2019-08-09 09:43:26 +00:00
|
|
|
#![allow(non_camel_case_types)]
|
|
|
|
|
|
|
|
|
|
enum E { A, B, c }
|
|
|
|
|
|
2021-11-17 19:37:46 +00:00
|
|
|
pub mod m {
|
2019-08-09 09:43:26 +00:00
|
|
|
const CONST1: usize = 10;
|
2021-11-17 19:37:46 +00:00
|
|
|
pub const Const2: usize = 20;
|
2019-08-09 09:43:26 +00:00
|
|
|
}
|
|
|
|
|
|
2012-08-06 07:20:23 -07:00
|
|
|
fn main() {
|
|
|
|
|
let y = 1;
|
2012-08-06 16:16:08 -07:00
|
|
|
match y {
|
2025-08-24 19:22:51 +00:00
|
|
|
a | b => {} //~ ERROR variable `a` is not bound in all patterns
|
|
|
|
|
//~| ERROR variable `b` is not bound in all patterns
|
2019-08-09 09:43:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let x = (E::A, E::B);
|
|
|
|
|
match x {
|
|
|
|
|
(A, B) | (ref B, c) | (c, A) => ()
|
|
|
|
|
//~^ ERROR variable `A` is not bound in all patterns
|
|
|
|
|
//~| ERROR variable `B` is not bound in all patterns
|
2020-03-04 03:58:52 +01:00
|
|
|
//~| ERROR variable `B` is bound inconsistently
|
2019-08-09 09:43:26 +00:00
|
|
|
//~| ERROR mismatched types
|
|
|
|
|
//~| ERROR variable `c` is not bound in all patterns
|
2021-11-17 19:37:46 +00:00
|
|
|
//~| HELP if you meant to match on unit variant `E::A`, use the full path in the pattern
|
2022-07-28 09:55:12 +09:00
|
|
|
//~| HELP consider removing `ref`
|
2019-08-09 09:43:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let z = (10, 20);
|
|
|
|
|
match z {
|
|
|
|
|
(CONST1, _) | (_, Const2) => ()
|
|
|
|
|
//~^ ERROR variable `CONST1` is not bound in all patterns
|
|
|
|
|
//~| ERROR variable `Const2` is not bound in all patterns
|
2021-11-17 19:37:46 +00:00
|
|
|
//~| HELP if you meant to match on constant `m::Const2`, use the full path in the pattern
|
2012-08-06 07:20:23 -07:00
|
|
|
}
|
|
|
|
|
}
|