about summary refs log tree commit diff
path: root/library
diff options
context:
space:
mode:
Diffstat (limited to 'library')
-rw-r--r--library/core/src/lib.rs1
-rw-r--r--library/core/src/raw.rs90
-rw-r--r--library/core/tests/lib.rs1
-rw-r--r--library/core/tests/mem.rs22
-rw-r--r--library/panic_unwind/src/lib.rs1
-rw-r--r--library/std/src/lib.rs4
6 files changed, 0 insertions, 119 deletions
diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs
index 7fa8202e5d6..866cd5ec535 100644
--- a/library/core/src/lib.rs
+++ b/library/core/src/lib.rs
@@ -255,7 +255,6 @@ pub mod option;
 pub mod panic;
 pub mod panicking;
 pub mod pin;
-pub mod raw;
 pub mod result;
 #[unstable(feature = "async_stream", issue = "79024")]
 pub mod stream;
diff --git a/library/core/src/raw.rs b/library/core/src/raw.rs
deleted file mode 100644
index 6d1e28f4cd7..00000000000
--- a/library/core/src/raw.rs
+++ /dev/null
@@ -1,90 +0,0 @@
-#![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.
-//!
-//! They can be used as targets of transmutes in unsafe code for manipulating
-//! the raw representations directly.
-//!
-//! Their definition should always match the ABI defined in
-//! `rustc_middle::ty::layout`.
-
-/// The representation of a trait object like `&dyn SomeTrait`.
-///
-/// This struct has the same layout as types like `&dyn SomeTrait` and
-/// `Box<dyn AnotherTrait>`.
-///
-/// `TraitObject` is guaranteed to match layouts, but it is not the
-/// type of trait objects (e.g., the fields are not directly accessible
-/// on a `&dyn SomeTrait`) nor does it control that layout (changing the
-/// definition will not change the layout of a `&dyn SomeTrait`). It is
-/// only designed to be used by unsafe code that needs to manipulate
-/// the low-level details.
-///
-/// There is no way to refer to all trait objects generically, so the only
-/// way to create values of this type is with functions like
-/// [`std::mem::transmute`][transmute]. Similarly, the only way to create a true
-/// trait object from a `TraitObject` value is with `transmute`.
-///
-/// [transmute]: crate::intrinsics::transmute
-///
-/// Synthesizing a trait object with mismatched types—one where the
-/// vtable does not correspond to the type of the value to which the
-/// data pointer points—is highly likely to lead to undefined
-/// behavior.
-///
-/// # Examples
-///
-/// ```
-/// #![feature(raw)]
-///
-/// use std::{mem, raw};
-///
-/// // an example trait
-/// trait Foo {
-///     fn bar(&self) -> i32;
-/// }
-///
-/// impl Foo for i32 {
-///     fn bar(&self) -> i32 {
-///          *self + 1
-///     }
-/// }
-///
-/// let value: i32 = 123;
-///
-/// // let the compiler make a trait object
-/// let object: &dyn Foo = &value;
-///
-/// // look at the raw representation
-/// let raw_object: raw::TraitObject = unsafe { mem::transmute(object) };
-///
-/// // the data pointer is the address of `value`
-/// assert_eq!(raw_object.data as *const i32, &value as *const _);
-///
-/// let other_value: i32 = 456;
-///
-/// // construct a new object, pointing to a different `i32`, being
-/// // careful to use the `i32` vtable from `object`
-/// let synthesized: &dyn Foo = unsafe {
-///      mem::transmute(raw::TraitObject {
-///          data: &other_value as *const _ as *mut (),
-///          vtable: raw_object.vtable,
-///      })
-/// };
-///
-/// // it should work just as if we had constructed a trait object out of
-/// // `other_value` directly
-/// assert_eq!(synthesized.bar(), 457);
-/// ```
-#[repr(C)]
-#[derive(Copy, Clone)]
-#[allow(missing_debug_implementations)]
-pub struct TraitObject {
-    pub data: *mut (),
-    pub vtable: *mut (),
-}
diff --git a/library/core/tests/lib.rs b/library/core/tests/lib.rs
index dee2478886d..e50b3bb96f8 100644
--- a/library/core/tests/lib.rs
+++ b/library/core/tests/lib.rs
@@ -29,7 +29,6 @@
 #![feature(try_find)]
 #![feature(is_sorted)]
 #![feature(pattern)]
-#![feature(raw)]
 #![feature(sort_internals)]
 #![feature(slice_partition_at_index)]
 #![feature(maybe_uninit_uninit_array)]
diff --git a/library/core/tests/mem.rs b/library/core/tests/mem.rs
index dfdbc9305d2..c780bb32ca9 100644
--- a/library/core/tests/mem.rs
+++ b/library/core/tests/mem.rs
@@ -97,28 +97,6 @@ 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 {
-        fn dummy(&self) {}
-    }
-    impl Foo for isize {}
-
-    let a = box 100isize as Box<dyn Foo>;
-    unsafe {
-        let x: ::core::raw::TraitObject = transmute(a);
-        assert!(*(x.data as *const isize) == 100);
-        let _x: Box<dyn Foo> = transmute(x);
-    }
-
-    unsafe {
-        assert_eq!(transmute::<_, Vec<u8>>("L".to_string()), [76]);
-    }
-}
-
 #[test]
 #[allow(dead_code)]
 fn test_discriminant_send_sync() {
diff --git a/library/panic_unwind/src/lib.rs b/library/panic_unwind/src/lib.rs
index d32a3f1f832..3622bc8294b 100644
--- a/library/panic_unwind/src/lib.rs
+++ b/library/panic_unwind/src/lib.rs
@@ -23,7 +23,6 @@
 #![feature(unwind_attributes)]
 #![feature(abi_thiscall)]
 #![feature(rustc_attrs)]
-#![feature(raw)]
 #![panic_runtime]
 #![feature(panic_runtime)]
 // `real_imp` is unused with Miri, so silence warnings.
diff --git a/library/std/src/lib.rs b/library/std/src/lib.rs
index 25f6b3c0182..6f389f000af 100644
--- a/library/std/src/lib.rs
+++ b/library/std/src/lib.rs
@@ -303,7 +303,6 @@
 #![feature(pin_static_ref)]
 #![feature(prelude_import)]
 #![feature(ptr_internals)]
-#![feature(raw)]
 #![feature(ready_macro)]
 #![feature(rustc_attrs)]
 #![feature(rustc_private)]
@@ -455,9 +454,6 @@ 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;
 #[unstable(feature = "async_stream", issue = "79024")]
 pub use core::stream;