1
Fork 0

Make alignment checks a future incompat lint

This commit is contained in:
Oli Scherer 2022-11-21 16:51:16 +00:00
parent ed71e32e14
commit d66824dbc4
13 changed files with 180 additions and 70 deletions

View file

@ -6,6 +6,7 @@ use std::cell::Cell;
use either::Right;
use rustc_ast::Mutability;
use rustc_const_eval::const_eval::CheckAlignment;
use rustc_data_structures::fx::FxHashSet;
use rustc_hir::def::DefKind;
use rustc_index::bit_set::BitSet;
@ -186,10 +187,10 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> for ConstPropMachine<'mir, 'tcx>
type MemoryKind = !;
#[inline(always)]
fn enforce_alignment(_ecx: &InterpCx<'mir, 'tcx, Self>) -> bool {
fn enforce_alignment(_ecx: &InterpCx<'mir, 'tcx, Self>) -> CheckAlignment {
// We do not check for alignment to avoid having to carry an `Align`
// in `ConstValue::ByRef`.
false
CheckAlignment::No
}
#[inline(always)]

View file

@ -2,6 +2,7 @@
//!
//! Currently, this pass only propagates scalar values.
use rustc_const_eval::const_eval::CheckAlignment;
use rustc_const_eval::interpret::{ConstValue, ImmTy, Immediate, InterpCx, Scalar};
use rustc_data_structures::fx::FxHashMap;
use rustc_middle::mir::visit::{MutVisitor, Visitor};
@ -448,7 +449,7 @@ impl<'mir, 'tcx> rustc_const_eval::interpret::Machine<'mir, 'tcx> for DummyMachi
type MemoryKind = !;
const PANIC_ON_ALLOC_FAIL: bool = true;
fn enforce_alignment(_ecx: &InterpCx<'mir, 'tcx, Self>) -> bool {
fn enforce_alignment(_ecx: &InterpCx<'mir, 'tcx, Self>) -> CheckAlignment {
unimplemented!()
}