rust/compiler/rustc_const_eval/src/interpret
Matthias Krüger bc0262d0f1
Rollup merge of #143327 - RalfJung:miri-type-validity-error, r=oli-obk
miri: improve errors for type validity assertion failures

Miri has pretty nice errors for type validity violations, printing which field in the type the problem occurs at and so on.

However, we don't see these errors when using e.g. `mem::zeroed` as that uses `assert_zero_valid` to bail out before Miri can detect the UB.

Similar to what we did with `@saethlin's` UB checks, I think we should disable such language UB checks in Miri so that we can get better error messages. If we go for this we should probably say this in the intrinsic docs as well so that people don't think they can rely on these intrinsics catching anything.

Furthermore, I slightly changed `MaybeUninit::assume_init` so that the `.value` field does not show up in error messages any more.

`@rust-lang/miri` what do you think?
2025-07-03 05:21:36 +02:00
..
call.rs Remove support for dyn* 2025-07-01 19:00:21 +00:00
cast.rs Remove support for dyn* 2025-07-01 19:00:21 +00:00
discriminant.rs Add InterpCx::layout_of with tracing, shadowing LayoutOf 2025-06-27 11:49:22 +02:00
eval_context.rs Rollup merge of #143046 - RalfJung:zst-unsafe-cell, r=lcnr,oli-obk 2025-06-27 22:13:05 +02:00
intern.rs const_eval: fix some outdated comments 2025-06-10 11:45:38 +02:00
intrinsics.rs miri: improve errors for type validity assertion failures 2025-07-02 17:47:46 +02:00
machine.rs rename Pointer::from_addr_invalid to match strict provenance API 2025-06-29 00:16:19 +02:00
memory.rs interpret: move the native call preparation logic into Miri 2025-07-02 14:25:11 +02:00
mod.rs Remove the nullary intrinsic const eval logic and treat them like other intrinsics 2025-06-30 08:04:40 +00:00
operand.rs Add InterpCx::layout_of with tracing, shadowing LayoutOf 2025-06-27 11:49:22 +02:00
operator.rs Add InterpCx::layout_of with tracing, shadowing LayoutOf 2025-06-27 11:49:22 +02:00
place.rs rename Pointer::from_addr_invalid to match strict provenance API 2025-06-29 00:16:19 +02:00
projection.rs Rollup merge of #143046 - RalfJung:zst-unsafe-cell, r=lcnr,oli-obk 2025-06-27 22:13:05 +02:00
stack.rs Remove support for dyn* 2025-07-01 19:00:21 +00:00
step.rs Update InterpCx::project_field to take FieldIdx 2025-06-05 19:15:56 -07:00
traits.rs Remove support for dyn* 2025-07-01 19:00:21 +00:00
util.rs Fix enter_trace_span!() using wrong $crate paths 2025-06-11 12:22:20 +02:00
validity.rs Remove support for dyn* 2025-07-01 19:00:21 +00:00
visitor.rs Remove support for dyn* 2025-07-01 19:00:21 +00:00