Debian Codegraph @

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

raw
1 #[lang = "sized"]
2 pub trait Sized {}
3
4 struct Foo(f32, bool);
5
6 struct GenericStruct<T>(T, usize);
7
8 fn main() {
9 let a1;
10 a1 = Foo(1.0, false);
11
12 let b1: f32 = a1.0;
13 // { dg-warning "unused name" "" { target *-*-* } .-1 }
14 let c1: bool = a1.1;
15 // { dg-warning "unused name" "" { target *-*-* } .-1 }
16
17 let a2: GenericStruct<i8>;
18 a2 = GenericStruct::<i8>(1, 456);
19
20 let b2: i8 = a2.0;
21 // { dg-warning "unused name" "" { target *-*-* } .-1 }
22 let c2: usize = a2.1;
23 // { dg-warning "unused name" "" { target *-*-* } .-1 }
24
25 let a3;
26 a3 = GenericStruct::<i32>(123, 456);
27
28 let b3: i32 = a3.0;
29 // { dg-warning "unused name" "" { target *-*-* } .-1 }
30 let c3: usize = a3.1;
31 // { dg-warning "unused name" "" { target *-*-* } .-1 }
32
33 let a4;
34 a4 = GenericStruct(1.0, 456);
35
36 let b4: f32 = a4.0;
37 // { dg-warning "unused name" "" { target *-*-* } .-1 }
38 let c4: usize = a4.1;
39 // { dg-warning "unused name" "" { target *-*-* } .-1 }
40
41 let a5;
42 a5 = GenericStruct::<_>(true, 456);
43
44 let b5: bool = a5.0;
45 // { dg-warning "unused name" "" { target *-*-* } .-1 }
46 let c5: usize = a5.1;
47 // { dg-warning "unused name" "" { target *-*-* } .-1 }
48 }