Skip to content

Commit 01a8502

Browse files
committed
---
yaml --- r: 158921 b: refs/heads/master c: 93c85eb h: refs/heads/master i: 158919: b4253ab v: v3
1 parent 3189838 commit 01a8502

Some content is hidden

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

77 files changed

+1556
-900
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: 2c956d0abfa8cc169fc2c2ab5343b77b20397817
2+
refs/heads/master: 93c85eb8bdcc910a27caf6abd20207a626ae98e5
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: f89e975685a3a9f258c996865cdd144a0f30f83c
55
refs/heads/try: f58aad6dce273570fb130b4df008ef9acd5a5be2

trunk/configure

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,24 @@ putvar() {
7676
printf "%-20s := %s\n" $1 "$T" >>config.tmp
7777
}
7878

79+
putpathvar() {
80+
local T
81+
eval T=\$$1
82+
eval TLEN=\${#$1}
83+
if [ $TLEN -gt 35 ]
84+
then
85+
printf "configure: %-20s := %.35s ...\n" $1 "$T"
86+
else
87+
printf "configure: %-20s := %s %s\n" $1 "$T" "$2"
88+
fi
89+
if [ -z "$T" ]
90+
then
91+
printf "%-20s := \n" $1 >>config.tmp
92+
else
93+
printf "%-20s := \"%s\"\n" $1 "$T" >>config.tmp
94+
fi
95+
}
96+
7997
probe() {
8098
local V=$1
8199
shift
@@ -101,7 +119,7 @@ probe() {
101119
fi
102120
done
103121
eval $V=\$T
104-
putvar $V "$VER"
122+
putpathvar $V "$VER"
105123
}
106124

107125
probe_need() {
@@ -638,9 +656,9 @@ probe CFG_ADB adb
638656

639657
if [ ! -z "$CFG_PANDOC" ]
640658
then
641-
PV_MAJOR_MINOR=$(pandoc --version | grep '^pandoc ' |
659+
PV_MAJOR_MINOR=$(pandoc --version | grep '^pandoc\(.exe\)\? ' |
642660
# extract the first 2 version fields, ignore everything else
643-
sed 's/pandoc \([0-9]*\)\.\([0-9]*\).*/\1 \2/')
661+
sed 's/pandoc\(.exe\)\? \([0-9]*\)\.\([0-9]*\).*/\2 \3/')
644662

645663
MIN_PV_MAJOR="1"
646664
MIN_PV_MINOR="9"
@@ -1330,8 +1348,7 @@ do
13301348
done
13311349

13321350
# Munge any paths that appear in config.mk back to posix-y
1333-
perl -i.bak -p -e 's@ ([a-zA-Z]):[/\\]@ /\1/@go;' \
1334-
-e 's@\\@/@go;' config.tmp
1351+
perl -i.bak -p -e 's@ ([a-zA-Z]):[/\\]@ /\1/@go;' config.tmp
13351352
rm -f config.tmp.bak
13361353

13371354
msg

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/mk/reconfig.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ ifndef CFG_DISABLE_MANAGE_SUBMODULES
1919
# (nothing checked out at all). `./configure --{llvm,jemalloc}-root`
2020
# will explicitly deinitialize the corresponding submodules, and we don't
2121
# want to force constant rebuilds in that case.
22-
NEED_GIT_RECONFIG=$(shell cd "$(CFG_SRC_DIR)" && "$(CFG_GIT)" submodule status | grep -c '^+')
22+
NEED_GIT_RECONFIG=$(shell cd "$(CFG_SRC_DIR)" && $(CFG_GIT) submodule status | grep -c '^+')
2323
else
2424
NEED_GIT_RECONFIG=0
2525
endif

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/liballoc/arc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ impl<T: Send + Sync + Clone> Arc<T> {
166166
// additional reference of either kind.
167167
if self.inner().strong.load(atomic::SeqCst) != 1 ||
168168
self.inner().weak.load(atomic::SeqCst) != 1 {
169-
*self = Arc::new(self.deref().clone())
169+
*self = Arc::new((**self).clone())
170170
}
171171
// This unsafety is ok because we're guaranteed that the pointer
172172
// returned is the *only* pointer that will ever be returned to T. Our

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: 89 additions & 3 deletions
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.
@@ -43,7 +42,27 @@ impl<E:CLike+fmt::Show> fmt::Show for EnumSet<E> {
4342
}
4443
}
4544

46-
/// An interface for casting C-like enum to uint and back.
45+
/**
46+
An interface for casting C-like enum to uint and back.
47+
A typically implementation is as below.
48+
49+
```{rust,ignore}
50+
#[repr(uint)]
51+
enum Foo {
52+
A, B, C
53+
}
54+
55+
impl CLike for Foo {
56+
fn to_uint(&self) -> uint {
57+
*self as uint
58+
}
59+
60+
fn from_uint(v: uint) -> Foo {
61+
unsafe { mem::transmute(v) }
62+
}
63+
}
64+
```
65+
*/
4766
pub trait CLike {
4867
/// Converts a C-like enum to a `uint`.
4968
fn to_uint(&self) -> uint;
@@ -52,7 +71,11 @@ pub trait CLike {
5271
}
5372

5473
fn bit<E:CLike>(e: &E) -> uint {
55-
1 << e.to_uint()
74+
use core::uint;
75+
let value = e.to_uint();
76+
assert!(value < uint::BITS,
77+
"EnumSet only supports up to {} variants.", uint::BITS - 1);
78+
1 << value
5679
}
5780

5881
impl<E:CLike> EnumSet<E> {
@@ -68,6 +91,12 @@ impl<E:CLike> EnumSet<E> {
6891
EnumSet {bits: 0}
6992
}
7093

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+
71100
/// Returns true if the `EnumSet` is empty.
72101
#[unstable = "matches collection reform specification, waiting for dust to settle"]
73102
pub fn is_empty(&self) -> bool {
@@ -206,6 +235,22 @@ impl<E:CLike> Iterator<E> for Items<E> {
206235
}
207236
}
208237

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+
209254
#[cfg(test)]
210255
mod test {
211256
use std::prelude::*;
@@ -245,6 +290,20 @@ mod test {
245290
assert_eq!("{A, C}", e.to_string().as_slice());
246291
}
247292

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+
248307
///////////////////////////////////////////////////////////////////////////
249308
// intersect
250309

@@ -378,4 +437,31 @@ mod test {
378437
let elems = e_subtract.iter().collect();
379438
assert_eq!(vec![A], elems)
380439
}
440+
441+
#[test]
442+
#[should_fail]
443+
fn test_overflow() {
444+
#[allow(dead_code)]
445+
#[repr(uint)]
446+
enum Bar {
447+
V00, V01, V02, V03, V04, V05, V06, V07, V08, V09,
448+
V10, V11, V12, V13, V14, V15, V16, V17, V18, V19,
449+
V20, V21, V22, V23, V24, V25, V26, V27, V28, V29,
450+
V30, V31, V32, V33, V34, V35, V36, V37, V38, V39,
451+
V40, V41, V42, V43, V44, V45, V46, V47, V48, V49,
452+
V50, V51, V52, V53, V54, V55, V56, V57, V58, V59,
453+
V60, V61, V62, V63, V64, V65, V66, V67, V68, V69,
454+
}
455+
impl CLike for Bar {
456+
fn to_uint(&self) -> uint {
457+
*self as uint
458+
}
459+
460+
fn from_uint(v: uint) -> Bar {
461+
unsafe { mem::transmute(v) }
462+
}
463+
}
464+
let mut set = EnumSet::empty();
465+
set.add(V64);
466+
}
381467
}

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);

0 commit comments

Comments
 (0)