aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/compile/issue-2907.rs
blob: 1af843f582e413784d6eef515e1c3366da70dd51 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#![feature(lang_items)]

#[lang = "sized"]
pub trait Sized {}

pub trait Bar {}

pub trait Foo {
    type Ty;

    fn foo(self) -> Self::Ty;
}

impl<B: Bar> Foo for B {
    type Ty = u32;

    fn foo(self) -> Self::Ty {
        // { dg-warning "unused name" "" { target *-*-* } .-1 }
        14
    }
}

struct Qux;

impl Bar for Qux {}

fn main() {
    let a = Qux;
    a.foo();

    let b = Qux;
    Foo::foo(b);
}