diff --git a/library/core/src/mem/mod.rs b/library/core/src/mem/mod.rs index d8521e79006e3..b321908fd9e77 100644 --- a/library/core/src/mem/mod.rs +++ b/library/core/src/mem/mod.rs @@ -1,7 +1,32 @@ -//! Basic functions for dealing with memory. +//! Basic functions for dealing with memory, values, and types. //! -//! This module contains functions for querying the size and alignment of -//! types, initializing and manipulating memory. +//! The contents of this module can be seen as belonging to a few families: +//! +//! * [`drop`], [`replace`], [`swap`], and [`take`] +//! are safe functions for moving values in particular ways. +//! They are useful in everyday Rust code. +//! +//! * [`size_of`], [`size_of_val`], [`align_of`], [`align_of_val`], and [`offset_of`] +//! give information about the representation of values in memory. +//! +//! * [`discriminant`] +//! allows comparing the variants of [`enum`] values while ignoring their fields. +//! +//! * [`forget`] and [`ManuallyDrop`] +//! prevent destructors from running, which is used in certain kinds of ownership transfer. +//! [`needs_drop`] +//! tells you whether a type’s destructor even does anything. +//! +//! * [`transmute`], [`transmute_copy`], and [`MaybeUninit`] +//! convert and construct values in [`unsafe`] ways. +//! +//! See also the [`alloc`] and [`ptr`] modules for more primitive operations on memory. +//! +// core::alloc exists but doesn’t contain all the items we want to discuss +//! [`alloc`]: ../../std/alloc/index.html +//! [`enum`]: ../../std/keyword.enum.html +//! [`ptr`]: crate::ptr +//! [`unsafe`]: ../../std/keyword.unsafe.html #![stable(feature = "rust1", since = "1.0.0")] diff --git a/tests/ui/binding/match-naked-record.rs b/tests/ui/binding/match-naked-record.rs deleted file mode 100644 index ce9489a00f2c6..0000000000000 --- a/tests/ui/binding/match-naked-record.rs +++ /dev/null @@ -1,12 +0,0 @@ -//@ run-pass -#![allow(dead_code)] - -struct X { x: isize } - -pub fn main() { - let _x = match 0 { - _ => X { - x: 0 - } - }; -} diff --git a/tests/ui/issues/issue-4830.rs b/tests/ui/issues/issue-4830.rs deleted file mode 100644 index d48c13fd10b1d..0000000000000 --- a/tests/ui/issues/issue-4830.rs +++ /dev/null @@ -1,10 +0,0 @@ -//@ check-pass -#![allow(dead_code)] - - -pub struct Scheduler { - /// The event loop used to drive the scheduler and perform I/O - event_loop: Box -} - -pub fn main() { } diff --git a/tests/ui/issues/issue-5192.rs b/tests/ui/issues/issue-5192.rs deleted file mode 100644 index be5d70f09b3c0..0000000000000 --- a/tests/ui/issues/issue-5192.rs +++ /dev/null @@ -1,38 +0,0 @@ -//@ run-pass -#![allow(dead_code)] - -pub trait EventLoop { - fn dummy(&self) { } -} - -pub struct UvEventLoop { - uvio: isize -} - -impl UvEventLoop { - pub fn new() -> UvEventLoop { - UvEventLoop { - uvio: 0 - } - } -} - -impl EventLoop for UvEventLoop { -} - -pub struct Scheduler { - event_loop: Box, -} - -impl Scheduler { - - pub fn new(event_loop: Box) -> Scheduler { - Scheduler { - event_loop: event_loop, - } - } -} - -pub fn main() { - let _sched = Scheduler::new(Box::new(UvEventLoop::new()) as Box); -} diff --git a/tests/ui/macros/unreachable.rs b/tests/ui/macros/unreachable.rs deleted file mode 100644 index c5cea5551cfcf..0000000000000 --- a/tests/ui/macros/unreachable.rs +++ /dev/null @@ -1,7 +0,0 @@ -//@ run-fail -//@ error-pattern:internal error: entered unreachable code -//@ needs-subprocess - -fn main() { - unreachable!() -} diff --git a/tests/ui/moves/array-copy-move.rs b/tests/ui/moves/array-copy-move.rs deleted file mode 100644 index ea95bc06a3693..0000000000000 --- a/tests/ui/moves/array-copy-move.rs +++ /dev/null @@ -1,8 +0,0 @@ -//! regression test for issue https://github.com/rust-lang/rust/issues/16783 -//@ run-pass -#![allow(unused_variables)] - -pub fn main() { - let x = [1, 2, 3]; - let y = x; -}