Skip to content

Commit 6827a41

Browse files
committed
Blesses UI tests, add known bug to typeid-equality-by-subtyping
1 parent f2bdaf1 commit 6827a41

File tree

4 files changed

+17
-7
lines changed

4 files changed

+17
-7
lines changed

tests/ui/const-generics/generic_const_exprs/typeid-equality-by-subtyping.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
// check-pass
1+
// known-bug: #110395
22
// known-bug: #97156
33

4-
#![feature(const_type_id, generic_const_exprs)]
4+
#![feature(const_type_id, const_trait_impl, generic_const_exprs)]
55
#![allow(incomplete_features)]
66

77
use std::any::TypeId;
@@ -26,7 +26,10 @@ impl<T: 'static> AssocCt for T {
2626
trait WithAssoc<U> {
2727
type Assoc;
2828
}
29-
impl<T: 'static> WithAssoc<()> for T where [(); <T as AssocCt>::ASSOC]: {
29+
impl<T: 'static> WithAssoc<()> for T
30+
where
31+
[(); <T as AssocCt>::ASSOC]:,
32+
{
3033
type Assoc = [u8; <T as AssocCt>::ASSOC];
3134
}
3235

@@ -38,7 +41,6 @@ where
3841
x
3942
}
4043

41-
4244
fn unsound<T>(x: <One as WithAssoc<T>>::Assoc) -> <Two as WithAssoc<T>>::Assoc
4345
where
4446
One: WithAssoc<T>,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
error: to use a constant of type `TypeId` in a pattern, `TypeId` must be annotated with `#[derive(PartialEq, Eq)]`
2+
--> $DIR/typeid-equality-by-subtyping.rs:18:9
3+
|
4+
LL | WHAT_A_TYPE => 0,
5+
| ^^^^^^^^^^^
6+
|
7+
= note: the traits must be derived, manual `impl`s are not sufficient
8+
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
9+
10+
error: aborting due to previous error
11+

tests/ui/consts/const_cmp_type_id.stderr

-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ LL | assert!(TypeId::of::<u8>() == TypeId::of::<u8>());
2020
note: impl defined here, but it is not `const`
2121
--> $SRC_DIR/core/src/any.rs:LL:COL
2222
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
23-
= note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
2423

2524
error[E0277]: can't compare `TypeId` with `TypeId` in const contexts
2625
--> $DIR/const_cmp_type_id.rs:9:13
@@ -44,7 +43,6 @@ LL | assert!(TypeId::of::<()>() != TypeId::of::<u8>());
4443
note: impl defined here, but it is not `const`
4544
--> $SRC_DIR/core/src/any.rs:LL:COL
4645
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
47-
= note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
4846

4947
error[E0277]: can't compare `TypeId` with `TypeId` in const contexts
5048
--> $DIR/const_cmp_type_id.rs:10:22

tests/ui/consts/issue-73976-monomorphic.stderr

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ LL | GetTypeId::<T>::VALUE == GetTypeId::<usize>::VALUE
2020
note: impl defined here, but it is not `const`
2121
--> $SRC_DIR/core/src/any.rs:LL:COL
2222
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
23-
= note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
2423

2524
error: aborting due to 2 previous errors
2625

0 commit comments

Comments
 (0)