]> git.lizzy.rs Git - rust.git/blob - tests/ui/traits/object/enforce-supertrait-projection.rs
Rollup merge of #103702 - WaffleLapkin:lift-sized-bounds-from-pointer-methods-where...
[rust.git] / tests / ui / traits / object / enforce-supertrait-projection.rs
1 trait SuperTrait {
2     type A;
3     type B;
4 }
5
6 trait Trait: SuperTrait<A = <Self as SuperTrait>::B> {}
7
8 fn transmute<A, B>(x: A) -> B {
9     foo::<A, B, dyn Trait<A = A, B = B>>(x)
10     //~^ ERROR type mismatch resolving `<dyn Trait<B = B, A = A> as SuperTrait>::A == B`
11 }
12
13 fn foo<A, B, T: ?Sized>(x: T::A) -> B
14 where
15     T: Trait<B = B>,
16 {
17     x
18 }
19
20 static X: u8 = 0;
21 fn main() {
22     let x = transmute::<&u8, &[u8; 1_000_000]>(&X);
23     println!("{:?}", x[100_000]);
24 }