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.
This commit is contained in:
Matthias Krüger 2024-09-18 00:12:19 +02:00 committed by GitHub
commit 7e8eb7aa93
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 0 additions and 81 deletions

View File

@ -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::<()>([]));
}

View File

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