summaryrefslogtreecommitdiffstats
path: root/tests/ui/traits/new-solver/normalize-unsize-rhs.rs
blob: a398ab4f2f2cd34cd0356d2057b1d61a1cd3c8fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// compile-flags: -Ztrait-solver=next
// check-pass

#![feature(trait_upcasting)]

trait A {}
trait B: A {}

impl A for usize {}
impl B for usize {}

trait Mirror {
    type Assoc: ?Sized;
}

impl<T: ?Sized> Mirror for T {
    type Assoc = T;
}

fn main() {
    let x = Box::new(1usize) as Box<<dyn B as Mirror>::Assoc>;
    let y = x as Box<<dyn A as Mirror>::Assoc>;
}