Skip to content

Commit 4a023ac

Browse files
committed
---
yaml --- r: 158927 b: refs/heads/master c: a2f303a h: refs/heads/master i: 158925: 8e2bbc8 158923: cd53ac6 158919: b4253ab 158911: 9348170 v: v3
1 parent 0ee1170 commit 4a023ac

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+832
-445
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: cf4e53eee7377b42524176f39b0b428175c74fb1
2+
refs/heads/master: a2f303ad098844351d08800038a4f99fa2ff0817
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: f89e975685a3a9f258c996865cdd144a0f30f83c
55
refs/heads/try: f58aad6dce273570fb130b4df008ef9acd5a5be2

trunk/mk/docs.mk

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@
2828
DOCS := index intro tutorial guide guide-ffi guide-macros guide-lifetimes \
2929
guide-tasks guide-container guide-pointers guide-testing \
3030
guide-plugin guide-crates complement-bugreport \
31-
complement-lang-faq complement-design-faq complement-project-faq rust \
31+
complement-lang-faq complement-design-faq complement-project-faq \
3232
rustdoc guide-unsafe guide-strings reference
3333

3434
PDF_DOCS := guide reference
3535

36-
RUSTDOC_DEPS_rust := doc/full-toc.inc
37-
RUSTDOC_FLAGS_rust := --html-in-header=doc/full-toc.inc
36+
RUSTDOC_DEPS_reference := doc/full-toc.inc
37+
RUSTDOC_FLAGS_reference := --html-in-header=doc/full-toc.inc
3838

3939
L10N_LANGS := ja
4040

trunk/src/etc/vim/syntax/rust.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ syn keyword rustEnum Ordering
9393
syn keyword rustEnumVariant Less Equal Greater
9494
syn keyword rustTrait Collection Mutable Map MutableMap MutableSeq
9595
syn keyword rustTrait Set MutableSet
96-
syn keyword rustTrait FromIterator Extendable ExactSize
96+
syn keyword rustTrait FromIterator IntoIterator Extend ExactSize
9797
syn keyword rustTrait Iterator DoubleEndedIterator
9898
syn keyword rustTrait RandomAccessIterator CloneableIterator
9999
syn keyword rustTrait OrdIterator MutableDoubleEndedIterator

trunk/src/libcollections/binary_heap.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ impl<T: Ord> FromIterator<T> for BinaryHeap<T> {
555555
}
556556
}
557557

