2018-08-30 12:18:55 +00:00
|
|
|
// run-pass
|
2018-09-25 21:51:35 +00:00
|
|
|
#![allow(unused_variables)]
|
2015-02-07 12:14:17 +00:00
|
|
|
// Regression test for Issue #20343.
|
|
|
|
|
2015-03-22 20:13:15 +00:00
|
|
|
// pretty-expanded FIXME #23616
|
|
|
|
|
2015-02-07 12:14:17 +00:00
|
|
|
#![deny(dead_code)]
|
|
|
|
|
|
|
|
struct B { b: u32 }
|
|
|
|
struct C;
|
|
|
|
struct D;
|
|
|
|
|
2015-02-12 15:29:52 +00:00
|
|
|
trait T<A> { fn dummy(&self, a: A) { } }
|
2015-02-07 12:14:17 +00: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::<()>();
|
|
|
|
}
|