Skip to content

Commit 01103c5

Browse files
committed
---
yaml --- r: 67261 b: refs/heads/master c: 92eb52d h: refs/heads/master i: 67259: 61f5be6 v: v3
1 parent 82affd8 commit 01103c5

32 files changed

+843
-879
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: 1f9255751252b5d2b1f55af921896c43764fe52f
2+
refs/heads/master: 92eb52d17251e7ad141aeaf422dcec7c10d5e61c
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 18e3db7392d2d0697b7e27d6d986139960144d85
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9

trunk/doc/tutorial.md

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -499,8 +499,8 @@ types.
499499
> items.
500500
501501
~~~~
502-
use std::float;
503-
use std::num::atan;
502+
# use std::float;
503+
# use std::num::atan;
504504
fn angle(vector: (float, float)) -> float {
505505
let pi = float::consts::pi;
506506
match vector {
@@ -555,7 +555,7 @@ while cake_amount > 0 {
555555
`loop` denotes an infinite loop, and is the preferred way of writing `while true`:
556556

557557
~~~~
558-
use std::int;
558+
# use std::int;
559559
let mut x = 5;
560560
loop {
561561
x += x - 3;
@@ -701,7 +701,7 @@ get at their contents. All variant constructors can be used as
701701
patterns, as in this definition of `area`:
702702

703703
~~~~
704-
use std::float;
704+
# use std::float;
705705
# struct Point {x: float, y: float}
706706
# enum Shape { Circle(Point, float), Rectangle(Point, Point) }
707707
fn area(sh: Shape) -> float {
@@ -733,7 +733,7 @@ fn point_from_direction(dir: Direction) -> Point {
733733
Enum variants may also be structs. For example:
734734

735735
~~~~
736-
use std::float;
736+
# use std::float;
737737
# struct Point { x: float, y: float }
738738
# fn square(x: float) -> float { x * x }
739739
enum Shape {
@@ -1599,8 +1599,7 @@ lists back to back. Since that is so unsightly, empty argument lists
15991599
may be omitted from `do` expressions.
16001600

16011601
~~~~
1602-
use std::task::spawn;
1603-
1602+
# use std::task::spawn;
16041603
do spawn {
16051604
debug!("Kablam!");
16061605
}
@@ -1729,7 +1728,7 @@ impl Circle {
17291728
To call such a method, just prefix it with the type name and a double colon:
17301729

17311730
~~~~
1732-
use std::float::consts::pi;
1731+
# use std::float::consts::pi;
17331732
struct Circle { radius: float }
17341733
impl Circle {
17351734
fn new(area: float) -> Circle { Circle { radius: (area / pi).sqrt() } }
@@ -1775,7 +1774,7 @@ illegal to copy and pass by value.
17751774
Generic `type`, `struct`, and `enum` declarations follow the same pattern:
17761775

17771776
~~~~
1778-
use std::hashmap::HashMap;
1777+
# use std::hashmap::HashMap;
17791778
type Set<T> = HashMap<T, ()>;
17801779
17811780
struct Stack<T> {
@@ -2001,7 +2000,7 @@ name and a double colon. The compiler uses type inference to decide which
20012000
implementation to use.
20022001

20032002
~~~~
2004-
use std::float::consts::pi;
2003+
# use std::float::consts::pi;
20052004
trait Shape { fn new(area: float) -> Self; }
20062005
struct Circle { radius: float }
20072006
struct Square { length: float }
@@ -2157,7 +2156,7 @@ trait Circle : Shape { fn radius(&self) -> float; }
21572156
Now, we can implement `Circle` on a type only if we also implement `Shape`.
21582157

21592158
~~~~
2160-
use std::float::consts::pi;
2159+
# use std::float::consts::pi;
21612160
# trait Shape { fn area(&self) -> float; }
21622161
# trait Circle : Shape { fn radius(&self) -> float; }
21632162
# struct Point { x: float, y: float }
@@ -2192,7 +2191,7 @@ fn radius_times_area<T: Circle>(c: T) -> float {
21922191
Likewise, supertrait methods may also be called on trait objects.
21932192

21942193
~~~ {.xfail-test}
2195-
use std::float::consts::pi;
2194+
# use std::float::consts::pi;
21962195
# trait Shape { fn area(&self) -> float; }
21972196
# trait Circle : Shape { fn radius(&self) -> float; }
21982197
# struct Point { x: float, y: float }

trunk/mk/tests.mk

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -537,10 +537,6 @@ TEST_SREQ$(1)_T_$(2)_H_$(3) = \
537537

538538
# Rules for the cfail/rfail/rpass/bench/perf test runner
539539

540-
# The tests select when to use debug configuration on their own;
541-
# remove directive, if present, from CFG_RUSTC_FLAGS (issue #7898).
542-
CTEST_RUSTC_FLAGS = $$(subst --cfg debug,,$$(CFG_RUSTC_FLAGS))
543-
544540
CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) := \
545541
--compile-lib-path $$(HLIB$(1)_H_$(3)) \
546542
--run-lib-path $$(TLIB$(1)_T_$(2)_H_$(3)) \
@@ -552,7 +548,7 @@ CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) := \
552548
--target $(2) \
553549
--adb-path=$(CFG_ADB) \
554550
--adb-test-dir=$(CFG_ADB_TEST_DIR) \
555-
--rustcflags "$(RUSTC_FLAGS_$(2)) $$(CTEST_RUSTC_FLAGS) --target=$(2)" \
551+
--rustcflags "$(RUSTC_FLAGS_$(2)) $$(CFG_RUSTC_FLAGS) --target=$(2)" \
556552
$$(CTEST_TESTARGS)
557553

558554
CTEST_DEPS_rpass_$(1)-T-$(2)-H-$(3) = $$(RPASS_TESTS)

trunk/src/etc/emacs/README.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,3 @@ marking, press x, and ELPA will install the packages for you (under
9898
~/.emacs.d/elpa/).
9999

100100
* or using <kbd>M-x package-install rust-mode
101-
102-
### Known bugs
103-
104-
* Combining `global-whitespace-mode` and `rust-mode` is generally glitchy.
105-
See [Issue #3994](https://github.com/mozilla/rust/issues/3994).

trunk/src/libextra/json.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ pub enum Json {
4141
}
4242

4343
pub type List = ~[Json];
44-
pub type Object = TreeMap<~str, Json>;
44+
pub type Object = HashMap<~str, Json>;
4545

4646
#[deriving(Eq)]
4747
/// If an error occurs while parsing some JSON, this is the structure which is
@@ -809,7 +809,7 @@ impl<T : iterator::Iterator<char>> Parser<T> {
809809
self.bump();
810810
self.parse_whitespace();
811811

812-
let mut values = ~TreeMap::new();
812+
let mut values = ~HashMap::new();
813813

814814
if self.ch == '}' {
815815
self.bump();
@@ -1087,7 +1087,7 @@ impl serialize::Decoder for Decoder {
10871087
let len = match self.stack.pop() {
10881088
Object(obj) => {
10891089
let len = obj.len();
1090-
for obj.consume_iter().advance |(key, value)| {
1090+
for obj.consume().advance |(key, value)| {
10911091
self.stack.push(value);
10921092
self.stack.push(String(key));
10931093
}
@@ -1294,19 +1294,19 @@ impl<A:ToJson> ToJson for ~[A] {
12941294
fn to_json(&self) -> Json { List(self.map(|elt| elt.to_json())) }
12951295
}
12961296

1297-
impl<A:ToJson> ToJson for TreeMap<~str, A> {
1297+
impl<A:ToJson> ToJson for HashMap<~str, A> {
12981298
fn to_json(&self) -> Json {
1299-
let mut d = TreeMap::new();
1299+
let mut d = HashMap::new();
13001300
for self.iter().advance |(key, value)| {
13011301
d.insert((*key).clone(), value.to_json());
13021302
}
13031303
Object(~d)
13041304
}
13051305
}
13061306

1307-
impl<A:ToJson> ToJson for HashMap<~str, A> {
1307+
impl<A:ToJson> ToJson for TreeMap<~str, A> {
13081308
fn to_json(&self) -> Json {
1309-
let mut d = TreeMap::new();
1309+
let mut d = HashMap::new();
13101310
for self.iter().advance |(key, value)| {
13111311
d.insert((*key).clone(), value.to_json());
13121312
}
@@ -1338,11 +1338,11 @@ mod tests {
13381338

13391339
use super::*;
13401340

1341+
use std::hashmap::HashMap;
13411342
use std::io;
13421343
use std::result;
13431344

1344-
use serialize::Decodable;
1345-
use treemap::TreeMap;
1345+
use extra::serialize::Decodable;
13461346

13471347
#[deriving(Eq, Encodable, Decodable)]
13481348
enum Animal {
@@ -1363,7 +1363,7 @@ mod tests {
13631363
}
13641364

13651365
fn mk_object(items: &[(~str, Json)]) -> Json {
1366-
let mut d = ~TreeMap::new();
1366+
let mut d = ~HashMap::new();
13671367

13681368
for items.iter().advance |item| {
13691369
match *item {
@@ -1954,7 +1954,7 @@ mod tests {
19541954
fn test_decode_map() {
19551955
let s = ~"{\"a\": \"Dog\", \"b\": [\"Frog\", \"Henry\", 349]}";
19561956
let mut decoder = Decoder(from_str(s).unwrap());
1957-
let mut map: TreeMap<~str, Animal> = Decodable::decode(&mut decoder);
1957+
let mut map: HashMap<~str, Animal> = Decodable::decode(&mut decoder);
19581958
19591959
assert_eq!(map.pop(&~"a"), Some(Dog));
19601960
assert_eq!(map.pop(&~"b"), Some(Frog(~"Henry", 349)));

trunk/src/libextra/test.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ use std::task;
3838
use std::to_str::ToStr;
3939
use std::u64;
4040
use std::f64;
41+
use std::hashmap::HashMap;
4142
use std::os;
4243

4344

@@ -851,7 +852,7 @@ fn calc_result(desc: &TestDesc, task_succeeded: bool) -> TestResult {
851852

852853
impl ToJson for Metric {
853854
fn to_json(&self) -> json::Json {
854-
let mut map = ~TreeMap::new();
855+
let mut map = ~HashMap::new();
855856
map.insert(~"value", json::Number(self.value as float));
856857
map.insert(~"noise", json::Number(self.noise as float));
857858
json::Object(map)

trunk/src/libextra/treemap.rs

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -204,19 +204,6 @@ impl<K: TotalOrd, V> TreeMap<K, V> {
204204
pub fn iter<'a>(&'a self) -> TreeMapIterator<'a, K, V> {
205205
TreeMapIterator{stack: ~[], node: &self.root, remaining: self.length}
206206
}
207-
208-
/// Get a lazy iterator that consumes the treemap.
209-
pub fn consume_iter(self) -> TreeMapConsumeIterator<K, V> {
210-
let TreeMap { root: root, length: length } = self;
211-
let stk = match root {
212-
None => ~[],
213-
Some(~tn) => ~[tn]
214-
};
215-
TreeMapConsumeIterator {
216-
stack: stk,
217-
remaining: length
218-
}
219-
}
220207
}
221208

222209
/// Lazy forward iterator over a map
@@ -254,56 +241,6 @@ impl<'self, K, V> Iterator<(&'self K, &'self V)> for TreeMapIterator<'self, K, V
254241
}
255242
}
256243

257-
/// Lazy forward iterator over a map that consumes the map while iterating
258-
pub struct TreeMapConsumeIterator<K, V> {
259-
priv stack: ~[TreeNode<K, V>],
260-
priv remaining: uint
261-
}
262-
263-
impl<K, V> Iterator<(K, V)> for TreeMapConsumeIterator<K,V> {
264-
#[inline]
265-
fn next(&mut self) -> Option<(K, V)> {
266-
while !self.stack.is_empty() {
267-
let TreeNode {
268-
key: key,
269-
value: value,
270-
left: left,
271-
right: right,
272-
level: level
273-
} = self.stack.pop();
274-
275-
match left {
276-
Some(~left) => {
277-
let n = TreeNode {
278-
key: key,
279-
value: value,
280-
left: None,
281-
right: right,
282-
level: level
283-
};
284-
self.stack.push(n);
285-
self.stack.push(left);
286-
}
287-
None => {
288-
match right {
289-
Some(~right) => self.stack.push(right),
290-
None => ()
291-
}
292-
self.remaining -= 1;
293-
return Some((key, value))
294-
}
295-
}
296-
}
297-
None
298-
}
299-
300-
#[inline]
301-
fn size_hint(&self) -> (uint, Option<uint>) {
302-
(self.remaining, Some(self.remaining))
303-
}
304-
305-
}
306-
307244
impl<'self, T> Iterator<&'self T> for TreeSetIterator<'self, T> {
308245
/// Advance the iterator to the next node (in order). If there are no more nodes, return `None`.
309246
#[inline]

0 commit comments

Comments
 (0)