558-
impl<T: Ord> Extendable<T> for BinaryHeap<T> {
558+
impl<T: Ord> Extend<T> for BinaryHeap<T> {
559559
fn extend<Iter: Iterator<T>>(&mut self, mut iter: Iter) {
560560
let (lower, _) = iter.size_hint();
561561

trunk/src/libcollections/bit.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -835,7 +835,7 @@ impl FromIterator<bool> for Bitv {
835835
}
836836
}
837837

838-
impl Extendable<bool> for Bitv {
838+
impl Extend<bool> for Bitv {
839839
#[inline]
840840
fn extend<I: Iterator<bool>>(&mut self, mut iterator: I) {
841841
let (min, _) = iterator.size_hint();
@@ -1014,7 +1014,7 @@ impl FromIterator<bool> for BitvSet {
10141014
}
10151015
}
10161016

1017-
impl Extendable<bool> for BitvSet {
1017+
impl Extend<bool> for BitvSet {
10181018
#[inline]
10191019
fn extend<I: Iterator<bool>>(&mut self, iterator: I) {
10201020
let &BitvSet(ref mut self_bitv) = self;

trunk/src/libcollections/btree/map.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,7 @@ impl<K: Ord, V> FromIterator<(K, V)> for BTreeMap<K, V> {
727727
}
728728
}
729729

730-
impl<K: Ord, V> Extendable<(K, V)> for BTreeMap<K, V> {
730+
impl<K: Ord, V> Extend<(K, V)> for BTreeMap<K, V> {
731731
#[inline]
732732
fn extend<T: Iterator<(K, V)>>(&mut self, mut iter: T) {
733733
for (k, v) in iter {

trunk/src/libcollections/btree/set.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ impl<T: Ord> FromIterator<T> for BTreeSet<T> {
316316
}
317317
}
318318

319-
impl<T: Ord> Extendable<T> for BTreeSet<T> {
319+
impl<T: Ord> Extend<T> for BTreeSet<T> {
320320
#[inline]
321321
fn extend<Iter: Iterator<T>>(&mut self, mut iter: Iter) {
322322
for elem in iter {

trunk/src/libcollections/dlist.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,7 @@ impl<A> FromIterator<A> for DList<A> {
720720
}
721721
}
722722

723-
impl<A> Extendable<A> for DList<A> {
723+
impl<A> Extend<A> for DList<A> {
724724
fn extend<T: Iterator<A>>(&mut self, mut iterator: T) {
725725
for elt in iterator { self.push_back(elt); }
726726
}

trunk/src/libcollections/enum_set.rs

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ use core::fmt;
1818

1919
// FIXME(conventions): implement BitXor
2020
// FIXME(contentions): implement union family of methods? (general design may be wrong here)
21-
// FIXME(conventions): implement len
2221

2322
#[deriving(Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
2423
/// A specialized `Set` implementation to use enum types.
@@ -92,6 +91,12 @@ impl<E:CLike> EnumSet<E> {
9291
EnumSet {bits: 0}
9392
}
9493

94+
/// Returns the number of elements in the given `EnumSet`.
95+
#[unstable = "matches collection reform specification, waiting for dust to settle"]
96+
pub fn len(&self) -> uint {
97+
self.bits.count_ones()
98+
}
99+
95100
/// Returns true if the `EnumSet` is empty.
96101
#[unstable = "matches collection reform specification, waiting for dust to settle"]
97102
pub fn is_empty(&self) -> bool {
@@ -230,6 +235,22 @@ impl<E:CLike> Iterator<E> for Items<E> {
230235
}
231236
}
232237

238+
impl<E:CLike> FromIterator<E> for EnumSet<E> {
239+
fn from_iter<I:Iterator<E>>(iterator: I) -> EnumSet<E> {
240+
let mut ret = EnumSet::new();
241+
ret.extend(iterator);
242+
ret
243+
}
244+
}
245+
246+
impl<E:CLike> Extend<E> for EnumSet<E> {
247+
fn extend<I: Iterator<E>>(&mut self, mut iterator: I) {
248+
for element in iterator {
249+
self.insert(element);
250+
}
251+
}
252+
}
253+
233254
#[cfg(test)]
234255
mod test {
235256
use std::prelude::*;
@@ -269,6 +290,20 @@ mod test {
269290
assert_eq!("{A, C}", e.to_string().as_slice());
270291
}
271292

293+
#[test]
294+
fn test_len() {
295+
let mut e = EnumSet::new();
296+
assert_eq!(e.len(), 0);
297+
e.insert(A);
298+
e.insert(B);
299+
e.insert(C);
300+
assert_eq!(e.len(), 3);
301+
e.remove(&A);
302+
assert_eq!(e.len(), 2);
303+
e.clear();
304+
assert_eq!(e.len(), 0);
305+
}
306+
272307
///////////////////////////////////////////////////////////////////////////
273308
// intersect
274309

trunk/src/libcollections/ring_buf.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,7 @@ impl<A> FromIterator<A> for RingBuf<A> {
735735
}
736736
}
737737

738-
impl<A> Extendable<A> for RingBuf<A> {
738+
impl<A> Extend<A> for RingBuf<A> {
739739
fn extend<T: Iterator<A>>(&mut self, mut iterator: T) {
740740
for elt in iterator {
741741
self.push_back(elt);

trunk/src/libcollections/string.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -683,8 +683,8 @@ impl FromIterator<char> for String {
683683
}
684684
}
685685

686-
#[experimental = "waiting on Extendable stabilization"]
687-
impl Extendable<char> for String {
686+
#[experimental = "waiting on Extend stabilization"]
687+
impl Extend<char> for String {
688688
fn extend<I:Iterator<char>>(&mut self, mut iterator: I) {
689689
for ch in iterator {
690690
self.push(ch)

trunk/src/libcollections/tree/map.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1260,7 +1260,7 @@ impl<K: Ord, V> FromIterator<(K, V)> for TreeMap<K, V> {
12601260
}
12611261
}
12621262

1263-
impl<K: Ord, V> Extendable<(K, V)> for TreeMap<K, V> {
1263+
impl<K: Ord, V> Extend<(K, V)> for TreeMap<K, V> {
12641264
#[inline]
12651265
fn extend<T: Iterator<(K, V)>>(&mut self, mut iter: T) {
12661266
for (k, v) in iter {

trunk/src/libcollections/tree/set.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -659,7 +659,7 @@ impl<T: Ord> FromIterator<T> for TreeSet<T> {
659659
}
660660
}
661661

662-
impl<T: Ord> Extendable<T> for TreeSet<T> {
662+
impl<T: Ord> Extend<T> for TreeSet<T> {
663663
#[inline]
664664
fn extend<Iter: Iterator<T>>(&mut self, mut iter: Iter) {
665665
for elem in iter {

trunk/src/libcollections/trie/map.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ impl<T> FromIterator<(uint, T)> for TrieMap<T> {
628628
}
629629
}
630630

631-
impl<T> Extendable<(uint, T)> for TrieMap<T> {
631+
impl<T> Extend<(uint, T)> for TrieMap<T> {
632632
fn extend<Iter: Iterator<(uint, T)>>(&mut self, mut iter: Iter) {
633633
for (k, v) in iter {
634634
self.insert(k, v);

trunk/src/libcollections/trie/set.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ impl FromIterator<uint> for TrieSet {
355355
}
356356
}
357357

358-
impl Extendable<uint> for TrieSet {
358+
impl Extend<uint> for TrieSet {
359359
fn extend<Iter: Iterator<uint>>(&mut self, mut iter: Iter) {
360360
for elem in iter {
361361
self.insert(elem);

trunk/src/libcollections/vec.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -484,8 +484,8 @@ impl<T> FromIterator<T> for Vec<T> {
484484
}
485485
}
486486

487-
#[experimental = "waiting on Extendable stability"]
488-
impl<T> Extendable<T> for Vec<T> {
487+
#[experimental = "waiting on Extend stability"]
488+
impl<T> Extend<T> for Vec<T> {
489489
#[inline]
490490
fn extend<I: Iterator<T>>(&mut self, mut iterator: I) {
491491
let (lower, _) = iterator.size_hint();
@@ -801,14 +801,13 @@ impl<T> Vec<T> {
801801
///
802802
/// # Example
803803
/// ```
804-
/// let mut v = vec!["foo".to_string(), "bar".to_string(),
805-
/// "baz".to_string(), "qux".to_string()];
804+
/// let mut v = vec!["foo", "bar", "baz", "qux"];
806805
///
807-
/// assert_eq!(v.swap_remove(1), Some("bar".to_string()));
808-
/// assert_eq!(v, vec!["foo".to_string(), "qux".to_string(), "baz".to_string()]);
806+
/// assert_eq!(v.swap_remove(1), Some("bar"));
807+
/// assert_eq!(v, vec!["foo", "qux", "baz"]);
809808
///
810-
/// assert_eq!(v.swap_remove(0), Some("foo".to_string()));
811-
/// assert_eq!(v, vec!["baz".to_string(), "qux".to_string()]);
809+
/// assert_eq!(v.swap_remove(0), Some("foo"));
810+
/// assert_eq!(v, vec!["baz", "qux"]);
812811
///
813812
/// assert_eq!(v.swap_remove(2), None);
814813
/// ```

trunk/src/libcollections/vec_map.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ impl<V> FromIterator<(uint, V)> for VecMap<V> {
499499
}
500500
}
501501

502-
impl<V> Extendable<(uint, V)> for VecMap<V> {
502+
impl<V> Extend<(uint, V)> for VecMap<V> {
503503
fn extend<Iter: Iterator<(uint, V)>>(&mut self, mut iter: Iter) {
504504
for (k, v) in iter {
505505
self.insert(k, v);

trunk/src/libcore/atomic.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -717,15 +717,15 @@ unsafe fn atomic_xor<T>(dst: *mut T, val: T, order: Ordering) -> T {
717717
/// A fence 'A' which has `Release` ordering semantics, synchronizes with a
718718
/// fence 'B' with (at least) `Acquire` semantics, if and only if there exists
719719
/// atomic operations X and Y, both operating on some atomic object 'M' such
720-
/// that A is sequenced before X, Y is synchronized before B and Y observers
720+
/// that A is sequenced before X, Y is synchronized before B and Y observes
721721
/// the change to M. This provides a happens-before dependence between A and B.
722722
///
723723
/// Atomic operations with `Release` or `Acquire` semantics can also synchronize
724724
/// with a fence.
725725
///
726-
/// A fence with has `SeqCst` ordering, in addition to having both `Acquire` and
727-
/// `Release` semantics, participates in the global program order of the other
728-
/// `SeqCst` operations and/or fences.
726+
/// A fence which has `SeqCst` ordering, in addition to having both `Acquire`
727+
/// and `Release` semantics, participates in the global program order of the
728+
/// other `SeqCst` operations and/or fences.
729729
///
730730
/// Accepts `Acquire`, `Release`, `AcqRel` and `SeqCst` orderings.
731731
///

trunk/src/libcore/intrinsics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ extern "rust-intrinsic" {
536536
/// `TypeId` represents a globally unique identifier for a type
537537
#[lang="type_id"] // This needs to be kept in lockstep with the code in trans/intrinsic.rs and
538538
// middle/lang_items.rs
539-
#[deriving(PartialEq, Eq, Show)]
539+
#[deriving(Clone, PartialEq, Eq, Show)]
540540
pub struct TypeId {
541541
t: u64,
542542
}

trunk/src/libcore/iter.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ use num::{Zero, One, CheckedAdd, CheckedSub, Saturating, ToPrimitive, Int};
6666
use ops::{Add, Mul, Sub};
6767
use option::{Option, Some, None};
6868
use uint;
69+
#[deprecated = "renamed to Extend"] pub use self::Extend as Extendable;
6970

7071
/// Conversion from an `Iterator`
7172
pub trait FromIterator<A> {
@@ -74,8 +75,8 @@ pub trait FromIterator<A> {
7475
}
7576

7677
/// A type growable from an `Iterator` implementation
77-
pub trait Extendable<A>: FromIterator<A> {
78-
/// Extend a container with the elements yielded by an iterator
78+
pub trait Extend<A> {
79+
/// Extend a container with the elements yielded by an arbitrary iterator
7980
fn extend<T: Iterator<A>>(&mut self, iterator: T);
8081
}
8182

trunk/src/libcore/prelude.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ pub use char::Char;
4848
pub use clone::Clone;
4949
pub use cmp::{PartialEq, PartialOrd, Eq, Ord};
5050
pub use cmp::{Ordering, Less, Equal, Greater, Equiv};
51-
pub use iter::{FromIterator, Extendable};
51+
pub use iter::{FromIterator, Extend};
5252
pub use iter::{Iterator, DoubleEndedIterator, RandomAccessIterator, CloneableIterator};
5353
pub use iter::{OrdIterator, MutableDoubleEndedIterator, ExactSize};
5454
pub use num::{Num, NumCast, CheckedAdd, CheckedSub, CheckedMul};

trunk/src/librustc/driver/driver.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -212,11 +212,6 @@ pub fn phase_2_configure_and_expand(sess: &Session,
212212
*ty == config::CrateTypeExecutable
213213
});
214214

215-
krate = time(time_passes, "crate injection", krate, |krate|
216-
syntax::std_inject::maybe_inject_crates_ref(krate,
217-
sess.opts.alt_std_name.clone(),
218-
any_exe));
219-
220215
// strip before expansion to allow macros to depend on
221216
// configuration variables e.g/ in
222217
//
@@ -228,6 +223,11 @@ pub fn phase_2_configure_and_expand(sess: &Session,
228223
krate = time(time_passes, "configuration 1", krate, |krate|
229224
syntax::config::strip_unconfigured_items(sess.diagnostic(), krate));
230225

226+
krate = time(time_passes, "crate injection", krate, |krate|
227+
syntax::std_inject::maybe_inject_crates_ref(krate,
228+
sess.opts.alt_std_name.clone(),
229+
any_exe));
230+
231231
let mut addl_plugins = Some(addl_plugins);
232232
let Plugins { macros, registrars }
233233
= time(time_passes, "plugin loading", (), |_|

trunk/src/librustc/middle/traits/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ pub enum Vtable<N> {
176176
/// ID is the ID of the closure expression. This is a `VtableImpl`
177177
/// in spirit, but the impl is generated by the compiler and does
178178
/// not appear in the source.
179-
VtableUnboxedClosure(ast::DefId),
179+
VtableUnboxedClosure(ast::DefId, subst::Substs),
180180

181181
/// Successful resolution to an obligation provided by the caller
182182
/// for some type parameter.
@@ -338,7 +338,7 @@ impl<N> Vtable<N> {
338338
pub fn iter_nested(&self) -> Items<N> {
339339
match *self {
340340
VtableImpl(ref i) => i.iter_nested(),
341-
VtableUnboxedClosure(_) => (&[]).iter(),
341+
VtableUnboxedClosure(..) => (&[]).iter(),
342342
VtableParam(_) => (&[]).iter(),
343343
VtableBuiltin(ref i) => i.iter_nested(),
344344
}
@@ -347,7 +347,7 @@ impl<N> Vtable<N> {
347347
pub fn map_nested<M>(&self, op: |&N| -> M) -> Vtable<M> {
348348
match *self {
349349
VtableImpl(ref i) => VtableImpl(i.map_nested(op)),
350-
VtableUnboxedClosure(d) => VtableUnboxedClosure(d),
350+
VtableUnboxedClosure(d, ref s) => VtableUnboxedClosure(d, s.clone()),
351351
VtableParam(ref p) => VtableParam((*p).clone()),
352352
VtableBuiltin(ref i) => VtableBuiltin(i.map_nested(op)),
353353
}
@@ -356,7 +356,7 @@ impl<N> Vtable<N> {
356356
pub fn map_move_nested<M>(self, op: |N| -> M) -> Vtable<M> {
357357
match self {
358358
VtableImpl(i) => VtableImpl(i.map_move_nested(op)),
359-
VtableUnboxedClosure(d) => VtableUnboxedClosure(d),
359+
VtableUnboxedClosure(d, s) => VtableUnboxedClosure(d, s),
360360
VtableParam(p) => VtableParam(p),
361361
VtableBuiltin(i) => VtableBuiltin(i.map_move_nested(op)),
362362
}

trunk/src/librustc/middle/traits/select.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1582,9 +1582,9 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
15821582
Ok(VtableImpl(vtable_impl))
15831583
}
15841584

1585-
UnboxedClosureCandidate(closure_def_id, ref substs) => {
1586-
try!(self.confirm_unboxed_closure_candidate(obligation, closure_def_id, substs));
1587-
Ok(VtableUnboxedClosure(closure_def_id))
1585+
UnboxedClosureCandidate(closure_def_id, substs) => {
1586+
try!(self.confirm_unboxed_closure_candidate(obligation, closure_def_id, &substs));
1587+
Ok(VtableUnboxedClosure(closure_def_id, substs))
15881588
}
15891589
}
15901590
}

trunk/src/librustc/middle/traits/util.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -311,9 +311,10 @@ impl<N:Repr> Repr for super::Vtable<N> {
311311
super::VtableImpl(ref v) =>
312312
v.repr(tcx),
313313

314-
super::VtableUnboxedClosure(ref d) =>
315-
format!("VtableUnboxedClosure({})",
316-
d.repr(tcx)),
314+
super::VtableUnboxedClosure(ref d, ref s) =>
315+
format!("VtableUnboxedClosure({},{})",
316+
d.repr(tcx),
317+
s.repr(tcx)),
317318

318319
super::VtableParam(ref v) =>
319320
format!("VtableParam({})", v.repr(tcx)),

0 commit comments

Comments
 (0)