From 218caa410aa38c29984be31a5229b9fa717560ee Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:13 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- .../item-collection/transitive-drop-glue.rs | 46 ++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 tests/codegen-units/item-collection/transitive-drop-glue.rs (limited to 'tests/codegen-units/item-collection/transitive-drop-glue.rs') 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:: - 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:: - 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:: - shim(Some(Leaf)) @@ transitive_drop_glue-cgu.0[Internal] +struct Leaf; + +impl Drop for Leaf { + //~ MONO_ITEM fn ::drop + fn drop(&mut self) {} +} + +struct RootGen(#[allow(unused_tuple_struct_fields)] IntermediateGen); +struct IntermediateGen(#[allow(unused_tuple_struct_fields)] LeafGen); +struct LeafGen(#[allow(unused_tuple_struct_fields)] T); + +impl Drop for LeafGen { + 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::> - shim(Some(RootGen)) @@ transitive_drop_glue-cgu.0[Internal] + //~ MONO_ITEM fn std::ptr::drop_in_place::> - shim(Some(IntermediateGen)) @@ transitive_drop_glue-cgu.0[Internal] + //~ MONO_ITEM fn std::ptr::drop_in_place::> - shim(Some(LeafGen)) @@ transitive_drop_glue-cgu.0[Internal] + //~ MONO_ITEM fn as std::ops::Drop>::drop + let _ = RootGen(IntermediateGen(LeafGen(0u32))); + + //~ MONO_ITEM fn std::ptr::drop_in_place::> - shim(Some(RootGen)) @@ transitive_drop_glue-cgu.0[Internal] + //~ MONO_ITEM fn std::ptr::drop_in_place::> - shim(Some(IntermediateGen)) @@ transitive_drop_glue-cgu.0[Internal] + //~ MONO_ITEM fn std::ptr::drop_in_place::> - shim(Some(LeafGen)) @@ transitive_drop_glue-cgu.0[Internal] + //~ MONO_ITEM fn as std::ops::Drop>::drop + let _ = RootGen(IntermediateGen(LeafGen(0i16))); + + 0 +} -- cgit v1.2.3