renamed str::from_slice to str::to_owned
This commit is contained in:
parent
b7da975049
commit
24ef88cee9
@ -91,7 +91,7 @@ pub fn is_test_ignored(config: config, testfile: &Path) -> bool {
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
fn xfail_target() -> ~str {
|
fn xfail_target() -> ~str {
|
||||||
~"xfail-" + str::from_slice(os::SYSNAME)
|
~"xfail-" + str::to_owned(os::SYSNAME)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -371,7 +371,7 @@ fn check_expected_errors(expected_errors: ~[errors::ExpectedError],
|
|||||||
was_expected = true;
|
was_expected = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if !was_expected && is_compiler_error_or_warning(str::from_slice(line)) {
|
if !was_expected && is_compiler_error_or_warning(str::to_owned(line)) {
|
||||||
fatal_ProcRes(fmt!("unexpected compiler error or warning: '%s'",
|
fatal_ProcRes(fmt!("unexpected compiler error or warning: '%s'",
|
||||||
line),
|
line),
|
||||||
ProcRes);
|
ProcRes);
|
||||||
@ -596,7 +596,7 @@ fn make_lib_name(config: config, auxfile: &Path, testfile: &Path) -> Path {
|
|||||||
|
|
||||||
fn make_exe_name(config: config, testfile: &Path) -> Path {
|
fn make_exe_name(config: config, testfile: &Path) -> Path {
|
||||||
Path(output_base_name(config, testfile).to_str() +
|
Path(output_base_name(config, testfile).to_str() +
|
||||||
str::from_slice(os::EXE_SUFFIX))
|
str::to_owned(os::EXE_SUFFIX))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn make_run_args(config: config, _props: TestProps, testfile: &Path) ->
|
fn make_run_args(config: config, _props: TestProps, testfile: &Path) ->
|
||||||
|
@ -711,7 +711,7 @@ impl<T:Reader> ReaderUtil for T {
|
|||||||
fn read_lines(&self) -> ~[~str] {
|
fn read_lines(&self) -> ~[~str] {
|
||||||
do vec::build |push| {
|
do vec::build |push| {
|
||||||
for self.each_line |line| {
|
for self.each_line |line| {
|
||||||
push(str::from_slice(line));
|
push(str::to_owned(line));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -396,8 +396,8 @@ fn dup2(src: c_int, dst: c_int) -> c_int {
|
|||||||
|
|
||||||
|
|
||||||
pub fn dll_filename(base: &str) -> ~str {
|
pub fn dll_filename(base: &str) -> ~str {
|
||||||
return str::from_slice(DLL_PREFIX) + str::from_slice(base) +
|
return str::to_owned(DLL_PREFIX) + str::to_owned(base) +
|
||||||
str::from_slice(DLL_SUFFIX)
|
str::to_owned(DLL_SUFFIX)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -477,7 +477,7 @@ impl GenericPath for PosixPath {
|
|||||||
fn with_filestem(&self, s: &str) -> PosixPath {
|
fn with_filestem(&self, s: &str) -> PosixPath {
|
||||||
match self.filetype() {
|
match self.filetype() {
|
||||||
None => self.with_filename(s),
|
None => self.with_filename(s),
|
||||||
Some(ref t) => self.with_filename(str::from_slice(s) + *t)
|
Some(ref t) => self.with_filename(str::to_owned(s) + *t)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -488,7 +488,7 @@ impl GenericPath for PosixPath {
|
|||||||
Some(ref s) => self.with_filename(*s)
|
Some(ref s) => self.with_filename(*s)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let t = ~"." + str::from_slice(t);
|
let t = ~"." + str::to_owned(t);
|
||||||
match self.filestem() {
|
match self.filestem() {
|
||||||
None => self.with_filename(t),
|
None => self.with_filename(t),
|
||||||
Some(ref s) => self.with_filename(*s + t)
|
Some(ref s) => self.with_filename(*s + t)
|
||||||
@ -621,7 +621,7 @@ impl GenericPath for WindowsPath {
|
|||||||
None => {
|
None => {
|
||||||
host = None;
|
host = None;
|
||||||
device = None;
|
device = None;
|
||||||
rest = str::from_slice(s);
|
rest = str::to_owned(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -694,7 +694,7 @@ impl GenericPath for WindowsPath {
|
|||||||
fn with_filestem(&self, s: &str) -> WindowsPath {
|
fn with_filestem(&self, s: &str) -> WindowsPath {
|
||||||
match self.filetype() {
|
match self.filetype() {
|
||||||
None => self.with_filename(s),
|
None => self.with_filename(s),
|
||||||
Some(ref t) => self.with_filename(str::from_slice(s) + *t)
|
Some(ref t) => self.with_filename(str::to_owned(s) + *t)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -705,7 +705,7 @@ impl GenericPath for WindowsPath {
|
|||||||
Some(ref s) => self.with_filename(*s)
|
Some(ref s) => self.with_filename(*s)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let t = ~"." + str::from_slice(t);
|
let t = ~"." + str::to_owned(t);
|
||||||
match self.filestem() {
|
match self.filestem() {
|
||||||
None => self.with_filename(t),
|
None => self.with_filename(t),
|
||||||
Some(ref s) =>
|
Some(ref s) =>
|
||||||
@ -956,7 +956,7 @@ mod tests {
|
|||||||
fn test_posix_paths() {
|
fn test_posix_paths() {
|
||||||
fn t(wp: &PosixPath, s: &str) {
|
fn t(wp: &PosixPath, s: &str) {
|
||||||
let ss = wp.to_str();
|
let ss = wp.to_str();
|
||||||
let sss = str::from_slice(s);
|
let sss = str::to_owned(s);
|
||||||
if (ss != sss) {
|
if (ss != sss) {
|
||||||
debug!("got %s", ss);
|
debug!("got %s", ss);
|
||||||
debug!("expected %s", sss);
|
debug!("expected %s", sss);
|
||||||
@ -1014,7 +1014,7 @@ mod tests {
|
|||||||
fn test_normalize() {
|
fn test_normalize() {
|
||||||
fn t(wp: &PosixPath, s: &str) {
|
fn t(wp: &PosixPath, s: &str) {
|
||||||
let ss = wp.to_str();
|
let ss = wp.to_str();
|
||||||
let sss = str::from_slice(s);
|
let sss = str::to_owned(s);
|
||||||
if (ss != sss) {
|
if (ss != sss) {
|
||||||
debug!("got %s", ss);
|
debug!("got %s", ss);
|
||||||
debug!("expected %s", sss);
|
debug!("expected %s", sss);
|
||||||
@ -1077,7 +1077,7 @@ mod tests {
|
|||||||
fn test_windows_paths() {
|
fn test_windows_paths() {
|
||||||
fn t(wp: &WindowsPath, s: &str) {
|
fn t(wp: &WindowsPath, s: &str) {
|
||||||
let ss = wp.to_str();
|
let ss = wp.to_str();
|
||||||
let sss = str::from_slice(s);
|
let sss = str::to_owned(s);
|
||||||
if (ss != sss) {
|
if (ss != sss) {
|
||||||
debug!("got %s", ss);
|
debug!("got %s", ss);
|
||||||
debug!("expected %s", sss);
|
debug!("expected %s", sss);
|
||||||
|
@ -78,21 +78,21 @@ pub fn from_bytes_slice<'a>(vector: &'a [u8]) -> &'a str {
|
|||||||
|
|
||||||
/// Copy a slice into a new unique str
|
/// Copy a slice into a new unique str
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub fn from_slice(s: &str) -> ~str {
|
pub fn to_owned(s: &str) -> ~str {
|
||||||
unsafe { raw::slice_bytes_owned(s, 0, len(s)) }
|
unsafe { raw::slice_bytes_owned(s, 0, len(s)) }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ToStr for ~str {
|
impl ToStr for ~str {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn to_str(&self) -> ~str { from_slice(*self) }
|
fn to_str(&self) -> ~str { to_owned(*self) }
|
||||||
}
|
}
|
||||||
impl<'self> ToStr for &'self str {
|
impl<'self> ToStr for &'self str {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn to_str(&self) -> ~str { from_slice(*self) }
|
fn to_str(&self) -> ~str { to_owned(*self) }
|
||||||
}
|
}
|
||||||
impl ToStr for @str {
|
impl ToStr for @str {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn to_str(&self) -> ~str { from_slice(*self) }
|
fn to_str(&self) -> ~str { to_owned(*self) }
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -511,7 +511,7 @@ Section: Transforming strings
|
|||||||
*/
|
*/
|
||||||
pub fn to_bytes(s: &str) -> ~[u8] {
|
pub fn to_bytes(s: &str) -> ~[u8] {
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut v: ~[u8] = ::cast::transmute(from_slice(s));
|
let mut v: ~[u8] = ::cast::transmute(to_owned(s));
|
||||||
vec::raw::set_len(&mut v, len(s));
|
vec::raw::set_len(&mut v, len(s));
|
||||||
v
|
v
|
||||||
}
|
}
|
||||||
@ -2141,7 +2141,7 @@ pub fn as_c_str<T>(s: &str, f: &fn(*libc::c_char) -> T) -> T {
|
|||||||
// NB: len includes the trailing null.
|
// NB: len includes the trailing null.
|
||||||
assert!(len > 0);
|
assert!(len > 0);
|
||||||
if unsafe { *(ptr::offset(buf,len-1)) != 0 } {
|
if unsafe { *(ptr::offset(buf,len-1)) != 0 } {
|
||||||
as_c_str(from_slice(s), f)
|
as_c_str(to_owned(s), f)
|
||||||
} else {
|
} else {
|
||||||
f(buf as *libc::c_char)
|
f(buf as *libc::c_char)
|
||||||
}
|
}
|
||||||
@ -2682,7 +2682,7 @@ impl<'self> StrSlice<'self> for &'self str {
|
|||||||
|
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn to_owned(&self) -> ~str { from_slice(*self) }
|
fn to_owned(&self) -> ~str { to_owned(*self) }
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn to_managed(&self) -> @str {
|
fn to_managed(&self) -> @str {
|
||||||
@ -2722,7 +2722,7 @@ impl OwnedStr for ~str {
|
|||||||
impl Clone for ~str {
|
impl Clone for ~str {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn clone(&self) -> ~str {
|
fn clone(&self) -> ~str {
|
||||||
from_slice(*self)
|
to_owned(*self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -316,7 +316,7 @@ pub fn check_variants_T<T:Copy>(crate: @ast::crate,
|
|||||||
if L < 100 {
|
if L < 100 {
|
||||||
do under(uint::min(L, 20)) |i| {
|
do under(uint::min(L, 20)) |i| {
|
||||||
error!("Replacing... #%?", uint::to_str(i));
|
error!("Replacing... #%?", uint::to_str(i));
|
||||||
let fname = str::from_slice(filename.to_str());
|
let fname = str::to_owned(filename.to_str());
|
||||||
do under(uint::min(L, 30)) |j| {
|
do under(uint::min(L, 30)) |j| {
|
||||||
let fname = fname.to_str();
|
let fname = fname.to_str();
|
||||||
error!("With... %?", stringifier(things[j], intr));
|
error!("With... %?", stringifier(things[j], intr));
|
||||||
|
@ -747,8 +747,8 @@ pub fn output_dll_filename(os: session::os, lm: LinkMeta) -> ~str {
|
|||||||
session::os_android => (android::DLL_PREFIX, android::DLL_SUFFIX),
|
session::os_android => (android::DLL_PREFIX, android::DLL_SUFFIX),
|
||||||
session::os_freebsd => (freebsd::DLL_PREFIX, freebsd::DLL_SUFFIX),
|
session::os_freebsd => (freebsd::DLL_PREFIX, freebsd::DLL_SUFFIX),
|
||||||
};
|
};
|
||||||
return str::from_slice(dll_prefix) + libname +
|
return str::to_owned(dll_prefix) + libname +
|
||||||
str::from_slice(dll_suffix);
|
str::to_owned(dll_suffix);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the user wants an exe generated we need to invoke
|
// If the user wants an exe generated we need to invoke
|
||||||
|
@ -91,9 +91,9 @@ pub fn default_configuration(sess: Session, argv0: @~str, input: &input) ->
|
|||||||
};
|
};
|
||||||
|
|
||||||
return ~[ // Target bindings.
|
return ~[ // Target bindings.
|
||||||
attr::mk_word_item(@str::from_slice(os::FAMILY)),
|
attr::mk_word_item(@str::to_owned(os::FAMILY)),
|
||||||
mk(@~"target_os", @tos),
|
mk(@~"target_os", @tos),
|
||||||
mk(@~"target_family", @str::from_slice(os::FAMILY)),
|
mk(@~"target_family", @str::to_owned(os::FAMILY)),
|
||||||
mk(@~"target_arch", @arch),
|
mk(@~"target_arch", @arch),
|
||||||
mk(@~"target_endian", @end),
|
mk(@~"target_endian", @end),
|
||||||
mk(@~"target_word_size", @wordsz),
|
mk(@~"target_word_size", @wordsz),
|
||||||
@ -648,7 +648,7 @@ pub fn build_session_options(binary: @~str,
|
|||||||
let linker_args = getopts::opt_strs(matches, ~"link-args").flat_map( |a| {
|
let linker_args = getopts::opt_strs(matches, ~"link-args").flat_map( |a| {
|
||||||
let mut args = ~[];
|
let mut args = ~[];
|
||||||
for str::each_split_char(*a, ' ') |arg| {
|
for str::each_split_char(*a, ' ') |arg| {
|
||||||
args.push(str::from_slice(arg));
|
args.push(str::to_owned(arg));
|
||||||
}
|
}
|
||||||
args
|
args
|
||||||
});
|
});
|
||||||
|
@ -73,7 +73,7 @@ pub fn mk_filesearch(maybe_sysroot: &Option<@Path>,
|
|||||||
@FileSearchImpl {
|
@FileSearchImpl {
|
||||||
sysroot: sysroot,
|
sysroot: sysroot,
|
||||||
addl_lib_search_paths: addl_lib_search_paths,
|
addl_lib_search_paths: addl_lib_search_paths,
|
||||||
target_triple: str::from_slice(target_triple)
|
target_triple: str::to_owned(target_triple)
|
||||||
} as @FileSearch
|
} as @FileSearch
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,7 +99,7 @@ pub fn search<T:Copy>(filesearch: @FileSearch, pick: pick<T>) -> Option<T> {
|
|||||||
|
|
||||||
pub fn relative_target_lib_path(target_triple: &str) -> Path {
|
pub fn relative_target_lib_path(target_triple: &str) -> Path {
|
||||||
Path(libdir()).push_many([~"rustc",
|
Path(libdir()).push_many([~"rustc",
|
||||||
str::from_slice(target_triple),
|
str::to_owned(target_triple),
|
||||||
libdir()])
|
libdir()])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ fn libname(cx: &Context) -> (~str, ~str) {
|
|||||||
os_freebsd => (freebsd::DLL_PREFIX, freebsd::DLL_SUFFIX),
|
os_freebsd => (freebsd::DLL_PREFIX, freebsd::DLL_SUFFIX),
|
||||||
};
|
};
|
||||||
|
|
||||||
(str::from_slice(dll_prefix), str::from_slice(dll_suffix))
|
(str::to_owned(dll_prefix), str::to_owned(dll_suffix))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn find_library_crate_aux(
|
fn find_library_crate_aux(
|
||||||
|
@ -104,7 +104,7 @@ impl get_insn_ctxt for @CrateContext {
|
|||||||
fn insn_ctxt(&self, s: &str) -> icx_popper {
|
fn insn_ctxt(&self, s: &str) -> icx_popper {
|
||||||
debug!("new insn_ctxt: %s", s);
|
debug!("new insn_ctxt: %s", s);
|
||||||
if self.sess.count_llvm_insns() {
|
if self.sess.count_llvm_insns() {
|
||||||
self.stats.llvm_insn_ctxt.push(str::from_slice(s));
|
self.stats.llvm_insn_ctxt.push(str::to_owned(s));
|
||||||
}
|
}
|
||||||
icx_popper(*self)
|
icx_popper(*self)
|
||||||
}
|
}
|
||||||
|
@ -129,13 +129,13 @@ fn first_sentence_(s: &str) -> ~str {
|
|||||||
};
|
};
|
||||||
match idx {
|
match idx {
|
||||||
Some(idx) if idx > 2u => {
|
Some(idx) if idx > 2u => {
|
||||||
str::from_slice(str::slice(s, 0, idx - 1))
|
str::to_owned(str::slice(s, 0, idx - 1))
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
if str::ends_with(s, ~".") {
|
if str::ends_with(s, ~".") {
|
||||||
str::from_slice(s)
|
str::to_owned(s)
|
||||||
} else {
|
} else {
|
||||||
str::from_slice(s)
|
str::to_owned(s)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -106,7 +106,7 @@ pub struct Opt {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn mkname(nm: &str) -> Name {
|
fn mkname(nm: &str) -> Name {
|
||||||
let unm = str::from_slice(nm);
|
let unm = str::to_owned(nm);
|
||||||
return if nm.len() == 1u {
|
return if nm.len() == 1u {
|
||||||
Short(str::char_at(unm, 0u))
|
Short(str::char_at(unm, 0u))
|
||||||
} else { Long(unm) };
|
} else { Long(unm) };
|
||||||
@ -441,7 +441,7 @@ pub fn opt_default(mm: &Matches, nm: &str, def: &str) -> Option<~str> {
|
|||||||
let vals = opt_vals(mm, nm);
|
let vals = opt_vals(mm, nm);
|
||||||
if vec::len::<Optval>(vals) == 0u { return None::<~str>; }
|
if vec::len::<Optval>(vals) == 0u { return None::<~str>; }
|
||||||
return match vals[0] { Val(copy s) => Some::<~str>(s),
|
return match vals[0] { Val(copy s) => Some::<~str>(s),
|
||||||
_ => Some::<~str>(str::from_slice(def)) }
|
_ => Some::<~str>(str::to_owned(def)) }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Eq)]
|
#[deriving(Eq)]
|
||||||
@ -481,10 +481,10 @@ pub mod groups {
|
|||||||
desc: &str, hint: &str) -> OptGroup {
|
desc: &str, hint: &str) -> OptGroup {
|
||||||
let len = short_name.len();
|
let len = short_name.len();
|
||||||
assert!(len == 1 || len == 0);
|
assert!(len == 1 || len == 0);
|
||||||
return OptGroup { short_name: str::from_slice(short_name),
|
return OptGroup { short_name: str::to_owned(short_name),
|
||||||
long_name: str::from_slice(long_name),
|
long_name: str::to_owned(long_name),
|
||||||
hint: str::from_slice(hint),
|
hint: str::to_owned(hint),
|
||||||
desc: str::from_slice(desc),
|
desc: str::to_owned(desc),
|
||||||
hasarg: Yes,
|
hasarg: Yes,
|
||||||
occur: Req};
|
occur: Req};
|
||||||
}
|
}
|
||||||
@ -494,10 +494,10 @@ pub mod groups {
|
|||||||
desc: &str, hint: &str) -> OptGroup {
|
desc: &str, hint: &str) -> OptGroup {
|
||||||
let len = short_name.len();
|
let len = short_name.len();
|
||||||
assert!(len == 1 || len == 0);
|
assert!(len == 1 || len == 0);
|
||||||
return OptGroup {short_name: str::from_slice(short_name),
|
return OptGroup {short_name: str::to_owned(short_name),
|
||||||
long_name: str::from_slice(long_name),
|
long_name: str::to_owned(long_name),
|
||||||
hint: str::from_slice(hint),
|
hint: str::to_owned(hint),
|
||||||
desc: str::from_slice(desc),
|
desc: str::to_owned(desc),
|
||||||
hasarg: Yes,
|
hasarg: Yes,
|
||||||
occur: Optional};
|
occur: Optional};
|
||||||
}
|
}
|
||||||
@ -507,10 +507,10 @@ pub mod groups {
|
|||||||
desc: &str) -> OptGroup {
|
desc: &str) -> OptGroup {
|
||||||
let len = short_name.len();
|
let len = short_name.len();
|
||||||
assert!(len == 1 || len == 0);
|
assert!(len == 1 || len == 0);
|
||||||
return OptGroup {short_name: str::from_slice(short_name),
|
return OptGroup {short_name: str::to_owned(short_name),
|
||||||
long_name: str::from_slice(long_name),
|
long_name: str::to_owned(long_name),
|
||||||
hint: ~"",
|
hint: ~"",
|
||||||
desc: str::from_slice(desc),
|
desc: str::to_owned(desc),
|
||||||
hasarg: No,
|
hasarg: No,
|
||||||
occur: Optional};
|
occur: Optional};
|
||||||
}
|
}
|
||||||
@ -520,10 +520,10 @@ pub mod groups {
|
|||||||
desc: &str, hint: &str) -> OptGroup {
|
desc: &str, hint: &str) -> OptGroup {
|
||||||
let len = short_name.len();
|
let len = short_name.len();
|
||||||
assert!(len == 1 || len == 0);
|
assert!(len == 1 || len == 0);
|
||||||
return OptGroup {short_name: str::from_slice(short_name),
|
return OptGroup {short_name: str::to_owned(short_name),
|
||||||
long_name: str::from_slice(long_name),
|
long_name: str::to_owned(long_name),
|
||||||
hint: str::from_slice(hint),
|
hint: str::to_owned(hint),
|
||||||
desc: str::from_slice(desc),
|
desc: str::to_owned(desc),
|
||||||
hasarg: Maybe,
|
hasarg: Maybe,
|
||||||
occur: Optional};
|
occur: Optional};
|
||||||
}
|
}
|
||||||
@ -536,10 +536,10 @@ pub mod groups {
|
|||||||
desc: &str, hint: &str) -> OptGroup {
|
desc: &str, hint: &str) -> OptGroup {
|
||||||
let len = short_name.len();
|
let len = short_name.len();
|
||||||
assert!(len == 1 || len == 0);
|
assert!(len == 1 || len == 0);
|
||||||
return OptGroup {short_name: str::from_slice(short_name),
|
return OptGroup {short_name: str::to_owned(short_name),
|
||||||
long_name: str::from_slice(long_name),
|
long_name: str::to_owned(long_name),
|
||||||
hint: str::from_slice(hint),
|
hint: str::to_owned(hint),
|
||||||
desc: str::from_slice(desc),
|
desc: str::to_owned(desc),
|
||||||
hasarg: Yes,
|
hasarg: Yes,
|
||||||
occur: Multi};
|
occur: Multi};
|
||||||
}
|
}
|
||||||
@ -648,7 +648,7 @@ pub mod groups {
|
|||||||
row
|
row
|
||||||
});
|
});
|
||||||
|
|
||||||
return str::from_slice(brief) +
|
return str::to_owned(brief) +
|
||||||
~"\n\nOptions:\n" +
|
~"\n\nOptions:\n" +
|
||||||
str::connect(rows, ~"\n") +
|
str::connect(rows, ~"\n") +
|
||||||
~"\n\n";
|
~"\n\n";
|
||||||
|
@ -225,7 +225,7 @@ pub mod v4 {
|
|||||||
let input_is_inaddr_none =
|
let input_is_inaddr_none =
|
||||||
result::get(&ip_rep_result).as_u32() == INADDR_NONE;
|
result::get(&ip_rep_result).as_u32() == INADDR_NONE;
|
||||||
|
|
||||||
let new_addr = uv_ip4_addr(str::from_slice(ip), 22);
|
let new_addr = uv_ip4_addr(str::to_owned(ip), 22);
|
||||||
let reformatted_name = uv_ip4_name(&new_addr);
|
let reformatted_name = uv_ip4_name(&new_addr);
|
||||||
debug!("try_parse_addr: input ip: %s reparsed ip: %s",
|
debug!("try_parse_addr: input ip: %s reparsed ip: %s",
|
||||||
ip, reformatted_name);
|
ip, reformatted_name);
|
||||||
@ -278,7 +278,7 @@ pub mod v6 {
|
|||||||
pub fn try_parse_addr(ip: &str) -> result::Result<IpAddr,ParseAddrErr> {
|
pub fn try_parse_addr(ip: &str) -> result::Result<IpAddr,ParseAddrErr> {
|
||||||
unsafe {
|
unsafe {
|
||||||
// need to figure out how to establish a parse failure..
|
// need to figure out how to establish a parse failure..
|
||||||
let new_addr = uv_ip6_addr(str::from_slice(ip), 22);
|
let new_addr = uv_ip6_addr(str::to_owned(ip), 22);
|
||||||
let reparsed_name = uv_ip6_name(&new_addr);
|
let reparsed_name = uv_ip6_name(&new_addr);
|
||||||
debug!("v6::try_parse_addr ip: '%s' reparsed '%s'",
|
debug!("v6::try_parse_addr ip: '%s' reparsed '%s'",
|
||||||
ip, reparsed_name);
|
ip, reparsed_name);
|
||||||
|
@ -289,7 +289,7 @@ priv fn do_strptime(s: &str, format: &str) -> Result<Tm, ~str> {
|
|||||||
|
|
||||||
let mut i = 0u;
|
let mut i = 0u;
|
||||||
while i < digits {
|
while i < digits {
|
||||||
let range = str::char_range_at(str::from_slice(ss), pos);
|
let range = str::char_range_at(str::to_owned(ss), pos);
|
||||||
pos = range.next;
|
pos = range.next;
|
||||||
|
|
||||||
match range.ch {
|
match range.ch {
|
||||||
@ -628,7 +628,7 @@ priv fn do_strptime(s: &str, format: &str) -> Result<Tm, ~str> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
do io::with_str_reader(str::from_slice(format)) |rdr| {
|
do io::with_str_reader(str::to_owned(format)) |rdr| {
|
||||||
let mut tm = Tm {
|
let mut tm = Tm {
|
||||||
tm_sec: 0_i32,
|
tm_sec: 0_i32,
|
||||||
tm_min: 0_i32,
|
tm_min: 0_i32,
|
||||||
@ -840,7 +840,7 @@ priv fn do_strftime(format: &str, tm: &Tm) -> ~str {
|
|||||||
|
|
||||||
let mut buf = ~"";
|
let mut buf = ~"";
|
||||||
|
|
||||||
do io::with_str_reader(str::from_slice(format)) |rdr| {
|
do io::with_str_reader(str::to_owned(format)) |rdr| {
|
||||||
while !rdr.eof() {
|
while !rdr.eof() {
|
||||||
match rdr.read_char() {
|
match rdr.read_char() {
|
||||||
'%' => buf += parse_type(rdr.read_char(), tm),
|
'%' => buf += parse_type(rdr.read_char(), tm),
|
||||||
@ -1022,7 +1022,7 @@ mod tests {
|
|||||||
|
|
||||||
fn test(s: &str, format: &str) -> bool {
|
fn test(s: &str, format: &str) -> bool {
|
||||||
match strptime(s, format) {
|
match strptime(s, format) {
|
||||||
Ok(ref tm) => tm.strftime(format) == str::from_slice(s),
|
Ok(ref tm) => tm.strftime(format) == str::to_owned(s),
|
||||||
Err(copy e) => fail!(e)
|
Err(copy e) => fail!(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -123,7 +123,7 @@ pub mod rt {
|
|||||||
|
|
||||||
impl<'self> ToSource for &'self str {
|
impl<'self> ToSource for &'self str {
|
||||||
fn to_source(&self, _cx: @ext_ctxt) -> ~str {
|
fn to_source(&self, _cx: @ext_ctxt) -> ~str {
|
||||||
let lit = dummy_spanned(ast::lit_str(@str::from_slice(*self)));
|
let lit = dummy_spanned(ast::lit_str(@str::to_owned(*self)));
|
||||||
pprust::lit_to_str(@lit)
|
pprust::lit_to_str(@lit)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,5 +12,5 @@ struct S { f0: ~str, f1: int }
|
|||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
let s = ~"Hello, world!";
|
let s = ~"Hello, world!";
|
||||||
let _s = S { f0: str::from_slice(s), ..S { f0: s, f1: 23 } };
|
let _s = S { f0: str::to_owned(s), ..S { f0: s, f1: 23 } };
|
||||||
}
|
}
|
||||||
|
@ -12,5 +12,5 @@ struct S { f0: ~str, f1: ~str }
|
|||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
let s = ~"Hello, world!";
|
let s = ~"Hello, world!";
|
||||||
let _s = S { f1: str::from_slice(s), f0: s };
|
let _s = S { f1: str::to_owned(s), f0: s };
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user