1 // Test the "defined here" and "not covered" diagnostic hints.
2 // We also make sure that references are peeled off from the scrutinee type
3 // so that the diagnostics work better with default binding modes.
15 //~^ NOTE `E` defined here
16 //~| NOTE `E` defined here
17 //~| NOTE `E` defined here
18 //~| NOTE `E` defined here
19 //~| NOTE `E` defined here
20 //~| NOTE `E` defined here
38 match e1 { //~ ERROR non-exhaustive patterns: `B` and `C` not covered
39 //~^ NOTE patterns `B` and `C` not covered
40 //~| NOTE the matched value is of type `E`
44 let E::A = e; //~ ERROR refutable pattern in local binding: `B` and `C` not covered
45 //~^ NOTE patterns `B` and `C` not covered
46 //~| NOTE `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with
47 //~| NOTE for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
48 //~| NOTE the matched value is of type `E`
51 fn by_ref_once(e: &E) {
52 match e { //~ ERROR non-exhaustive patterns: `&B` and `&C` not covered
53 //~^ NOTE patterns `&B` and `&C` not covered
54 //~| NOTE the matched value is of type `&E`
58 let E::A = e; //~ ERROR refutable pattern in local binding: `&B` and `&C` not covered
59 //~^ NOTE patterns `&B` and `&C` not covered
60 //~| NOTE `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with
61 //~| NOTE for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
62 //~| NOTE the matched value is of type `&E`
65 fn by_ref_thrice(e: & &mut &E) {
66 match e { //~ ERROR non-exhaustive patterns: `&&mut &B` and `&&mut &C` not covered
67 //~^ NOTE patterns `&&mut &B` and `&&mut &C` not covered
68 //~| NOTE the matched value is of type `&&mut &E`
73 //~^ ERROR refutable pattern in local binding: `&&mut &B` and `&&mut &C` not covered
74 //~| NOTE patterns `&&mut &B` and `&&mut &C` not covered
75 //~| NOTE `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with
76 //~| NOTE for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
77 //~| NOTE the matched value is of type `&&mut &E`
85 //~^ NOTE `Opt` defined here
86 //~| NOTE `Opt` defined here
92 match e {//~ ERROR non-exhaustive patterns: `None` not covered
93 //~^ NOTE pattern `None` not covered
94 //~| NOTE the matched value is of type `Opt`
95 Opt::Some(ref _x) => {}
98 let Opt::Some(ref _x) = e; //~ ERROR refutable pattern in local binding: `None` not covered
99 //~^ NOTE the matched value is of type `Opt`
100 //~| NOTE pattern `None` not covered
101 //~| NOTE `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with
102 //~| NOTE for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html