gcc/testsuite/rust/compile/issue-3009.rs
raw| 1 | #[lang = "sized"] |
| 2 | trait Sized {} |
| 3 | |
| 4 | struct Foo { |
| 5 | // { dg-warning "struct is never constructed" "" { target *-*-* } .-1 } |
| 6 | t: u64, |
| 7 | } |
| 8 | |
| 9 | impl Foo { |
| 10 | fn of<T>() -> Foo { |
| 11 | // { dg-warning "associated function is never used" "" { target *-*-* } .-1 } |
| 12 | Foo { t: 14 } |
| 13 | } |
| 14 | } |
| 15 | |
| 16 | trait Bar { |
| 17 | fn bar() -> Foo; |
| 18 | } |
| 19 | |
| 20 | impl<T> Bar for T { |
| 21 | fn bar() -> Foo { |
| 22 | Foo::of::<T>() |
| 23 | } |
| 24 | } |