Skip to content

Commit 4fefa1f

Browse files
committed
---
yaml --- r: 159055 b: refs/heads/snap-stage3 c: 60820ba h: refs/heads/master i: 159053: b993750 159051: 40a28f8 159047: a467356 159039: 9399e6b v: v3
1 parent fb8363a commit 4fefa1f

File tree

171 files changed

+6229
-4983
lines changed

Some content is hidden

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

171 files changed

+6229
-4983
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 40fb87d40f681f5356af42175fc7b85da387f037
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: e15a3903e00a3fdb5c2071ac4e72c2e8d5965def
4+
refs/heads/snap-stage3: 60820ba528a711d27562df87d6fd14524d67341f
55
refs/heads/try: f58aad6dce273570fb130b4df008ef9acd5a5be2
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d

branches/snap-stage3/mk/cfg/i686-pc-windows-gnu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# i686-pc-windows-gnu configuration
2-
CROSS_PREFIX_i686-pc-windows-gnu=i686-pc-windows-gnu-
2+
CROSS_PREFIX_i686-pc-windows-gnu=i686-w64-mingw32-
33
CC_i686-pc-windows-gnu=gcc
44
CXX_i686-pc-windows-gnu=g++
55
CPP_i686-pc-windows-gnu=gcc -E

branches/snap-stage3/mk/cfg/x86_64-pc-windows-gnu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# x86_64-pc-windows-gnu configuration
2-
CROSS_PREFIX_x86_64-pc-windows-gnu=x86_64-pc-windows-gnu-
2+
CROSS_PREFIX_x86_64-pc-windows-gnu=x86_64-w64-mingw32-
33
CC_x86_64-pc-windows-gnu=gcc
44
CXX_x86_64-pc-windows-gnu=g++
55
CPP_x86_64-pc-windows-gnu=gcc -E

branches/snap-stage3/mk/dist.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ $(PKG_EXE): rust.iss modpath.iss upgrade.iss LICENSE.txt rust-logo.ico \
125125
dist-prepare-win
126126
$(CFG_PYTHON) $(S)src/etc/make-win-dist.py tmp/dist/win $(CFG_BUILD)
127127
@$(call E, ISCC: $@)
128-
$(Q)"$(CFG_ISCC)" $<
128+
$(Q)$(CFG_ISCC) $<
129129

130130
$(eval $(call DEF_PREPARE,win))
131131

branches/snap-stage3/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

branches/snap-stage3/mk/main.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ CFG_GIT_DIR := $(CFG_SRC_DIR).git
5252
# so we use a hack: define $(SPACE) which contains space character.
5353
SPACE :=
5454
SPACE +=
55-
ifneq ($(wildcard $(subst $(SPACE),\$(SPACE),$(CFG_GIT))),)
55+
ifneq ($(CFG_GIT),)
5656
ifneq ($(wildcard $(subst $(SPACE),\$(SPACE),$(CFG_GIT_DIR))),)
5757
CFG_VER_DATE = $(shell git --git-dir='$(CFG_GIT_DIR)' log -1 --pretty=format:'%ci')
5858
CFG_VER_HASH = $(shell git --git-dir='$(CFG_GIT_DIR)' rev-parse HEAD)

