Skip to content

Commit

Permalink
Auto merge of rust-lang#84207 - SimonSapin:deprecate-core-raw, r=dtolnay
Browse files Browse the repository at this point in the history
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: rust-lang#81513
  • Loading branch information
bors committed Apr 18, 2021
2 parents 6765010 + 4d683c0 commit d7c3386
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions library/core/src/raw.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#![allow(missing_docs)]
#![unstable(feature = "raw", issue = "27751")]
#![rustc_deprecated(
since = "1.53.0",
reason = "use pointer metadata APIs instead https://github.com/rust-lang/rust/issues/81513"
)]

//! Contains struct definitions for the layout of compiler built-in types.
//!
Expand Down
3 changes: 3 additions & 0 deletions library/core/tests/mem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ fn test_transmute_copy() {
assert_eq!(1, unsafe { transmute_copy(&1) });
}

// Remove this test when `std::raw` is removed.
// The replacement pointer metadata APIs are tested in library/core/tests/ptr.rs
#[allow(deprecated)]
#[test]
fn test_transmute() {
trait Foo {
Expand Down
1 change: 1 addition & 0 deletions library/std/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,7 @@ pub use core::pin;
#[stable(feature = "rust1", since = "1.0.0")]
pub use core::ptr;
#[stable(feature = "rust1", since = "1.0.0")]
#[allow(deprecated, deprecated_in_future)]
pub use core::raw;
#[stable(feature = "rust1", since = "1.0.0")]
pub use core::result;
Expand Down
4 changes: 3 additions & 1 deletion src/test/ui/cast/fat-ptr-cast-rpass.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
// run-pass

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

use std::mem;
Expand Down Expand Up @@ -37,5 +40,4 @@ fn main() {

assert_eq!(b, d);
assert_eq!(c, d as usize);

}

0 comments on commit d7c3386

Please sign in to comment.