about summary refs log tree commit diff
path: root/src/liballoc
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-04-16 20:35:57 +0000
committerbors <bors@rust-lang.org>2018-04-16 20:35:57 +0000
commit4a3ab8b234cd848b673b64758e4d94bc690f98e0 (patch)
tree98450fb73c7d15d7294a9bf9e8b2715bda1695d7 /src/liballoc
parent49317cd511fbb60178bd5122e484609568938468 (diff)
parentbf16e4bc545640f7269d383edd1592737fbdc0c9 (diff)
downloadrust-4a3ab8b234cd848b673b64758e4d94bc690f98e0.tar.gz
rust-4a3ab8b234cd848b673b64758e4d94bc690f98e0.zip
Auto merge of #50003 - kennytm:rollup, r=kennytm
Rollup of 8 pull requests

Successful merges:

 - #49555 (Inline most of the code paths for conversions with boxed slices)
 - #49606 (Prevent broken pipes causing ICEs)
 - #49646 (Use box syntax instead of Box::new in Mutex::remutex on Windows)
 - #49647 (Remove `underscore_lifetimes` and `match_default_bindings` from active feature list)
 - #49931 (Fix incorrect span in `&mut` suggestion)
 - #49959 (rustbuild: allow building tools with debuginfo)
 - #49965 (Remove warning about f64->f32 cast being potential UB)
 - #49994 (Remove unnecessary indentation in rustdoc book codeblock.)

Failed merges:
Diffstat (limited to 'src/liballoc')
-rw-r--r--src/liballoc/boxed.rs2
-rw-r--r--src/liballoc/str.rs3
-rw-r--r--src/liballoc/string.rs1
-rw-r--r--src/liballoc/vec.rs4
4 files changed, 9 insertions, 1 deletions
diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs
index aceb6ff8abe..5ebd2cc6146 100644
--- a/src/liballoc/boxed.rs
+++ b/src/liballoc/boxed.rs
@@ -429,6 +429,7 @@ impl<'a, T: Copy> From<&'a [T]> for Box<[T]> {
 
 #[stable(feature = "box_from_slice", since = "1.17.0")]
 impl<'a> From<&'a str> for Box<str> {
+    #[inline]
     fn from(s: &'a str) -> Box<str> {
         unsafe { from_boxed_utf8_unchecked(Box::from(s.as_bytes())) }
     }
@@ -436,6 +437,7 @@ impl<'a> From<&'a str> for Box<str> {
 
 #[stable(feature = "boxed_str_conv", since = "1.19.0")]
 impl From<Box<str>> for Box<[u8]> {
+    #[inline]
     fn from(s: Box<str>) -> Self {
         unsafe { Box::from_raw(Box::into_raw(s) as *mut [u8]) }
     }
diff --git a/src/liballoc/str.rs b/src/liballoc/str.rs
index 6c9f3dd7ec9..0e708465332 100644
--- a/src/liballoc/str.rs
+++ b/src/liballoc/str.rs
@@ -1827,6 +1827,7 @@ impl str {
     /// assert_eq!(*boxed_bytes, *s.as_bytes());
     /// ```
     #[stable(feature = "str_box_extras", since = "1.20.0")]
+    #[inline]
     pub fn into_boxed_bytes(self: Box<str>) -> Box<[u8]> {
         self.into()
     }
@@ -2065,6 +2066,7 @@ impl str {
     /// assert_eq!(boxed_str.into_string(), string);
     /// ```
     #[stable(feature = "box_str", since = "1.4.0")]
+    #[inline]
     pub fn into_string(self: Box<str>) -> String {
         let slice = Box::<[u8]>::from(self);
         unsafe { String::from_utf8_unchecked(slice.into_vec()) }
@@ -2323,6 +2325,7 @@ impl str {
 /// assert_eq!("☺", &*smile);
 /// ```
 #[stable(feature = "str_box_extras", since = "1.20.0")]
+#[inline]
 pub unsafe fn from_boxed_utf8_unchecked(v: Box<[u8]>) -> Box<str> {
     Box::from_raw(Box::into_raw(v) as *mut str)
 }
diff --git a/src/liballoc/string.rs b/src/liballoc/string.rs
index 0924ca24791..11fb82c09d3 100644
--- a/src/liballoc/string.rs
+++ b/src/liballoc/string.rs
@@ -1586,6 +1586,7 @@ impl String {
     /// let b = s.into_boxed_str();
     /// ```
     #[stable(feature = "box_str", since = "1.4.0")]
+    #[inline]
     pub fn into_boxed_str(self) -> Box<str> {
         let slice = self.vec.into_boxed_slice();
         unsafe { from_boxed_utf8_unchecked(slice) }
diff --git a/src/liballoc/vec.rs b/src/liballoc/vec.rs
index 8ab25dfe7d8..7d1b2ed85c7 100644
--- a/src/liballoc/vec.rs
+++ b/src/liballoc/vec.rs
@@ -583,7 +583,9 @@ impl<T> Vec<T> {
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     pub fn shrink_to_fit(&mut self) {
-        self.buf.shrink_to_fit(self.len);
+        if self.capacity() != self.len {
+            self.buf.shrink_to_fit(self.len);
+        }
     }
 
     /// Shrinks the capacity of the vector with a lower bound.