]> git.lizzy.rs Git - rust.git/blob - src/test/codegen-units/non-generic-drop-glue.rs
Implement the translation item collector.
[rust.git] / src / test / codegen-units / non-generic-drop-glue.rs
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]
17 struct StructWithDrop {
18     x: i32
19 }
20
21 impl Drop for StructWithDrop {
22     //~ TRANS_ITEM fn non_generic_drop_glue::StructWithDrop.Drop[0]::drop[0]
23     fn drop(&mut self) {}
24 }
25
26 struct StructNoDrop {
27     x: i32
28 }
29
30 //~ TRANS_ITEM drop-glue non_generic_drop_glue::EnumWithDrop[0]
31 enum EnumWithDrop {
32     A(i32)
33 }
34
35 impl Drop for EnumWithDrop {
36     //~ TRANS_ITEM fn non_generic_drop_glue::EnumWithDrop.Drop[0]::drop[0]
37     fn drop(&mut self) {}
38 }
39
40 enum EnumNoDrop {
41     A(i32)
42 }
43
44 //~ TRANS_ITEM fn non_generic_drop_glue::main[0]
45 fn 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