about summary refs log tree commit diff
path: root/src/liballoc
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-05-09 13:28:15 +0000
committerbors <bors@rust-lang.org>2018-05-09 13:28:15 +0000
commitac287ed167f07619409928008e4a50eecac4a285 (patch)
treeaf5a99bdfb479ee083a98e8f13e5dab963735b75 /src/liballoc
parent8ff4b42064b374bb62043f7729f84b6d979c7667 (diff)
parent99cd9a9f401de3bf2f8c44f9e61bc505cd663a18 (diff)
downloadrust-ac287ed167f07619409928008e4a50eecac4a285.tar.gz
rust-ac287ed167f07619409928008e4a50eecac4a285.zip
Auto merge of #50546 - kennytm:rollup, r=kennytm
Rollup of 11 pull requests

Successful merges:

 - #49988 (Mention Result<!, E> in never docs.)
 - #50148 (turn `ManuallyDrop::new` into a constant function)
 - #50456 (Update the Cargo submodule)
 - #50460 (Make `String::new()` const)
 - #50464 (Remove some transmutes)
 - #50505 (Added regression function match value test)
 - #50511 (Add some explanations for #[must_use])
 - #50525 (Optimize string handling in lit_token().)
 - #50527 (Cleanup a `use` in a raw_vec test)
 - #50539 (Add more logarithm constants)
 - #49523 (Update RELEASES.md for 1.26.0)

Failed merges:
Diffstat (limited to 'src/liballoc')
-rw-r--r--src/liballoc/lib.rs1
-rw-r--r--src/liballoc/raw_vec.rs2
-rw-r--r--src/liballoc/str.rs6
-rw-r--r--src/liballoc/string.rs3
4 files changed, 8 insertions, 4 deletions
diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs
index da4b76a4d52..bb78c14b905 100644
--- a/src/liballoc/lib.rs
+++ b/src/liballoc/lib.rs
@@ -125,6 +125,7 @@
 #![feature(inclusive_range_methods)]
 #![cfg_attr(stage0, feature(generic_param_attrs))]
 #![feature(rustc_const_unstable)]
+#![feature(const_vec_new)]
 
 #![cfg_attr(not(test), feature(fn_traits, i128))]
 #![cfg_attr(test, feature(test))]
diff --git a/src/liballoc/raw_vec.rs b/src/liballoc/raw_vec.rs
index eb25ae17511..4d73d3aa07e 100644
--- a/src/liballoc/raw_vec.rs
+++ b/src/liballoc/raw_vec.rs
@@ -748,7 +748,7 @@ mod tests {
 
     #[test]
     fn allocator_param() {
-        use allocator::{Alloc, AllocErr};
+        use alloc::AllocErr;
 
         // Writing a test of integration between third-party
         // allocators and RawVec is a little tricky because the RawVec
diff --git a/src/liballoc/str.rs b/src/liballoc/str.rs
index 0cbe65db53c..9e693c89be9 100644
--- a/src/liballoc/str.rs
+++ b/src/liballoc/str.rs
@@ -207,7 +207,8 @@ impl str {
     /// let s = "this is old";
     /// assert_eq!(s, s.replace("cookie monster", "little lamb"));
     /// ```
-    #[must_use]
+    #[must_use = "this returns the replaced string as a new allocation, \
+                  without modifying the original"]
     #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
     pub fn replace<'a, P: Pattern<'a>>(&'a self, from: P, to: &str) -> String {
@@ -247,7 +248,8 @@ impl str {
     /// let s = "this is old";
     /// assert_eq!(s, s.replacen("cookie monster", "little lamb", 10));
     /// ```
-    #[must_use]
+    #[must_use = "this returns the replaced string as a new allocation, \
+                  without modifying the original"]
     #[stable(feature = "str_replacen", since = "1.16.0")]
     pub fn replacen<'a, P: Pattern<'a>>(&'a self, pat: P, to: &str, count: usize) -> String {
         // Hope to reduce the times of re-allocation
diff --git a/src/liballoc/string.rs b/src/liballoc/string.rs
index 2f84d5f7f86..da9afdd2ca3 100644
--- a/src/liballoc/string.rs
+++ b/src/liballoc/string.rs
@@ -380,7 +380,8 @@ impl String {
     /// ```
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn new() -> String {
+    #[rustc_const_unstable(feature = "const_string_new")]
+    pub const fn new() -> String {
         String { vec: Vec::new() }
     }