Skip to content

Commit 5d8edc9

Browse files
authored
Rollup merge of rust-lang#68335 - RalfJung:drop-in-place, r=Mark-Simulacrum
Remove real_drop_in_place In rust-lang@af9b057, I added `real_drop_in_place` because Stacked Borrows at the time couldn't handle transmuting of mutable references to raw pointers and back. Stacked Borrows 2, however, doesn't have any issue with these transmutes, so it is time to remove this hack again.
2 parents 0dc2557 + 9593493 commit 5d8edc9

18 files changed

+52
-63
lines changed

src/libcore/ptr/mod.rs

+2-12
Original file line numberDiff line numberDiff line change
@@ -169,22 +169,12 @@ mod mut_ptr;
169169
/// i.e., you do not usually have to worry about such issues unless you call `drop_in_place`
170170
/// manually.
171171
#[stable(feature = "drop_in_place", since = "1.8.0")]
172-
#[inline(always)]
173-
pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
174-
real_drop_in_place(&mut *to_drop)
175-
}
176-
177-
// The real `drop_in_place` -- the one that gets called implicitly when variables go
178-
// out of scope -- should have a safe reference and not a raw pointer as argument
179-
// type. When we drop a local variable, we access it with a pointer that behaves
180-
// like a safe reference; transmuting that to a raw pointer does not mean we can
181-
// actually access it with raw pointers.
182172
#[lang = "drop_in_place"]
183173
#[allow(unconditional_recursion)]
184-
unsafe fn real_drop_in_place<T: ?Sized>(to_drop: &mut T) {
174+
pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
185175
// Code here does not matter - this is replaced by the
186176
// real drop glue by the compiler.
187-
real_drop_in_place(to_drop)
177+
drop_in_place(to_drop)
188178
}
189179

190180
/// Creates a null raw pointer.

src/test/codegen-units/item-collection/drop_in_place_intrinsic.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
#![feature(start)]
66

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

