about summary refs log tree commit diff
path: root/compiler/rustc_const_eval/src/transform
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2022-08-12 03:48:40 +0000
committerMichael Goulet <michael@errs.io>2022-08-12 03:48:40 +0000
commitf94220f68eeef7fb0a4a36f7e95f599b56e2b161 (patch)
treeaf741c2617b37aec9235d93d95bfb0e04dcb46a3 /compiler/rustc_const_eval/src/transform
parent2ed0f29168f5bc116e747152be600519b5d78bfd (diff)
downloadrust-f94220f68eeef7fb0a4a36f7e95f599b56e2b161.tar.gz
rust-f94220f68eeef7fb0a4a36f7e95f599b56e2b161.zip
Erase regions better in promote_candidate
Diffstat (limited to 'compiler/rustc_const_eval/src/transform')
-rw-r--r--compiler/rustc_const_eval/src/transform/promote_consts.rs9
1 files changed, 2 insertions, 7 deletions
diff --git a/compiler/rustc_const_eval/src/transform/promote_consts.rs b/compiler/rustc_const_eval/src/transform/promote_consts.rs
index ed4d8c95d1e..161c89e3242 100644
--- a/compiler/rustc_const_eval/src/transform/promote_consts.rs
+++ b/compiler/rustc_const_eval/src/transform/promote_consts.rs
@@ -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),
                     }),
                 });