Auto merge of #140151 - RalfJung:drop_in_place-is-not-an-intrinsic, r… · rust-lang/rust@1bd50d4 (original) (raw)

6 files changed

lines changed

Original file line number Diff line number Diff line change
@@ -74,15 +74,6 @@ pub mod simd;
74 74 #[cfg(all(target_has_atomic = "8", target_has_atomic = "32", target_has_atomic = "ptr"))]
75 75 use crate::sync::atomic::{self, AtomicBool, AtomicI32, AtomicIsize, AtomicU32, Ordering};
76 76
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 -
86 77 // N.B., these intrinsics take raw pointers because they mutate aliased
87 78 // memory, which is not valid for either `&` or `&mut`.
88 79
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
1 -error[E0080]: evaluation of `std::ptr::drop_in_place::<Vec> - shim(Some(Vec))` failed
1 +error[E0080]: evaluation of `drop_in_place::<Vec> - shim(Some(Vec))` failed
2 2 --> $DIR/assoc_const.rs:12:31
3 3 |
4 4 LL | const F: u32 = (U::X, 42).1;
5 5 | ^ calling non-const function `<Vec as Drop>::drop`
6 6 |
7 -note: inside `std::ptr::drop_in_place::<(Vec, u32)> - shim(Some((Vec, u32)))`
7 +note: inside `drop_in_place::<(Vec, u32)> - shim(Some((Vec, u32)))`
8 8 --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
9 -note: inside `std::ptr::drop_in_place::<Vec> - shim(Some(Vec))`
9 +note: inside `drop_in_place::<Vec> - shim(Some(Vec))`
10 10 --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
11 11
12 12 note: erroneous constant encountered
Original file line number Diff line number Diff line change
@@ -15,6 +15,6 @@ static TEST_BAD: () = {
15 15 let _v: Vec<i32> = Vec::new();
16 16 }; //~ ERROR could not evaluate static initializer
17 17 //~| NOTE calling non-const function `<Vec as Drop>::drop`
18 -//~| NOTE inside `std::ptr::drop_in_place::<Vec> - shim(Some(Vec))`
18 +//~| NOTE inside `drop_in_place::<Vec> - shim(Some(Vec))`
19 19
20 20 //~? WARN skipping const checks
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ error[E0080]: could not evaluate static initializer
4 4 LL | };
5 5 | ^ calling non-const function `<Vec as Drop>::drop`
6 6 |
7 -note: inside `std::ptr::drop_in_place::<Vec> - shim(Some(Vec))`
7 +note: inside `drop_in_place::<Vec> - shim(Some(Vec))`
8 8 --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
9 9
10 10 warning: skipping const checks
Original file line number Diff line number Diff line change
@@ -13,11 +13,11 @@ error[E0080]: evaluation of constant value failed
13 13 LL | };
14 14 | ^ calling non-const function `<Vec as Drop>::drop`
15 15 |
16 -note: inside `std::ptr::drop_in_place::<Option> - shim(Some(Option))`
16 +note: inside `drop_in_place::<Option> - shim(Some(Option))`
17 17 --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
18 -note: inside `std::ptr::drop_in_place:: - shim(Some(String))`
18 +note: inside `drop_in_place:: - shim(Some(String))`
19 19 --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
20 -note: inside `std::ptr::drop_in_place::<Vec> - shim(Some(Vec))`
20 +note: inside `drop_in_place::<Vec> - shim(Some(Vec))`
21 21 --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
22 22
23 23 error[E0493]: destructor of `Option` cannot be evaluated at compile-time
@@ -34,11 +34,11 @@ error[E0080]: evaluation of constant value failed
34 34 LL | };
35 35 | ^ calling non-const function `<Vec as Drop>::drop`
36 36 |
37 -note: inside `std::ptr::drop_in_place::<Option> - shim(Some(Option))`
37 +note: inside `drop_in_place::<Option> - shim(Some(Option))`
38 38 --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
39 -note: inside `std::ptr::drop_in_place:: - shim(Some(String))`
39 +note: inside `drop_in_place:: - shim(Some(String))`
40 40 --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
41 -note: inside `std::ptr::drop_in_place::<Vec> - shim(Some(Vec))`
41 +note: inside `drop_in_place::<Vec> - shim(Some(Vec))`
42 42 --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
43 43
44 44 error[E0493]: destructor of `(u32, Option)` cannot be evaluated at compile-time
Original file line number Diff line number Diff line change
@@ -8,10 +8,9 @@
8 8 #![allow(unused_imports)]
9 9 #![allow(deprecated)]
10 10
11 -use std::intrinsics::drop_in_place as _;
12 11 use std::intrinsics::copy_nonoverlapping as _;
13 12 use std::intrinsics::copy as _;
14 13 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};
16 15
17 16 fn main() {}