mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-30 14:01:51 +00:00
Erase regions better in promote_candidate
This commit is contained in:
parent
2ed0f29168
commit
f94220f68e
@ -839,17 +839,12 @@ impl<'a, 'tcx> Promoter<'a, 'tcx> {
|
||||
let mut promoted_operand = |ty, span| {
|
||||
promoted.span = span;
|
||||
promoted.local_decls[RETURN_PLACE] = LocalDecl::new(ty, span);
|
||||
let substs = tcx.erase_regions(InternalSubsts::identity_for_item(tcx, def.did));
|
||||
let _const = tcx.mk_const(ty::ConstS {
|
||||
ty,
|
||||
kind: ty::ConstKind::Unevaluated(ty::Unevaluated {
|
||||
def,
|
||||
substs: InternalSubsts::for_item(tcx, def.did, |param, _| {
|
||||
if let ty::GenericParamDefKind::Lifetime = param.kind {
|
||||
tcx.lifetimes.re_erased.into()
|
||||
} else {
|
||||
tcx.mk_param_from_def(param)
|
||||
}
|
||||
}),
|
||||
substs,
|
||||
promoted: Some(promoted_id),
|
||||
}),
|
||||
});
|
||||
|
@ -0,0 +1,13 @@
|
||||
// check-pass
|
||||
// (this requires debug assertions)
|
||||
|
||||
#![feature(adt_const_params)]
|
||||
#![allow(incomplete_features)]
|
||||
|
||||
fn foo<const B: &'static bool>(arg: &'static bool) -> bool {
|
||||
B == arg
|
||||
}
|
||||
|
||||
fn main() {
|
||||
foo::<{ &true }>(&false);
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
// check-pass
|
||||
// (this requires debug assertions)
|
||||
|
||||
#![feature(adt_const_params)]
|
||||
#![allow(incomplete_features)]
|
||||
|
||||
pub const BAR: () = ice::<"">();
|
||||
pub const fn ice<const N: &'static str>() {
|
||||
&10;
|
||||
}
|
||||
|
||||
fn main() {}
|
Loading…
Reference in New Issue
Block a user