Skip to content

Removed deprecated str() functions. #5119

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ let mut x = 5;
loop {
x += x - 3;
if x % 5 == 0 { break; }
io::println(int::str(x));
io::println(int::to_str(x));
}
~~~~

Expand Down
5 changes: 0 additions & 5 deletions src/libcore/num/int-template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,11 +265,6 @@ pub pure fn to_str_radix(num: T, radix: uint) -> ~str {
buf
}

/// Convert to a string.
/// *Deprecated*, use to_str() instead.
#[inline(always)]
pub pure fn str(i: T) -> ~str { to_str(i) }

impl ToStr for T {
#[inline(always)]
pure fn to_str(&self) -> ~str {
Expand Down
5 changes: 0 additions & 5 deletions src/libcore/num/uint-template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,11 +229,6 @@ pub pure fn to_str_radix(num: T, radix: uint) -> ~str {
buf
}

/// Convert to a string.
/// *Deprecated*, use to_str() instead.
#[inline(always)]
pub pure fn str(i: T) -> ~str { to_str(i) }

impl ToStr for T {
#[inline(always)]
pure fn to_str(&self) -> ~str {
Expand Down
4 changes: 2 additions & 2 deletions src/libfuzzer/fuzzer.rc
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ pub fn check_variants_T<T: Copy>(

if L < 100 {
do under(uint::min(L, 20)) |i| {
log(error, ~"Replacing... #" + uint::str(i));
log(error, ~"Replacing... #" + uint::to_str(i));
let fname = str::from_slice(filename.to_str());
do under(uint::min(L, 30)) |j| {
log(error, ~"With... " + stringifier(@things[j], intr));
Expand Down Expand Up @@ -415,7 +415,7 @@ pub fn check_running(exe_filename: &Path) -> happiness {
}
rc => {
failed(~"Rust program ran but exited with status " +
int::str(rc))
int::to_str(rc))
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/metadata/tyencode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ fn enc_sty(w: io::Writer, cx: @ctxt, +st: ty::sty) {
w.write_char('p');
w.write_str((cx.ds)(did));
w.write_char('|');
w.write_str(uint::str(id));
w.write_str(uint::to_str(id));
}
ty::ty_self => {
w.write_char('s');
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/freevars.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ pub fn annotate_freevars(def_map: resolve::DefMap, crate: @ast::crate) ->

pub fn get_freevars(tcx: ty::ctxt, fid: ast::node_id) -> freevar_info {
match tcx.freevars.find(&fid) {
None => fail!(~"get_freevars: " + int::str(fid) + ~" has no freevars"),
None => fail!(~"get_freevars: "+int::to_str(fid)+~" has no freevars"),
Some(d) => return d
}
}
Expand Down
20 changes: 10 additions & 10 deletions src/libstd/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -842,7 +842,7 @@ priv fn do_strftime(format: &str, tm: &Tm) -> ~str {
//'U' {}
'u' => {
let i = tm.tm_wday as int;
int::str(if i == 0 { 7 } else { i })
int::to_str(if i == 0 { 7 } else { i })
}
//'V' {}
'v' => {
Expand All @@ -852,10 +852,10 @@ priv fn do_strftime(format: &str, tm: &Tm) -> ~str {
parse_type('Y', tm))
}
//'W' {}
'w' => int::str(tm.tm_wday as int),
'w' => int::to_str(tm.tm_wday as int),
//'X' {}
//'x' {}
'Y' => int::str(tm.tm_year as int + 1900),
'Y' => int::to_str(tm.tm_year as int + 1900),
'y' => fmt!("%02d", (tm.tm_year as int + 1900) % 100),
'Z' => copy tm.tm_zone,
'z' => {
Expand Down Expand Up @@ -902,15 +902,15 @@ mod tests {
const some_future_date: i64 = 1577836800i64; // 2020-01-01T00:00:00Z

let tv1 = get_time();
log(debug, ~"tv1=" + uint::str(tv1.sec as uint) + ~" sec + "
+ uint::str(tv1.nsec as uint) + ~" nsec");
log(debug, ~"tv1=" + uint::to_str(tv1.sec as uint) + ~" sec + "
+ uint::to_str(tv1.nsec as uint) + ~" nsec");

assert tv1.sec > some_recent_date;
assert tv1.nsec < 1000000000i32;

let tv2 = get_time();
log(debug, ~"tv2=" + uint::str(tv2.sec as uint) + ~" sec + "
+ uint::str(tv2.nsec as uint) + ~" nsec");
log(debug, ~"tv2=" + uint::to_str(tv2.sec as uint) + ~" sec + "
+ uint::to_str(tv2.nsec as uint) + ~" nsec");

assert tv2.sec >= tv1.sec;
assert tv2.sec < some_future_date;
Expand All @@ -927,13 +927,13 @@ mod tests {
log(debug, ~"s0=" + float::to_str_digits(s0, 9u) + ~" sec");
assert s0 > 0.;
let ns0 = (s0 * 1000000000.) as u64;
log(debug, ~"ns0=" + u64::str(ns0) + ~" ns");
log(debug, ~"ns0=" + u64::to_str(ns0) + ~" ns");

log(debug, ~"ns1=" + u64::str(ns1) + ~" ns");
log(debug, ~"ns1=" + u64::to_str(ns1) + ~" ns");
assert ns1 >= ns0;

let ns2 = precise_time_ns();
log(debug, ~"ns2=" + u64::str(ns2) + ~" ns");
log(debug, ~"ns2=" + u64::to_str(ns2) + ~" ns");
assert ns2 >= ns1;
}

Expand Down
2 changes: 1 addition & 1 deletion src/test/bench/shootout-pfib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ fn main() {
let elapsed = stop - start;

out.write_line(fmt!("%d\t%d\t%s", n, fibn,
u64::str(elapsed)));
u64::to_str(elapsed)));
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/monad.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ impl<A> option_monad<A> for Option<A> {
}

fn transform(x: Option<int>) -> Option<~str> {
x.bind(|n| Some(*n + 1) ).bind(|n| Some(int::str(*n)) )
x.bind(|n| Some(*n + 1) ).bind(|n| Some(int::to_str(*n)) )
}

pub fn main() {
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/static-impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ trait uint_utils {
}

impl uint_utils for uint {
fn str() -> ~str { uint::str(self) }
fn str() -> ~str { uint::to_str(self) }
fn multi(f: fn(uint)) {
let mut c = 0u;
while c < self { f(c); c += 1u; }
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/trait-generic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ trait to_str {
fn to_str() -> ~str;
}
impl to_str for int {
fn to_str() -> ~str { int::str(self) }
fn to_str() -> ~str { int::to_str(self) }
}
impl to_str for ~str {
fn to_str() -> ~str { copy self }
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/trait-to-str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ trait to_str {
}

impl to_str for int {
fn to_str() -> ~str { int::str(self) }
fn to_str() -> ~str { int::to_str(self) }
}

impl<T:to_str> to_str for ~[T] {
Expand Down