From 65f89990265211af0591c0b09e58ea833e4f7d0e Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Tue, 17 Sep 2024 15:14:27 -0300 Subject: [PATCH] Remove redundant test typeid equality by subtyping --- .../typeid-equality-by-subtyping.rs | 54 ------------------- .../typeid-equality-by-subtyping.stderr | 27 ---------- 2 files changed, 81 deletions(-) delete mode 100644 tests/ui/const-generics/generic_const_exprs/typeid-equality-by-subtyping.rs delete mode 100644 tests/ui/const-generics/generic_const_exprs/typeid-equality-by-subtyping.stderr 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 deleted file mode 100644 index 81be8d5c7d767..0000000000000 --- a/tests/ui/const-generics/generic_const_exprs/typeid-equality-by-subtyping.rs +++ /dev/null @@ -1,54 +0,0 @@ -//@ known-bug: #110395 -//@ known-bug: #97156 - -#![feature(const_type_id, const_trait_impl, generic_const_exprs)] -#![allow(incomplete_features)] - -use std::any::TypeId; -// `One` and `Two` are currently considered equal types, as both -// `One <: Two` and `One :> Two` holds. -type One = for<'a> fn(&'a (), &'a ()); -type Two = for<'a, 'b> fn(&'a (), &'b ()); -trait AssocCt { - const ASSOC: usize; -} -const fn to_usize() -> usize { - const WHAT_A_TYPE: TypeId = TypeId::of::(); - match TypeId::of::() { - WHAT_A_TYPE => 0, - _ => 1000, - } -} -impl AssocCt for T { - const ASSOC: usize = to_usize::(); -} - -trait WithAssoc { - type Assoc; -} -impl WithAssoc<()> for T -where - [(); ::ASSOC]:, -{ - type Assoc = [u8; ::ASSOC]; -} - -fn generic(x: >::Assoc) -> >::Assoc -where - [(); ::ASSOC]:, - T: WithAssoc, -{ - x -} - -fn unsound(x: >::Assoc) -> >::Assoc -where - One: WithAssoc, -{ - let x: >::Assoc = generic::(x); - x -} - -fn main() { - println!("{:?}", unsound::<()>([])); -} 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 deleted file mode 100644 index 26e724c906137..0000000000000 --- a/tests/ui/const-generics/generic_const_exprs/typeid-equality-by-subtyping.stderr +++ /dev/null @@ -1,27 +0,0 @@ -error: to use a constant of type `TypeId` in a pattern, `TypeId` must be annotated with `#[derive(PartialEq)]` - --> $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.StructuralPartialEq.html for details - -error[E0277]: the trait bound `for<'a, 'b> fn(&'a (), &'b ()): WithAssoc` is not satisfied - --> $DIR/typeid-equality-by-subtyping.rs:44:51 - | -LL | fn unsound(x: >::Assoc) -> >::Assoc - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `WithAssoc` is not implemented for `for<'a, 'b> fn(&'a (), &'b ())` - -error[E0277]: the trait bound `for<'a, 'b> fn(&'a (), &'b ()): WithAssoc` is not satisfied - --> $DIR/typeid-equality-by-subtyping.rs:47:1 - | -LL | / { -LL | | let x: >::Assoc = generic::(x); -LL | | x -LL | | } - | |_^ the trait `WithAssoc` is not implemented for `for<'a, 'b> fn(&'a (), &'b ())` - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0277`.