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
generator layout: ignore fake borrows #117712
Conversation
This PR changes MIR cc @oli-obk, @RalfJung, @JakobDegen, @davidtwco, @celinval, @vakaras Some changes occurred to the core trait solver cc @rust-lang/initiative-trait-system-refactor Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt This PR changes Stable MIR cc @oli-obk, @celinval, @spastorino, @ouz-a |
r? types |
Going to use a t-types fcp again, merging once the FCP period starts without waiting for 10 days. @rfcbot fcp merge |
Team member @lcnr has proposed to merge this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
This comment has been minimized.
This comment has been minimized.
r=me when FCP completes |
This comment has been minimized.
This comment has been minimized.
also adds some comments
dbb2914
to
92267c9
Compare
(checked the box for @oli-obk as they're currently not available) |
@rfcbot reviewed |
🔔 This is now entering its final comment period, as per the review above. 🔔 |
@bors r=jackh726 p=1 |
generator layout: ignore fake borrows fixes rust-lang#117059 We emit fake shallow borrows in case the scrutinee place uses a `Deref` and there is a match guard. This is necessary to prevent the match guard from mutating the scrutinee: https://github.com/rust-lang/rust/blob/fab1054e1742790c22ccc92a625736d658363677/compiler/rustc_mir_build/src/build/matches/mod.rs#L1250-L1265 These fake borrows end up impacting the generator witness computation in `mir_generator_witnesses`, which causes the issue in rust-lang#117059. This PR now completely ignores fake borrows during this computation. This is sound as thse are always removed after analysis and the actual computation of the generator layout happens afterwards. Only the second commit impacts behavior, and could be backported by itself. r? types
It is possible to only backport the second commit (after fixing the comment here which belongs in the next commit). However, T-compiler is fine with taking the whole PR as the rest of the rest of the changes are mechanical in nature. |
The job Click to see the possible cause of the failure (guessed by this bot)
|
💔 Test failed - checks-actions |
@bors retry seems spurious |
☀️ Test successful - checks-actions |
Finished benchmarking commit (b7583d3): comparison URL. Overall result: ✅ improvements - no action needed@rustbot label: -perf-regression Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 663.537s -> 662.476s (-0.16%) |
[beta] backports - dropck_outlives check whether generator witness needs_drop rust-lang#117134 - Make sure that predicates with unmentioned bound vars are still considered global in the old solver rust-lang#117589 - Check binders with bound vars for global bounds that don't hold rust-lang#117637 - generator layout: ignore fake borrows rust-lang#117712 r? ghost
[beta] backports - dropck_outlives check whether generator witness needs_drop rust-lang#117134 - Make sure that predicates with unmentioned bound vars are still considered global in the old solver rust-lang#117589 - Check binders with bound vars for global bounds that don't hold rust-lang#117637 - generator layout: ignore fake borrows rust-lang#117712 r? ghost
fixes #117059
We emit fake shallow borrows in case the scrutinee place uses a
Deref
and there is a match guard. This is necessary to prevent the match guard from mutating the scrutinee:rust/compiler/rustc_mir_build/src/build/matches/mod.rs
Lines 1250 to 1265 in fab1054
These fake borrows end up impacting the generator witness computation in
mir_generator_witnesses
, which causes the issue in #117059. This PR now completely ignores fake borrows during this computation. This is sound as thse are always removed after analysis and the actual computation of the generator layout happens afterwards.Only the second commit impacts behavior, and could be backported by itself.
r? types