about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorSimon Sapin <simon.sapin@exyr.org>2013-12-23 17:45:01 +0100
committerSimon Sapin <simon.sapin@exyr.org>2014-01-21 15:48:48 -0800
commit05ae134acebee3f35af4880de113a7ae7ce20002 (patch)
tree096daf1c7c42bd04ac3d1f11f710fd9786d9937a /src
parentb8c41492939c77b7139e46ee67375b47041f6692 (diff)
downloadrust-05ae134acebee3f35af4880de113a7ae7ce20002.tar.gz
rust-05ae134acebee3f35af4880de113a7ae7ce20002.zip
[std::str] Rename from_utf8_owned_opt() to from_utf8_owned(), drop the old from_utf8_owned() behavior
Diffstat (limited to 'src')
-rw-r--r--src/compiletest/procsrv.rs4
-rw-r--r--src/compiletest/runtest.rs6
-rw-r--r--src/libextra/base64.rs2
-rw-r--r--src/libextra/hex.rs2
-rw-r--r--src/libextra/json.rs10
-rw-r--r--src/libextra/stats.rs2
-rw-r--r--src/libextra/terminfo/parser/compiled.rs2
-rw-r--r--src/libextra/time.rs2
-rw-r--r--src/libextra/uuid.rs2
-rw-r--r--src/libextra/workcache.rs4
-rw-r--r--src/librustc/back/link.rs4
-rw-r--r--src/librustc/lib.rs2
-rw-r--r--src/librustc/metadata/encoder.rs2
-rw-r--r--src/librustc/middle/liveness.rs2
-rw-r--r--src/librustdoc/html/render.rs2
-rw-r--r--src/librustdoc/lib.rs2
-rw-r--r--src/librustpkg/source_control.rs16
-rw-r--r--src/librustpkg/tests.rs2
-rw-r--r--src/libstd/fmt/mod.rs2
-rw-r--r--src/libstd/io/fs.rs2
-rw-r--r--src/libstd/io/mod.rs4
-rw-r--r--src/libstd/num/strconv.rs2
-rw-r--r--src/libstd/repr.rs4
-rw-r--r--src/libstd/run.rs18
-rw-r--r--src/libstd/str.rs34
-rw-r--r--src/libsyntax/ext/source_util.rs2
-rw-r--r--src/libsyntax/parse/comments.rs2
-rw-r--r--src/libsyntax/parse/mod.rs4
-rw-r--r--src/libsyntax/print/pprust.rs2
-rw-r--r--src/test/bench/shootout-k-nucleotide.rs2
-rw-r--r--src/test/bench/shootout-meteor.rs2
-rw-r--r--src/test/run-pass/core-run-destroy.rs4
-rw-r--r--src/test/run-pass/ifmt.rs4
33 files changed, 65 insertions, 91 deletions
diff --git a/src/compiletest/procsrv.rs b/src/compiletest/procsrv.rs
index f919274f2ed..83fb267b0e7 100644
--- a/src/compiletest/procsrv.rs
+++ b/src/compiletest/procsrv.rs
@@ -66,8 +66,8 @@ pub fn run(lib_path: &str,
 
             Some(Result {
                 status: status,
-                out: str::from_utf8_owned(output),
-                err: str::from_utf8_owned(error)
+                out: str::from_utf8_owned(output).unwrap(),
+                err: str::from_utf8_owned(error).unwrap()
             })
         },
         None => None
