Skip to content

Commit 77ffd3a

Browse files
committed
---
yaml --- r: 63222 b: refs/heads/snap-stage3 c: efc71a8 h: refs/heads/master v: v3
1 parent 4519704 commit 77ffd3a

Some content is hidden

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

45 files changed

+259
-222
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: ba4a4778cc17c64c33a891a0d2565a1fb04ddffc
4+
refs/heads/snap-stage3: efc71a8bdb28fba88d0cc8916b33838bf43b3a8d
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

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

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

15-
use core::str;
1615
use core::vec;
1716

1817
/// A trait for converting a value to base64 encoding.
@@ -111,7 +110,7 @@ impl<'self> ToBase64 for &'self str {
111110
*
112111
*/
113112
fn to_base64(&self) -> ~str {
114-
str::to_bytes(*self).to_base64()
113+
self.as_bytes().to_base64()
115114
}
116115
}
117116

@@ -224,7 +223,7 @@ impl<'self> FromBase64 for &'self str {
224223
* ~~~
225224
*/
226225
fn from_base64(&self) -> ~[u8] {
227-
str::to_bytes(*self).from_base64()
226+
self.as_bytes().from_base64()
228227
}
229228
}
230229

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

246245
#[test]
247246
fn test_from_base64() {
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"));
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());
255254
}
256255
}

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

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

608608
use core::cast;
609609
use core::io;
610-
use core::str;
611610

612611
// ebml writing
613612
pub struct Encoder {
@@ -725,7 +724,7 @@ pub mod writer {
725724
}
726725

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

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

736735
pub fn wr_str(&mut self, s: &str) {
737736
debug!("Write str: %?", s);
738-
self.writer.write(str::to_bytes(s));
737+
self.writer.write(s.as_bytes());
739738
}
740739
}
741740

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".to_bytes());
490+
assert_eq!(buf, "0\n1\n2\n".as_bytes().to_owned());
491491
assert!(fi.eof())
492492
assert_eq!(fi.state().line_num, 3);
493493
}

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

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

1111
use core::prelude::*;
1212

13-
use core::str;
1413
use core::uint;
1514
use core::vec;
1615

