]> git.lizzy.rs Git - rust.git/blob - src/test/codegen-units/item-collection/non-generic-drop-glue.rs
Auto merge of #104535 - mikebenfield:discr-fix, r=pnkfelix
[rust.git] / src / test / codegen-units / item-collection / non-generic-drop-glue.rs
1 //
2 // compile-flags:-Zprint-mono-items=eager
3 // compile-flags:-Zinline-in-all-cgus
4
5 #![deny(dead_code)]
6 #![feature(start)]
7
8 //~ MONO_ITEM fn std::ptr::drop_in_place::<StructWithDrop> - shim(Some(StructWithDrop)) @@ non_generic_drop_glue-cgu.0[Internal]
9 struct StructWithDrop {
10     x: i32
11 }
12
13 impl Drop for StructWithDrop {
14     //~ MONO_ITEM fn <StructWithDrop as std::ops::Drop>::drop
15     fn drop(&mut self) {}
16 }
17
18 struct StructNoDrop {
19     x: i32
20 }
21
22 //~ MONO_ITEM fn std::ptr::drop_in_place::<EnumWithDrop> - shim(Some(EnumWithDrop)) @@ non_generic_drop_glue-cgu.0[Internal]
23 enum EnumWithDrop {
24     A(i32)
25 }
26
27 impl Drop for EnumWithDrop {
28     //~ MONO_ITEM fn <EnumWithDrop as std::ops::Drop>::drop
29     fn drop(&mut self) {}
30 }
31
32 enum EnumNoDrop {
33     A(i32)
34 }
35
36 //~ MONO_ITEM fn start
37 #[start]
38 fn start(_: isize, _: *const *const u8) -> isize {
39     let _ = StructWithDrop { x: 0 }.x;
40     let _ = StructNoDrop { x: 0 }.x;
41     let _ = match EnumWithDrop::A(0) {
42         EnumWithDrop::A(x) => x
43     };
44     let _ = match EnumNoDrop::A(0) {
45         EnumNoDrop::A(x) => x
46     };
47
48     0
49 }