generator layout: ignore fake borrows by lcnr · Pull Request #117712 · rust-lang/rust (original) (raw)
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
[ Show hidden characters]({{ revealButtonHref }})
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:
| // Insert a borrows of prefixes of places that are bound and are |
|---|
| // behind a dereference projection. |
| // |
| // These borrows are taken to avoid situations like the following: |
| // |
| // match x[10] { |
| // _ if { x = &[0]; false } => (), |
| // y => (), // Out of bounds array access! |
| // } |
| // |
| // match *x { |
| // // y is bound by reference in the guard and then by copy in the |
| // // arm, so y is 2 in the arm! |
| // y if { y == 1 && (x = &2) == () } => y, |
| // _ => 3, |
| // } |
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
lcnr added the beta-nominated
Nominated for backporting to the compiler in the beta channel.
label
Relevant to the types team, which will review and decide on the PR/issue.
label
lcnr removed the T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
label
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.
(checked the box for @oli-obk as they're currently not available)
rfcbot added the final-comment-period
In the final comment period and will be merged soon unless new substantive objections are raised.
label
🔔 This is now entering its final comment period, as per the review above. 🔔
bors added a commit to rust-lang-ci/rust that referenced this pull request
Beta backport accepted as per compiler team on Zulip
@rustbot label +beta-accepted
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 x86_64-apple-1 failed! Check out the build log: (web) (plain)
Click to see the possible cause of the failure (guessed by this bot)
SCCACHE_BUCKET=rust-lang-ci-sccache2
SCRIPT=./x.py --stage 2 test --skip tests/ui --skip tests/rustdoc --skip tests/run-make-fulldeps
SHELL=/bin/bash
SHLVL=3
SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.A9bQDgyjTu/Listeners
STATS_EXT=true
STATS_EXTP=https://provjobdsettingscdn.blob.core.windows.net/settings/provjobdsettings-0.5.154/provjobd.data
STATS_RDCL=true
STATS_TIS=mining
bors added S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
and removed S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
labels
@bors retry
seems spurious
bors added S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
and removed S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
labels
bors mentioned this pull request
Finished benchmarking commit (b7583d3): comparison URL.
Overall result: ✅ improvements - no action needed
@rustbot label: -perf-regression
Instruction count
This is a highly reliable metric that was used to determine the overall result at the top of this comment.
| mean | range | count | |
|---|---|---|---|
| Regressions ❌ (primary) | - | - | 0 |
| Regressions ❌ (secondary) | - | - | 0 |
| Improvements ✅ (primary) | -0.4% | [-0.4%, -0.4%] | 1 |
| Improvements ✅ (secondary) | - | - | 0 |
| All ❌✅ (primary) | -0.4% | [-0.4%, -0.4%] | 1 |
Max RSS (memory usage)
Results
This 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.
| mean | range | count | |
|---|---|---|---|
| Regressions ❌ (primary) | 0.6% | [0.4%, 0.9%] | 7 |
| Regressions ❌ (secondary) | - | - | 0 |
| Improvements ✅ (primary) | -0.6% | [-0.7%, -0.5%] | 4 |
| Improvements ✅ (secondary) | - | - | 0 |
| All ❌✅ (primary) | 0.2% | [-0.7%, 0.9%] | 11 |
Cycles
Results
This 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.
| mean | range | count | |
|---|---|---|---|
| Regressions ❌ (primary) | - | - | 0 |
| Regressions ❌ (secondary) | - | - | 0 |
| Improvements ✅ (primary) | -0.4% | [-0.5%, -0.4%] | 2 |
| Improvements ✅ (secondary) | -13.6% | [-13.8%, -13.4%] | 2 |
| All ❌✅ (primary) | -0.4% | [-0.5%, -0.4%] | 2 |
Binary size
This benchmark run did not return any relevant results for this metric.
Bootstrap: 663.537s -> 662.476s (-0.16%)
Artifact size: 308.81 MiB -> 308.77 MiB (-0.01%)
lcnr deleted the expand-coroutine branch
bors added a commit to rust-lang-ci/rust that referenced this pull request
[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
bors added a commit to rust-lang-ci/rust that referenced this pull request
[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
celinval added a commit to celinval/rust-dev that referenced this pull request
Update Rust toolchain from nightly-2023-11-09 to nightly-2023-11-10
without any other source changes.
This is an automatically generated pull request. If any of the CI checks
fail, manual intervention is required. In such a case, review the
changes at https://github.com/rust-lang/rust from
rust-lang@fdaaaf9
up to
rust-lang@0f44eb3.
The log for this commit range is:
rust-lang@0f44eb32f1 Auto merge of
rust-lang#117727 - saethlin:inline-derived-fmt, r=nnethercote
rust-lang@eae4135939 Auto merge of
rust-lang#117708 - onur-ozkan:x-setup, r=clubby789
rust-lang@4c8862b263 Auto merge of
rust-lang#117122 - ferrocene:pa-configure-git-diff, r=albertlarsan68
rust-lang@d32d9238cf Emit #[inline] on
derive(Debug)
rust-lang@b7583d38b7 Auto merge of
rust-lang#117712 - lcnr:expand-coroutine, r=jackh726
rust-lang@488dd9bc73 fmt
rust-lang@e7998aa21f Auto merge of
rust-lang#117734 - nnethercote:rm-Zstrip, r=davidtwco
rust-lang@287ae4db75 Auto merge of
rust-lang#117632 - Nilstrieb:icup, r=davidtwco
rust-lang@492e57c6ad Auto merge of
rust-lang#117736 - TaKO8Ki:rollup-fjrtmlb, r=TaKO8Ki
rust-lang@d1e26401bc chore(bootstrap):
capitalize {error, warning, info, note} tags
rust-lang@42fbf3ebf5 allow users to
override the existing configuration during x setup
rust-lang@3d6417fc7a check config file
before prompts on x setup
rust-lang@f5195c52bb Rollup merge of
rust-lang#117724 - Kobzol:shim-error-message, r=onur-ozkan
rust-lang@e603f4491c Rollup merge of
rust-lang#117723 - onur-ozkan:keep-bootstrap-on-x-clean, r=albertlarsan68
rust-lang@6533c62ce7 Rollup merge of
rust-lang#117705 - tshepang:patch-2, r=Nilstrieb
rust-lang@b4fa5b7004 Rollup merge of
rust-lang#117694 - jmillikin:core-io-borrowed-buf, r=m-ou-se
rust-lang@4cc549811f Rollup merge of
rust-lang#117645 - compiler-errors:auto-trait-subst, r=petrochenkov
rust-lang@a1a8d6fe9c Rollup merge of
rust-lang#116762 - WaffleLapkin:fixup_fromptr_docs, r=RalfJung
rust-lang@d8dbf7ca0e Auto merge of
rust-lang#117557 - Zoxc:panic-prio, r=petrochenkov
rust-lang@ecc936b155 Remove -Z strip.
rust-lang@57fb1e643a Auto merge of
rust-lang#117454 - shepmaster:github-actions-m1-tests,
r=GuillaumeGomez,onur-ozkan
rust-lang@341c85648c Move BorrowedBuf
and BorrowedCursor from std:io to core::io
rust-lang@92267c9794 update mir-opt tests
rust-lang@992d93f687 rename
BorrowKind::Shallow to Fake
rust-lang@a42eca42df generator layout:
ignore fake borrows
rust-lang@622be2d138 Restore rustc shim
error message
rust-lang@de0458af97 speed up x clean
rust-lang@6909992501 Run tests in CI for
aarch64-apple-darwin
rust-lang@64090536d4 Install tidy for
aarch64-apple-darwin
rust-lang@469d34b39b Mark Rustdoc test as
Linux-only
rust-lang@bf360d407e instrument
constituent types computation
rust-lang@03435e6fdd accept review
suggestion
rust-lang@769ad29c3e triagebot.toml: use
inclusive language
rust-lang@102384523a Document how rust
atomics work wrt mixed-sized and non-atomic accesses
rust-lang@c17d33f1df Extend builtin/auto
trait args with error when they have >1 argument
rust-lang@580fa0c1a9 rename
github_repository to git_repository
rust-lang@ffffc2038f Update ICU4X
rust-lang@ff1858e2aa Make
FatalErrorMarker lower priority than other panics
rust-lang@4a0873533f update suggest-tests
rust-lang@5a562d962e pass the correct
args to compiletest
rust-lang@545cc830e1 allow configuring
the parent GitHub repository
Co-authored-by: celinval celinval@users.noreply.github.com