Skip to content

Commit 6fc9a78

Browse files
committed
---
yaml --- r: 75775 b: refs/heads/master c: 00dd9e9 h: refs/heads/master i: 75773: 45bb3da 75771: d4b2657 75767: 511cd64 75759: 7a1f493 75743: 5ba28a0 75711: 50e4b47 75647: 81f4035 75519: 44f5850 75263: 293f921 74751: 40c4c83 73727: d50f3f3 v: v3
1 parent b00f675 commit 6fc9a78

Some content is hidden

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

47 files changed

+345
-324
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: 0f6e90a5fd7a19382e3d3028bfcc36eb57135515
2+
refs/heads/master: 00dd9e9cc57d1925df8362d02c6504b01d8105e3
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 67c954e365970e4c2cd06f0c50724656d7010f45
55
refs/heads/try: 10089455287dcc3652b984ab4bfd6971e1b5f302

trunk/configure

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,6 @@ do
739739
make_dir $h/test/doc-tutorial-ffi
740740
make_dir $h/test/doc-tutorial-macros
741741
make_dir $h/test/doc-tutorial-borrowed-ptr
742-
make_dir $h/test/doc-tutorial-container
743742
make_dir $h/test/doc-tutorial-tasks
744743
make_dir $h/test/doc-tutorial-conditions
745744
make_dir $h/test/doc-rust

