rust/tests/ui/consts/const_in_pattern/reject_non_structural.stderr

174 lines
8.4 KiB
Plaintext

error: constant of non-structural type `NoDerive` in a pattern
--> $DIR/reject_non_structural.rs:60:36
|
LL | struct NoDerive;
| --------------- `NoDerive` must be annotated with `#[derive(PartialEq)]` to be usable in patterns
...
LL | const ENUM: Derive<NoDerive> = Derive::Some(NoDerive);
| ---------------------------- constant defined here
LL | match Derive::Some(NoDerive) { ENUM => dbg!(ENUM), _ => panic!("whoops"), };
| ^^^^ constant of non-structural type
|
note: the `PartialEq` trait must be derived, manual `impl`s are not sufficient; see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details
--> $DIR/reject_non_structural.rs:32:1
|
LL | impl PartialEq for NoDerive { fn eq(&self, _: &Self) -> bool { false } }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: constant of non-structural type `NoDerive` in a pattern
--> $DIR/reject_non_structural.rs:65:28
|
LL | struct NoDerive;
| --------------- `NoDerive` must be annotated with `#[derive(PartialEq)]` to be usable in patterns
...
LL | const FIELD: OND = TrivialEq(Some(NoDerive)).0;
| ---------------- constant defined here
LL | match Some(NoDerive) { FIELD => dbg!(FIELD), _ => panic!("whoops"), };
| ^^^^^ constant of non-structural type
|
note: the `PartialEq` trait must be derived, manual `impl`s are not sufficient; see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details
--> $DIR/reject_non_structural.rs:32:1
|
LL | impl PartialEq for NoDerive { fn eq(&self, _: &Self) -> bool { false } }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: constant of non-structural type `NoDerive` in a pattern
--> $DIR/reject_non_structural.rs:71:27
|
LL | struct NoDerive;
| --------------- `NoDerive` must be annotated with `#[derive(PartialEq)]` to be usable in patterns
...
LL | const INDIRECT: OND = NO_DERIVE_SOME;
| ------------------- constant defined here
LL | match Some(NoDerive) {INDIRECT => dbg!(INDIRECT), _ => panic!("whoops"), };
| ^^^^^^^^ constant of non-structural type
|
note: the `PartialEq` trait must be derived, manual `impl`s are not sufficient; see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details
--> $DIR/reject_non_structural.rs:32:1
|
LL | impl PartialEq for NoDerive { fn eq(&self, _: &Self) -> bool { false } }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: constant of non-structural type `NoDerive` in a pattern
--> $DIR/reject_non_structural.rs:76:36
|
LL | struct NoDerive;
| --------------- `NoDerive` must be annotated with `#[derive(PartialEq)]` to be usable in patterns
...
LL | const TUPLE: (OND, OND) = (None, Some(NoDerive));
| ----------------------- constant defined here
LL | match (None, Some(NoDerive)) { TUPLE => dbg!(TUPLE), _ => panic!("whoops"), };
| ^^^^^ constant of non-structural type
|
note: the `PartialEq` trait must be derived, manual `impl`s are not sufficient; see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details
--> $DIR/reject_non_structural.rs:32:1
|
LL | impl PartialEq for NoDerive { fn eq(&self, _: &Self) -> bool { false } }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: constant of non-structural type `NoDerive` in a pattern
--> $DIR/reject_non_structural.rs:81:28
|
LL | struct NoDerive;
| --------------- `NoDerive` must be annotated with `#[derive(PartialEq)]` to be usable in patterns
...
LL | const TYPE_ASCRIPTION: OND = type_ascribe!(Some(NoDerive), OND);
| -------------------------- constant defined here
LL | match Some(NoDerive) { TYPE_ASCRIPTION => dbg!(TYPE_ASCRIPTION), _ => panic!("whoops"), };
| ^^^^^^^^^^^^^^^ constant of non-structural type
|
note: the `PartialEq` trait must be derived, manual `impl`s are not sufficient; see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details
--> $DIR/reject_non_structural.rs:32:1
|
LL | impl PartialEq for NoDerive { fn eq(&self, _: &Self) -> bool { false } }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: constant of non-structural type `NoDerive` in a pattern
--> $DIR/reject_non_structural.rs:86:36
|
LL | struct NoDerive;
| --------------- `NoDerive` must be annotated with `#[derive(PartialEq)]` to be usable in patterns
...
LL | const ARRAY: [OND; 2] = [None, Some(NoDerive)];
| --------------------- constant defined here
LL | match [None, Some(NoDerive)] { ARRAY => dbg!(ARRAY), _ => panic!("whoops"), };
| ^^^^^ constant of non-structural type
|
note: the `PartialEq` trait must be derived, manual `impl`s are not sufficient; see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details
--> $DIR/reject_non_structural.rs:32:1
|
LL | impl PartialEq for NoDerive { fn eq(&self, _: &Self) -> bool { false } }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: constant of non-structural type `NoDerive` in a pattern
--> $DIR/reject_non_structural.rs:91:33
|
LL | struct NoDerive;
| --------------- `NoDerive` must be annotated with `#[derive(PartialEq)]` to be usable in patterns
...
LL | const REPEAT: [OND; 2] = [Some(NoDerive); 2];
| ---------------------- constant defined here
LL | match [Some(NoDerive); 2] { REPEAT => dbg!(REPEAT), _ => panic!("whoops"), };
| ^^^^^^ constant of non-structural type
|
note: the `PartialEq` trait must be derived, manual `impl`s are not sufficient; see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details
--> $DIR/reject_non_structural.rs:32:1
|
LL | impl PartialEq for NoDerive { fn eq(&self, _: &Self) -> bool { false } }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: constant of non-structural type `NoDerive` in a pattern
--> $DIR/reject_non_structural.rs:97:28
|
LL | struct NoDerive;
| --------------- `NoDerive` must be annotated with `#[derive(PartialEq)]` to be usable in patterns
...
LL | trait Trait: Sized { const ASSOC: Option<Self>; }
| ------------------ ------------------------- constant defined here
LL | impl Trait for NoDerive { const ASSOC: Option<NoDerive> = Some(NoDerive); }
LL | match Some(NoDerive) { NoDerive::ASSOC => dbg!(NoDerive::ASSOC), _ => panic!("whoops"), };
| ^^^^^^^^^^^^^^^ constant of non-structural type
|
note: the `PartialEq` trait must be derived, manual `impl`s are not sufficient; see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details
--> $DIR/reject_non_structural.rs:32:1
|
LL | impl PartialEq for NoDerive { fn eq(&self, _: &Self) -> bool { false } }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: constant of non-structural type `NoDerive` in a pattern
--> $DIR/reject_non_structural.rs:102:28
|
LL | struct NoDerive;
| --------------- `NoDerive` must be annotated with `#[derive(PartialEq)]` to be usable in patterns
...
LL | const BLOCK: OND = { NoDerive; Some(NoDerive) };
| ---------------- constant defined here
LL | match Some(NoDerive) { BLOCK => dbg!(BLOCK), _ => panic!("whoops"), };
| ^^^^^ constant of non-structural type
|
note: the `PartialEq` trait must be derived, manual `impl`s are not sufficient; see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details
--> $DIR/reject_non_structural.rs:32:1
|
LL | impl PartialEq for NoDerive { fn eq(&self, _: &Self) -> bool { false } }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: constant of non-structural type `NoDerive` in a pattern
--> $DIR/reject_non_structural.rs:107:29
|
LL | struct NoDerive;
| --------------- `NoDerive` must be annotated with `#[derive(PartialEq)]` to be usable in patterns
...
LL | const ADDR_OF: &OND = &Some(NoDerive);
| ------------------- constant defined here
LL | match &Some(NoDerive) { ADDR_OF => dbg!(ADDR_OF), _ => panic!("whoops"), };
| ^^^^^^^ constant of non-structural type
|
note: the `PartialEq` trait must be derived, manual `impl`s are not sufficient; see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details
--> $DIR/reject_non_structural.rs:32:1
|
LL | impl PartialEq for NoDerive { fn eq(&self, _: &Self) -> bool { false } }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 10 previous errors