summaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/compile/torture/generics18.rs
blob: 4c98b86a1b93f5a91deb724ed1494a462551f851 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
struct Foo<T>(T);

impl<X> Foo<X> {
    fn new(a: X) -> Self {
        // { dg-warning "associated function is never used" "" { target *-*-* } .-1 }
        Self(a)
    }

    fn test(self) -> X {
        self.0
    }
}

fn main() {
    let a;
    a = Foo(123);

    let b = a.test();
    // { dg-warning "unused name" "" { target *-*-* } .-1 }
}