Blesses UI tests, add known bug to typeid-equality-by-subtyping

This commit is contained in:
onestacked 2023-05-26 09:53:05 +02:00
parent f2bdaf1a4d
commit 6827a413c8
4 changed files with 17 additions and 7 deletions

View File

@ -1,7 +1,7 @@
// check-pass // known-bug: #110395
// known-bug: #97156 // known-bug: #97156
#![feature(const_type_id, generic_const_exprs)] #![feature(const_type_id, const_trait_impl, generic_const_exprs)]
#![allow(incomplete_features)] #![allow(incomplete_features)]
use std::any::TypeId; use std::any::TypeId;
@ -26,7 +26,10 @@ impl<T: 'static> AssocCt for T {
trait WithAssoc<U> { trait WithAssoc<U> {
type Assoc; type Assoc;
} }
impl<T: 'static> WithAssoc<()> for T where [(); <T as AssocCt>::ASSOC]: { impl<T: 'static> WithAssoc<()> for T
where
[(); <T as AssocCt>::ASSOC]:,
{
type Assoc = [u8; <T as AssocCt>::ASSOC]; type Assoc = [u8; <T as AssocCt>::ASSOC];
} }
@ -38,7 +41,6 @@ fn generic<T: 'static, U>(x: <T as WithAssoc<U>>::Assoc) -> <T as WithAssoc<U>>:
x x
} }
fn unsound<T>(x: <One as WithAssoc<T>>::Assoc) -> <Two as WithAssoc<T>>::Assoc fn unsound<T>(x: <One as WithAssoc<T>>::Assoc) -> <Two as WithAssoc<T>>::Assoc
where where
One: WithAssoc<T>, One: WithAssoc<T>,

View File

@ -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

View File

@ -20,7 +20,6 @@ LL | assert!(TypeId::of::<u8>() == TypeId::of::<u8>());
note: impl defined here, but it is not `const` note: impl defined here, but it is not `const`
--> $SRC_DIR/core/src/any.rs:LL:COL --> $SRC_DIR/core/src/any.rs:LL:COL
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants = 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 error[E0277]: can't compare `TypeId` with `TypeId` in const contexts
--> $DIR/const_cmp_type_id.rs:9:13 --> $DIR/const_cmp_type_id.rs:9:13
@ -44,7 +43,6 @@ LL | assert!(TypeId::of::<()>() != TypeId::of::<u8>());
note: impl defined here, but it is not `const` note: impl defined here, but it is not `const`
--> $SRC_DIR/core/src/any.rs:LL:COL --> $SRC_DIR/core/src/any.rs:LL:COL
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants = 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 error[E0277]: can't compare `TypeId` with `TypeId` in const contexts
--> $DIR/const_cmp_type_id.rs:10:22 --> $DIR/const_cmp_type_id.rs:10:22

View File

@ -20,7 +20,6 @@ LL | GetTypeId::<T>::VALUE == GetTypeId::<usize>::VALUE
note: impl defined here, but it is not `const` note: impl defined here, but it is not `const`
--> $SRC_DIR/core/src/any.rs:LL:COL --> $SRC_DIR/core/src/any.rs:LL:COL
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants = 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 error: aborting due to 2 previous errors