Skip to content

Commit 1e8d87c

Browse files
committed
---
yaml --- r: 71947 b: refs/heads/dist-snap c: ea9bdaa h: refs/heads/master i: 71945: 20cd88a 71943: 7870756 v: v3
1 parent 5c308ce commit 1e8d87c

File tree

143 files changed

+5723
-2502
lines changed

Some content is hidden

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

143 files changed

+5723
-2502
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
99
refs/heads/incoming: b50030718cf28f2a5a81857a26b57442734fe854
10-
refs/heads/dist-snap: 35c73c80887cca62f8bba2eb9b9e277a98c37f93
10+
refs/heads/dist-snap: ea9bdaaed9e4cb91cb8dfc96d0ce2dab10eae1d2
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1313
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/configure

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ then
533533
LLVM_VERSION=$($LLVM_CONFIG --version)
534534

535535
case $LLVM_VERSION in
536-
(3.2svn|3.2|3.1svn|3.1|3.0svn|3.0)
536+
(3.3|3.3svn|3.2|3.2svn)
537537
msg "found ok version of LLVM: $LLVM_VERSION"
538538
;;
539539
(*)

branches/dist-snap/doc/tutorial.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,11 @@ omitted.
495495

496496
A powerful application of pattern matching is *destructuring*:
497497
matching in order to bind names to the contents of data
498-
types. Assuming that `(float, float)` is a tuple of two floats:
498+
types.
499+
500+
> ***Note:*** The following code makes use of tuples (`(float, float)`) which
501+
> are explained in section 5.3. For now you can think of tuples as a list of
502+
> items.
499503
500504
~~~~
501505
fn angle(vector: (float, float)) -> float {

branches/dist-snap/src/compiletest/compiletest.rc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
#[allow(deprecated_mode)];
1818
#[allow(deprecated_pattern)];
1919

20-
extern mod core(vers = "0.6");
21-
extern mod std(vers = "0.6");
20+
extern mod core(vers = "0.7-pre");
21+
extern mod std(vers = "0.7-pre");
2222

2323
use core::*;
2424

branches/dist-snap/src/driver/driver.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,24 @@
99
// except according to those terms.
1010

1111
#[no_core];
12-
extern mod core(vers = "0.6");
12+
extern mod core(vers = "0.7-pre");
1313

1414
#[cfg(rustpkg)]
15-
extern mod this(name = "rustpkg", vers = "0.6");
15+
extern mod this(name = "rustpkg", vers = "0.7-pre");
1616

1717
#[cfg(fuzzer)]
18-
extern mod this(name = "fuzzer", vers = "0.6");
18+
extern mod this(name = "fuzzer", vers = "0.7-pre");
1919

2020
#[cfg(rustdoc)]
21-
extern mod this(name = "rustdoc", vers = "0.6");
21+
extern mod this(name = "rustdoc", vers = "0.7-pre");
2222

2323
#[cfg(rusti)]
24-
extern mod this(name = "rusti", vers = "0.6");
24+
extern mod this(name = "rusti", vers = "0.7-pre");
2525

2626
#[cfg(rust)]
27-
extern mod this(name = "rust", vers = "0.6");
27+
extern mod this(name = "rust", vers = "0.7-pre");
2828

2929
#[cfg(rustc)]
30-
extern mod this(name = "rustc", vers = "0.6");
30+
extern mod this(name = "rustc", vers = "0.7-pre");
3131

3232
fn main() { this::main() }

branches/dist-snap/src/etc/kate/rust.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<!ENTITY rustIdent "[a-zA-Z_][a-zA-Z_0-9]*">
88
<!ENTITY rustIntSuf "([iu](8|16|32|64)?)?">
99
]>
10-
<language name="Rust" version="0.6" kateversion="2.4" section="Sources" extensions="*.rs;*.rc" mimetype="text/x-rust" priority="15">
10+
<language name="Rust" version="0.7-pre" kateversion="2.4" section="Sources" extensions="*.rs;*.rc" mimetype="text/x-rust" priority="15">
1111
<highlighting>
1212
<list name="fn">
1313
<item> fn </item>

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,11 @@ syn match rustFloat display "\<[0-9][0-9_]*\.[0-9_]\+\%([eE][+-]\=[0-9
110110
syn match rustLifetime display "\'\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*"
111111
syn match rustCharacter "'\([^'\\]\|\\\(['nrt\\\"]\|x\x\{2}\|u\x\{4}\|U\x\{8}\)\)'"
112112

113-
syn region rustCommentDoc start="/\*\*" end="\*/"
114-
syn region rustCommentDoc start="///" skip="\\$" end="$" keepend
113+
syn region rustCommentDoc start="/\*[\*!]" end="\*/"
114+
syn region rustCommentDoc start="//[/!]" skip="\\$" end="$" keepend
115115
syn match rustComment "/\*\*/"
116-
syn region rustComment start="/\*\([^\*]\|$\)" end="\*/" contains=rustTodo
117-
syn region rustComment start="//\([^/]\|$\)" skip="\\$" end="$" contains=rustTodo keepend
116+
syn region rustComment start="/\*\([^\*!]\|$\)" end="\*/" contains=rustTodo
117+
syn region rustComment start="//\([^/!]\|$\)" skip="\\$" end="$" contains=rustTodo keepend
118118

