about summary refs log tree commit diff
path: root/tests/ui/const-generics/generic_const_exprs
diff options
context:
space:
mode:
authorSantiago Pastorino <spastorino@gmail.com>2024-09-17 15:14:27 -0300
committerSantiago Pastorino <spastorino@gmail.com>2024-09-17 15:45:15 -0300
commit65f89990265211af0591c0b09e58ea833e4f7d0e (patch)
tree1a6ec7c881f79c347c79e04b5ad9807ff6235917 /tests/ui/const-generics/generic_const_exprs
parente9e13a68d7271baac458addc056ffff6ddbbe57c (diff)
downloadrust-65f89990265211af0591c0b09e58ea833e4f7d0e.tar.gz
rust-65f89990265211af0591c0b09e58ea833e4f7d0e.zip
Remove redundant test typeid equality by subtyping
Diffstat (limited to 'tests/ui/const-generics/generic_const_exprs')
-rw-r--r--tests/ui/const-generics/generic_const_exprs/typeid-equality-by-subtyping.rs54
-rw-r--r--tests/ui/const-generics/generic_const_exprs/typeid-equality-by-subtyping.stderr27
2 files changed, 0 insertions, 81 deletions
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 81be8d5c7d7..00000000000
--- 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<T: 'static>() -> usize {
-    const WHAT_A_TYPE: TypeId = TypeId::of::<One>();
-    match TypeId::of::<T>() {
-        WHAT_A_TYPE => 0,
-        _ => 1000,
-    }
-}
-impl<T: 'static> AssocCt for T {
-    const ASSOC: usize = to_usize::<T>();
-}
-
-trait WithAssoc<U> {
-    type Assoc;
-}
-impl<T: 'static> WithAssoc<()> for T
-where
-    [(); <T as AssocCt>::ASSOC]:,
-{
-    type Assoc = [u8; <T as AssocCt>::ASSOC];
-}
-
-fn generic<T: 'static, U>(x: <T as WithAssoc<U>>::Assoc) -> <T as WithAssoc<U>>::Assoc
-where
-    [(); <T as AssocCt>::ASSOC]:,
-    T: WithAssoc<U>,
-{
-    x
-}
-
-fn unsound<T>(x: <One as WithAssoc<T>>::Assoc) -> <Two as WithAssoc<T>>::Assoc
-where
-    One: WithAssoc<T>,
-{
-    let x: <Two as WithAssoc<T>>::Assoc = generic::<One, T>(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 26e724c9061..00000000000
--- 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<T>` is not satisfied
-  --> $DIR/typeid-equality-by-subtyping.rs:44:51
-   |
-LL | fn unsound<T>(x: <One as WithAssoc<T>>::Assoc) -> <Two as WithAssoc<T>>::Assoc
-   |                                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `WithAssoc<T>` is not implemented for `for<'a, 'b> fn(&'a (), &'b ())`
-
-error[E0277]: the trait bound `for<'a, 'b> fn(&'a (), &'b ()): WithAssoc<T>` is not satisfied
-  --> $DIR/typeid-equality-by-subtyping.rs:47:1
-   |
-LL | / {
-LL | |     let x: <Two as WithAssoc<T>>::Assoc = generic::<One, T>(x);
-LL | |     x
-LL | | }
-   | |_^ the trait `WithAssoc<T>` 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`.