UnsafePinned: implement coroutine lowering changes#152946
UnsafePinned: implement coroutine lowering changes#152946b-naber wants to merge 6 commits intorust-lang:mainfrom
Conversation
|
Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
|
r? @mati865 rustbot has assigned @mati865. Use Why was this reviewer chosen?The reviewer was selected based on:
|
This comment has been minimized.
This comment has been minimized.
50482bd to
b226e46
Compare
…rk-Simulacrum extend unpin noalias tests to cover mutable references rust-lang#152946 made a change to the logic for this attribute that the test should have flagged as problematic -- but the test only checked `Box`, not `&mut`, and those have independent code paths. So extend the test to also cover `&mut`. @b-naber would be nice if you could confirm that the added tests do fail with your PR.
Rollup merge of #152970 - RalfJung:unpin-noalias-tests, r=Mark-Simulacrum extend unpin noalias tests to cover mutable references #152946 made a change to the logic for this attribute that the test should have flagged as problematic -- but the test only checked `Box`, not `&mut`, and those have independent code paths. So extend the test to also cover `&mut`. @b-naber would be nice if you could confirm that the added tests do fail with your PR.
|
I'm not a good fit for this code, perhaps r? @RalfJung ? Feel free to reroll |
|
|
|
Definitely not, I don't know the coroutine lowering code at all. @rustbot reroll |
|
@cjgillot Could you maybe review this? |
b226e46 to
d8b3c3d
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
This comment has been minimized.
This comment has been minimized.
d8b3c3d to
3d40415
Compare
…crum extend unpin noalias tests to cover mutable references rust-lang/rust#152946 made a change to the logic for this attribute that the test should have flagged as problematic -- but the test only checked `Box`, not `&mut`, and those have independent code paths. So extend the test to also cover `&mut`. @b-naber would be nice if you could confirm that the added tests do fail with your PR.
|
@rustbot author |
Sorry for the confusion. I think you are right, the That analyis also takes into account raw pointers. We only take the information from that analysis into account when calculating the |
|
Movable coroutines indeed should not get any UnsafePinned.
|
3d40415 to
30322eb
Compare
This comment has been minimized.
This comment has been minimized.
|
That test failing is a great sign! Quoting from the test description |
|
The Miri subtree was changed cc @rust-lang/miri |
| //! FIXME: This test should pass! However, `async fn` does not yet use `UnsafePinned`. | ||
| //! This is a regression test for <https://github.com/rust-lang/rust/issues/137750>: | ||
| //! `UnsafePinned` must include the effects of `UnsafeCell`. | ||
| // run-pass |
There was a problem hiding this comment.
This comment does nothing, please remove it. (Why did you even add this? Even in the rustc ui test suite this would do nothing. It's spelled // @run-pass there. But the Miri test suite is a little different.)
There was a problem hiding this comment.
There's another test that uses this: https://github.com/rust-lang/rust/blob/main/src/tools/miri/tests/pass/packed-struct-dyn-trait.rs, which is why I used this.
There was a problem hiding this comment.
Ah, not sure how that snuck in, thanks for pointing that out. But you'll notice most pass tests don't have such an annotation.
3733432 to
4998cf2
Compare
This comment has been minimized.
This comment has been minimized.
|
Some changes occurred in src/tools/clippy cc @rust-lang/clippy |
|
@rustbot ready |
This comment has been minimized.
This comment has been minimized.
f5e7edd to
3f2a21b
Compare
This comment has been minimized.
This comment has been minimized.
3f2a21b to
8129bdb
Compare
This comment has been minimized.
This comment has been minimized.
8129bdb to
4df37a6
Compare
View all comments
Implements the lowering part for #125735
This introduces a visitor that looks for self-referential fields in the coroutine struct and wraps all of these types into UnsafePinned. I've also included a commit where we change the condition for using noalias. That change is based on my understanding of the RFC, but is likely wrong given the change in #151365. I've included it for now to further discuss this.
cc @RalfJung