Debian Codegraph @

gcc/testsuite/rust/compile/torture/generics18.rs

raw
1 #[lang = "sized"]
2 pub trait Sized {}
3
4 struct Foo<T>(T);
5
6 impl<X> Foo<X> {
7 fn new(a: X) -> Self {
8 // { dg-warning "associated function is never used" "" { target *-*-* } .-1 }
9 Self(a)
10 }
11
12 fn test(self) -> X {
13 self.0
14 }
15 }
16
17 fn main() {
18 let a;
19 a = Foo(123);
20
21 let b = a.test();
22 // { dg-warning "unused name" "" { target *-*-* } .-1 }
23 }