about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-04-23 00:28:05 +0000
committerbors <bors@rust-lang.org>2020-04-23 00:28:05 +0000
commitfc145e19d05e8f2ee0aad77a0eba93292ebd3887 (patch)
tree1644d58fa36743ff3897969697e3f7bc7fd783f4 /src/libcore
parentdb9b05aeb52b77d1eb780ee005979b63d093c214 (diff)
parentbb13aab8e570b8b062b494f3cbbf569ed6830c68 (diff)
downloadrust-fc145e19d05e8f2ee0aad77a0eba93292ebd3887.tar.gz
rust-fc145e19d05e8f2ee0aad77a0eba93292ebd3887.zip
Auto merge of #71445 - Dylan-DPC:rollup-31givp1, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #71256 (Lint must_use on mem::replace)
 - #71350 (Error code explanation extra check)
 - #71369 (allow wasm32 compilation of librustc_data_structures/profiling.rs)
 - #71400 (proc_macro::is_available())
 - #71440 (Implement `Copy` for `AllocErr`)

Failed merges:

r? @ghost
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/alloc/mod.rs2
-rw-r--r--src/libcore/marker.rs1
-rw-r--r--src/libcore/mem/mod.rs1
3 files changed, 3 insertions, 1 deletions
diff --git a/src/libcore/alloc/mod.rs b/src/libcore/alloc/mod.rs
index e1892edb7c7..86a6fa7f8ba 100644
--- a/src/libcore/alloc/mod.rs
+++ b/src/libcore/alloc/mod.rs
@@ -18,7 +18,7 @@ use crate::ptr::{self, NonNull};
 /// something wrong when combining the given input arguments with this
 /// allocator.
 #[unstable(feature = "allocator_api", issue = "32838")]
-#[derive(Clone, PartialEq, Eq, Debug)]
+#[derive(Copy, Clone, PartialEq, Eq, Debug)]
 pub struct AllocErr;
 
 // (we need this for downstream impl of trait Error)
diff --git a/src/libcore/marker.rs b/src/libcore/marker.rs
index 35bceaa25c3..549933ceeb6 100644
--- a/src/libcore/marker.rs
+++ b/src/libcore/marker.rs
@@ -709,6 +709,7 @@ unsafe impl<T: ?Sized> Freeze for &mut T {}
 /// So this, for example, can only be done on types implementing `Unpin`:
 ///
 /// ```rust
+/// # #![allow(unused_must_use)]
 /// use std::mem;
 /// use std::pin::Pin;
 ///
diff --git a/src/libcore/mem/mod.rs b/src/libcore/mem/mod.rs
index 07f7d28bb75..3fa2b7a2d04 100644
--- a/src/libcore/mem/mod.rs
+++ b/src/libcore/mem/mod.rs
@@ -808,6 +808,7 @@ pub fn take<T: Default>(dest: &mut T) -> T {
 /// [`Clone`]: ../../std/clone/trait.Clone.html
 #[inline]
 #[stable(feature = "rust1", since = "1.0.0")]
+#[must_use = "if you don't need the old value, you can just assign the new value directly"]
 pub fn replace<T>(dest: &mut T, mut src: T) -> T {
     swap(dest, &mut src);
     src