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

struct Foo<T>(T);

struct Bar<T> {
    a: Foo<T>,
    b: bool,
// { dg-warning "field is never read" "" { target *-*-* } .-1 }
}

fn test<T>(a: Bar<T>) -> Foo<T> {
    a.a
}

fn main() {
    let a: Bar<i32> = Bar::<i32> {
        a: Foo::<i32>(123),
        b: true,
    };
    let b: Foo<i32> = test(a);
    // { dg-warning "unused name" "" { target *-*-* } .-1 }
}