Rollup merge of #58511 - oli-obk:const_to_op, r=RalfJung

Const to op simplification

r? @RalfJung

alternative to https://github.com/rust-lang/rust/pull/58486
This commit is contained in:
Mazdak Farrokhzad 2019-02-24 05:56:01 +01:00 committed by GitHub
commit 1082a292ea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 117 additions and 126 deletions

View file

@ -71,7 +71,7 @@ pub fn codegen_static_initializer(
let static_ = cx.tcx.const_eval(param_env.and(cid))?;
let alloc = match static_.val {
ConstValue::ByRef(_, alloc, n) if n.bytes() == 0 => alloc,
ConstValue::ByRef(ptr, alloc) if ptr.offset.bytes() == 0 => alloc,
_ => bug!("static const eval returned {:#?}", static_),
};
Ok((const_alloc_to_llvm(cx, alloc), alloc))