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

Test the borrowck behavior of if-let guards #106005

Merged
merged 1 commit into from
Jan 3, 2023

Conversation

LeSeulArtichaut
Copy link
Contributor

Add some tests to make sure that if-let guards behave the same as if guards with respect to borrow-checking. Most of them are a naive adaptation, replacing an if guard with if let Some(()).
This includes regression tests for notable issues that arose for if guards (#24535, #27282, #29723, #31287) as suggested in #51114 (comment).

cc @pnkfelix are there any other tests that you would want to see?
cc tracking issue #51114

@rustbot
Copy link
Collaborator

rustbot commented Dec 21, 2022

r? @Nilstrieb

(rustbot has picked a reviewer for you, use r? to override)

@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 Dec 21, 2022
Copy link
Member

@Noratrieb Noratrieb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, adding so many tests is great! Looks mostly good except for one place where you forgot to change it.

r=me after fixing that unless Felix wants to add another test or something changed

src/test/ui/nll/issue-27282-move-match-input-into-guard.rs Outdated Show resolved Hide resolved
@LeSeulArtichaut
Copy link
Contributor Author

Fixed, thank you very much for the review!

@Noratrieb
Copy link
Member

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Jan 3, 2023

📌 Commit 56aaf74 has been approved by Nilstrieb

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 Jan 3, 2023
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 3, 2023
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#104552 (warn newer available version of the x tool)
 - rust-lang#105681 (some fixes/improvements to mir::visit module)
 - rust-lang#106005 (Test the borrowck behavior of if-let guards)
 - rust-lang#106356 (clean: Remove `ctor_kind` from `VariantStruct`.)
 - rust-lang#106365 (Grammar : Missing "is" in format specifier diagnostic)
 - rust-lang#106388 (rustdoc: remove legacy box-sizing CSS)
 - rust-lang#106392 (`has_overflow` only if value is *not* within limit)
 - rust-lang#106402 (Fix dupe word typos)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 6e94012 into rust-lang:master Jan 3, 2023
@rustbot rustbot added this to the 1.68.0 milestone Jan 3, 2023
@LeSeulArtichaut LeSeulArtichaut deleted the if-let-guard-borrowck-test branch January 4, 2023 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

4 participants