Open
Description
Even with C: StableDeref
, moving the cart can potentially invalidate the yoke.
However, miri does not by default report any errors when using yoke. This is due to the fact that miri's aliasing analysis/retagging does not by-default recurse into private fields, so the box's uniqueness is never asserted, along with never giving mutable access to the carted data meaning uniqueness never needs to be asserted. -Zmiri-retag-fields
exists to opt into the retagging of fields, which will surface this potential UB.
This is mostly to note that this potential issue is known; feel free to close if this is considered a non-issue.
Related:
- OwningRef is in conflict with
noalias
Kimundi/owning-ref-rs#49 - Soundness problems? Storyyeller/stable_deref_trait#15
- Stacked Borrows: Retag (private) fields of ADTs? rust-lang/unsafe-code-guidelines#125
- Stacked Borrows vs inner pointers into "stable-deref" types rust-lang/unsafe-code-guidelines#194
- What are the uniqueness guarantees of Box and Vec? rust-lang/unsafe-code-guidelines#326
- MaybeDangling rust-lang/rfcs#3336