diff options
| author | Brian Anderson <banderson@mozilla.com> | 2015-03-13 15:28:35 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2015-03-23 14:40:26 -0700 |
| commit | e9019101a82dd7f61dcdcd52bcc0123d5ed25d22 (patch) | |
| tree | 6553b47da56745ce8cab9e17265bba143608aa97 /src/libcollections | |
| parent | df290f127e923e0aacfe8223dd77f0fa222f0bc8 (diff) | |
Add #![feature] attributes to doctests
Diffstat (limited to 'src/libcollections')
| -rw-r--r-- | src/libcollections/binary_heap.rs | 8 | ||||
| -rw-r--r-- | src/libcollections/bit.rs | 45 | ||||
| -rw-r--r-- | src/libcollections/btree/map.rs | 5 | ||||
| -rw-r--r-- | src/libcollections/btree/set.rs | 11 | ||||
| -rw-r--r-- | src/libcollections/fmt.rs | 3 | ||||
| -rw-r--r-- | src/libcollections/lib.rs | 1 | ||||
| -rw-r--r-- | src/libcollections/linked_list.rs | 7 | ||||
| -rw-r--r-- | src/libcollections/slice.rs | 9 | ||||
| -rw-r--r-- | src/libcollections/str.rs | 15 | ||||
| -rw-r--r-- | src/libcollections/string.rs | 12 | ||||
| -rw-r--r-- | src/libcollections/vec.rs | 11 | ||||
| -rw-r--r-- | src/libcollections/vec_deque.rs | 15 | ||||
| -rw-r--r-- | src/libcollections/vec_map.rs | 21 |
13 files changed, 163 insertions, 0 deletions
diff --git a/src/libcollections/binary_heap.rs b/src/libcollections/binary_heap.rs index 11c8656c994..6edee82dc30 100644 --- a/src/libcollections/binary_heap.rs +++ b/src/libcollections/binary_heap.rs @@ -216,6 +216,7 @@ impl<T: Ord> BinaryHeap<T> { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BinaryHeap; /// let heap = BinaryHeap::from_vec(vec![9, 1, 2, 7, 3, 2]); /// ``` @@ -235,6 +236,7 @@ impl<T: Ord> BinaryHeap<T> { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BinaryHeap; /// let heap = BinaryHeap::from_vec(vec![1, 2, 3, 4]); /// @@ -255,6 +257,7 @@ impl<T: Ord> BinaryHeap<T> { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BinaryHeap; /// let heap = BinaryHeap::from_vec(vec![1, 2, 3, 4]); /// @@ -360,6 +363,7 @@ impl<T: Ord> BinaryHeap<T> { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BinaryHeap; /// let mut heap = BinaryHeap::from_vec(vec![1, 3]); /// @@ -405,6 +409,7 @@ impl<T: Ord> BinaryHeap<T> { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BinaryHeap; /// let mut heap = BinaryHeap::new(); /// heap.push(1); @@ -436,6 +441,7 @@ impl<T: Ord> BinaryHeap<T> { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BinaryHeap; /// let mut heap = BinaryHeap::new(); /// @@ -461,6 +467,7 @@ impl<T: Ord> BinaryHeap<T> { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BinaryHeap; /// let heap = BinaryHeap::from_vec(vec![1, 2, 3, 4, 5, 6, 7]); /// let vec = heap.into_vec(); @@ -478,6 +485,7 @@ impl<T: Ord> BinaryHeap<T> { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BinaryHeap; /// /// let mut heap = BinaryHeap::from_vec(vec![1, 2, 4, 5, 7]); diff --git a/src/libcollections/bit.rs b/src/libcollections/bit.rs index 90fbe04d348..d83ff92bf3d 100644 --- a/src/libcollections/bit.rs +++ b/src/libcollections/bit.rs @@ -38,6 +38,7 @@ //! [sieve]: http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes //! //! ``` +//! # #![feature(collections, core)] //! use std::collections::{BitSet, BitVec}; //! use std::num::Float; //! use std::iter; @@ -134,6 +135,7 @@ static FALSE: bool = false; /// # Examples /// /// ``` +/// # #![feature(collections)] /// use std::collections::BitVec; /// /// let mut bv = BitVec::from_elem(10, false); @@ -250,6 +252,7 @@ impl BitVec { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BitVec; /// let mut bv = BitVec::new(); /// ``` @@ -264,6 +267,7 @@ impl BitVec { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BitVec; /// /// let mut bv = BitVec::from_elem(10, false); @@ -304,6 +308,7 @@ impl BitVec { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BitVec; /// /// let bv = BitVec::from_bytes(&[0b10100000, 0b00010010]); @@ -346,6 +351,7 @@ impl BitVec { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BitVec; /// /// let bv = BitVec::from_fn(5, |i| { i % 2 == 0 }); @@ -364,6 +370,7 @@ impl BitVec { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BitVec; /// /// let bv = BitVec::from_bytes(&[0b01100000]); @@ -396,6 +403,7 @@ impl BitVec { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BitVec; /// /// let mut bv = BitVec::from_elem(5, false); @@ -420,6 +428,7 @@ impl BitVec { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BitVec; /// /// let before = 0b01100000; @@ -440,6 +449,7 @@ impl BitVec { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BitVec; /// /// let before = 0b01100000; @@ -468,6 +478,7 @@ impl BitVec { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BitVec; /// /// let a = 0b01100100; @@ -498,6 +509,7 @@ impl BitVec { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BitVec; /// /// let a = 0b01100100; @@ -528,6 +540,7 @@ impl BitVec { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BitVec; /// /// let a = 0b01100100; @@ -557,6 +570,7 @@ impl BitVec { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BitVec; /// /// let mut bv = BitVec::from_elem(5, true); @@ -581,6 +595,7 @@ impl BitVec { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BitVec; /// /// let bv = BitVec::from_bytes(&[0b01110100, 0b10010010]); @@ -597,6 +612,7 @@ impl BitVec { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BitVec; /// /// let mut bv = BitVec::from_elem(10, false); @@ -614,6 +630,7 @@ impl BitVec { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BitVec; /// /// let mut bv = BitVec::from_elem(10, false); @@ -635,6 +652,7 @@ impl BitVec { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BitVec; /// /// let mut bv = BitVec::from_elem(3, true); @@ -682,6 +700,7 @@ impl BitVec { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BitVec; /// /// let bv = BitVec::from_bytes(&[0b10100000]); @@ -702,6 +721,7 @@ impl BitVec { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BitVec; /// /// let mut bv = BitVec::from_bytes(&[0b01001011]); @@ -728,6 +748,7 @@ impl BitVec { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BitVec; /// /// let mut bv = BitVec::from_elem(3, false); @@ -758,6 +779,7 @@ impl BitVec { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BitVec; /// /// let mut bv = BitVec::from_elem(3, false); @@ -780,6 +802,7 @@ impl BitVec { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BitVec; /// /// let mut bv = BitVec::new(); @@ -801,6 +824,7 @@ impl BitVec { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BitVec; /// /// let mut bv = BitVec::from_bytes(&[0b01001011]); @@ -851,6 +875,7 @@ impl BitVec { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BitVec; /// /// let mut bv = BitVec::from_bytes(&[0b01001001]); @@ -881,6 +906,7 @@ impl BitVec { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BitVec; /// /// let mut bv = BitVec::new(); @@ -1091,6 +1117,7 @@ impl<'a> IntoIterator for &'a BitVec { /// # Examples /// /// ``` +/// # #![feature(collections)] /// use std::collections::{BitSet, BitVec}; /// /// // It's a regular set @@ -1187,6 +1214,7 @@ impl BitSet { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BitSet; /// /// let mut s = BitSet::new(); @@ -1203,6 +1231,7 @@ impl BitSet { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BitSet; /// /// let mut s = BitSet::with_capacity(100); @@ -1220,6 +1249,7 @@ impl BitSet { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::{BitVec, BitSet}; /// /// let bv = BitVec::from_bytes(&[0b01100000]); @@ -1249,6 +1279,7 @@ impl BitSet { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BitSet; /// /// let mut s = BitSet::with_capacity(100); @@ -1270,6 +1301,7 @@ impl BitSet { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BitSet; /// /// let mut s = BitSet::new(); @@ -1296,6 +1328,7 @@ impl BitSet { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BitSet; /// /// let mut s = BitSet::new(); @@ -1316,6 +1349,7 @@ impl BitSet { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BitSet; /// /// let mut s = BitSet::new(); @@ -1336,6 +1370,7 @@ impl BitSet { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BitSet; /// /// let mut s = BitSet::new(); @@ -1382,6 +1417,7 @@ impl BitSet { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BitSet; /// /// let mut s = BitSet::new(); @@ -1414,6 +1450,7 @@ impl BitSet { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::{BitVec, BitSet}; /// /// let s = BitSet::from_bit_vec(BitVec::from_bytes(&[0b01001010])); @@ -1435,6 +1472,7 @@ impl BitSet { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::{BitVec, BitSet}; /// /// let a = BitSet::from_bit_vec(BitVec::from_bytes(&[0b01101000])); @@ -1465,6 +1503,7 @@ impl BitSet { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::{BitVec, BitSet}; /// /// let a = BitSet::from_bit_vec(BitVec::from_bytes(&[0b01101000])); @@ -1495,6 +1534,7 @@ impl BitSet { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::{BitSet, BitVec}; /// /// let a = BitSet::from_bit_vec(BitVec::from_bytes(&[0b01101000])); @@ -1533,6 +1573,7 @@ impl BitSet { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::{BitSet, BitVec}; /// /// let a = BitSet::from_bit_vec(BitVec::from_bytes(&[0b01101000])); @@ -1562,6 +1603,7 @@ impl BitSet { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::{BitSet, BitVec}; /// /// let a = 0b01101000; @@ -1585,6 +1627,7 @@ impl BitSet { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::{BitSet, BitVec}; /// /// let a = 0b01101000; @@ -1609,6 +1652,7 @@ impl BitSet { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::{BitSet, BitVec}; /// /// let a = 0b01101000; @@ -1641,6 +1685,7 @@ impl BitSet { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::{BitSet, BitVec}; /// /// let a = 0b01101000; diff --git a/src/libcollections/btree/map.rs b/src/libcollections/btree/map.rs index a9e1ce8d7ce..e69ca8c9a09 100644 --- a/src/libcollections/btree/map.rs +++ b/src/libcollections/btree/map.rs @@ -1269,6 +1269,7 @@ impl<K, V> BTreeMap<K, V> { /// # Examples /// /// ``` + /// # #![feature(core)] /// use std::collections::BTreeMap; /// /// let mut a = BTreeMap::new(); @@ -1291,6 +1292,7 @@ impl<K, V> BTreeMap<K, V> { /// # Examples /// /// ``` + /// # #![feature(core)] /// use std::collections::BTreeMap; /// /// let mut a = BTreeMap::new(); @@ -1478,6 +1480,7 @@ impl<K: Ord, V> BTreeMap<K, V> { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BTreeMap; /// use std::collections::Bound::{Included, Unbounded}; /// @@ -1504,6 +1507,7 @@ impl<K: Ord, V> BTreeMap<K, V> { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BTreeMap; /// use std::collections::Bound::{Included, Excluded}; /// @@ -1529,6 +1533,7 @@ impl<K: Ord, V> BTreeMap<K, V> { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BTreeMap; /// use std::collections::btree_map::Entry; /// diff --git a/src/libcollections/btree/set.rs b/src/libcollections/btree/set.rs index 5616d36ce0b..bce0450852f 100644 --- a/src/libcollections/btree/set.rs +++ b/src/libcollections/btree/set.rs @@ -116,6 +116,7 @@ impl<T> BTreeSet<T> { /// # Examples /// /// ``` + /// # #![feature(core)] /// use std::collections::BTreeSet; /// /// let set: BTreeSet<usize> = [1, 2, 3, 4].iter().cloned().collect(); @@ -137,6 +138,7 @@ impl<T> BTreeSet<T> { /// # Examples /// /// ``` + /// # #![feature(core)] /// use std::collections::BTreeSet; /// /// let set: BTreeSet<usize> = [1, 2, 3, 4].iter().cloned().collect(); @@ -162,6 +164,7 @@ impl<T: Ord> BTreeSet<T> { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BTreeSet; /// use std::collections::Bound::{Included, Unbounded}; /// @@ -190,6 +193,7 @@ impl<T: Ord> BTreeSet<T> { /// # Examples /// /// ``` + /// # #![feature(core)] /// use std::collections::BTreeSet; /// /// let mut a = BTreeSet::new(); @@ -213,6 +217,7 @@ impl<T: Ord> BTreeSet<T> { /// # Examples /// /// ``` + /// # #![feature(core)] /// use std::collections::BTreeSet; /// /// let mut a = BTreeSet::new(); @@ -237,6 +242,7 @@ impl<T: Ord> BTreeSet<T> { /// # Examples /// /// ``` + /// # #![feature(core)] /// use std::collections::BTreeSet; /// /// let mut a = BTreeSet::new(); @@ -261,6 +267,7 @@ impl<T: Ord> BTreeSet<T> { /// # Examples /// /// ``` + /// # #![feature(core)] /// use std::collections::BTreeSet; /// /// let mut a = BTreeSet::new(); @@ -333,6 +340,7 @@ impl<T: Ord> BTreeSet<T> { /// # Examples /// /// ``` + /// # #![feature(core)] /// use std::collections::BTreeSet; /// /// let set: BTreeSet<_> = [1, 2, 3].iter().cloned().collect(); @@ -350,6 +358,7 @@ impl<T: Ord> BTreeSet<T> { /// # Examples /// /// ``` + /// # #![feature(core)] /// use std::collections::BTreeSet; /// /// let a: BTreeSet<_> = [1, 2, 3].iter().cloned().collect(); @@ -371,6 +380,7 @@ impl<T: Ord> BTreeSet<T> { /// # Examples /// /// ``` + /// # #![feature(core)] /// use std::collections::BTreeSet; /// /// let sup: BTreeSet<_> = [1, 2, 3].iter().cloned().collect(); @@ -413,6 +423,7 @@ impl<T: Ord> BTreeSet<T> { /// # Examples /// /// ``` + /// # #![feature(core)] /// use std::collections::BTreeSet; /// /// let sub: BTreeSet<_> = [1, 2].iter().cloned().collect(); diff --git a/src/libcollections/fmt.rs b/src/libcollections/fmt.rs index 3af7485b237..b106f4adbc7 100644 --- a/src/libcollections/fmt.rs +++ b/src/libcollections/fmt.rs @@ -174,6 +174,7 @@ //! like: //! //! ``` +//! # #![feature(core, std_misc)] //! use std::fmt; //! use std::f64; //! use std::num::Float; @@ -261,6 +262,7 @@ //! Example usage is: //! //! ``` +//! # #![feature(old_io)] //! # #![allow(unused_must_use)] //! use std::io::Write; //! let mut w = Vec::new(); @@ -288,6 +290,7 @@ //! off, some example usage is: //! //! ``` +//! # #![feature(old_io)] //! use std::fmt; //! use std::io::{self, Write}; //! diff --git a/src/libcollections/lib.rs b/src/libcollections/lib.rs index cf9f6a39a55..fa8413ff170 100644 --- a/src/libcollections/lib.rs +++ b/src/libcollections/lib.rs @@ -22,6 +22,7 @@ html_favicon_url = "http://www.rust-lang.org/favicon.ico", html_root_url = "http://doc.rust-lang.org/nightly/", html_playground_url = "http://play.rust-lang.org/")] +#![doc(test(no_crate_inject))] #![feature(alloc)] #![feature(box_syntax)] diff --git a/src/libcollections/linked_list.rs b/src/libcollections/linked_list.rs index 9e0a6d04381..ae00c820a1d 100644 --- a/src/libcollections/linked_list.rs +++ b/src/libcollections/linked_list.rs @@ -235,6 +235,7 @@ impl<T> LinkedList<T> { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::LinkedList; /// /// let mut a = LinkedList::new(); @@ -483,6 +484,7 @@ impl<T> LinkedList<T> { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::LinkedList; /// /// let mut dl = LinkedList::new(); @@ -530,6 +532,7 @@ impl<T> LinkedList<T> { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::LinkedList; /// /// let mut d = LinkedList::new(); @@ -548,6 +551,7 @@ impl<T> LinkedList<T> { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::LinkedList; /// /// let mut d = LinkedList::new(); @@ -573,6 +577,7 @@ impl<T> LinkedList<T> { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::LinkedList; /// /// let mut d = LinkedList::new(); @@ -765,6 +770,7 @@ impl<'a, A> IterMut<'a, A> { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::LinkedList; /// /// let mut list: LinkedList<_> = vec![1, 3, 4].into_iter().collect(); @@ -792,6 +798,7 @@ impl<'a, A> IterMut<'a, A> { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::LinkedList; /// /// let mut list: LinkedList<_> = vec![1, 2, 3].into_iter().collect(); diff --git a/src/libcollections/slice.rs b/src/libcollections/slice.rs index 45864153dd7..9b9417d2be7 100644 --- a/src/libcollections/slice.rs +++ b/src/libcollections/slice.rs @@ -14,6 +14,7 @@ //! Slices are a view into a block of memory represented as a pointer and a length. //! //! ```rust +//! # #![feature(core)] //! // slicing a Vec //! let vec = vec!(1, 2, 3); //! let int_slice = vec.as_slice(); @@ -270,6 +271,7 @@ impl<T> [T] { /// # Examples /// /// ```rust + /// # #![feature(collections)] /// let mut a = [1, 2, 3, 4, 5]; /// let b = vec![6, 7, 8]; /// let num_moved = a.move_from(b, 0, 3); @@ -560,6 +562,7 @@ impl<T> [T] { /// found; the fourth could match any position in `[1,4]`. /// /// ```rust + /// # #![feature(core)] /// let s = [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55]; /// let s = s.as_slice(); /// @@ -842,6 +845,7 @@ impl<T> [T] { /// # Examples /// /// ```rust + /// # #![feature(collections)] /// let v = [1, 2, 3]; /// let mut perms = v.permutations(); /// @@ -853,6 +857,7 @@ impl<T> [T] { /// Iterating through permutations one by one. /// /// ```rust + /// # #![feature(collections)] /// let v = [1, 2, 3]; /// let mut perms = v.permutations(); /// @@ -874,6 +879,7 @@ impl<T> [T] { /// # Example /// /// ```rust + /// # #![feature(collections)] /// let mut dst = [0, 0, 0]; /// let src = [1, 2]; /// @@ -921,6 +927,7 @@ impl<T> [T] { /// found; the fourth could match any position in `[1,4]`. /// /// ```rust + /// # #![feature(core)] /// let s = [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55]; /// let s = s.as_slice(); /// @@ -950,6 +957,7 @@ impl<T> [T] { /// # Example /// /// ```rust + /// # #![feature(collections)] /// let v: &mut [_] = &mut [0, 1, 2]; /// v.next_permutation(); /// let b: &mut [_] = &mut [0, 2, 1]; @@ -972,6 +980,7 @@ impl<T> [T] { /// # Example /// /// ```rust + /// # #![feature(collections)] /// let v: &mut [_] = &mut [1, 0, 2]; /// v.prev_permutation(); /// let b: &mut [_] = &mut [0, 2, 1]; diff --git a/src/libcollections/str.rs b/src/libcollections/str.rs index 3a289e4ef37..494dd009ea9 100644 --- a/src/libcollections/str.rs +++ b/src/libcollections/str.rs @@ -548,6 +548,7 @@ impl str { /// # Examples /// /// ``` + /// # #![feature(collections)] /// assert!("hello".contains_char('e')); /// /// assert!(!"hello".contains_char('z')); @@ -739,6 +740,7 @@ impl str { /// # Examples /// /// ``` + /// # #![feature(collections)] /// let v: Vec<(usize, usize)> = "abcXXXabcYYYabc".match_indices("abc").collect(); /// assert_eq!(v, [(0,3), (6,9), (12,15)]); /// @@ -761,6 +763,7 @@ impl str { /// # Examples /// /// ``` + /// # #![feature(collections)] /// let v: Vec<&str> = "abcXXXabcYYYabc".split_str("abc").collect(); /// assert_eq!(v, ["", "XXX", "YYY", ""]); /// @@ -869,6 +872,7 @@ impl str { /// # Examples /// /// ``` + /// # #![feature(collections)] /// let s = "Löwe 老虎 Léopard"; /// /// assert_eq!(s.slice_chars(0, 4), "Löwe"); @@ -1019,6 +1023,7 @@ impl str { /// # Examples /// /// ``` + /// # #![feature(str_char)] /// let s = "Löwe 老虎 Léopard"; /// assert!(s.is_char_boundary(0)); /// // start of `老` @@ -1055,6 +1060,7 @@ impl str { /// done by `.chars()` or `.char_indices()`. /// /// ``` + /// # #![feature(str_char, core)] /// use std::str::CharRange; /// /// let s = "中华Việt Nam"; @@ -1105,6 +1111,7 @@ impl str { /// done by `.chars().rev()` or `.char_indices()`. /// /// ``` + /// # #![feature(str_char, core)] /// use std::str::CharRange; /// /// let s = "中华Việt Nam"; @@ -1148,6 +1155,7 @@ impl str { /// # Examples /// /// ``` + /// # #![feature(str_char)] /// let s = "abπc"; /// assert_eq!(s.char_at(1), 'b'); /// assert_eq!(s.char_at(2), 'π'); @@ -1172,6 +1180,7 @@ impl str { /// # Examples /// /// ``` + /// # #![feature(str_char)] /// let s = "abπc"; /// assert_eq!(s.char_at_reverse(1), 'a'); /// assert_eq!(s.char_at_reverse(2), 'b'); @@ -1286,6 +1295,7 @@ impl str { /// # Examples /// /// ``` + /// # #![feature(collections)] /// let s = "Löwe 老虎 Léopard"; /// /// assert_eq!(s.find_str("老虎 L"), Some(6)); @@ -1307,6 +1317,7 @@ impl str { /// # Examples /// /// ``` + /// # #![feature(str_char)] /// let s = "Löwe 老虎 Léopard"; /// let (c, s1) = s.slice_shift_char().unwrap(); /// @@ -1335,6 +1346,7 @@ impl str { /// # Examples /// /// ``` + /// # #![feature(collections)] /// let string = "a\nb\nc"; /// let lines: Vec<&str> = string.lines().collect(); /// @@ -1434,6 +1446,7 @@ impl str { /// # Examples /// /// ``` + /// # #![feature(unicode, core)] /// let gr1 = "a\u{310}e\u{301}o\u{308}\u{332}".graphemes(true).collect::<Vec<&str>>(); /// let b: &[_] = &["a\u{310}", "e\u{301}", "o\u{308}\u{332}"]; /// @@ -1456,6 +1469,7 @@ impl str { /// # Examples /// /// ``` + /// # #![feature(unicode, core)] /// let gr_inds = "a̐éö̲\r\n".grapheme_indices(true).collect::<Vec<(usize, &str)>>(); /// let b: &[_] = &[(0, "a̐"), (3, "é"), (6, "ö̲"), (11, "\r\n")]; /// @@ -1475,6 +1489,7 @@ impl str { /// # Examples /// /// ``` + /// # #![feature(str_words)] /// let some_words = " Mary had\ta little \n\t lamb"; /// let v: Vec<&str> = some_words.words().collect(); /// diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs index cd6f27bf65f..abc67aa6136 100644 --- a/src/libcollections/string.rs +++ b/src/libcollections/string.rs @@ -90,6 +90,7 @@ impl String { /// # Examples /// /// ``` + /// # #![feature(collections, core)] /// let s = String::from_str("hello"); /// assert_eq!(s.as_slice(), "hello"); /// ``` @@ -122,6 +123,7 @@ impl String { /// # Examples /// /// ``` + /// # #![feature(core)] /// use std::str::Utf8Error; /// /// let hello_vec = vec![104, 101, 108, 108, 111]; @@ -350,6 +352,7 @@ impl String { /// # Examples /// /// ``` + /// # #![feature(collections)] /// let s = String::from_str("hello"); /// let bytes = s.into_bytes(); /// assert_eq!(bytes, [104, 101, 108, 108, 111]); @@ -365,6 +368,7 @@ impl String { /// # Examples /// /// ``` + /// # #![feature(collections)] /// let mut s = String::from_str("foo"); /// s.push_str("bar"); /// assert_eq!(s, "foobar"); @@ -441,6 +445,7 @@ impl String { /// # Examples /// /// ``` + /// # #![feature(collections)] /// let mut s = String::from_str("foo"); /// s.reserve(100); /// assert!(s.capacity() >= 100); @@ -458,6 +463,7 @@ impl String { /// # Examples /// /// ``` + /// # #![feature(collections)] /// let mut s = String::from_str("abc"); /// s.push('1'); /// s.push('2'); @@ -493,6 +499,7 @@ impl String { /// # Examples /// /// ``` + /// # #![feature(collections)] /// let s = String::from_str("hello"); /// let b: &[_] = &[104, 101, 108, 108, 111]; /// assert_eq!(s.as_bytes(), b); @@ -513,6 +520,7 @@ impl String { /// # Examples /// /// ``` + /// # #![feature(collections)] /// let mut s = String::from_str("hello"); /// s.truncate(2); /// assert_eq!(s, "he"); @@ -530,6 +538,7 @@ impl String { /// # Examples /// /// ``` + /// # #![feature(collections)] /// let mut s = String::from_str("foo"); /// assert_eq!(s.pop(), Some('o')); /// assert_eq!(s.pop(), Some('o')); @@ -567,6 +576,7 @@ impl String { /// # Examples /// /// ``` + /// # #![feature(collections)] /// let mut s = String::from_str("foo"); /// assert_eq!(s.remove(0), 'f'); /// assert_eq!(s.remove(1), 'o'); @@ -629,6 +639,7 @@ impl String { /// # Examples /// /// ``` + /// # #![feature(collections)] /// let mut s = String::from_str("hello"); /// unsafe { /// let vec = s.as_mut_vec(); @@ -930,6 +941,7 @@ impl<'a> Deref for DerefString<'a> { /// # Examples /// /// ``` +/// # #![feature(collections)] /// use std::string::as_string; /// /// fn string_consumer(s: String) { diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs index b0e8dc7d0b6..473442e531b 100644 --- a/src/libcollections/vec.rs +++ b/src/libcollections/vec.rs @@ -73,6 +73,7 @@ use borrow::{Cow, IntoCow}; /// # Examples /// /// ``` +/// # #![feature(collections)] /// let mut vec = Vec::new(); /// vec.push(1); /// vec.push(2); @@ -345,6 +346,7 @@ impl<T> Vec<T> { /// # Examples /// /// ``` + /// # #![feature(collections)] /// let mut vec = Vec::with_capacity(10); /// vec.push_all(&[1, 2, 3]); /// assert_eq!(vec.capacity(), 10); @@ -400,6 +402,7 @@ impl<T> Vec<T> { /// # Examples /// /// ``` + /// # #![feature(collections)] /// let mut vec = vec![1, 2, 3, 4]; /// vec.truncate(2); /// assert_eq!(vec, [1, 2]); @@ -565,6 +568,7 @@ impl<T> Vec<T> { /// # Examples /// /// ``` + /// # #![feature(collections)] /// let mut v = vec![1, 2, 3]; /// assert_eq!(v.remove(1), 2); /// assert_eq!(v, [1, 3]); @@ -696,6 +700,7 @@ impl<T> Vec<T> { /// # Examples /// /// ``` + /// # #![feature(collections)] /// let mut vec = vec![1, 2, 3]; /// let mut vec2 = vec![4, 5, 6]; /// vec.append(&mut vec2); @@ -732,6 +737,7 @@ impl<T> Vec<T> { /// # Examples /// /// ``` + /// # #![feature(collections)] /// let mut v = vec!["a".to_string(), "b".to_string()]; /// for s in v.drain() { /// // s has type String, not &String @@ -813,6 +819,7 @@ impl<T> Vec<T> { /// # Examples /// /// ``` + /// # #![feature(collections, core)] /// let v = vec![0, 1, 2]; /// let w = v.map_in_place(|i| i + 3); /// assert_eq!(w.as_slice(), [3, 4, 5].as_slice()); @@ -1015,6 +1022,7 @@ impl<T> Vec<T> { /// # Examples /// /// ``` + /// # #![feature(collections)] /// let mut vec = vec![1,2,3]; /// let vec2 = vec.split_off(1); /// assert_eq!(vec, [1]); @@ -1053,6 +1061,7 @@ impl<T: Clone> Vec<T> { /// # Examples /// /// ``` + /// # #![feature(collections)] /// let mut vec = vec!["hello"]; /// vec.resize(3, "world"); /// assert_eq!(vec, ["hello", "world", "world"]); @@ -1081,6 +1090,7 @@ impl<T: Clone> Vec<T> { /// # Examples /// /// ``` + /// # #![feature(collections)] /// let mut vec = vec![1]; /// vec.push_all(&[2, 3, 4]); /// assert_eq!(vec, [1, 2, 3, 4]); @@ -1554,6 +1564,7 @@ impl<T> AsSlice<T> for Vec<T> { /// # Examples /// /// ``` + /// # #![feature(core)] /// fn foo(slice: &[i32]) {} /// /// let vec = vec![1, 2]; diff --git a/src/libcollections/vec_deque.rs b/src/libcollections/vec_deque.rs index 56ca74dab1f..d2570640038 100644 --- a/src/libcollections/vec_deque.rs +++ b/src/libcollections/vec_deque.rs @@ -257,6 +257,7 @@ impl<T> VecDeque<T> { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::VecDeque; /// /// let mut buf = VecDeque::new(); @@ -284,6 +285,7 @@ impl<T> VecDeque<T> { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::VecDeque; /// /// let buf: VecDeque<i32> = VecDeque::with_capacity(10); @@ -307,6 +309,7 @@ impl<T> VecDeque<T> { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::VecDeque; /// /// let mut buf: VecDeque<i32> = vec![1].into_iter().collect(); @@ -328,6 +331,7 @@ impl<T> VecDeque<T> { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::VecDeque; /// /// let mut buf: VecDeque<i32> = vec![1].into_iter().collect(); @@ -403,6 +407,7 @@ impl<T> VecDeque<T> { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::VecDeque; /// /// let mut buf = VecDeque::with_capacity(15); @@ -489,6 +494,7 @@ impl<T> VecDeque<T> { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::VecDeque; /// /// let mut buf = VecDeque::new(); @@ -512,6 +518,7 @@ impl<T> VecDeque<T> { /// # Examples /// /// ``` + /// # #![feature(core)] /// use std::collections::VecDeque; /// /// let mut buf = VecDeque::new(); @@ -535,6 +542,7 @@ impl<T> VecDeque<T> { /// # Examples /// /// ``` + /// # #![feature(core)] /// use std::collections::VecDeque; /// /// let mut buf = VecDeque::new(); @@ -644,6 +652,7 @@ impl<T> VecDeque<T> { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::VecDeque; /// /// let mut v = VecDeque::new(); @@ -882,6 +891,7 @@ impl<T> VecDeque<T> { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::VecDeque; /// /// let mut buf = VecDeque::new(); @@ -915,6 +925,7 @@ impl<T> VecDeque<T> { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::VecDeque; /// /// let mut buf = VecDeque::new(); @@ -948,6 +959,7 @@ impl<T> VecDeque<T> { /// /// # Examples /// ``` + /// # #![feature(collections)] /// use std::collections::VecDeque; /// /// let mut buf = VecDeque::new(); @@ -1321,6 +1333,7 @@ impl<T> VecDeque<T> { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::VecDeque; /// /// let mut buf: VecDeque<_> = vec![1,2,3].into_iter().collect(); @@ -1383,6 +1396,7 @@ impl<T> VecDeque<T> { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::VecDeque; /// /// let mut buf: VecDeque<_> = vec![1, 2, 3].into_iter().collect(); @@ -1407,6 +1421,7 @@ impl<T: Clone> VecDeque<T> { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::VecDeque; /// /// let mut buf = VecDeque::new(); diff --git a/src/libcollections/vec_map.rs b/src/libcollections/vec_map.rs index 6e67d876327..84fb06809b9 100644 --- a/src/libcollections/vec_map.rs +++ b/src/libcollections/vec_map.rs @@ -34,6 +34,7 @@ use vec::Vec; /// # Examples /// /// ``` +/// # #![feature(collections)] /// use std::collections::VecMap; /// /// let mut months = VecMap::new(); @@ -132,6 +133,7 @@ impl<V> VecMap<V> { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::VecMap; /// let mut map: VecMap<&str> = VecMap::new(); /// ``` @@ -144,6 +146,7 @@ impl<V> VecMap<V> { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::VecMap; /// let mut map: VecMap<&str> = VecMap::with_capacity(10); /// ``` @@ -158,6 +161,7 @@ impl<V> VecMap<V> { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::VecMap; /// let map: VecMap<String> = VecMap::with_capacity(10); /// assert!(map.capacity() >= 10); @@ -177,6 +181,7 @@ impl<V> VecMap<V> { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::VecMap; /// let mut map: VecMap<&str> = VecMap::new(); /// map.reserve_len(10); @@ -201,6 +206,7 @@ impl<V> VecMap<V> { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::VecMap; /// let mut map: VecMap<&str> = VecMap::new(); /// map.reserve_len_exact(10); @@ -240,6 +246,7 @@ impl<V> VecMap<V> { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::VecMap; /// /// let mut map = VecMap::new(); @@ -268,6 +275,7 @@ impl<V> VecMap<V> { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::VecMap; /// /// let mut map = VecMap::new(); @@ -299,6 +307,7 @@ impl<V> VecMap<V> { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::VecMap; /// /// let mut map = VecMap::new(); @@ -325,6 +334,7 @@ impl<V> VecMap<V> { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::VecMap; /// /// let mut a = VecMap::new(); @@ -360,6 +370,7 @@ impl<V> VecMap<V> { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::VecMap; /// /// let mut a = VecMap::new(); @@ -416,6 +427,7 @@ impl<V> VecMap<V> { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::VecMap; /// /// let mut map = VecMap::new(); @@ -443,6 +455,7 @@ impl<V> VecMap<V> { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::VecMap; /// /// let mut a = VecMap::new(); @@ -460,6 +473,7 @@ impl<V> VecMap<V> { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::VecMap; /// /// let mut a = VecMap::new(); @@ -477,6 +491,7 @@ impl<V> VecMap<V> { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::VecMap; /// /// let mut a = VecMap::new(); @@ -492,6 +507,7 @@ impl<V> VecMap<V> { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::VecMap; /// /// let mut map = VecMap::new(); @@ -516,6 +532,7 @@ impl<V> VecMap<V> { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::VecMap; /// /// let mut map = VecMap::new(); @@ -534,6 +551,7 @@ impl<V> VecMap<V> { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::VecMap; /// /// let mut map = VecMap::new(); @@ -562,6 +580,7 @@ impl<V> VecMap<V> { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::VecMap; /// /// let mut map = VecMap::new(); @@ -587,6 +606,7 @@ impl<V> VecMap<V> { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::VecMap; /// /// let mut map = VecMap::new(); @@ -608,6 +628,7 @@ impl<V> VecMap<V> { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::VecMap; /// use std::collections::vec_map::Entry; /// |
