Skip to content
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

Make if let guard parsing consistent with normal guards #115371

Merged
merged 2 commits into from Sep 6, 2023

Conversation

matthewjasper
Copy link
Contributor

  • Add tests that struct expressions are not allowed in if let and while let (no change, consistent with if and while)
  • Allow struct expressions in if let guards (consistent with if guards).

r? @cjgillot

Closes #93817
cc #51114

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 30, 2023
@cjgillot
Copy link
Contributor

cjgillot commented Sep 2, 2023

@bors r+

@bors
Copy link
Contributor

bors commented Sep 2, 2023

📌 Commit 89235fd has been approved by cjgillot

It is now in the queue for this repository.

@bors 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 Sep 2, 2023
@bors
Copy link
Contributor

bors commented Sep 2, 2023

⌛ Testing commit 89235fd with merge 82cd0ff640a6d93e92e52bd11bb20ac8071f3b06...

@rust-log-analyzer
Copy link
Collaborator

The job x86_64-apple-2 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)

---- [ui] tests/ui/issues/issue-30490.rs stdout ----

error: test compilation failed although it shouldn't!
status: signal: 11 (SIGSEGV)
command: RUSTC_ICE="0" "/Users/runner/work/rust/rust/build/x86_64-apple-darwin/stage2/bin/rustc" "/Users/runner/work/rust/rust/tests/ui/issues/issue-30490.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "--sysroot" "/Users/runner/work/rust/rust/build/x86_64-apple-darwin/stage2" "--target=x86_64-apple-darwin" "-O" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "-C" "prefer-dynamic" "-o" "/Users/runner/work/rust/rust/build/x86_64-apple-darwin/test/ui/issues/issue-30490/a" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/Users/runner/work/rust/rust/build/x86_64-apple-darwin/native/rust-test-helpers" "-L" "/Users/runner/work/rust/rust/build/x86_64-apple-darwin/test/ui/issues/issue-30490/auxiliary"
stderr: none


---- [ui] tests/ui/issues/issue-40288.rs stdout ----
---- [ui] tests/ui/issues/issue-40288.rs stdout ----

error: Error: expected failure status (Some(1)) but received status None.
status: signal: 6 (SIGABRT)
command: RUSTC_ICE="0" "/Users/runner/work/rust/rust/build/x86_64-apple-darwin/stage2/bin/rustc" "/Users/runner/work/rust/rust/tests/ui/issues/issue-40288.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "--sysroot" "/Users/runner/work/rust/rust/build/x86_64-apple-darwin/stage2" "--target=x86_64-apple-darwin" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/Users/runner/work/rust/rust/build/x86_64-apple-darwin/test/ui/issues/issue-40288" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/Users/runner/work/rust/rust/build/x86_64-apple-darwin/native/rust-test-helpers" "-L" "/Users/runner/work/rust/rust/build/x86_64-apple-darwin/test/ui/issues/issue-40288/auxiliary"
--- stderr -------------------------------
--- stderr -------------------------------
error[E0506]: cannot assign to `*refr` because it is borrowed
   |
   |
LL |     save_ref(&*refr, &mut out);
   |              ------ `*refr` is borrowed here
...
LL |     *refr = 3; //~ ERROR cannot assign to `*refr` because it is borrowed
   |     ^^^^^^^^^ `*refr` is assigned to here but it was already borrowed
LL |     println!("{:?}", out[0]);
   |                      ------ borrow later used here

error: aborting due to previous error

@bors
Copy link
Contributor

bors commented Sep 2, 2023

💔 Test failed - checks-actions

@bors 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 Sep 2, 2023
@cjgillot cjgillot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 3, 2023
@ehuss
Copy link
Contributor

ehuss commented Sep 3, 2023

@bors r-

bors synchronize fixing the queue

@matthewjasper
Copy link
Contributor Author

@bors r=cjgillot

@bors
Copy link
Contributor

bors commented Sep 5, 2023

📌 Commit 89235fd has been approved by cjgillot

It is now in the queue for this repository.

@bors 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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Sep 5, 2023
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Sep 5, 2023
…, r=cjgillot

Make if let guard parsing consistent with normal guards

- Add tests that struct expressions are not allowed in `if let` and `while let` (no change, consistent with `if` and `while`)
- Allow struct expressions in `if let` guards (consistent with `if` guards).

r? `@cjgillot`

Closes rust-lang#93817
cc rust-lang#51114
@bors
Copy link
Contributor

bors commented Sep 6, 2023

⌛ Testing commit 89235fd with merge 25283f4...

@bors
Copy link
Contributor

bors commented Sep 6, 2023

☀️ Test successful - checks-actions
Approved by: cjgillot
Pushing 25283f4 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Sep 6, 2023
@bors bors merged commit 25283f4 into rust-lang:master Sep 6, 2023
12 checks passed
@rustbot rustbot added this to the 1.74.0 milestone Sep 6, 2023
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (25283f4): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

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
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-1.6% [-1.9%, -1.4%] 3
All ❌✅ (primary) - - 0

Cycles

This benchmark run did not return any relevant results for this metric.

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 628.364s -> 628.843s (0.08%)
Artifact size: 316.22 MiB -> 316.24 MiB (0.01%)

@matthewjasper matthewjasper deleted the if-let-guard-parsing branch September 6, 2023 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Struct literals are forbidden in MatchExpressions (feature(if_let_guard))
7 participants