oldmap: get rid of the legacy contains_key method
This commit is contained in:
parent
319eeb1c79
commit
f4a27b2c7d
41 changed files with 86 additions and 87 deletions
|
@ -1706,7 +1706,7 @@ pub fn cmd_sources(c: &Cargo) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.sources.contains_key(name) {
|
if c.sources.contains_key_ref(&name) {
|
||||||
error(fmt!("source already exists: %s", name));
|
error(fmt!("source already exists: %s", name));
|
||||||
} else {
|
} else {
|
||||||
c.sources.insert(name, @Source {
|
c.sources.insert(name, @Source {
|
||||||
|
@ -1733,7 +1733,7 @@ pub fn cmd_sources(c: &Cargo) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.sources.contains_key(name) {
|
if c.sources.contains_key_ref(&name) {
|
||||||
c.sources.remove(name);
|
c.sources.remove(name);
|
||||||
info(fmt!("removed source: %s", name));
|
info(fmt!("removed source: %s", name));
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -94,7 +94,7 @@ pub fn set_crate_data(cstore: CStore,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn have_crate_data(cstore: CStore, cnum: ast::crate_num) -> bool {
|
pub fn have_crate_data(cstore: CStore, cnum: ast::crate_num) -> bool {
|
||||||
return p(cstore).metas.contains_key(cnum);
|
return p(cstore).metas.contains_key_ref(&cnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn iter_crate_data(cstore: CStore,
|
pub fn iter_crate_data(cstore: CStore,
|
||||||
|
|
|
@ -99,7 +99,7 @@ pub enum encode_ctxt = {
|
||||||
};
|
};
|
||||||
|
|
||||||
pub fn reachable(ecx: @encode_ctxt, id: node_id) -> bool {
|
pub fn reachable(ecx: @encode_ctxt, id: node_id) -> bool {
|
||||||
ecx.reachable.contains_key(id)
|
ecx.reachable.contains_key_ref(&id)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn encode_name(ecx: @encode_ctxt, ebml_w: writer::Encoder, name: ident) {
|
fn encode_name(ecx: @encode_ctxt, ebml_w: writer::Encoder, name: ident) {
|
||||||
|
|
|
@ -665,7 +665,7 @@ fn check_loans_in_expr(expr: @ast::expr,
|
||||||
|
|
||||||
self.check_for_conflicting_loans(expr.id);
|
self.check_for_conflicting_loans(expr.id);
|
||||||
|
|
||||||
if self.bccx.moves_map.contains_key(expr.id) {
|
if self.bccx.moves_map.contains_key_ref(&expr.id) {
|
||||||
self.check_move_out_from_expr(expr);
|
self.check_move_out_from_expr(expr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -686,7 +686,7 @@ fn check_loans_in_expr(expr: @ast::expr,
|
||||||
}
|
}
|
||||||
ast::expr_index(_, rval) |
|
ast::expr_index(_, rval) |
|
||||||
ast::expr_binary(_, _, rval)
|
ast::expr_binary(_, _, rval)
|
||||||
if self.bccx.method_map.contains_key(expr.id) => {
|
if self.bccx.method_map.contains_key_ref(&expr.id) => {
|
||||||
self.check_call(expr,
|
self.check_call(expr,
|
||||||
None,
|
None,
|
||||||
expr.callee_id,
|
expr.callee_id,
|
||||||
|
@ -694,7 +694,7 @@ fn check_loans_in_expr(expr: @ast::expr,
|
||||||
~[rval]);
|
~[rval]);
|
||||||
}
|
}
|
||||||
ast::expr_unary(*) | ast::expr_index(*)
|
ast::expr_unary(*) | ast::expr_index(*)
|
||||||
if self.bccx.method_map.contains_key(expr.id) => {
|
if self.bccx.method_map.contains_key_ref(&expr.id) => {
|
||||||
self.check_call(expr,
|
self.check_call(expr,
|
||||||
None,
|
None,
|
||||||
expr.callee_id,
|
expr.callee_id,
|
||||||
|
|
|
@ -204,7 +204,7 @@ fn req_loans_in_expr(ex: @ast::expr,
|
||||||
ast::expr_binary(_, rcvr, _) |
|
ast::expr_binary(_, rcvr, _) |
|
||||||
ast::expr_unary(_, rcvr) |
|
ast::expr_unary(_, rcvr) |
|
||||||
ast::expr_assign_op(_, rcvr, _)
|
ast::expr_assign_op(_, rcvr, _)
|
||||||
if self.bccx.method_map.contains_key(ex.id) => {
|
if self.bccx.method_map.contains_key_ref(&ex.id) => {
|
||||||
// Receivers in method calls are always passed by ref.
|
// Receivers in method calls are always passed by ref.
|
||||||
//
|
//
|
||||||
// Here, in an overloaded operator, the call is this expression,
|
// Here, in an overloaded operator, the call is this expression,
|
||||||
|
@ -241,7 +241,7 @@ fn req_loans_in_expr(ex: @ast::expr,
|
||||||
// }
|
// }
|
||||||
|
|
||||||
ast::expr_field(rcvr, _, _)
|
ast::expr_field(rcvr, _, _)
|
||||||
if self.bccx.method_map.contains_key(ex.id) => {
|
if self.bccx.method_map.contains_key_ref(&ex.id) => {
|
||||||
// Receivers in method calls are always passed by ref.
|
// Receivers in method calls are always passed by ref.
|
||||||
//
|
//
|
||||||
// Here, the field a.b is in fact a closure. Eventually, this
|
// 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
|
// scope_id;`. Though that would potentially re-introduce
|
||||||
// the ICE. See #3511 for more details.
|
// the ICE. See #3511 for more details.
|
||||||
let scope_to_use = if
|
let scope_to_use = if
|
||||||
self.bccx.stmt_map.contains_key(scope_id) {
|
self.bccx.stmt_map.contains_key_ref(&scope_id) {
|
||||||
// Root it in its parent scope, b/c
|
// Root it in its parent scope, b/c
|
||||||
// trans won't introduce a new scope for the
|
// trans won't introduce a new scope for the
|
||||||
// stmt
|
// stmt
|
||||||
|
|
|
@ -102,7 +102,7 @@ pub fn check_expr(sess: Session,
|
||||||
}
|
}
|
||||||
expr_lit(@codemap::spanned {node: lit_str(_), _}) => { }
|
expr_lit(@codemap::spanned {node: lit_str(_), _}) => { }
|
||||||
expr_binary(_, _, _) | expr_unary(_, _) => {
|
expr_binary(_, _, _) | expr_unary(_, _) => {
|
||||||
if method_map.contains_key(e.id) {
|
if method_map.contains_key_ref(&e.id) {
|
||||||
sess.span_err(e.span, ~"user-defined operators are not \
|
sess.span_err(e.span, ~"user-defined operators are not \
|
||||||
allowed in constant expressions");
|
allowed in constant expressions");
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,7 @@ pub fn expr_is_non_moving_lvalue(cx: @MatchCheckCtxt, expr: @expr) -> bool {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
!cx.moves_map.contains_key(expr.id)
|
!cx.moves_map.contains_key_ref(&expr.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn check_expr(cx: @MatchCheckCtxt, ex: @expr, &&s: (), v: visit::vt<()>) {
|
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);
|
by_ref_span = Some(span);
|
||||||
}
|
}
|
||||||
bind_infer => {
|
bind_infer => {
|
||||||
if cx.moves_map.contains_key(id) {
|
if cx.moves_map.contains_key_ref(&id) {
|
||||||
any_by_move = true;
|
any_by_move = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -774,7 +774,7 @@ pub fn check_legality_of_move_bindings(cx: @MatchCheckCtxt,
|
||||||
if pat_is_binding(def_map, p) {
|
if pat_is_binding(def_map, p) {
|
||||||
match p.node {
|
match p.node {
|
||||||
pat_ident(_, _, sub) => {
|
pat_ident(_, _, sub) => {
|
||||||
if cx.moves_map.contains_key(p.id) {
|
if cx.moves_map.contains_key_ref(&p.id) {
|
||||||
check_move(p, sub);
|
check_move(p, sub);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -800,7 +800,7 @@ pub fn check_legality_of_move_bindings(cx: @MatchCheckCtxt,
|
||||||
behind_bad_pointer);
|
behind_bad_pointer);
|
||||||
|
|
||||||
if behind_bad_pointer &&
|
if behind_bad_pointer &&
|
||||||
cx.moves_map.contains_key(pat.id)
|
cx.moves_map.contains_key_ref(&pat.id)
|
||||||
{
|
{
|
||||||
cx.tcx.sess.span_err(
|
cx.tcx.sess.span_err(
|
||||||
pat.span,
|
pat.span,
|
||||||
|
|
|
@ -71,7 +71,7 @@ fn collect_freevars(def_map: resolve::DefMap, blk: ast::blk)
|
||||||
}
|
}
|
||||||
if i == depth { // Made it to end of loop
|
if i == depth { // Made it to end of loop
|
||||||
let dnum = ast_util::def_id_of_def(def).node;
|
let dnum = ast_util::def_id_of_def(def).node;
|
||||||
if !seen.contains_key(dnum) {
|
if !seen.contains_key_ref(&dnum) {
|
||||||
refs.push(@freevar_entry {
|
refs.push(@freevar_entry {
|
||||||
def: def,
|
def: def,
|
||||||
span: expr.span,
|
span: expr.span,
|
||||||
|
|
|
@ -348,7 +348,7 @@ pub impl &mem_categorization_ctxt {
|
||||||
let expr_ty = tcx.ty(expr);
|
let expr_ty = tcx.ty(expr);
|
||||||
match expr.node {
|
match expr.node {
|
||||||
ast::expr_unary(ast::deref, e_base) => {
|
ast::expr_unary(ast::deref, e_base) => {
|
||||||
if self.method_map.contains_key(expr.id) {
|
if self.method_map.contains_key_ref(&expr.id) {
|
||||||
return self.cat_rvalue(expr, expr_ty);
|
return self.cat_rvalue(expr, expr_ty);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -357,7 +357,7 @@ pub impl &mem_categorization_ctxt {
|
||||||
}
|
}
|
||||||
|
|
||||||
ast::expr_field(base, f_name, _) => {
|
ast::expr_field(base, f_name, _) => {
|
||||||
if self.method_map.contains_key(expr.id) {
|
if self.method_map.contains_key_ref(&expr.id) {
|
||||||
return self.cat_method_ref(expr, expr_ty);
|
return self.cat_method_ref(expr, expr_ty);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -366,7 +366,7 @@ pub impl &mem_categorization_ctxt {
|
||||||
}
|
}
|
||||||
|
|
||||||
ast::expr_index(base, _) => {
|
ast::expr_index(base, _) => {
|
||||||
if self.method_map.contains_key(expr.id) {
|
if self.method_map.contains_key_ref(&expr.id) {
|
||||||
return self.cat_rvalue(expr, expr_ty);
|
return self.cat_rvalue(expr, expr_ty);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -640,7 +640,7 @@ impl VisitContext {
|
||||||
arg_exprs: &[@expr],
|
arg_exprs: &[@expr],
|
||||||
visitor: vt<VisitContext>) -> bool
|
visitor: vt<VisitContext>) -> bool
|
||||||
{
|
{
|
||||||
if !self.method_map.contains_key(expr.id) {
|
if !self.method_map.contains_key_ref(&expr.id) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -771,7 +771,7 @@ impl VisitContext {
|
||||||
for arm.pats.each |pat| {
|
for arm.pats.each |pat| {
|
||||||
let mut found = false;
|
let mut found = false;
|
||||||
do pat_bindings(self.tcx.def_map, *pat) |_, node_id, _, _| {
|
do pat_bindings(self.tcx.def_map, *pat) |_, node_id, _, _| {
|
||||||
if moves_map.contains_key(node_id) {
|
if moves_map.contains_key_ref(&node_id) {
|
||||||
found = true;
|
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(expr.id) {
|
if new_cx.root_exprs.contains_key_ref(&expr.id) {
|
||||||
new_cx.parent = Some(expr.id);
|
new_cx.parent = Some(expr.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2211,7 +2211,7 @@ pub impl Resolver {
|
||||||
}
|
}
|
||||||
|
|
||||||
// We've successfully resolved the import. Write the results in.
|
// We've successfully resolved the import. Write the results in.
|
||||||
assert module_.import_resolutions.contains_key(target);
|
assert module_.import_resolutions.contains_key_ref(&target);
|
||||||
let import_resolution = module_.import_resolutions.get(target);
|
let import_resolution = module_.import_resolutions.get(target);
|
||||||
|
|
||||||
match value_result {
|
match value_result {
|
||||||
|
@ -2370,7 +2370,7 @@ pub impl Resolver {
|
||||||
}
|
}
|
||||||
|
|
||||||
// We've successfully resolved the import. Write the results in.
|
// We've successfully resolved the import. Write the results in.
|
||||||
assert module_.import_resolutions.contains_key(target);
|
assert module_.import_resolutions.contains_key_ref(&target);
|
||||||
let import_resolution = module_.import_resolutions.get(target);
|
let import_resolution = module_.import_resolutions.get(target);
|
||||||
|
|
||||||
match module_result {
|
match module_result {
|
||||||
|
@ -4090,7 +4090,7 @@ pub impl Resolver {
|
||||||
}
|
}
|
||||||
|
|
||||||
for map_i.each |key, binding| {
|
for map_i.each |key, binding| {
|
||||||
if !map_0.contains_key(key) {
|
if !map_0.contains_key_ref(&key) {
|
||||||
self.session.span_err(
|
self.session.span_err(
|
||||||
binding.span,
|
binding.span,
|
||||||
fmt!("variable `%s` from pattern #%u is \
|
fmt!("variable `%s` from pattern #%u is \
|
||||||
|
@ -4319,7 +4319,8 @@ pub impl Resolver {
|
||||||
|
|
||||||
match bindings_list {
|
match bindings_list {
|
||||||
Some(bindings_list)
|
Some(bindings_list)
|
||||||
if !bindings_list.contains_key(ident) => {
|
if !bindings_list.contains_key_ref(&ident)
|
||||||
|
=> {
|
||||||
let last_rib = (*self.value_ribs).last();
|
let last_rib = (*self.value_ribs).last();
|
||||||
last_rib.bindings.insert(ident,
|
last_rib.bindings.insert(ident,
|
||||||
dl_def(def));
|
dl_def(def));
|
||||||
|
@ -4391,16 +4392,19 @@ pub impl Resolver {
|
||||||
pat_struct(path, _, _) => {
|
pat_struct(path, _, _) => {
|
||||||
match self.resolve_path(path, TypeNS, false, visitor) {
|
match self.resolve_path(path, TypeNS, false, visitor) {
|
||||||
Some(def_ty(class_id))
|
Some(def_ty(class_id))
|
||||||
if self.structs.contains_key(class_id) => {
|
if self.structs.contains_key_ref(&class_id)
|
||||||
|
=> {
|
||||||
let class_def = def_struct(class_id);
|
let class_def = def_struct(class_id);
|
||||||
self.record_def(pattern.id, class_def);
|
self.record_def(pattern.id, class_def);
|
||||||
}
|
}
|
||||||
Some(definition @ def_struct(class_id))
|
Some(definition @ def_struct(class_id))
|
||||||
if self.structs.contains_key(class_id) => {
|
if self.structs.contains_key_ref(&class_id)
|
||||||
|
=> {
|
||||||
self.record_def(pattern.id, definition);
|
self.record_def(pattern.id, definition);
|
||||||
}
|
}
|
||||||
Some(definition @ def_variant(_, variant_id))
|
Some(definition @ def_variant(_, variant_id))
|
||||||
if self.structs.contains_key(variant_id) => {
|
if self.structs.contains_key_ref(&variant_id)
|
||||||
|
=> {
|
||||||
self.record_def(pattern.id, definition);
|
self.record_def(pattern.id, definition);
|
||||||
}
|
}
|
||||||
result => {
|
result => {
|
||||||
|
@ -4848,12 +4852,12 @@ pub impl Resolver {
|
||||||
|
|
||||||
match self.resolve_path(path, TypeNS, false, visitor) {
|
match self.resolve_path(path, TypeNS, false, visitor) {
|
||||||
Some(def_ty(class_id)) | Some(def_struct(class_id))
|
Some(def_ty(class_id)) | Some(def_struct(class_id))
|
||||||
if self.structs.contains_key(class_id) => {
|
if self.structs.contains_key_ref(&class_id) => {
|
||||||
let class_def = def_struct(class_id);
|
let class_def = def_struct(class_id);
|
||||||
self.record_def(expr.id, class_def);
|
self.record_def(expr.id, class_def);
|
||||||
}
|
}
|
||||||
Some(definition @ def_variant(_, class_id))
|
Some(definition @ def_variant(_, class_id))
|
||||||
if self.structs.contains_key(class_id) => {
|
if self.structs.contains_key_ref(&class_id) => {
|
||||||
self.record_def(expr.id, definition);
|
self.record_def(expr.id, definition);
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
|
@ -5073,7 +5077,7 @@ pub impl Resolver {
|
||||||
self.session.str_of(name));
|
self.session.str_of(name));
|
||||||
|
|
||||||
match self.trait_info.find(trait_def_id) {
|
match self.trait_info.find(trait_def_id) {
|
||||||
Some(trait_info) if trait_info.contains_key(name) => {
|
Some(trait_info) if trait_info.contains_key_ref(&name) => {
|
||||||
debug!("(adding trait info if containing method) found trait \
|
debug!("(adding trait info if containing method) found trait \
|
||||||
%d:%d for method '%s'",
|
%d:%d for method '%s'",
|
||||||
trait_def_id.crate,
|
trait_def_id.crate,
|
||||||
|
|
|
@ -1586,7 +1586,7 @@ pub fn trans_match_inner(scope_cx: block,
|
||||||
// but during matching we need to store a *T as explained
|
// but during matching we need to store a *T as explained
|
||||||
// above
|
// above
|
||||||
let is_move =
|
let is_move =
|
||||||
scope_cx.ccx().maps.moves_map.contains_key(p_id);
|
scope_cx.ccx().maps.moves_map.contains_key_ref(&p_id);
|
||||||
llmatch = alloca(bcx, T_ptr(llvariable_ty));
|
llmatch = alloca(bcx, T_ptr(llvariable_ty));
|
||||||
trmode = TrByValue(is_move, alloca(bcx, llvariable_ty));
|
trmode = TrByValue(is_move, alloca(bcx, llvariable_ty));
|
||||||
}
|
}
|
||||||
|
|
|
@ -169,8 +169,7 @@ pub fn get_extern_fn(externs: HashMap<~str, ValueRef>,
|
||||||
+name: ~str,
|
+name: ~str,
|
||||||
cc: lib::llvm::CallConv,
|
cc: lib::llvm::CallConv,
|
||||||
ty: TypeRef) -> ValueRef {
|
ty: TypeRef) -> ValueRef {
|
||||||
// XXX: Bad copy.
|
if externs.contains_key_ref(&name) { return externs.get(name); }
|
||||||
if externs.contains_key(copy name) { return externs.get(name); }
|
|
||||||
// XXX: Bad copy.
|
// XXX: Bad copy.
|
||||||
let f = decl_fn(llmod, copy name, cc, ty);
|
let f = decl_fn(llmod, copy name, cc, ty);
|
||||||
externs.insert(name, f);
|
externs.insert(name, f);
|
||||||
|
@ -180,8 +179,7 @@ pub fn get_extern_fn(externs: HashMap<~str, ValueRef>,
|
||||||
pub fn get_extern_const(externs: HashMap<~str, ValueRef>, llmod: ModuleRef,
|
pub fn get_extern_const(externs: HashMap<~str, ValueRef>, llmod: ModuleRef,
|
||||||
+name: ~str, ty: TypeRef) -> ValueRef {
|
+name: ~str, ty: TypeRef) -> ValueRef {
|
||||||
unsafe {
|
unsafe {
|
||||||
// XXX: Bad copy.
|
if externs.contains_key_ref(&name) { return externs.get(name); }
|
||||||
if externs.contains_key(copy name) { return externs.get(name); }
|
|
||||||
let c = str::as_c_str(name, |buf| {
|
let c = str::as_c_str(name, |buf| {
|
||||||
llvm::LLVMAddGlobal(llmod, ty, buf)
|
llvm::LLVMAddGlobal(llmod, ty, buf)
|
||||||
});
|
});
|
||||||
|
@ -451,7 +449,7 @@ pub fn set_glue_inlining(f: ValueRef, t: ty::t) {
|
||||||
// silently mangles such symbols, breaking our linkage model.
|
// silently mangles such symbols, breaking our linkage model.
|
||||||
pub fn note_unique_llvm_symbol(ccx: @crate_ctxt, +sym: ~str) {
|
pub fn note_unique_llvm_symbol(ccx: @crate_ctxt, +sym: ~str) {
|
||||||
// XXX: Bad copy.
|
// XXX: Bad copy.
|
||||||
if ccx.all_llvm_symbols.contains_key(copy sym) {
|
if ccx.all_llvm_symbols.contains_key_ref(&sym) {
|
||||||
ccx.sess.bug(~"duplicate LLVM symbol: " + sym);
|
ccx.sess.bug(~"duplicate LLVM symbol: " + sym);
|
||||||
}
|
}
|
||||||
ccx.all_llvm_symbols.insert(sym, ());
|
ccx.all_llvm_symbols.insert(sym, ());
|
||||||
|
@ -2485,7 +2483,7 @@ pub fn get_item_val(ccx: @crate_ctxt, id: ast::node_id) -> ValueRef {
|
||||||
ccx.sess.bug(~"get_item_val(): unexpected variant")
|
ccx.sess.bug(~"get_item_val(): unexpected variant")
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if !(exprt || ccx.reachable.contains_key(id)) {
|
if !(exprt || ccx.reachable.contains_key_ref(&id)) {
|
||||||
lib::llvm::SetLinkage(val, lib::llvm::InternalLinkage);
|
lib::llvm::SetLinkage(val, lib::llvm::InternalLinkage);
|
||||||
}
|
}
|
||||||
ccx.item_vals.insert(id, val);
|
ccx.item_vals.insert(id, val);
|
||||||
|
|
|
@ -672,7 +672,8 @@ pub fn trans_arg_expr(bcx: block,
|
||||||
// FIXME(#3548) use the adjustments table
|
// FIXME(#3548) use the adjustments table
|
||||||
match autoref_arg {
|
match autoref_arg {
|
||||||
DoAutorefArg => {
|
DoAutorefArg => {
|
||||||
assert !bcx.ccx().maps.moves_map.contains_key(arg_expr.id);
|
assert !bcx.ccx().maps.moves_map.contains_key_ref(
|
||||||
|
&arg_expr.id);
|
||||||
val = arg_datum.to_ref_llval(bcx);
|
val = arg_datum.to_ref_llval(bcx);
|
||||||
}
|
}
|
||||||
DontAutorefArg => {
|
DontAutorefArg => {
|
||||||
|
@ -682,16 +683,16 @@ pub fn trans_arg_expr(bcx: block,
|
||||||
// the explicit self code currently passes by-ref, it
|
// the explicit self code currently passes by-ref, it
|
||||||
// does not hold.
|
// does not hold.
|
||||||
//
|
//
|
||||||
//assert !bcx.ccx().maps.moves_map.contains_key(
|
//assert !bcx.ccx().maps.moves_map.contains_key_ref(
|
||||||
// arg_expr.id);
|
// &arg_expr.id);
|
||||||
val = arg_datum.to_ref_llval(bcx);
|
val = arg_datum.to_ref_llval(bcx);
|
||||||
}
|
}
|
||||||
|
|
||||||
ast::by_val => {
|
ast::by_val => {
|
||||||
// NB: avoid running the take glue.
|
// NB: avoid running the take glue.
|
||||||
|
|
||||||
assert !bcx.ccx().maps.moves_map.contains_key(
|
assert !bcx.ccx().maps.moves_map.contains_key_ref(
|
||||||
arg_expr.id);
|
&arg_expr.id);
|
||||||
val = arg_datum.to_value_llval(bcx);
|
val = arg_datum.to_value_llval(bcx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -126,7 +126,7 @@ pub fn get_const_val(cx: @crate_ctxt, def_id: ast::def_id) -> ValueRef {
|
||||||
if !ast_util::is_local(def_id) {
|
if !ast_util::is_local(def_id) {
|
||||||
cx.tcx.sess.bug(~"cross-crate constants");
|
cx.tcx.sess.bug(~"cross-crate constants");
|
||||||
}
|
}
|
||||||
if !cx.const_values.contains_key(def_id.node) {
|
if !cx.const_values.contains_key_ref(&def_id.node) {
|
||||||
match cx.tcx.items.get(def_id.node) {
|
match cx.tcx.items.get(def_id.node) {
|
||||||
ast_map::node_item(@ast::item {
|
ast_map::node_item(@ast::item {
|
||||||
node: ast::item_const(_, subexpr), _
|
node: ast::item_const(_, subexpr), _
|
||||||
|
|
|
@ -183,8 +183,7 @@ pub fn trans_log(log_ex: @ast::expr,
|
||||||
// XXX: Bad copy.
|
// XXX: Bad copy.
|
||||||
let modname = path_str(ccx.sess, copy modpath);
|
let modname = path_str(ccx.sess, copy modpath);
|
||||||
|
|
||||||
// XXX: Bad copy.
|
let global = if ccx.module_data.contains_key_ref(&modname) {
|
||||||
let global = if ccx.module_data.contains_key(copy modname) {
|
|
||||||
ccx.module_data.get(modname)
|
ccx.module_data.get(modname)
|
||||||
} else {
|
} else {
|
||||||
let s = link::mangle_internal_name_by_path_and_seq(
|
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.
|
* `id` is located in the move table, but copies otherwise.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if bcx.ccx().maps.moves_map.contains_key(id) {
|
if bcx.ccx().maps.moves_map.contains_key_ref(&id) {
|
||||||
self.move_to(bcx, action, dst)
|
self.move_to(bcx, action, dst)
|
||||||
} else {
|
} else {
|
||||||
self.copy_to(bcx, action, dst)
|
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) {
|
fn update_cache(cache: metadata_cache, mdtag: int, val: debug_metadata) {
|
||||||
let existing = if cache.contains_key(mdtag) {
|
let existing = if cache.contains_key_ref(&mdtag) {
|
||||||
cache.get(mdtag)
|
cache.get(mdtag)
|
||||||
} else {
|
} else {
|
||||||
~[]
|
~[]
|
||||||
|
@ -176,7 +176,7 @@ fn cached_metadata<T: Copy>(cache: metadata_cache,
|
||||||
eq_fn: fn(md: T) -> bool)
|
eq_fn: fn(md: T) -> bool)
|
||||||
-> Option<T> {
|
-> Option<T> {
|
||||||
unsafe {
|
unsafe {
|
||||||
if cache.contains_key(mdtag) {
|
if cache.contains_key_ref(&mdtag) {
|
||||||
let items = cache.get(mdtag);
|
let items = cache.get(mdtag);
|
||||||
for items.each |item| {
|
for items.each |item| {
|
||||||
let md: T = md_from_metadata::<T>(*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 {
|
pub fn trans_into(bcx: block, expr: @ast::expr, dest: Dest) -> block {
|
||||||
if bcx.tcx().adjustments.contains_key(expr.id) {
|
if bcx.tcx().adjustments.contains_key_ref(&expr.id) {
|
||||||
// use trans_to_datum, which is mildly less efficient but
|
// use trans_to_datum, which is mildly less efficient but
|
||||||
// which will perform the adjustments:
|
// which will perform the adjustments:
|
||||||
let datumblock = trans_to_datum(bcx, expr);
|
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) => {
|
ast::expr_binary(op, lhs, rhs) => {
|
||||||
// if overloaded, would be RvalueDpsExpr
|
// if overloaded, would be RvalueDpsExpr
|
||||||
assert !bcx.ccx().maps.method_map.contains_key(expr.id);
|
assert !bcx.ccx().maps.method_map.contains_key_ref(&expr.id);
|
||||||
|
|
||||||
return trans_binary(bcx, expr, op, lhs, rhs);
|
return trans_binary(bcx, expr, op, lhs, rhs);
|
||||||
}
|
}
|
||||||
|
@ -1243,7 +1243,7 @@ fn trans_unary_datum(bcx: block,
|
||||||
assert op != ast::deref;
|
assert op != ast::deref;
|
||||||
|
|
||||||
// if overloaded, would be RvalueDpsExpr
|
// if overloaded, would be RvalueDpsExpr
|
||||||
assert !bcx.ccx().maps.method_map.contains_key(un_expr.id);
|
assert !bcx.ccx().maps.method_map.contains_key_ref(&un_expr.id);
|
||||||
|
|
||||||
let un_ty = expr_ty(bcx, un_expr);
|
let un_ty = expr_ty(bcx, un_expr);
|
||||||
let sub_ty = expr_ty(bcx, sub_expr);
|
let sub_ty = expr_ty(bcx, sub_expr);
|
||||||
|
|
|
@ -380,7 +380,7 @@ pub fn make_visit_glue(bcx: block, v: ValueRef, t: ty::t) {
|
||||||
let _icx = bcx.insn_ctxt("make_visit_glue");
|
let _icx = bcx.insn_ctxt("make_visit_glue");
|
||||||
let mut bcx = bcx;
|
let mut bcx = bcx;
|
||||||
let ty_visitor_name = special_idents::ty_visitor;
|
let ty_visitor_name = special_idents::ty_visitor;
|
||||||
assert bcx.ccx().tcx.intrinsic_defs.contains_key(ty_visitor_name);
|
assert bcx.ccx().tcx.intrinsic_defs.contains_key_ref(&ty_visitor_name);
|
||||||
let (trait_id, ty) = bcx.ccx().tcx.intrinsic_defs.get(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)));
|
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);
|
bcx = reflect::emit_calls_to_trait_visit_ty(bcx, t, v, trait_id);
|
||||||
|
|
|
@ -178,7 +178,7 @@ pub fn llalign_of(cx: @crate_ctxt, t: TypeRef) -> ValueRef {
|
||||||
|
|
||||||
// Computes the size of the data part of an enum.
|
// Computes the size of the data part of an enum.
|
||||||
pub fn static_size_of_enum(cx: @crate_ctxt, t: ty::t) -> uint {
|
pub fn static_size_of_enum(cx: @crate_ctxt, t: ty::t) -> uint {
|
||||||
if cx.enum_sizes.contains_key(t) { return cx.enum_sizes.get(t); }
|
if cx.enum_sizes.contains_key_ref(&t) { return cx.enum_sizes.get(t); }
|
||||||
match ty::get(t).sty {
|
match ty::get(t).sty {
|
||||||
ty::ty_enum(tid, ref substs) => {
|
ty::ty_enum(tid, ref substs) => {
|
||||||
// Compute max(variant sizes).
|
// Compute max(variant sizes).
|
||||||
|
|
|
@ -871,7 +871,7 @@ pub fn trans_trait_cast(bcx: block,
|
||||||
match vstore {
|
match vstore {
|
||||||
ty::vstore_slice(*) | ty::vstore_box => {
|
ty::vstore_slice(*) | ty::vstore_box => {
|
||||||
let mut llboxdest = GEPi(bcx, lldest, [0u, 1u]);
|
let mut llboxdest = GEPi(bcx, lldest, [0u, 1u]);
|
||||||
if bcx.tcx().legacy_boxed_traits.contains_key(id) {
|
if bcx.tcx().legacy_boxed_traits.contains_key_ref(&id) {
|
||||||
// Allocate an @ box and store the value into it
|
// Allocate an @ box and store the value into it
|
||||||
let {bcx: new_bcx, box: llbox, body: body} =
|
let {bcx: new_bcx, box: llbox, body: body} =
|
||||||
malloc_boxed(bcx, v_ty);
|
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) {
|
fn traverse_public_item(cx: ctx, item: @item) {
|
||||||
if cx.rmap.contains_key(item.id) { return; }
|
if cx.rmap.contains_key_ref(&item.id) { return; }
|
||||||
cx.rmap.insert(item.id, ());
|
cx.rmap.insert(item.id, ());
|
||||||
match /*bad*/copy item.node {
|
match /*bad*/copy item.node {
|
||||||
item_mod(m) => traverse_public_mod(cx, item.id, m),
|
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>) {
|
fn traverse_ty(ty: @Ty, cx: ctx, v: visit::vt<ctx>) {
|
||||||
if cx.rmap.contains_key(ty.id) { return; }
|
if cx.rmap.contains_key_ref(&ty.id) { return; }
|
||||||
cx.rmap.insert(ty.id, ());
|
cx.rmap.insert(ty.id, ());
|
||||||
|
|
||||||
match ty.node {
|
match ty.node {
|
||||||
|
|
|
@ -316,7 +316,7 @@ pub fn emit_calls_to_trait_visit_ty(bcx: block,
|
||||||
-> block {
|
-> block {
|
||||||
use syntax::parse::token::special_idents::tydesc;
|
use syntax::parse::token::special_idents::tydesc;
|
||||||
let final = sub_block(bcx, ~"final");
|
let final = sub_block(bcx, ~"final");
|
||||||
assert bcx.ccx().tcx.intrinsic_defs.contains_key(tydesc);
|
assert bcx.ccx().tcx.intrinsic_defs.contains_key_ref(&tydesc);
|
||||||
let (_, tydesc_ty) = bcx.ccx().tcx.intrinsic_defs.get(tydesc);
|
let (_, tydesc_ty) = bcx.ccx().tcx.intrinsic_defs.get(tydesc);
|
||||||
let tydesc_ty = type_of::type_of(bcx.ccx(), tydesc_ty);
|
let tydesc_ty = type_of::type_of(bcx.ccx(), tydesc_ty);
|
||||||
let r = reflector({
|
let r = reflector({
|
||||||
|
|
|
@ -87,7 +87,7 @@ pub fn type_of(cx: @crate_ctxt, t: ty::t) -> TypeRef {
|
||||||
debug!("type_of %?: %?", t, ty::get(t));
|
debug!("type_of %?: %?", t, ty::get(t));
|
||||||
|
|
||||||
// Check the cache.
|
// Check the cache.
|
||||||
if cx.lltypes.contains_key(t) { return cx.lltypes.get(t); }
|
if cx.lltypes.contains_key_ref(&t) { return cx.lltypes.get(t); }
|
||||||
|
|
||||||
// Replace any typedef'd types with their equivalent non-typedef
|
// Replace any typedef'd types with their equivalent non-typedef
|
||||||
// type. This ensures that all LLVM nominal types that contain
|
// type. This ensures that all LLVM nominal types that contain
|
||||||
|
|
|
@ -2817,7 +2817,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 {
|
fn node_id_has_type_params(cx: ctxt, id: ast::node_id) -> bool {
|
||||||
return cx.node_type_substs.contains_key(id);
|
return cx.node_type_substs.contains_key_ref(&id);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Type accessors for substructures of types
|
// Type accessors for substructures of types
|
||||||
|
@ -3114,7 +3114,7 @@ pub enum ExprKind {
|
||||||
pub fn expr_kind(tcx: ctxt,
|
pub fn expr_kind(tcx: ctxt,
|
||||||
method_map: typeck::method_map,
|
method_map: typeck::method_map,
|
||||||
expr: @ast::expr) -> ExprKind {
|
expr: @ast::expr) -> ExprKind {
|
||||||
if method_map.contains_key(expr.id) {
|
if method_map.contains_key_ref(&expr.id) {
|
||||||
// Overloaded operations are generally calls, and hence they are
|
// Overloaded operations are generally calls, and hence they are
|
||||||
// generated via DPS. However, assign_op (e.g., `x += y`) is an
|
// generated via DPS. However, assign_op (e.g., `x += y`) is an
|
||||||
// exception, as its result is always unit.
|
// exception, as its result is always unit.
|
||||||
|
@ -4368,7 +4368,7 @@ pub fn iter_bound_traits_and_supertraits(tcx: ctxt,
|
||||||
let super_t = supertrait.tpt.ty;
|
let super_t = supertrait.tpt.ty;
|
||||||
let d_id = ty_to_def_id(super_t).expect("supertrait \
|
let d_id = ty_to_def_id(super_t).expect("supertrait \
|
||||||
should be a trait ty");
|
should be a trait ty");
|
||||||
if !supertrait_map.contains_key(d_id) {
|
if !supertrait_map.contains_key_ref(&d_id) {
|
||||||
supertrait_map.insert(d_id, super_t);
|
supertrait_map.insert(d_id, super_t);
|
||||||
trait_ty = super_t;
|
trait_ty = super_t;
|
||||||
seen_def_ids.push(d_id);
|
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.
|
// Report an error if not all the fields were specified.
|
||||||
if !etc {
|
if !etc {
|
||||||
for class_fields.eachi |i, field| {
|
for class_fields.eachi |i, field| {
|
||||||
if found_fields.contains_key(i) {
|
if found_fields.contains_key_ref(&i) {
|
||||||
loop;
|
loop;
|
||||||
}
|
}
|
||||||
tcx.sess.span_err(span,
|
tcx.sess.span_err(span,
|
||||||
|
|
|
@ -1171,11 +1171,12 @@ pub impl LookupContext {
|
||||||
match candidate.origin {
|
match candidate.origin {
|
||||||
method_static(method_id) | method_self(method_id, _)
|
method_static(method_id) | method_self(method_id, _)
|
||||||
| method_super(method_id, _) => {
|
| method_super(method_id, _) => {
|
||||||
bad = self.tcx().destructors.contains_key(method_id);
|
bad = self.tcx().destructors.contains_key_ref(&method_id);
|
||||||
}
|
}
|
||||||
method_param(method_param { trait_id: trait_id, _ }) |
|
method_param(method_param { trait_id: trait_id, _ }) |
|
||||||
method_trait(trait_id, _, _) => {
|
method_trait(trait_id, _, _) => {
|
||||||
bad = self.tcx().destructor_for_type.contains_key(trait_id);
|
bad = self.tcx().destructor_for_type.contains_key_ref(
|
||||||
|
&trait_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3078,8 +3078,8 @@ pub fn check_intrinsic_type(ccx: @crate_ctxt, it: @ast::foreign_item) {
|
||||||
~"visit_tydesc" => {
|
~"visit_tydesc" => {
|
||||||
let tydesc_name = special_idents::tydesc;
|
let tydesc_name = special_idents::tydesc;
|
||||||
let ty_visitor_name = tcx.sess.ident_of(~"TyVisitor");
|
let ty_visitor_name = tcx.sess.ident_of(~"TyVisitor");
|
||||||
assert tcx.intrinsic_defs.contains_key(tydesc_name);
|
assert tcx.intrinsic_defs.contains_key_ref(&tydesc_name);
|
||||||
assert ccx.tcx.intrinsic_defs.contains_key(ty_visitor_name);
|
assert ccx.tcx.intrinsic_defs.contains_key_ref(&ty_visitor_name);
|
||||||
let (_, tydesc_ty) = tcx.intrinsic_defs.get(tydesc_name);
|
let (_, tydesc_ty) = tcx.intrinsic_defs.get(tydesc_name);
|
||||||
let (_, visitor_trait) = tcx.intrinsic_defs.get(ty_visitor_name);
|
let (_, visitor_trait) = tcx.intrinsic_defs.get(ty_visitor_name);
|
||||||
let td_ptr = ty::mk_ptr(ccx.tcx, ty::mt {ty: tydesc_ty,
|
let td_ptr = ty::mk_ptr(ccx.tcx, ty::mt {ty: tydesc_ty,
|
||||||
|
|
|
@ -211,7 +211,7 @@ pub fn visit_expr(expr: @ast::expr, &&rcx: @rcx, v: rvt) {
|
||||||
// `constrain_auto_ref()` on all exprs. But that causes a
|
// `constrain_auto_ref()` on all exprs. But that causes a
|
||||||
// lot of spurious errors because of how the region
|
// lot of spurious errors because of how the region
|
||||||
// hierarchy is setup.
|
// hierarchy is setup.
|
||||||
if rcx.fcx.ccx.method_map.contains_key(callee.id) {
|
if rcx.fcx.ccx.method_map.contains_key_ref(&callee.id) {
|
||||||
match callee.node {
|
match callee.node {
|
||||||
ast::expr_field(base, _, _) => {
|
ast::expr_field(base, _, _) => {
|
||||||
constrain_auto_ref(rcx, base);
|
constrain_auto_ref(rcx, base);
|
||||||
|
@ -750,7 +750,7 @@ pub mod guarantor {
|
||||||
let _i = ::util::common::indenter();
|
let _i = ::util::common::indenter();
|
||||||
|
|
||||||
let guarantor = {
|
let guarantor = {
|
||||||
if rcx.fcx.ccx.method_map.contains_key(expr.id) {
|
if rcx.fcx.ccx.method_map.contains_key_ref(&expr.id) {
|
||||||
None
|
None
|
||||||
} else {
|
} else {
|
||||||
guarantor(rcx, expr)
|
guarantor(rcx, expr)
|
||||||
|
|
|
@ -268,7 +268,7 @@ pub fn lookup_vtable(vcx: &VtableContext,
|
||||||
// im is one specific impl of trait_ty.
|
// im is one specific impl of trait_ty.
|
||||||
|
|
||||||
// First, ensure we haven't processed this impl yet.
|
// First, ensure we haven't processed this impl yet.
|
||||||
if impls_seen.contains_key(im.did) {
|
if impls_seen.contains_key_ref(&im.did) {
|
||||||
loop;
|
loop;
|
||||||
}
|
}
|
||||||
impls_seen.insert(im.did, ());
|
impls_seen.insert(im.did, ());
|
||||||
|
|
|
@ -141,7 +141,7 @@ fn maybe_resolve_type_vars_for_node(wbcx: wb_ctxt, sp: span,
|
||||||
id: ast::node_id)
|
id: ast::node_id)
|
||||||
-> Option<ty::t>
|
-> Option<ty::t>
|
||||||
{
|
{
|
||||||
if wbcx.fcx.inh.node_types.contains_key(id) {
|
if wbcx.fcx.inh.node_types.contains_key_ref(&id) {
|
||||||
resolve_type_vars_for_node(wbcx, sp, id)
|
resolve_type_vars_for_node(wbcx, sp, id)
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
|
|
|
@ -502,7 +502,7 @@ pub impl CoherenceChecker {
|
||||||
}
|
}
|
||||||
|
|
||||||
for ty::trait_methods(tcx, trait_did).each |method| {
|
for ty::trait_methods(tcx, trait_did).each |method| {
|
||||||
if provided_method_idents.contains_key(method.ident) {
|
if provided_method_idents.contains_key_ref(&method.ident) {
|
||||||
if !f(method) {
|
if !f(method) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -912,7 +912,7 @@ pub impl CoherenceChecker {
|
||||||
let tcx = self.crate_context.tcx;
|
let tcx = self.crate_context.tcx;
|
||||||
let pmm = tcx.provided_methods;
|
let pmm = tcx.provided_methods;
|
||||||
|
|
||||||
if pmm.contains_key(trait_def_id) { return; }
|
if pmm.contains_key_ref(&trait_def_id) { return; }
|
||||||
|
|
||||||
debug!("(adding default methods for trait) processing trait");
|
debug!("(adding default methods for trait) processing trait");
|
||||||
|
|
||||||
|
|
|
@ -326,7 +326,7 @@ pub fn ensure_supertraits(ccx: @crate_ctxt,
|
||||||
rp: Option<ty::region_variance>,
|
rp: Option<ty::region_variance>,
|
||||||
trait_refs: &[@ast::trait_ref]) {
|
trait_refs: &[@ast::trait_ref]) {
|
||||||
let tcx = ccx.tcx;
|
let tcx = ccx.tcx;
|
||||||
if tcx.supertraits.contains_key(local_def(id)) { return; }
|
if tcx.supertraits.contains_key_ref(&local_def(id)) { return; }
|
||||||
|
|
||||||
let instantiated = dvec::DVec();
|
let instantiated = dvec::DVec();
|
||||||
for trait_refs.each |trait_ref| {
|
for trait_refs.each |trait_ref| {
|
||||||
|
|
|
@ -164,10 +164,6 @@ pub mod chained {
|
||||||
impl<K:Eq IterBytes Hash Copy, V: Copy> T<K, V> {
|
impl<K:Eq IterBytes Hash Copy, V: Copy> T<K, V> {
|
||||||
pure fn size() -> uint { self.count }
|
pure fn size() -> uint { self.count }
|
||||||
|
|
||||||
pure fn contains_key(k: K) -> bool {
|
|
||||||
self.contains_key_ref(&k)
|
|
||||||
}
|
|
||||||
|
|
||||||
pure fn contains_key_ref(k: &K) -> bool {
|
pure fn contains_key_ref(k: &K) -> bool {
|
||||||
let hash = k.hash_keyed(0,0) as uint;
|
let hash = k.hash_keyed(0,0) as uint;
|
||||||
match self.search_tbl(k, hash) {
|
match self.search_tbl(k, hash) {
|
||||||
|
@ -638,9 +634,9 @@ mod tests {
|
||||||
fn test_contains_key() {
|
fn test_contains_key() {
|
||||||
let key = ~"k";
|
let key = ~"k";
|
||||||
let map = HashMap::<~str, ~str>();
|
let map = HashMap::<~str, ~str>();
|
||||||
assert (!map.contains_key(key));
|
assert (!map.contains_key_ref(&key));
|
||||||
map.insert(key, ~"val");
|
map.insert(key, ~"val");
|
||||||
assert (map.contains_key(key));
|
assert (map.contains_key_ref(&key));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -658,10 +654,10 @@ mod tests {
|
||||||
let map = HashMap::<~str, ~str>();
|
let map = HashMap::<~str, ~str>();
|
||||||
map.insert(key, ~"val");
|
map.insert(key, ~"val");
|
||||||
assert (map.size() == 1);
|
assert (map.size() == 1);
|
||||||
assert (map.contains_key(key));
|
assert (map.contains_key_ref(&key));
|
||||||
map.clear();
|
map.clear();
|
||||||
assert (map.size() == 0);
|
assert (map.size() == 0);
|
||||||
assert (!map.contains_key(key));
|
assert (!map.contains_key_ref(&key));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
@ -363,7 +363,7 @@ pub fn require_unique_names(diagnostic: span_handler,
|
||||||
let name = get_meta_item_name(*meta);
|
let name = get_meta_item_name(*meta);
|
||||||
|
|
||||||
// FIXME: How do I silence the warnings? --pcw (#2619)
|
// FIXME: How do I silence the warnings? --pcw (#2619)
|
||||||
if map.contains_key(name) {
|
if map.contains_key_ref(&name) {
|
||||||
diagnostic.span_fatal(meta.span,
|
diagnostic.span_fatal(meta.span,
|
||||||
fmt!("duplicate meta item `%s`", name));
|
fmt!("duplicate meta item `%s`", name));
|
||||||
}
|
}
|
||||||
|
|
|
@ -197,7 +197,7 @@ pub fn nameize(p_s: parse_sess, ms: ~[matcher], res: ~[@named_match])
|
||||||
codemap::spanned {
|
codemap::spanned {
|
||||||
node: match_nonterminal(bind_name, _, idx), span: sp
|
node: match_nonterminal(bind_name, _, idx), span: sp
|
||||||
} => {
|
} => {
|
||||||
if ret_val.contains_key(bind_name) {
|
if ret_val.contains_key_ref(&bind_name) {
|
||||||
p_s.span_diagnostic.span_fatal(sp, ~"Duplicated bind name: "+
|
p_s.span_diagnostic.span_fatal(sp, ~"Duplicated bind name: "+
|
||||||
*p_s.interner.get(bind_name))
|
*p_s.interner.get(bind_name))
|
||||||
}
|
}
|
||||||
|
|
|
@ -137,7 +137,7 @@ pub impl Parser {
|
||||||
desc: &str) {
|
desc: &str) {
|
||||||
self.span_err(sp, fmt!("obsolete syntax: %s", kind_str));
|
self.span_err(sp, fmt!("obsolete syntax: %s", kind_str));
|
||||||
|
|
||||||
if !self.obsolete_set.contains_key(kind) {
|
if !self.obsolete_set.contains_key_ref(&kind) {
|
||||||
self.sess.span_diagnostic.handler().note(fmt!("%s", desc));
|
self.sess.span_diagnostic.handler().note(fmt!("%s", desc));
|
||||||
self.obsolete_set.insert(kind, ());
|
self.obsolete_set.insert(kind, ());
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,7 +134,7 @@ fn writer(path: ~str, pport: pipes::Port<Line>, size: uint)
|
||||||
done += 1_u;
|
done += 1_u;
|
||||||
let mut prev = done;
|
let mut prev = done;
|
||||||
while prev <= i {
|
while prev <= i {
|
||||||
if lines.contains_key(prev) {
|
if lines.contains_key_ref(&prev) {
|
||||||
debug!("WS %u", prev);
|
debug!("WS %u", prev);
|
||||||
cout.write(lines.get(prev));
|
cout.write(lines.get(prev));
|
||||||
done += 1_u;
|
done += 1_u;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue