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

struct Foo<T>(T);

impl<X> Foo<X> {
    fn new(a: X) -> Self {
        Self(a)
    }

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

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

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