1010
impl Drop for StructWithDtor {
@@ -16,7 +16,7 @@ impl Drop for StructWithDtor {
1616
#[start]
1717
fn start(_: isize, _: *const *const u8) -> isize {
1818

19-
//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<[drop_in_place_intrinsic::StructWithDtor[0]; 2]> @@ drop_in_place_intrinsic-cgu.0[Internal]
19+
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<[drop_in_place_intrinsic::StructWithDtor[0]; 2]> @@ drop_in_place_intrinsic-cgu.0[Internal]
2020
let x = [StructWithDtor(0), StructWithDtor(1)];
2121

2222
drop_slice_in_place(&x);
@@ -31,7 +31,6 @@ fn drop_slice_in_place(x: &[StructWithDtor]) {
3131
// not have drop-glue for the unsized [StructWithDtor]. This has to be
3232
// generated though when the drop_in_place() intrinsic is used.
3333
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<[drop_in_place_intrinsic::StructWithDtor[0]]> @@ drop_in_place_intrinsic-cgu.0[Internal]
34-
//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<[drop_in_place_intrinsic::StructWithDtor[0]]> @@ drop_in_place_intrinsic-cgu.0[Internal]
3534
::std::ptr::drop_in_place(x as *const _ as *mut [StructWithDtor]);
3635
}
3736
}

src/test/codegen-units/item-collection/generic-drop-glue.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ enum EnumNoDrop<T1, T2> {
3737
struct NonGenericNoDrop(i32);
3838

3939
struct NonGenericWithDrop(i32);
40-
//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<generic_drop_glue::NonGenericWithDrop[0]> @@ generic_drop_glue-cgu.0[Internal]
40+
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<generic_drop_glue::NonGenericWithDrop[0]> @@ generic_drop_glue-cgu.0[Internal]
4141

4242
impl Drop for NonGenericWithDrop {
4343
//~ MONO_ITEM fn generic_drop_glue::{{impl}}[2]::drop[0]
@@ -47,11 +47,11 @@ impl Drop for NonGenericWithDrop {
4747
//~ MONO_ITEM fn generic_drop_glue::start[0]
4848
#[start]
4949
fn start(_: isize, _: *const *const u8) -> isize {
50-
//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<generic_drop_glue::StructWithDrop[0]<i8, char>> @@ generic_drop_glue-cgu.0[Internal]
50+
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<generic_drop_glue::StructWithDrop[0]<i8, char>> @@ generic_drop_glue-cgu.0[Internal]
5151
//~ MONO_ITEM fn generic_drop_glue::{{impl}}[0]::drop[0]<i8, char>
5252
let _ = StructWithDrop { x: 0i8, y: 'a' }.x;
5353

54-
//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<generic_drop_glue::StructWithDrop[0]<&str, generic_drop_glue::NonGenericNoDrop[0]>> @@ generic_drop_glue-cgu.0[Internal]
54+
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<generic_drop_glue::StructWithDrop[0]<&str, generic_drop_glue::NonGenericNoDrop[0]>> @@ generic_drop_glue-cgu.0[Internal]
5555
//~ MONO_ITEM fn generic_drop_glue::{{impl}}[0]::drop[0]<&str, generic_drop_glue::NonGenericNoDrop[0]>
5656
let _ = StructWithDrop { x: "&str", y: NonGenericNoDrop(0) }.y;
5757

@@ -60,17 +60,17 @@ fn start(_: isize, _: *const *const u8) -> isize {
6060

6161
// This is supposed to generate drop-glue because it contains a field that
6262
// needs to be dropped.
63-
//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<generic_drop_glue::StructNoDrop[0]<generic_drop_glue::NonGenericWithDrop[0], f64>> @@ generic_drop_glue-cgu.0[Internal]
63+
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<generic_drop_glue::StructNoDrop[0]<generic_drop_glue::NonGenericWithDrop[0], f64>> @@ generic_drop_glue-cgu.0[Internal]
6464
let _ = StructNoDrop { x: NonGenericWithDrop(0), y: 0f64 }.y;
6565

66-
//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<generic_drop_glue::EnumWithDrop[0]<i32, i64>> @@ generic_drop_glue-cgu.0[Internal]
66+
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<generic_drop_glue::EnumWithDrop[0]<i32, i64>> @@ generic_drop_glue-cgu.0[Internal]
6767
//~ MONO_ITEM fn generic_drop_glue::{{impl}}[1]::drop[0]<i32, i64>
6868
let _ = match EnumWithDrop::A::<i32, i64>(0) {
6969
EnumWithDrop::A(x) => x,
7070
EnumWithDrop::B(x) => x as i32
7171
};
7272

73-
//~MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<generic_drop_glue::EnumWithDrop[0]<f64, f32>> @@ generic_drop_glue-cgu.0[Internal]
73+
//~MONO_ITEM fn core::ptr[0]::drop_in_place[0]<generic_drop_glue::EnumWithDrop[0]<f64, f32>> @@ generic_drop_glue-cgu.0[Internal]
7474
//~ MONO_ITEM fn generic_drop_glue::{{impl}}[1]::drop[0]<f64, f32>
7575
let _ = match EnumWithDrop::B::<f64, f32>(1.0) {
7676
EnumWithDrop::A(x) => x,

src/test/codegen-units/item-collection/instantiation-through-vtable.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ impl<T> Trait for Struct<T> {
2424
fn start(_: isize, _: *const *const u8) -> isize {
2525
let s1 = Struct { _a: 0u32 };
2626

27-
//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<instantiation_through_vtable::Struct[0]<u32>> @@ instantiation_through_vtable-cgu.0[Internal]
27+
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<instantiation_through_vtable::Struct[0]<u32>> @@ instantiation_through_vtable-cgu.0[Internal]
2828
//~ MONO_ITEM fn instantiation_through_vtable::{{impl}}[0]::foo[0]<u32>
2929
//~ MONO_ITEM fn instantiation_through_vtable::{{impl}}[0]::bar[0]<u32>
3030
let _ = &s1 as &Trait;
3131

3232
let s1 = Struct { _a: 0u64 };
33-
//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<instantiation_through_vtable::Struct[0]<u64>> @@ instantiation_through_vtable-cgu.0[Internal]
33+
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<instantiation_through_vtable::Struct[0]<u64>> @@ instantiation_through_vtable-cgu.0[Internal]
3434
//~ MONO_ITEM fn instantiation_through_vtable::{{impl}}[0]::foo[0]<u64>
3535
//~ MONO_ITEM fn instantiation_through_vtable::{{impl}}[0]::bar[0]<u64>
3636
let _ = &s1 as &Trait;

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#![deny(dead_code)]
66
#![feature(start)]
77

8-
//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<non_generic_drop_glue::StructWithDrop[0]> @@ non_generic_drop_glue-cgu.0[Internal]
8+
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<non_generic_drop_glue::StructWithDrop[0]> @@ non_generic_drop_glue-cgu.0[Internal]
99
struct StructWithDrop {
1010
x: i32
1111
}
@@ -19,7 +19,7 @@ struct StructNoDrop {
1919
x: i32
2020
}
2121

22-
//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<non_generic_drop_glue::EnumWithDrop[0]> @@ non_generic_drop_glue-cgu.0[Internal]
22+
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<non_generic_drop_glue::EnumWithDrop[0]> @@ non_generic_drop_glue-cgu.0[Internal]
2323
enum EnumWithDrop {
2424
A(i32)
2525
}

src/test/codegen-units/item-collection/transitive-drop-glue.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
#![deny(dead_code)]
66
#![feature(start)]
77

8-
//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<transitive_drop_glue::Root[0]> @@ transitive_drop_glue-cgu.0[Internal]
8+
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::Root[0]> @@ transitive_drop_glue-cgu.0[Internal]
99
struct Root(Intermediate);
10-
//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<transitive_drop_glue::Intermediate[0]> @@ transitive_drop_glue-cgu.0[Internal]
10+
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::Intermediate[0]> @@ transitive_drop_glue-cgu.0[Internal]
1111
struct Intermediate(Leaf);
12-
//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<transitive_drop_glue::Leaf[0]> @@ transitive_drop_glue-cgu.0[Internal]
12+
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::Leaf[0]> @@ transitive_drop_glue-cgu.0[Internal]
1313
struct Leaf;
1414

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

33-
//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<transitive_drop_glue::RootGen[0]<u32>> @@ transitive_drop_glue-cgu.0[Internal]
34-
//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<transitive_drop_glue::IntermediateGen[0]<u32>> @@ transitive_drop_glue-cgu.0[Internal]
35-
//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<transitive_drop_glue::LeafGen[0]<u32>> @@ transitive_drop_glue-cgu.0[Internal]
33+
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::RootGen[0]<u32>> @@ transitive_drop_glue-cgu.0[Internal]
34+
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::IntermediateGen[0]<u32>> @@ transitive_drop_glue-cgu.0[Internal]
35+
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::LeafGen[0]<u32>> @@ transitive_drop_glue-cgu.0[Internal]
3636
//~ MONO_ITEM fn transitive_drop_glue::{{impl}}[1]::drop[0]<u32>
3737
let _ = RootGen(IntermediateGen(LeafGen(0u32)));
3838

39-
//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<transitive_drop_glue::RootGen[0]<i16>> @@ transitive_drop_glue-cgu.0[Internal]
40-
//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<transitive_drop_glue::IntermediateGen[0]<i16>> @@ transitive_drop_glue-cgu.0[Internal]
41-
//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<transitive_drop_glue::LeafGen[0]<i16>> @@ transitive_drop_glue-cgu.0[Internal]
39+
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::RootGen[0]<i16>> @@ transitive_drop_glue-cgu.0[Internal]
40+
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::IntermediateGen[0]<i16>> @@ transitive_drop_glue-cgu.0[Internal]
41+
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::LeafGen[0]<i16>> @@ transitive_drop_glue-cgu.0[Internal]
4242
//~ MONO_ITEM fn transitive_drop_glue::{{impl}}[1]::drop[0]<i16>
4343
let _ = RootGen(IntermediateGen(LeafGen(0i16)));
4444

src/test/codegen-units/item-collection/tuple-drop-glue.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#![deny(dead_code)]
66
#![feature(start)]
77

8-
//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<tuple_drop_glue::Dropped[0]> @@ tuple_drop_glue-cgu.0[Internal]
8+
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<tuple_drop_glue::Dropped[0]> @@ tuple_drop_glue-cgu.0[Internal]
99
struct Dropped;
1010

1111
impl Drop for Dropped {
@@ -16,11 +16,11 @@ impl Drop for Dropped {
1616
//~ MONO_ITEM fn tuple_drop_glue::start[0]
1717
#[start]
1818
fn start(_: isize, _: *const *const u8) -> isize {
19-
//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<(u32, tuple_drop_glue::Dropped[0])> @@ tuple_drop_glue-cgu.0[Internal]
19+
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<(u32, tuple_drop_glue::Dropped[0])> @@ tuple_drop_glue-cgu.0[Internal]
2020
let x = (0u32, Dropped);
2121

22-
//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<(i16, (tuple_drop_glue::Dropped[0], bool))> @@ tuple_drop_glue-cgu.0[Internal]
23-
//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<(tuple_drop_glue::Dropped[0], bool)> @@ tuple_drop_glue-cgu.0[Internal]
22+
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<(i16, (tuple_drop_glue::Dropped[0], bool))> @@ tuple_drop_glue-cgu.0[Internal]
23+
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<(tuple_drop_glue::Dropped[0], bool)> @@ tuple_drop_glue-cgu.0[Internal]
2424
let x = (0i16, (Dropped, true));
2525

2626
0

src/test/codegen-units/item-collection/unsizing.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@ impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<Wrapper<U>> for Wrapper<T>
4848
fn start(_: isize, _: *const *const u8) -> isize {
4949
// simple case
5050
let bool_sized = &true;
51-
//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<bool> @@ unsizing-cgu.0[Internal]
51+
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<bool> @@ unsizing-cgu.0[Internal]
5252
//~ MONO_ITEM fn unsizing::{{impl}}[0]::foo[0]
5353
let _bool_unsized = bool_sized as &Trait;
5454

5555
let char_sized = &'a';
5656

57-
//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<char> @@ unsizing-cgu.0[Internal]
57+
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<char> @@ unsizing-cgu.0[Internal]
5858
//~ MONO_ITEM fn unsizing::{{impl}}[1]::foo[0]
5959
let _char_unsized = char_sized as &Trait;
6060

@@ -64,13 +64,13 @@ fn start(_: isize, _: *const *const u8) -> isize {
6464
_b: 2,
6565
_c: 3.0f64
6666
};
67-
//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<f64> @@ unsizing-cgu.0[Internal]
67+
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<f64> @@ unsizing-cgu.0[Internal]
6868
//~ MONO_ITEM fn unsizing::{{impl}}[2]::foo[0]
6969
let _struct_unsized = struct_sized as &Struct<Trait>;
7070

7171
// custom coercion
7272
let wrapper_sized = Wrapper(&0u32);
73-
//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<u32> @@ unsizing-cgu.0[Internal]
73+
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<u32> @@ unsizing-cgu.0[Internal]
7474
//~ MONO_ITEM fn unsizing::{{impl}}[3]::foo[0]
7575
let _wrapper_sized = wrapper_sized as Wrapper<Trait>;
7676

src/test/codegen-units/partitioning/extern-drop-glue.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111
// aux-build:cgu_extern_drop_glue.rs
1212
extern crate cgu_extern_drop_glue;
1313

14-
//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<cgu_extern_drop_glue::Struct[0]> @@ extern_drop_glue[Internal] extern_drop_glue-mod1[Internal]
14+
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<cgu_extern_drop_glue::Struct[0]> @@ extern_drop_glue[Internal] extern_drop_glue-mod1[Internal]
1515

1616
struct LocalStruct(cgu_extern_drop_glue::Struct);
1717

1818
//~ MONO_ITEM fn extern_drop_glue::user[0] @@ extern_drop_glue[External]
1919
pub fn user()
2020
{
21-
//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<extern_drop_glue::LocalStruct[0]> @@ extern_drop_glue[Internal]
21+
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<extern_drop_glue::LocalStruct[0]> @@ extern_drop_glue[Internal]
2222
let _ = LocalStruct(cgu_extern_drop_glue::Struct(0));
2323
}
2424

@@ -30,7 +30,7 @@ pub mod mod1 {
3030
//~ MONO_ITEM fn extern_drop_glue::mod1[0]::user[0] @@ extern_drop_glue-mod1[External]
3131
pub fn user()
3232
{
33-
//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<extern_drop_glue::mod1[0]::LocalStruct[0]> @@ extern_drop_glue-mod1[Internal]
33+
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<extern_drop_glue::mod1[0]::LocalStruct[0]> @@ extern_drop_glue-mod1[Internal]
3434
let _ = LocalStruct(cgu_extern_drop_glue::Struct(0));
3535
}
3636
}

src/test/codegen-units/partitioning/local-drop-glue.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#![allow(dead_code)]
88
#![crate_type="rlib"]
99

10-
//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<local_drop_glue::Struct[0]> @@ local_drop_glue[Internal] local_drop_glue-mod1[Internal]
10+
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<local_drop_glue::Struct[0]> @@ local_drop_glue[Internal] local_drop_glue-mod1[Internal]
1111
struct Struct {
1212
_a: u32
1313
}
@@ -17,7 +17,7 @@ impl Drop for Struct {
1717
fn drop(&mut self) {}
1818
}
1919

20-
//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<local_drop_glue::Outer[0]> @@ local_drop_glue[Internal]
20+
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<local_drop_glue::Outer[0]> @@ local_drop_glue[Internal]
2121
struct Outer {
2222
_a: Struct
2323
}
@@ -36,10 +36,10 @@ pub mod mod1
3636
{
3737
use super::Struct;
3838

39-
//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<local_drop_glue::mod1[0]::Struct2[0]> @@ local_drop_glue-mod1[Internal]
39+
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<local_drop_glue::mod1[0]::Struct2[0]> @@ local_drop_glue-mod1[Internal]
4040
struct Struct2 {
4141
_a: Struct,
42-
//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<(u32, local_drop_glue::Struct[0])> @@ local_drop_glue-mod1[Internal]
42+
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<(u32, local_drop_glue::Struct[0])> @@ local_drop_glue-mod1[Internal]
4343
_b: (u32, Struct),
4444
}
4545

src/test/codegen-units/partitioning/vtable-through-const.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ mod mod1 {
6666
//~ MONO_ITEM fn vtable_through_const::start[0]
6767
#[start]
6868
fn start(_: isize, _: *const *const u8) -> isize {
69-
//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<u32> @@ vtable_through_const[Internal]
69+
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<u32> @@ vtable_through_const[Internal]
7070

7171
// Since Trait1::do_something() is instantiated via its default implementation,
7272
// it is considered a generic and is instantiated here only because it is

src/test/codegen/drop.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub fn droppy() {
2121
// regular function exit. We used to have problems with quadratic growths of drop calls in such
2222
// functions.
2323
// FIXME(eddyb) the `void @` forces a match on the instruction, instead of the
24-
// comment, that's `; call core::ptr::real_drop_in_place::<drop::SomeUniqueName>`
24+
// comment, that's `; call core::intrinsics::drop_in_place::<drop::SomeUniqueName>`
2525
// for the `v0` mangling, should switch to matching on that once `legacy` is gone.
2626
// CHECK-NOT: invoke void @{{.*}}drop_in_place{{.*}}SomeUniqueName
2727
// CHECK: call void @{{.*}}drop_in_place{{.*}}SomeUniqueName

src/test/mir-opt/retag.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ fn main() {
113113
// }
114114
// }
115115
// END rustc.main-{{closure}}.EraseRegions.after.mir
116-
// START rustc.ptr-real_drop_in_place.Test.SimplifyCfg-make_shim.after.mir
117-
// fn std::ptr::real_drop_in_place(_1: &mut Test) -> () {
116+
// START rustc.ptr-drop_in_place.Test.SimplifyCfg-make_shim.after.mir
117+
// fn std::intrinsics::drop_in_place(_1: *mut Test) -> () {
118118
// ...
119119
// bb0: {
120120
// Retag([raw] _1);
@@ -126,4 +126,4 @@ fn main() {
126126
// return;
127127
// }
128128
// }
129-
// END rustc.ptr-real_drop_in_place.Test.SimplifyCfg-make_shim.after.mir
129+
// END rustc.ptr-drop_in_place.Test.SimplifyCfg-make_shim.after.mir

src/test/mir-opt/slice-drop-shim.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ fn main() {
66

77
// END RUST SOURCE
88

9-
// START rustc.ptr-real_drop_in_place.[std__string__String].AddMovesForPackedDrops.before.mir
9+
// START rustc.ptr-drop_in_place.[std__string__String].AddMovesForPackedDrops.before.mir
1010
// let mut _2: usize;
1111
// let mut _3: usize;
1212
// let mut _4: usize;
@@ -87,4 +87,4 @@ fn main() {
8787
// _3 = Len((*_1));
8888
// switchInt(move _2) -> [0usize: bb8, otherwise: bb14];
8989
// }
90-
// END rustc.ptr-real_drop_in_place.[std__string__String].AddMovesForPackedDrops.before.mir
90+
// END rustc.ptr-drop_in_place.[std__string__String].AddMovesForPackedDrops.before.mir

src/test/mir-opt/unusual-item-types.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ fn main() {
4545
// }
4646
// END rustc.E-V-{{constant}}.mir_map.0.mir
4747

48-
// START rustc.ptr-real_drop_in_place.std__vec__Vec_i32_.AddMovesForPackedDrops.before.mir
48+
// START rustc.ptr-drop_in_place.std__vec__Vec_i32_.AddMovesForPackedDrops.before.mir
4949
// bb0: {
5050
// goto -> bb7;
5151
// }
@@ -71,7 +71,7 @@ fn main() {
7171
// _2 = &mut (*_1);
7272
// _3 = const <std::vec::Vec<i32> as std::ops::Drop>::drop(move _2) -> [return: bb6, unwind: bb5];
7373
// }
74-
// END rustc.ptr-real_drop_in_place.std__vec__Vec_i32_.AddMovesForPackedDrops.before.mir
74+
// END rustc.ptr-drop_in_place.std__vec__Vec_i32_.AddMovesForPackedDrops.before.mir
7575

7676
// START rustc.Test-X-{{constructor}}.mir_map.0.mir
7777
// fn Test::X(_1: usize) -> Test {

src/test/ui/consts/miri_unleashed/drop.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@ LL | let _v: Vec<i32> = Vec::new();
77
error[E0080]: could not evaluate static initializer
88
--> $SRC_DIR/libcore/ptr/mod.rs:LL:COL
99
|
10-
LL | / unsafe fn real_drop_in_place<T: ?Sized>(to_drop: &mut T) {
10+
LL | / pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
1111
LL | | // Code here does not matter - this is replaced by the
1212
LL | | // real drop glue by the compiler.
13-
LL | | real_drop_in_place(to_drop)
13+
LL | | drop_in_place(to_drop)
1414
LL | | }
1515
| |_^ calling non-const function `<std::vec::Vec<i32> as std::ops::Drop>::drop`
1616
|
1717
::: $DIR/drop.rs:23:1
1818
|
1919
LL | };
20-
| - inside call to `std::ptr::real_drop_in_place::<std::vec::Vec<i32>> - shim(Some(std::vec::Vec<i32>))` at $DIR/drop.rs:23:1
20+
| - inside call to `std::intrinsics::drop_in_place::<std::vec::Vec<i32>> - shim(Some(std::vec::Vec<i32>))` at $DIR/drop.rs:23:1
2121

2222
error: aborting due to previous error
2323

src/test/ui/recursion/issue-38591-non-regular-dropck-recursion.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Dropck shouldn't hit a recursion limit from checking `S<u32>` since it has
22
// no free regions or type parameters.
3-
// Codegen however, has to error for the infinitely many `real_drop_in_place`
3+
// Codegen however, has to error for the infinitely many `drop_in_place`
44
// functions it has been asked to create.
55
// build-fail
66

0 commit comments

Comments
 (0)