Remove temporary stdlib placeholders, use actual stdlib functions
(Possible now that a snapshot took place.)
This commit is contained in:
parent
4c315666dd
commit
7661c08496
src/comp
@ -4,7 +4,6 @@ import lib::llvm::llvm::ModuleRef;
|
||||
import std::str;
|
||||
import std::vec;
|
||||
import std::os::target_os;
|
||||
import syntax::_std::istr;
|
||||
|
||||
fn get_module_asm() -> str { ret ""; }
|
||||
|
||||
|
@ -343,7 +343,7 @@ fn build_session_options(str binary, getopts::match match, str binary_dir) ->
|
||||
|
||||
fn build_session(@session::options sopts) -> session::session {
|
||||
auto target_cfg = build_target_config();
|
||||
auto crate_cache = syntax::_std::new_int_hash[session::crate_metadata]();
|
||||
auto crate_cache = std::map::new_int_hash[session::crate_metadata]();
|
||||
ret session::session(target_cfg, sopts, crate_cache, [],
|
||||
[], [], codemap::new_codemap(), 0u);
|
||||
}
|
||||
|
@ -1457,7 +1457,7 @@ state obj type_names(std::map::hashmap[TypeRef, str] type_names,
|
||||
}
|
||||
|
||||
fn mk_type_names() -> type_names {
|
||||
auto nt = syntax::_std::new_str_hash[TypeRef]();
|
||||
auto nt = std::map::new_str_hash[TypeRef]();
|
||||
|
||||
fn hash(&TypeRef t) -> uint {
|
||||
ret t as uint;
|
||||
@ -1519,8 +1519,7 @@ fn type_to_str_inner(type_names names,
|
||||
case (6) { ret "Label"; }
|
||||
|
||||
case (7) {
|
||||
ret "i" + syntax::_std::istr(llvm::LLVMGetIntTypeWidth(ty)
|
||||
as int);
|
||||
ret "i" + std::int::str(llvm::LLVMGetIntTypeWidth(ty) as int);
|
||||
}
|
||||
|
||||
case (8) {
|
||||
@ -1558,7 +1557,7 @@ fn type_to_str_inner(type_names names,
|
||||
i += 1u;
|
||||
if (tout as int == ty as int) {
|
||||
let uint n = vec::len[TypeRef](outer0) - i;
|
||||
ret "*\\" + syntax::_std::istr(n as int);
|
||||
ret "*\\" + std::int::str(n as int);
|
||||
}
|
||||
}
|
||||
ret "*" + type_to_str_inner(names, outer,
|
||||
|
@ -201,7 +201,7 @@ fn read_crates(session::session sess, resolve::crate_map crate_map,
|
||||
auto e =
|
||||
@rec(sess=sess,
|
||||
crate_map=crate_map,
|
||||
crate_cache=@syntax::_std::new_str_hash[int](),
|
||||
crate_cache=@std::map::new_str_hash[int](),
|
||||
library_search_paths=sess.get_opts().library_search_paths,
|
||||
mutable next_crate_num=1);
|
||||
auto v =
|
||||
|
@ -4,6 +4,7 @@ import std::io;
|
||||
import std::map::hashmap;
|
||||
import std::option::some;
|
||||
import std::option::none;
|
||||
import std::int;
|
||||
import std::uint;
|
||||
import syntax::ast::*;
|
||||
import middle::ty;
|
||||
@ -182,7 +183,7 @@ fn enc_sty(&io::writer w, &@ctxt cx, &ty::sty st) {
|
||||
}
|
||||
case (ty::ty_var(?id)) {
|
||||
w.write_char('X');
|
||||
w.write_str(syntax::_std::istr(id));
|
||||
w.write_str(int::str(id));
|
||||
}
|
||||
case (ty::ty_native(?def)) {
|
||||
w.write_char('E');
|
||||
@ -191,7 +192,7 @@ fn enc_sty(&io::writer w, &@ctxt cx, &ty::sty st) {
|
||||
}
|
||||
case (ty::ty_param(?id)) {
|
||||
w.write_char('p');
|
||||
w.write_str(syntax::_std::uistr(id));
|
||||
w.write_str(uint::str(id));
|
||||
}
|
||||
case (ty::ty_type) { w.write_char('Y'); }
|
||||
case (ty::ty_task) { w.write_char('a'); }
|
||||
|
@ -45,7 +45,7 @@ fn check_crate(@ty::ctxt tcx, &@ast::crate crate) {
|
||||
|
||||
// Stores information about object fields and function
|
||||
// arguments that's otherwise not easily available.
|
||||
local_map=syntax::_std::new_int_hash());
|
||||
local_map=std::map::new_int_hash());
|
||||
auto v =
|
||||
@rec(visit_fn=bind visit_fn(cx, _, _, _, _, _, _, _),
|
||||
visit_item=bind visit_item(cx, _, _, _),
|
||||
|
@ -11,8 +11,8 @@ import metadata::creader;
|
||||
import metadata::decoder;
|
||||
import driver::session::session;
|
||||
import util::common::new_def_hash;
|
||||
import syntax::_std::new_int_hash;
|
||||
import syntax::_std::new_str_hash;
|
||||
import std::map::new_int_hash;
|
||||
import std::map::new_str_hash;
|
||||
import syntax::codemap::span;
|
||||
import syntax::ast::respan;
|
||||
import middle::ty::constr_table;
|
||||
|
@ -36,10 +36,9 @@ import middle::ty::pat_ty;
|
||||
import syntax::visit;
|
||||
import visit::vt;
|
||||
import util::common;
|
||||
import syntax::_std::istr;
|
||||
import util::common::new_def_hash;
|
||||
import syntax::_std::new_int_hash;
|
||||
import syntax::_std::new_str_hash;
|
||||
import std::map::new_int_hash;
|
||||
import std::map::new_str_hash;
|
||||
import util::common::local_rhs_span;
|
||||
import syntax::codemap::span;
|
||||
import lib::llvm::llvm;
|
||||
@ -73,7 +72,7 @@ import syntax::print::pprust::expr_to_str;
|
||||
import syntax::print::pprust::path_to_str;
|
||||
|
||||
obj namegen(mutable int i) {
|
||||
fn next(str prefix) -> str { i += 1; ret prefix + istr(i); }
|
||||
fn next(str prefix) -> str { i += 1; ret prefix + int::str(i); }
|
||||
}
|
||||
|
||||
type derived_tydesc_info = rec(ValueRef lltydesc, bool escapes);
|
||||
@ -4432,7 +4431,8 @@ fn build_environment(&@block_ctxt cx, &vec[ast::node_id] upvars) ->
|
||||
case (some(?x)) { llbinding = x; }
|
||||
case (_) {
|
||||
cx.fcx.lcx.ccx.sess.bug("unbound var \
|
||||
in build_environment " + istr(nid)); }
|
||||
in build_environment " + int::str(nid));
|
||||
}
|
||||
}
|
||||
}
|
||||
case (some(?llval)) { llbinding = llval; }
|
||||
|
@ -3,12 +3,12 @@ import std::vec;
|
||||
import std::option;
|
||||
import std::option::some;
|
||||
import std::option::none;
|
||||
import std::int;
|
||||
import std::uint;
|
||||
import syntax::ast::*;
|
||||
import syntax::walk;
|
||||
import syntax::codemap::span;
|
||||
import syntax::_std::istr;
|
||||
import syntax::_std::uistr;
|
||||
import syntax::_std::new_str_hash;
|
||||
import std::map::new_str_hash;
|
||||
import util::common::log_expr_err;
|
||||
import util::common::log_block_err;
|
||||
import util::common::log_item_err;
|
||||
@ -35,12 +35,12 @@ fn collect_ids_block(&block b, @mutable vec[node_id] rs) {
|
||||
fn collect_ids_stmt(&@stmt s, @mutable vec[node_id] rs) {
|
||||
alt (s.node) {
|
||||
case (stmt_decl(_, ?id)) {
|
||||
log "node_id " + istr(id);
|
||||
log "node_id " + int::str(id);
|
||||
log_stmt(*s);
|
||||
vec::push(*rs, id);
|
||||
}
|
||||
case (stmt_expr(_, ?id)) {
|
||||
log "node_id " + istr(id);
|
||||
log "node_id " + int::str(id);
|
||||
log_stmt(*s);
|
||||
vec::push(*rs, id);
|
||||
}
|
||||
@ -65,7 +65,7 @@ fn node_ids_in_fn(&_fn f, &vec[ty_param] tps, &span sp, &fn_ident i,
|
||||
|
||||
fn init_vecs(&crate_ctxt ccx, &vec[node_id] node_ids, uint len) {
|
||||
for (node_id i in node_ids) {
|
||||
log istr(i) + " |-> " + uistr(len);
|
||||
log int::str(i) + " |-> " + uint::str(len);
|
||||
add_node(ccx, i, empty_ann(len));
|
||||
}
|
||||
}
|
||||
|
@ -7,15 +7,15 @@ import std::option;
|
||||
import std::option::none;
|
||||
import std::option::some;
|
||||
import std::option::maybe;
|
||||
import std::int;
|
||||
import std::uint;
|
||||
import syntax::ast::*;
|
||||
import syntax::codemap::span;
|
||||
import util::common;
|
||||
import util::common::log_block;
|
||||
import syntax::_std::new_int_hash;
|
||||
import syntax::_std::new_uint_hash;
|
||||
import std::map::new_int_hash;
|
||||
import std::map::new_uint_hash;
|
||||
import util::common::log_expr_err;
|
||||
import syntax::_std::istr;
|
||||
import syntax::_std::uistr;
|
||||
import util::common::lit_eq;
|
||||
import syntax::print::pprust::path_to_str;
|
||||
import tstate::ann::pre_and_post;
|
||||
@ -44,7 +44,9 @@ import syntax::print::pprust::lit_to_str;
|
||||
|
||||
|
||||
/* logging funs */
|
||||
fn def_id_to_str(def_id d) -> str { ret istr(d._0) + "," + istr(d._1); }
|
||||
fn def_id_to_str(def_id d) -> str {
|
||||
ret int::str(d._0) + "," + int::str(d._1);
|
||||
}
|
||||
|
||||
fn comma_str(vec[@constr_arg_use] args) -> str {
|
||||
auto rslt = "";
|
||||
@ -259,7 +261,8 @@ fn get_ts_ann(&crate_ctxt ccx, node_id i) -> option::t[ts_ann] {
|
||||
fn node_id_to_ts_ann(&crate_ctxt ccx, node_id id) -> ts_ann {
|
||||
alt (get_ts_ann(ccx, id)) {
|
||||
case (none) {
|
||||
log_err "node_id_to_ts_ann: no ts_ann for node_id " + istr(id);
|
||||
log_err "node_id_to_ts_ann: no ts_ann for node_id " +
|
||||
int::str(id);
|
||||
fail;
|
||||
}
|
||||
case (some(?t)) { ret t; }
|
||||
@ -460,7 +463,7 @@ fn constraints_expr(&ty::ctxt cx, @expr e) -> vec[@ty::constr_def] {
|
||||
fn node_id_to_def_strict(&ty::ctxt cx, node_id id) -> def {
|
||||
alt (cx.def_map.find(id)) {
|
||||
case (none) {
|
||||
log_err "node_id_to_def: node_id " + istr(id) + " has no def";
|
||||
log_err "node_id_to_def: node_id " + int::str(id) + " has no def";
|
||||
fail;
|
||||
}
|
||||
case (some(?d)) { ret d; }
|
||||
@ -518,7 +521,7 @@ fn match_args(&fn_ctxt fcx, vec[pred_desc] occs, vec[@constr_arg_use] occ) ->
|
||||
fn node_id_for_constr(ty::ctxt tcx, node_id t) -> node_id {
|
||||
alt (tcx.def_map.find(t)) {
|
||||
case (none) {
|
||||
tcx.sess.bug("node_id_for_constr: bad node_id " + istr(t));
|
||||
tcx.sess.bug("node_id_for_constr: bad node_id " + int::str(t));
|
||||
}
|
||||
case (some(def_fn(?i,_))) { ret i._1; }
|
||||
case (_) {
|
||||
@ -590,7 +593,7 @@ fn expr_to_constr(ty::ctxt tcx, &@expr e) -> constr {
|
||||
}
|
||||
|
||||
fn pred_desc_to_str(&pred_desc p) -> str {
|
||||
ret "<" + uistr(p.node.bit_num) + ", " +
|
||||
ret "<" + uint::str(p.node.bit_num) + ", " +
|
||||
constr_args_to_str(std::util::fst[ident, def_id], p.node.args) + ">";
|
||||
}
|
||||
|
||||
|
@ -21,9 +21,8 @@ import aux::constr_map;
|
||||
import aux::expr_to_constr;
|
||||
import aux::constraints_expr;
|
||||
import aux::node_id_to_def_strict;
|
||||
import syntax::_std::new_int_hash;
|
||||
import std::map::new_int_hash;
|
||||
import util::common::new_def_hash;
|
||||
import syntax::_std::uistr;
|
||||
import syntax::codemap::span;
|
||||
import syntax::ast::respan;
|
||||
|
||||
@ -82,7 +81,7 @@ fn find_locals(&ty::ctxt tcx, &_fn f, &vec[ty_param] tps,
|
||||
|
||||
fn add_constraint(&ty::ctxt tcx, aux::constr c, uint next, constr_map tbl) ->
|
||||
uint {
|
||||
log aux::constraint_to_str(tcx, c) + " |-> " + uistr(next);
|
||||
log aux::constraint_to_str(tcx, c) + " |-> " + std::uint::str(next);
|
||||
alt (c.node.c) {
|
||||
case (ninit(?i)) { tbl.insert(c.node.id, cinit(next, c.span, i)); }
|
||||
case (npred(?p, ?args)) {
|
||||
@ -142,7 +141,8 @@ fn mk_fn_info(&crate_ctxt ccx, &_fn f, &vec[ty_param] tp,
|
||||
cf=f.decl.cf,
|
||||
used_vars=v);
|
||||
ccx.fm.insert(id, rslt);
|
||||
log name + " has " + uistr(num_constraints(rslt)) + " constraints";
|
||||
log name + " has " + std::uint::str(num_constraints(rslt)) +
|
||||
" constraints";
|
||||
}
|
||||
|
||||
|
||||
|
@ -66,10 +66,8 @@ import bitvectors::gen_poststate;
|
||||
import bitvectors::relax_precond_block;
|
||||
import bitvectors::gen;
|
||||
import syntax::ast::*;
|
||||
import syntax::_std::new_int_hash;
|
||||
import std::map::new_int_hash;
|
||||
import util::common::new_def_hash;
|
||||
import syntax::_std::istr;
|
||||
import syntax::_std::uistr;
|
||||
import util::common::log_expr;
|
||||
import util::common::log_fn;
|
||||
import util::common::elt_exprs;
|
||||
|
@ -80,7 +80,6 @@ import middle::ty::expr_ty;
|
||||
import middle::ty::type_is_nil;
|
||||
import middle::ty::type_is_bot;
|
||||
import util::common::new_def_hash;
|
||||
import syntax::_std::uistr;
|
||||
import util::common::log_expr;
|
||||
import util::common::log_block;
|
||||
import util::common::log_block_err;
|
||||
|
@ -9,7 +9,7 @@ import metadata::decoder;
|
||||
import driver::session;
|
||||
import util::common;
|
||||
import syntax::codemap::span;
|
||||
import syntax::_std::new_int_hash;
|
||||
import std::map::new_int_hash;
|
||||
import util::common::new_def_hash;
|
||||
import util::common::log_expr_err;
|
||||
import middle::ty;
|
||||
@ -537,7 +537,7 @@ mod collect {
|
||||
}
|
||||
case (_) {
|
||||
cx.tcx.sess.fatal("internal error " +
|
||||
syntax::_std::istr(id._1));
|
||||
std::int::str(id._1));
|
||||
}
|
||||
}
|
||||
ret tpt;
|
||||
|
@ -37,7 +37,6 @@ mod middle {
|
||||
|
||||
|
||||
mod syntax {
|
||||
mod _std; // FIXME remove
|
||||
mod ast;
|
||||
mod fold;
|
||||
mod walk;
|
||||
|
@ -1,29 +0,0 @@
|
||||
// FIXME all this stuff should be in the standard lib, and in fact is,
|
||||
// but due to the way our snapshots currently work, rustc can't use it
|
||||
// until after the next snapshot.
|
||||
|
||||
fn new_str_hash[V]() -> std::map::hashmap[str, V] {
|
||||
let std::map::hashfn[str] hasher = std::str::hash;
|
||||
let std::map::eqfn[str] eqer = std::str::eq;
|
||||
ret std::map::mk_hashmap[str, V](hasher, eqer);
|
||||
}
|
||||
|
||||
fn new_int_hash[V]() -> std::map::hashmap[int, V] {
|
||||
fn hash_int(&int x) -> uint { ret x as uint; }
|
||||
fn eq_int(&int a, &int b) -> bool { ret a == b; }
|
||||
auto hasher = hash_int;
|
||||
auto eqer = eq_int;
|
||||
ret std::map::mk_hashmap[int, V](hasher, eqer);
|
||||
}
|
||||
|
||||
fn new_uint_hash[V]() -> std::map::hashmap[uint, V] {
|
||||
fn hash_uint(&uint x) -> uint { ret x; }
|
||||
fn eq_uint(&uint a, &uint b) -> bool { ret a == b; }
|
||||
auto hasher = hash_uint;
|
||||
auto eqer = eq_uint;
|
||||
ret std::map::mk_hashmap[uint, V](hasher, eqer);
|
||||
}
|
||||
|
||||
fn istr(int i) -> str { ret std::int::to_str(i, 10u); }
|
||||
|
||||
fn uistr(uint i) -> str { ret std::uint::to_str(i, 10u); }
|
@ -3,7 +3,7 @@ import std::option;
|
||||
import std::map::hashmap;
|
||||
import parse::parser::parse_sess;
|
||||
import codemap::span;
|
||||
import syntax::_std::new_str_hash;
|
||||
import std::map::new_str_hash;
|
||||
import codemap;
|
||||
|
||||
type syntax_expander =
|
||||
|
@ -12,7 +12,7 @@ import std::map::hashmap;
|
||||
import token::can_begin_expr;
|
||||
import ex=ext::base;
|
||||
import codemap::span;
|
||||
import _std::new_str_hash;
|
||||
import std::map::new_str_hash;
|
||||
import util::interner;
|
||||
|
||||
tag restriction { UNRESTRICTED; RESTRICT_NO_CALL_EXPRS; }
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
import ast::ty_mach;
|
||||
import ast::ty_mach_to_str;
|
||||
import _std::new_str_hash;
|
||||
import std::map::new_str_hash;
|
||||
import util::interner;
|
||||
import std::int;
|
||||
import std::uint;
|
||||
|
@ -8,8 +8,6 @@ import std::option;
|
||||
import parse::lexer;
|
||||
import syntax::codemap::codemap;
|
||||
import ast;
|
||||
import _std::istr;
|
||||
import _std::uistr;
|
||||
import option::some;
|
||||
import option::none;
|
||||
import pp::printer;
|
||||
@ -1294,11 +1292,11 @@ fn print_literal(&ps s, &@ast::lit lit) {
|
||||
word(s.s,
|
||||
"'" + escape_str(str::from_bytes([ch as u8]), '\'') + "'");
|
||||
}
|
||||
case (ast::lit_int(?val)) { word(s.s, istr(val)); }
|
||||
case (ast::lit_uint(?val)) { word(s.s, uistr(val) + "u"); }
|
||||
case (ast::lit_int(?val)) { word(s.s, int::str(val)); }
|
||||
case (ast::lit_uint(?val)) { word(s.s, uint::str(val) + "u"); }
|
||||
case (ast::lit_float(?fstr)) { word(s.s, fstr); }
|
||||
case (ast::lit_mach_int(?mach, ?val)) {
|
||||
word(s.s, istr(val as int));
|
||||
word(s.s, int::str(val as int));
|
||||
word(s.s, ast::ty_mach_to_str(mach));
|
||||
}
|
||||
case (ast::lit_mach_float(?mach, ?val)) {
|
||||
@ -1446,7 +1444,7 @@ fn constr_arg_to_str[T](fn(&T) -> str f, &ast::constr_arg_general_[T] c) ->
|
||||
// needed b/c constr_args_to_str needs
|
||||
// something that takes an alias
|
||||
// (argh)
|
||||
fn uint_to_str(&uint i) -> str { ret uistr(i); }
|
||||
fn uint_to_str(&uint i) -> str { ret uint::str(i); }
|
||||
|
||||
fn ast_constr_to_str(&@ast::constr c) -> str {
|
||||
ret ast::path_to_str(c.node.path) +
|
||||
|
@ -1,6 +1,7 @@
|
||||
import std::io;
|
||||
import std::vec;
|
||||
import std::str;
|
||||
import std::int;
|
||||
import std::option;
|
||||
import std::option::none;
|
||||
import std::option::some;
|
||||
@ -12,8 +13,6 @@ import pp::word;
|
||||
import pp::eof;
|
||||
import pp::zerobreak;
|
||||
import pp::hardbreak;
|
||||
import syntax::_std::istr;
|
||||
import syntax::_std::uistr;
|
||||
import ast::ty_mach_to_str;
|
||||
import syntax::ast;
|
||||
|
||||
@ -34,7 +33,7 @@ fn mode_str_1(&ty::mode m) -> str {
|
||||
|
||||
fn fn_ident_to_string(ast::node_id id, &ast::fn_ident i) -> str {
|
||||
ret alt (i) {
|
||||
case (none) { "anon" + istr(id) }
|
||||
case (none) { "anon" + int::str(id) }
|
||||
case (some(?s)) { s }
|
||||
};
|
||||
}
|
||||
@ -118,7 +117,7 @@ fn ty_to_str(&ctxt cx, &t typ) -> str {
|
||||
case (ty_tag(?id, ?tps)) {
|
||||
// The user should never see this if the cname is set properly!
|
||||
|
||||
s += "<tag#" + istr(id._0) + ":" + istr(id._1) + ">";
|
||||
s += "<tag#" + int::str(id._0) + ":" + int::str(id._1) + ">";
|
||||
if (vec::len[t](tps) > 0u) {
|
||||
auto f = bind ty_to_str(cx, _);
|
||||
auto strs = vec::map[t, str](f, tps);
|
||||
@ -138,9 +137,9 @@ fn ty_to_str(&ctxt cx, &t typ) -> str {
|
||||
s += "obj {\n\t" + str::connect(m, "\n\t") + "\n}";
|
||||
}
|
||||
case (ty_res(?id, _, _)) {
|
||||
s += "<resource#" + istr(id._0) + ":" + istr(id._1) + ">";
|
||||
s += "<resource#" + int::str(id._0) + ":" + int::str(id._1) + ">";
|
||||
}
|
||||
case (ty_var(?v)) { s += "<T" + istr(v) + ">"; }
|
||||
case (ty_var(?v)) { s += "<T" + int::str(v) + ">"; }
|
||||
case (ty_param(?id)) {
|
||||
s += "'" + str::unsafe_from_bytes([('a' as u8) + (id as u8)]);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user