gcc/testsuite/rust/compile/torture/generics12.rs
raw| 1 | #[lang = "sized"] |
| 2 | pub trait Sized {} |
| 3 | |
| 4 | struct GenericStruct<T>(T, usize); |
| 5 | |
| 6 | impl GenericStruct<i32> { |
| 7 | fn new(a: i32, b: usize) -> Self { |
| 8 | GenericStruct(a, b) |
| 9 | } |
| 10 | |
| 11 | fn get(self) -> i32 { |
| 12 | self.0 |
| 13 | } |
| 14 | } |
| 15 | |
| 16 | fn main() { |
| 17 | let a: GenericStruct<i32> = GenericStruct::<i32>::new(123, 456); |
| 18 | let aa: i32 = a.get(); |
| 19 | // { dg-warning "unused name" "" { target *-*-* } .-1 } |
| 20 | } |