Skip to content

Commit 7a7307e

Browse files
committed
Auto merge of #31006 - Manishearth:rollup, r=Manishearth
- Successful merges: #30981, #30982, #30986, #30987, #30988, #30990, #30998 - Failed merges:
2 parents acc699f + 652fa5c commit 7a7307e

File tree

9 files changed

+38
-36
lines changed

9 files changed

+38
-36
lines changed

configure

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1035,7 +1035,7 @@ then
10351035
if [ -n "$CFG_OSX_CLANG_VERSION" ]
10361036
then
10371037
case $CFG_OSX_CLANG_VERSION in
1038-
(7.0*)
1038+
(7.0* | 7.1* | 7.2*)
10391039
step_msg "found ok version of APPLE CLANG: $CFG_OSX_CLANG_VERSION"
10401040
;;
10411041
(*)

src/doc/book/lifetimes.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,8 +353,8 @@ fn frob<'a, 'b>(s: &'a str, t: &'b str) -> &str; // Expanded: Output lifetime is
353353
fn get_mut(&mut self) -> &mut T; // elided
354354
fn get_mut<'a>(&'a mut self) -> &'a mut T; // expanded
355355
356-
fn args<T:ToCStr>(&mut self, args: &[T]) -> &mut Command; // elided
357-
fn args<'a, 'b, T:ToCStr>(&'a mut self, args: &'b [T]) -> &'a mut Command; // expanded
356+
fn args<T: ToCStr>(&mut self, args: &[T]) -> &mut Command; // elided
357+
fn args<'a, 'b, T: ToCStr>(&'a mut self, args: &'b [T]) -> &'a mut Command; // expanded
358358
359359
fn new(buf: &mut [u8]) -> BufWriter; // elided
360360
fn new<'a>(buf: &'a mut [u8]) -> BufWriter<'a>; // expanded

src/doc/book/macros.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -285,9 +285,11 @@ This expands to
285285

286286
```text
287287
const char *state = "reticulating splines";
288-
int state = get_log_state();
289-
if (state > 0) {
290-
printf("log(%d): %s\n", state, state);
288+
{
289+
int state = get_log_state();
290+
if (state > 0) {
291+
printf("log(%d): %s\n", state, state);
292+
}
291293
}
292294
```
293295

src/doc/nomicon/lifetime-elision.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ fn frob(s: &str, t: &str) -> &str; // ILLEGAL
5555
fn get_mut(&mut self) -> &mut T; // elided
5656
fn get_mut<'a>(&'a mut self) -> &'a mut T; // expanded
5757
58-
fn args<T:ToCStr>(&mut self, args: &[T]) -> &mut Command // elided
59-
fn args<'a, 'b, T:ToCStr>(&'a mut self, args: &'b [T]) -> &'a mut Command // expanded
58+
fn args<T: ToCStr>(&mut self, args: &[T]) -> &mut Command // elided
59+
fn args<'a, 'b, T: ToCStr>(&'a mut self, args: &'b [T]) -> &'a mut Command // expanded
6060
6161
fn new(buf: &mut [u8]) -> BufWriter; // elided
6262
fn new<'a>(buf: &'a mut [u8]) -> BufWriter<'a> // expanded

src/libcollections/btree/set.rs

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
use core::cmp::Ordering::{self, Less, Greater, Equal};
1515
use core::fmt::Debug;
1616
use core::fmt;
17-
use core::iter::{Peekable, Map, FromIterator};
17+
use core::iter::{Peekable, FromIterator};
1818
use core::ops::{BitOr, BitAnd, BitXor, Sub};
1919

