aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/compile/impl_trait_diag.rs
blob: 54a0cd220a39338620a4c32eb836e40a6f2ae1ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#[lang = "sized"]
pub trait Sized {}

trait Foo {
    fn method(&self);
}

struct Bar;
impl Foo for Bar {}

fn main() {
    let x: impl Foo = Bar; // { dg-error ".impl Trait. not allowed outside of function and inherent method return types .E0562." }

    struct Wrapper {
        field: impl Foo, // { dg-error ".impl Trait. not allowed outside of function and inherent method return types .E0562." }
    }
}