1
Fork 0

place evaluation: require the original pointer to be aligned if an access happens

This commit is contained in:
Ralf Jung 2023-09-05 15:12:18 +02:00
parent ea9a24e32e
commit f3f9b795bd
22 changed files with 266 additions and 219 deletions

View file

@ -1,3 +1,5 @@
use std::mem;
use either::{Left, Right};
use rustc_hir::def::DefKind;
@ -73,9 +75,9 @@ fn eval_body_using_ecx<'mir, 'tcx>(
None => InternKind::Constant,
}
};
ecx.machine.check_alignment = CheckAlignment::No; // interning doesn't need to respect alignment
let check_alignment = mem::replace(&mut ecx.machine.check_alignment, CheckAlignment::No); // 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
ecx.machine.check_alignment = check_alignment;
debug!("eval_body_using_ecx done: {:?}", ret);
Ok(ret)