-
Notifications
You must be signed in to change notification settings - Fork 341
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Experiment idea: -Zmiri-unique-library-types
to control treating Box
and Vec
as Uniq
retaggers
#2728
Comments
Not currently. Stacked Borrows does not support We're currently working on a next aliasing model, which should support this, and then we can consider making |
If such crates actually start to be a thing we should consider removing the flag from rustc, IMO. Certainly I don't want Miri to support such an ecosystem split. |
To be clear, I don't expect any crates to actually be using Footnotes
|
This exists now in Tree Borrows, kind of: |
Currently, rustc tags
Box
asnoalias
, so the default behavior of Miri is to treat movingBox
as aUniq
SB retag, invalidating any pointers to its interior.[
Raw
]Vec
is built on the same internalptr::Unique
. It has been considered if treatingVec
asUniq
as well, though the fallout from doing so is very likely (and iirc, there was an experiment showing it to be) to make more programs UB than withBox
.Would it be possible/reasonable to expose a miri flag to treat
Vec
's pointer as unique? This wouldn't have any impact without also setting-Zmiri-retag-fields=all
sinceVec
is larger than a scalar pair, but I'd like to be able to put Miri into super pedantic mode when testing my ownunsafe
code which should ideally be valid even under this extremely strict interpretation.In short, I would like a (combination of) flags that allows the following snippet to be diagnosed as UB. By my understanding of the current SB rules, under the strictest form (always doing field retagging,
ptr::Unique
is unique), it is. Even if this is stricter than we end up actually adopting, I think having the ability to diagnose this as potential UB is a useful tool in making the decision, since it allows us to quantify how much crater-visible miri-testable code (doesn't have other issues and) is usingVec
as a stand-in forRFC3336<Pin<Vec<_>>>
.The flag could also allow more crates to benefit from Miri testing coverage with field retagging even if they're implicitly relying on
-Zbox-noalias=no
, if it allows opting out ofUniq
retagging onBox
(though obviously doing so would currently be unsound).The text was updated successfully, but these errors were encountered: