Skip to content

Commit d2563d5

Browse files
committed
bless codegen-unit tests
1 parent 5ffca45 commit d2563d5

12 files changed

Lines changed: 44 additions & 41 deletions

tests/codegen-units/item-collection/drop-glue-eager.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//@ compile-flags:-Clink-dead-code
44
//@ compile-flags:--crate-type=lib
55

6-
//~ MONO_ITEM fn std::ptr::drop_in_place::<StructWithDrop> - shim(Some(StructWithDrop))
6+
//~ MONO_ITEM fn std::ptr::drop_glue::<StructWithDrop> - shim(Some(StructWithDrop))
77
struct StructWithDrop {
88
x: i32,
99
}
@@ -17,7 +17,7 @@ struct StructNoDrop {
1717
x: i32,
1818
}
1919

20-
//~ MONO_ITEM fn std::ptr::drop_in_place::<EnumWithDrop> - shim(Some(EnumWithDrop))
20+
//~ MONO_ITEM fn std::ptr::drop_glue::<EnumWithDrop> - shim(Some(EnumWithDrop))
2121
enum EnumWithDrop {
2222
A(i32),
2323
}
@@ -37,14 +37,14 @@ impl<'a> Drop for StructWithDropAndLt<'a> {
3737
fn drop(&mut self) {}
3838
}
3939

40-
//~ MONO_ITEM fn std::ptr::drop_in_place::<StructWithDropAndLt<'_>> - shim(Some(StructWithDropAndLt<'_>))
40+
//~ MONO_ITEM fn std::ptr::drop_glue::<StructWithDropAndLt<'_>> - shim(Some(StructWithDropAndLt<'_>))
4141
struct StructWithDropAndLt<'a> {
4242
x: &'a i32,
4343
}
4444

4545
// Make sure we don't ICE when checking impossible predicates for the struct.
4646
// Regression test for <https://github.com/rust-lang/rust/issues/135515>.
47-
//~ MONO_ITEM fn std::ptr::drop_in_place::<StructWithLtAndPredicate<'_>> - shim(Some(StructWithLtAndPredicate<'_>))
47+
//~ MONO_ITEM fn std::ptr::drop_glue::<StructWithLtAndPredicate<'_>> - shim(Some(StructWithLtAndPredicate<'_>))
4848
struct StructWithLtAndPredicate<'a: 'a> {
4949
x: &'a i32,
5050
}

