summaryrefslogtreecommitdiffstats
path: root/tests/codegen-units/item-collection/transitive-drop-glue.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
commit218caa410aa38c29984be31a5229b9fa717560ee (patch)
treec54bd55eeb6e4c508940a30e94c0032fbd45d677 /tests/codegen-units/item-collection/transitive-drop-glue.rs
parentReleasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-218caa410aa38c29984be31a5229b9fa717560ee.tar.xz
rustc-218caa410aa38c29984be31a5229b9fa717560ee.zip
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/codegen-units/item-collection/transitive-drop-glue.rs')
-rw-r--r--tests/codegen-units/item-collection/transitive-drop-glue.rs46
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/codegen-units/item-collection/transitive-drop-glue.rs b/tests/codegen-units/item-collection/transitive-drop-glue.rs
new file mode 100644
index 000000000..e286c800b
--- /dev/null
+++ b/tests/codegen-units/item-collection/transitive-drop-glue.rs
@@ -0,0 +1,46 @@
+//
+// compile-flags:-Zprint-mono-items=eager
+// compile-flags:-Zinline-in-all-cgus
+
+#![deny(dead_code)]
+#![feature(start)]
+
+//~ MONO_ITEM fn std::ptr::drop_in_place::<Root> - shim(Some(Root)) @@ transitive_drop_glue-cgu.0[Internal]
+struct Root(#[allow(unused_tuple_struct_fields)] Intermediate);
+//~ MONO_ITEM fn std::ptr::drop_in_place::<Intermediate> - shim(Some(Intermediate)) @@ transitive_drop_glue-cgu.0[Internal]
+struct Intermediate(#[allow(unused_tuple_struct_fields)] Leaf);
+//~ MONO_ITEM fn std::ptr::drop_in_place::<Leaf> - shim(Some(Leaf)) @@ transitive_drop_glue-cgu.0[Internal]
+struct Leaf;
+
+impl Drop for Leaf {
+ //~ MONO_ITEM fn <Leaf as std::ops::Drop>::drop
+ fn drop(&mut self) {}
+}
+
+struct RootGen<T>(#[allow(unused_tuple_struct_fields)] IntermediateGen<T>);
+struct IntermediateGen<T>(#[allow(unused_tuple_struct_fields)] LeafGen<T>);
+struct LeafGen<T>(#[allow(unused_tuple_struct_fields)] T);
+
+impl<T> Drop for LeafGen<T> {
+ fn drop(&mut self) {}
+}
+
+//~ MONO_ITEM fn start
+#[start]
+fn start(_: isize, _: *const *const u8) -> isize {
+ let _ = Root(Intermediate(Leaf));
+
+ //~ MONO_ITEM fn std::ptr::drop_in_place::<RootGen<u32>> - shim(Some(RootGen<u32>)) @@ transitive_drop_glue-cgu.0[Internal]
+ //~ MONO_ITEM fn std::ptr::drop_in_place::<IntermediateGen<u32>> - shim(Some(IntermediateGen<u32>)) @@ transitive_drop_glue-cgu.0[Internal]
+ //~ MONO_ITEM fn std::ptr::drop_in_place::<LeafGen<u32>> - shim(Some(LeafGen<u32>)) @@ transitive_drop_glue-cgu.0[Internal]
+ //~ MONO_ITEM fn <LeafGen<u32> as std::ops::Drop>::drop
+ let _ = RootGen(IntermediateGen(LeafGen(0u32)));
+
+ //~ MONO_ITEM fn std::ptr::drop_in_place::<RootGen<i16>> - shim(Some(RootGen<i16>)) @@ transitive_drop_glue-cgu.0[Internal]
+ //~ MONO_ITEM fn std::ptr::drop_in_place::<IntermediateGen<i16>> - shim(Some(IntermediateGen<i16>)) @@ transitive_drop_glue-cgu.0[Internal]
+ //~ MONO_ITEM fn std::ptr::drop_in_place::<LeafGen<i16>> - shim(Some(LeafGen<i16>)) @@ transitive_drop_glue-cgu.0[Internal]
+ //~ MONO_ITEM fn <LeafGen<i16> as std::ops::Drop>::drop
+ let _ = RootGen(IntermediateGen(LeafGen(0i16)));
+
+ 0
+}