Skip to content

Commit 7ea6bad

Browse files
committed
---
yaml --- r: 191449 b: refs/heads/try c: 3437865 h: refs/heads/master i: 191447: 4452e73 v: v3
1 parent 5f529a9 commit 7ea6bad

File tree

20 files changed

+415
-71
lines changed

20 files changed

+415
-71
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: 8a8b2cecbc1fab7ffa4a20efb6dc4deed876571e
5+
refs/heads/try: 34378657ef7dfd368c2ccdd82769b0714f63bfe3
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().cloned().collect::<Vec<_>>(),
363+
assert_eq!(d.iter_mut().rev().map(|x| *x).collect::<Vec<_>>(),
364364
vec![4, 3, 2]);
365365
}
366366

branches/try/src/libcore/iter.rs

Lines changed: 18 additions & 27 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, Deref, FnMut, RangeFrom};
68+
use ops::{Add, FnMut, RangeFrom};
6969
use option::Option;
7070
use option::Option::{Some, None};
7171
use marker::Sized;
@@ -976,12 +976,11 @@ pub trait IteratorExt: Iterator + Sized {
976976
(ts, us)
977977
}
978978

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,
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
985984
{
986985
Cloned { it: self }
987986
}
@@ -1279,14 +1278,12 @@ pub struct Cloned<I> {
12791278
}
12801279

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

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

@@ -1296,36 +1293,30 @@ impl<I> Iterator for Cloned<I> where
12961293
}
12971294

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

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

13161309
#[unstable(feature = "core", reason = "trait is experimental")]
1317-
impl<I> RandomAccessIterator for Cloned<I> where
1318-
I: RandomAccessIterator,
1319-
I::Item: Deref,
1320-
<I::Item as Deref>::Target: Clone
1310+
impl<'a, I, T: 'a> RandomAccessIterator for Cloned<I>
1311+
where I: RandomAccessIterator<Item=&'a T>, T: Clone
13211312
{
13221313
#[inline]
13231314
fn indexable(&self) -> usize {
13241315
self.it.indexable()
13251316
}
13261317

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

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 value, if any.
333+
/// and discarding the success value, if any.
334334
///
335335
/// # Examples
336336
///

0 commit comments

Comments
 (0)