summaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/compile/torture/generics16.rs
blob: 15b9d7b55e73385c04695f0fd29353a83cc470b0 (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
25
26
27
28
29
30
31
struct Foo<T>(T, bool);

impl Foo<i32> {
    fn new() -> Self {
        Foo(123, true)
    }

    fn bar(self) -> i32 {
        self.0
    }
}

impl Foo<f32> {
    fn new() -> Self {
        Foo(123f32, true)
    }

    fn bar(self) -> f32 {
        self.0
    }
}

fn main() {
    let a = Foo::<i32>::new();
    let aa: i32 = a.bar();
    // { dg-warning "unused name" "" { target *-*-* } .-1 }

    let b = Foo::<f32>::new();
    let bb: f32 = b.bar();
    // { dg-warning "unused name" "" { target *-*-* } .-1 }
}