aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/compile/torture/generics10.rs
blob: af12d7d328d34a0966db1792fdeff86a05b81cb6 (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
#![feature(lang_items)]
#[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 }
}