diff --git a/tests/ui/const-generics/generic_const_exprs/typeid-equality-by-subtyping.rs b/tests/ui/const-generics/generic_const_exprs/typeid-equality-by-subtyping.rs index 85345d65c4a..b22cab7c7ff 100644 --- a/tests/ui/const-generics/generic_const_exprs/typeid-equality-by-subtyping.rs +++ b/tests/ui/const-generics/generic_const_exprs/typeid-equality-by-subtyping.rs @@ -1,7 +1,7 @@ -// check-pass +// known-bug: #110395 // known-bug: #97156 -#![feature(const_type_id, generic_const_exprs)] +#![feature(const_type_id, const_trait_impl, generic_const_exprs)] #![allow(incomplete_features)] use std::any::TypeId; @@ -26,7 +26,10 @@ impl AssocCt for T { trait WithAssoc { type Assoc; } -impl WithAssoc<()> for T where [(); ::ASSOC]: { +impl WithAssoc<()> for T +where + [(); ::ASSOC]:, +{ type Assoc = [u8; ::ASSOC]; } @@ -38,7 +41,6 @@ where x } - fn unsound(x: >::Assoc) -> >::Assoc where One: WithAssoc, diff --git a/tests/ui/const-generics/generic_const_exprs/typeid-equality-by-subtyping.stderr b/tests/ui/const-generics/generic_const_exprs/typeid-equality-by-subtyping.stderr new file mode 100644 index 00000000000..8cbd1265448 --- /dev/null +++ b/tests/ui/const-generics/generic_const_exprs/typeid-equality-by-subtyping.stderr @@ -0,0 +1,11 @@ +error: to use a constant of type `TypeId` in a pattern, `TypeId` must be annotated with `#[derive(PartialEq, Eq)]` + --> $DIR/typeid-equality-by-subtyping.rs:18:9 + | +LL | WHAT_A_TYPE => 0, + | ^^^^^^^^^^^ + | + = note: the traits must be derived, manual `impl`s are not sufficient + = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details + +error: aborting due to previous error + diff --git a/tests/ui/consts/const_cmp_type_id.stderr b/tests/ui/consts/const_cmp_type_id.stderr index 319d2b924a8..dc2c702d885 100644 --- a/tests/ui/consts/const_cmp_type_id.stderr +++ b/tests/ui/consts/const_cmp_type_id.stderr @@ -20,7 +20,6 @@ LL | assert!(TypeId::of::() == TypeId::of::()); note: impl defined here, but it is not `const` --> $SRC_DIR/core/src/any.rs:LL:COL = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants - = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: can't compare `TypeId` with `TypeId` in const contexts --> $DIR/const_cmp_type_id.rs:9:13 @@ -44,7 +43,6 @@ LL | assert!(TypeId::of::<()>() != TypeId::of::()); note: impl defined here, but it is not `const` --> $SRC_DIR/core/src/any.rs:LL:COL = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants - = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: can't compare `TypeId` with `TypeId` in const contexts --> $DIR/const_cmp_type_id.rs:10:22 diff --git a/tests/ui/consts/issue-73976-monomorphic.stderr b/tests/ui/consts/issue-73976-monomorphic.stderr index 95ab78b1b23..09661d3f344 100644 --- a/tests/ui/consts/issue-73976-monomorphic.stderr +++ b/tests/ui/consts/issue-73976-monomorphic.stderr @@ -20,7 +20,6 @@ LL | GetTypeId::::VALUE == GetTypeId::::VALUE note: impl defined here, but it is not `const` --> $SRC_DIR/core/src/any.rs:LL:COL = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants - = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 2 previous errors