rust-lang / miri

An interpreter for Rust's mid-level intermediate representation
Apache License 2.0
4.2k stars 324 forks source link

Miri could respect `-Zbox-noalias=no` #2729

Open CAD97 opened 1 year ago

CAD97 commented 1 year ago

-Zmiri-retag-fields=scalar is roughly explained as retagging where rustc emits noalias attributes. For this to be accurate, Box shouldn't cause retagging when -Zbox-noalias=no, since setting this (experimental) rustc flag disables emitting noalias for Box.

RalfJung commented 1 year ago

-Zmiri-retag-fields=scalar is roughly explained as retagging where rustc emits noalias attributes.

That's a motivation for the choice of behavior, but not a spec.

I don't think it makes sense to tie retag-fields and box-noalias together in any way. However we could consider making Miri respect box-noalias, completely independent of retag-fields.

Note however that retagging justifies both the noalias and dereferenceable attributes. For Box this is fine though since we already don't add dereferenceable.