1 // Copyright 2013 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 #![allow(unused_variables)]
12 #![allow(non_camel_case_types)]
17 b
: bool
, //~ ERROR: field is never used
20 fn field_read(f
: Foo
) -> usize {
25 X
, //~ ERROR variant is never used
26 Y
{ //~ ERROR variant is never used
34 enum ABC
{ //~ ERROR enum is never used
44 // ensure struct variants get warning for their fields
46 I
, //~ ERROR variant is never used
49 b
: i32, //~ ERROR field is never used
50 c
: i32, //~ ERROR field is never used
52 K
//~ ERROR variant is never used
56 fn struct_variant_partial_use(b
: IJK
) -> String
{
58 IJK
::J { a, b: _, .. }
=> a
,
63 fn field_match_in_patterns(b
: XYZ
) -> String
{
65 XYZ
::Y { a, b: _, .. }
=> a
,
71 x
: usize, //~ ERROR: field is never used
73 c
: bool
, //~ ERROR: field is never used
82 fn field_match_in_let(f
: Bar
) -> bool
{
83 let Bar { b, c: _, .. }
= f
;
88 field_read(Foo { x: 1, b: false }
);
89 field_match_in_patterns(XYZ
::Z
);
90 struct_variant_partial_use(IJK
::J { a: "".into(), b: 1, c: -1 }
);
91 field_match_in_let(Bar { x: 42, b: true, c: false, _guard: () }
);