]> git.proxmox.com Git - rustc.git/blame - src/test/codegen-units/non-generic-drop-glue.rs
Imported Upstream version 1.9.0+dfsg1
[rustc.git] / src / test / codegen-units / non-generic-drop-glue.rs
CommitLineData
7453a54e
SL
1// Copyright 2012-2015 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.
4//
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.
10
11// ignore-tidy-linelength
12// compile-flags:-Zprint-trans-items=eager
13
14#![deny(dead_code)]
15
16//~ TRANS_ITEM drop-glue non_generic_drop_glue::StructWithDrop[0]
17struct StructWithDrop {
18 x: i32
19}
20
21impl Drop for StructWithDrop {
54a0048b 22 //~ TRANS_ITEM fn non_generic_drop_glue::{{impl}}[0]::drop[0]
7453a54e
SL
23 fn drop(&mut self) {}
24}
25
26struct StructNoDrop {
27 x: i32
28}
29
30//~ TRANS_ITEM drop-glue non_generic_drop_glue::EnumWithDrop[0]
31enum EnumWithDrop {
32 A(i32)
33}
34
35impl Drop for EnumWithDrop {
54a0048b 36 //~ TRANS_ITEM fn non_generic_drop_glue::{{impl}}[1]::drop[0]
7453a54e
SL
37 fn drop(&mut self) {}
38}
39
40enum EnumNoDrop {
41 A(i32)
42}
43
44//~ TRANS_ITEM fn non_generic_drop_glue::main[0]
45fn main() {
46 let _ = StructWithDrop { x: 0 }.x;
47 let _ = StructNoDrop { x: 0 }.x;
48 let _ = match EnumWithDrop::A(0) {
49 EnumWithDrop::A(x) => x
50 };
51 let _ = match EnumNoDrop::A(0) {
52 EnumNoDrop::A(x) => x
53 };
54}
55
56//~ TRANS_ITEM drop-glue i8