Skip to content

Conversation

Nadrieril
Copy link
Member

#118527 accidentally allowed the following to parse on stable:

match Some(0) {
    None => { foo(); }
    #[cfg(FALSE)]
    Some(_)
}

This fixes that oversight. The way I choose which error to emit is the best I could think of, I'm open if you know a better way.

r? @petrochenkov since you're the one who noticed

@Nadrieril Nadrieril added A-parser Area: The lexing & parsing of Rust source code to an AST F-never_patterns `#![feature(never_patterns)]` labels Dec 12, 2023
@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 12, 2023
@rust-log-analyzer

This comment has been minimized.

@petrochenkov petrochenkov 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 Dec 12, 2023
@Nadrieril Nadrieril force-pushed the correctly-gate-never_patterns-parsing branch from d40202d to e274372 Compare December 12, 2023 13:42
@Nadrieril
Copy link
Member Author

I had forgotten to test Some(_) if false, as well so I just added some cases

@Nadrieril
Copy link
Member Author

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Dec 12, 2023
@petrochenkov
Copy link
Contributor

@bors r+

@bors
Copy link
Collaborator

bors commented Dec 12, 2023

📌 Commit 19e0c98 has been approved by petrochenkov

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

Rollup of 9 pull requests

Successful merges:

 - rust-lang#116740 (dont ICE when ConstKind::Expr for is_const_evaluatable)
 - rust-lang#117914 (On borrow return type, suggest borrowing from arg or owned return type)
 - rust-lang#117927 (Clarify how to choose a FutureIncompatibilityReason variant.)
 - rust-lang#118855 (Improve an error involving attribute values.)
 - rust-lang#118856 (rustdoc-search: clean up parser)
 - rust-lang#118865 (rustc_codegen_llvm: Enforce `rustc::potential_query_instability` lint)
 - rust-lang#118866 (llvm-wrapper: adapt for LLVM API change)
 - rust-lang#118868 (Correctly gate the parsing of match arms without body)
 - rust-lang#118877 (tests: CGU tests require build-pass, not check-pass (remove FIXME))

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit d661974 into rust-lang:master Dec 12, 2023
@rustbot rustbot added this to the 1.76.0 milestone Dec 12, 2023
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Dec 12, 2023
Rollup merge of rust-lang#118868 - Nadrieril:correctly-gate-never_patterns-parsing, r=petrochenkov

Correctly gate the parsing of match arms without body

rust-lang#118527 accidentally allowed the following to parse on stable:
```rust
match Some(0) {
    None => { foo(); }
    #[cfg(FALSE)]
    Some(_)
}
```

This fixes that oversight. The way I choose which error to emit is the best I could think of, I'm open if you know a better way.

r? `@petrochenkov` since you're the one who noticed
@Nadrieril Nadrieril deleted the correctly-gate-never_patterns-parsing branch December 12, 2023 21:00
@Nadrieril
Copy link
Member Author

That was swift! Good teamwork

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-parser Area: The lexing & parsing of Rust source code to an AST F-never_patterns `#![feature(never_patterns)]` 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.

5 participants