Skip to content

Commit d9ec142

Browse files
committed
Auto merge of #25275 - steveklabnik:rollup, r=steveklabnik
- Successful merges: #24948, #25085, #25158, #25188, #25239, #25240, #25241, #25255, #25257, #25263, #25271 - Failed merges:
2 parents 750f2c6 + 253612d commit d9ec142

File tree

34 files changed

+169
-120
lines changed

34 files changed

+169
-120
lines changed

src/doc/trpl/guessing-game.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,7 @@ variety of numbers, we need to give Rust a hint as to the exact type of number
713713
we want. Hence, `let guess: u32`. The colon (`:`) after `guess` tells Rust
714714
we’re going to annotate its type. `u32` is an unsigned, thirty-two bit
715715
integer. Rust has [a number of built-in number types][number], but we’ve
716-
chosen `u32`. It’s a good default choice for a small positive numer.
716+
chosen `u32`. It’s a good default choice for a small positive number.
717717
718718
[parse]: ../std/primitive.str.html#method.parse
719719
[number]: primitive-types.html#numeric-types
@@ -922,7 +922,7 @@ failure. Each contains more information: the successful parsed integer, or an
922922
error type. In this case, we `match` on `Ok(num)`, which sets the inner value
923923
of the `Ok` to the name `num`, and then we just return it on the right-hand
924924
side. In the `Err` case, we don’t care what kind of error it is, so we just
925-
use `_` intead of a name. This ignores the error, and `continue` causes us
925+
use `_` instead of a name. This ignores the error, and `continue` causes us
926926
to go to the next iteration of the `loop`.
927927
928928
Now we should be good! Let’s try:

src/doc/trpl/match.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ side of a `let` binding or directly where an expression is used:
5050
```rust
5151
let x = 5;
5252

53-
let numer = match x {
53+
let number = match x {
5454
1 => "one",
5555
2 => "two",
5656
3 => "three",

src/doc/trpl/mutability.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ When we call `clone()`, the `Arc<T>` needs to update the reference count. Yet
7878
we’ve not used any `mut`s here, `x` is an immutable binding, and we didn’t take
7979
`&mut 5` or anything. So what gives?
8080

81-
To this, we have to go back to the core of Rust’s guiding philosophy, memory
82-
safety, and the mechanism by which Rust guarantees it, the
81+
To understand this, we have to go back to the core of Rust’s guiding
82+
philosophy, memory safety, and the mechanism by which Rust guarantees it, the
8383
[ownership][ownership] system, and more specifically, [borrowing][borrowing]:
8484

8585
> You may have one or the other of these two kinds of borrows, but not both at

src/doc/trpl/ownership.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ fn foo(v: Vec<i32>) -> Vec<i32> {
174174
}
175175
```
176176

177-
This would get very tedius. It gets worse the more things we want to take ownership of:
177+
This would get very tedious. It gets worse the more things we want to take ownership of:
178178

179179
```rust
180180
fn foo(v1: Vec<i32>, v2: Vec<i32>) -> (Vec<i32>, Vec<i32>, i32) {

src/doc/trpl/primitive-types.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ Slices have type `&[T]`. We’ll talk about that `T` when we cover
176176

177177
[generics]: generics.html
178178

179-
You can find more documentation for `slices`s [in the standard library
179+
You can find more documentation for slices [in the standard library
180180
documentation][slice].
181181

182182
[slice]: ../std/primitive.slice.html

src/doc/trpl/references-and-borrowing.md

+1
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,7 @@ println!("{}", y);
312312

313313
We get this error:
314314

315+
```text
315316
error: `x` does not live long enough
316317
y = &x;
317318
^

src/etc/CONFIGS.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
# Configs
22

3-
Here are some links to repos with configs which ease the use of rust:
3+
These are some links to repos with configs which ease the use of rust.
4+
5+
## Officially Maintained Configs
46

