diff --git a/src/librustc_mir/transform/promote_consts.rs b/src/librustc_mir/transform/promote_consts.rs index 90393ec6c8c8..f058ac834ef3 100644 --- a/src/librustc_mir/transform/promote_consts.rs +++ b/src/librustc_mir/transform/promote_consts.rs @@ -930,11 +930,11 @@ impl<'a, 'tcx> Promoter<'a, 'tcx> { let span = statement.source_info.span; let ref_ty = tcx.mk_ref( - tcx.lifetimes.re_static, + tcx.lifetimes.re_erased, ty::TypeAndMut { ty, mutbl: borrow_kind.to_mutbl_lossy() }, ); - *region = tcx.lifetimes.re_static; + *region = tcx.lifetimes.re_erased; let mut projection = vec![PlaceElem::Deref]; projection.extend(place.projection); @@ -958,7 +958,7 @@ impl<'a, 'tcx> Promoter<'a, 'tcx> { self.extra_statements.push((loc, promoted_ref_statement)); Rvalue::Ref( - tcx.lifetimes.re_static, + tcx.lifetimes.re_erased, borrow_kind, Place { local: mem::replace(&mut place.local, promoted_ref),