]> git.lizzy.rs Git - rust.git/blob - tests/ui/lint/issue-20343.rs
Auto merge of #106884 - clubby789:fieldless-enum-debug, r=michaelwoerister
[rust.git] / tests / ui / lint / issue-20343.rs
1 // run-pass
2 #![allow(unused_variables)]
3 // Regression test for Issue #20343.
4
5 // pretty-expanded FIXME #23616
6
7 #![deny(dead_code)]
8
9 struct B { b: u32 }
10 struct C;
11 struct D;
12
13 trait T<A> { fn dummy(&self, a: A) { } }
14 impl<A> T<A> for () {}
15
16 impl B {
17     // test for unused code in arguments
18     fn foo(B { b }: B) -> u32 { b }
19
20     // test for unused code in return type
21     fn bar() -> C { unsafe { ::std::mem::transmute(()) } }
22
23     // test for unused code in generics
24     fn baz<A: T<D>>() {}
25 }
26
27 pub fn main() {
28     let b = B { b: 3 };
29     B::foo(b);
30     B::bar();
31     B::baz::<()>();
32 }