rust/compiler/rustc_const_eval/src/interpret
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
..
cast.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
discriminant.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
eval_context.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
intern.rs rename CompileTimeInterpreter -> CompileTimeMachine, CompileTimeEvalContext -> CompileTimeInterpCx 2024-06-13 20:30:11 +02:00
intrinsics.rs Rollup merge of #128277 - RalfJung:offset_from_wildcard, r=oli-obk 2024-07-29 11:42:34 +02:00
machine.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
memory.rs Rollup merge of #128277 - RalfJung:offset_from_wildcard, r=oli-obk 2024-07-29 11:42:34 +02:00
mod.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
operand.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
operator.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
place.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
projection.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
step.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
terminator.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
traits.rs interpret: add sanity check in dyn upcast to double-check what codegen does 2024-07-18 11:41:10 +02:00
util.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
validity.rs Rollup merge of #128277 - RalfJung:offset_from_wildcard, r=oli-obk 2024-07-29 11:42:34 +02:00
visitor.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00