Skip to content

Commit dd39c2f

Browse files
committed
remove intrinsics::drop_in_place
1 parent fae7785 commit dd39c2f

File tree

6 files changed

+12
-22
lines changed

6 files changed

+12
-22
lines changed

library/core/src/intrinsics/mod.rs

-9
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,6 @@ pub mod simd;
7474
#[cfg(all(target_has_atomic = "8", target_has_atomic = "32", target_has_atomic = "ptr"))]
7575
use crate::sync::atomic::{self, AtomicBool, AtomicI32, AtomicIsize, AtomicU32, Ordering};
7676

77-
#[stable(feature = "drop_in_place", since = "1.8.0")]
78-
#[rustc_allowed_through_unstable_modules = "import this function via `std::ptr` instead"]
79-
#[deprecated(note = "no longer an intrinsic - use `ptr::drop_in_place` directly", since = "1.52.0")]
80-
#[inline]
81-
pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
82-
// SAFETY: see `ptr::drop_in_place`
83-
unsafe { crate::ptr::drop_in_place(to_drop) }
84-
}
85-
8677
// N.B., these intrinsics take raw pointers because they mutate aliased
8778
// memory, which is not valid for either `&` or `&mut`.
8879

tests/ui/consts/miri_unleashed/assoc_const.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
error[E0080]: evaluation of `std::ptr::drop_in_place::<Vec<u32>> - shim(Some(Vec<u32>))` failed
1+
error[E0080]: evaluation of `drop_in_place::<Vec<u32>> - shim(Some(Vec<u32>))` failed
22
--> $DIR/assoc_const.rs:12:31
33
|
44
LL | const F: u32 = (U::X, 42).1;
55
| ^ calling non-const function `<Vec<u32> as Drop>::drop`
66
|
7-
note: inside `std::ptr::drop_in_place::<(Vec<u32>, u32)> - shim(Some((Vec<u32>, u32)))`
7+
note: inside `drop_in_place::<(Vec<u32>, u32)> - shim(Some((Vec<u32>, u32)))`
88
--> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
9-
note: inside `std::ptr::drop_in_place::<Vec<u32>> - shim(Some(Vec<u32>))`
9+
note: inside `drop_in_place::<Vec<u32>> - shim(Some(Vec<u32>))`
1010
--> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
1111

1212
note: erroneous constant encountered

tests/ui/consts/miri_unleashed/drop.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ static TEST_BAD: () = {
1515
let _v: Vec<i32> = Vec::new();
1616
}; //~ ERROR could not evaluate static initializer
1717
//~| NOTE calling non-const function `<Vec<i32> as Drop>::drop`
18-
//~| NOTE inside `std::ptr::drop_in_place::<Vec<i32>> - shim(Some(Vec<i32>))`
18+
//~| NOTE inside `drop_in_place::<Vec<i32>> - shim(Some(Vec<i32>))`
1919

2020
//~? WARN skipping const checks

tests/ui/consts/miri_unleashed/drop.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0080]: could not evaluate static initializer
44
LL | };
55
| ^ calling non-const function `<Vec<i32> as Drop>::drop`
66
|
7-
note: inside `std::ptr::drop_in_place::<Vec<i32>> - shim(Some(Vec<i32>))`
7+
note: inside `drop_in_place::<Vec<i32>> - shim(Some(Vec<i32>))`
88
--> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
99

1010
warning: skipping const checks

tests/ui/consts/qualif-indirect-mutation-fail.stderr

+6-6
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ error[E0080]: evaluation of constant value failed
1313
LL | };
1414
| ^ calling non-const function `<Vec<u8> as Drop>::drop`
1515
|
16-
note: inside `std::ptr::drop_in_place::<Option<String>> - shim(Some(Option<String>))`
16+
note: inside `drop_in_place::<Option<String>> - shim(Some(Option<String>))`
1717
--> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
18-
note: inside `std::ptr::drop_in_place::<String> - shim(Some(String))`
18+
note: inside `drop_in_place::<String> - shim(Some(String))`
1919
--> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
20-
note: inside `std::ptr::drop_in_place::<Vec<u8>> - shim(Some(Vec<u8>))`
20+
note: inside `drop_in_place::<Vec<u8>> - shim(Some(Vec<u8>))`
2121
--> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
2222

2323
error[E0493]: destructor of `Option<String>` cannot be evaluated at compile-time
@@ -34,11 +34,11 @@ error[E0080]: evaluation of constant value failed
3434
LL | };
3535
| ^ calling non-const function `<Vec<u8> as Drop>::drop`
3636
|
37-
note: inside `std::ptr::drop_in_place::<Option<String>> - shim(Some(Option<String>))`
37+
note: inside `drop_in_place::<Option<String>> - shim(Some(Option<String>))`
3838
--> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
39-
note: inside `std::ptr::drop_in_place::<String> - shim(Some(String))`
39+
note: inside `drop_in_place::<String> - shim(Some(String))`
4040
--> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
41-
note: inside `std::ptr::drop_in_place::<Vec<u8>> - shim(Some(Vec<u8>))`
41+
note: inside `drop_in_place::<Vec<u8>> - shim(Some(Vec<u8>))`
4242
--> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
4343

4444
error[E0493]: destructor of `(u32, Option<String>)` cannot be evaluated at compile-time

tests/ui/stability-attribute/issue-99286-stable-intrinsics.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,9 @@
88
#![allow(unused_imports)]
99
#![allow(deprecated)]
1010

11-
use std::intrinsics::drop_in_place as _;
1211
use std::intrinsics::copy_nonoverlapping as _;
1312
use std::intrinsics::copy as _;
1413
use std::intrinsics::write_bytes as _;
15-
use std::intrinsics::{drop_in_place, copy_nonoverlapping, copy, write_bytes};
14+
use std::intrinsics::{copy_nonoverlapping, copy, write_bytes};
1615

1716
fn main() {}

0 commit comments

Comments
 (0)