2018-08-30 07:18:55 -05:00
|
|
|
// run-pass
|
2018-09-25 16:51:35 -05:00
|
|
|
#![allow(unused_variables)]
|
2015-02-07 06:14:17 -06:00
|
|
|
// Regression test for Issue #20343.
|
|
|
|
|
2015-03-22 15:13:15 -05:00
|
|
|
// pretty-expanded FIXME #23616
|
|
|
|
|
2015-02-07 06:14:17 -06:00
|
|
|
#![deny(dead_code)]
|
|
|
|
|
|
|
|
struct B { b: u32 }
|
|
|
|
struct C;
|
|
|
|
struct D;
|
|
|
|
|
2015-02-12 09:29:52 -06:00
|
|
|
trait T<A> { fn dummy(&self, a: A) { } }
|
2015-02-07 06:14:17 -06:00
|
|
|
impl<A> T<A> for () {}
|
|
|
|
|
|
|
|
impl B {
|
|
|
|
// test for unused code in arguments
|
|
|
|
fn foo(B { b }: B) -> u32 { b }
|
|
|
|
|
|
|
|
// test for unused code in return type
|
|
|
|
fn bar() -> C { unsafe { ::std::mem::transmute(()) } }
|
|
|
|
|
|
|
|
// test for unused code in generics
|
|
|
|
fn baz<A: T<D>>() {}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn main() {
|
|
|
|
let b = B { b: 3 };
|
|
|
|
B::foo(b);
|
|
|
|
B::bar();
|
|
|
|
B::baz::<()>();
|
|
|
|
}
|