diff --git a/src/compiletest/procsrv.rs b/src/compiletest/procsrv.rs index a758e9a21bb..6f3fd87466a 100644 --- a/src/compiletest/procsrv.rs +++ b/src/compiletest/procsrv.rs @@ -85,7 +85,7 @@ fn readclose(fd: fd_t) -> str { let buf = ""; while !reader.eof() { let bytes = reader.read_bytes(4096u); - buf += str::unsafe_from_bytes(bytes); + buf += str::from_bytes(bytes); } os::fclose(file); ret buf; @@ -114,8 +114,8 @@ fn worker(p: port) { // the alt discriminant are wrong. alt recv(p) { exec(lib_path, prog, args, respchan) { - {lib_path: str::unsafe_from_bytes(lib_path), - prog: str::unsafe_from_bytes(prog), + {lib_path: str::from_bytes(lib_path), + prog: str::from_bytes(prog), args: clone_vecu8str(args), respchan: respchan} } @@ -189,7 +189,7 @@ fn clone_vecstr(v: [str]) -> [[u8]] { fn clone_vecu8str(v: [[u8]]) -> [str] { let r = []; for t in vec::slice(v, 0u, vec::len(v)) { - r += [str::unsafe_from_bytes(t)]; + r += [str::from_bytes(t)]; } ret r; } diff --git a/src/libcore/extfmt.rs b/src/libcore/extfmt.rs index a06e01f491e..eb91c2cb5d5 100644 --- a/src/libcore/extfmt.rs +++ b/src/libcore/extfmt.rs @@ -390,7 +390,7 @@ fn get_int_precision(cv: conv) -> uint { fn str_init_elt(n_elts: uint, c: char) -> str { let svec = vec::init_elt::(n_elts, c as u8); - ret str::unsafe_from_bytes(svec); + ret str::from_bytes(svec); } enum pad_mode { pad_signed, pad_unsigned, pad_nozero, } fn pad(cv: conv, s: str, mode: pad_mode) -> str { @@ -439,7 +439,7 @@ fn have_precision(cv: conv) -> bool { if signed && zero_padding && str::byte_len(s) > 0u { let head = s[0]; if head == '+' as u8 || head == '-' as u8 || head == ' ' as u8 { - let headstr = str::unsafe_from_bytes([head]); + let headstr = str::from_bytes([head]); // FIXME: not UTF-8 safe let bytelen = str::byte_len(s); let numpart = str::substr(s, 1u, bytelen - 1u);