#[lang = "sized"] pub trait Sized {} struct Foo(T); struct Bar { a: Foo, b: bool, // { dg-warning "field is never read" "" { target *-*-* } .-1 } } fn test(a: Bar) -> Foo { a.a } fn main() { let a: Bar = Bar:: { a: Foo::(123), b: true, }; let b: Foo = test(a); // { dg-warning "unused name" "" { target *-*-* } .-1 } }