119119
syn keyword rustTodo contained TODO FIXME XXX NB
120120

branches/dist-snap/src/libcore/cmp.rs

Lines changed: 53 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,32 @@ totaleq_impl!(i64)
6464
totaleq_impl!(int)
6565
totaleq_impl!(uint)
6666

67-
#[deriving(Eq)]
68-
pub enum Ordering { Less, Equal, Greater }
67+
#[deriving(Clone, Eq)]
68+
pub enum Ordering { Less = -1, Equal = 0, Greater = 1 }
6969

7070
/// Trait for types that form a total order
7171
pub trait TotalOrd: TotalEq {
7272
fn cmp(&self, other: &Self) -> Ordering;
7373
}
7474

75+
impl TotalOrd for Ordering {
76+
#[inline(always)]
77+
fn cmp(&self, other: &Ordering) -> Ordering {
78+
(*self as int).cmp(&(*other as int))
79+
}
80+
}
81+
82+
impl Ord for Ordering {
83+
#[inline(always)]
84+
fn lt(&self, other: &Ordering) -> bool { (*self as int) < (*other as int) }
85+
#[inline(always)]
86+
fn le(&self, other: &Ordering) -> bool { (*self as int) <= (*other as int) }
87+
#[inline(always)]
88+
fn gt(&self, other: &Ordering) -> bool { (*self as int) > (*other as int) }
89+
#[inline(always)]
90+
fn ge(&self, other: &Ordering) -> bool { (*self as int) >= (*other as int) }
91+
}
92+
7593
macro_rules! totalord_impl(
7694
($t:ty) => {
7795
impl TotalOrd for $t {
@@ -98,6 +116,19 @@ totalord_impl!(i64)
98116
totalord_impl!(int)
99117
totalord_impl!(uint)
100118

119+
/**
120+
Return `o1` if it is not `Equal`, otherwise `o2`. Simulates the
121+
lexical ordering on a type `(int, int)`.
122+
*/
123+
// used in deriving code in libsyntax
124+
#[inline(always)]
125+
pub fn lexical_ordering(o1: Ordering, o2: Ordering) -> Ordering {
126+
match o1 {
127+
Equal => o2,
128+
_ => o1
129+
}
130+
}
131+
101132
/**
102133
* Trait for values that can be compared for a sort-order.
103134
*
@@ -166,6 +197,8 @@ pub fn max<T:Ord>(v1: T, v2: T) -> T {
166197

167198
#[cfg(test)]
168199
mod test {
200+
use super::lexical_ordering;
201+
169202
#[test]
170203
fn test_int_totalord() {
171204
assert_eq!(5.cmp(&10), Less);
@@ -180,4 +213,22 @@ mod test {
180213
assert!(5.equals(&5));
181214
assert!(!2.equals(&17));
182215
}
216+
217+
#[test]
218+
fn test_ordering_order() {
219+
assert!(Less < Equal);
220+
assert_eq!(Greater.cmp(&Less), Greater);
221+
}
222+
223+
#[test]
224+
fn test_lexical_ordering() {
225+
fn t(o1: Ordering, o2: Ordering, e: Ordering) {
226+
assert_eq!(lexical_ordering(o1, o2), e);
227+
}
228+
for [Less, Equal, Greater].each |&o| {
229+
t(Less, o, Less);
230+
t(Equal, o, o);
231+
t(Greater, o, Greater);
232+
}
233+
}
183234
}

branches/dist-snap/src/libcore/container.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ pub trait Map<K, V>: Mutable {
2929
/// Return true if the map contains a value for the specified key
3030
fn contains_key(&self, key: &K) -> bool;
3131

32+
// Visits all keys and values
33+
fn each(&self, f: &fn(&K, &V) -> bool);
34+
3235
/// Visit all keys
3336
fn each_key(&self, f: &fn(&K) -> bool);
3437

branches/dist-snap/src/libcore/core.rc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ they contained the following prologue:
4848

4949

5050
#[link(name = "core",
51-
vers = "0.6",
51+
vers = "0.7-pre",
5252
uuid = "c70c24a7-5551-4f73-8e37-380b11d80be8",
5353
url = "https://github.com/mozilla/rust/tree/master/src/libcore")];
5454

@@ -66,7 +66,7 @@ they contained the following prologue:
6666
#[allow(deprecated_drop)];
6767

6868
// Make core testable by not duplicating lang items. See #2912
69-
#[cfg(test)] extern mod realcore(name = "core", vers = "0.6");
69+
#[cfg(test)] extern mod realcore(name = "core", vers = "0.7-pre");
7070
#[cfg(test)] pub use kinds = realcore::kinds;
7171
#[cfg(test)] pub use ops = realcore::ops;
7272
#[cfg(test)] pub use cmp = realcore::cmp;

branches/dist-snap/src/libcore/hashmap.rs

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -279,24 +279,6 @@ priv impl<K:Hash + IterBytes + Eq,V> HashMap<K, V> {
279279
}
280280
}
281281
282-
impl<'self,K:Hash + IterBytes + Eq,V>
283-
BaseIter<(&'self K, &'self V)> for HashMap<K, V> {
284-
/// Visit all key-value pairs
285-
fn each(&self, blk: &fn(&(&'self K, &'self V)) -> bool) {
286-
for uint::range(0, self.buckets.len()) |i| {
287-
let mut broke = false;
288-
do self.buckets[i].map |bucket| {
289-
if !blk(&(&bucket.key, &bucket.value)) {
290-
broke = true; // FIXME(#3064) just write "break;"
291-
}
292-
};
293-
if broke { break; }
294-
}
295-
}
296-
fn size_hint(&self) -> Option<uint> { Some(self.len()) }
297-
}
298-
299-
300282
impl<K:Hash + IterBytes + Eq,V> Container for HashMap<K, V> {
301283
/// Return the number of elements in the map
302284
fn len(&const self) -> uint { self.size }
@@ -315,7 +297,7 @@ impl<K:Hash + IterBytes + Eq,V> Mutable for HashMap<K, V> {
315297
}
316298
}
317299
318-
impl<'self,K:Hash + IterBytes + Eq,V> Map<K, V> for HashMap<K, V> {
300+
impl<K:Hash + IterBytes + Eq,V> Map<K, V> for HashMap<K, V> {
319301
/// Return true if the map contains a value for the specified key
320302
fn contains_key(&self, k: &K) -> bool {
321303
match self.bucket_for_key(k) {
@@ -324,14 +306,25 @@ impl<'self,K:Hash + IterBytes + Eq,V> Map<K, V> for HashMap<K, V> {
324306
}
325307
}
326308
309+
/// Visit all key-value pairs
310+
fn each(&self, blk: &fn(&'self K, &'self V) -> bool) {
311+
for uint::range(0, self.buckets.len()) |i| {
312+
for self.buckets[i].each |bucket| {
313+
if !blk(&bucket.key, &bucket.value) {
314+
return;
315+
}
316+
}
317+
}
318+
}
319+
327320
/// Visit all keys
328321
fn each_key(&self, blk: &fn(k: &K) -> bool) {
329-
self.each(|&(k, _)| blk(k))
322+
self.each(|k, _| blk(k))
330323
}
331324
332325
/// Visit all values
333326
fn each_value(&self, blk: &fn(v: &V) -> bool) {
334-
self.each(|&(_, v)| blk(v))
327+
self.each(|_, v| blk(v))
335328
}
336329
337330
/// Iterate over the map and mutate the contained values
@@ -545,7 +538,7 @@ impl<K:Hash + IterBytes + Eq,V:Eq> Eq for HashMap<K, V> {
545538
fn eq(&self, other: &HashMap<K, V>) -> bool {
546539
if self.len() != other.len() { return false; }
547540

548-
for self.each |&(key, value)| {
541+
for self.each |key, value| {
549542
match other.find(key) {
550543
None => return false,
551544
Some(v) => if value != v { return false },
@@ -798,7 +791,7 @@ mod test_map {
798791
assert!(m.insert(i, i*2));
799792
}
800793
let mut observed = 0;
801-
for m.each |&(k, v)| {
794+
for m.each |k, v| {
802795
assert!(*v == *k * 2);
803796
observed |= (1 << *k);
804797
}

branches/dist-snap/src/libcore/iter.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,3 +344,29 @@ pub fn copy_seq<T:Copy,IT:BaseIter<T>,BT:Buildable<T>>(v: &IT) -> BT {
344344
for v.each |x| { push(*x); }
345345
}
346346
}
347+
348+
/**
349+
* Helper function to transform an internal iterator into an owned vector.
350+
*
351+
* # Example:
352+
*
353+
* ~~~
354+
* let v = ~[1, 2, 3];
355+
* let v2 = do iter_to_vec |f| { v.each(|e| f(*e)) };
356+
* if v != v2 { fail!() }
357+
* ~~~
358+
*/
359+
#[inline(always)]
360+
pub fn iter_to_vec<T>(pusher: &fn(it: &fn(T) -> bool)) -> ~[T] {
361+
let mut v = ~[];
362+
let pushf = |e| {v.push(e); true};
363+
pusher(pushf);
364+
v
365+
}
366+
367+
#[test]
368+
fn test_iter_to_vec() {
369+
let v = ~[1, 2, 3];
370+
let v2 = do iter_to_vec |f| { v.each(|e| f(*e)) };
371+
if v != v2 { fail!() }
372+
}

0 commit comments

Comments
 (0)