diff options
| author | Ralf Jung <post@ralfj.de> | 2022-08-26 08:08:10 -0400 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2022-08-26 08:15:29 -0400 |
| commit | b85178a5fccb0d582fdbf23625c531af170cc882 (patch) | |
| tree | 4a08740d85ce9d4fc3bdb908768f4c76f719eacb /compiler/rustc_const_eval/src | |
| parent | 983f4daddf238d114c4adc4751c5528fc6695a5a (diff) | |
| download | rust-b85178a5fccb0d582fdbf23625c531af170cc882.tar.gz rust-b85178a5fccb0d582fdbf23625c531af170cc882.zip | |
no alignment check during interning
Diffstat (limited to 'compiler/rustc_const_eval/src')
| -rw-r--r-- | compiler/rustc_const_eval/src/const_eval/eval_queries.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_const_eval/src/const_eval/machine.rs | 6 |
2 files changed, 5 insertions, 3 deletions
diff --git a/compiler/rustc_const_eval/src/const_eval/eval_queries.rs b/compiler/rustc_const_eval/src/const_eval/eval_queries.rs index 5cfa63bd105..371f2cfab1e 100644 --- a/compiler/rustc_const_eval/src/const_eval/eval_queries.rs +++ b/compiler/rustc_const_eval/src/const_eval/eval_queries.rs @@ -74,7 +74,9 @@ fn eval_body_using_ecx<'mir, 'tcx>( None => InternKind::Constant, } }; + ecx.machine.check_alignment = false; // interning doesn't need to respect alignment intern_const_alloc_recursive(ecx, intern_kind, &ret)?; + // we leave alignment checks off, since this `ecx` will not be used for further evaluation anyway debug!("eval_body_using_ecx done: {:?}", *ret); Ok(ret) diff --git a/compiler/rustc_const_eval/src/const_eval/machine.rs b/compiler/rustc_const_eval/src/const_eval/machine.rs index f24b19089c1..7ad312a123a 100644 --- a/compiler/rustc_const_eval/src/const_eval/machine.rs +++ b/compiler/rustc_const_eval/src/const_eval/machine.rs @@ -89,10 +89,10 @@ pub struct CompileTimeInterpreter<'mir, 'tcx> { /// exhaustion error. /// /// Setting this to `0` disables the limit and allows the interpreter to run forever. - pub steps_remaining: usize, + pub(super) steps_remaining: usize, /// The virtual call stack. - pub(crate) stack: Vec<Frame<'mir, 'tcx, AllocId, ()>>, + pub(super) stack: Vec<Frame<'mir, 'tcx, AllocId, ()>>, /// We need to make sure consts never point to anything mutable, even recursively. That is /// relied on for pattern matching on consts with references. @@ -103,7 +103,7 @@ pub struct CompileTimeInterpreter<'mir, 'tcx> { pub(super) can_access_statics: bool, /// Whether to check alignment during evaluation. - check_alignment: bool, + pub(super) check_alignment: bool, } impl<'mir, 'tcx> CompileTimeInterpreter<'mir, 'tcx> { |
