Closed
Description
#[deriving(Show)]
enum State {
AtoZ(uint),
Numeric,
}
fn main() {
let state = Numeric;
let b = 97u8; // a
let r = match (state, b as char) {
(AtoZ(..), 'a'..'z') => {
"Named"
},
(Numeric, 'x') => {
"Hex"
},
_ => {
"Other"
}
};
println!("{} {}: {}", state, b as char, r);
}
Outputs Numeric a: Hex
. Clearly, a
shouldn't match x
.
Worth noting: if you change the first range to not include x
, such as a
..w
, it works correctly. Also, removing the field from AtoZ
also makes the match work correctly.
Activity
seanmonstar commentedon Apr 30, 2014
blocking #13831
lilyball commentedon May 2, 2014
cc me
edwardw commentedon May 2, 2014
This seems to be a regression introduced by #13034.
lilyball commentedon May 2, 2014
This is impacting #13896 as well. I had to add in guards that re-test the range to work around it.
enter_opt
#13169edwardw commentedon May 2, 2014
The defect of #13034 is that it doesn't check multiple refutable patterns, which is exactly what this bug report is about.
Reverse rust-lang#13034
5 remaining items