Skip to content

Commit 4007e25

Browse files
jooertManishearth
authored andcommitted
---
yaml --- r: 191445 b: refs/heads/try c: da96d22 h: refs/heads/master i: 191443: 68e2710 v: v3
1 parent 0745b74 commit 4007e25

File tree

20 files changed

+71
-415
lines changed

20 files changed

+71
-415
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 809a554fca2d0ebc2ba50077016fe282a4064752
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: c64d671671aea2e44ee7fc6eb00ee75fc30ed7b9
5-
refs/heads/try: acc706db4bea7fe8b0cede5ba3f45ad3fff47ce9
5+
refs/heads/try: da96d22d3a8bd4ad74e797b823dd10a34d88991e
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
88
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/try/src/doc/reference.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2068,7 +2068,7 @@ type int8_t = i8;
20682068
item](#language-items) for more details.
20692069
- `test` - indicates that this function is a test function, to only be compiled
20702070
in case of `--test`.
2071-
- `should_fail` - indicates that this test function should panic, inverting the success condition.
2071+
- `should_panic` - indicates that this test function should panic, inverting the success condition.
20722072
- `cold` - The function is unlikely to be executed, so optimize it (and calls
20732073
to it) differently.
20742074

branches/try/src/doc/trpl/functions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ Because this function will cause a crash, it will never return, and so it has
179179
the type '`!`', which is read "diverges." A diverging function can be used
180180
as any type:
181181

182-
```should_fail
182+
```should_panic
183183
# fn diverges() -> ! {
184184
# panic!("This function never returns!");
185185
# }

branches/try/src/doc/trpl/testing.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,11 @@ $ echo $?
129129

130130
This is useful if you want to integrate `cargo test` into other tooling.
131131

132-
We can invert our test's failure with another attribute: `should_fail`:
132+
We can invert our test's failure with another attribute: `should_panic`:
133133

134134
```rust
135135
#[test]
136-
#[should_fail]
136+
#[should_panic]
137137
fn it_works() {
138138
assert!(false);
139139
}
@@ -163,13 +163,13 @@ equality:
163163

164164
```rust
165165
#[test]
166-
#[should_fail]
166+
#[should_panic]
167167
fn it_works() {
168168
assert_eq!("Hello", "world");
169169
}
170170
```
171171

172-
Does this test pass or fail? Because of the `should_fail` attribute, it
172+
Does this test pass or fail? Because of the `should_panic` attribute, it
173173
passes:
174174

175175
```bash
@@ -189,15 +189,15 @@ running 0 tests
189189
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
190190
```
191191

192-
`should_fail` tests can be fragile, as it's hard to guarantee that the test
192+
`should_panic` tests can be fragile, as it's hard to guarantee that the test
193193
didn't fail for an unexpected reason. To help with this, an optional `expected`
194-
parameter can be added to the `should_fail` attribute. The test harness will
194+
parameter can be added to the `should_panic` attribute. The test harness will
195195
make sure that the failure message contains the provided text. A safer version
196196
of the example above would be:
197197

198198
```
199199
#[test]
200-
#[should_fail(expected = "assertion failed")]
200+
#[should_panic(expected = "assertion failed")]
201201
fn it_works() {
202202
assert_eq!("Hello", "world");
203203
}

branches/try/src/libcollectionstest/vec_deque.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ fn test_mut_rev_iter_wrap() {
360360
assert_eq!(d.pop_front(), Some(1));
361361
d.push_back(4);
362362

363-
assert_eq!(d.iter_mut().rev().map(|x| *x).collect::<Vec<_>>(),
363+
assert_eq!(d.iter_mut().rev().cloned().collect::<Vec<_>>(),
364364
vec![4, 3, 2]);
365365
}
366366

branches/try/src/libcore/iter.rs

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ use default::Default;
6565
use marker;
6666
use mem;
6767
use num::{ToPrimitive, Int};
68-
use ops::{Add, FnMut, RangeFrom};
68+
use ops::{Add, Deref, FnMut, RangeFrom};
6969
use option::Option;
7070
use option::Option::{Some, None};
7171
use marker::Sized;
@@ -976,11 +976,12 @@ pub trait IteratorExt: Iterator + Sized {
976976
(ts, us)
977977
}
978978

979-
/// Creates an iterator that clones the elements it yields. Useful for
980-
/// converting an Iterator<&T> to an Iterator<T>.
981-
#[stable(feature = "rust1", since = "1.0.0")]
982-
fn cloned<'a, T: 'a>(self) -> Cloned<Self>
983-
where Self: Iterator<Item=&'a T>, T: Clone
979+
/// Creates an iterator that clones the elements it yields. Useful for converting an
980+
/// Iterator<&T> to an Iterator<T>.
981+
#[unstable(feature = "core", reason = "recent addition")]
982+
fn cloned(self) -> Cloned<Self> where
983+
Self::Item: Deref,
984+
<Self::Item as Deref>::Target: Clone,
984985
{
985986
Cloned { it: self }
986987
}
@@ -1278,12 +1279,14 @@ pub struct Cloned<I> {
12781279
}
12791280

12801281
#[stable(feature = "rust1", since = "1.0.0")]
1281-
impl<'a, I, T: 'a> Iterator for Cloned<I>
1282-
where I: Iterator<Item=&'a T>, T: Clone
1282+
impl<I> Iterator for Cloned<I> where
1283+
I: Iterator,
1284+
I::Item: Deref,
1285+
<I::Item as Deref>::Target: Clone
12831286
{
1284-
type Item = T;
1287+
type Item = <I::Item as Deref>::Target;
12851288

1286-
fn next(&mut self) -> Option<T> {
1289+
fn next(&mut self) -> Option<<Self as Iterator>::Item> {
12871290
self.it.next().cloned()
12881291
}
12891292

@@ -1293,30 +1296,36 @@ impl<'a, I, T: 'a> Iterator for Cloned<I>
12931296
}
12941297

12951298
#[stable(feature = "rust1", since = "1.0.0")]
1296-
impl<'a, I, T: 'a> DoubleEndedIterator for Cloned<I>
1297-
where I: DoubleEndedIterator<Item=&'a T>, T: Clone
1299+
impl<I> DoubleEndedIterator for Cloned<I> where
1300+
I: DoubleEndedIterator,
1301+
I::Item: Deref,
1302+
<I::Item as Deref>::Target: Clone
12981303
{
1299-
fn next_back(&mut self) -> Option<T> {
1304+
fn next_back(&mut self) -> Option<<Self as Iterator>::Item> {
13001305
self.it.next_back().cloned()
13011306
}
13021307
}
13031308

13041309
#[stable(feature = "rust1", since = "1.0.0")]
1305-
impl<'a, I, T: 'a> ExactSizeIterator for Cloned<I>
1306-
where I: ExactSizeIterator<Item=&'a T>, T: Clone
1310+
impl<I> ExactSizeIterator for Cloned<I> where
1311+
I: ExactSizeIterator,
1312+
I::Item: Deref,
1313+
<I::Item as Deref>::Target: Clone
13071314
{}
13081315

13091316
#[unstable(feature = "core", reason = "trait is experimental")]
1310-
impl<'a, I, T: 'a> RandomAccessIterator for Cloned<I>
1311-
where I: RandomAccessIterator<Item=&'a T>, T: Clone
1317+
impl<I> RandomAccessIterator for Cloned<I> where
1318+
I: RandomAccessIterator,
1319+
I::Item: Deref,
1320+
<I::Item as Deref>::Target: Clone
13121321
{
13131322
#[inline]
13141323
fn indexable(&self) -> usize {
13151324
self.it.indexable()
13161325
}
13171326

13181327
#[inline]
1319-
fn idx(&mut self, index: usize) -> Option<T> {
1328+
fn idx(&mut self, index: usize) -> Option<<Self as Iterator>::Item> {
13201329
self.it.idx(index).cloned()
13211330
}
13221331
}

branches/try/src/libcore/result.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ impl<T, E> Result<T, E> {
330330
/// Convert from `Result<T, E>` to `Option<E>`
331331
///
332332
/// Converts `self` into an `Option<E>`, consuming `self`,
333-
/// and discarding the success value, if any.
333+
/// and discarding the value, if any.
334334
///
335335
/// # Examples
336336
///

0 commit comments

Comments
 (0)