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 {
46 fn get_struct() -> Struct {
49 fn get_drop_struct() -> DropStruct {
50 DropStruct { field: 0 }
55 Struct { field: get_number() };
56 Struct { ..get_struct() };
57 Enum::Tuple(get_number());
58 Enum::Struct { field: get_number() };
68 [42, 55][get_number() as usize];
71 [42; 55][get_number() as usize];
76 s: String::from("blah"),
80 DropTuple(get_number());
81 DropStruct { field: get_number() };
82 DropStruct { field: get_number() };
83 DropStruct { ..get_drop_struct() };
84 DropEnum::Tuple(get_number());
85 DropEnum::Struct { field: get_number() };