Reword message for non-structural type constant in pattern
This commit is contained in:
parent
a6040bc230
commit
fb2f6a44c0
9 changed files with 9 additions and 11 deletions
|
|
@ -273,8 +273,7 @@ mir_build_non_exhaustive_patterns_type_not_empty = non-exhaustive patterns: type
|
|||
.suggestion = ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown
|
||||
.help = ensure that all possible cases are being handled by adding a match arm with a wildcard pattern
|
||||
|
||||
mir_build_non_partial_eq_match =
|
||||
to use a constant of type `{$non_peq_ty}` in a pattern, the type must implement `PartialEq`
|
||||
mir_build_non_partial_eq_match = constant of non-structural type `{$non_peq_ty}` in a pattern
|
||||
.label = constant of non-structural type
|
||||
|
||||
mir_build_pattern_not_covered = refutable pattern in {$origin}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ const C: &[O<B>] = &[O::None];
|
|||
fn main() {
|
||||
let x = O::None;
|
||||
match &[x][..] {
|
||||
C => (), //~ERROR: the type must implement `PartialEq`
|
||||
C => (), //~ ERROR constant of non-structural type `&[O<B>]` in a pattern
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
error: to use a constant of type `&[O<B>]` in a pattern, the type must implement `PartialEq`
|
||||
error: constant of non-structural type `&[O<B>]` in a pattern
|
||||
--> $DIR/issue-65466.rs:14:9
|
||||
|
|
||||
LL | const C: &[O<B>] = &[O::None];
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ fn main() {
|
|||
|
||||
match None {
|
||||
NO_PARTIAL_EQ_NONE => println!("NO_PARTIAL_EQ_NONE"),
|
||||
//~^ ERROR must implement `PartialEq`
|
||||
//~^ ERROR constant of non-structural type `Option<NoPartialEq>` in a pattern
|
||||
_ => panic!("whoops"),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
error: to use a constant of type `Option<NoPartialEq>` in a pattern, the type must implement `PartialEq`
|
||||
error: constant of non-structural type `Option<NoPartialEq>` in a pattern
|
||||
--> $DIR/reject_non_partial_eq.rs:28:9
|
||||
|
|
||||
LL | const NO_PARTIAL_EQ_NONE: Option<NoPartialEq> = None;
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ const CONST_SET: EnumSet<Enum8> = EnumSet { __enumset_underlying: 3 };
|
|||
|
||||
fn main() {
|
||||
match CONST_SET {
|
||||
CONST_SET => { /* ok */ } //~ERROR: must implement `PartialEq`
|
||||
CONST_SET => { /* ok */ } //~ ERROR constant of non-structural type `EnumSet<Enum8>` in a pattern
|
||||
_ => panic!("match fell through?"),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
error: to use a constant of type `EnumSet<Enum8>` in a pattern, the type must implement `PartialEq`
|
||||
error: constant of non-structural type `EnumSet<Enum8>` in a pattern
|
||||
--> $DIR/issue-72896-non-partial-eq-const.rs:19:9
|
||||
|
|
||||
LL | const CONST_SET: EnumSet<Enum8> = EnumSet { __enumset_underlying: 3 };
|
||||
|
|
|
|||
|
|
@ -12,8 +12,7 @@ const A: &[B] = &[];
|
|||
|
||||
pub fn main() {
|
||||
match &[][..] {
|
||||
A => (),
|
||||
//~^ ERROR must implement `PartialEq`
|
||||
A => (), //~ ERROR constant of non-structural type `&[B]` in a pattern
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
error: to use a constant of type `&[B]` in a pattern, the type must implement `PartialEq`
|
||||
error: constant of non-structural type `&[B]` in a pattern
|
||||
--> $DIR/issue-61188-match-slice-forbidden-without-eq.rs:15:9
|
||||
|
|
||||
LL | const A: &[B] = &[];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue