Pacify tidy

This commit is contained in:
Oliver Scherer 2019-06-19 20:17:09 +02:00
parent cdf5596502
commit 3dfe017dc3
2 changed files with 9 additions and 6 deletions

View File

@ -45,11 +45,12 @@ pub enum ConstValue<'tcx> {
/// An value not represented/representable by `Scalar` or `Slice` /// An value not represented/representable by `Scalar` or `Slice`
ByRef { ByRef {
/// The alignment exists to allow `const_field` to have `ByRef` access to nonprimitive fields /// The alignment exists to allow `const_field` to have `ByRef` access to nonprimitive
/// of `repr(packed)` structs. The alignment may be lower than the type of this constant. /// fields of `repr(packed)` structs. The alignment may be lower than the type of this
/// This permits reads with lower alignment than what the type would normally require. /// constant. This permits reads with lower alignment than what the type would normally
/// FIXME(RalfJ,oli-obk): The alignment checks are part of miri, but const eval doesn't really /// require.
/// need them. Disabling them may be too hard though. /// FIXME(RalfJ,oli-obk): The alignment checks are part of miri, but const eval doesn't
/// really need them. Disabling them may be too hard though.
align: Align, align: Align,
/// Offset into `alloc` /// Offset into `alloc`
offset: Size, offset: Size,

View File

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