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

or_patterns: unused_parens lints erroneously on _a @ (0 | 1) #64106

Closed
Centril opened this issue Sep 3, 2019 · 1 comment · Fixed by #64128
Closed

or_patterns: unused_parens lints erroneously on _a @ (0 | 1) #64106

Centril opened this issue Sep 3, 2019 · 1 comment · Fixed by #64128
Assignees
Labels
A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. C-bug Category: This is a bug. F-or_patterns `#![feature(or_patterns)]` requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@Centril
Copy link
Contributor

Centril commented Sep 3, 2019

#![feature(or_patterns)]
#![allow(incomplete_features)]

fn foo() {
    match 0 {
        _a @ (0 | 1) => {}
        _ => {}
    }

    let () = 0; // Prevent the ICE in MIR.
}

results in:

warning: unnecessary parentheses around pattern
 --> src/lib.rs:6:14
  |
6 |         _a @ (0 | 1) => {}
  |              ^^^^^^^ help: remove these parentheses
  |
  = note: `#[warn(unused_parens)]` on by default

changing things into _a @ (0 | 1) will correctly refuse to parse.

cc @dlrobertson #54883

@Centril Centril added A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. C-bug Category: This is a bug. requires-nightly This issue requires a nightly compiler in some way. F-or_patterns `#![feature(or_patterns)]` labels Sep 3, 2019
@Centril Centril changed the title or_patterns: unnecessary patterns lints erroneously on _a @ (0 | 1) or_patterns: unused_parens lints erroneously on _a @ (0 | 1) Sep 3, 2019
@Centril Centril self-assigned this Sep 3, 2019
@Centril
Copy link
Contributor Author

Centril commented Sep 3, 2019

Keep-sake: #55342.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. C-bug Category: This is a bug. F-or_patterns `#![feature(or_patterns)]` requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant