about summary refs log tree commit diff
path: root/src/liballoc
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-06-23 13:46:43 +0000
committerbors <bors@rust-lang.org>2017-06-23 13:46:43 +0000
commit229d0d3266002d343cdd2f4a3bf7f2fe9da15f38 (patch)
tree013df87f8b1813e88368ac8c1728bc4c9b6bfb76 /src/liballoc
parentbd32b1ba0d2d51a7e8505c1d3e37d17d3ba12843 (diff)
parent9037ef2c782c9890e84285e81a183109ef1293f0 (diff)
downloadrust-229d0d3266002d343cdd2f4a3bf7f2fe9da15f38.tar.gz
rust-229d0d3266002d343cdd2f4a3bf7f2fe9da15f38.zip
Auto merge of #42856 - Mark-Simulacrum:rollup, r=Mark-Simulacrum
Rollup of 8 pull requests

- Successful merges: #42777, #42783, #42787, #42821, #42822, #42825, #42829, #42833
- Failed merges:
Diffstat (limited to 'src/liballoc')
-rw-r--r--src/liballoc/boxed.rs4
-rw-r--r--src/liballoc/fmt.rs2
-rw-r--r--src/liballoc/raw_vec.rs22
-rw-r--r--src/liballoc/rc.rs2
-rw-r--r--src/liballoc/string.rs2
-rw-r--r--src/liballoc/vec.rs2
6 files changed, 26 insertions, 8 deletions
diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs
index 2f867912f58..4a43018e973 100644
--- a/src/liballoc/boxed.rs
+++ b/src/liballoc/boxed.rs
@@ -42,8 +42,10 @@
 //! Recursive structures must be boxed, because if the definition of `Cons`
 //! looked like this:
 //!
-//! ```rust,ignore
+//! ```compile_fail,E0072
+//! # enum List<T> {
 //! Cons(T, List<T>),
+//! # }
 //! ```
 //!
 //! It wouldn't work. This is because the size of a `List` depends on how many
diff --git a/src/liballoc/fmt.rs b/src/liballoc/fmt.rs
index 62a88164621..1bd95fb82aa 100644
--- a/src/liballoc/fmt.rs
+++ b/src/liballoc/fmt.rs
@@ -230,7 +230,7 @@
 //! There are a number of related macros in the `format!` family. The ones that
 //! are currently implemented are:
 //!
-//! ```ignore
+//! ```ignore (only-for-syntax-highlight)
 //! format!      // described above
 //! write!       // first argument is a &mut io::Write, the destination
 //! writeln!     // same as write but appends a newline
diff --git a/src/liballoc/raw_vec.rs b/src/liballoc/raw_vec.rs
index 7117c446821..c56a93c0460 100644
--- a/src/liballoc/raw_vec.rs
+++ b/src/liballoc/raw_vec.rs
@@ -244,7 +244,11 @@ impl<T, A: Alloc> RawVec<T, A> {
     ///
     /// # Examples
     ///
-    /// ```ignore
+    /// ```
+    /// # #![feature(alloc)]
+    /// # extern crate alloc;
+    /// # use std::ptr;
+    /// # use alloc::raw_vec::RawVec;
     /// struct MyVec<T> {
     ///     buf: RawVec<T>,
     ///     len: usize,
@@ -261,6 +265,10 @@ impl<T, A: Alloc> RawVec<T, A> {
     ///         self.len += 1;
     ///     }
     /// }
+    /// # fn main() {
+    /// #   let mut vec = MyVec { buf: RawVec::new(), len: 0 };
+    /// #   vec.push(1);
+    /// # }
     /// ```
     #[inline(never)]
     #[cold]
@@ -440,13 +448,17 @@ impl<T, A: Alloc> RawVec<T, A> {
     ///
     /// # Examples
     ///
-    /// ```ignore
+    /// ```
+    /// # #![feature(alloc)]
+    /// # extern crate alloc;
+    /// # use std::ptr;
+    /// # use alloc::raw_vec::RawVec;
     /// struct MyVec<T> {
     ///     buf: RawVec<T>,
     ///     len: usize,
     /// }
     ///
-    /// impl<T> MyVec<T> {
+    /// impl<T: Clone> MyVec<T> {
     ///     pub fn push_all(&mut self, elems: &[T]) {
     ///         self.buf.reserve(self.len, elems.len());
     ///         // reserve would have aborted or panicked if the len exceeded
@@ -459,6 +471,10 @@ impl<T, A: Alloc> RawVec<T, A> {
     ///         }
     ///     }
     /// }
+    /// # fn main() {
+    /// #   let mut vector = MyVec { buf: RawVec::new(), len: 0 };
+    /// #   vector.push_all(&[1, 3, 5, 7, 9]);
+    /// # }
     /// ```
     pub fn reserve(&mut self, used_cap: usize, needed_extra_cap: usize) {
         unsafe {
diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs
index 21a56ff9899..94fe36d01a5 100644
--- a/src/liballoc/rc.rs
+++ b/src/liballoc/rc.rs
@@ -273,7 +273,7 @@ struct RcBox<T: ?Sized> {
 /// See the [module-level documentation](./index.html) for more details.
 ///
 /// The inherent methods of `Rc` are all associated functions, which means
-/// that you have to call them as e.g. [`Rc::get_mut(&value)`][get_mut] instead of
+/// that you have to call them as e.g. [`Rc::get_mut(&mut value)`][get_mut] instead of
 /// `value.get_mut()`. This avoids conflicts with methods of the inner
 /// type `T`.
 ///
diff --git a/src/liballoc/string.rs b/src/liballoc/string.rs
index 2cb81029f95..79d1ccf637d 100644
--- a/src/liballoc/string.rs
+++ b/src/liballoc/string.rs
@@ -124,7 +124,7 @@ use boxed::Box;
 /// similar, but without the UTF-8 constraint. The second implication is that
 /// you cannot index into a `String`:
 ///
-/// ```ignore
+/// ```compile_fail,E0277
 /// let s = "hello";
 ///
 /// println!("The first letter of s is {}", s[0]); // ERROR!!!
diff --git a/src/liballoc/vec.rs b/src/liballoc/vec.rs
index c9c7a27c614..5d1999a4262 100644
--- a/src/liballoc/vec.rs
+++ b/src/liballoc/vec.rs
@@ -156,7 +156,7 @@ use Bound::{Excluded, Included, Unbounded};
 /// However be careful: if you try to access an index which isn't in the `Vec`,
 /// your software will panic! You cannot do this:
 ///
-/// ```ignore
+/// ```should_panic
 /// let v = vec![0, 2, 4, 6];
 /// println!("{}", v[6]); // it will panic!
 /// ```