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