aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/compile/torture/generics18.rs
blob: cb7b1fa7404d0aac9e2c7901ccddf8f95ff3d99d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#[lang = "sized"]
pub trait Sized {}

struct Foo<T>(T);

impl<X> Foo<X> {
    fn new(a: X) -> Self {
        // { dg-warning "associated function is never used" "" { target *-*-* } .-1 }
        Self(a)
    }

    fn test(self) -> X {
        self.0
    }
}

fn main() {
    let a;
    a = Foo(123);

    let b = a.test();
    // { dg-warning "unused name" "" { target *-*-* } .-1 }
}