auto merge of #4854 : thestinger/rust/oldmap, r=catamorphism
This commit is contained in:
commit
d6442e97a5
@ -730,7 +730,7 @@ pub fn configure(opts: Options) -> Cargo {
|
||||
need_dir(&c.libdir);
|
||||
need_dir(&c.bindir);
|
||||
|
||||
for sources.each_key_ref |&k| {
|
||||
for sources.each_key |&k| {
|
||||
let mut s = sources.get(&k);
|
||||
load_source_packages(&c, s);
|
||||
sources.insert(k, s);
|
||||
@ -748,7 +748,7 @@ pub fn configure(opts: Options) -> Cargo {
|
||||
}
|
||||
|
||||
pub fn for_each_package(c: &Cargo, b: fn(s: @Source, p: &Package)) {
|
||||
for c.sources.each_value_ref |&v| {
|
||||
for c.sources.each_value |&v| {
|
||||
for v.packages.each |p| {
|
||||
b(v, p);
|
||||
}
|
||||
@ -1155,7 +1155,7 @@ pub fn cmd_install(c: &mut Cargo) {
|
||||
}
|
||||
|
||||
pub fn sync(c: &Cargo) {
|
||||
for c.sources.each_key_ref |&k| {
|
||||
for c.sources.each_key |&k| {
|
||||
let mut s = c.sources.get(&k);
|
||||
sync_one(c, s);
|
||||
c.sources.insert(k, s);
|
||||
@ -1569,7 +1569,7 @@ pub fn cmd_list(c: &Cargo) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for c.sources.each_value_ref |&v| {
|
||||
for c.sources.each_value |&v| {
|
||||
print_source(v);
|
||||
}
|
||||
}
|
||||
@ -1636,7 +1636,7 @@ pub fn dump_sources(c: &Cargo) {
|
||||
result::Ok(writer) => {
|
||||
let mut hash = ~LinearMap::new();
|
||||
|
||||
for c.sources.each_ref |&k, &v| {
|
||||
for c.sources.each |&k, &v| {
|
||||
let mut chash = ~LinearMap::new();
|
||||
|
||||
chash.insert(~"url", json::String(v.url));
|
||||
@ -1675,7 +1675,7 @@ pub fn copy_warn(srcfile: &Path, destfile: &Path) {
|
||||
|
||||
pub fn cmd_sources(c: &Cargo) {
|
||||
if vec::len(c.opts.free) < 3u {
|
||||
for c.sources.each_value_ref |&v| {
|
||||
for c.sources.each_value |&v| {
|
||||
info(fmt!("%s (%s) via %s",
|
||||
v.name, v.url, v.method));
|
||||
}
|
||||
@ -1686,7 +1686,7 @@ pub fn cmd_sources(c: &Cargo) {
|
||||
|
||||
match action {
|
||||
~"clear" => {
|
||||
for c.sources.each_key_ref |&k| {
|
||||
for c.sources.each_key |&k| {
|
||||
c.sources.remove(&k);
|
||||
}
|
||||
|
||||
@ -1706,7 +1706,7 @@ pub fn cmd_sources(c: &Cargo) {
|
||||
return;
|
||||
}
|
||||
|
||||
if c.sources.contains_key_ref(&name) {
|
||||
if c.sources.contains_key(&name) {
|
||||
error(fmt!("source already exists: %s", name));
|
||||
} else {
|
||||
c.sources.insert(name, @Source {
|
||||
@ -1733,7 +1733,7 @@ pub fn cmd_sources(c: &Cargo) {
|
||||
return;
|
||||
}
|
||||
|
||||
if c.sources.contains_key_ref(&name) {
|
||||
if c.sources.contains_key(&name) {
|
||||
c.sources.remove(&name);
|
||||
info(fmt!("removed source: %s", name));
|
||||
} else {
|
||||
|
@ -18,8 +18,7 @@ use core::os;
|
||||
use core::uint;
|
||||
use core::util;
|
||||
use core::vec;
|
||||
use std::oldmap::HashMap;
|
||||
use std::oldmap;
|
||||
use core::hashmap::linear::LinearSet;
|
||||
|
||||
pure fn not_win32(os: session::os) -> bool {
|
||||
match os {
|
||||
@ -187,16 +186,14 @@ pub fn get_install_prefix_rpath(target_triple: &str) -> Path {
|
||||
}
|
||||
|
||||
pub fn minimize_rpaths(rpaths: &[Path]) -> ~[Path] {
|
||||
let set = oldmap::HashMap();
|
||||
let mut set = LinearSet::new();
|
||||
let mut minimized = ~[];
|
||||
for rpaths.each |rpath| {
|
||||
let s = rpath.to_str();
|
||||
if !set.contains_key_ref(&s) {
|
||||
minimized.push(/*bad*/copy *rpath);
|
||||
set.insert(s, ());
|
||||
if set.insert(rpath.to_str()) {
|
||||
minimized.push(copy *rpath);
|
||||
}
|
||||
}
|
||||
return minimized;
|
||||
minimized
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
|
@ -86,13 +86,13 @@ pub fn set_crate_data(cstore: @mut CStore,
|
||||
}
|
||||
|
||||
pub fn have_crate_data(cstore: @mut CStore, cnum: ast::crate_num) -> bool {
|
||||
return cstore.metas.contains_key_ref(&cnum);
|
||||
cstore.metas.contains_key(&cnum)
|
||||
}
|
||||
|
||||
pub fn iter_crate_data(cstore: @mut CStore,
|
||||
i: fn(ast::crate_num, crate_metadata)) {
|
||||
let metas = cstore.metas;
|
||||
for metas.each_ref |&k, &v| {
|
||||
for metas.each |&k, &v| {
|
||||
i(k, v);
|
||||
}
|
||||
}
|
||||
@ -148,7 +148,7 @@ pub fn get_dep_hashes(cstore: @mut CStore) -> ~[~str] {
|
||||
let mut result = ~[];
|
||||
|
||||
let use_crate_map = cstore.use_crate_map;
|
||||
for use_crate_map.each_value_ref |&cnum| {
|
||||
for use_crate_map.each_value |&cnum| {
|
||||
let cdata = cstore::get_crate_data(cstore, cnum);
|
||||
let hash = decoder::get_crate_hash(cdata.data);
|
||||
debug!("Add hash[%s]: %s", cdata.name, hash);
|
||||
|
@ -99,7 +99,7 @@ pub enum encode_ctxt = {
|
||||
};
|
||||
|
||||
pub fn reachable(ecx: @encode_ctxt, id: node_id) -> bool {
|
||||
ecx.reachable.contains_key_ref(&id)
|
||||
ecx.reachable.contains_key(&id)
|
||||
}
|
||||
|
||||
fn encode_name(ecx: @encode_ctxt, ebml_w: writer::Encoder, name: ident) {
|
||||
|
@ -689,7 +689,7 @@ fn check_loans_in_expr(expr: @ast::expr,
|
||||
|
||||
self.check_for_conflicting_loans(expr.id);
|
||||
|
||||
if self.bccx.moves_map.contains_key_ref(&expr.id) {
|
||||
if self.bccx.moves_map.contains_key(&expr.id) {
|
||||
self.check_move_out_from_expr(expr);
|
||||
}
|
||||
|
||||
@ -710,7 +710,7 @@ fn check_loans_in_expr(expr: @ast::expr,
|
||||
}
|
||||
ast::expr_index(_, rval) |
|
||||
ast::expr_binary(_, _, rval)
|
||||
if self.bccx.method_map.contains_key_ref(&expr.id) => {
|
||||
if self.bccx.method_map.contains_key(&expr.id) => {
|
||||
self.check_call(expr,
|
||||
None,
|
||||
expr.callee_id,
|
||||
@ -718,7 +718,7 @@ fn check_loans_in_expr(expr: @ast::expr,
|
||||
~[rval]);
|
||||
}
|
||||
ast::expr_unary(*) | ast::expr_index(*)
|
||||
if self.bccx.method_map.contains_key_ref(&expr.id) => {
|
||||
if self.bccx.method_map.contains_key(&expr.id) => {
|
||||
self.check_call(expr,
|
||||
None,
|
||||
expr.callee_id,
|
||||
|
@ -207,7 +207,7 @@ fn req_loans_in_expr(ex: @ast::expr,
|
||||
ast::expr_binary(_, rcvr, _) |
|
||||
ast::expr_unary(_, rcvr) |
|
||||
ast::expr_assign_op(_, rcvr, _)
|
||||
if self.bccx.method_map.contains_key_ref(&ex.id) => {
|
||||
if self.bccx.method_map.contains_key(&ex.id) => {
|
||||
// Receivers in method calls are always passed by ref.
|
||||
//
|
||||
// Here, in an overloaded operator, the call is this expression,
|
||||
@ -244,7 +244,7 @@ fn req_loans_in_expr(ex: @ast::expr,
|
||||
// }
|
||||
|
||||
ast::expr_field(rcvr, _, _)
|
||||
if self.bccx.method_map.contains_key_ref(&ex.id) => {
|
||||
if self.bccx.method_map.contains_key(&ex.id) => {
|
||||
// Receivers in method calls are always passed by ref.
|
||||
//
|
||||
// Here, the field a.b is in fact a closure. Eventually, this
|
||||
|
@ -375,7 +375,7 @@ impl PreserveCtxt {
|
||||
// scope_id;`. Though that would potentially re-introduce
|
||||
// the ICE. See #3511 for more details.
|
||||
let scope_to_use = if
|
||||
self.bccx.stmt_map.contains_key_ref(&scope_id) {
|
||||
self.bccx.stmt_map.contains_key(&scope_id) {
|
||||
// Root it in its parent scope, b/c
|
||||
// trans won't introduce a new scope for the
|
||||
// stmt
|
||||
|
@ -102,7 +102,7 @@ pub fn check_expr(sess: Session,
|
||||
}
|
||||
expr_lit(@codemap::spanned {node: lit_str(_), _}) => { }
|
||||
expr_binary(_, _, _) | expr_unary(_, _) => {
|
||||
if method_map.contains_key_ref(&e.id) {
|
||||
if method_map.contains_key(&e.id) {
|
||||
sess.span_err(e.span, ~"user-defined operators are not \
|
||||
allowed in constant expressions");
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ pub fn expr_is_non_moving_lvalue(cx: @MatchCheckCtxt, expr: @expr) -> bool {
|
||||
return false;
|
||||
}
|
||||
|
||||
!cx.moves_map.contains_key_ref(&expr.id)
|
||||
!cx.moves_map.contains_key(&expr.id)
|
||||
}
|
||||
|
||||
pub fn check_expr(cx: @MatchCheckCtxt, ex: @expr, &&s: (), v: visit::vt<()>) {
|
||||
@ -734,7 +734,7 @@ pub fn check_legality_of_move_bindings(cx: @MatchCheckCtxt,
|
||||
by_ref_span = Some(span);
|
||||
}
|
||||
bind_infer => {
|
||||
if cx.moves_map.contains_key_ref(&id) {
|
||||
if cx.moves_map.contains_key(&id) {
|
||||
any_by_move = true;
|
||||
}
|
||||
}
|
||||
@ -774,7 +774,7 @@ pub fn check_legality_of_move_bindings(cx: @MatchCheckCtxt,
|
||||
if pat_is_binding(def_map, p) {
|
||||
match p.node {
|
||||
pat_ident(_, _, sub) => {
|
||||
if cx.moves_map.contains_key_ref(&p.id) {
|
||||
if cx.moves_map.contains_key(&p.id) {
|
||||
check_move(p, sub);
|
||||
}
|
||||
}
|
||||
@ -800,7 +800,7 @@ pub fn check_legality_of_move_bindings(cx: @MatchCheckCtxt,
|
||||
behind_bad_pointer);
|
||||
|
||||
if behind_bad_pointer &&
|
||||
cx.moves_map.contains_key_ref(&pat.id)
|
||||
cx.moves_map.contains_key(&pat.id)
|
||||
{
|
||||
cx.tcx.sess.span_err(
|
||||
pat.span,
|
||||
|
@ -69,7 +69,7 @@ fn collect_freevars(def_map: resolve::DefMap, blk: ast::blk)
|
||||
}
|
||||
if i == depth { // Made it to end of loop
|
||||
let dnum = ast_util::def_id_of_def(def).node;
|
||||
if !seen.contains_key_ref(&dnum) {
|
||||
if !seen.contains_key(&dnum) {
|
||||
refs.push(@freevar_entry {
|
||||
def: def,
|
||||
span: expr.span,
|
||||
|
@ -391,7 +391,7 @@ impl LanguageItemCollector {
|
||||
}
|
||||
|
||||
fn check_completeness() {
|
||||
for self.item_refs.each_ref |&key, &item_ref| {
|
||||
for self.item_refs.each |&key, &item_ref| {
|
||||
match self.items.items[item_ref] {
|
||||
None => {
|
||||
self.session.err(fmt!("no item found for `%s`", key));
|
||||
|
@ -400,7 +400,7 @@ pub fn build_settings_crate(sess: session::Session, crate: @ast::crate) {
|
||||
sess: sess});
|
||||
|
||||
// Install defaults.
|
||||
for cx.dict.each_value_ref |&spec| {
|
||||
for cx.dict.each_value |&spec| {
|
||||
cx.set_level(spec.lint, spec.default);
|
||||
}
|
||||
|
||||
|
@ -340,7 +340,7 @@ pub impl &mem_categorization_ctxt {
|
||||
let expr_ty = tcx.ty(expr);
|
||||
match expr.node {
|
||||
ast::expr_unary(ast::deref, e_base) => {
|
||||
if self.method_map.contains_key_ref(&expr.id) {
|
||||
if self.method_map.contains_key(&expr.id) {
|
||||
return self.cat_rvalue(expr, expr_ty);
|
||||
}
|
||||
|
||||
@ -349,7 +349,7 @@ pub impl &mem_categorization_ctxt {
|
||||
}
|
||||
|
||||
ast::expr_field(base, f_name, _) => {
|
||||
if self.method_map.contains_key_ref(&expr.id) {
|
||||
if self.method_map.contains_key(&expr.id) {
|
||||
return self.cat_method_ref(expr, expr_ty);
|
||||
}
|
||||
|
||||
@ -358,7 +358,7 @@ pub impl &mem_categorization_ctxt {
|
||||
}
|
||||
|
||||
ast::expr_index(base, _) => {
|
||||
if self.method_map.contains_key_ref(&expr.id) {
|
||||
if self.method_map.contains_key(&expr.id) {
|
||||
return self.cat_rvalue(expr, expr_ty);
|
||||
}
|
||||
|
||||
|
@ -668,7 +668,7 @@ impl VisitContext {
|
||||
arg_exprs: &[@expr],
|
||||
visitor: vt<VisitContext>) -> bool
|
||||
{
|
||||
if !self.method_map.contains_key_ref(&expr.id) {
|
||||
if !self.method_map.contains_key(&expr.id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -799,7 +799,7 @@ impl VisitContext {
|
||||
for arm.pats.each |pat| {
|
||||
let mut found = false;
|
||||
do pat_bindings(self.tcx.def_map, *pat) |_, node_id, _, _| {
|
||||
if moves_map.contains_key_ref(&node_id) {
|
||||
if moves_map.contains_key(&node_id) {
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
|
@ -296,7 +296,7 @@ pub fn resolve_expr(expr: @ast::expr, cx: ctxt, visitor: visit::vt<ctxt>) {
|
||||
_ => {}
|
||||
};
|
||||
|
||||
if new_cx.root_exprs.contains_key_ref(&expr.id) {
|
||||
if new_cx.root_exprs.contains_key(&expr.id) {
|
||||
new_cx.parent = Some(expr.id);
|
||||
}
|
||||
|
||||
@ -840,7 +840,7 @@ pub fn determine_rp_in_crate(sess: Session,
|
||||
debug!("%s", {
|
||||
debug!("Region variance results:");
|
||||
let region_paramd_items = cx.region_paramd_items;
|
||||
for region_paramd_items.each_ref |&key, &value| {
|
||||
for region_paramd_items.each |&key, &value| {
|
||||
debug!("item %? (%s) is parameterized with variance %?",
|
||||
key,
|
||||
ast_map::node_id_to_str(ast_map, key,
|
||||
|
@ -1942,7 +1942,7 @@ pub impl Resolver {
|
||||
self.module_to_str(module_));
|
||||
self.resolve_imports_for_module(module_);
|
||||
|
||||
for module_.children.each_value_ref |&child_node| {
|
||||
for module_.children.each_value |&child_node| {
|
||||
match child_node.get_module_if_available() {
|
||||
None => {
|
||||
// Nothing to do.
|
||||
@ -1953,7 +1953,7 @@ pub impl Resolver {
|
||||
}
|
||||
}
|
||||
|
||||
for module_.anonymous_children.each_value_ref |&child_module| {
|
||||
for module_.anonymous_children.each_value |&child_module| {
|
||||
self.resolve_imports_for_module_subtree(child_module);
|
||||
}
|
||||
}
|
||||
@ -2241,7 +2241,7 @@ pub impl Resolver {
|
||||
}
|
||||
|
||||
// We've successfully resolved the import. Write the results in.
|
||||
assert module_.import_resolutions.contains_key_ref(&target);
|
||||
assert module_.import_resolutions.contains_key(&target);
|
||||
let import_resolution = module_.import_resolutions.get(&target);
|
||||
|
||||
match value_result {
|
||||
@ -2400,7 +2400,7 @@ pub impl Resolver {
|
||||
}
|
||||
|
||||
// We've successfully resolved the import. Write the results in.
|
||||
assert module_.import_resolutions.contains_key_ref(&target);
|
||||
assert module_.import_resolutions.contains_key(&target);
|
||||
let import_resolution = module_.import_resolutions.get(&target);
|
||||
|
||||
match module_result {
|
||||
@ -2461,7 +2461,7 @@ pub impl Resolver {
|
||||
assert containing_module.glob_count == 0;
|
||||
|
||||
// Add all resolved imports from the containing module.
|
||||
for containing_module.import_resolutions.each_ref
|
||||
for containing_module.import_resolutions.each
|
||||
|&ident, &target_import_resolution| {
|
||||
|
||||
debug!("(resolving glob import) writing module resolution \
|
||||
@ -2512,7 +2512,7 @@ pub impl Resolver {
|
||||
}
|
||||
|
||||
// Add all children from the containing module.
|
||||
for containing_module.children.each_ref |&ident, &name_bindings| {
|
||||
for containing_module.children.each |&ident, &name_bindings| {
|
||||
let mut dest_import_resolution;
|
||||
match module_.import_resolutions.find(&ident) {
|
||||
None => {
|
||||
@ -3182,7 +3182,7 @@ pub impl Resolver {
|
||||
}
|
||||
|
||||
// Descend into children and anonymous children.
|
||||
for module_.children.each_value_ref |&child_node| {
|
||||
for module_.children.each_value |&child_node| {
|
||||
match child_node.get_module_if_available() {
|
||||
None => {
|
||||
// Continue.
|
||||
@ -3193,7 +3193,7 @@ pub impl Resolver {
|
||||
}
|
||||
}
|
||||
|
||||
for module_.anonymous_children.each_value_ref |&module_| {
|
||||
for module_.anonymous_children.each_value |&module_| {
|
||||
self.report_unresolved_imports(module_);
|
||||
}
|
||||
}
|
||||
@ -3238,7 +3238,7 @@ pub impl Resolver {
|
||||
|
||||
self.record_exports_for_module(module_);
|
||||
|
||||
for module_.children.each_value_ref |&child_name_bindings| {
|
||||
for module_.children.each_value |&child_name_bindings| {
|
||||
match child_name_bindings.get_module_if_available() {
|
||||
None => {
|
||||
// Nothing to do.
|
||||
@ -3249,7 +3249,7 @@ pub impl Resolver {
|
||||
}
|
||||
}
|
||||
|
||||
for module_.anonymous_children.each_value_ref |&child_module| {
|
||||
for module_.anonymous_children.each_value |&child_module| {
|
||||
self.record_exports_for_module_subtree(child_module);
|
||||
}
|
||||
}
|
||||
@ -3297,7 +3297,7 @@ pub impl Resolver {
|
||||
}
|
||||
|
||||
fn add_exports_for_module(exports2: &mut ~[Export2], module_: @Module) {
|
||||
for module_.children.each_ref |ident, namebindings| {
|
||||
for module_.children.each |ident, namebindings| {
|
||||
debug!("(computing exports) maybe export '%s'",
|
||||
self.session.str_of(*ident));
|
||||
self.add_exports_of_namebindings(&mut *exports2,
|
||||
@ -3312,7 +3312,7 @@ pub impl Resolver {
|
||||
false);
|
||||
}
|
||||
|
||||
for module_.import_resolutions.each_ref |ident, importresolution| {
|
||||
for module_.import_resolutions.each |ident, importresolution| {
|
||||
if importresolution.privacy != Public {
|
||||
debug!("(computing exports) not reexporting private `%s`",
|
||||
self.session.str_of(*ident));
|
||||
@ -4102,7 +4102,7 @@ pub impl Resolver {
|
||||
for arm.pats.eachi() |i, p| {
|
||||
let map_i = self.binding_mode_map(*p);
|
||||
|
||||
for map_0.each_ref |&key, &binding_0| {
|
||||
for map_0.each |&key, &binding_0| {
|
||||
match map_i.find(&key) {
|
||||
None => {
|
||||
self.session.span_err(
|
||||
@ -4123,8 +4123,8 @@ pub impl Resolver {
|
||||
}
|
||||
}
|
||||
|
||||
for map_i.each_ref |&key, &binding| {
|
||||
if !map_0.contains_key_ref(&key) {
|
||||
for map_i.each |&key, &binding| {
|
||||
if !map_0.contains_key(&key) {
|
||||
self.session.span_err(
|
||||
binding.span,
|
||||
fmt!("variable `%s` from pattern #%u is \
|
||||
@ -4353,7 +4353,7 @@ pub impl Resolver {
|
||||
|
||||
match bindings_list {
|
||||
Some(bindings_list)
|
||||
if !bindings_list.contains_key_ref(&ident)
|
||||
if !bindings_list.contains_key(&ident)
|
||||
=> {
|
||||
let last_rib = (*self.value_ribs).last();
|
||||
last_rib.bindings.insert(ident,
|
||||
@ -4426,18 +4426,18 @@ pub impl Resolver {
|
||||
pat_struct(path, _, _) => {
|
||||
match self.resolve_path(path, TypeNS, false, visitor) {
|
||||
Some(def_ty(class_id))
|
||||
if self.structs.contains_key_ref(&class_id)
|
||||
if self.structs.contains_key(&class_id)
|
||||
=> {
|
||||
let class_def = def_struct(class_id);
|
||||
self.record_def(pattern.id, class_def);
|
||||
}
|
||||
Some(definition @ def_struct(class_id))
|
||||
if self.structs.contains_key_ref(&class_id)
|
||||
if self.structs.contains_key(&class_id)
|
||||
=> {
|
||||
self.record_def(pattern.id, definition);
|
||||
}
|
||||
Some(definition @ def_variant(_, variant_id))
|
||||
if self.structs.contains_key_ref(&variant_id)
|
||||
if self.structs.contains_key(&variant_id)
|
||||
=> {
|
||||
self.record_def(pattern.id, definition);
|
||||
}
|
||||
@ -4886,12 +4886,12 @@ pub impl Resolver {
|
||||
|
||||
match self.resolve_path(path, TypeNS, false, visitor) {
|
||||
Some(def_ty(class_id)) | Some(def_struct(class_id))
|
||||
if self.structs.contains_key_ref(&class_id) => {
|
||||
if self.structs.contains_key(&class_id) => {
|
||||
let class_def = def_struct(class_id);
|
||||
self.record_def(expr.id, class_def);
|
||||
}
|
||||
Some(definition @ def_variant(_, class_id))
|
||||
if self.structs.contains_key_ref(&class_id) => {
|
||||
if self.structs.contains_key(&class_id) => {
|
||||
self.record_def(expr.id, definition);
|
||||
}
|
||||
_ => {
|
||||
@ -5035,7 +5035,7 @@ pub impl Resolver {
|
||||
}
|
||||
|
||||
// Look for trait children.
|
||||
for search_module.children.each_value_ref |&child_name_bindings| {
|
||||
for search_module.children.each_value |&child_name_bindings| {
|
||||
match child_name_bindings.def_for_namespace(TypeNS) {
|
||||
Some(def) => {
|
||||
match def {
|
||||
@ -5055,7 +5055,7 @@ pub impl Resolver {
|
||||
}
|
||||
|
||||
// Look for imports.
|
||||
for search_module.import_resolutions.each_value_ref
|
||||
for search_module.import_resolutions.each_value
|
||||
|&import_resolution| {
|
||||
|
||||
match import_resolution.target_for_namespace(TypeNS) {
|
||||
@ -5115,7 +5115,7 @@ pub impl Resolver {
|
||||
self.session.str_of(name));
|
||||
|
||||
match self.trait_info.find(&trait_def_id) {
|
||||
Some(trait_info) if trait_info.contains_key_ref(&name) => {
|
||||
Some(trait_info) if trait_info.contains_key(&name) => {
|
||||
debug!("(adding trait info if containing method) found trait \
|
||||
%d:%d for method '%s'",
|
||||
trait_def_id.crate,
|
||||
@ -5223,7 +5223,7 @@ pub impl Resolver {
|
||||
|
||||
self.check_for_unused_imports_in_module(module_);
|
||||
|
||||
for module_.children.each_value_ref |&child_name_bindings| {
|
||||
for module_.children.each_value |&child_name_bindings| {
|
||||
match (*child_name_bindings).get_module_if_available() {
|
||||
None => {
|
||||
// Nothing to do.
|
||||
@ -5235,13 +5235,13 @@ pub impl Resolver {
|
||||
}
|
||||
}
|
||||
|
||||
for module_.anonymous_children.each_value_ref |&child_module| {
|
||||
for module_.anonymous_children.each_value |&child_module| {
|
||||
self.check_for_unused_imports_in_module_subtree(child_module);
|
||||
}
|
||||
}
|
||||
|
||||
fn check_for_unused_imports_in_module(module_: @Module) {
|
||||
for module_.import_resolutions.each_value_ref |&import_resolution| {
|
||||
for module_.import_resolutions.each_value |&import_resolution| {
|
||||
// Ignore dummy spans for things like automatically injected
|
||||
// imports for the prelude, and also don't warn about the same
|
||||
// import statement being unused more than once.
|
||||
@ -5306,12 +5306,12 @@ pub impl Resolver {
|
||||
debug!("Dump of module `%s`:", self.module_to_str(module_));
|
||||
|
||||
debug!("Children:");
|
||||
for module_.children.each_key_ref |&name| {
|
||||
for module_.children.each_key |&name| {
|
||||
debug!("* %s", self.session.str_of(name));
|
||||
}
|
||||
|
||||
debug!("Import resolutions:");
|
||||
for module_.import_resolutions.each_ref |&name, &import_resolution| {
|
||||
for module_.import_resolutions.each |&name, &import_resolution| {
|
||||
let mut value_repr;
|
||||
match (*import_resolution).target_for_namespace(ValueNS) {
|
||||
None => { value_repr = ~""; }
|
||||
|
@ -1096,7 +1096,7 @@ pub fn store_non_ref_bindings(bcx: block,
|
||||
*/
|
||||
|
||||
let mut bcx = bcx;
|
||||
for data.bindings_map.each_value_ref |&binding_info| {
|
||||
for data.bindings_map.each_value |&binding_info| {
|
||||
match binding_info.trmode {
|
||||
TrByValue(is_move, lldest) => {
|
||||
let llval = Load(bcx, binding_info.llmatch); // get a T*
|
||||
@ -1130,7 +1130,7 @@ pub fn insert_lllocals(bcx: block,
|
||||
* the `fcx.lllocals` map. If add_cleans is true, then adds cleanups for
|
||||
* the bindings. */
|
||||
|
||||
for data.bindings_map.each_value_ref |&binding_info| {
|
||||
for data.bindings_map.each_value |&binding_info| {
|
||||
let llval = match binding_info.trmode {
|
||||
// By value bindings: use the stack slot that we
|
||||
// copied/moved the value into
|
||||
@ -1203,7 +1203,7 @@ pub fn compile_guard(bcx: block,
|
||||
|
||||
fn drop_bindings(bcx: block, data: &ArmData) -> block {
|
||||
let mut bcx = bcx;
|
||||
for data.bindings_map.each_value_ref |&binding_info| {
|
||||
for data.bindings_map.each_value |&binding_info| {
|
||||
match binding_info.trmode {
|
||||
TrByValue(_, llval) => {
|
||||
bcx = glue::drop_ty(bcx, llval, binding_info.ty);
|
||||
@ -1598,7 +1598,7 @@ pub fn trans_match_inner(scope_cx: block,
|
||||
// but during matching we need to store a *T as explained
|
||||
// above
|
||||
let is_move =
|
||||
scope_cx.ccx().maps.moves_map.contains_key_ref(&p_id);
|
||||
scope_cx.ccx().maps.moves_map.contains_key(&p_id);
|
||||
llmatch = alloca(bcx, T_ptr(llvariable_ty));
|
||||
trmode = TrByValue(is_move, alloca(bcx, llvariable_ty));
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ pub fn get_extern_fn(externs: ExternMap,
|
||||
name: @str,
|
||||
cc: lib::llvm::CallConv,
|
||||
ty: TypeRef) -> ValueRef {
|
||||
if externs.contains_key_ref(&name) { return externs.get(&name); }
|
||||
if externs.contains_key(&name) { return externs.get(&name); }
|
||||
let f = decl_fn(llmod, name, cc, ty);
|
||||
externs.insert(name, f);
|
||||
return f;
|
||||
@ -178,7 +178,7 @@ pub fn get_extern_fn(externs: ExternMap,
|
||||
pub fn get_extern_const(externs: ExternMap, llmod: ModuleRef,
|
||||
name: @str, ty: TypeRef) -> ValueRef {
|
||||
unsafe {
|
||||
if externs.contains_key_ref(&name) { return externs.get(&name); }
|
||||
if externs.contains_key(&name) { return externs.get(&name); }
|
||||
let c = str::as_c_str(name, |buf| {
|
||||
llvm::LLVMAddGlobal(llmod, ty, buf)
|
||||
});
|
||||
@ -448,7 +448,7 @@ pub fn set_glue_inlining(f: ValueRef, t: ty::t) {
|
||||
// silently mangles such symbols, breaking our linkage model.
|
||||
pub fn note_unique_llvm_symbol(ccx: @crate_ctxt, +sym: ~str) {
|
||||
// XXX: Bad copy.
|
||||
if ccx.all_llvm_symbols.contains_key_ref(&sym) {
|
||||
if ccx.all_llvm_symbols.contains_key(&sym) {
|
||||
ccx.sess.bug(~"duplicate LLVM symbol: " + sym);
|
||||
}
|
||||
ccx.all_llvm_symbols.insert(sym, ());
|
||||
@ -2477,7 +2477,7 @@ pub fn get_item_val(ccx: @crate_ctxt, id: ast::node_id) -> ValueRef {
|
||||
ccx.sess.bug(~"get_item_val(): unexpected variant")
|
||||
}
|
||||
};
|
||||
if !(exprt || ccx.reachable.contains_key_ref(&id)) {
|
||||
if !(exprt || ccx.reachable.contains_key(&id)) {
|
||||
lib::llvm::SetLinkage(val, lib::llvm::InternalLinkage);
|
||||
}
|
||||
ccx.item_vals.insert(id, val);
|
||||
@ -2800,7 +2800,7 @@ pub fn create_module_map(ccx: @crate_ctxt) -> ValueRef {
|
||||
lib::llvm::SetLinkage(map, lib::llvm::InternalLinkage);
|
||||
}
|
||||
let mut elts: ~[ValueRef] = ~[];
|
||||
for ccx.module_data.each_ref |&key, &val| {
|
||||
for ccx.module_data.each |&key, &val| {
|
||||
let elt = C_struct(~[p2i(ccx, C_cstr(ccx, key)),
|
||||
p2i(ccx, val)]);
|
||||
elts.push(elt);
|
||||
@ -3084,7 +3084,7 @@ pub fn trans_crate(sess: session::Session,
|
||||
}
|
||||
|
||||
if ccx.sess.count_llvm_insns() {
|
||||
for ccx.stats.llvm_insns.each_ref |&k, &v| {
|
||||
for ccx.stats.llvm_insns.each |&k, &v| {
|
||||
io::println(fmt!("%-7u %s", v, k));
|
||||
}
|
||||
}
|
||||
|
@ -674,8 +674,7 @@ pub fn trans_arg_expr(bcx: block,
|
||||
// FIXME(#3548) use the adjustments table
|
||||
match autoref_arg {
|
||||
DoAutorefArg => {
|
||||
assert !bcx.ccx().maps.moves_map.contains_key_ref(
|
||||
&arg_expr.id);
|
||||
assert !bcx.ccx().maps.moves_map.contains_key(&arg_expr.id);
|
||||
val = arg_datum.to_ref_llval(bcx);
|
||||
}
|
||||
DontAutorefArg => {
|
||||
@ -685,7 +684,7 @@ pub fn trans_arg_expr(bcx: block,
|
||||
// the explicit self code currently passes by-ref, it
|
||||
// does not hold.
|
||||
//
|
||||
//assert !bcx.ccx().maps.moves_map.contains_key_ref(
|
||||
//assert !bcx.ccx().maps.moves_map.contains_key(
|
||||
// &arg_expr.id);
|
||||
val = arg_datum.to_ref_llval(bcx);
|
||||
}
|
||||
@ -693,7 +692,7 @@ pub fn trans_arg_expr(bcx: block,
|
||||
ast::by_val => {
|
||||
// NB: avoid running the take glue.
|
||||
|
||||
assert !bcx.ccx().maps.moves_map.contains_key_ref(
|
||||
assert !bcx.ccx().maps.moves_map.contains_key(
|
||||
&arg_expr.id);
|
||||
val = arg_datum.to_value_llval(bcx);
|
||||
}
|
||||
|
@ -132,7 +132,7 @@ pub fn get_const_val(cx: @crate_ctxt, def_id: ast::def_id) -> ValueRef {
|
||||
if !ast_util::is_local(def_id) {
|
||||
cx.tcx.sess.bug(~"cross-crate constants");
|
||||
}
|
||||
if !cx.const_values.contains_key_ref(&def_id.node) {
|
||||
if !cx.const_values.contains_key(&def_id.node) {
|
||||
match cx.tcx.items.get(&def_id.node) {
|
||||
ast_map::node_item(@ast::item {
|
||||
node: ast::item_const(_, subexpr), _
|
||||
|
@ -186,7 +186,7 @@ pub fn trans_log(log_ex: @ast::expr,
|
||||
// XXX: Bad copy.
|
||||
let modname = path_str(ccx.sess, copy modpath);
|
||||
|
||||
let global = if ccx.module_data.contains_key_ref(&modname) {
|
||||
let global = if ccx.module_data.contains_key(&modname) {
|
||||
ccx.module_data.get(&modname)
|
||||
} else {
|
||||
let s = link::mangle_internal_name_by_path_and_seq(
|
||||
|
@ -223,7 +223,7 @@ pub impl Datum {
|
||||
* `id` is located in the move table, but copies otherwise.
|
||||
*/
|
||||
|
||||
if bcx.ccx().maps.moves_map.contains_key_ref(&id) {
|
||||
if bcx.ccx().maps.moves_map.contains_key(&id) {
|
||||
self.move_to(bcx, action, dst)
|
||||
} else {
|
||||
self.copy_to(bcx, action, dst)
|
||||
|
@ -117,7 +117,7 @@ pub fn mk_ctxt(+crate: ~str, intr: @ident_interner) -> debug_ctxt {
|
||||
}
|
||||
|
||||
fn update_cache(cache: metadata_cache, mdtag: int, val: debug_metadata) {
|
||||
let existing = if cache.contains_key_ref(&mdtag) {
|
||||
let existing = if cache.contains_key(&mdtag) {
|
||||
cache.get(&mdtag)
|
||||
} else {
|
||||
~[]
|
||||
@ -176,7 +176,7 @@ fn cached_metadata<T: Copy>(cache: metadata_cache,
|
||||
eq_fn: fn(md: T) -> bool)
|
||||
-> Option<T> {
|
||||
unsafe {
|
||||
if cache.contains_key_ref(&mdtag) {
|
||||
if cache.contains_key(&mdtag) {
|
||||
let items = cache.get(&mdtag);
|
||||
for items.each |item| {
|
||||
let md: T = md_from_metadata::<T>(*item);
|
||||
|
@ -265,7 +265,7 @@ pub fn trans_to_datum(bcx: block, expr: @ast::expr) -> DatumBlock {
|
||||
}
|
||||
|
||||
pub fn trans_into(bcx: block, expr: @ast::expr, dest: Dest) -> block {
|
||||
if bcx.tcx().adjustments.contains_key_ref(&expr.id) {
|
||||
if bcx.tcx().adjustments.contains_key(&expr.id) {
|
||||
// use trans_to_datum, which is mildly less efficient but
|
||||
// which will perform the adjustments:
|
||||
let datumblock = trans_to_datum(bcx, expr);
|
||||
@ -426,7 +426,7 @@ fn trans_rvalue_datum_unadjusted(bcx: block, expr: @ast::expr) -> DatumBlock {
|
||||
}
|
||||
ast::expr_binary(op, lhs, rhs) => {
|
||||
// if overloaded, would be RvalueDpsExpr
|
||||
assert !bcx.ccx().maps.method_map.contains_key_ref(&expr.id);
|
||||
assert !bcx.ccx().maps.method_map.contains_key(&expr.id);
|
||||
|
||||
return trans_binary(bcx, expr, op, lhs, rhs);
|
||||
}
|
||||
@ -1215,7 +1215,7 @@ fn trans_unary_datum(bcx: block,
|
||||
assert op != ast::deref;
|
||||
|
||||
// if overloaded, would be RvalueDpsExpr
|
||||
assert !bcx.ccx().maps.method_map.contains_key_ref(&un_expr.id);
|
||||
assert !bcx.ccx().maps.method_map.contains_key(&un_expr.id);
|
||||
|
||||
let un_ty = expr_ty(bcx, un_expr);
|
||||
let sub_ty = expr_ty(bcx, sub_expr);
|
||||
|
@ -384,7 +384,7 @@ pub fn make_visit_glue(bcx: block, v: ValueRef, t: ty::t) {
|
||||
let _icx = bcx.insn_ctxt("make_visit_glue");
|
||||
let mut bcx = bcx;
|
||||
let ty_visitor_name = special_idents::ty_visitor;
|
||||
assert bcx.ccx().tcx.intrinsic_defs.contains_key_ref(&ty_visitor_name);
|
||||
assert bcx.ccx().tcx.intrinsic_defs.contains_key(&ty_visitor_name);
|
||||
let (trait_id, ty) = bcx.ccx().tcx.intrinsic_defs.get(&ty_visitor_name);
|
||||
let v = PointerCast(bcx, v, T_ptr(type_of::type_of(bcx.ccx(), ty)));
|
||||
bcx = reflect::emit_calls_to_trait_visit_ty(bcx, t, v, trait_id);
|
||||
@ -762,7 +762,7 @@ pub fn emit_tydescs(ccx: @crate_ctxt) {
|
||||
let _icx = ccx.insn_ctxt("emit_tydescs");
|
||||
// As of this point, allow no more tydescs to be created.
|
||||
ccx.finished_tydescs = true;
|
||||
for ccx.tydescs.each_value_ref |&val| {
|
||||
for ccx.tydescs.each_value |&val| {
|
||||
let glue_fn_ty = T_ptr(T_generic_glue_fn(ccx));
|
||||
let ti = val;
|
||||
|
||||
|
@ -180,7 +180,7 @@ pub fn llalign_of(cx: @crate_ctxt, t: TypeRef) -> ValueRef {
|
||||
|
||||
// Computes the size of the data part of an enum.
|
||||
pub fn static_size_of_enum(cx: @crate_ctxt, t: ty::t) -> uint {
|
||||
if cx.enum_sizes.contains_key_ref(&t) { return cx.enum_sizes.get(&t); }
|
||||
if cx.enum_sizes.contains_key(&t) { return cx.enum_sizes.get(&t); }
|
||||
match ty::get(t).sty {
|
||||
ty::ty_enum(tid, ref substs) => {
|
||||
// Compute max(variant sizes).
|
||||
|
@ -871,7 +871,7 @@ pub fn trans_trait_cast(bcx: block,
|
||||
match vstore {
|
||||
ty::vstore_slice(*) | ty::vstore_box => {
|
||||
let mut llboxdest = GEPi(bcx, lldest, [0u, 1u]);
|
||||
if bcx.tcx().legacy_boxed_traits.contains_key_ref(&id) {
|
||||
if bcx.tcx().legacy_boxed_traits.contains_key(&id) {
|
||||
// Allocate an @ box and store the value into it
|
||||
let {bcx: new_bcx, box: llbox, body: body} =
|
||||
malloc_boxed(bcx, v_ty);
|
||||
|
@ -95,7 +95,7 @@ fn traverse_public_mod(cx: ctx, mod_id: node_id, m: _mod) {
|
||||
}
|
||||
|
||||
fn traverse_public_item(cx: ctx, item: @item) {
|
||||
if cx.rmap.contains_key_ref(&item.id) { return; }
|
||||
if cx.rmap.contains_key(&item.id) { return; }
|
||||
cx.rmap.insert(item.id, ());
|
||||
match /*bad*/copy item.node {
|
||||
item_mod(m) => traverse_public_mod(cx, item.id, m),
|
||||
@ -145,7 +145,7 @@ fn mk_ty_visitor() -> visit::vt<ctx> {
|
||||
}
|
||||
|
||||
fn traverse_ty(ty: @Ty, cx: ctx, v: visit::vt<ctx>) {
|
||||
if cx.rmap.contains_key_ref(&ty.id) { return; }
|
||||
if cx.rmap.contains_key(&ty.id) { return; }
|
||||
cx.rmap.insert(ty.id, ());
|
||||
|
||||
match ty.node {
|
||||
|
@ -331,7 +331,7 @@ pub fn emit_calls_to_trait_visit_ty(bcx: block,
|
||||
-> block {
|
||||
use syntax::parse::token::special_idents::tydesc;
|
||||
let final = sub_block(bcx, ~"final");
|
||||
assert bcx.ccx().tcx.intrinsic_defs.contains_key_ref(&tydesc);
|
||||
assert bcx.ccx().tcx.intrinsic_defs.contains_key(&tydesc);
|
||||
let (_, tydesc_ty) = bcx.ccx().tcx.intrinsic_defs.get(&tydesc);
|
||||
let tydesc_ty = type_of::type_of(bcx.ccx(), tydesc_ty);
|
||||
let mut r = Reflector {
|
||||
|
@ -93,7 +93,7 @@ pub fn type_of(cx: @crate_ctxt, t: ty::t) -> TypeRef {
|
||||
debug!("type_of %?: %?", t, ty::get(t));
|
||||
|
||||
// Check the cache.
|
||||
if cx.lltypes.contains_key_ref(&t) { return cx.lltypes.get(&t); }
|
||||
if cx.lltypes.contains_key(&t) { return cx.lltypes.get(&t); }
|
||||
|
||||
// Replace any typedef'd types with their equivalent non-typedef
|
||||
// type. This ensures that all LLVM nominal types that contain
|
||||
|
@ -2778,7 +2778,7 @@ pub fn node_id_to_type_params(cx: ctxt, id: ast::node_id) -> ~[t] {
|
||||
}
|
||||
|
||||
fn node_id_has_type_params(cx: ctxt, id: ast::node_id) -> bool {
|
||||
return cx.node_type_substs.contains_key_ref(&id);
|
||||
cx.node_type_substs.contains_key(&id)
|
||||
}
|
||||
|
||||
// Type accessors for substructures of types
|
||||
@ -3082,7 +3082,7 @@ pub enum ExprKind {
|
||||
pub fn expr_kind(tcx: ctxt,
|
||||
method_map: typeck::method_map,
|
||||
expr: @ast::expr) -> ExprKind {
|
||||
if method_map.contains_key_ref(&expr.id) {
|
||||
if method_map.contains_key(&expr.id) {
|
||||
// Overloaded operations are generally calls, and hence they are
|
||||
// generated via DPS. However, assign_op (e.g., `x += y`) is an
|
||||
// exception, as its result is always unit.
|
||||
@ -4338,7 +4338,7 @@ pub fn iter_bound_traits_and_supertraits(tcx: ctxt,
|
||||
let super_t = supertrait.tpt.ty;
|
||||
let d_id = ty_to_def_id(super_t).expect("supertrait \
|
||||
should be a trait ty");
|
||||
if !supertrait_map.contains_key_ref(&d_id) {
|
||||
if !supertrait_map.contains_key(&d_id) {
|
||||
supertrait_map.insert(d_id, super_t);
|
||||
trait_ty = super_t;
|
||||
seen_def_ids.push(d_id);
|
||||
|
@ -239,7 +239,7 @@ pub fn check_struct_pat_fields(pcx: pat_ctxt,
|
||||
// Report an error if not all the fields were specified.
|
||||
if !etc {
|
||||
for class_fields.eachi |i, field| {
|
||||
if found_fields.contains_key_ref(&i) {
|
||||
if found_fields.contains_key(&i) {
|
||||
loop;
|
||||
}
|
||||
tcx.sess.span_err(span,
|
||||
|
@ -1172,12 +1172,11 @@ pub impl LookupContext {
|
||||
match candidate.origin {
|
||||
method_static(method_id) | method_self(method_id, _)
|
||||
| method_super(method_id, _) => {
|
||||
bad = self.tcx().destructors.contains_key_ref(&method_id);
|
||||
bad = self.tcx().destructors.contains_key(&method_id);
|
||||
}
|
||||
method_param(method_param { trait_id: trait_id, _ }) |
|
||||
method_trait(trait_id, _, _) => {
|
||||
bad = self.tcx().destructor_for_type.contains_key_ref(
|
||||
&trait_id);
|
||||
bad = self.tcx().destructor_for_type.contains_key(&trait_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3208,8 +3208,8 @@ pub fn check_intrinsic_type(ccx: @mut CrateCtxt, it: @ast::foreign_item) {
|
||||
~"visit_tydesc" => {
|
||||
let tydesc_name = special_idents::tydesc;
|
||||
let ty_visitor_name = tcx.sess.ident_of(~"TyVisitor");
|
||||
assert tcx.intrinsic_defs.contains_key_ref(&tydesc_name);
|
||||
assert ccx.tcx.intrinsic_defs.contains_key_ref(&ty_visitor_name);
|
||||
assert tcx.intrinsic_defs.contains_key(&tydesc_name);
|
||||
assert ccx.tcx.intrinsic_defs.contains_key(&ty_visitor_name);
|
||||
let (_, tydesc_ty) = tcx.intrinsic_defs.get(&tydesc_name);
|
||||
let (_, visitor_trait) = tcx.intrinsic_defs.get(&ty_visitor_name);
|
||||
let td_ptr = ty::mk_ptr(ccx.tcx, ty::mt {ty: tydesc_ty,
|
||||
|
@ -213,7 +213,7 @@ pub fn visit_expr(expr: @ast::expr, &&rcx: @mut Rcx, v: rvt) {
|
||||
// `constrain_auto_ref()` on all exprs. But that causes a
|
||||
// lot of spurious errors because of how the region
|
||||
// hierarchy is setup.
|
||||
if rcx.fcx.ccx.method_map.contains_key_ref(&callee.id) {
|
||||
if rcx.fcx.ccx.method_map.contains_key(&callee.id) {
|
||||
match callee.node {
|
||||
ast::expr_field(base, _, _) => {
|
||||
constrain_auto_ref(rcx, base);
|
||||
@ -749,7 +749,7 @@ pub mod guarantor {
|
||||
let _i = ::util::common::indenter();
|
||||
|
||||
let guarantor = {
|
||||
if rcx.fcx.ccx.method_map.contains_key_ref(&expr.id) {
|
||||
if rcx.fcx.ccx.method_map.contains_key(&expr.id) {
|
||||
None
|
||||
} else {
|
||||
guarantor(rcx, expr)
|
||||
|
@ -268,7 +268,7 @@ pub fn lookup_vtable(vcx: &VtableContext,
|
||||
// im is one specific impl of trait_ty.
|
||||
|
||||
// First, ensure we haven't processed this impl yet.
|
||||
if impls_seen.contains_key_ref(&im.did) {
|
||||
if impls_seen.contains_key(&im.did) {
|
||||
loop;
|
||||
}
|
||||
impls_seen.insert(im.did, ());
|
||||
|
@ -141,7 +141,7 @@ fn maybe_resolve_type_vars_for_node(wbcx: @mut WbCtxt,
|
||||
sp: span,
|
||||
id: ast::node_id)
|
||||
-> Option<ty::t> {
|
||||
if wbcx.fcx.inh.node_types.contains_key_ref(&id) {
|
||||
if wbcx.fcx.inh.node_types.contains_key(&id) {
|
||||
resolve_type_vars_for_node(wbcx, sp, id)
|
||||
} else {
|
||||
None
|
||||
|
@ -418,7 +418,7 @@ pub impl CoherenceChecker {
|
||||
let coherence_info = &mut self.crate_context.coherence_info;
|
||||
let extension_methods = &coherence_info.extension_methods;
|
||||
|
||||
for extension_methods.each_key_ref |&trait_id| {
|
||||
for extension_methods.each_key |&trait_id| {
|
||||
self.check_implementation_coherence_of(trait_id);
|
||||
}
|
||||
}
|
||||
@ -503,7 +503,7 @@ pub impl CoherenceChecker {
|
||||
}
|
||||
|
||||
for ty::trait_methods(tcx, trait_did).each |method| {
|
||||
if provided_method_idents.contains_key_ref(&method.ident) {
|
||||
if provided_method_idents.contains_key(&method.ident) {
|
||||
if !f(method) {
|
||||
break;
|
||||
}
|
||||
@ -911,7 +911,7 @@ pub impl CoherenceChecker {
|
||||
let tcx = self.crate_context.tcx;
|
||||
let pmm = tcx.provided_methods;
|
||||
|
||||
if pmm.contains_key_ref(&trait_def_id) { return; }
|
||||
if pmm.contains_key(&trait_def_id) { return; }
|
||||
|
||||
debug!("(adding default methods for trait) processing trait");
|
||||
|
||||
|
@ -304,7 +304,7 @@ pub fn ensure_supertraits(ccx: @mut CrateCtxt,
|
||||
rp: Option<ty::region_variance>,
|
||||
trait_refs: &[@ast::trait_ref]) {
|
||||
let tcx = ccx.tcx;
|
||||
if tcx.supertraits.contains_key_ref(&local_def(id)) { return; }
|
||||
if tcx.supertraits.contains_key(&local_def(id)) { return; }
|
||||
|
||||
let instantiated = dvec::DVec();
|
||||
for trait_refs.each |trait_ref| {
|
||||
|
@ -1242,7 +1242,7 @@ impl RegionVarBindings {
|
||||
|
||||
// It would be nice to write this using map():
|
||||
let mut edges = vec::with_capacity(num_edges);
|
||||
for self.constraints.each_ref |constraint, span| {
|
||||
for self.constraints.each |constraint, span| {
|
||||
edges.push(GraphEdge {
|
||||
next_edge: [uint::max_value, uint::max_value],
|
||||
constraint: *constraint,
|
||||
|
@ -177,7 +177,7 @@ Available lint options:
|
||||
|
||||
let lint_dict = lint::get_lint_dict();
|
||||
let mut max_key = 0;
|
||||
for lint_dict.each_key_ref |&k| { max_key = uint::max(k.len(), max_key); }
|
||||
for lint_dict.each_key |&k| { max_key = uint::max(k.len(), max_key); }
|
||||
fn padded(max: uint, s: &str) -> ~str {
|
||||
str::from_bytes(vec::from_elem(max - s.len(), ' ' as u8)) + s
|
||||
}
|
||||
@ -186,7 +186,7 @@ Available lint options:
|
||||
padded(max_key, ~"name"), ~"default", ~"meaning"));
|
||||
io::println(fmt!(" %s %7.7s %s\n",
|
||||
padded(max_key, ~"----"), ~"-------", ~"-------"));
|
||||
for lint_dict.each_ref |&k, &v| {
|
||||
for lint_dict.each |&k, &v| {
|
||||
let k = str::replace(k, ~"_", ~"-");
|
||||
io::println(fmt!(" %s %7.7s %s",
|
||||
padded(max_key, k),
|
||||
|
@ -76,7 +76,7 @@ pub mod chained {
|
||||
FoundAfter(@Entry<K,V>, @Entry<K,V>)
|
||||
}
|
||||
|
||||
priv impl<K:Eq IterBytes Hash, V: Copy> T<K, V> {
|
||||
priv impl<K:Eq IterBytes Hash, V> T<K, V> {
|
||||
pure fn search_rem(k: &K, h: uint, idx: uint,
|
||||
e_root: @Entry<K,V>) -> SearchResult<K,V> {
|
||||
let mut e0 = e_root;
|
||||
@ -90,15 +90,13 @@ pub mod chained {
|
||||
}
|
||||
Some(e1) => {
|
||||
comp += 1u;
|
||||
unsafe {
|
||||
if e1.hash == h && e1.key == *k {
|
||||
debug!("search_tbl: present, comp %u, \
|
||||
hash %u, idx %u",
|
||||
comp, h, idx);
|
||||
return FoundAfter(e0, e1);
|
||||
} else {
|
||||
e0 = e1;
|
||||
}
|
||||
if e1.hash == h && e1.key == *k {
|
||||
debug!(
|
||||
"search_tbl: present, comp %u, hash %u, idx %u",
|
||||
comp, h, idx);
|
||||
return FoundAfter(e0, e1);
|
||||
} else {
|
||||
e0 = e1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -114,14 +112,12 @@ pub mod chained {
|
||||
return NotFound;
|
||||
}
|
||||
Some(e) => {
|
||||
unsafe {
|
||||
if e.hash == h && e.key == *k {
|
||||
debug!("search_tbl: present, comp %u, hash %u, \
|
||||
idx %u", 1u, h, idx);
|
||||
return FoundFirst(idx, e);
|
||||
} else {
|
||||
return self.search_rem(k, h, idx, e);
|
||||
}
|
||||
if e.hash == h && e.key == *k {
|
||||
debug!("search_tbl: present, comp %u, hash %u, \
|
||||
idx %u", 1u, h, idx);
|
||||
return FoundFirst(idx, e);
|
||||
} else {
|
||||
return self.search_rem(k, h, idx, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -172,8 +168,8 @@ pub mod chained {
|
||||
}
|
||||
}
|
||||
|
||||
impl<K:Eq IterBytes Hash Copy, V: Copy> T<K, V> {
|
||||
pure fn contains_key_ref(&self, k: &K) -> bool {
|
||||
impl<K: Eq IterBytes Hash, V> T<K, V> {
|
||||
pure fn contains_key(&self, k: &K) -> bool {
|
||||
let hash = k.hash_keyed(0,0) as uint;
|
||||
match self.search_tbl(k, hash) {
|
||||
NotFound => false,
|
||||
@ -225,13 +221,43 @@ pub mod chained {
|
||||
}
|
||||
}
|
||||
|
||||
fn remove(k: &K) -> bool {
|
||||
match self.search_tbl(k, k.hash_keyed(0,0) as uint) {
|
||||
NotFound => false,
|
||||
FoundFirst(idx, entry) => {
|
||||
self.count -= 1u;
|
||||
self.chains[idx] = entry.next;
|
||||
true
|
||||
}
|
||||
FoundAfter(eprev, entry) => {
|
||||
self.count -= 1u;
|
||||
eprev.next = entry.next;
|
||||
true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pure fn each(&self, blk: fn(key: &K, value: &V) -> bool) {
|
||||
for self.each_entry |entry| {
|
||||
if !blk(&entry.key, &entry.value) { break; }
|
||||
}
|
||||
}
|
||||
|
||||
pure fn each_key(&self, blk: fn(key: &K) -> bool) {
|
||||
self.each(|k, _v| blk(k))
|
||||
}
|
||||
|
||||
pure fn each_value(&self, blk: fn(value: &V) -> bool) {
|
||||
self.each(|_k, v| blk(v))
|
||||
}
|
||||
}
|
||||
|
||||
impl<K: Eq IterBytes Hash Copy, V: Copy> T<K, V> {
|
||||
pure fn find(&self, k: &K) -> Option<V> {
|
||||
unsafe {
|
||||
match self.search_tbl(k, k.hash_keyed(0,0) as uint) {
|
||||
NotFound => None,
|
||||
FoundFirst(_, entry) => Some(entry.value),
|
||||
FoundAfter(_, entry) => Some(entry.value)
|
||||
}
|
||||
match self.search_tbl(k, k.hash_keyed(0,0) as uint) {
|
||||
NotFound => None,
|
||||
FoundFirst(_, entry) => Some(entry.value),
|
||||
FoundAfter(_, entry) => Some(entry.value)
|
||||
}
|
||||
}
|
||||
|
||||
@ -297,36 +323,6 @@ pub mod chained {
|
||||
}
|
||||
option::unwrap(move opt_v)
|
||||
}
|
||||
|
||||
fn remove(k: &K) -> bool {
|
||||
match self.search_tbl(k, k.hash_keyed(0,0) as uint) {
|
||||
NotFound => false,
|
||||
FoundFirst(idx, entry) => {
|
||||
self.count -= 1u;
|
||||
self.chains[idx] = entry.next;
|
||||
true
|
||||
}
|
||||
FoundAfter(eprev, entry) => {
|
||||
self.count -= 1u;
|
||||
eprev.next = entry.next;
|
||||
true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pure fn each_ref(&self, blk: fn(key: &K, value: &V) -> bool) {
|
||||
for self.each_entry |entry| {
|
||||
if !blk(&entry.key, &entry.value) { break; }
|
||||
}
|
||||
}
|
||||
|
||||
pure fn each_key_ref(&self, blk: fn(key: &K) -> bool) {
|
||||
self.each_ref(|k, _v| blk(k))
|
||||
}
|
||||
|
||||
pure fn each_value_ref(&self, blk: fn(value: &V) -> bool) {
|
||||
self.each_ref(|_k, v| blk(v))
|
||||
}
|
||||
}
|
||||
|
||||
impl<K:Eq IterBytes Hash Copy ToStr, V: ToStr Copy> T<K, V> {
|
||||
@ -362,9 +358,7 @@ pub mod chained {
|
||||
|
||||
impl<K:Eq IterBytes Hash Copy, V: Copy> T<K, V>: ops::Index<K, V> {
|
||||
pure fn index(&self, k: K) -> V {
|
||||
unsafe {
|
||||
self.get(&k)
|
||||
}
|
||||
self.get(&k)
|
||||
}
|
||||
}
|
||||
|
||||
@ -397,7 +391,7 @@ pub fn set_add<K:Eq IterBytes Hash Const Copy>(set: Set<K>, key: K) -> bool {
|
||||
/// Convert a set into a vector.
|
||||
pub pure fn vec_from_set<T:Eq IterBytes Hash Copy>(s: Set<T>) -> ~[T] {
|
||||
do vec::build_sized(s.len()) |push| {
|
||||
for s.each_key_ref() |&k| {
|
||||
for s.each_key() |&k| {
|
||||
push(k);
|
||||
}
|
||||
}
|
||||
@ -628,9 +622,9 @@ mod tests {
|
||||
fn test_contains_key() {
|
||||
let key = ~"k";
|
||||
let map = HashMap::<~str, ~str>();
|
||||
assert (!map.contains_key_ref(&key));
|
||||
assert (!map.contains_key(&key));
|
||||
map.insert(key, ~"val");
|
||||
assert (map.contains_key_ref(&key));
|
||||
assert (map.contains_key(&key));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -648,10 +642,10 @@ mod tests {
|
||||
let mut map = HashMap::<~str, ~str>();
|
||||
map.insert(key, ~"val");
|
||||
assert (map.len() == 1);
|
||||
assert (map.contains_key_ref(&key));
|
||||
assert (map.contains_key(&key));
|
||||
map.clear();
|
||||
assert (map.len() == 0);
|
||||
assert (!map.contains_key_ref(&key));
|
||||
assert (!map.contains_key(&key));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -24,8 +24,7 @@ use core::either::Either;
|
||||
use core::either;
|
||||
use core::option;
|
||||
use core::vec;
|
||||
use std::oldmap::HashMap;
|
||||
use std::oldmap;
|
||||
use core::hashmap::linear::LinearSet;
|
||||
use std;
|
||||
|
||||
/* Constructors */
|
||||
@ -358,16 +357,15 @@ pub fn find_inline_attr(attrs: &[ast::attribute]) -> inline_attr {
|
||||
|
||||
pub fn require_unique_names(diagnostic: span_handler,
|
||||
metas: &[@ast::meta_item]) {
|
||||
let map = oldmap::HashMap();
|
||||
let mut set = LinearSet::new();
|
||||
for metas.each |meta| {
|
||||
let name = get_meta_item_name(*meta);
|
||||
|
||||
// FIXME: How do I silence the warnings? --pcw (#2619)
|
||||
if map.contains_key_ref(&name) {
|
||||
if !set.insert(name) {
|
||||
diagnostic.span_fatal(meta.span,
|
||||
fmt!("duplicate meta item `%s`", name));
|
||||
}
|
||||
map.insert(name, ());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -197,7 +197,7 @@ pub fn nameize(p_s: parse_sess, ms: ~[matcher], res: ~[@named_match])
|
||||
codemap::spanned {
|
||||
node: match_nonterminal(bind_name, _, idx), span: sp
|
||||
} => {
|
||||
if ret_val.contains_key_ref(&bind_name) {
|
||||
if ret_val.contains_key(&bind_name) {
|
||||
p_s.span_diagnostic.span_fatal(sp, ~"Duplicated bind name: "+
|
||||
*p_s.interner.get(bind_name))
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ pub impl Parser {
|
||||
|
||||
// A sanity check that the word we are asking for is a known keyword
|
||||
fn require_keyword(word: ~str) {
|
||||
if !self.keywords.contains_key_ref(&word) {
|
||||
if !self.keywords.contains_key(&word) {
|
||||
self.bug(fmt!("unknown keyword: %s", word));
|
||||
}
|
||||
}
|
||||
@ -120,7 +120,7 @@ pub impl Parser {
|
||||
fn is_any_keyword(tok: token::Token) -> bool {
|
||||
match tok {
|
||||
token::IDENT(sid, false) => {
|
||||
self.keywords.contains_key_ref(self.id_to_str(sid))
|
||||
self.keywords.contains_key(self.id_to_str(sid))
|
||||
}
|
||||
_ => false
|
||||
}
|
||||
@ -146,7 +146,7 @@ pub impl Parser {
|
||||
}
|
||||
|
||||
fn is_strict_keyword(word: ~str) -> bool {
|
||||
self.strict_keywords.contains_key_ref(&word)
|
||||
self.strict_keywords.contains_key(&word)
|
||||
}
|
||||
|
||||
fn check_strict_keywords() {
|
||||
@ -166,7 +166,7 @@ pub impl Parser {
|
||||
}
|
||||
|
||||
fn is_reserved_keyword(word: ~str) -> bool {
|
||||
self.reserved_keywords.contains_key_ref(&word)
|
||||
self.reserved_keywords.contains_key(&word)
|
||||
}
|
||||
|
||||
fn check_reserved_keywords() {
|
||||
|
@ -137,7 +137,7 @@ pub impl Parser {
|
||||
desc: &str) {
|
||||
self.span_err(sp, fmt!("obsolete syntax: %s", kind_str));
|
||||
|
||||
if !self.obsolete_set.contains_key_ref(&kind) {
|
||||
if !self.obsolete_set.contains_key(&kind) {
|
||||
self.sess.span_diagnostic.handler().note(fmt!("%s", desc));
|
||||
self.obsolete_set.insert(kind, ());
|
||||
}
|
||||
|
@ -455,13 +455,13 @@ pub fn mk_fake_ident_interner() -> @ident_interner {
|
||||
*/
|
||||
pub fn keyword_table() -> HashMap<~str, ()> {
|
||||
let keywords = HashMap();
|
||||
for temporary_keyword_table().each_key_ref |&word| {
|
||||
for temporary_keyword_table().each_key |&word| {
|
||||
keywords.insert(word, ());
|
||||
}
|
||||
for strict_keyword_table().each_key_ref |&word| {
|
||||
for strict_keyword_table().each_key |&word| {
|
||||
keywords.insert(word, ());
|
||||
}
|
||||
for reserved_keyword_table().each_key_ref |&word| {
|
||||
for reserved_keyword_table().each_key |&word| {
|
||||
keywords.insert(word, ());
|
||||
}
|
||||
keywords
|
||||
|
@ -49,7 +49,7 @@ fn sort_and_fmt(mm: HashMap<~[u8], uint>, total: uint) -> ~str {
|
||||
let mut pairs = ~[];
|
||||
|
||||
// map -> [(k,%)]
|
||||
for mm.each_ref |&key, &val| {
|
||||
for mm.each |&key, &val| {
|
||||
pairs.push((key, pct(val, total)));
|
||||
}
|
||||
|
||||
|
@ -134,7 +134,7 @@ fn writer(path: ~str, pport: pipes::Port<Line>, size: uint)
|
||||
done += 1_u;
|
||||
let mut prev = done;
|
||||
while prev <= i {
|
||||
if lines.contains_key_ref(&prev) {
|
||||
if lines.contains_key(&prev) {
|
||||
debug!("WS %u", prev);
|
||||
cout.write(lines.get(&prev));
|
||||
done += 1_u;
|
||||
|
Loading…
x
Reference in New Issue
Block a user