Add test for failing try_eval_bits
This commit is contained in:
parent
d31b4c3750
commit
c38aad4f4b
2 changed files with 16 additions and 1 deletions
|
@ -154,4 +154,13 @@ fn main() {
|
|||
match 0u128 { //~ ERROR non-exhaustive patterns
|
||||
4 ..= u128::MAX => {}
|
||||
}
|
||||
|
||||
const FOO: i32 = 42;
|
||||
const BAR: &i32 = &42;
|
||||
match &0 {
|
||||
&42 => {}
|
||||
&FOO => {} //~ ERROR unreachable pattern
|
||||
BAR => {} // not detected as unreachable because `try_eval_bits` fails on BAR
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -118,6 +118,12 @@ LL | match 0u128 {
|
|||
|
|
||||
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
|
||||
|
||||
error: aborting due to 14 previous errors
|
||||
error: unreachable pattern
|
||||
--> $DIR/exhaustive_integer_patterns.rs:162:9
|
||||
|
|
||||
LL | &FOO => {}
|
||||
| ^^^^
|
||||
|
||||
error: aborting due to 15 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0004`.
|
||||
|
|
Loading…
Add table
Reference in a new issue