1
Fork 0
rust/compiler/rustc_const_eval/src
Matthias Krüger eb8114bad7
Rollup merge of #128277 - RalfJung:offset_from_wildcard, r=oli-obk
miri: fix offset_from behavior on wildcard pointers

offset_from wouldn't behave correctly when the "end" pointer was a wildcard pointer (result of an int2ptr cast) just at the end of the allocation. Fix that by expressing the "same allocation" check in terms of two `check_ptr_access_signed` instead of something specific to offset_from, which is both more canonical and works better with wildcard pointers.

The second commit just improves diagnostics: I wanted the "pointer is dangling (has no provenance)" message to say how many bytes of memory it expected to see (since if it were 0 bytes, this would actually be legal, so it's good to tell the user that it's not 0 bytes). And then I was annoying that the error looks so different for when you deref a dangling pointer vs an out-of-bounds pointer so I made them more similar.

Fixes https://github.com/rust-lang/miri/issues/3767
2024-07-29 11:42:34 +02:00
..
check_consts Reformat use declarations. 2024-07-29 08:26:52 +10:00
const_eval Reformat use declarations. 2024-07-29 08:26:52 +10:00
interpret Rollup merge of #128277 - RalfJung:offset_from_wildcard, r=oli-obk 2024-07-29 11:42:34 +02:00
util Reformat use declarations. 2024-07-29 08:26:52 +10:00
errors.rs Rollup merge of #128277 - RalfJung:offset_from_wildcard, r=oli-obk 2024-07-29 11:42:34 +02:00
lib.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00