@@ -163,7 +163,7 @@ assert_eq!(sum, 57);
163
163
The `for` keyword can be used as sugar for iterating through any iterator:
164
164
165
165
~~~
166
- let xs = [ 2 , 3, 5, 7, 11, 13, 17] ;
166
+ let xs = [ 2u , 3, 5, 7, 11, 13, 17] ;
167
167
168
168
// print out all the elements in the vector
169
169
for x in xs.iter() {
@@ -219,7 +219,7 @@ Containers can provide conversion from iterators through `collect` by
219
219
implementing the `FromIterator` trait. For example, the implementation for
220
220
vectors is as follows:
221
221
222
- ~~~
222
+ ~~~ {.xfail-test}
223
223
impl<A> FromIterator<A> for ~[A] {
224
224
pub fn from_iterator<T: Iterator<A>>(iterator: &mut T) -> ~[A] {
225
225
let (lower, _) = iterator.size_hint();
@@ -237,7 +237,7 @@ impl<A> FromIterator<A> for ~[A] {
237
237
The ` Iterator ` trait provides a ` size_hint ` default method, returning a lower
238
238
bound and optionally on upper bound on the length of the iterator:
239
239
240
- ~~~
240
+ ~~~ {.xfail-test}
241
241
fn size_hint(&self) -> (uint, Option<uint>) { (0, None) }
242
242
~~~
243
243
@@ -319,6 +319,16 @@ for x in it.invert() {
319
319
}
320
320
~~~
321
321
322
+ The ` reverse_ ` method is also available for any double-ended iterator yielding
323
+ mutable references. It can be used to reverse a container in-place. Note that
324
+ the trailing underscore is a workaround for issue #5898 and will be removed.
325
+
326
+ ~~~
327
+ let mut ys = [1, 2, 3, 4, 5];
328
+ ys.mut_iter().reverse_();
329
+ assert_eq!(ys, [5, 4, 3, 2, 1]);
330
+ ~~~
331
+
322
332
## Random-access iterators
323
333
324
334
The ` RandomAccessIterator ` trait represents an iterator offering random access
0 commit comments