gcc/testsuite/rust/compile/issue-2907.rs
raw| 1 | #![feature(lang_items)] |
| 2 | |
| 3 | #[lang = "sized"] |
| 4 | pub trait Sized {} |
| 5 | |
| 6 | pub trait Bar {} |
| 7 | |
| 8 | pub trait Foo { |
| 9 | type Ty; |
| 10 | |
| 11 | fn foo(self) -> Self::Ty; |
| 12 | } |
| 13 | |
| 14 | impl<B: Bar> Foo for B { |
| 15 | type Ty = u32; |
| 16 | |
| 17 | fn foo(self) -> Self::Ty { |
| 18 | // { dg-warning "unused name" "" { target *-*-* } .-1 } |
| 19 | 14 |
| 20 | } |
| 21 | } |
| 22 | |
| 23 | struct Qux; |
| 24 | |
| 25 | impl Bar for Qux {} |
| 26 | |
| 27 | fn main() { |
| 28 | let a = Qux; |
| 29 | a.foo(); |
| 30 | |
| 31 | let b = Qux; |
| 32 | Foo::foo(b); |
| 33 | } |