aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/compile/torture/generics16.rs
blob: a9fa2ebdf0bc188e428c6f0e99d7200d8b214771 (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
32
33
34
#[lang = "sized"]
pub trait Sized {}

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 }
}