Skip to content

Commit 9a63fc8

Browse files
committed
Promoteds always have a backing allocation
1 parent db168bc commit 9a63fc8

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/librustc_codegen_ssa/mir/place.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -416,11 +416,8 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
416416
};
417417
let layout = cx.layout_of(self.monomorphize(&ty));
418418
match bx.tcx().const_eval(param_env.and(cid)) {
419-
Ok(val) => match val.val {
420-
mir::interpret::ConstValue::ByRef => {
421-
let (alloc, ptr) = val.alloc.unwrap();
422-
bx.cx().from_const_alloc(layout, alloc, ptr.offset)
423-
}
419+
Ok(val) => match val.alloc {
420+
Some((alloc, ptr)) => bx.cx().from_const_alloc(layout, alloc, ptr.offset),
424421
_ => bug!("promoteds should have an allocation: {:?}", val),
425422
},
426423
Err(_) => {

0 commit comments

Comments
 (0)