Remove temporary stdlib placeholders, use actual stdlib functions

(Possible now that a snapshot took place.)
This commit is contained in:
Marijn Haverbeke 2011-07-06 16:46:17 +02:00
parent 4c315666dd
commit 7661c08496
21 changed files with 53 additions and 87 deletions

View file

@ -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); }

View file

@ -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 =

View file

@ -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; }

View file

@ -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;

View file

@ -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) +