summaryrefslogtreecommitdiffstats
path: root/src/test/ui/pattern/usefulness/non-exhaustive-defined-here.stderr
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/pattern/usefulness/non-exhaustive-defined-here.stderr')
-rw-r--r--src/test/ui/pattern/usefulness/non-exhaustive-defined-here.stderr198
1 files changed, 198 insertions, 0 deletions
diff --git a/src/test/ui/pattern/usefulness/non-exhaustive-defined-here.stderr b/src/test/ui/pattern/usefulness/non-exhaustive-defined-here.stderr
new file mode 100644
index 000000000..0f06c31c4
--- /dev/null
+++ b/src/test/ui/pattern/usefulness/non-exhaustive-defined-here.stderr
@@ -0,0 +1,198 @@
+error[E0004]: non-exhaustive patterns: `B` and `C` not covered
+ --> $DIR/non-exhaustive-defined-here.rs:38:11
+ |
+LL | match e1 {
+ | ^^ patterns `B` and `C` not covered
+ |
+note: `E` defined here
+ --> $DIR/non-exhaustive-defined-here.rs:14:5
+ |
+LL | enum E {
+ | -
+...
+LL | B,
+ | ^ not covered
+...
+LL | C
+ | ^ not covered
+ = note: the matched value is of type `E`
+help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
+ |
+LL ~ E::A => {}
+LL + B | C => todo!()
+ |
+
+error[E0005]: refutable pattern in local binding: `B` and `C` not covered
+ --> $DIR/non-exhaustive-defined-here.rs:44:9
+ |
+LL | let E::A = e;
+ | ^^^^ patterns `B` and `C` not covered
+ |
+ = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
+ = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
+note: `E` defined here
+ --> $DIR/non-exhaustive-defined-here.rs:14:5
+ |
+LL | enum E {
+ | -
+...
+LL | B,
+ | ^ not covered
+...
+LL | C
+ | ^ not covered
+ = note: the matched value is of type `E`
+help: you might want to use `if let` to ignore the variants that aren't matched
+ |
+LL | if let E::A = e { todo!() }
+ | ++ ~~~~~~~~~~~
+
+error[E0004]: non-exhaustive patterns: `&B` and `&C` not covered
+ --> $DIR/non-exhaustive-defined-here.rs:52:11
+ |
+LL | match e {
+ | ^ patterns `&B` and `&C` not covered
+ |
+note: `E` defined here
+ --> $DIR/non-exhaustive-defined-here.rs:14:5
+ |
+LL | enum E {
+ | -
+...
+LL | B,
+ | ^ not covered
+...
+LL | C
+ | ^ not covered
+ = note: the matched value is of type `&E`
+help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
+ |
+LL ~ E::A => {}
+LL + &B | &C => todo!()
+ |
+
+error[E0005]: refutable pattern in local binding: `&B` and `&C` not covered
+ --> $DIR/non-exhaustive-defined-here.rs:58:9
+ |
+LL | let E::A = e;
+ | ^^^^ patterns `&B` and `&C` not covered
+ |
+ = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
+ = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
+note: `E` defined here
+ --> $DIR/non-exhaustive-defined-here.rs:14:5
+ |
+LL | enum E {
+ | -
+...
+LL | B,
+ | ^ not covered
+...
+LL | C
+ | ^ not covered
+ = note: the matched value is of type `&E`
+help: you might want to use `if let` to ignore the variants that aren't matched
+ |
+LL | if let E::A = e { todo!() }
+ | ++ ~~~~~~~~~~~
+
+error[E0004]: non-exhaustive patterns: `&&mut &B` and `&&mut &C` not covered
+ --> $DIR/non-exhaustive-defined-here.rs:66:11
+ |
+LL | match e {
+ | ^ patterns `&&mut &B` and `&&mut &C` not covered
+ |
+note: `E` defined here
+ --> $DIR/non-exhaustive-defined-here.rs:14:5
+ |
+LL | enum E {
+ | -
+...
+LL | B,
+ | ^ not covered
+...
+LL | C
+ | ^ not covered
+ = note: the matched value is of type `&&mut &E`
+help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
+ |
+LL ~ E::A => {}
+LL + &&mut &B | &&mut &C => todo!()
+ |
+
+error[E0005]: refutable pattern in local binding: `&&mut &B` and `&&mut &C` not covered
+ --> $DIR/non-exhaustive-defined-here.rs:72:9
+ |
+LL | let E::A = e;
+ | ^^^^ patterns `&&mut &B` and `&&mut &C` not covered
+ |
+ = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
+ = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
+note: `E` defined here
+ --> $DIR/non-exhaustive-defined-here.rs:14:5
+ |
+LL | enum E {
+ | -
+...
+LL | B,
+ | ^ not covered
+...
+LL | C
+ | ^ not covered
+ = note: the matched value is of type `&&mut &E`
+help: you might want to use `if let` to ignore the variants that aren't matched
+ |
+LL | if let E::A = e { todo!() }
+ | ++ ~~~~~~~~~~~
+
+error[E0004]: non-exhaustive patterns: `None` not covered
+ --> $DIR/non-exhaustive-defined-here.rs:92:11
+ |
+LL | match e {
+ | ^ pattern `None` not covered
+ |
+note: `Opt` defined here
+ --> $DIR/non-exhaustive-defined-here.rs:84:5
+ |
+LL | enum Opt {
+ | ---
+...
+LL | None,
+ | ^^^^ not covered
+ = note: the matched value is of type `Opt`
+help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
+ |
+LL ~ Opt::Some(ref _x) => {}
+LL + None => todo!()
+ |
+
+error[E0005]: refutable pattern in local binding: `None` not covered
+ --> $DIR/non-exhaustive-defined-here.rs:98:9
+ |
+LL | let Opt::Some(ref _x) = e;
+ | ^^^^^^^^^^^^^^^^^ pattern `None` not covered
+ |
+ = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
+ = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
+note: `Opt` defined here
+ --> $DIR/non-exhaustive-defined-here.rs:84:5
+ |
+LL | enum Opt {
+ | ---
+...
+LL | None,
+ | ^^^^ not covered
+ = note: the matched value is of type `Opt`
+help: you might want to use `if let` to ignore the variant that isn't matched
+ |
+LL | let _x = if let Opt::Some(ref _x) = e { _x } else { todo!() };
+ | +++++++++++ +++++++++++++++++++++++
+help: alternatively, on nightly, you might want to use `#![feature(let_else)]` to handle the variant that isn't matched
+ |
+LL | let Opt::Some(ref _x) = e else { todo!() };
+ | ++++++++++++++++
+
+error: aborting due to 8 previous errors
+
+Some errors have detailed explanations: E0004, E0005.
+For more information about an error, try `rustc --explain E0004`.