]> git.lizzy.rs Git - rust.git/blob - tests/ui/never_type/exhaustive_patterns.stderr
Rollup merge of #107615 - notriddle:notriddle/nbsp, r=GuillaumeGomez
[rust.git] / tests / ui / never_type / exhaustive_patterns.stderr
1 error[E0005]: refutable pattern in local binding
2   --> $DIR/exhaustive_patterns.rs:20:9
3    |
4 LL |     let Either::A(()) = foo();
5    |         ^^^^^^^^^^^^^ pattern `Either::B(_)` not covered
6    |
7    = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
8    = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
9 note: `Either<(), !>` defined here
10   --> $DIR/exhaustive_patterns.rs:10:6
11    |
12 LL | enum Either<A, B> {
13    |      ^^^^^^
14 LL |     A(A),
15 LL |     B(inner::Wrapper<B>),
16    |     - not covered
17    = note: the matched value is of type `Either<(), !>`
18 help: you might want to use `if let` to ignore the variant that isn't matched
19    |
20 LL |     if let Either::A(()) = foo() { todo!() }
21    |     ++                           ~~~~~~~~~~~
22
23 error: aborting due to previous error
24
25 For more information about this error, try `rustc --explain E0005`.