Skip to content

Commit d7c3386

Browse files
committed
Auto merge of #84207 - SimonSapin:deprecate-core-raw, r=dtolnay
Deprecate the core::raw / std::raw module It only contains the `TraitObject` struct which exposes components of wide pointer. Pointer metadata APIs are designed to replace this: #81513
2 parents 6765010 + 4d683c0 commit d7c3386

File tree

4 files changed

+11
-1
lines changed

4 files changed

+11
-1
lines changed

library/core/src/raw.rs

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
#![allow(missing_docs)]
22
#![unstable(feature = "raw", issue = "27751")]
3+
#![rustc_deprecated(
4+
since = "1.53.0",
5+
reason = "use pointer metadata APIs instead https://github.com/rust-lang/rust/issues/81513"
6+
)]
37

48
//! Contains struct definitions for the layout of compiler built-in types.
59
//!

library/core/tests/mem.rs

+3
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ fn test_transmute_copy() {
9797
assert_eq!(1, unsafe { transmute_copy(&1) });
9898
}
9999

100+
// Remove this test when `std::raw` is removed.
101+
// The replacement pointer metadata APIs are tested in library/core/tests/ptr.rs
102+
#[allow(deprecated)]
100103
#[test]
101104
fn test_transmute() {
102105
trait Foo {

library/std/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,7 @@ pub use core::pin;
459459
#[stable(feature = "rust1", since = "1.0.0")]
460460
pub use core::ptr;
461461
#[stable(feature = "rust1", since = "1.0.0")]
462+
#[allow(deprecated, deprecated_in_future)]
462463
pub use core::raw;
463464
#[stable(feature = "rust1", since = "1.0.0")]
464465
pub use core::result;

src/test/ui/cast/fat-ptr-cast-rpass.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
// run-pass
22

3+
// Remove this file when `std::raw` is removed.
4+
// The replacement pointer metadata APIs are tested in library/core/tests/ptr.rs
5+
#![allow(deprecated)]
36
#![feature(raw)]
47

58
use std::mem;
@@ -37,5 +40,4 @@ fn main() {
3740

3841
assert_eq!(b, d);
3942
assert_eq!(c, d as usize);
40-
4143
}

0 commit comments

Comments
 (0)