2021-12-26 00:45:05 -06:00
|
|
|
trait SuperTrait {
|
|
|
|
type A;
|
|
|
|
type B;
|
|
|
|
}
|
|
|
|
|
|
|
|
trait Trait: SuperTrait<A = <Self as SuperTrait>::B> {}
|
|
|
|
|
|
|
|
fn transmute<A, B>(x: A) -> B {
|
|
|
|
foo::<A, B, dyn Trait<A = A, B = B>>(x)
|
2022-05-12 13:29:11 -05:00
|
|
|
//~^ ERROR type mismatch resolving `<dyn Trait<B = B, A = A> as SuperTrait>::A == B`
|
2021-12-26 00:45:05 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
fn foo<A, B, T: ?Sized>(x: T::A) -> B
|
|
|
|
where
|
|
|
|
T: Trait<B = B>,
|
|
|
|
{
|
|
|
|
x
|
|
|
|
}
|
|
|
|
|
|
|
|
static X: u8 = 0;
|
|
|
|
fn main() {
|
|
|
|
let x = transmute::<&u8, &[u8; 1_000_000]>(&X);
|
|
|
|
println!("{:?}", x[100_000]);
|
|
|
|
}
|