@@ -129,7 +128,7 @@ pub fn md4_str(msg: &[u8]) -> ~str {
129128

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

134133
#[test]
135134
fn test_md4() {

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

Lines changed: 9 additions & 11 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 = str::to_bytes("ping");
1639+
let resp_bytes = "ping".as_bytes().to_owned();
16401640
tcp_write_single(&sock, resp_bytes);
16411641
debug!("message sent");
16421642
sock.read(0u);
@@ -1756,9 +1756,7 @@ mod test {
17561756
buf_write(sock_buf, expected_req);
17571757
17581758
// so contrived!
1759-
let actual_resp = do str::as_bytes(&expected_resp.to_str()) |resp_buf| {
1760-
buf_read(sock_buf, resp_buf.len())
1761-
};
1759+
let actual_resp = buf_read(sock_buf, expected_resp.as_bytes().len());
17621760
17631761
let actual_req = server_result_po.recv();
17641762
debug!("REQ: expected: '%s' actual: '%s'",
@@ -1810,11 +1808,10 @@ mod test {
18101808

18111809
fn buf_write<W:io::Writer>(w: &W, val: &str) {
18121810
debug!("BUF_WRITE: val len %?", val.len());
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-
}
1811+
let b_slice = val.as_bytes();
1812+
debug!("BUF_WRITE: b_slice len %?",
1813+
b_slice.len());
1814+
w.write(b_slice)
18181815
}
18191816

18201817
fn buf_read<R:io::Reader>(r: &R, len: uint) -> ~str {
@@ -1877,7 +1874,8 @@ mod test {
18771874
server_ch.send(
18781875
str::from_bytes(data));
18791876
debug!("SERVER: before write");
1880-
tcp_write_single(&sock, str::to_bytes(resp_cell2.take()));
1877+
let s = resp_cell2.take();
1878+
tcp_write_single(&sock, s.as_bytes().to_owned());
18811879
debug!("SERVER: after write.. die");
18821880
kill_ch.send(None);
18831881
}
@@ -1949,7 +1947,7 @@ mod test {
19491947
}
19501948
else {
19511949
let sock = result::unwrap(connect_result);
1952-
let resp_bytes = str::to_bytes(resp);
1950+
let resp_bytes = resp.as_bytes().to_owned();
19531951
tcp_write_single(&sock, resp_bytes);
19541952
let read_result = sock.read(0u);
19551953
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 = str::to_bytes("a=1&foo+bar=abc&foo+bar=12+%3D+34");
1063+
let s = "a=1&foo+bar=abc&foo+bar=12+%3D+34".as_bytes();
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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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(str::to_bytes(s), radix)
537+
BigUint::parse_bytes(s.as_bytes(), radix)
538538
}
539539
}
540540

@@ -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(str::to_bytes(s), radix)
1093+
BigInt::parse_bytes(s.as_bytes(), radix)
10941094
}
10951095
}
10961096

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
use core::prelude::*;
2626

2727
use core::iterator::IteratorUtil;
28-
use core::str;
2928
use core::uint;
3029
use core::vec;
3130

@@ -246,8 +245,7 @@ pub fn sha1() -> @Sha1 {
246245
}
247246
fn input(&mut self, msg: &const [u8]) { add_input(self, msg); }
248247
fn input_str(&mut self, msg: &str) {
249-
let bs = str::to_bytes(msg);
250-
add_input(self, bs);
248+
add_input(self, msg.as_bytes());
251249
}
252250
fn result(&mut self) -> ~[u8] { return mk_result(self); }
253251
fn result_str(&mut self) -> ~str {

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
use core::prelude::*;
1414

1515
use core::iterator::*;
16-
use core::vec;
1716
use core::f64;
1817
use core::cmp;
1918
use core::num;

branches/snap-stage3/src/libextra/terminfo/parm.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,14 @@ pub fn expand(cap: &[u8], params: &mut [Param], sta: &mut [Param], dyn: &mut [Pa
8585
_ => return Err(~"a non-char was used with %c")
8686
},
8787
's' => match stack.pop() {
88-
String(s) => output.push_all(s.to_bytes()),
88+
String(s) => output.push_all(s.as_bytes()),
8989
_ => return Err(~"a non-str was used with %s")
9090
},
9191
'd' => match stack.pop() {
92-
Number(x) => output.push_all(x.to_str().to_bytes()),
92+
Number(x) => {
93+
let s = x.to_str();
94+
output.push_all(s.as_bytes())
95+
}
9396
_ => return Err(~"a non-number was used with %d")
9497
},
9598
'p' => state = PushParam,

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -769,10 +769,10 @@ mod test_treemap {
769769
fn u8_map() {
770770
let mut m = TreeMap::new();
771771

772-
let k1 = str::to_bytes("foo");
773-
let k2 = str::to_bytes("bar");
774-
let v1 = str::to_bytes("baz");
775-
let v2 = str::to_bytes("foobar");
772+
let k1 = "foo".as_bytes();
773+
let k2 = "bar".as_bytes();
774+
let v1 = "baz".as_bytes();
775+
let v2 = "foobar".as_bytes();
776776

777777
m.insert(copy k1, copy v1);
778778
m.insert(copy k2, copy v2);

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1368,7 +1368,7 @@ mod test {
13681368
// In C, this would be a malloc'd or stack-allocated
13691369
// struct that we'd cast to a void* and store as the
13701370
// data field in our uv_connect_t struct
1371-
let req_str_bytes = str::to_bytes(req_str);
1371+
let req_str_bytes = req_str.as_bytes();
13721372
let req_msg_ptr: *u8 = vec::raw::to_ptr(req_str_bytes);
13731373
debug!("req_msg ptr: %u", req_msg_ptr as uint);
13741374
let req_msg = ~[
@@ -1626,7 +1626,7 @@ mod test {
16261626
let server_write_req = write_t();
16271627
let server_write_req_ptr: *uv_write_t = &server_write_req;
16281628
1629-
let resp_str_bytes = str::to_bytes(server_resp_msg);
1629+
let resp_str_bytes = server_resp_msg.as_bytes();
16301630
let resp_msg_ptr: *u8 = vec::raw::to_ptr(resp_str_bytes);
16311631
debug!("resp_msg ptr: %u", resp_msg_ptr as uint);
16321632
let resp_msg = ~[

branches/snap-stage3/src/librustc/back/link.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ pub enum output_type {
5050
}
5151

5252
fn write_string<W:Writer>(writer: &mut W, string: &str) {
53-
let buffer = str::as_bytes_slice(string);
54-
writer.write(buffer);
53+
writer.write(string.as_bytes());
5554
}
5655

5756
pub fn llvm_err(sess: Session, msg: ~str) -> ! {

branches/snap-stage3/src/librustc/metadata/encoder.rs

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,8 @@ fn encode_type_param_bounds(ebml_w: &mut writer::Encoder,
202202

203203
fn encode_variant_id(ebml_w: &mut writer::Encoder, vid: def_id) {
204204
ebml_w.start_tag(tag_items_data_item_variant);
205-
ebml_w.writer.write(str::to_bytes(def_to_str(vid)));
205+
let s = def_to_str(vid);
206+
ebml_w.writer.write(s.as_bytes());
206207
ebml_w.end_tag();
207208
}
208209

@@ -271,7 +272,7 @@ fn encode_symbol(ecx: @EncodeContext,
271272
match ecx.item_symbols.find(&id) {
272273
Some(x) => {
273274
debug!("encode_symbol(id=%?, str=%s)", id, *x);
274-
ebml_w.writer.write(str::to_bytes(*x));
275+
ebml_w.writer.write(x.as_bytes());
275276
}
276277
None => {
277278
ecx.diag.handler().bug(
@@ -285,21 +286,23 @@ fn encode_discriminant(ecx: @EncodeContext,
285286
ebml_w: &mut writer::Encoder,
286287
id: node_id) {
287288
ebml_w.start_tag(tag_items_data_item_symbol);
288-
ebml_w.writer.write(str::to_bytes(*ecx.discrim_symbols.get_copy(&id)));
289+
ebml_w.writer.write(ecx.discrim_symbols.get_copy(&id).as_bytes());
289290
ebml_w.end_tag();
290291
}
291292

292293
fn encode_disr_val(_: @EncodeContext,
293294
ebml_w: &mut writer::Encoder,
294295
disr_val: int) {
295296
ebml_w.start_tag(tag_disr_val);
296-
ebml_w.writer.write(str::to_bytes(int::to_str(disr_val)));
297+
let s = int::to_str(disr_val);
298+
ebml_w.writer.write(s.as_bytes());
297299
ebml_w.end_tag();
298300
}
299301

300302
fn encode_parent_item(ebml_w: &mut writer::Encoder, id: def_id) {
301303
ebml_w.start_tag(tag_items_data_parent_item);
302-
ebml_w.writer.write(str::to_bytes(def_to_str(id)));
304+
let s = def_to_str(id);
305+
ebml_w.writer.write(s.as_bytes());
303306
ebml_w.end_tag();
304307
}
305308

@@ -954,7 +957,8 @@ fn encode_info_for_item(ecx: @EncodeContext,
954957
for methods.each |m| {
955958
ebml_w.start_tag(tag_item_impl_method);
956959
let method_def_id = local_def(m.id);
957-
ebml_w.writer.write(str::to_bytes(def_to_str(method_def_id)));
960+
let s = def_to_str(method_def_id);
961+
ebml_w.writer.write(s.as_bytes());
958962
ebml_w.end_tag();
959963
}
960964
for opt_trait.iter().advance |ast_trait_ref| {
@@ -1218,7 +1222,7 @@ fn encode_meta_item(ebml_w: &mut writer::Encoder, mi: @meta_item) {
12181222
meta_word(name) => {
12191223
ebml_w.start_tag(tag_meta_item_word);
12201224
ebml_w.start_tag(tag_meta_item_name);
1221-
ebml_w.writer.write(str::to_bytes(*name));
1225+
ebml_w.writer.write(name.as_bytes());
12221226
ebml_w.end_tag();
12231227
ebml_w.end_tag();
12241228
}
@@ -1227,10 +1231,10 @@ fn encode_meta_item(ebml_w: &mut writer::Encoder, mi: @meta_item) {
12271231
lit_str(value) => {
12281232
ebml_w.start_tag(tag_meta_item_name_value);
12291233
ebml_w.start_tag(tag_meta_item_name);
1230-
ebml_w.writer.write(str::to_bytes(*name));
1234+
ebml_w.writer.write(name.as_bytes());
12311235
ebml_w.end_tag();
12321236
ebml_w.start_tag(tag_meta_item_value);
1233-
ebml_w.writer.write(str::to_bytes(*value));
1237+
ebml_w.writer.write(value.as_bytes());
12341238
ebml_w.end_tag();
12351239
ebml_w.end_tag();
12361240
}
@@ -1240,7 +1244,7 @@ fn encode_meta_item(ebml_w: &mut writer::Encoder, mi: @meta_item) {
12401244
meta_list(name, ref items) => {
12411245
ebml_w.start_tag(tag_meta_item_list);
12421246
ebml_w.start_tag(tag_meta_item_name);
1243-
ebml_w.writer.write(str::to_bytes(*name));
1247+
ebml_w.writer.write(name.as_bytes());
12441248
ebml_w.end_tag();
12451249
for items.each |inner_item| {
12461250
encode_meta_item(ebml_w, *inner_item);
@@ -1398,20 +1402,21 @@ fn encode_crate_dep(ecx: @EncodeContext,
13981402
dep: decoder::crate_dep) {
13991403
ebml_w.start_tag(tag_crate_dep);
14001404
ebml_w.start_tag(tag_crate_dep_name);
1401-
ebml_w.writer.write(str::to_bytes(*ecx.tcx.sess.str_of(dep.name)));
1405+
let s = ecx.tcx.sess.str_of(dep.name);
1406+
ebml_w.writer.write(s.as_bytes());
14021407
ebml_w.end_tag();
14031408
ebml_w.start_tag(tag_crate_dep_vers);
1404-
ebml_w.writer.write(str::to_bytes(*dep.vers));
1409+
ebml_w.writer.write(dep.vers.as_bytes());
14051410
ebml_w.end_tag();
14061411
ebml_w.start_tag(tag_crate_dep_hash);
1407-
ebml_w.writer.write(str::to_bytes(*dep.hash));
1412+
ebml_w.writer.write(dep.hash.as_bytes());
14081413
ebml_w.end_tag();
14091414
ebml_w.end_tag();
14101415
}
14111416

14121417
fn encode_hash(ebml_w: &mut writer::Encoder, hash: &str) {
14131418
ebml_w.start_tag(tag_crate_hash);
1414-
ebml_w.writer.write(str::to_bytes(hash));
1419+
ebml_w.writer.write(hash.as_bytes());
14151420
ebml_w.end_tag();
14161421
}
14171422

branches/snap-stage3/src/librustc/metadata/filesearch.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ use core::prelude::*;
1313
use core::option;
1414
use core::os;
1515
use core::result;
16-
use core::str;
1716

1817
// A module for searching for libraries
1918
// FIXME (#2658): I'm not happy how this module turned out. Should

0 commit comments

Comments
 (0)