1 // Copyright 2012 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 // aux-build:structs.rs
14 use structs
::{NormalStruct, UnitStruct, TupleStruct, FunctionalRecord}
;
17 let fr
= FunctionalRecord
{
18 //~^ ERROR cannot create non-exhaustive struct
21 ..FunctionalRecord
::default()
24 let ns
= NormalStruct { first_field: 640, second_field: 480 }
;
25 //~^ ERROR cannot create non-exhaustive struct
27 let NormalStruct { first_field, second_field }
= ns
;
28 //~^ ERROR `..` required with struct marked as non-exhaustive
30 let ts
= TupleStruct(640, 480);
31 //~^ ERROR expected function, found struct `TupleStruct` [E0423]
33 let ts_explicit
= structs
::TupleStruct(640, 480);
34 //~^ ERROR tuple struct `TupleStruct` is private [E0603]
36 let TupleStruct { 0: first_field, 1: second_field }
= ts
;
37 //~^ ERROR `..` required with struct marked as non-exhaustive
40 //~^ ERROR expected value, found struct `UnitStruct` [E0423]
42 let us_explicit
= structs
::UnitStruct
;
43 //~^ ERROR unit struct `UnitStruct` is private [E0603]
45 let UnitStruct { }
= us
;
46 //~^ ERROR `..` required with struct marked as non-exhaustive