Debian Codegraph @

gcc/testsuite/rust/compile/torture/generics10.rs

raw
1 #[lang = "sized"]
2 pub trait Sized {}
3
4 struct Foo<T>(T);
5
6 struct Bar<T> {
7 a: Foo<T>,
8 b: bool,
9 // { dg-warning "field is never read" "" { target *-*-* } .-1 }
10 }
11
12 fn test<T>(a: Bar<T>) -> Foo<T> {
13 a.a
14 }
15
16 fn main() {
17 let a: Bar<i32> = Bar::<i32> {
18 a: Foo::<i32>(123),
19 b: true,
20 };
21 let b: Foo<i32> = test(a);
22 // { dg-warning "unused name" "" { target *-*-* } .-1 }
23 }