diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2013-03-12 13:00:50 -0700 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2013-03-13 20:07:09 -0700 |
| commit | b1c699815ddf22bf17b58a8c3d317af33745e28d (patch) | |
| tree | 164b9b4cb10ca38a8908c2b3d84f56f2a0cb78fb /src/libstd | |
| parent | 24a0de4e7f26d5bbd071fbec5b3958b650cd3f56 (diff) | |
| download | rust-b1c699815ddf22bf17b58a8c3d317af33745e28d.tar.gz rust-b1c699815ddf22bf17b58a8c3d317af33745e28d.zip | |
librustc: Don't accept `as Trait` anymore; fix all occurrences of it.
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/bitv.rs | 2 | ||||
| -rw-r--r-- | src/libstd/ebml.rs | 8 | ||||
| -rw-r--r-- | src/libstd/flatpipes.rs | 12 | ||||
| -rw-r--r-- | src/libstd/json.rs | 20 | ||||
| -rw-r--r-- | src/libstd/net_tcp.rs | 2 | ||||
| -rw-r--r-- | src/libstd/oldmap.rs | 2 | ||||
| -rw-r--r-- | src/libstd/prettyprint.rs | 4 | ||||
| -rw-r--r-- | src/libstd/semver.rs | 9 | ||||
| -rw-r--r-- | src/libstd/sort.rs | 2 | ||||
| -rw-r--r-- | src/libstd/tempfile.rs | 1 | ||||
| -rw-r--r-- | src/libstd/term.rs | 10 | ||||
| -rw-r--r-- | src/libstd/test.rs | 21 | ||||
| -rw-r--r-- | src/libstd/timer.rs | 1 | ||||
| -rw-r--r-- | src/libstd/treemap.rs | 1 |
14 files changed, 51 insertions, 44 deletions
diff --git a/src/libstd/bitv.rs b/src/libstd/bitv.rs index 8dbdb83698c..9cf2d145eac 100644 --- a/src/libstd/bitv.rs +++ b/src/libstd/bitv.rs @@ -1424,7 +1424,7 @@ mod tests { fail_unless!(a.capacity() == uint::bits); } - fn rng() -> rand::Rng { + fn rng() -> @rand::Rng { let seed = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]; rand::seeded_rng(seed) } diff --git a/src/libstd/ebml.rs b/src/libstd/ebml.rs index a55d4bc97ec..4ab119abf1c 100644 --- a/src/libstd/ebml.rs +++ b/src/libstd/ebml.rs @@ -415,11 +415,11 @@ pub mod writer { // ebml writing pub struct Encoder { - writer: io::Writer, + writer: @io::Writer, priv mut size_positions: ~[uint], } - fn write_sized_vuint(w: io::Writer, n: uint, size: uint) { + fn write_sized_vuint(w: @io::Writer, n: uint, size: uint) { match size { 1u => w.write(&[0x80u8 | (n as u8)]), 2u => w.write(&[0x40u8 | ((n >> 8_u) as u8), n as u8]), @@ -431,7 +431,7 @@ pub mod writer { }; } - fn write_vuint(w: io::Writer, n: uint) { + fn write_vuint(w: @io::Writer, n: uint) { if n < 0x7f_u { write_sized_vuint(w, n, 1u); return; } if n < 0x4000_u { write_sized_vuint(w, n, 2u); return; } if n < 0x200000_u { write_sized_vuint(w, n, 3u); return; } @@ -439,7 +439,7 @@ pub mod writer { fail!(fmt!("vint to write too big: %?", n)); } - pub fn Encoder(w: io::Writer) -> Encoder { + pub fn Encoder(w: @io::Writer) -> Encoder { let size_positions: ~[uint] = ~[]; Encoder { writer: w, mut size_positions: size_positions } } diff --git a/src/libstd/flatpipes.rs b/src/libstd/flatpipes.rs index 897cb4c2034..e2e09f1d675 100644 --- a/src/libstd/flatpipes.rs +++ b/src/libstd/flatpipes.rs @@ -459,15 +459,15 @@ pub mod flatteners { } pub trait FromReader { - static fn from_reader(r: Reader) -> Self; + static fn from_reader(r: @Reader) -> Self; } pub trait FromWriter { - static fn from_writer(w: Writer) -> Self; + static fn from_writer(w: @Writer) -> Self; } impl FromReader for json::Decoder/&self { - static fn from_reader(r: Reader) -> json::Decoder/&self { + static fn from_reader(r: @Reader) -> json::Decoder/&self { match json::from_reader(r) { Ok(json) => { json::Decoder(json) @@ -478,13 +478,13 @@ pub mod flatteners { } impl FromWriter for json::Encoder { - static fn from_writer(w: Writer) -> json::Encoder { + static fn from_writer(w: @Writer) -> json::Encoder { json::Encoder(w) } } impl FromReader for ebml::reader::Decoder { - static fn from_reader(r: Reader) -> ebml::reader::Decoder { + static fn from_reader(r: @Reader) -> ebml::reader::Decoder { let buf = @r.read_whole_stream(); let doc = ebml::reader::Doc(buf); ebml::reader::Decoder(doc) @@ -492,7 +492,7 @@ pub mod flatteners { } impl FromWriter for ebml::writer::Encoder { - static fn from_writer(w: Writer) -> ebml::writer::Encoder { + static fn from_writer(w: @Writer) -> ebml::writer::Encoder { ebml::writer::Encoder(w) } } diff --git a/src/libstd/json.rs b/src/libstd/json.rs index 8c6a870b98c..56f2611c914 100644 --- a/src/libstd/json.rs +++ b/src/libstd/json.rs @@ -74,10 +74,10 @@ fn spaces(n: uint) -> ~str { } pub struct Encoder { - priv wr: io::Writer, + priv wr: @io::Writer, } -pub fn Encoder(wr: io::Writer) -> Encoder { +pub fn Encoder(wr: @io::Writer) -> Encoder { Encoder { wr: wr } } @@ -208,11 +208,11 @@ impl serialize::Encoder for Encoder { } pub struct PrettyEncoder { - priv wr: io::Writer, + priv wr: @io::Writer, priv mut indent: uint, } -pub fn PrettyEncoder(wr: io::Writer) -> PrettyEncoder { +pub fn PrettyEncoder(wr: @io::Writer) -> PrettyEncoder { PrettyEncoder { wr: wr, indent: 0 } } @@ -346,7 +346,7 @@ impl<S:serialize::Encoder> serialize::Encodable<S> for Json { } /// Encodes a json value into a io::writer -pub fn to_writer(wr: io::Writer, json: &Json) { +pub fn to_writer(wr: @io::Writer, json: &Json) { json.encode(&Encoder(wr)) } @@ -359,7 +359,7 @@ pub pure fn to_str(json: &Json) -> ~str { } /// Encodes a json value into a io::writer -pub fn to_pretty_writer(wr: io::Writer, json: &Json) { +pub fn to_pretty_writer(wr: @io::Writer, json: &Json) { json.encode(&PrettyEncoder(wr)) } @@ -369,14 +369,14 @@ pub fn to_pretty_str(json: &Json) -> ~str { } pub struct Parser { - priv rdr: io::Reader, + priv rdr: @io::Reader, priv mut ch: char, priv mut line: uint, priv mut col: uint, } /// Decode a json value from an io::reader -pub fn Parser(rdr: io::Reader) -> Parser { +pub fn Parser(rdr: @io::Reader) -> Parser { Parser { rdr: rdr, ch: rdr.read_char(), @@ -734,8 +734,8 @@ priv impl Parser { } } -/// Decodes a json value from an io::reader -pub fn from_reader(rdr: io::Reader) -> Result<Json, Error> { +/// Decodes a json value from an @io::Reader +pub fn from_reader(rdr: @io::Reader) -> Result<Json, Error> { Parser(rdr).parse() } diff --git a/src/libstd/net_tcp.rs b/src/libstd/net_tcp.rs index 0224927df57..54fbae956ce 100644 --- a/src/libstd/net_tcp.rs +++ b/src/libstd/net_tcp.rs @@ -1799,7 +1799,7 @@ pub mod test { let sock_buf = @socket_buf(result::unwrap(conn_result)); buf_write(sock_buf, expected_req); - let buf_reader = sock_buf as Reader; + let buf_reader = sock_buf as @Reader; let actual_response = str::from_bytes(buf_reader.read_whole_stream()); debug!("Actual response: %s", actual_response); fail_unless!(expected_resp == actual_response); diff --git a/src/libstd/oldmap.rs b/src/libstd/oldmap.rs index 18527cfece1..6a234b9dc9b 100644 --- a/src/libstd/oldmap.rs +++ b/src/libstd/oldmap.rs @@ -326,7 +326,7 @@ pub mod chained { } pub impl<K:Eq + IterBytes + Hash + Copy + ToStr,V:ToStr + Copy> T<K, V> { - fn to_writer(&self, wr: io::Writer) { + fn to_writer(&self, wr: @io::Writer) { if self.count == 0u { wr.write_str(~"{}"); return; diff --git a/src/libstd/prettyprint.rs b/src/libstd/prettyprint.rs index d2d80eb7da8..f823d73cf0b 100644 --- a/src/libstd/prettyprint.rs +++ b/src/libstd/prettyprint.rs @@ -14,10 +14,10 @@ use core::io::WriterUtil; use core::io; pub struct Serializer { - wr: io::Writer, + wr: @io::Writer, } -pub fn Serializer(wr: io::Writer) -> Serializer { +pub fn Serializer(wr: @io::Writer) -> Serializer { Serializer { wr: wr } } diff --git a/src/libstd/semver.rs b/src/libstd/semver.rs index 7b8a06f1b93..85996c8ac4a 100644 --- a/src/libstd/semver.rs +++ b/src/libstd/semver.rs @@ -138,7 +138,7 @@ condition! { bad_parse: () -> (); } -fn take_nonempty_prefix(rdr: io::Reader, +fn take_nonempty_prefix(rdr: @io::Reader, ch: char, pred: &fn(char) -> bool) -> (~str, char) { let mut buf = ~""; @@ -154,7 +154,7 @@ fn take_nonempty_prefix(rdr: io::Reader, (buf, ch) } -fn take_num(rdr: io::Reader, ch: char) -> (uint, char) { +fn take_num(rdr: @io::Reader, ch: char) -> (uint, char) { let (s, ch) = take_nonempty_prefix(rdr, ch, char::is_digit); match uint::from_str(s) { None => { bad_parse::cond.raise(()); (0, ch) }, @@ -162,7 +162,7 @@ fn take_num(rdr: io::Reader, ch: char) -> (uint, char) { } } -fn take_ident(rdr: io::Reader, ch: char) -> (Identifier, char) { +fn take_ident(rdr: @io::Reader, ch: char) -> (Identifier, char) { let (s,ch) = take_nonempty_prefix(rdr, ch, char::is_alphanumeric); if s.all(char::is_digit) { match uint::from_str(s) { @@ -180,8 +180,7 @@ fn expect(ch: char, c: char) { } } -fn parse_reader(rdr: io::Reader) -> Version { - +fn parse_reader(rdr: @io::Reader) -> Version { let (major, ch) = take_num(rdr, rdr.read_char()); expect(ch, '.'); let (minor, ch) = take_num(rdr, rdr.read_char()); diff --git a/src/libstd/sort.rs b/src/libstd/sort.rs index a13617a57ac..e0828d981d7 100644 --- a/src/libstd/sort.rs +++ b/src/libstd/sort.rs @@ -893,6 +893,7 @@ mod test_tim_sort { use sort::tim_sort; + use core::rand::RngUtil; use core::rand; use core::vec; @@ -990,6 +991,7 @@ mod big_tests { use sort::*; + use core::rand::RngUtil; use core::rand; use core::task; use core::uint; diff --git a/src/libstd/tempfile.rs b/src/libstd/tempfile.rs index cd023962c88..7704ec158e5 100644 --- a/src/libstd/tempfile.rs +++ b/src/libstd/tempfile.rs @@ -12,6 +12,7 @@ use core::os; use core::prelude::*; +use core::rand::RngUtil; use core::rand; pub fn mkdtemp(tmpdir: &Path, suffix: &str) -> Option<Path> { diff --git a/src/libstd/term.rs b/src/libstd/term.rs index fb63755a572..2a8c8b3b06b 100644 --- a/src/libstd/term.rs +++ b/src/libstd/term.rs @@ -36,10 +36,10 @@ pub const color_bright_magenta: u8 = 13u8; pub const color_bright_cyan: u8 = 14u8; pub const color_bright_white: u8 = 15u8; -pub fn esc(writer: io::Writer) { writer.write(~[0x1bu8, '[' as u8]); } +pub fn esc(writer: @io::Writer) { writer.write(~[0x1bu8, '[' as u8]); } /// Reset the foreground and background colors to default -pub fn reset(writer: io::Writer) { +pub fn reset(writer: @io::Writer) { esc(writer); writer.write(~['0' as u8, 'm' as u8]); } @@ -59,7 +59,7 @@ pub fn color_supported() -> bool { }; } -pub fn set_color(writer: io::Writer, first_char: u8, color: u8) { +pub fn set_color(writer: @io::Writer, first_char: u8, color: u8) { fail_unless!((color < 16u8)); esc(writer); let mut color = color; @@ -68,12 +68,12 @@ pub fn set_color(writer: io::Writer, first_char: u8, color: u8) { } /// Set the foreground color -pub fn fg(writer: io::Writer, color: u8) { +pub fn fg(writer: @io::Writer, color: u8) { return set_color(writer, '3' as u8, color); } /// Set the background color -pub fn bg(writer: io::Writer, color: u8) { +pub fn bg(writer: @io::Writer, color: u8) { return set_color(writer, '4' as u8, color); } diff --git a/src/libstd/test.rs b/src/libstd/test.rs index 3f363b613d7..cec9f56708f 100644 --- a/src/libstd/test.rs +++ b/src/libstd/test.rs @@ -198,8 +198,8 @@ pub struct BenchSamples { pub enum TestResult { TrOk, TrFailed, TrIgnored, TrBench(BenchSamples) } struct ConsoleTestState { - out: io::Writer, - log_out: Option<io::Writer>, + out: @io::Writer, + log_out: Option<@io::Writer>, use_color: bool, mut total: uint, mut passed: uint, @@ -316,7 +316,7 @@ pub fn run_tests_console(opts: &TestOpts, } } - fn write_log(out: io::Writer, result: TestResult, test: &TestDesc) { + fn write_log(out: @io::Writer, result: TestResult, test: &TestDesc) { out.write_line(fmt!("%s %s", match result { TrOk => ~"ok", @@ -326,23 +326,26 @@ pub fn run_tests_console(opts: &TestOpts, }, test.name.to_str())); } - fn write_ok(out: io::Writer, use_color: bool) { + fn write_ok(out: @io::Writer, use_color: bool) { write_pretty(out, ~"ok", term::color_green, use_color); } - fn write_failed(out: io::Writer, use_color: bool) { + fn write_failed(out: @io::Writer, use_color: bool) { write_pretty(out, ~"FAILED", term::color_red, use_color); } - fn write_ignored(out: io::Writer, use_color: bool) { + fn write_ignored(out: @io::Writer, use_color: bool) { write_pretty(out, ~"ignored", term::color_yellow, use_color); } - fn write_bench(out: io::Writer, use_color: bool) { + fn write_bench(out: @io::Writer, use_color: bool) { write_pretty(out, ~"bench", term::color_cyan, use_color); } - fn write_pretty(out: io::Writer, word: &str, color: u8, use_color: bool) { + fn write_pretty(out: @io::Writer, + word: &str, + color: u8, + use_color: bool) { if use_color && term::color_supported() { term::fg(out, color); } @@ -601,6 +604,7 @@ pub mod bench { use stats::Stats; use core::num; + use core::rand::RngUtil; use core::rand; use core::u64; use core::vec; @@ -700,7 +704,6 @@ pub mod bench { let mut prev_madp = 0.0; loop { - let n_samples = rng.gen_uint_range(50, 60); let n_iter = rng.gen_uint_range(magnitude, magnitude * 2); diff --git a/src/libstd/timer.rs b/src/libstd/timer.rs index 8ed541c7140..d72bfe73dd6 100644 --- a/src/libstd/timer.rs +++ b/src/libstd/timer.rs @@ -179,6 +179,7 @@ mod test { use uv; use core::iter; + use core::rand::RngUtil; use core::rand; use core::task; use core::pipes::{stream, SharedChan}; diff --git a/src/libstd/treemap.rs b/src/libstd/treemap.rs index 42a84da43d2..56ee3bd5893 100644 --- a/src/libstd/treemap.rs +++ b/src/libstd/treemap.rs @@ -706,6 +706,7 @@ fn remove<K: TotalOrd, V>(node: &mut Option<~TreeNode<K, V>>, mod test_treemap { use core::prelude::*; use super::*; + use core::rand::RngUtil; use core::rand; #[test] |
