aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/compile/impl_trait_generic_arg.rs
blob: ecdb08803b40829188f68863e2eead1ff28053db (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
#[lang = "sized"]
trait Sized {}

trait Foo {
    fn id(&self) -> u8;
}

struct Bar;

impl Foo for Bar {
    fn id(&self) -> u8 {
        1
    }
}

fn takes(val: impl Foo) -> u8 {
    val.id()
}

fn main() {
    let b = Bar;
    let x = takes::<Bar>(b);
    // { dg-error "cannot provide explicit generic arguments when .impl Trait. is used in argument position .E0632." "" { target *-*-* } .-1 }
}