Skip to content

Commit f0e68a6

Browse files
---
yaml --- r: 273742 b: refs/heads/beta c: f10a12c h: refs/heads/master
1 parent 3c7e28f commit f0e68a6

File tree

32 files changed

+255
-648
lines changed

32 files changed

+255
-648
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ refs/tags/0.9: 36870b185fc5f5486636d4515f0e22677493f225
2323
refs/tags/0.10: ac33f2b15782272ae348dbd7b14b8257b2148b5a
2424
refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
26-
refs/heads/beta: 641204a408ecda8494adce213e1d5c65f4220756
26+
refs/heads/beta: f10a12c49f80e8dd277907b9d669dee54b67341a
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
2828
refs/heads/tmp: e06d2ad9fcd5027bcaac5b08fc9aa39a49d0ecd3
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f

branches/beta/src/doc/style/features/traits/generics.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ explicitly implement to be used by this generic function.
2727
* _Inference_. Since the type parameters to generic functions can usually be
2828
inferred, generic functions can help cut down on verbosity in code where
2929
explicit conversions or other method calls would usually be necessary. See the
30-
overloading/implicits use case below.
30+
[overloading/implicits use case](#use-case-limited-overloading-andor-implicit-conversions)
31+
below.
3132
* _Precise types_. Because generics give a _name_ to the specific type
3233
implementing a trait, it is possible to be precise about places where that
3334
exact type is required or produced. For example, a function
@@ -50,7 +51,7 @@ explicitly implement to be used by this generic function.
5051
a `Vec<T>` contains elements of a single concrete type (and, indeed, the
5152
vector representation is specialized to lay these out in line). Sometimes
5253
heterogeneous collections are useful; see
53-
trait objects below.
54+
[trait objects](#use-case-trait-objects) below.
5455
* _Signature verbosity_. Heavy use of generics can bloat function signatures.
5556
**[Ed. note]** This problem may be mitigated by some language improvements; stay tuned.
5657

branches/beta/src/libcollections/binary_heap.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -980,13 +980,13 @@ impl<'a, T> IntoIterator for &'a BinaryHeap<T> where T: Ord {
980980

981981
#[stable(feature = "rust1", since = "1.0.0")]
982982
impl<T: Ord> Extend<T> for BinaryHeap<T> {
983-
fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I) {
984-
let iterator = iter.into_iter();
985-
let (lower, _) = iterator.size_hint();
983+
fn extend<I: IntoIterator<Item = T>>(&mut self, iterable: I) {
984+
let iter = iterable.into_iter();
985+
let (lower, _) = iter.size_hint();
986986

987987
self.reserve(lower);
988988

989-
for elem in iterator {
989+
for elem in iter {
990990
self.push(elem);
991991
}
992992
}

branches/beta/src/libcollections/string.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1388,35 +1388,35 @@ impl Clone for String {
13881388

13891389
#[stable(feature = "rust1", since = "1.0.0")]
13901390
impl FromIterator<char> for String {
1391-
fn from_iter<I: IntoIterator<Item = char>>(iter: I) -> String {
1391+
fn from_iter<I: IntoIterator<Item = char>>(iterable: I) -> String {
13921392
let mut buf = String::new();
1393-
buf.extend(iter);
1393+
buf.extend(iterable);
13941394
buf
13951395
}
13961396
}
13971397

13981398
#[stable(feature = "rust1", since = "1.0.0")]
13991399
impl<'a> FromIterator<&'a str> for String {
1400-
fn from_iter<I: IntoIterator<Item = &'a str>>(iter: I) -> String {
1400+
fn from_iter<I: IntoIterator<Item = &'a str>>(iterable: I) -> String {
14011401
let mut buf = String::new();
1402-
buf.extend(iter);
1402+
buf.extend(iterable);
14031403
buf
14041404
}
14051405
}
14061406

14071407
#[stable(feature = "extend_string", since = "1.4.0")]
14081408
impl FromIterator<String> for String {
1409-
fn from_iter<I: IntoIterator<Item = String>>(iter: I) -> String {
1409+
fn from_iter<I: IntoIterator<Item = String>>(iterable: I) -> String {
14101410
let mut buf = String::new();
1411-
buf.extend(iter);
1411+
buf.extend(iterable);
14121412
buf
14131413
}
14141414
}
14151415

14161416
#[stable(feature = "rust1", since = "1.0.0")]
14171417
impl Extend<char> for String {
1418-
fn extend<I: IntoIterator<Item = char>>(&mut self, iter: I) {
1419-
let iterator = iter.into_iter();
1418+
fn extend<I: IntoIterator<Item = char>>(&mut self, iterable: I) {
1419+
let iterator = iterable.into_iter();
14201420
let (lower_bound, _) = iterator.size_hint();
14211421
self.reserve(lower_bound);
14221422
for ch in iterator {
@@ -1427,24 +1427,24 @@ impl Extend<char> for String {
14271427

14281428
#[stable(feature = "extend_ref", since = "1.2.0")]
14291429
impl<'a> Extend<&'a char> for String {
1430-
fn extend<I: IntoIterator<Item = &'a char>>(&mut self, iter: I) {
1431-
self.extend(iter.into_iter().cloned());
1430+
fn extend<I: IntoIterator<Item = &'a char>>(&mut self, iterable: I) {
1431+
self.extend(iterable.into_iter().cloned());
14321432
}
14331433
}
14341434

14351435
#[stable(feature = "rust1", since = "1.0.0")]
14361436
impl<'a> Extend<&'a str> for String {
1437-
fn extend<I: IntoIterator<Item = &'a str>>(&mut self, iter: I) {
1438-
for s in iter {
1437+
fn extend<I: IntoIterator<Item = &'a str>>(&mut self, iterable: I) {
1438+
for s in iterable {
14391439
self.push_str(s)
14401440
}
14411441
}
14421442
}
14431443

14441444
#[stable(feature = "extend_string", since = "1.4.0")]
14451445
impl Extend<String> for String {
1446-
fn extend<I: IntoIterator<Item = String>>(&mut self, iter: I) {
1447-
for s in iter {
1446+
fn extend<I: IntoIterator<Item = String>>(&mut self, iterable: I) {
1447+
for s in iterable {
14481448
self.push_str(&s)
14491449
}
14501450
}

branches/beta/src/libcollections/vec.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1302,13 +1302,13 @@ impl<T> ops::DerefMut for Vec<T> {
13021302
#[stable(feature = "rust1", since = "1.0.0")]
13031303
impl<T> FromIterator<T> for Vec<T> {
13041304
#[inline]
1305-
fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Vec<T> {
1305+
fn from_iter<I: IntoIterator<Item = T>>(iterable: I) -> Vec<T> {
13061306
// Unroll the first iteration, as the vector is going to be
13071307
// expanded on this iteration in every case when the iterable is not
13081308
// empty, but the loop in extend_desugared() is not going to see the
13091309
// vector being full in the few subsequent loop iterations.
13101310
// So we get better branch prediction.
1311-
let mut iterator = iter.into_iter();
1311+
let mut iterator = iterable.into_iter();
13121312
let mut vector = match iterator.next() {
13131313
None => return Vec::new(),
13141314
Some(element) => {
@@ -1389,8 +1389,8 @@ impl<'a, T> IntoIterator for &'a mut Vec<T> {
13891389
#[stable(feature = "rust1", since = "1.0.0")]
13901390
impl<T> Extend<T> for Vec<T> {
13911391
#[inline]
1392-
fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I) {
1393-
self.extend_desugared(iter.into_iter())
1392+
fn extend<I: IntoIterator<Item = T>>(&mut self, iterable: I) {
1393+
self.extend_desugared(iterable.into_iter())
13941394
}
13951395
}
13961396

branches/beta/src/libcollections/vec_deque.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2057,8 +2057,8 @@ impl<A> IndexMut<usize> for VecDeque<A> {
20572057

20582058
#[stable(feature = "rust1", since = "1.0.0")]
20592059
impl<A> FromIterator<A> for VecDeque<A> {
2060-
fn from_iter<T: IntoIterator<Item = A>>(iter: T) -> VecDeque<A> {
2061-
let iterator = iter.into_iter();
2060+
fn from_iter<T: IntoIterator<Item = A>>(iterable: T) -> VecDeque<A> {
2061+
let iterator = iterable.into_iter();
20622062
let (lower, _) = iterator.size_hint();
20632063
let mut deq = VecDeque::with_capacity(lower);
20642064
deq.extend(iterator);

branches/beta/src/libcore/hash/sip.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use super::Hasher;
1717

1818
/// An implementation of SipHash 2-4.
1919
///
20-
/// See: https://131002.net/siphash/
20+
/// See: http://131002.net/siphash/
2121
///
2222
/// This is currently the default hashing function used by standard library
2323
/// (eg. `collections::HashMap` uses it by default).

branches/beta/src/libcore/iter.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ pub trait Iterator {
434434
/// `None`. Once `None` is encountered, `count()` returns the number of
435435
/// times it called [`next()`].
436436
///
437-
/// [`next()`]: #tymethod.next
437+
/// [`next()`]: #method.next
438438
///
439439
/// # Overflow Behavior
440440
///
@@ -497,7 +497,7 @@ pub trait Iterator {
497497
/// This method will evaluate the iterator `n` times, discarding those elements.
498498
/// After it does so, it will call [`next()`] and return its value.
499499
///
500-
/// [`next()`]: #tymethod.next
500+
/// [`next()`]: #method.next
501501
///
502502
/// Like most indexing operations, the count starts from zero, so `nth(0)`
503503
/// returns the first value, `nth(1)` the second, and so on.
@@ -2458,10 +2458,10 @@ impl<'a, I: Iterator + ?Sized> Iterator for &'a mut I {
24582458
///
24592459
/// // and we'll implement FromIterator
24602460
/// impl FromIterator<i32> for MyCollection {
2461-
/// fn from_iter<I: IntoIterator<Item=i32>>(iter: I) -> Self {
2461+
/// fn from_iter<I: IntoIterator<Item=i32>>(iterator: I) -> Self {
24622462
/// let mut c = MyCollection::new();
24632463
///
2464-
/// for i in iter {
2464+
/// for i in iterator {
24652465
/// c.add(i);
24662466
/// }
24672467
///
@@ -2508,7 +2508,7 @@ pub trait FromIterator<A>: Sized {
25082508
/// assert_eq!(v, vec![5, 5, 5, 5, 5]);
25092509
/// ```
25102510
#[stable(feature = "rust1", since = "1.0.0")]
2511-
fn from_iter<T: IntoIterator<Item=A>>(iter: T) -> Self;
2511+
fn from_iter<T: IntoIterator<Item=A>>(iterator: T) -> Self;
25122512
}
25132513

25142514
/// Conversion into an `Iterator`.
@@ -2683,11 +2683,11 @@ impl<I: Iterator> IntoIterator for I {
26832683
/// // This is a bit simpler with the concrete type signature: we can call
26842684
/// // extend on anything which can be turned into an Iterator which gives
26852685
/// // us i32s. Because we need i32s to put into MyCollection.
2686-
/// fn extend<T: IntoIterator<Item=i32>>(&mut self, iter: T) {
2686+
/// fn extend<T: IntoIterator<Item=i32>>(&mut self, iterable: T) {
26872687
///
26882688
/// // The implementation is very straightforward: loop through the
26892689
/// // iterator, and add() each element to ourselves.
2690-
/// for elem in iter {
2690+
/// for elem in iterable {
26912691
/// self.add(elem);
26922692
/// }
26932693
/// }
@@ -2727,7 +2727,7 @@ pub trait Extend<A> {
27272727
/// assert_eq!("abcdef", &message);
27282728
/// ```
27292729
#[stable(feature = "rust1", since = "1.0.0")]
2730-
fn extend<T: IntoIterator<Item=A>>(&mut self, iter: T);
2730+
fn extend<T: IntoIterator<Item=A>>(&mut self, iterable: T);
27312731
}
27322732

27332733
/// An iterator able to yield elements from both ends.

branches/beta/src/librustc/infer/mod.rs

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -386,33 +386,6 @@ pub fn normalizing_infer_ctxt<'a, 'tcx>(tcx: &'a TyCtxt<'tcx>,
386386
infcx
387387
}
388388

389-
/// Computes the least upper-bound of `a` and `b`. If this is not possible, reports an error and
390-
/// returns ty::err.
391-
pub fn common_supertype<'a, 'tcx>(cx: &InferCtxt<'a, 'tcx>,
392-
origin: TypeOrigin,
393-
a_is_expected: bool,
394-
a: Ty<'tcx>,
395-
b: Ty<'tcx>)
396-
-> Ty<'tcx>
397-
{
398-
debug!("common_supertype({:?}, {:?})",
399-
a, b);
400-
401-
let trace = TypeTrace {
402-
origin: origin,
403-
values: Types(expected_found(a_is_expected, a, b))
404-
};
405-
406-
let result = cx.commit_if_ok(|_| cx.lub(a_is_expected, trace.clone()).relate(&a, &b));
407-
match result {
408-
Ok(t) => t,
409-
Err(ref err) => {
410-
cx.report_and_explain_type_error(trace, err).emit();
411-
cx.tcx.types.err
412-
}
413-
}
414-
}
415-
416389
pub fn mk_subty<'a, 'tcx>(cx: &InferCtxt<'a, 'tcx>,
417390
a_is_expected: bool,
418391
origin: TypeOrigin,

branches/beta/src/librustc_unicode/char.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,7 @@ pub struct DecodeUtf16<I>
748748
buf: Option<u16>,
749749
}
750750

751-
/// Create an iterator over the UTF-16 encoded code points in `iter`,
751+
/// Create an iterator over the UTF-16 encoded code points in `iterable`,
752752
/// returning unpaired surrogates as `Err`s.
753753
///
754754
/// # Examples
@@ -796,9 +796,9 @@ pub struct DecodeUtf16<I>
796796
/// ```
797797
#[unstable(feature = "decode_utf16", reason = "recently exposed", issue = "27830")]
798798
#[inline]
799-
pub fn decode_utf16<I: IntoIterator<Item = u16>>(iter: I) -> DecodeUtf16<I::IntoIter> {
799+
pub fn decode_utf16<I: IntoIterator<Item = u16>>(iterable: I) -> DecodeUtf16<I::IntoIter> {
800800
DecodeUtf16 {
801-
iter: iter.into_iter(),
801+
iter: iterable.into_iter(),
802802
buf: None,
803803
}
804804
}

0 commit comments

Comments
 (0)