2020
use borrow::Borrow;
@@ -52,12 +52,12 @@ pub struct Iter<'a, T: 'a> {
5252
/// An owning iterator over a BTreeSet's items.
5353
#[stable(feature = "rust1", since = "1.0.0")]
5454
pub struct IntoIter<T> {
55-
iter: Map<::btree_map::IntoIter<T, ()>, fn((T, ())) -> T>,
55+
iter: ::btree_map::IntoIter<T, ()>,
5656
}
5757

5858
/// An iterator over a sub-range of BTreeSet's items.
5959
pub struct Range<'a, T: 'a> {
60-
iter: Map<::btree_map::Range<'a, T, ()>, fn((&'a T, &'a ())) -> &'a T>,
60+
iter: ::btree_map::Range<'a, T, ()>,
6161
}
6262

6363
/// A lazy iterator producing elements in the set difference (in-order).
@@ -160,12 +160,7 @@ impl<T: Ord> BTreeSet<T> {
160160
-> Range<'a, T>
161161
where T: Borrow<Min> + Borrow<Max>
162162
{
163-
fn first<A, B>((a, _): (A, B)) -> A {
164-
a
165-
}
166-
let first: fn((&'a T, &'a ())) -> &'a T = first; // coerce to fn pointer
167-
168-
Range { iter: self.map.range(min, max).map(first) }
163+
Range { iter: self.map.range(min, max) }
169164
}
170165
}
171166

@@ -548,12 +543,7 @@ impl<T> IntoIterator for BTreeSet<T> {
548543
/// assert_eq!(v, [1, 2, 3, 4]);
549544
/// ```
550545
fn into_iter(self) -> IntoIter<T> {
551-
fn first<A, B>((a, _): (A, B)) -> A {
552-
a
553-
}
554-
let first: fn((T, ())) -> T = first; // coerce to fn pointer
555-
556-
IntoIter { iter: self.map.into_iter().map(first) }
546+
IntoIter { iter: self.map.into_iter() }
557547
}
558548
}
559549

@@ -721,7 +711,7 @@ impl<T> Iterator for IntoIter<T> {
721711
type Item = T;
722712

723713
fn next(&mut self) -> Option<T> {
724-
self.iter.next()
714+
self.iter.next().map(|(k, _)| k)
725715
}
726716
fn size_hint(&self) -> (usize, Option<usize>) {
727717
self.iter.size_hint()
@@ -730,7 +720,7 @@ impl<T> Iterator for IntoIter<T> {
730720
#[stable(feature = "rust1", since = "1.0.0")]
731721
impl<T> DoubleEndedIterator for IntoIter<T> {
732722
fn next_back(&mut self) -> Option<T> {
733-
self.iter.next_back()
723+
self.iter.next_back().map(|(k, _)| k)
734724
}
735725
}
736726
#[stable(feature = "rust1", since = "1.0.0")]
@@ -746,12 +736,12 @@ impl<'a, T> Iterator for Range<'a, T> {
746736
type Item = &'a T;
747737

748738
fn next(&mut self) -> Option<&'a T> {
749-
self.iter.next()
739+
self.iter.next().map(|(k, _)| k)
750740
}
751741
}
752742
impl<'a, T> DoubleEndedIterator for Range<'a, T> {
753743
fn next_back(&mut self) -> Option<&'a T> {
754-
self.iter.next_back()
744+
self.iter.next_back().map(|(k, _)| k)
755745
}
756746
}
757747

src/libcollections/fmt.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,8 +348,8 @@
348348
//! The fill character is provided normally in conjunction with the `width`
349349
//! parameter. This indicates that if the value being formatted is smaller than
350350
//! `width` some extra characters will be printed around it. The extra
351-
//! characters are specified by `fill`, and the alignment can be one of two
352-
//! options:
351+
//! characters are specified by `fill`, and the alignment can be one of the
352+
//! following options:
353353
//!
354354
//! * `<` - the argument is left-aligned in `width` columns
355355
//! * `^` - the argument is center-aligned in `width` columns

src/libcollections/str.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ impl str {
302302
/// # Safety
303303
///
304304
/// Callers of this function are responsible that three preconditions are
305-
/// satisifed:
305+
/// satisfied:
306306
///
307307
/// * `begin` must come before `end`.
308308
/// * `begin` and `end` must be byte positions within the string slice.
@@ -345,7 +345,7 @@ impl str {
345345
/// # Safety
346346
///
347347
/// Callers of this function are responsible that three preconditions are
348-
/// satisifed:
348+
/// satisfied:
349349
///
350350
/// * `begin` must come before `end`.
351351
/// * `begin` and `end` must be byte positions within the string slice.

src/libcollectionstest/btree/set.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,3 +254,13 @@ fn test_recovery() {
254254

255255
assert_eq!(s.iter().next(), None);
256256
}
257+
258+
#[test]
259+
fn test_variance() {
260+
use std::collections::btree_set::{IntoIter, Iter, Range};
261+
262+
fn set<'new>(v: BTreeSet<&'static str>) -> BTreeSet<&'new str> { v }
263+
fn iter<'a, 'new>(v: Iter<'a, &'static str>) -> Iter<'a, &'new str> { v }
264+
fn into_iter<'new>(v: IntoIter<&'static str>) -> IntoIter<&'new str> { v }
265+
fn range<'a, 'new>(v: Range<'a, &'static str>) -> Range<'a, &'new str> { v }
266+
}

src/libcore/marker.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ macro_rules! impls{
333333
/// use std::marker::PhantomData;
334334
///
335335
/// # #[allow(dead_code)]
336-
/// struct Slice<'a, T:'a> {
336+
/// struct Slice<'a, T: 'a> {
337337
/// start: *const T,
338338
/// end: *const T,
339339
/// phantom: PhantomData<&'a T>
@@ -428,18 +428,18 @@ mod impls {
428428
/// use std::any::Any;
429429
///
430430
/// # #[allow(dead_code)]
431-
/// fn foo<T:Reflect+'static>(x: &T) {
431+
/// fn foo<T: Reflect + 'static>(x: &T) {
432432
/// let any: &Any = x;
433433
/// if any.is::<u32>() { println!("u32"); }
434434
/// }
435435
/// ```
436436
///
437-
/// Without the declaration `T:Reflect`, `foo` would not type check
437+
/// Without the declaration `T: Reflect`, `foo` would not type check
438438
/// (note: as a matter of style, it would be preferable to write
439-
/// `T:Any`, because `T:Any` implies `T:Reflect` and `T:'static`, but
439+
/// `T: Any`, because `T: Any` implies `T: Reflect` and `T: 'static`, but
440440
/// we use `Reflect` here to show how it works). The `Reflect` bound
441441
/// thus serves to alert `foo`'s caller to the fact that `foo` may
442-
/// behave differently depending on whether `T=u32` or not. In
442+
/// behave differently depending on whether `T = u32` or not. In
443443
/// particular, thanks to the `Reflect` bound, callers know that a
444444
/// function declared like `fn bar<T>(...)` will always act in
445445
/// precisely the same way no matter what type `T` is supplied,

0 commit comments

Comments
 (0)