Skip to content

Commit 10960c4

Browse files
committed
---
yaml --- r: 110503 b: refs/heads/snap-stage3 c: 9a33330 h: refs/heads/master i: 110501: d6b94bf 110499: 1430921 110495: 74917ba v: v3
1 parent 3b51fbe commit 10960c4

File tree

47 files changed

+272
-254
lines changed

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

+272
-254
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: e415c25bcd81dc1f9a5a3d25d9b48ed2d545336b
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 2ecae80af210d6153cdf0fecb1ecd11fcc390c00
4+
refs/heads/snap-stage3: 9a33330caaaedb9eef447ae862e9b87e3aa9880f
55
refs/heads/try: 597a645456b55e1c886ce15d23a192abdf4d55cf
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ documentation.
5959

6060
[repo]: https://github.com/mozilla/rust
6161
[tarball]: http://static.rust-lang.org/dist/rust-nightly.tar.gz
62-
[tutorial]: http://static.rust-lang.org/doc/nightly/tutorial.html
62+
[tutorial]: http://static.rust-lang.org/doc/master/tutorial.html
6363

6464
## Notes
6565

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ pub fn run(lib_path: &str,
8484

8585
Some(Result {
8686
status: status,
87-
out: str::from_utf8_owned(output).unwrap(),
88-
err: str::from_utf8_owned(error).unwrap()
87+
out: str::from_utf8(output.as_slice()).unwrap().to_owned(),
88+
err: str::from_utf8(error.as_slice()).unwrap().to_owned()
8989
})
9090
},
9191
Err(..) => None

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ fn run_pretty_test(config: &config, props: &TestProps, testfile: &Path) {
153153
match props.pp_exact { Some(_) => 1, None => 2 };
154154

155155
let src = File::open(testfile).read_to_end().unwrap();
156-
let src = str::from_utf8_owned(src).unwrap();
156+
let src = str::from_utf8(src.as_slice()).unwrap().to_owned();
157157
let mut srcs = vec!(src);
158158

159159
let mut round = 0;
@@ -177,7 +177,7 @@ fn run_pretty_test(config: &config, props: &TestProps, testfile: &Path) {
177177
Some(ref file) => {
178178
let filepath = testfile.dir_path().join(file);
179179
let s = File::open(&filepath).read_to_end().unwrap();
180-
str::from_utf8_owned(s).unwrap()
180+
str::from_utf8(s.as_slice()).unwrap().to_owned()
181181
}
182182
None => { (*srcs.get(srcs.len() - 2u)).clone() }
183183
};
@@ -1163,7 +1163,7 @@ fn disassemble_extract(config: &config, _props: &TestProps,
11631163
11641164
fn count_extracted_lines(p: &Path) -> uint {
11651165
let x = File::open(&p.with_extension("ll")).read_to_end().unwrap();
1166-
let x = str::from_utf8_owned(x).unwrap();
1166+
let x = str::from_utf8(x.as_slice()).unwrap();
11671167
x.lines().len()
11681168
}
11691169

branches/snap-stage3/src/doc/complement-cheatsheet.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ Use the [`lines`](http://static.rust-lang.org/doc/master/std/io/trait.Buffer.htm
9696
use std::io::BufferedReader;
9797
# use std::io::MemReader;
9898
99-
# let reader = MemReader::new(~[]);
99+
# let reader = MemReader::new(vec!());
100100
101101
let mut reader = BufferedReader::new(reader);
102102
for line in reader.lines() {

branches/snap-stage3/src/etc/kate/rust.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@
202202
<RegExpr String="[0-9][0-9_]*\.[0-9_]*([eE][+-]?[0-9_]+)?(f32|f64|f)?" attribute="Number" context="#stay"/>
203203
<RegExpr String="[0-9][0-9_]*&rustIntSuf;" attribute="Number" context="#stay"/>
204204
<Detect2Chars char="#" char1="[" attribute="Attribute" context="Attribute" beginRegion="Attribute"/>
205-
<Detect2Chars char="#" char1="!" char2="[" attribute="Attribute" context="Attribute" beginRegion="Attribute"/>
205+
<StringDetect String="#![" attribute="Attribute" context="Attribute" beginRegion="Attribute"/>
206206
<RegExpr String="&rustIdent;::" attribute="Scope"/>
207207
<RegExpr String="&rustIdent;!" attribute="Macro"/>
208208
<RegExpr String="&apos;&rustIdent;(?!&apos;)" attribute="Lifetime"/>

branches/snap-stage3/src/librand/reader.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use Rng;
2323
/// use rand::{reader, Rng};
2424
/// use std::io::MemReader;
2525
///
26-
/// let mut rng = reader::ReaderRng::new(MemReader::new(~[1,2,3,4,5,6,7,8]));
26+
/// let mut rng = reader::ReaderRng::new(MemReader::new(vec!(1,2,3,4,5,6,7,8)));
2727
/// println!("{:x}", rng.gen::<uint>());
2828
/// ```
2929
pub struct ReaderRng<R> {
@@ -80,7 +80,7 @@ mod test {
8080
// transmute from the target to avoid endianness concerns.
8181
let v = ~[1u64, 2u64, 3u64];
8282
let bytes: ~[u8] = unsafe {cast::transmute(v)};
83-
let mut rng = ReaderRng::new(MemReader::new(bytes));
83+
let mut rng = ReaderRng::new(MemReader::new(bytes.move_iter().collect()));
8484

8585
assert_eq!(rng.next_u64(), 1);
8686
assert_eq!(rng.next_u64(), 2);
@@ -91,7 +91,7 @@ mod test {
9191
// transmute from the target to avoid endianness concerns.
9292
let v = ~[1u32, 2u32, 3u32];
9393
let bytes: ~[u8] = unsafe {cast::transmute(v)};
94-
let mut rng = ReaderRng::new(MemReader::new(bytes));
94+
let mut rng = ReaderRng::new(MemReader::new(bytes.move_iter().collect()));
9595

9696
assert_eq!(rng.next_u32(), 1);
9797
assert_eq!(rng.next_u32(), 2);
@@ -102,7 +102,7 @@ mod test {
102102
let v = [1u8, 2, 3, 4, 5, 6, 7, 8];
103103
let mut w = [0u8, .. 8];
104104

105-
let mut rng = ReaderRng::new(MemReader::new(v.to_owned()));
105+
let mut rng = ReaderRng::new(MemReader::new(Vec::from_slice(v)));
106106
rng.fill_bytes(w);
107107

108108
assert!(v == w);
@@ -111,7 +111,7 @@ mod test {
111111
#[test]
112112
#[should_fail]
113113
fn test_reader_rng_insufficient_bytes() {
114-
let mut rng = ReaderRng::new(MemReader::new(~[]));
114+
let mut rng = ReaderRng::new(MemReader::new(vec!()));
115115
let mut v = [0u8, .. 3];
116116
rng.fill_bytes(v);
117117
}

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,10 @@ fn run_ar(sess: &Session, args: &str, cwd: Option<&Path>,
5959
if !o.status.success() {
6060
sess.err(format!("{} {} failed with: {}", ar, args.connect(" "),
6161
o.status));
62-
sess.note(format!("stdout ---\n{}", str::from_utf8(o.output).unwrap()));
63-
sess.note(format!("stderr ---\n{}", str::from_utf8(o.error).unwrap()));
62+
sess.note(format!("stdout ---\n{}",
63+
str::from_utf8(o.output.as_slice()).unwrap()));
64+
sess.note(format!("stderr ---\n{}",
65+
str::from_utf8(o.error.as_slice()).unwrap()));
6466
sess.abort_if_errors();
6567
}
6668
o
@@ -129,7 +131,7 @@ impl<'a> Archive<'a> {
129131
/// Lists all files in an archive
130132
pub fn files(&self) -> Vec<~str> {
131133
let output = run_ar(self.sess, "t", None, [&self.dst]);
132-
let output = str::from_utf8(output.output).unwrap();
134+
let output = str::from_utf8(output.output.as_slice()).unwrap();
133135
// use lines_any because windows delimits output with `\r\n` instead of
134136
// just `\n`
135137
output.lines_any().map(|s| s.to_owned()).collect()

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,9 @@ pub mod write {
350350
if !prog.status.success() {
351351
sess.err(format!("linking with `{}` failed: {}", cc, prog.status));
352352
sess.note(format!("{} arguments: '{}'", cc, args.connect("' '")));
353-
sess.note(str::from_utf8_owned(prog.error + prog.output).unwrap());
353+
let mut note = prog.error.clone();
354+
note.push_all(prog.output.as_slice());
355+
sess.note(str::from_utf8(note.as_slice()).unwrap().to_owned());
354356
sess.abort_if_errors();
355357
}
356358
},
@@ -942,7 +944,8 @@ fn link_rlib<'a>(sess: &'a Session,
942944
let bc = obj_filename.with_extension("bc");
943945
let bc_deflated = obj_filename.with_extension("bc.deflate");
944946
match fs::File::open(&bc).read_to_end().and_then(|data| {
945-
fs::File::create(&bc_deflated).write(flate::deflate_bytes(data).as_slice())
947+
fs::File::create(&bc_deflated)
948+
.write(flate::deflate_bytes(data.as_slice()).as_slice())
946949
}) {
947950
Ok(()) => {}
948951
Err(e) => {
@@ -1038,7 +1041,9 @@ fn link_natively(sess: &Session, dylib: bool, obj_filename: &Path,
10381041
if !prog.status.success() {
10391042
sess.err(format!("linking with `{}` failed: {}", cc_prog, prog.status));
10401043
sess.note(format!("{} arguments: '{}'", cc_prog, cc_args.connect("' '")));
1041-
sess.note(str::from_utf8_owned(prog.error + prog.output).unwrap());
1044+
let mut output = prog.error.clone();
1045+
output.push_all(prog.output.as_slice());
1046+
sess.note(str::from_utf8(output.as_slice()).unwrap().to_owned());
10421047
sess.abort_if_errors();
10431048
}
10441049
},

branches/snap-stage3/src/librustc/driver/driver.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,7 @@ pub fn pretty_print_input(sess: Session,
681681
};
682682

683683
let src_name = source_name(input);
684-
let src = sess.codemap().get_filemap(src_name).src.as_bytes().to_owned();
684+
let src = Vec::from_slice(sess.codemap().get_filemap(src_name).src.as_bytes());
685685
let mut rdr = MemReader::new(src);
686686

687687
match ppm {

branches/snap-stage3/src/librustc/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ pub fn run_compiler(args: &[~str]) {
274274
let ifile = matches.free.get(0).as_slice();
275275
if ifile == "-" {
276276
let contents = io::stdin().read_to_end().unwrap();
277-
let src = str::from_utf8_owned(contents).unwrap();
277+
let src = str::from_utf8(contents.as_slice()).unwrap().to_owned();
278278
(d::StrInput(src), None)
279279
} else {
280280
(d::FileInput(Path::new(ifile)), Some(Path::new(ifile)))

branches/snap-stage3/src/librustc/middle/liveness.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,7 @@ impl<'a> Liveness<'a> {
741741
self.write_vars(wr, ln, |idx| self.users.get(idx).writer);
742742
write!(wr, " precedes {}]", self.successors.get(ln.get()).to_str());
743743
}
744-
str::from_utf8_owned(wr.unwrap()).unwrap()
744+
str::from_utf8(wr.unwrap().as_slice()).unwrap().to_owned()
745745
}
746746

747747
fn init_empty(&mut self, ln: LiveNode, succ_ln: LiveNode) {

branches/snap-stage3/src/librustdoc/html/highlight.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ pub fn highlight(src: &str, class: Option<&str>) -> ~str {
3434
lexer::new_string_reader(&sess.span_diagnostic, fm),
3535
class,
3636
&mut out).unwrap();
37-
str::from_utf8_lossy(out.unwrap()).into_owned()
37+
str::from_utf8_lossy(out.unwrap().as_slice()).into_owned()
3838
}
3939
4040
/// Exhausts the `lexer` writing the output into `out`.

branches/snap-stage3/src/librustdoc/html/render.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ pub fn run(mut krate: clean::Crate, dst: Path) -> io::IoResult<()> {
312312
}
313313
try!(write!(&mut w, "\\};"));
314314

315-
str::from_utf8_owned(w.unwrap()).unwrap()
315+
str::from_utf8(w.unwrap().as_slice()).unwrap().to_owned()
316316
};
317317

318318
// Write out the shared files. Note that these are shared among all rustdoc
@@ -487,7 +487,7 @@ impl<'a> SourceCollector<'a> {
487487
filename.ends_with("macros>") => return Ok(()),
488488
Err(e) => return Err(e)
489489
};
490-
let contents = str::from_utf8_owned(contents).unwrap();
490+
let contents = str::from_utf8(contents.as_slice()).unwrap();
491491

492492
// Remove the utf-8 BOM if any
493493
let contents = if contents.starts_with("\ufeff") {

branches/snap-stage3/src/librustdoc/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ fn json_output(krate: clean::Crate, res: Vec<plugins::PluginJson> ,
389389
let mut encoder = json::Encoder::new(&mut w as &mut io::Writer);
390390
krate.encode(&mut encoder).unwrap();
391391
}
392-
str::from_utf8_owned(w.unwrap()).unwrap()
392+
str::from_utf8(w.unwrap().as_slice()).unwrap().to_owned()
393393
};
394394
let crate_json = match json::from_str(crate_json_str) {
395395
Ok(j) => j,

branches/snap-stage3/src/librustdoc/markdown.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use test::Collector;
2222
fn load_string(input: &Path) -> io::IoResult<Option<~str>> {
2323
let mut f = try!(io::File::open(input));
2424
let d = try!(f.read_to_end());
25-
Ok(str::from_utf8_owned(d))
25+
Ok(str::from_utf8(d.as_slice()).map(|s| s.to_owned()))
2626
}
2727
macro_rules! load_or_return {
2828
($input: expr, $cant_read: expr, $not_utf8: expr) => {

branches/snap-stage3/src/librustdoc/test.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,8 @@ fn runtest(test: &str, cratename: &str, libs: HashSet<Path>, should_fail: bool,
159159
if should_fail && out.status.success() {
160160
fail!("test executable succeeded when it should have failed");
161161
} else if !should_fail && !out.status.success() {
162-
fail!("test executable failed:\n{}", str::from_utf8(out.error));
162+
fail!("test executable failed:\n{}",
163+
str::from_utf8(out.error.as_slice()));
163164
}
164165
}
165166
}

branches/snap-stage3/src/libserialize/json.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ impl<'a> Encoder<'a> {
309309
}
310310

311311
/// Encode the specified struct into a json [u8]
312-
pub fn buffer_encode<T:Encodable<Encoder<'a>, io::IoError>>(to_encode_object: &T) -> ~[u8] {
312+
pub fn buffer_encode<T:Encodable<Encoder<'a>, io::IoError>>(to_encode_object: &T) -> Vec<u8> {
313313
//Serialize the object in a string using a writer
314314
let mut m = MemWriter::new();
315315
{
@@ -322,8 +322,8 @@ impl<'a> Encoder<'a> {
322322

323323
/// Encode the specified struct into a json str
324324
pub fn str_encode<T:Encodable<Encoder<'a>, io::IoError>>(to_encode_object: &T) -> ~str {
325-
let buff:~[u8] = Encoder::buffer_encode(to_encode_object);
326-
str::from_utf8_owned(buff).unwrap()
325+
let buff = Encoder::buffer_encode(to_encode_object);
326+
str::from_utf8(buff.as_slice()).unwrap().to_owned()
327327
}
328328
}
329329

@@ -484,7 +484,7 @@ impl<'a> ::Encoder<io::IoError> for Encoder<'a> {
484484
let mut check_encoder = Encoder::new(&mut buf);
485485
try!(f(&mut check_encoder));
486486
let buf = buf.unwrap();
487-
let out = from_utf8(buf).unwrap();
487+
let out = from_utf8(buf.as_slice()).unwrap();
488488
let needs_wrapping = out.char_at(0) != '"' &&
489489
out.char_at_reverse(out.len()) != '"';
490490
if needs_wrapping { try!(write!(self.wr, "\"")); }
@@ -715,7 +715,7 @@ impl<'a> ::Encoder<io::IoError> for PrettyEncoder<'a> {
715715
let mut check_encoder = PrettyEncoder::new(&mut buf);
716716
try!(f(&mut check_encoder));
717717
let buf = buf.unwrap();
718-
let out = from_utf8(buf).unwrap();
718+
let out = from_utf8(buf.as_slice()).unwrap();
719719
let needs_wrapping = out.char_at(0) != '"' &&
720720
out.char_at_reverse(out.len()) != '"';
721721
if needs_wrapping { try!(write!(self.wr, "\"")); }
@@ -763,7 +763,7 @@ impl Json {
763763
pub fn to_pretty_str(&self) -> ~str {
764764
let mut s = MemWriter::new();
765765
self.to_pretty_writer(&mut s as &mut io::Writer).unwrap();
766-
str::from_utf8_owned(s.unwrap()).unwrap()
766+
str::from_utf8(s.unwrap().as_slice()).unwrap().to_owned()
767767
}
768768

769769
/// If the Json value is an Object, returns the value associated with the provided key.
@@ -1282,8 +1282,8 @@ pub fn from_reader(rdr: &mut io::Reader) -> DecodeResult<Json> {
12821282
Ok(c) => c,
12831283
Err(e) => return Err(IoError(e))
12841284
};
1285-
let s = match str::from_utf8_owned(contents) {
1286-
Some(s) => s,
1285+
let s = match str::from_utf8(contents.as_slice()) {
1286+
Some(s) => s.to_owned(),
12871287
None => return Err(ParseError(~"contents not utf-8", 0, 0))
12881288
};
12891289
let mut parser = Parser::new(s.chars());
@@ -1927,7 +1927,7 @@ mod tests {
19271927
19281928
let mut m = MemWriter::new();
19291929
f(&mut m as &mut io::Writer);
1930-
str::from_utf8_owned(m.unwrap()).unwrap()
1930+
str::from_utf8(m.unwrap().as_slice()).unwrap().to_owned()
19311931
}
19321932
19331933
#[test]
@@ -2528,7 +2528,7 @@ mod tests {
25282528
hm.encode(&mut encoder).unwrap();
25292529
}
25302530
let bytes = mem_buf.unwrap();
2531-
let json_str = from_utf8(bytes).unwrap();
2531+
let json_str = from_utf8(bytes.as_slice()).unwrap();
25322532
match from_str(json_str) {
25332533
Err(_) => fail!("Unable to parse json_str: {:?}", json_str),
25342534
_ => {} // it parsed and we are good to go
@@ -2548,7 +2548,7 @@ mod tests {
25482548
hm.encode(&mut encoder).unwrap();
25492549
}
25502550
let bytes = mem_buf.unwrap();
2551-
let json_str = from_utf8(bytes).unwrap();
2551+
let json_str = from_utf8(bytes.as_slice()).unwrap();
25522552
match from_str(json_str) {
25532553
Err(_) => fail!("Unable to parse json_str: {:?}", json_str),
25542554
_ => {} // it parsed and we are good to go

0 commit comments

Comments
 (0)