trunk/doc/rust.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2864,16 +2864,17 @@ the vtable pointer for the `T` implementation of `R`, and the pointer value of `
28642864
An example of an object type:
28652865

28662866
~~~~~~~~
2867+
# use std::int;
28672868
trait Printable {
2868-
fn to_string(&self) -> ~str;
2869+
fn to_str(&self) -> ~str;
28692870
}
28702871
28712872
impl Printable for int {
2872-
fn to_string(&self) -> ~str { self.to_str() }
2873+
fn to_str(&self) -> ~str { int::to_str(*self) }
28732874
}
28742875
28752876
fn print(a: @Printable) {
2876-
println(a.to_string());
2877+
println(a.to_str());
28772878
}
28782879
28792880
fn main() {

trunk/doc/tutorial-container.md

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ assert_eq!(sum, 57);
163163
The `for` keyword can be used as sugar for iterating through any iterator:
164164
165165
~~~
166-
let xs = [2u, 3, 5, 7, 11, 13, 17];
166+
let xs = [2, 3, 5, 7, 11, 13, 17];
167167

168168
// print out all the elements in the vector
169169
for x in xs.iter() {
@@ -219,7 +219,7 @@ Containers can provide conversion from iterators through `collect` by
219219
implementing the `FromIterator` trait. For example, the implementation for
220220
vectors is as follows:
221221
222-
~~~ {.xfail-test}
222+
~~~
223223
impl<A> FromIterator<A> for ~[A] {
224224
pub fn from_iterator<T: Iterator<A>>(iterator: &mut T) -> ~[A] {
225225
let (lower, _) = iterator.size_hint();
@@ -237,7 +237,7 @@ impl<A> FromIterator<A> for ~[A] {
237237
The `Iterator` trait provides a `size_hint` default method, returning a lower
238238
bound and optionally on upper bound on the length of the iterator:
239239
240-
~~~ {.xfail-test}
240+
~~~
241241
fn size_hint(&self) -> (uint, Option<uint>) { (0, None) }
242242
~~~
243243
@@ -319,16 +319,6 @@ for x in it.invert() {
319319
}
320320
~~~
321321
322-
The `reverse_` method is also available for any double-ended iterator yielding
323-
mutable references. It can be used to reverse a container in-place. Note that
324-
the trailing underscore is a workaround for issue #5898 and will be removed.
325-
326-
~~~
327-
let mut ys = [1, 2, 3, 4, 5];
328-
ys.mut_iter().reverse_();
329-
assert_eq!(ys, [5, 4, 3, 2, 1]);
330-
~~~
331-
332322
## Random-access iterators
333323
334324
The `RandomAccessIterator` trait represents an iterator offering random access

trunk/doc/tutorial.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -555,11 +555,12 @@ while cake_amount > 0 {
555555
`loop` denotes an infinite loop, and is the preferred way of writing `while true`:
556556

557557
~~~~
558-
let mut x = 5u;
558+
use std::int;
559+
let mut x = 5;
559560
loop {
560561
x += x - 3;
561562
if x % 5 == 0 { break; }
562-
println(x.to_str());
563+
println(int::to_str(x));
563564
}
564565
~~~~
565566

trunk/mk/tests.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ TEST_CRATES = $(TEST_TARGET_CRATES) $(TEST_HOST_CRATES)
2020

2121
# Markdown files under doc/ that should have their code extracted and run
2222
DOC_TEST_NAMES = tutorial tutorial-ffi tutorial-macros tutorial-borrowed-ptr \
23-
tutorial-tasks tutorial-conditions tutorial-container rust
23+
tutorial-tasks tutorial-conditions rust
2424

2525
######################################################################
2626
# Environment configuration

trunk/src/libextra/crypto/digest.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
use std::uint;
1112
use std::vec;
1213

1314

@@ -70,7 +71,7 @@ pub trait Digest {
7071
fn to_hex(rr: &[u8]) -> ~str {
7172
let mut s = ~"";
7273
for b in rr.iter() {
73-
let hex = (*b as uint).to_str_radix(16u);
74+
let hex = uint::to_str_radix(*b as uint, 16u);
7475
if hex.len() == 1 {
7576
s.push_char('0');
7677
}

trunk/src/libextra/extra.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ pub mod flatpipes;
5555

5656
pub mod container;
5757
pub mod bitv;
58+
pub mod fun_treemap;
5859
pub mod list;
5960
pub mod ringbuf;
6061
pub mod priority_queue;

trunk/src/libextra/fun_treemap.rs

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
/*!
12+
* A functional key,value store that works on anything.
13+
*
14+
* This works using a binary search tree. In the first version, it's a
15+
* very naive algorithm, but it will probably be updated to be a
16+
* red-black tree or something else.
17+
*
18+
* This is copied and modified from treemap right now. It's missing a lot
19+
* of features.
20+
*/
21+
22+
23+
use std::cmp::{Eq, Ord};
24+
use std::option::{Some, None};
25+
26+
pub type Treemap<K, V> = @TreeNode<K, V>;
27+
28+
enum TreeNode<K, V> {
29+
Empty,
30+
Node(@K, @V, @TreeNode<K, V>, @TreeNode<K, V>)
31+
}
32+
33+
/// Create a treemap
34+
pub fn init<K: 'static, V: 'static>() -> Treemap<K, V> {
35+
@Empty
36+
}
37+
38+
/// Insert a value into the map
39+
pub fn insert<K:Eq + Ord + 'static,
40+
V:'static>(
41+
m: Treemap<K, V>,
42+
k: K,
43+
v: V)
44+
-> Treemap<K, V> {
45+
@match m {
46+
@Empty => Node(@k, @v, @Empty, @Empty),
47+
@Node(kk, vv, left, right) => cond!(
48+
(k < *kk) { Node(kk, vv, insert(left, k, v), right) }
49+
(k == *kk) { Node(kk, @v, left, right) }
50+
_ { Node(kk, vv, left, insert(right, k, v)) }
51+
)
52+
}
53+
}
54+
55+
/// Find a value based on the key
56+
pub fn find<K:Eq + Ord + 'static,
57+
V:Clone + 'static>(
58+
m: Treemap<K, V>,
59+
k: K)
60+
-> Option<V> {
61+
match *m {
62+
Empty => None,
63+
Node(kk, v, left, right) => cond!(
64+
(k == *kk) { Some((*v).clone()) }
65+
(k < *kk) { find(left, k) }
66+
_ { find(right, k) }
67+
)
68+
}
69+
}
70+
71+
/// Visit all pairs in the map in order.
72+
pub fn traverse<K, V>(m: Treemap<K, V>, f: &fn(&K, &V)) {
73+
match *m {
74+
Empty => (),
75+
// Previously, this had what looked like redundant
76+
// matches to me, so I changed it. but that may be a
77+
// de-optimization -- tjc
78+
Node(@ref k, @ref v, left, right) => {
79+
traverse(left, |k,v| f(k,v));
80+
f(k, v);
81+
traverse(right, |k,v| f(k,v));
82+
}
83+
}
84+
}

trunk/src/libextra/md4.rs

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

1111

12+
use std::uint;
1213
use std::vec;
1314

1415
struct Quad {
@@ -120,7 +121,7 @@ pub fn md4_str(msg: &[u8]) -> ~str {
120121
if byte <= 16u8 {
121122
result.push_char('0')
122123
}
123-
result.push_str((byte as uint).to_str_radix(16u));
124+
result.push_str(uint::to_str_radix(byte as uint, 16u));
124125
i += 1u32;
125126
}
126127
}

trunk/src/libextra/num/bigint.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ impl ToStrRadix for BigUint {
525525
if v.is_empty() { return ~"0" }
526526
let mut s = str::with_capacity(v.len() * l);
527527
for n in v.rev_iter() {
528-
let ss = (*n as uint).to_str_radix(radix);
528+
let ss = uint::to_str_radix(*n as uint, radix);
529529
s.push_str("0".repeat(l - ss.len()));
530530
s.push_str(ss);
531531
}

trunk/src/libextra/time.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
#[allow(missing_doc)];
1212

13+
14+
use std::int;
1315
use std::io;
1416
use std::num;
1517
use std::str;
@@ -822,7 +824,7 @@ fn do_strftime(format: &str, tm: &Tm) -> ~str {
822824
//'U' {}
823825
'u' => {
824826
let i = tm.tm_wday as int;
825-
(if i == 0 { 7 } else { i }).to_str()
827+
int::to_str(if i == 0 { 7 } else { i })
826828
}
827829
//'V' {}
828830
'v' => {
@@ -832,10 +834,10 @@ fn do_strftime(format: &str, tm: &Tm) -> ~str {
832834
parse_type('Y', tm))
833835
}
834836
//'W' {}
835-
'w' => (tm.tm_wday as int).to_str(),
837+
'w' => int::to_str(tm.tm_wday as int),
836838
//'X' {}
837839
//'x' {}
838-
'Y' => (tm.tm_year as int + 1900).to_str(),
840+
'Y' => int::to_str(tm.tm_year as int + 1900),
839841
'y' => fmt!("%02d", (tm.tm_year as int + 1900) % 100),
840842
'Z' => tm.tm_zone.clone(),
841843
'z' => {

trunk/src/librustc/driver/driver.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ use util::common::time;
2626
use util::ppaux;
2727

2828
use std::hashmap::{HashMap,HashSet};
29+
use std::int;
2930
use std::io;
3031
use std::os;
3132
use std::vec;
@@ -453,21 +454,21 @@ pub fn pretty_print_input(sess: Session, cfg: ast::CrateConfig, input: &input,
453454
match node {
454455
pprust::node_item(s, item) => {
455456
pp::space(s.s);
456-
pprust::synth_comment(s, item.id.to_str());
457+
pprust::synth_comment(s, int::to_str(item.id));
457458
}
458459
pprust::node_block(s, ref blk) => {
459460
pp::space(s.s);
460461
pprust::synth_comment(
461-
s, ~"block " + blk.id.to_str());
462+
s, ~"block " + int::to_str(blk.id));
462463
}
463464
pprust::node_expr(s, expr) => {
464465
pp::space(s.s);
465-
pprust::synth_comment(s, expr.id.to_str());
466+
pprust::synth_comment(s, int::to_str(expr.id));
466467
pprust::pclose(s);
467468
}
468469
pprust::node_pat(s, pat) => {
469470
pp::space(s.s);
470-
pprust::synth_comment(s, ~"pat " + pat.id.to_str());
471+
pprust::synth_comment(s, ~"pat " + int::to_str(pat.id));
471472
}
472473
}
473474
}

trunk/src/librustc/metadata/encoder.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ use std::hash::HashUtil;
2525
use std::hashmap::{HashMap, HashSet};
2626
use std::io;
2727
use std::str;
28+
use std::uint;
2829
use std::vec;
2930
use extra::flate;
3031
use extra::serialize::Encodable;
@@ -302,7 +303,7 @@ fn encode_disr_val(_: &EncodeContext,
302303
ebml_w: &mut writer::Encoder,
303304
disr_val: uint) {
304305
ebml_w.start_tag(tag_disr_val);
305-
let s = disr_val.to_str();
306+
let s = uint::to_str(disr_val);
306307
ebml_w.writer.write(s.as_bytes());
307308
ebml_w.end_tag();
308309
}

trunk/src/librustc/metadata/tyencode.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ use middle::ty;
1717
use std::hashmap::HashMap;
1818
use std::io::WriterUtil;
1919
use std::io;
20+
use std::uint;
2021
use syntax::abi::AbiSet;
2122
use syntax::ast;
2223
use syntax::ast::*;
@@ -323,7 +324,7 @@ fn enc_sty(w: @io::Writer, cx: @ctxt, st: &ty::sty) {
323324
w.write_char('p');
324325
w.write_str((cx.ds)(did));
325326
w.write_char('|');
326-
w.write_str(id.to_str());
327+
w.write_str(uint::to_str(id));
327328
}
328329
ty::ty_self(did) => {
329330
w.write_char('s');

trunk/src/librustc/middle/trans/base.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ use std::hash;
7171
use std::hashmap::HashMap;
7272
use std::io;
7373
use std::libc::c_uint;
74+
use std::uint;
7475
use std::vec;
7576
use std::local_data;
7677
use extra::time;
@@ -718,7 +719,7 @@ pub fn iter_structural_ty(cx: @mut Block, av: ValueRef, t: ty::t,
718719
for variant in (*variants).iter() {
719720
let variant_cx =
720721
sub_block(cx, ~"enum-iter-variant-" +
721-
variant.disr_val.to_str());
722+
uint::to_str(variant.disr_val));
722723
let variant_cx =
723724
iter_variant(variant_cx, repr, av, *variant,
724725
substs.tps, |x,y,z| f(x,y,z));

trunk/src/librustc/middle/ty.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ use std::ops;
3333
use std::ptr::to_unsafe_ptr;
3434
use std::to_bytes;
3535
use std::to_str::ToStr;
36+
use std::u32;
3637
use std::vec;
3738
use syntax::ast::*;
3839
use syntax::ast_util::is_local;
@@ -1943,7 +1944,7 @@ impl ops::Sub<TypeContents,TypeContents> for TypeContents {
19431944

19441945
impl ToStr for TypeContents {
19451946
fn to_str(&self) -> ~str {
1946-
fmt!("TypeContents(%s)", self.bits.to_str_radix(2))
1947+
fmt!("TypeContents(%s)", u32::to_str_radix(self.bits, 2))
19471948
}
19481949
}
19491950

trunk/src/librustc/middle/typeck/infer/to_str.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ use middle::typeck::infer::InferCtxt;
1717
use middle::typeck::infer::unify::{Redirect, Root, VarValue};
1818
use util::ppaux::{mt_to_str, ty_to_str, trait_ref_to_str};
1919

20+
use std::uint;
2021
use syntax::ast;
2122

2223
pub trait InferStr {
@@ -71,7 +72,7 @@ impl<V:Vid + ToStr,T:InferStr> InferStr for VarValue<V, T> {
7172
match *self {
7273
Redirect(ref vid) => fmt!("Redirect(%s)", vid.to_str()),
7374
Root(ref pt, rk) => fmt!("Root(%s, %s)", pt.inf_str(cx),
74-
rk.to_str_radix(10u))
75+
uint::to_str_radix(rk, 10u))
7576
}
7677
}
7778
}

trunk/src/libstd/container.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ pub trait Map<K, V>: Container {
3838
fn find<'a>(&'a self, key: &K) -> Option<&'a V>;
3939

4040
/// Return true if the map contains a value for the specified key
41-
#[inline]
4241
fn contains_key(&self, key: &K) -> bool {
4342
self.find(key).is_some()
4443
}

0 commit comments

Comments
 (0)