rust/tests/ui/pattern/deref-patterns/usefulness/non-exhaustive.stderr
Chayim Refael Friedman 6bf3cbe39e In rustc_pattern_analysis, put true witnesses before false witnesses
In rustc it doesn't really matter what the order of the witnesses is, but I'm planning to use the witnesses for implementing the "add missing match arms" assist in rust-analyzer, and there `true` before `false` is the natural order (like `Some` before `None`), and also what the current assist does.

The current order doesn't seem to be intentional; the code was created when bool ctors became their own thing, not just int ctors, but for integer, 0 before 1 is indeed the natural order.
2025-07-28 02:01:39 +03:00

64 lines
2.7 KiB
Plaintext

error[E0004]: non-exhaustive patterns: `deref!(true)` not covered
--> $DIR/non-exhaustive.rs:7:11
|
LL | match Box::new(false) {
| ^^^^^^^^^^^^^^^ pattern `deref!(true)` not covered
|
note: `Box<bool>` defined here
--> $SRC_DIR/alloc/src/boxed.rs:LL:COL
= note: the matched value is of type `Box<bool>`
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 ~ false => {},
LL + deref!(true) => todo!()
|
error[E0004]: non-exhaustive patterns: `deref!(deref!(false))` not covered
--> $DIR/non-exhaustive.rs:12:11
|
LL | match Box::new(Box::new(false)) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `deref!(deref!(false))` not covered
|
note: `Box<Box<bool>>` defined here
--> $SRC_DIR/alloc/src/boxed.rs:LL:COL
= note: the matched value is of type `Box<Box<bool>>`
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 ~ true => {},
LL + deref!(deref!(false)) => todo!()
|
error[E0004]: non-exhaustive patterns: `deref!((true, deref!(true)))` and `deref!((false, deref!(false)))` not covered
--> $DIR/non-exhaustive.rs:17:11
|
LL | match Box::new((true, Box::new(false))) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ patterns `deref!((true, deref!(true)))` and `deref!((false, deref!(false)))` not covered
|
note: `Box<(bool, Box<bool>)>` defined here
--> $SRC_DIR/alloc/src/boxed.rs:LL:COL
= note: the matched value is of type `Box<(bool, Box<bool>)>`
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 ~ (false, true) => {},
LL + deref!((true, deref!(true))) | deref!((false, deref!(false))) => todo!()
|
error[E0004]: non-exhaustive patterns: `deref!((deref!(T::C), _))` not covered
--> $DIR/non-exhaustive.rs:24:11
|
LL | match Box::new((Box::new(T::A), Box::new(T::A))) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `deref!((deref!(T::C), _))` not covered
|
note: `Box<(Box<T>, Box<T>)>` defined here
--> $SRC_DIR/alloc/src/boxed.rs:LL:COL
= note: the matched value is of type `Box<(Box<T>, Box<T>)>`
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 ~ (T::A | T::B, T::C) => {},
LL + deref!((deref!(T::C), _)) => todo!()
|
error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0004`.