aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/compile/issue-3009.rs
blob: 2eb4ef39abdc0e10e314f12a05bbd50fa428a685 (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 {}

struct Foo {
    // { dg-warning "struct is never constructed" "" { target *-*-* } .-1 }
    t: u64,
}

impl Foo {
    fn of<T>() -> Foo {
        // { dg-warning "associated function is never used" "" { target *-*-* } .-1 }
        Foo { t: 14 }
    }
}

trait Bar {
    fn bar() -> Foo;
}

impl<T> Bar for T {
    fn bar() -> Foo {
        Foo::of::<T>()
    }
}