tests/codegen-units/item-collection/drop-glue-noop.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
pub fn start(_: isize, _: *const *const u8) -> isize {
99
// No item produced for this, it's a no-op drop and so is removed.
1010
unsafe {
11+
// FIXME: is not removed on opt-level=0 anymore...
12+
//~ MONO_ITEM fn std::ptr::drop_in_place::<u32> @@ drop_glue_noop-cgu.0[External]
1113
std::ptr::drop_in_place::<u32>(&mut 0);
1214
}
1315

@@ -16,7 +18,7 @@ pub fn start(_: isize, _: *const *const u8) -> isize {
1618
// instantiation-through-vtable.rs) because we special case null pointer for drop glue since
1719
// #122662.
1820
//
19-
//~ MONO_ITEM fn std::ptr::drop_in_place::<u64> - shim(None) @@ drop_glue_noop-cgu.0[External]
21+
//~ MONO_ITEM fn std::ptr::drop_in_place::<u64> @@ drop_glue_noop-cgu.0[External]
2022
std::ptr::drop_in_place::<u64> as unsafe fn(*mut u64);
2123

2224
0

tests/codegen-units/item-collection/drop_in_place_intrinsic.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,17 @@
44

55
#![crate_type = "lib"]
66

7-
//~ MONO_ITEM fn std::ptr::drop_in_place::<StructWithDtor> - shim(Some(StructWithDtor)) @@ drop_in_place_intrinsic-cgu.0[Internal]
7+
//~ MONO_ITEM fn std::ptr::drop_glue::<StructWithDtor> - shim(Some(StructWithDtor)) @@ drop_in_place_intrinsic-cgu.0[Internal]
88
struct StructWithDtor(u32);
99

1010
impl Drop for StructWithDtor {
1111
//~ MONO_ITEM fn <StructWithDtor as std::ops::Drop>::drop
1212
fn drop(&mut self) {}
1313
}
14-
1514
//~ MONO_ITEM fn start
1615
#[no_mangle]
1716
pub fn start(_: isize, _: *const *const u8) -> isize {
18-
//~ MONO_ITEM fn std::ptr::drop_in_place::<[StructWithDtor; 2]> - shim(Some([StructWithDtor; 2])) @@ drop_in_place_intrinsic-cgu.0[Internal]
17+
//~ MONO_ITEM fn std::ptr::drop_glue::<[StructWithDtor; 2]> - shim(Some([StructWithDtor; 2])) @@ drop_in_place_intrinsic-cgu.0[Internal]
1918
let x = [StructWithDtor(0), StructWithDtor(1)];
2019

2120
drop_slice_in_place(&x);
@@ -26,10 +25,12 @@ pub fn start(_: isize, _: *const *const u8) -> isize {
2625
//~ MONO_ITEM fn drop_slice_in_place
2726
fn drop_slice_in_place(x: &[StructWithDtor]) {
2827
unsafe {
28+
// FIXME: drop_in_place isn't an intrinsic....
2929
// This is the interesting thing in this test case: Normally we would
3030
// not have drop-glue for the unsized [StructWithDtor]. This has to be
3131
// generated though when the drop_in_place() intrinsic is used.
32-
//~ MONO_ITEM fn std::ptr::drop_in_place::<[StructWithDtor]> - shim(Some([StructWithDtor])) @@ drop_in_place_intrinsic-cgu.0[Internal]
32+
//~ MONO_ITEM fn std::ptr::drop_glue::<[StructWithDtor]> - shim(Some([StructWithDtor])) @@ drop_in_place_intrinsic-cgu.0[Internal]
33+
//~ MONO_ITEM fn std::ptr::drop_in_place::<[StructWithDtor]> @@ drop_in_place_intrinsic-cgu.0[External]
3334
::std::ptr::drop_in_place(x as *const _ as *mut [StructWithDtor]);
3435
}
3536
}

tests/codegen-units/item-collection/generic-drop-glue.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ enum EnumNoDrop<T1, T2> {
3535
struct NonGenericNoDrop(#[allow(dead_code)] i32);
3636

3737
struct NonGenericWithDrop(#[allow(dead_code)] i32);
38-
//~ MONO_ITEM fn std::ptr::drop_in_place::<NonGenericWithDrop> - shim(Some(NonGenericWithDrop)) @@ generic_drop_glue-cgu.0[Internal]
38+
//~ MONO_ITEM fn std::ptr::drop_glue::<NonGenericWithDrop> - shim(Some(NonGenericWithDrop)) @@ generic_drop_glue-cgu.0[Internal]
3939

4040
impl Drop for NonGenericWithDrop {
4141
//~ MONO_ITEM fn <NonGenericWithDrop as std::ops::Drop>::drop
@@ -45,11 +45,11 @@ impl Drop for NonGenericWithDrop {
4545
//~ MONO_ITEM fn start
4646
#[no_mangle]
4747
pub fn start(_: isize, _: *const *const u8) -> isize {
48-
//~ MONO_ITEM fn std::ptr::drop_in_place::<StructWithDrop<i8, char>> - shim(Some(StructWithDrop<i8, char>)) @@ generic_drop_glue-cgu.0[Internal]
48+
//~ MONO_ITEM fn std::ptr::drop_glue::<StructWithDrop<i8, char>> - shim(Some(StructWithDrop<i8, char>)) @@ generic_drop_glue-cgu.0[Internal]
4949
//~ MONO_ITEM fn <StructWithDrop<i8, char> as std::ops::Drop>::drop
5050
let _ = StructWithDrop { x: 0i8, y: 'a' }.x;
5151

52-
//~ MONO_ITEM fn std::ptr::drop_in_place::<StructWithDrop<&str, NonGenericNoDrop>> - shim(Some(StructWithDrop<&str, NonGenericNoDrop>)) @@ generic_drop_glue-cgu.0[Internal]
52+
//~ MONO_ITEM fn std::ptr::drop_glue::<StructWithDrop<&str, NonGenericNoDrop>> - shim(Some(StructWithDrop<&str, NonGenericNoDrop>)) @@ generic_drop_glue-cgu.0[Internal]
5353
//~ MONO_ITEM fn <StructWithDrop<&str, NonGenericNoDrop> as std::ops::Drop>::drop
5454
let _ = StructWithDrop { x: "&str", y: NonGenericNoDrop(0) }.y;
5555

@@ -58,17 +58,17 @@ pub fn start(_: isize, _: *const *const u8) -> isize {
5858

5959
// This is supposed to generate drop-glue because it contains a field that
6060
// needs to be dropped.
61-
//~ MONO_ITEM fn std::ptr::drop_in_place::<StructNoDrop<NonGenericWithDrop, f64>> - shim(Some(StructNoDrop<NonGenericWithDrop, f64>)) @@ generic_drop_glue-cgu.0[Internal]
61+
//~ MONO_ITEM fn std::ptr::drop_glue::<StructNoDrop<NonGenericWithDrop, f64>> - shim(Some(StructNoDrop<NonGenericWithDrop, f64>)) @@ generic_drop_glue-cgu.0[Internal]
6262
let _ = StructNoDrop { x: NonGenericWithDrop(0), y: 0f64 }.y;
6363

64-
//~ MONO_ITEM fn std::ptr::drop_in_place::<EnumWithDrop<i32, i64>> - shim(Some(EnumWithDrop<i32, i64>)) @@ generic_drop_glue-cgu.0[Internal]
64+
//~ MONO_ITEM fn std::ptr::drop_glue::<EnumWithDrop<i32, i64>> - shim(Some(EnumWithDrop<i32, i64>)) @@ generic_drop_glue-cgu.0[Internal]
6565
//~ MONO_ITEM fn <EnumWithDrop<i32, i64> as std::ops::Drop>::drop
6666
let _ = match EnumWithDrop::A::<i32, i64>(0) {
6767
EnumWithDrop::A(x) => x,
6868
EnumWithDrop::B(x) => x as i32,
6969
};
7070

71-
//~ MONO_ITEM fn std::ptr::drop_in_place::<EnumWithDrop<f64, f32>> - shim(Some(EnumWithDrop<f64, f32>)) @@ generic_drop_glue-cgu.0[Internal]
71+
//~ MONO_ITEM fn std::ptr::drop_glue::<EnumWithDrop<f64, f32>> - shim(Some(EnumWithDrop<f64, f32>)) @@ generic_drop_glue-cgu.0[Internal]
7272
//~ MONO_ITEM fn <EnumWithDrop<f64, f32> as std::ops::Drop>::drop
7373
let _ = match EnumWithDrop::B::<f64, f32>(1.0) {
7474
EnumWithDrop::A(x) => x,

tests/codegen-units/item-collection/non-generic-closures.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ fn assigned_to_variable_executed_directly() {
4343
//~ MONO_ITEM fn with_drop @@ non_generic_closures-cgu.0[External]
4444
fn with_drop(v: PresentDrop) {
4545
//~ MONO_ITEM fn with_drop::{closure#0} @@ non_generic_closures-cgu.0[External]
46-
//~ MONO_ITEM fn std::ptr::drop_in_place::<PresentDrop> - shim(Some(PresentDrop)) @@ non_generic_closures-cgu.0[Internal]
47-
//~ MONO_ITEM fn std::ptr::drop_in_place::<{closure@TEST_PATH:49:14: 49:24}> - shim(Some({closure@TEST_PATH:49:14: 49:24})) @@ non_generic_closures-cgu.0[Internal]
46+
//~ MONO_ITEM fn std::ptr::drop_glue::<PresentDrop> - shim(Some(PresentDrop)) @@ non_generic_closures-cgu.0[Internal]
47+
//~ MONO_ITEM fn std::ptr::drop_glue::<{closure@TEST_PATH:49:14: 49:24}> - shim(Some({closure@TEST_PATH:49:14: 49:24})) @@ non_generic_closures-cgu.0[Internal]
4848

4949
let _f = |a: usize| {
5050
let _ = a + 2;

tests/codegen-units/item-collection/non-generic-drop-glue.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#![deny(dead_code)]
55
#![crate_type = "lib"]
66

7-
//~ MONO_ITEM fn std::ptr::drop_in_place::<StructWithDrop> - shim(Some(StructWithDrop)) @@ non_generic_drop_glue-cgu.0[Internal]
7+
//~ MONO_ITEM fn std::ptr::drop_glue::<StructWithDrop> - shim(Some(StructWithDrop)) @@ non_generic_drop_glue-cgu.0[Internal]
88
struct StructWithDrop {
99
x: i32,
1010
}
@@ -18,7 +18,7 @@ struct StructNoDrop {
1818
x: i32,
1919
}
2020

21-
//~ MONO_ITEM fn std::ptr::drop_in_place::<EnumWithDrop> - shim(Some(EnumWithDrop)) @@ non_generic_drop_glue-cgu.0[Internal]
21+
//~ MONO_ITEM fn std::ptr::drop_glue::<EnumWithDrop> - shim(Some(EnumWithDrop)) @@ non_generic_drop_glue-cgu.0[Internal]
2222
enum EnumWithDrop {
2323
A(i32),
2424
}

tests/codegen-units/item-collection/transitive-drop-glue.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
#![deny(dead_code)]
55
#![crate_type = "lib"]
66

7-
//~ MONO_ITEM fn std::ptr::drop_in_place::<Root> - shim(Some(Root)) @@ transitive_drop_glue-cgu.0[Internal]
7+
//~ MONO_ITEM fn std::ptr::drop_glue::<Root> - shim(Some(Root)) @@ transitive_drop_glue-cgu.0[Internal]
88
struct Root(#[allow(dead_code)] Intermediate);
9-
//~ MONO_ITEM fn std::ptr::drop_in_place::<Intermediate> - shim(Some(Intermediate)) @@ transitive_drop_glue-cgu.0[Internal]
9+
//~ MONO_ITEM fn std::ptr::drop_glue::<Intermediate> - shim(Some(Intermediate)) @@ transitive_drop_glue-cgu.0[Internal]
1010
struct Intermediate(#[allow(dead_code)] Leaf);
11-
//~ MONO_ITEM fn std::ptr::drop_in_place::<Leaf> - shim(Some(Leaf)) @@ transitive_drop_glue-cgu.0[Internal]
11+
//~ MONO_ITEM fn std::ptr::drop_glue::<Leaf> - shim(Some(Leaf)) @@ transitive_drop_glue-cgu.0[Internal]
1212
struct Leaf;
1313

1414
impl Drop for Leaf {
@@ -29,15 +29,15 @@ impl<T> Drop for LeafGen<T> {
2929
pub fn start(_: isize, _: *const *const u8) -> isize {
3030
let _ = Root(Intermediate(Leaf));
3131

32-
//~ MONO_ITEM fn std::ptr::drop_in_place::<RootGen<u32>> - shim(Some(RootGen<u32>)) @@ transitive_drop_glue-cgu.0[Internal]
33-
//~ MONO_ITEM fn std::ptr::drop_in_place::<IntermediateGen<u32>> - shim(Some(IntermediateGen<u32>)) @@ transitive_drop_glue-cgu.0[Internal]
34-
//~ MONO_ITEM fn std::ptr::drop_in_place::<LeafGen<u32>> - shim(Some(LeafGen<u32>)) @@ transitive_drop_glue-cgu.0[Internal]
32+
//~ MONO_ITEM fn std::ptr::drop_glue::<RootGen<u32>> - shim(Some(RootGen<u32>)) @@ transitive_drop_glue-cgu.0[Internal]
33+
//~ MONO_ITEM fn std::ptr::drop_glue::<IntermediateGen<u32>> - shim(Some(IntermediateGen<u32>)) @@ transitive_drop_glue-cgu.0[Internal]
34+
//~ MONO_ITEM fn std::ptr::drop_glue::<LeafGen<u32>> - shim(Some(LeafGen<u32>)) @@ transitive_drop_glue-cgu.0[Internal]
3535
//~ MONO_ITEM fn <LeafGen<u32> as std::ops::Drop>::drop
3636
let _ = RootGen(IntermediateGen(LeafGen(0u32)));
3737

38-
//~ MONO_ITEM fn std::ptr::drop_in_place::<RootGen<i16>> - shim(Some(RootGen<i16>)) @@ transitive_drop_glue-cgu.0[Internal]
39-
//~ MONO_ITEM fn std::ptr::drop_in_place::<IntermediateGen<i16>> - shim(Some(IntermediateGen<i16>)) @@ transitive_drop_glue-cgu.0[Internal]
40-
//~ MONO_ITEM fn std::ptr::drop_in_place::<LeafGen<i16>> - shim(Some(LeafGen<i16>)) @@ transitive_drop_glue-cgu.0[Internal]
38+
//~ MONO_ITEM fn std::ptr::drop_glue::<RootGen<i16>> - shim(Some(RootGen<i16>)) @@ transitive_drop_glue-cgu.0[Internal]
39+
//~ MONO_ITEM fn std::ptr::drop_glue::<IntermediateGen<i16>> - shim(Some(IntermediateGen<i16>)) @@ transitive_drop_glue-cgu.0[Internal]
40+
//~ MONO_ITEM fn std::ptr::drop_glue::<LeafGen<i16>> - shim(Some(LeafGen<i16>)) @@ transitive_drop_glue-cgu.0[Internal]
4141
//~ MONO_ITEM fn <LeafGen<i16> as std::ops::Drop>::drop
4242
let _ = RootGen(IntermediateGen(LeafGen(0i16)));
4343

tests/codegen-units/item-collection/tuple-drop-glue.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#![deny(dead_code)]
55
#![crate_type = "lib"]
66

7-
//~ MONO_ITEM fn std::ptr::drop_in_place::<Dropped> - shim(Some(Dropped)) @@ tuple_drop_glue-cgu.0[Internal]
7+
//~ MONO_ITEM fn std::ptr::drop_glue::<Dropped> - shim(Some(Dropped)) @@ tuple_drop_glue-cgu.0[Internal]
88
struct Dropped;
99

1010
impl Drop for Dropped {
@@ -15,11 +15,11 @@ impl Drop for Dropped {
1515
//~ MONO_ITEM fn start
1616
#[no_mangle]
1717
pub fn start(_: isize, _: *const *const u8) -> isize {
18-
//~ MONO_ITEM fn std::ptr::drop_in_place::<(u32, Dropped)> - shim(Some((u32, Dropped))) @@ tuple_drop_glue-cgu.0[Internal]
18+
//~ MONO_ITEM fn std::ptr::drop_glue::<(u32, Dropped)> - shim(Some((u32, Dropped))) @@ tuple_drop_glue-cgu.0[Internal]
1919
let x = (0u32, Dropped);
2020

21-
//~ MONO_ITEM fn std::ptr::drop_in_place::<(i16, (Dropped, bool))> - shim(Some((i16, (Dropped, bool)))) @@ tuple_drop_glue-cgu.0[Internal]
22-
//~ MONO_ITEM fn std::ptr::drop_in_place::<(Dropped, bool)> - shim(Some((Dropped, bool))) @@ tuple_drop_glue-cgu.0[Internal]
21+
//~ MONO_ITEM fn std::ptr::drop_glue::<(i16, (Dropped, bool))> - shim(Some((i16, (Dropped, bool)))) @@ tuple_drop_glue-cgu.0[Internal]
22+
//~ MONO_ITEM fn std::ptr::drop_glue::<(Dropped, bool)> - shim(Some((Dropped, bool))) @@ tuple_drop_glue-cgu.0[Internal]
2323
let x = (0i16, (Dropped, true));
2424

2525
0

tests/codegen-units/item-collection/unsizing.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ pub fn start(_: isize, _: *const *const u8) -> isize {
7979
// with drop
8080
let droppable = &PresentDrop;
8181
//~ MONO_ITEM fn <PresentDrop as std::ops::Drop>::drop @@ unsizing-cgu.0[Internal]
82-
//~ MONO_ITEM fn std::ptr::drop_in_place::<PresentDrop> - shim(Some(PresentDrop)) @@ unsizing-cgu.0[Internal]
82+
//~ MONO_ITEM fn std::ptr::drop_glue::<PresentDrop> - shim(Some(PresentDrop)) @@ unsizing-cgu.0[Internal]
8383
//~ MONO_ITEM fn <PresentDrop as Trait>::foo
8484
let droppable = droppable as &dyn Trait;
8585

tests/codegen-units/partitioning/extern-drop-glue.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ extern crate cgu_extern_drop_glue;
99
// This test checks that drop glue is generated, even for types not defined in this crate, and all
1010
// drop glue is put in the fallback CGU.
1111

12-
//~ MONO_ITEM fn std::ptr::drop_in_place::<cgu_extern_drop_glue::Struct> - shim(Some(cgu_extern_drop_glue::Struct)) @@ extern_drop_glue-fallback.cgu[External]
12+
//~ MONO_ITEM fn std::ptr::drop_glue::<cgu_extern_drop_glue::Struct> - shim(Some(cgu_extern_drop_glue::Struct)) @@ extern_drop_glue-fallback.cgu[External]
1313

1414
struct LocalStruct(cgu_extern_drop_glue::Struct);
1515

1616
//~ MONO_ITEM fn user @@ extern_drop_glue[External]
1717
pub fn user() {
18-
//~ MONO_ITEM fn std::ptr::drop_in_place::<LocalStruct> - shim(Some(LocalStruct)) @@ extern_drop_glue-fallback.cgu[External]
18+
//~ MONO_ITEM fn std::ptr::drop_glue::<LocalStruct> - shim(Some(LocalStruct)) @@ extern_drop_glue-fallback.cgu[External]
1919
let _ = LocalStruct(cgu_extern_drop_glue::Struct(0));
2020
}
2121

@@ -26,7 +26,7 @@ pub mod mod1 {
2626

2727
//~ MONO_ITEM fn mod1::user @@ extern_drop_glue-mod1[External]
2828
pub fn user() {
29-
//~ MONO_ITEM fn std::ptr::drop_in_place::<mod1::LocalStruct> - shim(Some(mod1::LocalStruct)) @@ extern_drop_glue-fallback.cgu[External]
29+
//~ MONO_ITEM fn std::ptr::drop_glue::<mod1::LocalStruct> - shim(Some(mod1::LocalStruct)) @@ extern_drop_glue-fallback.cgu[External]
3030
let _ = LocalStruct(cgu_extern_drop_glue::Struct(0));
3131
}
3232
}

0 commit comments

Comments
 (0)