-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
add_retag: ensure box-to-raw-ptr casts are preserved for Miri #122647
Conversation
Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt The Miri subtree was changed cc @rust-lang/miri |
&elaborate_box_derefs::ElaborateBoxDerefs, | ||
&coroutine::StateTransform, | ||
&add_retag::AddRetag, | ||
&Lint(known_panics_lint::KnownPanicsLint), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was not sure what to do with the pass order here. AddRetag
needs to be before ElaborateBoxDerefs
removes all traces of primitive Box derefs. Whether they should be before or after StateTransform
, I don't know. I decided to use the order which doesn't change anything on stable (where AddRetag
is a NOP).
65752d1
to
bcf8015
Compare
@bors r+ rollup thanks for the thorough explanations |
add_retag: ensure box-to-raw-ptr casts are preserved for Miri In rust-lang#122233 I added `retag_box_to_raw` not realizing that we can already do `addr_of_mut!(*bx)` to turn a box into a raw pointer without an intermediate reference. We just need to ensure this information is preserved past the ElaborateBoxDerefs pass. r? `@oli-obk`
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#122480 (Avoid various uses of `Option<Span>` in favor of using `DUMMY_SP` in the few cases that used `None`) - rust-lang#122567 (Remove fixme about LLVM basic block naming) - rust-lang#122588 (less useless filter calls in imported_source_file) - rust-lang#122647 (add_retag: ensure box-to-raw-ptr casts are preserved for Miri) - rust-lang#122649 (Update the minimum external LLVM to 17) - rust-lang#122680 (Do not eat nested expressions' results in `MayContainYieldPoint` format args visitor) - rust-lang#122683 (add missing test: expected paren or brace in macro) - rust-lang#122689 (Add missing `try_visit` calls in visitors.) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#122647 - RalfJung:box-to-raw-retag, r=oli-obk add_retag: ensure box-to-raw-ptr casts are preserved for Miri In rust-lang#122233 I added `retag_box_to_raw` not realizing that we can already do `addr_of_mut!(*bx)` to turn a box into a raw pointer without an intermediate reference. We just need to ensure this information is preserved past the ElaborateBoxDerefs pass. r? ``@oli-obk``
Box::into_raw: make Miri understand that this is a box-to-raw cast Turns out rust-lang#122647 went a bit too far in cleaning up `Box`... we still need a hack in `Box::into_raw`. The nicer fix would be to make Stacked Borrows not care about reference-to-raw-pointer casts, but it's unclear whether that will ever be possible without going to full Tree Borrows. Fixes rust-lang/miri#3473.
Rollup merge of rust-lang#124013 - RalfJung:box-to-raw, r=oli-obk Box::into_raw: make Miri understand that this is a box-to-raw cast Turns out rust-lang#122647 went a bit too far in cleaning up `Box`... we still need a hack in `Box::into_raw`. The nicer fix would be to make Stacked Borrows not care about reference-to-raw-pointer casts, but it's unclear whether that will ever be possible without going to full Tree Borrows. Fixes rust-lang/miri#3473.
Box::into_raw: make Miri understand that this is a box-to-raw cast Turns out rust-lang/rust#122647 went a bit too far in cleaning up `Box`... we still need a hack in `Box::into_raw`. The nicer fix would be to make Stacked Borrows not care about reference-to-raw-pointer casts, but it's unclear whether that will ever be possible without going to full Tree Borrows. Fixes #3473.
In #122233 I added
retag_box_to_raw
not realizing that we can already doaddr_of_mut!(*bx)
to turn a box into a raw pointer without an intermediate reference. We just need to ensure this information is preserved past the ElaborateBoxDerefs pass.r? @oli-obk