about summary refs log tree commit diff
path: root/tests/ui/specialization/min_specialization/impl-on-opaque.rs
blob: 131ad8b9d65df11f2c8b53729249d69f50bee265 (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
26
27
28
29
30
31
32
// Test that specializing on opaque types is allowed

//@ check-pass

#![feature(min_specialization, type_alias_impl_trait)]

trait SpecTrait<U> {
    fn f();
}

impl<U> SpecTrait<U> for () {
    default fn f() {}
}

type Opaque = impl Tuple;

trait Tuple {}

impl Tuple for () {}

impl SpecTrait<Opaque> for () {
    fn f() {}
}

impl SpecTrait<u32> for () {
    fn f() {}
}

#[define_opaque(Opaque)]
fn foo() -> Opaque {}

fn main() {}