branches/snap-stage3/src/doc/guide.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1481,7 +1481,7 @@ s.push_str(", world.");
14811481
println!("{}", s);
14821482
```
14831483

1484-
You can coerce a `String` into a `&str` with the `as_slice()` method:
1484+
You can get a `&str` view into a `String` with the `as_slice()` method:
14851485

14861486
```{rust}
14871487
fn takes_slice(slice: &str) {
@@ -1514,7 +1514,7 @@ fn compare(string: String) {
15141514
}
15151515
```
15161516

1517-
Converting a `String` to a `&str` is cheap, but converting the `&str` to a
1517+
Viewing a `String` as a `&str` is cheap, but converting the `&str` to a
15181518
`String` involves allocating memory. No reason to do that unless you have to!
15191519

15201520
That's the basics of strings in Rust! They're probably a bit more complicated

branches/snap-stage3/src/doc/intro.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ including the right thing!) Even though we compiled with flags to give us as
217217
many warnings as possible, and to treat those warnings as errors, we got no
218218
errors. When we ran the program, it crashed.
219219

220-
Why does this happen? When we prepend to an array, its length changes. Since
220+
Why does this happen? When we append to an array, its length changes. Since
221221
its length changes, we may need to allocate more memory. In Ruby, this happens
222222
as well, we just don't think about it very often. So why does the C++ version
223223
segfault when we allocate more memory?

branches/snap-stage3/src/etc/vim/syntax/rust.vim

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ syn keyword rustConditional match if else
1717
syn keyword rustOperator as
1818

1919
syn match rustAssert "\<assert\(\w\)*!" contained
20-
syn match rustFail "\<fail\(\w\)*!" contained
20+
syn match rustPanic "\<panic\(\w\)*!" contained
2121
syn keyword rustKeyword break
2222
syn keyword rustKeyword box nextgroup=rustBoxPlacement skipwhite skipempty
2323
syn keyword rustKeyword continue
2424
syn keyword rustKeyword extern nextgroup=rustExternCrate,rustObsoleteExternMod skipwhite skipempty
2525
syn keyword rustKeyword fn nextgroup=rustFuncName skipwhite skipempty
26-
syn keyword rustKeyword for in if impl let
26+
syn keyword rustKeyword for in if impl let move
2727
syn keyword rustKeyword loop once proc pub
2828
syn keyword rustKeyword return super
2929
syn keyword rustKeyword unsafe virtual where while
@@ -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
@@ -151,8 +151,8 @@ syn match rustSigil display /[&~@*][^)= \t\r\n]/he=e-1,me=e-1
151151
" Last, because the & in && isn't a sigil
152152
syn match rustOperator display "&&\|||"
153153

154-
syn match rustMacro '\w\(\w\)*!' contains=rustAssert,rustFail
155-
syn match rustMacro '#\w\(\w\)*' contains=rustAssert,rustFail
154+
syn match rustMacro '\w\(\w\)*!' contains=rustAssert,rustPanic
155+
syn match rustMacro '#\w\(\w\)*' contains=rustAssert,rustPanic
156156

157157
syn match rustEscapeError display contained /\\./
158158
syn match rustEscape display contained /\\\([nrt0\\'"]\|x\x\{2}\)/
@@ -263,7 +263,7 @@ hi def link rustCommentLineDoc SpecialComment
263263
hi def link rustCommentBlock rustCommentLine
264264
hi def link rustCommentBlockDoc rustCommentLineDoc
265265
hi def link rustAssert PreCondit
266-
hi def link rustFail PreCondit
266+
hi def link rustPanic PreCondit
267267
hi def link rustMacro Macro
268268
hi def link rustType Type
269269
hi def link rustTodo Todo
@@ -282,7 +282,7 @@ hi def link rustBoxPlacementExpr rustKeyword
282282
" hi rustAttribute ctermfg=cyan
283283
" hi rustDeriving ctermfg=cyan
284284
" hi rustAssert ctermfg=yellow
285-
" hi rustFail ctermfg=red
285+
" hi rustPanic ctermfg=red
286286
" hi rustMacro ctermfg=magenta
287287

288288
syn sync minlines=200

branches/snap-stage3/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

branches/snap-stage3/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;

branches/snap-stage3/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 {

branches/snap-stage3/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 {

branches/snap-stage3/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
}

branches/snap-stage3/src/libcollections/enum_set.rs

Lines changed: 62 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@
1616
use core::prelude::*;
1717
use core::fmt;
1818

19-
// FIXME(conventions): implement BitXor
2019
// FIXME(contentions): implement union family of methods? (general design may be wrong here)
21-
// FIXME(conventions): implement len
2220

2321
#[deriving(Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
2422
/// A specialized `Set` implementation to use enum types.
@@ -92,6 +90,12 @@ impl<E:CLike> EnumSet<E> {
9290
EnumSet {bits: 0}
9391
}
9492

93+
/// Returns the number of elements in the given `EnumSet`.
94+
#[unstable = "matches collection reform specification, waiting for dust to settle"]
95+
pub fn len(&self) -> uint {
96+
self.bits.count_ones()
97+
}
98+
9599
/// Returns true if the `EnumSet` is empty.
96100
#[unstable = "matches collection reform specification, waiting for dust to settle"]
97101
pub fn is_empty(&self) -> bool {
@@ -196,6 +200,12 @@ impl<E:CLike> BitAnd<EnumSet<E>, EnumSet<E>> for EnumSet<E> {
196200
}
197201
}
198202

203+
impl<E:CLike> BitXor<EnumSet<E>, EnumSet<E>> for EnumSet<E> {
204+
fn bitxor(&self, e: &EnumSet<E>) -> EnumSet<E> {
205+
EnumSet {bits: self.bits ^ e.bits}
206+
}
207+
}
208+
199209
/// An iterator over an EnumSet
200210
pub struct Items<E> {
201211
index: uint,
@@ -230,6 +240,22 @@ impl<E:CLike> Iterator<E> for Items<E> {
230240
}
231241
}
232242

243+
impl<E:CLike> FromIterator<E> for EnumSet<E> {
244+
fn from_iter<I:Iterator<E>>(iterator: I) -> EnumSet<E> {
245+
let mut ret = EnumSet::new();
246+
ret.extend(iterator);
247+
ret
248+
}
249+
}
250+
251+
impl<E:CLike> Extend<E> for EnumSet<E> {
252+
fn extend<I: Iterator<E>>(&mut self, mut iterator: I) {
253+
for element in iterator {
254+
self.insert(element);
255+
}
256+
}
257+
}
258+
233259
#[cfg(test)]
234260
mod test {
235261
use std::prelude::*;
@@ -269,6 +295,20 @@ mod test {
269295
assert_eq!("{A, C}", e.to_string().as_slice());
270296
}
271297

298+
#[test]
299+
fn test_len() {
300+
let mut e = EnumSet::new();
301+
assert_eq!(e.len(), 0);
302+
e.insert(A);
303+
e.insert(B);
304+
e.insert(C);
305+
assert_eq!(e.len(), 3);
306+
e.remove(&A);
307+
assert_eq!(e.len(), 2);
308+
e.clear();
309+
assert_eq!(e.len(), 0);
310+
}
311+
272312
///////////////////////////////////////////////////////////////////////////
273313
// intersect
274314

@@ -398,9 +438,29 @@ mod test {
398438
let elems = e_intersection.iter().collect();
399439
assert_eq!(vec![C], elems)
400440

441+
// Another way to express intersection
442+
let e_intersection = e1 - (e1 - e2);
443+
let elems = e_intersection.iter().collect();
444+
assert_eq!(vec![C], elems)
445+
401446
let e_subtract = e1 - e2;
402447
let elems = e_subtract.iter().collect();
403448
assert_eq!(vec![A], elems)
449+
450+
// Bitwise XOR of two sets, aka symmetric difference
451+
let e_symmetric_diff = e1 ^ e2;
452+
let elems = e_symmetric_diff.iter().collect();
453+
assert_eq!(vec![A,B], elems)
454+
455+
// Another way to express symmetric difference
456+
let e_symmetric_diff = (e1 - e2) | (e2 - e1);
457+
let elems = e_symmetric_diff.iter().collect();
458+
assert_eq!(vec![A,B], elems)
459+
460+
// Yet another way to express symmetric difference
461+
let e_symmetric_diff = (e1 | e2) - (e1 & e2);
462+
let elems = e_symmetric_diff.iter().collect();
463+
assert_eq!(vec![A,B], elems)
404464
}
405465

406466
#[test]

branches/snap-stage3/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);

branches/snap-stage3/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)

branches/snap-stage3/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 {

branches/snap-stage3/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 {

0 commit comments

Comments
 (0)