57
* [rust.vim](https://github.com/rust-lang/rust.vim)
68
* [emacs rust-mode](https://github.com/rust-lang/rust-mode)
79
* [gedit-config](https://github.com/rust-lang/gedit-config)
810
* [kate-config](https://github.com/rust-lang/kate-config)
911
* [nano-config](https://github.com/rust-lang/nano-config)
1012
* [zsh-config](https://github.com/rust-lang/zsh-config)
13+
14+
## Community-maintained Configs
15+
16+
* [.editorconfig](https://gist.github.com/derhuerst/c9d1b9309e308d9851fa) ([what is this?](http://editorconfig.org/))

src/libcollections/string.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1052,6 +1052,7 @@ impl<T: fmt::Display + ?Sized> ToString for T {
10521052

10531053
#[stable(feature = "rust1", since = "1.0.0")]
10541054
impl AsRef<str> for String {
1055+
#[inline]
10551056
fn as_ref(&self) -> &str {
10561057
self
10571058
}

src/libcore/convert.rs

+1
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ impl<T> AsMut<[T]> for [T] {
173173

174174
#[stable(feature = "rust1", since = "1.0.0")]
175175
impl AsRef<str> for str {
176+
#[inline]
176177
fn as_ref(&self) -> &str {
177178
self
178179
}

src/libcore/iter.rs

+42-42
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ pub trait Iterator {
137137
///
138138
/// ```
139139
/// let a = [1, 2, 3, 4, 5];
140-
/// assert_eq!(a.iter().last().unwrap(), &5);
140+
/// assert_eq!(a.iter().last(), Some(&5));
141141
/// ```
142142
#[inline]
143143
#[stable(feature = "rust1", since = "1.0.0")]
@@ -155,7 +155,7 @@ pub trait Iterator {
155155
/// ```
156156
/// let a = [1, 2, 3, 4, 5];
157157
/// let mut it = a.iter();
158-
/// assert_eq!(it.nth(2).unwrap(), &3);
158+
/// assert_eq!(it.nth(2), Some(&3));
159159
/// assert_eq!(it.nth(2), None);
160160
/// ```
161161
#[inline]
@@ -178,8 +178,8 @@ pub trait Iterator {
178178
/// let a = [0];
179179
/// let b = [1];
180180
/// let mut it = a.iter().chain(b.iter());
181-
/// assert_eq!(it.next().unwrap(), &0);
182-
/// assert_eq!(it.next().unwrap(), &1);
181+
/// assert_eq!(it.next(), Some(&0));
182+
/// assert_eq!(it.next(), Some(&1));
183183
/// assert!(it.next().is_none());
184184
/// ```
185185
#[inline]
@@ -201,7 +201,7 @@ pub trait Iterator {
201201
/// let a = [0];
202202
/// let b = [1];
203203
/// let mut it = a.iter().zip(b.iter());
204-
/// assert_eq!(it.next().unwrap(), (&0, &1));
204+
/// assert_eq!(it.next(), Some((&0, &1)));
205205
/// assert!(it.next().is_none());
206206
/// ```
207207
///
@@ -234,8 +234,8 @@ pub trait Iterator {
234234
/// ```
235235
/// let a = [1, 2];
236236
/// let mut it = a.iter().map(|&x| 2 * x);
237-
/// assert_eq!(it.next().unwrap(), 2);
238-
/// assert_eq!(it.next().unwrap(), 4);
237+
/// assert_eq!(it.next(), Some(2));
238+
/// assert_eq!(it.next(), Some(4));
239239
/// assert!(it.next().is_none());
240240
/// ```
241241
#[inline]
@@ -255,7 +255,7 @@ pub trait Iterator {
255255
/// ```
256256
/// let a = [1, 2];
257257
/// let mut it = a.iter().filter(|&x| *x > 1);
258-
/// assert_eq!(it.next().unwrap(), &2);
258+
/// assert_eq!(it.next(), Some(&2));
259259
/// assert!(it.next().is_none());
260260
/// ```
261261
#[inline]
@@ -275,7 +275,7 @@ pub trait Iterator {
275275
/// ```
276276
/// let a = [1, 2];
277277
/// let mut it = a.iter().filter_map(|&x| if x > 1 {Some(2 * x)} else {None});
278-
/// assert_eq!(it.next().unwrap(), 4);
278+
/// assert_eq!(it.next(), Some(4));
279279
/// assert!(it.next().is_none());
280280
/// ```
281281
#[inline]
@@ -310,8 +310,8 @@ pub trait Iterator {
310310
/// ```
311311
/// let a = [100, 200];
312312
/// let mut it = a.iter().enumerate();
313-
/// assert_eq!(it.next().unwrap(), (0, &100));
314-
/// assert_eq!(it.next().unwrap(), (1, &200));
313+
/// assert_eq!(it.next(), Some((0, &100)));
314+
/// assert_eq!(it.next(), Some((1, &200)));
315315
/// assert!(it.next().is_none());
316316
/// ```
317317
#[inline]
@@ -329,12 +329,12 @@ pub trait Iterator {
329329
/// # #![feature(core)]
330330
/// let xs = [100, 200, 300];
331331
/// let mut it = xs.iter().cloned().peekable();
332-
/// assert_eq!(*it.peek().unwrap(), 100);
333-
/// assert_eq!(it.next().unwrap(), 100);
334-
/// assert_eq!(it.next().unwrap(), 200);
335-
/// assert_eq!(*it.peek().unwrap(), 300);
336-
/// assert_eq!(*it.peek().unwrap(), 300);
337-
/// assert_eq!(it.next().unwrap(), 300);
332+
/// assert_eq!(*it.peek(), Some(100));
333+
/// assert_eq!(it.next(), Some(100));
334+
/// assert_eq!(it.next(), Some(200));
335+
/// assert_eq!(*it.peek(), Some(300));
336+
/// assert_eq!(*it.peek(), Some(300));
337+
/// assert_eq!(it.next(), Some(300));
338338
/// assert!(it.peek().is_none());
339339
/// assert!(it.next().is_none());
340340
/// ```
@@ -353,9 +353,9 @@ pub trait Iterator {
353353
/// ```
354354
/// let a = [1, 2, 3, 4, 5];
355355
/// let mut it = a.iter().skip_while(|&a| *a < 3);
356-
/// assert_eq!(it.next().unwrap(), &3);
357-
/// assert_eq!(it.next().unwrap(), &4);
358-
/// assert_eq!(it.next().unwrap(), &5);
356+
/// assert_eq!(it.next(), Some(&3));
357+
/// assert_eq!(it.next(), Some(&4));
358+
/// assert_eq!(it.next(), Some(&5));
359359
/// assert!(it.next().is_none());
360360
/// ```
361361
#[inline]
@@ -375,8 +375,8 @@ pub trait Iterator {
375375
/// ```
376376
/// let a = [1, 2, 3, 4, 5];
377377
/// let mut it = a.iter().take_while(|&a| *a < 3);
378-
/// assert_eq!(it.next().unwrap(), &1);
379-
/// assert_eq!(it.next().unwrap(), &2);
378+
/// assert_eq!(it.next(), Some(&1));
379+
/// assert_eq!(it.next(), Some(&2));
380380
/// assert!(it.next().is_none());
381381
/// ```
382382
#[inline]
@@ -395,8 +395,8 @@ pub trait Iterator {
395395
/// ```
396396
/// let a = [1, 2, 3, 4, 5];
397397
/// let mut it = a.iter().skip(3);
398-
/// assert_eq!(it.next().unwrap(), &4);
399-
/// assert_eq!(it.next().unwrap(), &5);
398+
/// assert_eq!(it.next(), Some(&4));
399+
/// assert_eq!(it.next(), Some(&5));
400400
/// assert!(it.next().is_none());
401401
/// ```
402402
#[inline]
@@ -413,9 +413,9 @@ pub trait Iterator {
413413
/// ```
414414
/// let a = [1, 2, 3, 4, 5];
415415
/// let mut it = a.iter().take(3);
416-
/// assert_eq!(it.next().unwrap(), &1);
417-
/// assert_eq!(it.next().unwrap(), &2);
418-
/// assert_eq!(it.next().unwrap(), &3);
416+
/// assert_eq!(it.next(), Some(&1));
417+
/// assert_eq!(it.next(), Some(&2));
418+
/// assert_eq!(it.next(), Some(&3));
419419
/// assert!(it.next().is_none());
420420
/// ```
421421
#[inline]
@@ -437,11 +437,11 @@ pub trait Iterator {
437437
/// *fac = *fac * x;
438438
/// Some(*fac)
439439
/// });
440-
/// assert_eq!(it.next().unwrap(), 1);
441-
/// assert_eq!(it.next().unwrap(), 2);
442-
/// assert_eq!(it.next().unwrap(), 6);
443-
/// assert_eq!(it.next().unwrap(), 24);
444-
/// assert_eq!(it.next().unwrap(), 120);
440+
/// assert_eq!(it.next(), Some(1));
441+
/// assert_eq!(it.next(), Some(2));
442+
/// assert_eq!(it.next(), Some(6));
443+
/// assert_eq!(it.next(), Some(24));
444+
/// assert_eq!(it.next(), Some(120));
445445
/// assert!(it.next().is_none());
446446
/// ```
447447
#[inline]
@@ -680,7 +680,7 @@ pub trait Iterator {
680680
/// ```
681681
/// let a = [1, 2, 3, 4, 5];
682682
/// let mut it = a.iter();
683-
/// assert_eq!(it.find(|&x| *x == 3).unwrap(), &3);
683+
/// assert_eq!(it.find(|&x| *x == 3), Some(&3));
684684
/// assert_eq!(it.collect::<Vec<_>>(), [&4, &5]);
685685
#[inline]
686686
#[stable(feature = "rust1", since = "1.0.0")]
@@ -715,7 +715,7 @@ pub trait Iterator {
715715
/// ```
716716
/// let a = [1, 2, 3, 4, 5];
717717
/// let mut it = a.iter();
718-
/// assert_eq!(it.position(|x| *x == 3).unwrap(), 2);
718+
/// assert_eq!(it.position(|x| *x == 3), Some(2));
719719
/// assert_eq!(it.collect::<Vec<_>>(), [&4, &5]);
720720
#[inline]
721721
#[stable(feature = "rust1", since = "1.0.0")]
@@ -743,7 +743,7 @@ pub trait Iterator {
743743
/// ```
744744
/// let a = [1, 2, 2, 4, 5];
745745
/// let mut it = a.iter();
746-
/// assert_eq!(it.rposition(|x| *x == 2).unwrap(), 2);
746+
/// assert_eq!(it.rposition(|x| *x == 2), Some(2));
747747
/// assert_eq!(it.collect::<Vec<_>>(), [&1, &2]);
748748
#[inline]
749749
#[stable(feature = "rust1", since = "1.0.0")]
@@ -773,7 +773,7 @@ pub trait Iterator {
773773
///
774774
/// ```
775775
/// let a = [1, 2, 3, 4, 5];
776-
/// assert_eq!(a.iter().max().unwrap(), &5);
776+
/// assert_eq!(a.iter().max(), Some(&5));
777777
/// ```
778778
#[inline]
779779
#[stable(feature = "rust1", since = "1.0.0")]
@@ -796,7 +796,7 @@ pub trait Iterator {
796796
///
797797
/// ```
798798
/// let a = [1, 2, 3, 4, 5];
799-
/// assert_eq!(a.iter().min().unwrap(), &1);
799+
/// assert_eq!(a.iter().min(), Some(&1));
800800
/// ```
801801
#[inline]
802802
#[stable(feature = "rust1", since = "1.0.0")]
@@ -900,7 +900,7 @@ pub trait Iterator {
900900
/// # #![feature(core)]
901901
///
902902
/// let a = [-3_i32, 0, 1, 5, -10];
903-
/// assert_eq!(*a.iter().max_by(|x| x.abs()).unwrap(), -10);
903+
/// assert_eq!(*a.iter().max_by(|x| x.abs()), Some(-10));
904904
/// ```
905905
#[inline]
906906
#[unstable(feature = "core",
@@ -929,7 +929,7 @@ pub trait Iterator {
929929
/// # #![feature(core)]
930930
///
931931
/// let a = [-3_i32, 0, 1, 5, -10];
932-
/// assert_eq!(*a.iter().min_by(|x| x.abs()).unwrap(), 0);
932+
/// assert_eq!(*a.iter().min_by(|x| x.abs()), Some(0));
933933
/// ```
934934
#[inline]
935935
#[unstable(feature = "core",
@@ -1025,9 +1025,9 @@ pub trait Iterator {
10251025
/// ```
10261026
/// let a = [1, 2];
10271027
/// let mut it = a.iter().cycle();
1028-
/// assert_eq!(it.next().unwrap(), &1);
1029-
/// assert_eq!(it.next().unwrap(), &2);
1030-
/// assert_eq!(it.next().unwrap(), &1);
1028+
/// assert_eq!(it.next(), Some(&1));
1029+
/// assert_eq!(it.next(), Some(&2));
1030+
/// assert_eq!(it.next(), Some(&1));
10311031
/// ```
10321032
#[stable(feature = "rust1", since = "1.0.0")]
10331033
#[inline]

src/librustc/middle/expr_use_visitor.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1125,7 +1125,7 @@ impl<'d,'t,'tcx,TYPER:mc::Typer<'tcx>> ExprUseVisitor<'d,'t,'tcx,TYPER> {
11251125
// that case we can adjust the length of the
11261126
// original vec accordingly, but we'd have to
11271127
// make trans do the right thing, and it would
1128-
// only work for `~` vectors. It seems simpler
1128+
// only work for `Box<[T]>`s. It seems simpler
11291129
// to just require that people call
11301130
// `vec.pop()` or `vec.unshift()`.
11311131
let slice_bk = ty::BorrowKind::from_mutbl(slice_mutbl);

src/librustc/middle/traits/coherence.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ fn ty_is_local_constructor<'tcx>(tcx: &ty::ctxt<'tcx>,
323323
def_id.krate == ast::LOCAL_CRATE
324324
}
325325

326-
ty::ty_uniq(_) => { // treat ~T like Box<T>
326+
ty::ty_uniq(_) => { // Box<T>
327327
let krate = tcx.lang_items.owned_box().map(|d| d.krate);
328328
krate == Some(ast::LOCAL_CRATE)
329329
}

src/librustc/middle/traits/select.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -2441,10 +2441,10 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
24412441
/// `match_impl()`. For example, if `impl_def_id` is declared
24422442
/// as:
24432443
///
2444-
/// impl<T:Copy> Foo for ~T { ... }
2444+
/// impl<T:Copy> Foo for Box<T> { ... }
24452445
///
2446-
/// and `obligation_self_ty` is `int`, we'd back an `Err(_)`
2447-
/// result. But if `obligation_self_ty` were `~int`, we'd get
2446+
/// and `obligation_self_ty` is `int`, we'd get back an `Err(_)`
2447+
/// result. But if `obligation_self_ty` were `Box<int>`, we'd get
24482448
/// back `Ok(T=int)`.
24492449
fn match_inherent_impl(&mut self,
24502450
impl_def_id: ast::DefId,

src/librustc/util/ppaux.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,7 @@ impl<'tcx, T:Repr<'tcx>> Repr<'tcx> for OwnedSlice<T> {
637637
}
638638
}
639639

640-
// This is necessary to handle types like Option<~[T]>, for which
640+
// This is necessary to handle types like Option<Vec<T>>, for which
641641
// autoderef cannot convert the &[T] handler
642642
impl<'tcx, T:Repr<'tcx>> Repr<'tcx> for Vec<T> {
643643
fn repr(&self, tcx: &ctxt<'tcx>) -> String {

src/librustc_borrowck/borrowck/check_loans.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,7 @@ impl<'a, 'tcx> CheckLoanCtxt<'a, 'tcx> {
732732
/// let p: Point;
733733
/// p.x = 22; // ok, even though `p` is uninitialized
734734
///
735-
/// let p: ~Point;
735+
/// let p: Box<Point>;
736736
/// (*p).x = 22; // not ok, p is uninitialized, can't deref
737737
/// ```
738738
fn check_if_assigned_path_is_moved(&self,

src/librustc_privacy/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1314,7 +1314,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for VisiblePrivateTypesVisitor<'a, 'tcx> {
13141314
// `impl [... for] Private` is never visible.
13151315
let self_contains_private;
13161316
// impl [... for] Public<...>, but not `impl [... for]
1317-
// ~[Public]` or `(Public,)` etc.
1317+
// Vec<Public>` or `(Public,)` etc.
13181318
let self_is_public_path;
13191319

13201320
// check the properties of the Self type:

0 commit comments

Comments
 (0)