-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.Category: This is a bug.F-or_patterns`#![feature(or_patterns)]``#![feature(or_patterns)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
Description
With rustc 1.42.0-nightly (0de96d3 2019-12-19):
For the following code:
pub enum MyEnum {
A { i: i32, j: i32 },
B { i: i32, j: i32 },
}
pub fn foo(x: MyEnum) {
use MyEnum::*;
match x {
A { i, j } | B { i, j } => {
println!("{}", i);
}
}
}
I get the following diagnostic:
) rustc +nightly test.rs -o test --crate-type lib
warning: unused variable: `j`
--> test.rs:10:16
|
10 | A { i, j } | B { i, j } => {
| ^ ^
|
= note: `#[warn(unused_variables)]` on by default
help: try ignoring the field
|
10 | A { i, j: _j: _ } | B { i, j } => {
| ^^^^^^^
Instead of:
help: try ignoring the field
|
10 | A { i, j: _ } | B { i, j: _ } => {
| ^^^^ ^^^^
Metadata
Metadata
Assignees
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.Category: This is a bug.F-or_patterns`#![feature(or_patterns)]``#![feature(or_patterns)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.