about summary refs log tree commit diff
path: root/tests/ui/traits/trait-upcasting/upcast-defining-opaque.rs
blob: 3e36ce0dc726ecc9b8c332130cf37a5bdc634e60 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
//@ revisions: current next
//@[next] compile-flags: -Znext-solver
//@ ignore-compare-mode-next-solver (explicit revisions)
//@check-pass

#![feature(type_alias_impl_trait)]

trait Super {
    type Assoc;
}

trait Sub: Super {}

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

type Foo = impl Sized;

#[define_opaque(Foo)]
fn upcast(x: &dyn Sub<Assoc = Foo>) -> &dyn Super<Assoc = i32> {
    x
}

fn main() {}