1 // Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution.
4 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
5 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
6 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
7 // option. This file may not be copied, modified, or distributed
8 // except according to those terms.
10 #![feature(box_syntax)]
11 #![allow(clippy::deref_addrof)]
12 #![warn(clippy::unnecessary_operation)]
20 Struct { field: i32 },
25 impl Drop for DropStruct {
28 struct DropTuple(i32);
29 impl Drop for DropTuple {
34 Struct { field: i32 },
36 impl Drop for DropEnum {
43 fn get_number() -> i32 { 0 }
44 fn get_struct() -> Struct { Struct { field: 0 } }
45 fn get_drop_struct() -> DropStruct { DropStruct { field: 0 } }
49 Struct { field: get_number() };
50 Struct { ..get_struct() };
51 Enum::Tuple(get_number());
52 Enum::Struct { field: get_number() };
62 [42, 55][get_number() as usize];
65 [42; 55][get_number() as usize];
67 FooString { s: String::from("blah"), };
70 DropTuple(get_number());
71 DropStruct { field: get_number() };
72 DropStruct { field: get_number() };
73 DropStruct { ..get_drop_struct() };
74 DropEnum::Tuple(get_number());
75 DropEnum::Struct { field: get_number() };