Skip to content

Commit ef08c0a

Browse files
committed
---
yaml --- r: 63231 b: refs/heads/snap-stage3 c: 8761b1f h: refs/heads/master i: 63229: 7366337 63227: cae47dd 63223: 5122bee 63215: 9eb6b9d 63199: 583695a 63167: d53b7b8 63103: cd6fe44 62975: fa69e26 v: v3
1 parent dc6858c commit ef08c0a

Some content is hidden

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

82 files changed

+792
-850
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 2d28d645422c1617be58c8ca7ad9a457264ca850
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: eecbe5556b96aa5546ede9454483a53b25d3380a
4+
refs/heads/snap-stage3: 8761b1fb16c8d1e7e57a95efdb2cdcf36565477a
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/doc/tutorial.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1410,7 +1410,7 @@ let new_favorite_crayon_name = favorite_crayon_name.trim();
14101410
14111411
if favorite_crayon_name.len() > 5 {
14121412
// Create a substring
1413-
println(favorite_crayon_name.slice_chars(0, 5));
1413+
println(favorite_crayon_name.substr(0, 5));
14141414
}
14151415
~~~
14161416

branches/snap-stage3/src/compiletest/runtest.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,8 @@ fn run_pretty_test(config: &config, props: &TestProps, testfile: &Path) {
171171
if props.pp_exact.is_some() {
172172
// Now we have to care about line endings
173173
let cr = ~"\r";
174-
actual = actual.replace(cr, "");
175-
expected = expected.replace(cr, "");
174+
actual = str::replace(actual, cr, "");
175+
expected = str::replace(expected, cr, "");
176176
}
177177

178178
compare_source(expected, actual);
@@ -238,7 +238,7 @@ fn run_debuginfo_test(config: &config, props: &TestProps, testfile: &Path) {
238238
// do not optimize debuginfo tests
239239
let mut config = match config.rustcflags {
240240
Some(ref flags) => config {
241-
rustcflags: Some(flags.replace("-O", "")),
241+
rustcflags: Some(str::replace(*flags, "-O", "")),
242242
.. copy *config
243243
},
244244
None => copy *config
@@ -254,7 +254,7 @@ fn run_debuginfo_test(config: &config, props: &TestProps, testfile: &Path) {
254254
}
255255

256256
// write debugger script
257-
let script_str = cmds.append("\nquit\n");
257+
let script_str = str::append(cmds, "\nquit\n");
258258
debug!("script_str = %s", script_str);
259259
dump_output_file(config, testfile, script_str, "debugger.script");
260260

branches/snap-stage3/src/libextra/base64.rs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
1313
use core::prelude::*;
1414

15+
use core::str;
1516
use core::vec;
1617

1718
/// A trait for converting a value to base64 encoding.
@@ -110,7 +111,7 @@ impl<'self> ToBase64 for &'self str {
110111
*
111112
*/
112113
fn to_base64(&self) -> ~str {
113-
self.as_bytes().to_base64()
114+
str::to_bytes(*self).to_base64()
114115
}
115116
}
116117

@@ -223,7 +224,7 @@ impl<'self> FromBase64 for &'self str {
223224
* ~~~
224225
*/
225226
fn from_base64(&self) -> ~[u8] {
226-
self.as_bytes().from_base64()
227+
str::to_bytes(*self).from_base64()
227228
}
228229
}
229230

@@ -244,12 +245,12 @@ mod tests {
244245

245246
#[test]
246247
fn test_from_base64() {
247-
assert_eq!("".from_base64(), "".as_bytes().to_owned());
248-
assert_eq!("Zg==".from_base64(), "f".as_bytes().to_owned());
249-
assert_eq!("Zm8=".from_base64(), "fo".as_bytes().to_owned());
250-
assert_eq!("Zm9v".from_base64(), "foo".as_bytes().to_owned());
251-
assert_eq!("Zm9vYg==".from_base64(), "foob".as_bytes().to_owned());
252-
assert_eq!("Zm9vYmE=".from_base64(), "fooba".as_bytes().to_owned());
253-
assert_eq!("Zm9vYmFy".from_base64(), "foobar".as_bytes().to_owned());
248+
assert_eq!("".from_base64(), str::to_bytes(""));
249+
assert_eq!("Zg==".from_base64(), str::to_bytes("f"));
250+
assert_eq!("Zm8=".from_base64(), str::to_bytes("fo"));
251+
assert_eq!("Zm9v".from_base64(), str::to_bytes("foo"));
252+
assert_eq!("Zm9vYg==".from_base64(), str::to_bytes("foob"));
253+
assert_eq!("Zm9vYmE=".from_base64(), str::to_bytes("fooba"))
254+
assert_eq!("Zm9vYmFy".from_base64(), str::to_bytes("foobar"));
254255
}
255256
}

branches/snap-stage3/src/libextra/ebml.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -607,6 +607,7 @@ pub mod writer {
607607

608608
use core::cast;
609609
use core::io;
610+
use core::str;
610611

611612
// ebml writing
612613
pub struct Encoder {
@@ -724,7 +725,7 @@ pub mod writer {
724725
}
725726

726727
pub fn wr_tagged_str(&mut self, tag_id: uint, v: &str) {
727-
self.wr_tagged_bytes(tag_id, v.as_bytes());
728+
str::byte_slice(v, |b| self.wr_tagged_bytes(tag_id, b));
728729
}
729730

730731
pub fn wr_bytes(&mut self, b: &[u8]) {
@@ -734,7 +735,7 @@ pub mod writer {
734735

735736
pub fn wr_str(&mut self, s: &str) {
736737
debug!("Write str: %?", s);
737-
self.writer.write(s.as_bytes());
738+
self.writer.write(str::to_bytes(s));
738739
}
739740
}
740741

branches/snap-stage3/src/libextra/fileinput.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ mod test {
487487
let mut buf : ~[u8] = vec::from_elem(6, 0u8);
488488
let count = fi.read(buf, 10);
489489
assert_eq!(count, 6);
490-
assert_eq!(buf, "0\n1\n2\n".as_bytes().to_owned());
490+
assert_eq!(buf, "0\n1\n2\n".to_bytes());
491491
assert!(fi.eof())
492492
assert_eq!(fi.state().line_num, 3);
493493
}

branches/snap-stage3/src/libextra/flatpipes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ pub mod flatteners {
450450
T: Decodable<D>>(
451451
buf: &[u8])
452452
-> T {
453-
let buf = buf.to_owned();
453+
let buf = vec::to_owned(buf);
454454
let buf_reader = @BufReader::new(buf);
455455
let reader = buf_reader as @Reader;
456456
let mut deser: D = FromReader::from_reader(reader);

branches/snap-stage3/src/libextra/getopts.rs

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ pub fn getopts(args: &[~str], opts: &[Opt]) -> Result {
345345
}
346346
i += 1;
347347
}
348-
return Ok(Matches {opts: opts.to_owned(),
348+
return Ok(Matches {opts: vec::to_owned(opts),
349349
vals: vals,
350350
free: free});
351351
}
@@ -447,7 +447,7 @@ pub fn opt_default(mm: &Matches, nm: &str, def: &str) -> Option<~str> {
447447
let vals = opt_vals(mm, nm);
448448
if vals.is_empty() { return None::<~str>; }
449449
return match vals[0] { Val(ref s) => Some::<~str>(copy *s),
450-
_ => Some::<~str>(def.to_owned()) }
450+
_ => Some::<~str>(str::to_owned(def)) }
451451
}
452452

453453
#[deriving(Eq)]
@@ -487,10 +487,10 @@ pub mod groups {
487487
desc: &str, hint: &str) -> OptGroup {
488488
let len = short_name.len();
489489
assert!(len == 1 || len == 0);
490-
return OptGroup { short_name: short_name.to_owned(),
491-
long_name: long_name.to_owned(),
492-
hint: hint.to_owned(),
493-
desc: desc.to_owned(),
490+
return OptGroup { short_name: str::to_owned(short_name),
491+
long_name: str::to_owned(long_name),
492+
hint: str::to_owned(hint),
493+
desc: str::to_owned(desc),
494494
hasarg: Yes,
495495
occur: Req};
496496
}
@@ -500,10 +500,10 @@ pub mod groups {
500500
desc: &str, hint: &str) -> OptGroup {
501501
let len = short_name.len();
502502
assert!(len == 1 || len == 0);
503-
return OptGroup {short_name: short_name.to_owned(),
504-
long_name: long_name.to_owned(),
505-
hint: hint.to_owned(),
506-
desc: desc.to_owned(),
503+
return OptGroup {short_name: str::to_owned(short_name),
504+
long_name: str::to_owned(long_name),
505+
hint: str::to_owned(hint),
506+
desc: str::to_owned(desc),
507507
hasarg: Yes,
508508
occur: Optional};
509509
}
@@ -513,10 +513,10 @@ pub mod groups {
513513
desc: &str) -> OptGroup {
514514
let len = short_name.len();
515515
assert!(len == 1 || len == 0);
516-
return OptGroup {short_name: short_name.to_owned(),
517-
long_name: long_name.to_owned(),
516+
return OptGroup {short_name: str::to_owned(short_name),
517+
long_name: str::to_owned(long_name),
518518
hint: ~"",
519-
desc: desc.to_owned(),
519+
desc: str::to_owned(desc),
520520
hasarg: No,
521521
occur: Optional};
522522
}
@@ -526,10 +526,10 @@ pub mod groups {
526526
desc: &str, hint: &str) -> OptGroup {
527527
let len = short_name.len();
528528
assert!(len == 1 || len == 0);
529-
return OptGroup {short_name: short_name.to_owned(),
530-
long_name: long_name.to_owned(),
531-
hint: hint.to_owned(),
532-
desc: desc.to_owned(),
529+
return OptGroup {short_name: str::to_owned(short_name),
530+
long_name: str::to_owned(long_name),
531+
hint: str::to_owned(hint),
532+
desc: str::to_owned(desc),
533533
hasarg: Maybe,
534534
occur: Optional};
535535
}
@@ -542,10 +542,10 @@ pub mod groups {
542542
desc: &str, hint: &str) -> OptGroup {
543543
let len = short_name.len();
544544
assert!(len == 1 || len == 0);
545-
return OptGroup {short_name: short_name.to_owned(),
546-
long_name: long_name.to_owned(),
547-
hint: hint.to_owned(),
548-
desc: desc.to_owned(),
545+
return OptGroup {short_name: str::to_owned(short_name),
546+
long_name: str::to_owned(long_name),
547+
hint: str::to_owned(hint),
548+
desc: str::to_owned(desc),
549549
hasarg: Yes,
550550
occur: Multi};
551551
}
@@ -593,7 +593,7 @@ pub mod groups {
593593
*/
594594
pub fn usage(brief: &str, opts: &[OptGroup]) -> ~str {
595595

596-
let desc_sep = ~"\n" + " ".repeat(24);
596+
let desc_sep = ~"\n" + str::repeat(" ", 24);
597597

598598
let rows = vec::map(opts, |optref| {
599599
let OptGroup{short_name: short_name,
@@ -603,7 +603,7 @@ pub mod groups {
603603
hasarg: hasarg,
604604
_} = copy *optref;
605605

606-
let mut row = " ".repeat(4);
606+
let mut row = str::repeat(" ", 4);
607607

608608
// short option
609609
row += match short_name.len() {
@@ -629,7 +629,7 @@ pub mod groups {
629629
// here we just need to indent the start of the description
630630
let rowlen = row.len();
631631
row += if rowlen < 24 {
632-
" ".repeat(24 - rowlen)
632+
str::repeat(" ", 24 - rowlen)
633633
} else {
634634
copy desc_sep
635635
};
@@ -654,7 +654,7 @@ pub mod groups {
654654
row
655655
});
656656

657-
return brief.to_owned() +
657+
return str::to_owned(brief) +
658658
"\n\nOptions:\n" +
659659
rows.connect("\n") +
660660
"\n\n";

branches/snap-stage3/src/libextra/md4.rs

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

1111
use core::prelude::*;
1212

13+
use core::str;
1314
use core::uint;
1415
use core::vec;
1516

@@ -29,7 +30,7 @@ pub fn md4(msg: &[u8]) -> Quad {
2930
let orig_len: u64 = (msg.len() * 8u) as u64;
3031

3132
// pad message
32-
let mut msg = vec::append(msg.to_owned(), [0x80u8]);
33+
let mut msg = vec::append(vec::to_owned(msg), [0x80u8]);
3334
let mut bitlen = orig_len + 8u64;
3435
while (bitlen + 64u64) % 512u64 > 0u64 {
3536
msg.push(0u8);
@@ -128,7 +129,7 @@ pub fn md4_str(msg: &[u8]) -> ~str {
128129

129130
/// Calculates the md4 hash of a string, returning the hex-encoded version of
130131
/// the hash
131-
pub fn md4_text(msg: &str) -> ~str { md4_str(msg.as_bytes()) }
132+
pub fn md4_text(msg: &str) -> ~str { md4_str(str::to_bytes(msg)) }
132133

133134
#[test]
134135
fn test_md4() {

branches/snap-stage3/src/libextra/net_tcp.rs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1636,7 +1636,7 @@ mod test {
16361636
assert_eq!(net::ip::get_port(&sock.get_peer_addr()), 8887);
16371637
16381638
// Fulfill the protocol the test server expects
1639-
let resp_bytes = "ping".as_bytes().to_owned();
1639+
let resp_bytes = str::to_bytes("ping");
16401640
tcp_write_single(&sock, resp_bytes);
16411641
debug!("message sent");
16421642
sock.read(0u);
@@ -1756,7 +1756,9 @@ mod test {
17561756
buf_write(sock_buf, expected_req);
17571757
17581758
// so contrived!
1759-
let actual_resp = buf_read(sock_buf, expected_resp.as_bytes().len());
1759+
let actual_resp = do str::as_bytes(&expected_resp.to_str()) |resp_buf| {
1760+
buf_read(sock_buf, resp_buf.len())
1761+
};
17601762
17611763
let actual_req = server_result_po.recv();
17621764
debug!("REQ: expected: '%s' actual: '%s'",
@@ -1808,10 +1810,11 @@ mod test {
18081810

18091811
fn buf_write<W:io::Writer>(w: &W, val: &str) {
18101812
debug!("BUF_WRITE: val len %?", val.len());
1811-
let b_slice = val.as_bytes();
1812-
debug!("BUF_WRITE: b_slice len %?",
1813-
b_slice.len());
1814-
w.write(b_slice)
1813+
do str::byte_slice(val) |b_slice| {
1814+
debug!("BUF_WRITE: b_slice len %?",
1815+
b_slice.len());
1816+
w.write(b_slice)
1817+
}
18151818
}
18161819

18171820
fn buf_read<R:io::Reader>(r: &R, len: uint) -> ~str {
@@ -1874,8 +1877,7 @@ mod test {
18741877
server_ch.send(
18751878
str::from_bytes(data));
18761879
debug!("SERVER: before write");
1877-
let s = resp_cell2.take();
1878-
tcp_write_single(&sock, s.as_bytes().to_owned());
1880+
tcp_write_single(&sock, str::to_bytes(resp_cell2.take()));
18791881
debug!("SERVER: after write.. die");
18801882
kill_ch.send(None);
18811883
}
@@ -1947,7 +1949,7 @@ mod test {
19471949
}
19481950
else {
19491951
let sock = result::unwrap(connect_result);
1950-
let resp_bytes = resp.as_bytes().to_owned();
1952+
let resp_bytes = str::to_bytes(resp);
19511953
tcp_write_single(&sock, resp_bytes);
19521954
let read_result = sock.read(0u);
19531955
if read_result.is_err() {

branches/snap-stage3/src/libextra/net_url.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1060,7 +1060,7 @@ mod tests {
10601060
/*
10611061
assert_eq!(decode_form_urlencoded([]).len(), 0);
10621062
1063-
let s = "a=1&foo+bar=abc&foo+bar=12+%3D+34".as_bytes();
1063+
let s = str::to_bytes("a=1&foo+bar=abc&foo+bar=12+%3D+34");
10641064
let form = decode_form_urlencoded(s);
10651065
assert_eq!(form.len(), 2);
10661066
assert_eq!(form.get_ref(&~"a"), &~[~"1"]);

branches/snap-stage3/src/libextra/num/bigint.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ impl ToStrRadix for BigUint {
524524
let s = uint::to_str_radix(*n as uint, radix);
525525
str::from_chars(vec::from_elem(l - s.len(), '0')) + s
526526
}).concat();
527-
s.trim_left_chars(&'0').to_owned()
527+
s.trim_left_chars(['0']).to_owned()
528528
}
529529
}
530530
}
@@ -534,7 +534,7 @@ impl FromStrRadix for BigUint {
534534
535535
pub fn from_str_radix(s: &str, radix: uint)
536536
-> Option<BigUint> {
537-
BigUint::parse_bytes(s.as_bytes(), radix)
537+
BigUint::parse_bytes(str::to_bytes(s), radix)
538538
}
539539
}
540540

@@ -564,7 +564,7 @@ impl BigUint {
564564
/// Creates and initializes an BigUint.
565565
566566
pub fn from_slice(slice: &[BigDigit]) -> BigUint {
567-
return BigUint::new(slice.to_owned());
567+
return BigUint::new(vec::to_owned(slice));
568568
}
569569

570570
/// Creates and initializes an BigUint.
@@ -1090,7 +1090,7 @@ impl FromStrRadix for BigInt {
10901090
10911091
fn from_str_radix(s: &str, radix: uint)
10921092
-> Option<BigInt> {
1093-
BigInt::parse_bytes(s.as_bytes(), radix)
1093+
BigInt::parse_bytes(str::to_bytes(s), radix)
10941094
}
10951095
}
10961096

0 commit comments

Comments
 (0)