diff --git a/src/compiletest/runtest.rs b/src/compiletest/runtest.rs
index 7fede7f855d..1d8e5a707ed 100644
--- a/src/compiletest/runtest.rs
+++ b/src/compiletest/runtest.rs
@@ -154,7 +154,7 @@ fn run_pretty_test(config: &config, props: &TestProps, testfile: &Path) {
         match props.pp_exact { Some(_) => 1, None => 2 };
 
     let src = File::open(testfile).read_to_end();
-    let src = str::from_utf8_owned(src);
+    let src = str::from_utf8_owned(src).unwrap();
     let mut srcs = ~[src];
 
     let mut round = 0;
@@ -176,7 +176,7 @@ fn run_pretty_test(config: &config, props: &TestProps, testfile: &Path) {
         Some(ref file) => {
             let filepath = testfile.dir_path().join(file);
             let s = File::open(&filepath).read_to_end();
-            str::from_utf8_owned(s)
+            str::from_utf8_owned(s).unwrap()
           }
           None => { srcs[srcs.len() - 2u].clone() }
         };
@@ -1100,7 +1100,7 @@ fn disassemble_extract(config: &config, _props: &TestProps,
 
 fn count_extracted_lines(p: &Path) -> uint {
     let x = File::open(&p.with_extension("ll")).read_to_end();
-    let x = str::from_utf8_owned(x);
+    let x = str::from_utf8_owned(x).unwrap();
     x.lines().len()
 }
 
diff --git a/src/libextra/base64.rs b/src/libextra/base64.rs
index 1043f700aa7..1fcce6d01ee 100644
--- a/src/libextra/base64.rs
+++ b/src/libextra/base64.rs
@@ -198,7 +198,7 @@ impl<'a> FromBase64 for &'a str {
      *     println!("base64 output: {}", hello_str);
      *     let res = hello_str.from_base64();
      *     if res.is_ok() {
-     *       let optBytes = str::from_utf8_owned_opt(res.unwrap());
+     *       let optBytes = str::from_utf8_owned(res.unwrap());
      *       if optBytes.is_some() {
      *         println!("decoded from base64: {}", optBytes.unwrap());
      *       }
diff --git a/src/libextra/hex.rs b/src/libextra/hex.rs
index e5fcd39667d..343d6aac437 100644
--- a/src/libextra/hex.rs
+++ b/src/libextra/hex.rs
@@ -96,7 +96,7 @@ impl<'a> FromHex for &'a str {
      *     println!("{}", hello_str);
      *     let bytes = hello_str.from_hex().unwrap();
      *     println!("{:?}", bytes);
-     *     let result_str = str::from_utf8_owned(bytes);
+     *     let result_str = str::from_utf8_owned(bytes).unwrap();
      *     println!("{}", result_str);
      * }
      * ```
diff --git a/src/libextra/json.rs b/src/libextra/json.rs
index 9fcafee8c51..a35c474337d 100644
--- a/src/libextra/json.rs
+++ b/src/libextra/json.rs
@@ -312,7 +312,7 @@ impl<'a> Encoder<'a> {
     /// Encode the specified struct into a json str
     pub fn str_encode<T:Encodable<Encoder<'a>>>(to_encode_object: &T) -> ~str  {
         let buff:~[u8] = Encoder::buffer_encode(to_encode_object);
-        str::from_utf8_owned(buff)
+        str::from_utf8_owned(buff).unwrap()
     }
 }
 
@@ -684,7 +684,7 @@ impl Json{
     pub fn to_pretty_str(&self) -> ~str {
         let mut s = MemWriter::new();
         self.to_pretty_writer(&mut s as &mut io::Writer);
-        str::from_utf8_owned(s.unwrap())
+        str::from_utf8_owned(s.unwrap()).unwrap()
     }
 }
 
@@ -1067,7 +1067,7 @@ impl<T : Iterator<char>> Parser<T> {
 
 /// Decodes a json value from an `&mut io::Reader`
 pub fn from_reader(rdr: &mut io::Reader) -> Result<Json, Error> {
-    let s = str::from_utf8_owned(rdr.read_to_end());
+    let s = str::from_utf8_owned(rdr.read_to_end()).unwrap();
     let mut parser = Parser::new(s.chars());
     parser.parse()
 }
@@ -1541,7 +1541,7 @@ impl to_str::ToStr for Json {
     fn to_str(&self) -> ~str {
         let mut s = MemWriter::new();
         self.to_writer(&mut s as &mut io::Writer);
-        str::from_utf8_owned(s.unwrap())
+        str::from_utf8_owned(s.unwrap()).unwrap()
     }
 }
 
@@ -1732,7 +1732,7 @@ mod tests {
 
         let mut m = MemWriter::new();
         f(&mut m as &mut io::Writer);
-        str::from_utf8_owned(m.unwrap())
+        str::from_utf8_owned(m.unwrap()).unwrap()
     }
 
     #[test]
diff --git a/src/libextra/stats.rs b/src/libextra/stats.rs
index 2e953575410..096e5882774 100644
--- a/src/libextra/stats.rs
+++ b/src/libextra/stats.rs
@@ -1001,7 +1001,7 @@ mod tests {
             use std::io::MemWriter;
             let mut m = MemWriter::new();
             write_boxplot(&mut m as &mut io::Writer, s, 30);
-            let out = str::from_utf8_owned(m.unwrap());
+            let out = str::from_utf8_owned(m.unwrap()).unwrap();
             assert_eq!(out, expected);
         }
 
diff --git a/src/libextra/terminfo/parser/compiled.rs b/src/libextra/terminfo/parser/compiled.rs
index 8d63021d51b..23478728330 100644
--- a/src/libextra/terminfo/parser/compiled.rs
+++ b/src/libextra/terminfo/parser/compiled.rs
@@ -216,7 +216,7 @@ pub fn parse(file: &mut io::Reader,
     }
 
     // don't read NUL
-    let names_str = str::from_utf8_owned(file.read_bytes(names_bytes as uint - 1));
+    let names_str = str::from_utf8_owned(file.read_bytes(names_bytes as uint - 1)).unwrap();
 
     let term_names: ~[~str] = names_str.split('|').map(|s| s.to_owned()).collect();
 
diff --git a/src/libextra/time.rs b/src/libextra/time.rs
index 9d7c71d6e6c..3e5b9b797d3 100644
--- a/src/libextra/time.rs
+++ b/src/libextra/time.rs
@@ -1030,7 +1030,7 @@ pub fn strftime(format: &str, tm: &Tm) -> ~str {
         }
     }
 
-    str::from_utf8_owned(buf)
+    str::from_utf8_owned(buf).unwrap()
 }
 
 #[cfg(test)]
diff --git a/src/libextra/uuid.rs b/src/libextra/uuid.rs
index 3465deb5a59..9163a892039 100644
--- a/src/libextra/uuid.rs
+++ b/src/libextra/uuid.rs
@@ -313,7 +313,7 @@ impl Uuid {
             s[i*2+0] = digit[0];
             s[i*2+1] = digit[1];
         }
-        str::from_utf8_owned(s)
+        str::from_utf8_owned(s).unwrap()
     }
 
     /// Returns a string of hexadecimal digits, separated into groups with a hyphen.
diff --git a/src/libextra/workcache.rs b/src/libextra/workcache.rs
index 2bec1a2f962..cccca1309f4 100644
--- a/src/libextra/workcache.rs
+++ b/src/libextra/workcache.rs
@@ -243,7 +243,7 @@ fn json_encode<'a, T:Encodable<json::Encoder<'a>>>(t: &T) -> ~str {
     let mut writer = MemWriter::new();
     let mut encoder = json::Encoder::new(&mut writer as &mut io::Writer);
     t.encode(&mut encoder);
-    str::from_utf8_owned(writer.unwrap())
+    str::from_utf8_owned(writer.unwrap()).unwrap()
 }
 
 // FIXME(#5121)
@@ -491,7 +491,7 @@ fn test() {
         let subcx = cx.clone();
         let pth = pth.clone();
 
-        let file_content = from_utf8_owned(File::open(&pth).read_to_end());
+        let file_content = from_utf8_owned(File::open(&pth).read_to_end()).unwrap();
 
         // FIXME (#9639): This needs to handle non-utf8 paths
         prep.declare_input("file", pth.as_str().unwrap(), file_content);
diff --git a/src/librustc/back/link.rs b/src/librustc/back/link.rs
index 06c13c7de15..63c4d9f4a29 100644
--- a/src/librustc/back/link.rs
+++ b/src/librustc/back/link.rs
@@ -298,7 +298,7 @@ pub mod write {
                 if !prog.status.success() {
                     sess.err(format!("linking with `{}` failed: {}", cc, prog.status));
                     sess.note(format!("{} arguments: '{}'", cc, args.connect("' '")));
-                    sess.note(str::from_utf8_owned(prog.error + prog.output));
+                    sess.note(str::from_utf8_owned(prog.error + prog.output).unwrap());
                     sess.abort_if_errors();
                 }
             },
@@ -1007,7 +1007,7 @@ fn link_natively(sess: Session, dylib: bool, obj_filename: &Path,
             if !prog.status.success() {
                 sess.err(format!("linking with `{}` failed: {}", cc_prog, prog.status));
                 sess.note(format!("{} arguments: '{}'", cc_prog, cc_args.connect("' '")));
-                sess.note(str::from_utf8_owned(prog.error + prog.output));
+                sess.note(str::from_utf8_owned(prog.error + prog.output).unwrap());
                 sess.abort_if_errors();
             }
         },
diff --git a/src/librustc/lib.rs b/src/librustc/lib.rs
index 7ecf2b1e18c..f7ee736f144 100644
--- a/src/librustc/lib.rs
+++ b/src/librustc/lib.rs
@@ -234,7 +234,7 @@ pub fn run_compiler(args: &[~str], demitter: @diagnostic::Emitter) {
       1u => {
         let ifile = matches.free[0].as_slice();
         if "-" == ifile {
-            let src = str::from_utf8_owned(io::stdin().read_to_end());
+            let src = str::from_utf8_owned(io::stdin().read_to_end()).unwrap();
             d::StrInput(src.to_managed())
         } else {
             d::FileInput(Path::new(ifile))
diff --git a/src/librustc/metadata/encoder.rs b/src/librustc/metadata/encoder.rs
index 9bf3e2ca43e..a7c82ba4317 100644
--- a/src/librustc/metadata/encoder.rs
+++ b/src/librustc/metadata/encoder.rs
@@ -1989,5 +1989,5 @@ pub fn encoded_ty(tcx: ty::ctxt, t: ty::t) -> ~str {
         abbrevs: tyencode::ac_no_abbrevs};
     let mut wr = MemWriter::new();
     tyencode::enc_ty(&mut wr, cx, t);
-    str::from_utf8_owned(wr.get_ref().to_owned())
+    str::from_utf8_owned(wr.get_ref().to_owned()).unwrap()
 }
diff --git a/src/librustc/middle/liveness.rs b/src/librustc/middle/liveness.rs
index 03d7c56aeb6..d8bf115eb42 100644
--- a/src/librustc/middle/liveness.rs
+++ b/src/librustc/middle/liveness.rs
@@ -825,7 +825,7 @@ impl Liveness {
                 }
             }
         }
-        str::from_utf8_owned(wr.unwrap())
+        str::from_utf8_owned(wr.unwrap()).unwrap()
     }
 
     pub fn init_empty(&self, ln: LiveNode, succ_ln: LiveNode) {
diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs
index 9a9b588fa47..b0a56cb402b 100644
--- a/src/librustdoc/html/render.rs
+++ b/src/librustdoc/html/render.rs
@@ -427,7 +427,7 @@ impl<'a> SourceCollector<'a> {
                 }
             }
         }
-        let contents = str::from_utf8_owned(contents);
+        let contents = str::from_utf8_owned(contents).unwrap();
 
         // Create the intermediate directories
         let mut cur = self.dst.clone();
diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs
index a6bdb2250a6..393be290506 100644
--- a/src/librustdoc/lib.rs
+++ b/src/librustdoc/lib.rs
@@ -330,7 +330,7 @@ fn json_output(crate: clean::Crate, res: ~[plugins::PluginJson], dst: Path) {
             let mut encoder = json::Encoder::new(&mut w as &mut io::Writer);
             crate.encode(&mut encoder);
         }
-        str::from_utf8_owned(w.unwrap())
+        str::from_utf8_owned(w.unwrap()).unwrap()
     };
     let crate_json = match json::from_str(crate_json_str) {
         Ok(j) => j,
diff --git a/src/librustpkg/source_control.rs b/src/librustpkg/source_control.rs
index 7da99c5d562..4b7aaf7e340 100644
--- a/src/librustpkg/source_control.rs
+++ b/src/librustpkg/source_control.rs
@@ -38,8 +38,8 @@ pub fn safe_git_clone(source: &Path, v: &Version, target: &Path) -> CloneResult
                                                        target.as_str().unwrap().to_owned()]);
             let outp = opt_outp.expect("Failed to exec `git`");
             if !outp.status.success() {
-                println!("{}", str::from_utf8_owned(outp.output.clone()));
-                println!("{}", str::from_utf8_owned(outp.error));
+                println!("{}", str::from_utf8_owned(outp.output.clone()).unwrap());
+                println!("{}", str::from_utf8_owned(outp.error).unwrap());
                 return DirToUse(target.clone());
             }
             else {
@@ -54,8 +54,8 @@ pub fn safe_git_clone(source: &Path, v: &Version, target: &Path) -> CloneResult
                              format!("--git-dir={}", git_dir.as_str().unwrap().to_owned()),
                              ~"checkout", format!("{}", *s)]).expect("Failed to exec `git`");
                         if !outp.status.success() {
-                            println!("{}", str::from_utf8_owned(outp.output.clone()));
-                            println!("{}", str::from_utf8_owned(outp.error));
+                            println!("{}", str::from_utf8_owned(outp.output.clone()).unwrap());
+                            println!("{}", str::from_utf8_owned(outp.error).unwrap());
                             return DirToUse(target.clone());
                         }
                     }
@@ -114,8 +114,8 @@ pub fn git_clone_url(source: &str, target: &Path, v: &Version) {
                                                target.as_str().unwrap().to_owned()]);
     let outp = opt_outp.expect("Failed to exec `git`");
     if !outp.status.success() {
-         debug!("{}", str::from_utf8_owned(outp.output.clone()));
-         debug!("{}", str::from_utf8_owned(outp.error));
+         debug!("{}", str::from_utf8_owned(outp.output.clone()).unwrap());
+         debug!("{}", str::from_utf8_owned(outp.error).unwrap());
          cond.raise((source.to_owned(), target.clone()))
     }
     else {
@@ -125,8 +125,8 @@ pub fn git_clone_url(source: &str, target: &Path, v: &Version) {
                                                          target);
                     let outp = opt_outp.expect("Failed to exec `git`");
                     if !outp.status.success() {
-                        debug!("{}", str::from_utf8_owned(outp.output.clone()));
-                        debug!("{}", str::from_utf8_owned(outp.error));
+                        debug!("{}", str::from_utf8_owned(outp.output.clone()).unwrap());
+                        debug!("{}", str::from_utf8_owned(outp.error).unwrap());
                         cond.raise((source.to_owned(), target.clone()))
                     }
             }
diff --git a/src/librustpkg/tests.rs b/src/librustpkg/tests.rs
index b2cc568ee5e..c0b4a246d35 100644
--- a/src/librustpkg/tests.rs
+++ b/src/librustpkg/tests.rs
@@ -1191,7 +1191,7 @@ fn test_info() {
     let expected_info = ~"package foo"; // fill in
     let workspace = create_local_package(&CrateId::new("foo"));
     let output = command_line_test([~"info", ~"foo"], workspace.path());
-    assert_eq!(str::from_utf8_owned(output.output), expected_info);
+    assert_eq!(str::from_utf8_owned(output.output).unwrap(), expected_info);
 }
 
 #[test]
diff --git a/src/libstd/fmt/mod.rs b/src/libstd/fmt/mod.rs
index 4bee1f42b86..411f9f25459 100644
--- a/src/libstd/fmt/mod.rs
+++ b/src/libstd/fmt/mod.rs
@@ -691,7 +691,7 @@ pub fn format(args: &Arguments) -> ~str {
 pub unsafe fn format_unsafe(fmt: &[rt::Piece], args: &[Argument]) -> ~str {
     let mut output = MemWriter::new();
     write_unsafe(&mut output as &mut io::Writer, fmt, args);
-    return str::from_utf8_owned(output.unwrap());
+    return str::from_utf8_owned(output.unwrap()).unwrap();
 }
 
 impl<'a> Formatter<'a> {
diff --git a/src/libstd/io/fs.rs b/src/libstd/io/fs.rs
index 0564311ad22..cb98ff21105 100644
--- a/src/libstd/io/fs.rs
+++ b/src/libstd/io/fs.rs
@@ -754,7 +754,7 @@ mod test {
             let mut read_buf = [0, .. 1028];
             let read_str = match read_stream.read(read_buf).unwrap() {
                 -1|0 => fail!("shouldn't happen"),
-                n => str::from_utf8_owned(read_buf.slice_to(n).to_owned())
+                n => str::from_utf8_owned(read_buf.slice_to(n).to_owned()).unwrap()
             };
             assert_eq!(read_str, message.to_owned());
         }
diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs
index b12adbf230f..30827983360 100644
--- a/src/libstd/io/mod.rs
+++ b/src/libstd/io/mod.rs
@@ -607,7 +607,7 @@ pub trait Reader {
     /// This function will raise all the same conditions as the `read` method,
     /// along with raising a condition if the input is not valid UTF-8.
     fn read_to_str(&mut self) -> ~str {
-        match str::from_utf8_owned_opt(self.read_to_end()) {
+        match str::from_utf8_owned(self.read_to_end()) {
             Some(s) => s,
             None => {
                 io_error::cond.raise(standard_error(InvalidInput));
@@ -1117,7 +1117,7 @@ pub trait Buffer: Reader {
     /// The task will also fail if sequence of bytes leading up to
     /// the newline character are not valid UTF-8.
     fn read_line(&mut self) -> Option<~str> {
-        self.read_until('\n' as u8).map(str::from_utf8_owned)
+        self.read_until('\n' as u8).map(|line| str::from_utf8_owned(line).unwrap())
     }
 
     /// Create an iterator that reads a line on each iteration until EOF.
diff --git a/src/libstd/num/strconv.rs b/src/libstd/num/strconv.rs
index 5c35c500e6c..bf9e6b739f2 100644
--- a/src/libstd/num/strconv.rs
+++ b/src/libstd/num/strconv.rs
@@ -427,7 +427,7 @@ pub fn float_to_str_common<T:NumCast+Zero+One+Eq+Ord+NumStrConv+Float+Round+
         sign: SignFormat, digits: SignificantDigits) -> (~str, bool) {
     let (bytes, special) = float_to_str_bytes_common(num, radix,
                                negative_zero, sign, digits);
-    (str::from_utf8_owned(bytes), special)
+    (str::from_utf8_owned(bytes).unwrap(), special)
 }
 
 // Some constants for from_str_bytes_common's input validation,
diff --git a/src/libstd/repr.rs b/src/libstd/repr.rs
index 8f7d01f263d..8919f9f8903 100644
--- a/src/libstd/repr.rs
+++ b/src/libstd/repr.rs
@@ -608,7 +608,7 @@ pub fn repr_to_str<T>(t: &T) -> ~str {
 
     let mut result = io::MemWriter::new();
     write_repr(&mut result as &mut io::Writer, t);
-    str::from_utf8_owned(result.unwrap())
+    str::from_utf8_owned(result.unwrap()).unwrap()
 }
 
 #[cfg(test)]
@@ -626,7 +626,7 @@ fn test_repr() {
     fn exact_test<T>(t: &T, e:&str) {
         let mut m = io::MemWriter::new();
         write_repr(&mut m as &mut io::Writer, t);
-        let s = str::from_utf8_owned(m.unwrap());
+        let s = str::from_utf8_owned(m.unwrap()).unwrap();
         assert_eq!(s.as_slice(), e);
     }
 
diff --git a/src/libstd/run.rs b/src/libstd/run.rs
index 3595a7d45ac..f460d3f4944 100644
--- a/src/libstd/run.rs
+++ b/src/libstd/run.rs
@@ -372,7 +372,7 @@ mod tests {
 
         let run::ProcessOutput {status, output, error}
              = run::process_output("echo", [~"hello"]).expect("failed to exec `echo`");
-        let output_str = str::from_utf8_owned(output);
+        let output_str = str::from_utf8_owned(output).unwrap();
 
         assert!(status.success());
         assert_eq!(output_str.trim().to_owned(), ~"hello");
@@ -439,7 +439,7 @@ mod tests {
                 None => break
             }
         }
-        str::from_utf8_owned(res)
+        str::from_utf8_owned(res).unwrap()
     }
 
     #[test]
@@ -467,7 +467,7 @@ mod tests {
             .expect("failed to exec `echo`");
         let run::ProcessOutput {status, output, error}
             = prog.finish_with_output();
-        let output_str = str::from_utf8_owned(output);
+        let output_str = str::from_utf8_owned(output).unwrap();
 
         assert!(status.success());
         assert_eq!(output_str.trim().to_owned(), ~"hello");
@@ -486,7 +486,7 @@ mod tests {
         let run::ProcessOutput {status, output, error}
             = prog.finish_with_output();
 
-        let output_str = str::from_utf8_owned(output);
+        let output_str = str::from_utf8_owned(output).unwrap();
 
         assert!(status.success());
         assert_eq!(output_str.trim().to_owned(), ~"hello");
@@ -533,7 +533,7 @@ mod tests {
     fn test_keep_current_working_dir() {
         let mut prog = run_pwd(None);
 
-        let output = str::from_utf8_owned(prog.finish_with_output().output);
+        let output = str::from_utf8_owned(prog.finish_with_output().output).unwrap();
         let parent_dir = os::getcwd();
         let child_dir = Path::new(output.trim());
 
@@ -551,7 +551,7 @@ mod tests {
         let parent_dir = os::getcwd().dir_path();
         let mut prog = run_pwd(Some(&parent_dir));
 
-        let output = str::from_utf8_owned(prog.finish_with_output().output);
+        let output = str::from_utf8_owned(prog.finish_with_output().output).unwrap();
         let child_dir = Path::new(output.trim());
 
         let parent_stat = parent_dir.stat();
@@ -590,7 +590,7 @@ mod tests {
         if running_on_valgrind() { return; }
 
         let mut prog = run_env(None);
-        let output = str::from_utf8_owned(prog.finish_with_output().output);
+        let output = str::from_utf8_owned(prog.finish_with_output().output).unwrap();
 
         let r = os::env();
         for &(ref k, ref v) in r.iter() {
@@ -604,7 +604,7 @@ mod tests {
         if running_on_valgrind() { return; }
 
         let mut prog = run_env(None);
-        let output = str::from_utf8_owned(prog.finish_with_output().output);
+        let output = str::from_utf8_owned(prog.finish_with_output().output).unwrap();
 
         let r = os::env();
         for &(ref k, ref v) in r.iter() {
@@ -623,7 +623,7 @@ mod tests {
         new_env.push((~"RUN_TEST_NEW_ENV", ~"123"));
 
         let mut prog = run_env(Some(new_env));
-        let output = str::from_utf8_owned(prog.finish_with_output().output);
+        let output = str::from_utf8_owned(prog.finish_with_output().output).unwrap();
 
         assert!(output.contains("RUN_TEST_NEW_ENV=123"));
     }
diff --git a/src/libstd/str.rs b/src/libstd/str.rs
index c266ddfea4b..6d52e94064c 100644
--- a/src/libstd/str.rs
+++ b/src/libstd/str.rs
@@ -129,26 +129,9 @@ condition! {
 Section: Creating a string
 */
 
-/// Consumes a vector of bytes to create a new utf-8 string
-///
-/// # Failure
-///
-/// Raises the `not_utf8` condition if invalid UTF-8
-pub fn from_utf8_owned(vv: ~[u8]) -> ~str {
-    use str::not_utf8::cond;
-
-    if !is_utf8(vv) {
-        let first_bad_byte = *vv.iter().find(|&b| !is_utf8([*b])).unwrap();
-        cond.raise(format!("from_utf8: input is not UTF-8; first bad byte is {}",
-                           first_bad_byte))
-    } else {
-        unsafe { raw::from_utf8_owned(vv) }
-    }
-}
-
 /// Consumes a vector of bytes to create a new utf-8 string.
 /// Returns None if the vector contains invalid UTF-8.
-pub fn from_utf8_owned_opt(vv: ~[u8]) -> Option<~str> {
+pub fn from_utf8_owned(vv: ~[u8]) -> Option<~str> {
     if is_utf8(vv) {
         Some(unsafe { raw::from_utf8_owned(vv) })
     } else {
@@ -3964,22 +3947,13 @@ mod tests {
     #[test]
     fn test_str_from_utf8_owned() {
         let xs = bytes!("hello").to_owned();
-        assert_eq!(from_utf8_owned(xs), ~"hello");
-
-        let xs = bytes!("ศไทย中华Việt Nam").to_owned();
-        assert_eq!(from_utf8_owned(xs), ~"ศไทย中华Việt Nam");
-    }
-
-    #[test]
-    fn test_str_from_utf8_owned_opt() {
-        let xs = bytes!("hello").to_owned();
-        assert_eq!(from_utf8_owned_opt(xs), Some(~"hello"));
+        assert_eq!(from_utf8_owned(xs), Some(~"hello"));
 
         let xs = bytes!("ศไทย中华Việt Nam").to_owned();
-        assert_eq!(from_utf8_owned_opt(xs), Some(~"ศไทย中华Việt Nam"));
+        assert_eq!(from_utf8_owned(xs), Some(~"ศไทย中华Việt Nam"));
 
         let xs = bytes!("hello", 0xff).to_owned();
-        assert_eq!(from_utf8_owned_opt(xs), None);
+        assert_eq!(from_utf8_owned(xs), None);
     }
 
     #[test]
diff --git a/src/libsyntax/ext/source_util.rs b/src/libsyntax/ext/source_util.rs
index 711f8ff11ee..a9f94da7a98 100644
--- a/src/libsyntax/ext/source_util.rs
+++ b/src/libsyntax/ext/source_util.rs
@@ -109,7 +109,7 @@ pub fn expand_include_str(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
         }
         Ok(bytes) => bytes,
     };
-    match str::from_utf8_owned_opt(bytes) {
+    match str::from_utf8_owned(bytes) {
         Some(src) => {
             // Add this input file to the code map to make it available as
             // dependency information
diff --git a/src/libsyntax/parse/comments.rs b/src/libsyntax/parse/comments.rs
index 86ab2e099d0..22ece367b80 100644
--- a/src/libsyntax/parse/comments.rs
+++ b/src/libsyntax/parse/comments.rs
@@ -351,7 +351,7 @@ pub fn gather_comments_and_literals(span_diagnostic:
                                     path: @str,
                                     srdr: &mut io::Reader)
                                  -> (~[Comment], ~[Literal]) {
-    let src = str::from_utf8_owned(srdr.read_to_end()).to_managed();
+    let src = str::from_utf8_owned(srdr.read_to_end()).unwrap().to_managed();
     let cm = CodeMap::new();
     let filemap = cm.new_filemap(path, src);
     let rdr = lexer::new_low_level_string_reader(span_diagnostic, filemap);
diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs
index b1a80878cf1..9713f331147 100644
--- a/src/libsyntax/parse/mod.rs
+++ b/src/libsyntax/parse/mod.rs
@@ -246,7 +246,7 @@ pub fn file_to_filemap(sess: @ParseSess, path: &Path, spanopt: Option<Span>)
             unreachable!()
         }
     };
-    match str::from_utf8_owned_opt(bytes) {
+    match str::from_utf8_owned(bytes) {
         Some(s) => {
             return string_to_filemap(sess, s.to_managed(),
                                      path.as_str().unwrap().to_managed());
@@ -315,7 +315,7 @@ mod test {
         let mut writer = MemWriter::new();
         let mut encoder = extra::json::Encoder::new(&mut writer as &mut io::Writer);
         val.encode(&mut encoder);
-        str::from_utf8_owned(writer.unwrap())
+        str::from_utf8_owned(writer.unwrap()).unwrap()
     }
 
     // produce a codemap::span
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs
index cdfeebd3e1b..54e9a8bd629 100644
--- a/src/libsyntax/print/pprust.rs
+++ b/src/libsyntax/print/pprust.rs
@@ -2316,7 +2316,7 @@ pub fn print_string(s: &mut State, st: &str, style: ast::StrStyle) {
 // downcasts.
 unsafe fn get_mem_writer(writer: &mut ~io::Writer) -> ~str {
     let (_, wr): (uint, ~MemWriter) = cast::transmute_copy(writer);
-    let result = str::from_utf8_owned(wr.get_ref().to_owned());
+    let result = str::from_utf8_owned(wr.get_ref().to_owned()).unwrap();
     cast::forget(wr);
     result
 }
diff --git a/src/test/bench/shootout-k-nucleotide.rs b/src/test/bench/shootout-k-nucleotide.rs
index 067ef873fd3..61e76b99283 100644
--- a/src/test/bench/shootout-k-nucleotide.rs
+++ b/src/test/bench/shootout-k-nucleotide.rs
@@ -59,7 +59,7 @@ impl Code {
         }
 
         reverse(result);
-        str::from_utf8_owned(result)
+        str::from_utf8_owned(result).unwrap()
     }
 }
 
diff --git a/src/test/bench/shootout-meteor.rs b/src/test/bench/shootout-meteor.rs
index 4b6430cbd27..c5b01e68fc4 100644
--- a/src/test/bench/shootout-meteor.rs
+++ b/src/test/bench/shootout-meteor.rs
@@ -187,7 +187,7 @@ fn to_utf8(raw_sol: &List<u64>) -> ~str {
             if m & 1 << i != 0 {sol[i] = '0' as u8 + id;}
         }
     }
-    std::str::from_utf8_owned(sol)
+    std::str::from_utf8_owned(sol).unwrap()
 }
 
 // Prints a solution in ~str form.
diff --git a/src/test/run-pass/core-run-destroy.rs b/src/test/run-pass/core-run-destroy.rs
index 4b7ab09e152..3442e971f4f 100644
--- a/src/test/run-pass/core-run-destroy.rs
+++ b/src/test/run-pass/core-run-destroy.rs
@@ -62,14 +62,14 @@ fn test_destroy_actually_kills(force: bool) {
     fn process_exists(pid: libc::pid_t) -> bool {
         let run::ProcessOutput {output, ..} = run::process_output("ps", [~"-p", pid.to_str()])
             .expect("failed to exec `ps`");
-        str::from_utf8_owned(output).contains(pid.to_str())
+        str::from_utf8_owned(output).unwrap().contains(pid.to_str())
     }
 
     #[cfg(unix,target_os="android")]
     fn process_exists(pid: libc::pid_t) -> bool {
         let run::ProcessOutput {output, ..} = run::process_output("/system/bin/ps", [pid.to_str()])
             .expect("failed to exec `/system/bin/ps`");
-        str::from_utf8_owned(output).contains(~"root")
+        str::from_utf8_owned(output).unwrap().contains(~"root")
     }
 
     #[cfg(windows)]
diff --git a/src/test/run-pass/ifmt.rs b/src/test/run-pass/ifmt.rs
index 54aaa86351e..76759d04ab4 100644
--- a/src/test/run-pass/ifmt.rs
+++ b/src/test/run-pass/ifmt.rs
@@ -260,7 +260,7 @@ fn test_write() {
         writeln!(w, "{foo}", foo="bar");
     }
 
-    let s = str::from_utf8_owned(buf.unwrap());
+    let s = str::from_utf8_owned(buf.unwrap()).unwrap();
     t!(s, "34helloline\nbar\n");
 }
 
@@ -284,7 +284,7 @@ fn test_format_args() {
         format_args!(|args| { fmt::write(w, args) }, "test");
         format_args!(|args| { fmt::write(w, args) }, "{test}", test=3);
     }
-    let s = str::from_utf8_owned(buf.unwrap());
+    let s = str::from_utf8_owned(buf.unwrap()).unwrap();
     t!(s, "1test3");
 
     let s = format_args!(fmt::format, "hello {}", "world");