Skip to content

Commit 389aede

Browse files
committed
---
yaml --- r: 144747 b: refs/heads/try2 c: de39874 h: refs/heads/master i: 144745: 9303422 144743: 30d7ea6 v: v3
1 parent 05c8549 commit 389aede

Some content is hidden

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

43 files changed

+162
-201
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: d1dde99e4b3d43d044cdead7240bbd5f0d7a0ce5
8+
refs/heads/try2: de39874801761197bf10bf8d04bde1aa2bd82e15
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/compiletest/procsrv.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ pub fn run(lib_path: &str,
6363

6464
Result {
6565
status: output.status,
66-
out: str::from_bytes(output.output),
67-
err: str::from_bytes(output.error)
66+
out: str::from_utf8(output.output),
67+
err: str::from_utf8(output.error)
6868
}
6969
}

branches/try2/src/libextra/base64.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ impl<'self> ToBase64 for &'self [u8] {
145145
}
146146

147147
unsafe {
148-
str::raw::from_bytes_owned(v)
148+
str::raw::from_utf8_owned(v)
149149
}
150150
}
151151
}
@@ -162,7 +162,7 @@ impl<'self> FromBase64 for &'self str {
162162
* Convert any base64 encoded string (literal, `@`, `&`, or `~`)
163163
* to the byte values it encodes.
164164
*
165-
* You can use the `from_bytes` function in `std::str`
165+
* You can use the `from_utf8` function in `std::str`
166166
* to turn a `[u8]` into a string with characters corresponding to those
167167
* values.
168168
*
@@ -180,7 +180,7 @@ impl<'self> FromBase64 for &'self str {
180180
* printfln!("%s", hello_str);
181181
* let bytes = hello_str.from_base64();
182182
* printfln!("%?", bytes);
183-
* let result_str = str::from_bytes(bytes);
183+
* let result_str = str::from_utf8(bytes);
184184
* printfln!("%s", result_str);
185185
* }
186186
* ~~~

branches/try2/src/libextra/bitv.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ impl Bitv {
523523
* with the most significant bits of each byte coming first. Each
524524
* bit becomes true if equal to 1 or false if equal to 0.
525525
*/
526-
pub fn from_bytes(bytes: &[u8]) -> Bitv {
526+
pub fn from_utf8(bytes: &[u8]) -> Bitv {
527527
from_fn(bytes.len() * 8, |i| {
528528
let b = bytes[i / 8] as uint;
529529
let offset = i % 8;
@@ -1275,8 +1275,8 @@ mod tests {
12751275
}
12761276
12771277
#[test]
1278-
fn test_from_bytes() {
1279-
let bitv = from_bytes([0b10110110, 0b00000000, 0b11111111]);
1278+
fn test_from_utf8() {
1279+
let bitv = from_utf8([0b10110110, 0b00000000, 0b11111111]);
12801280
let str = ~"10110110" + "00000000" + "11111111";
12811281
assert_eq!(bitv.to_str(), str);
12821282
}
@@ -1302,7 +1302,7 @@ mod tests {
13021302
#[test]
13031303
fn test_to_bools() {
13041304
let bools = ~[false, false, true, false, false, true, true, false];
1305-
assert_eq!(from_bytes([0b00100110]).to_bools(), bools);
1305+
assert_eq!(from_utf8([0b00100110]).to_bools(), bools);
13061306
}
13071307
13081308
#[test]

branches/try2/src/libextra/ebml.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ impl Doc {
4141
}
4242

4343
pub fn as_str_slice<'a>(&'a self) -> &'a str {
44-
str::from_bytes_slice(self.data.slice(self.start, self.end))
44+
str::from_utf8_slice(self.data.slice(self.start, self.end))
4545
}
4646

4747
pub fn as_str(&self) -> ~str {

branches/try2/src/libextra/hex.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ impl<'self> ToHex for &'self [u8] {
4545
}
4646

4747
unsafe {
48-
str::raw::from_bytes_owned(v)
48+
str::raw::from_utf8_owned(v)
4949
}
5050
}
5151
}
@@ -62,7 +62,7 @@ impl<'self> FromHex for &'self str {
6262
* Convert any hexadecimal encoded string (literal, `@`, `&`, or `~`)
6363
* to the byte values it encodes.
6464
*
65-
* You can use the `from_bytes` function in `std::str`
65+
* You can use the `from_utf8` function in `std::str`
6666
* to turn a `[u8]` into a string with characters corresponding to those
6767
* values.
6868
*
@@ -80,7 +80,7 @@ impl<'self> FromHex for &'self str {
8080
* printfln!("%s", hello_str);
8181
* let bytes = hello_str.from_hex().unwrap();
8282
* printfln!("%?", bytes);
83-
* let result_str = str::from_bytes(bytes);
83+
* let result_str = str::from_utf8(bytes);
8484
* printfln!("%s", result_str);
8585
* }
8686
* ~~~

branches/try2/src/libextra/json.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -858,7 +858,7 @@ impl<T : iterator::Iterator<char>> Parser<T> {
858858

859859
/// Decodes a json value from an @io::Reader
860860
pub fn from_reader(rdr: @io::Reader) -> Result<Json, Error> {
861-
let s = str::from_bytes(rdr.read_whole_stream());
861+
let s = str::from_utf8(rdr.read_whole_stream());
862862
let mut parser = Parser(~s.iter());
863863
parser.parse()
864864
}

branches/try2/src/libextra/terminfo/parser/compiled.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ pub fn parse(file: @Reader, longnames: bool) -> Result<~TermInfo, ~str> {
213213
return Err(~"incompatible file: more string offsets than expected");
214214
}
215215

216-
let names_str = str::from_bytes(file.read_bytes(names_bytes as uint - 1)); // don't read NUL
216+
let names_str = str::from_utf8(file.read_bytes(names_bytes as uint - 1)); // don't read NUL
217217
let term_names: ~[~str] = names_str.split_iter('|').map(|s| s.to_owned()).collect();
218218

219219
file.read_byte(); // consume NUL

branches/try2/src/libextra/uuid.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ impl Uuid {
210210
///
211211
/// # Arguments
212212
/// * `b` An array or slice of 16 bytes
213-
pub fn from_bytes(b: &[u8]) -> Option<Uuid> {
213+
pub fn from_utf8(b: &[u8]) -> Option<Uuid> {
214214
if b.len() != 16 {
215215
return None
216216
}
@@ -307,7 +307,7 @@ impl Uuid {
307307
s[i*2+0] = digit[0];
308308
s[i*2+1] = digit[1];
309309
}
310-
str::from_bytes(s)
310+
str::from_utf8(s)
311311
}
312312

313313
/// Returns a string of hexadecimal digits, separated into groups with a hypen
@@ -413,7 +413,7 @@ impl Uuid {
413413
ub[i] = FromStrRadix::from_str_radix(vs.slice(i*2, (i+1)*2), 16).unwrap();
414414
}
415415

416-
Ok(Uuid::from_bytes(ub).unwrap())
416+
Ok(Uuid::from_utf8(ub).unwrap())
417417
}
418418
}
419419

@@ -705,11 +705,11 @@ mod test {
705705
}
706706

707707
#[test]
708-
fn test_from_bytes() {
708+
fn test_from_utf8() {
709709
let b = ~[ 0xa1, 0xa2, 0xa3, 0xa4, 0xb1, 0xb2, 0xc1, 0xc2,
710710
0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8 ];
711711

712-
let u = Uuid::from_bytes(b).unwrap();
712+
let u = Uuid::from_utf8(b).unwrap();
713713
let expected = ~"a1a2a3a4b1b2c1c2d1d2d3d4d5d6d7d8";
714714

715715
assert!(u.to_simple_str() == expected);
@@ -729,7 +729,7 @@ mod test {
729729
let b_in: [u8, ..16] = [ 0xa1, 0xa2, 0xa3, 0xa4, 0xb1, 0xb2, 0xc1, 0xc2,
730730
0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8 ];
731731

732-
let u = Uuid::from_bytes(b_in.clone()).unwrap();
732+
let u = Uuid::from_utf8(b_in.clone()).unwrap();
733733

734734
let b_out = u.to_bytes();
735735

branches/try2/src/librustc/back/link.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ pub mod write {
386386
cc_prog, prog.status));
387387
sess.note(fmt!("%s arguments: %s",
388388
cc_prog, cc_args.connect(" ")));
389-
sess.note(str::from_bytes(prog.error + prog.output));
389+
sess.note(str::from_utf8(prog.error + prog.output));
390390
sess.abort_if_errors();
391391
}
392392
}
@@ -943,7 +943,7 @@ pub fn link_binary(sess: Session,
943943
cc_prog, prog.status));
944944
sess.note(fmt!("%s arguments: %s",
945945
cc_prog, cc_args.connect(" ")));
946-
sess.note(str::from_bytes(prog.error + prog.output));
946+
sess.note(str::from_utf8(prog.error + prog.output));
947947
sess.abort_if_errors();
948948
}
949949

branches/try2/src/librustc/metadata/decoder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1239,7 +1239,7 @@ fn read_path(d: ebml::Doc) -> (~str, uint) {
12391239
do reader::with_doc_data(d) |desc| {
12401240
let pos = io::u64_from_be_bytes(desc, 0u, 4u) as uint;
12411241
let pathbytes = desc.slice(4u, desc.len());
1242-
let path = str::from_bytes(pathbytes);
1242+
let path = str::from_utf8(pathbytes);
12431243

12441244
(path, pos)
12451245
}

branches/try2/src/librustc/metadata/tydecode.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ pub fn parse_ident(st: &mut PState, last: char) -> ast::Ident {
9797

9898
fn parse_ident_(st: &mut PState, is_last: @fn(char) -> bool) ->
9999
ast::Ident {
100-
let rslt = scan(st, is_last, str::from_bytes);
100+
let rslt = scan(st, is_last, str::from_utf8);
101101
return st.tcx.sess.ident_of(rslt);
102102
}
103103

@@ -477,7 +477,7 @@ fn parse_abi_set(st: &mut PState) -> AbiSet {
477477
let mut abis = AbiSet::empty();
478478
while peek(st) != ']' {
479479
// FIXME(#5422) str API should not force this copy
480-
let abi_str = scan(st, |c| c == ',', str::from_bytes);
480+
let abi_str = scan(st, |c| c == ',', str::from_utf8);
481481
let abi = abi::lookup(abi_str).expect(abi_str);
482482
abis.add(abi);
483483
}

branches/try2/src/librustc/middle/borrowck/gather_loans/mod.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,6 @@ impl visit::Visitor<@mut GatherLoanCtxt> for GatherLoanVisitor {
9595
fn visit_local(&mut self, l:@Local, e:@mut GatherLoanCtxt) {
9696
gather_loans_in_local(self, l, e);
9797
}
98-
99-
// #7740: Do not visit items here, not even fn items nor methods
100-
// of impl items; the outer loop in borrowck/mod will visit them
101-
// for us in turn. Thus override visit_item's walk with a no-op.
102-
fn visit_item(&mut self, _:@ast::item, _:@mut GatherLoanCtxt) { }
10398
}
10499

105100
pub fn gather_loans(bccx: @BorrowckCtxt,
@@ -140,8 +135,10 @@ fn gather_loans_in_fn(v: &mut GatherLoanVisitor,
140135
id: ast::NodeId,
141136
this: @mut GatherLoanCtxt) {
142137
match fk {
138+
// Do not visit items here, the outer loop in borrowck/mod
139+
// will visit them for us in turn.
143140
&visit::fk_item_fn(*) | &visit::fk_method(*) => {
144-
fail!("cannot occur, due to visit_item override");
141+
return;
145142
}
146143

147144
// Visit closures as part of the containing item.

branches/try2/src/librustc/rustc.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ Available lint options:
161161
max_key = num::max(name.len(), max_key);
162162
}
163163
fn padded(max: uint, s: &str) -> ~str {
164-
str::from_bytes(vec::from_elem(max - s.len(), ' ' as u8)) + s
164+
str::from_utf8(vec::from_elem(max - s.len(), ' ' as u8)) + s
165165
}
166166
println("\nAvailable lint checks:\n");
167167
printfln!(" %s %7.7s %s",
@@ -244,7 +244,7 @@ pub fn run_compiler(args: &[~str], demitter: diagnostic::Emitter) {
244244
1u => {
245245
let ifile = matches.free[0].as_slice();
246246
if "-" == ifile {
247-
let src = str::from_bytes(io::stdin().read_whole_stream());
247+
let src = str::from_utf8(io::stdin().read_whole_stream());
248248
str_input(src.to_managed())
249249
} else {
250250
file_input(Path(ifile))

branches/try2/src/librustdoc/markdown_writer.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@ fn pandoc_writer(
116116

117117
debug!("pandoc result: %i", output.status);
118118
if output.status != 0 {
119-
error!("pandoc-out: %s", str::from_bytes(output.output));
120-
error!("pandoc-err: %s", str::from_bytes(output.error));
119+
error!("pandoc-out: %s", str::from_utf8(output.output));
120+
error!("pandoc-err: %s", str::from_utf8(output.error));
121121
fail!("pandoc failed");
122122
}
123123
}

branches/try2/src/librustpkg/rustpkg.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ impl<'self> PkgScript<'self> {
153153
exe.to_str(), sysroot.to_str(), "configs");
154154
let output = run::process_output(exe.to_str(), [sysroot.to_str(), ~"configs"]);
155155
// Run the configs() function to get the configs
156-
let cfgs = str::from_bytes_slice(output.output).word_iter()
156+
let cfgs = str::from_utf8_slice(output.output).word_iter()
157157
.map(|w| w.to_owned()).collect();
158158
(cfgs, output.status)
159159
}

branches/try2/src/librustpkg/source_control.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ pub fn git_clone(source: &Path, target: &Path, v: &Version) {
2222
debug!("Running: git clone %s %s", source.to_str(), target.to_str());
2323
let outp = run::process_output("git", [~"clone", source.to_str(), target.to_str()]);
2424
if outp.status != 0 {
25-
io::println(str::from_bytes_owned(outp.output.clone()));
26-
io::println(str::from_bytes_owned(outp.error));
25+
io::println(str::from_utf8_owned(outp.output.clone()));
26+
io::println(str::from_utf8_owned(outp.error));
2727
fail!("Couldn't `git clone` %s", source.to_str());
2828
}
2929
else {
@@ -36,8 +36,8 @@ pub fn git_clone(source: &Path, target: &Path, v: &Version) {
3636
fmt!("--git-dir=%s", target.push(".git").to_str()),
3737
~"checkout", fmt!("%s", *s)]);
3838
if outp.status != 0 {
39-
io::println(str::from_bytes_owned(outp.output.clone()));
40-
io::println(str::from_bytes_owned(outp.error));
39+
io::println(str::from_utf8_owned(outp.output.clone()));
40+
io::println(str::from_utf8_owned(outp.error));
4141
fail!("Couldn't `git checkout %s` in %s",
4242
*s, target.to_str());
4343
}
@@ -64,8 +64,8 @@ pub fn git_clone(source: &Path, target: &Path, v: &Version) {
6464
pub fn git_clone_general(source: &str, target: &Path, v: &Version) -> bool {
6565
let outp = run::process_output("git", [~"clone", source.to_str(), target.to_str()]);
6666
if outp.status != 0 {
67-
debug!(str::from_bytes_owned(outp.output.clone()));
68-
debug!(str::from_bytes_owned(outp.error));
67+
debug!(str::from_utf8_owned(outp.output.clone()));
68+
debug!(str::from_utf8_owned(outp.error));
6969
false
7070
}
7171
else {
@@ -74,8 +74,8 @@ pub fn git_clone_general(source: &str, target: &Path, v: &Version) -> bool {
7474
let outp = process_output_in_cwd("git", [~"checkout", fmt!("%s", *s)],
7575
target);
7676
if outp.status != 0 {
77-
debug!(str::from_bytes_owned(outp.output.clone()));
78-
debug!(str::from_bytes_owned(outp.error));
77+
debug!(str::from_utf8_owned(outp.output.clone()));
78+
debug!(str::from_utf8_owned(outp.error));
7979
false
8080
}
8181
else {

0 commit comments

Comments
 (0)