diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-09-18 00:12:19 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-09-18 00:12:19 +0200 |
| commit | 7e8eb7aa93b7c39fc8bf4587ef5bfdd6fd251ac2 (patch) | |
| tree | 7e761d56714411ff5e1e47fbd3ebf798c13e527d /tests | |
| parent | 0a35418d345ea20534b4ad1e6208bc1018cc0750 (diff) | |
| parent | 65f89990265211af0591c0b09e58ea833e4f7d0e (diff) | |
| download | rust-7e8eb7aa93b7c39fc8bf4587ef5bfdd6fd251ac2.tar.gz rust-7e8eb7aa93b7c39fc8bf4587ef5bfdd6fd251ac2.zip | |
Rollup merge of #130482 - spastorino:remove-known-bug-97156, r=jackh726
Remove redundant test typeid equality by subtyping This known-bug label was a left over on #118247 r? `@jackh726` This doesn't address #110395, I didn't investigate about it yet.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ui/const-generics/generic_const_exprs/typeid-equality-by-subtyping.rs | 54 | ||||
| -rw-r--r-- | tests/ui/const-generics/generic_const_exprs/typeid-equality-by-subtyping.stderr | 27 |
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`. |
