1
Fork 0

Auto merge of #131006 - RalfJung:immediate-sanity, r=saethlin

interpret: always enable write_immediate sanity checks

Writing a wrongly-sized scalar somewhere can have quite confusing effects. Let's see how expensive it is to catch this early.
This commit is contained in:
bors 2024-10-02 22:12:06 +00:00
commit 9c7013c15c
2 changed files with 6 additions and 3 deletions

View file

@ -118,6 +118,7 @@ impl<Prov: Provenance> Immediate<Prov> {
(Immediate::Scalar(scalar), Abi::Scalar(s)) => {
assert_eq!(scalar.size(), s.size(cx));
if !matches!(s.primitive(), abi::Pointer(..)) {
// This is not a pointer, it should not carry provenance.
assert!(matches!(scalar, Scalar::Int(..)));
}
}