import std::option::some;
import std::option::none;
import std::str;
+import std::istr;
import std::vec;
import std::int;
import std::io;
alt node {
pprust::node_item(s, item) {
pp::space(s.s);
- pprust::synth_comment(s, int::to_str(item.id, 10u));
+ pprust::synth_comment(
+ s, istr::to_estr(int::to_str(item.id, 10u)));
}
pprust::node_block(s, blk) {
pp::space(s.s);
- pprust::synth_comment(s,
- "block " + int::to_str(blk.node.id, 10u));
+ pprust::synth_comment(
+ s, istr::to_estr(~"block " + int::to_str(blk.node.id, 10u)));
}
pprust::node_expr(s, expr) {
pp::space(s.s);
- pprust::synth_comment(s, int::to_str(expr.id, 10u));
+ pprust::synth_comment(
+ s, istr::to_estr(int::to_str(expr.id, 10u)));
pprust::pclose(s);
}
_ { }
import std::vec;
import std::str;
+import std::istr;
import std::str::rustrt::sbuf;
import llvm::ModuleRef;
7 {
- ret "i" + std::int::str(llvm::LLVMGetIntTypeWidth(ty) as int);
+ ret "i" + istr::to_estr(std::int::str(
+ llvm::LLVMGetIntTypeWidth(ty) as int));
}
i += 1u;
if tout as int == ty as int {
let n: uint = vec::len::<TypeRef>(outer0) - i;
- ret "*\\" + std::int::str(n as int);
+ ret "*\\" + istr::to_estr(std::int::str(n as int));
}
}
ret "*" +
for t: ty::t in tps { enc_ty(w, cx, t); }
w.write_char(']');
}
- ty::ty_var(id) { w.write_char('X'); w.write_str(int::str(id)); }
+ ty::ty_var(id) {
+ w.write_char('X');
+ w.write_str(istr::to_estr(int::str(id)));
+ }
ty::ty_native(def) {
w.write_char('E');
w.write_str(cx.ds(def));
import std::map::*;
import std::option;
import std::int;
+import std::istr;
import std::option::*;
import syntax::ast;
import syntax::ast_util;
fn get_freevar_info(tcx: &ty::ctxt, fid: ast::node_id) -> freevar_info {
alt tcx.freevars.find(fid) {
- none. { fail "get_freevars: " + int::str(fid) + " has no freevars"; }
+ none. {
+ fail "get_freevars: " + istr::to_estr(int::str(fid))
+ + " has no freevars";
+ }
some(d) { ret d; }
}
}
import trans::drop_ty;
obj namegen(mutable i: int) {
- fn next(prefix: str) -> str { i += 1; ret prefix + int::str(i); }
+ fn next(prefix: str) -> str {
+ i += 1; ret prefix + istr::to_estr(int::str(i));
+ }
}
type derived_tydesc_info = {lltydesc: ValueRef, escapes: bool};
fn collect_ids_stmt(s: &@stmt, rs: @mutable [node_id]) {
alt s.node {
stmt_decl(_, id) {
- log "node_id " + int::str(id);
+ log ~"node_id " + int::str(id);
log_stmt(*s);;
*rs += [id];
}
stmt_expr(_, id) {
- log "node_id " + int::str(id);
+ log ~"node_id " + int::str(id);
log_stmt(*s);;
*rs += [id];
}
fn init_vecs(ccx: &crate_ctxt, node_ids: &[node_id], len: uint) {
for i: node_id in node_ids {
- log int::str(i) + " |-> " + istr::to_estr(uint::str(len));
+ log istr::to_estr(int::str(i) + ~" |-> " + uint::str(len));
add_node(ccx, i, empty_ann(len));
}
}
/* logging funs */
fn def_id_to_str(d: def_id) -> str {
- ret int::str(d.crate) + "," + int::str(d.node);
+ ret istr::to_estr(int::str(d.crate) + ~"," + int::str(d.node));
}
fn comma_str(args: &[@constr_arg_use]) -> str {
fn node_id_to_ts_ann(ccx: &crate_ctxt, id: node_id) -> ts_ann {
alt get_ts_ann(ccx, id) {
none. {
- log_err "node_id_to_ts_ann: no ts_ann for node_id " + int::str(id);
+ log_err "node_id_to_ts_ann: no ts_ann for node_id "
+ + istr::to_estr(int::str(id));
fail;
}
some(t) { ret t; }
fn node_id_to_def_upvar_strict(cx: &fn_ctxt, id: node_id) -> def {
alt freevars::def_lookup(cx.ccx.tcx, cx.id, id) {
none. {
- log_err "node_id_to_def: node_id " + int::str(id) + " has no def";
+ log_err "node_id_to_def: node_id "
+ + istr::to_estr(int::str(id)) + " has no def";
fail;
}
some(d) { ret d; }
fn node_id_to_def_strict(cx: &ty::ctxt, id: node_id) -> def {
alt cx.def_map.find(id) {
none. {
- log_err "node_id_to_def: node_id " + int::str(id) + " has no def";
+ log_err "node_id_to_def: node_id "
+ + istr::to_estr(int::str(id)) + " has no def";
fail;
}
some(d) { ret d; }
fn def_id_for_constr(tcx: ty::ctxt, t: node_id) -> def_id {
alt tcx.def_map.find(t) {
none. {
- tcx.sess.bug("node_id_for_constr: bad node_id " + int::str(t));
+ tcx.sess.bug("node_id_for_constr: bad node_id "
+ + istr::to_estr(int::str(t)));
}
some(def_fn(i, _)) { ret i; }
_ { tcx.sess.bug("node_id_for_constr: pred is not a function"); }
alt smallintmap::find(*cx.node_types, id as uint) {
none. {
cx.sess.bug("node_id_to_ty_param_substs_opt_and_ty() called on " +
- "an untyped node (" + std::int::to_str(id, 10u) +
- ")");
+ "an untyped node (" +
+ istr::to_estr(std::int::to_str(id, 10u)) +
+ ")");
}
some(tpot) { ret tpot; }
}
import std::int;
import std::vec;
import std::str;
+import std::istr;
import std::uint;
import std::map;
import std::map::hashmap;
some(ast_map::node_native_item(native_item)) {
tpt = ty_of_native_item(cx, native_item, ast::native_abi_cdecl);
}
- _ { cx.tcx.sess.fatal("internal error " + std::int::str(id.node)); }
+ _ {
+ cx.tcx.sess.fatal(
+ "internal error " + istr::to_estr(std::int::str(id.node)));
+ }
}
ret tpt;
}
this_obj_sty = some(structure_of(fcx, expr.span, tpt.ty));
}
none. {
- tcx.sess.bug("didn't find " + int::str(did.node) +
- " in type cache");
+ tcx.sess.bug("didn't find " +
+ istr::to_estr(int::str(did.node)) +
+ " in type cache");
}
}
}
*/
import std::vec;
import std::str;
+import std::istr;
import std::option;
import std::option::none;
import std::option::some;
}
fn log_conv(c: conv) {
alt c.param {
- some(p) { log "param: " + std::int::to_str(p, 10u); }
+ some(p) {
+ log "param: "
+ + istr::to_estr(std::int::to_str(p, 10u));
+ }
_ { log "param: none"; }
}
for f: flag in c.flags {
}
}
alt c.width {
- count_is(i) { log "width: count is " + std::int::to_str(i, 10u); }
+ count_is(i) { log "width: count is "
+ + istr::to_estr(std::int::to_str(i, 10u)); }
count_is_param(i) {
- log "width: count is param " + std::int::to_str(i, 10u);
+ log "width: count is param "
+ + istr::to_estr(std::int::to_str(i, 10u));
}
count_is_next_param. { log "width: count is next param"; }
count_implied. { log "width: count is implied"; }
}
alt c.precision {
- count_is(i) { log "prec: count is " + std::int::to_str(i, 10u); }
+ count_is(i) { log "prec: count is "
+ + istr::to_estr(std::int::to_str(i, 10u)); }
count_is_param(i) {
- log "prec: count is param " + std::int::to_str(i, 10u);
+ log "prec: count is param "
+ + istr::to_estr(std::int::to_str(i, 10u));
}
count_is_next_param. { log "prec: count is next param"; }
count_implied. { log "prec: count is implied"; }
/* Literals */
LIT_INT(i) {
- ret int::to_str(i, 10u);
+ ret istr::to_estr(int::to_str(i, 10u));
}
LIT_UINT(u) { ret istr::to_estr(uint::to_str(u, 10u)); }
LIT_MACH_INT(tm, i) {
- ret int::to_str(i, 10u) + "_" + ty_mach_to_str(tm);
+ ret istr::to_estr(int::to_str(i, 10u)) + "_" + ty_mach_to_str(tm);
}
LIT_MACH_FLOAT(tm, s) {
ret interner::get::<str>(*r.get_interner(), s) + "_" +
IDENT(s, _) {
ret interner::get::<str>(*r.get_interner(), s);
}
- IDX(i) { ret "_" + int::to_str(i, 10u); }
+ IDX(i) { ret istr::to_estr(~"_" + int::to_str(i, 10u)); }
UNDERSCORE. { ret "_"; }
BRACEQUOTE(_) { ret "<bracequote>"; }
EOF. { ret "<eof>"; }
"'" + escape_str(str::unsafe_from_bytes([ch as u8]), '\'') +
"'");
}
- ast::lit_int(val) { word(s.s, int::str(val)); }
+ ast::lit_int(val) { word(s.s, istr::to_estr(int::str(val))); }
ast::lit_uint(val) { word(s.s, istr::to_estr(uint::str(val)) + "u"); }
ast::lit_float(fstr) { word(s.s, fstr); }
ast::lit_mach_int(mach, val) {
- word(s.s, int::str(val as int));
+ word(s.s, istr::to_estr(int::str(val as int)));
word(s.s, ast_util::ty_mach_to_str(mach));
}
ast::lit_mach_float(mach, val) {
import std::vec;
import std::str;
+import std::istr;
import std::int;
import std::option;
import std::option::none;
}
fn fn_ident_to_string(id: ast::node_id, i: &ast::fn_ident) -> str {
- ret alt i { none. { "anon" + int::str(id) } some(s) { s } };
+ ret alt i {
+ none. { istr::to_estr(~"anon" + int::str(id)) }
+ some(s) { s }
+ };
}
fn get_id_ident(cx: &ctxt, id: ast::def_id) -> str {
"obj {\n\t" + str::connect(strs, "\n\t") + "\n}"
}
ty_res(id, _, _) { get_id_ident(cx, id) }
- ty_var(v) { "<T" + int::str(v) + ">" }
+ ty_var(v) { istr::to_estr(~"<T" + int::str(v) + ~">") }
ty_param(id, _) {
"'" + str::unsafe_from_bytes([('a' as u8) + (id as u8)])
}
while lo_ < hi { put lo_; lo_ += 1; }
}
-fn to_str(n: int, radix: uint) -> str {
+fn to_str(n: int, radix: uint) -> istr {
assert (0u < radix && radix <= 16u);
ret if n < 0 {
- "-" + istr::to_estr(uint::to_str(-n as uint, radix))
- } else { istr::to_estr(uint::to_str(n as uint, radix)) };
+ ~"-" + uint::to_str(-n as uint, radix)
+ } else { uint::to_str(n as uint, radix) };
}
-fn str(i: int) -> str { ret to_str(i, 10u); }
+fn str(i: int) -> istr { ret to_str(i, 10u); }
fn pow(base: int, exponent: uint) -> int {
ret if exponent == 0u {
out.write(str::bytes(str::from_char(ch)));
}
- fn write_int(n: int) { out.write(str::bytes(int::to_str(n, 10u))); }
+ fn write_int(n: int) { out.write(str::bytes(
+ istr::to_estr(int::to_str(n, 10u)))); }
fn write_uint(n: uint) { out.write(str::bytes(
istr::to_estr(uint::to_str(n, 10u)))); }
fn write_bytes(bytes: &[u8]) { out.write(bytes); }
use std;
import std::int;
import std::str;
+import std::istr;
fn b1() -> str { ret "# of beer on the wall, # of beer."; }
alt n {
0 { ns = "no more bottles"; }
1 { ns = "1 bottle"; }
- _ { ns = int::to_str(n, 10u) + " bottles"; }
+ _ { ns = istr::to_estr(int::to_str(n, 10u) + ~" bottles"); }
}
while i < str::byte_len(t) {
if t[i] == '#' as u8 { b += ns; } else { str::push_byte(b, t[i]); }
use std;
import std::int;
import std::str;
+import std::istr;
tag bottle { none; dual; single; multiple(int); }
"1 bottle of beer on the wall.";
}
multiple(n) {
- let nb: str = int::to_str(n, 10u);
- let mb: str = int::to_str(n - 1, 10u);
+ let nb: str = istr::to_estr(int::to_str(n, 10u));
+ let mb: str = istr::to_estr(int::to_str(n - 1, 10u));
log nb + " bottles of beer on the wall, " + nb + " bottles of beer,";
log "Take one down and pass it around, " + mb +
" bottles of beer on the wall.";
use std;
import std::int;
import std::str;
+import std::istr;
fn b1() -> str { ret "# of beer on the wall, # of beer."; }
alt n {
0 { ns = "no more bottles"; }
1 { ns = "1 bottle"; }
- _ { ns = int::to_str(n, 10u) + " bottles"; }
+ _ { ns = istr::to_estr(int::to_str(n, 10u) + ~" bottles"); }
}
while i < str::byte_len(t) {
if t[i] == '#' as u8 { b += ns; } else { str::push_byte(b, t[i]); }
use std;
import std::int;
import std::str;
+import std::istr;
fn main() {
fn multiple(n: int) {
- let nb: str = int::to_str(n, 10u);
- let mb: str = int::to_str(n - 1, 10u);
+ let nb: str = istr::to_estr(int::to_str(n, 10u));
+ let mb: str = istr::to_estr(int::to_str(n - 1, 10u));
log nb + " bottles of beer on the wall, " + nb + " bottles of beer,";
log "Take one down and pass it around, " + mb +
" bottles of beer on the wall.";
use std;
import std::int;
-import std::str::eq;
+import std::istr::eq;
#[test]
fn test_to_str() {
- assert (eq(int::to_str(0, 10u), "0"));
- assert (eq(int::to_str(1, 10u), "1"));
- assert (eq(int::to_str(-1, 10u), "-1"));
- assert (eq(int::to_str(255, 16u), "ff"));
- assert (eq(int::to_str(100, 10u), "100"));
+ assert (eq(int::to_str(0, 10u), ~"0"));
+ assert (eq(int::to_str(1, 10u), ~"1"));
+ assert (eq(int::to_str(-1, 10u), ~"-1"));
+ assert (eq(int::to_str(255, 16u), ~"ff"));
+ assert (eq(int::to_str(100, 10u), ~"100"));
}
#[test]