-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-exhaustiveness-checkingRelating to exhaustiveness / usefulness checking of patternsRelating to exhaustiveness / usefulness checking of patternsC-bugCategory: This is a bug.Category: This is a bug.I-unsoundIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessP-criticalCritical priorityCritical priorityT-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-nightlyPerformance or correctness regression from stable to nightly.Performance or correctness regression from stable to nightly.
Milestone
Description
I tried this code:
pub fn parse_data(data: &[u8]) -> u32 {
match data {
b"" => 1,
_ => 2,
}
}
fn main() {
println!("{}", parse_data(b"asd"))
}
It produces the following, incorrect, warning:
warning: unreachable pattern
--> src/main.rs:4:9
|
4 | _ => 2,
| ^
|
= note: `#[warn(unreachable_patterns)]` on by default
however, the output is 2
so it's clearly incorrect
Meta
rustc --version
:
1.50.0-nightly (2020-11-13 74f7e32f43b5fb0f8389)
tesuji
Metadata
Metadata
Assignees
Labels
A-exhaustiveness-checkingRelating to exhaustiveness / usefulness checking of patternsRelating to exhaustiveness / usefulness checking of patternsC-bugCategory: This is a bug.Category: This is a bug.I-unsoundIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessP-criticalCritical priorityCritical priorityT-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-nightlyPerformance or correctness regression from stable to nightly.Performance or correctness regression from stable to nightly.