]> git.lizzy.rs Git - rust.git/commitdiff
Fallout from collection conventions
authorAlexis Beingessner <a.beingessner@gmail.com>
Thu, 6 Nov 2014 17:25:16 +0000 (12:25 -0500)
committerAlexis Beingessner <a.beingessner@gmail.com>
Thu, 6 Nov 2014 17:26:08 +0000 (12:26 -0500)
101 files changed:
src/libgreen/lib.rs
src/libgreen/sched.rs
src/librustc/back/link.rs
src/librustc/driver/session.rs
src/librustc/lint/builtin.rs
src/librustc/lint/context.rs
src/librustc/metadata/cstore.rs
src/librustc/metadata/decoder.rs
src/librustc/metadata/encoder.rs
src/librustc/metadata/tydecode.rs
src/librustc/metadata/tyencode.rs
src/librustc/middle/astencode.rs
src/librustc/middle/borrowck/move_data.rs
src/librustc/middle/cfg/construct.rs
src/librustc/middle/check_const.rs
src/librustc/middle/check_match.rs
src/librustc/middle/check_static_recursion.rs
src/librustc/middle/const_eval.rs
src/librustc/middle/dataflow.rs
src/librustc/middle/dead.rs
src/librustc/middle/dependency_format.rs
src/librustc/middle/expr_use_visitor.rs
src/librustc/middle/lang_items.rs
src/librustc/middle/liveness.rs
src/librustc/middle/mem_categorization.rs
src/librustc/middle/pat_util.rs
src/librustc/middle/privacy.rs
src/librustc/middle/reachable.rs
src/librustc/middle/region.rs
src/librustc/middle/resolve.rs
src/librustc/middle/traits/select.rs
src/librustc/middle/trans/_match.rs
src/librustc/middle/trans/adt.rs
src/librustc/middle/trans/base.rs
src/librustc/middle/trans/builder.rs
src/librustc/middle/trans/closure.rs
src/librustc/middle/trans/common.rs
src/librustc/middle/trans/consts.rs
src/librustc/middle/trans/controlflow.rs
src/librustc/middle/trans/debuginfo.rs
src/librustc/middle/trans/expr.rs
src/librustc/middle/trans/glue.rs
src/librustc/middle/trans/inline.rs
src/librustc/middle/trans/meth.rs
src/librustc/middle/trans/monomorphize.rs
src/librustc/middle/trans/type_.rs
src/librustc/middle/trans/type_of.rs
src/librustc/middle/ty.rs
src/librustc/middle/typeck/astconv.rs
src/librustc/middle/typeck/check/_match.rs
src/librustc/middle/typeck/check/method.rs
src/librustc/middle/typeck/check/mod.rs
src/librustc/middle/typeck/check/regionck.rs
src/librustc/middle/typeck/check/writeback.rs
src/librustc/middle/typeck/coherence/mod.rs
src/librustc/middle/typeck/coherence/overlap.rs
src/librustc/middle/typeck/collect.rs
src/librustc/middle/typeck/infer/error_reporting.rs
src/librustc/middle/typeck/infer/region_inference/mod.rs
src/librustc/middle/typeck/infer/sub.rs
src/librustc/middle/typeck/mod.rs
src/librustc/middle/typeck/variance.rs
src/librustc/util/common.rs
src/librustc/util/ppaux.rs
src/librustdoc/clean/inline.rs
src/librustdoc/clean/mod.rs
src/librustdoc/html/format.rs
src/librustdoc/html/markdown.rs
src/librustdoc/html/render.rs
src/librustdoc/lib.rs
src/librustrt/local_data.rs
src/libserialize/collection_impls.rs
src/libserialize/json.rs
src/libstd/io/mod.rs
src/libstd/io/process.rs
src/libsyntax/diagnostics/plugin.rs
src/libsyntax/ext/base.rs
src/libsyntax/ext/format.rs
src/libsyntax/ext/mtwt.rs
src/libsyntax/util/interner.rs
src/libtest/lib.rs
src/test/bench/core-map.rs
src/test/bench/shootout-chameneos-redux.rs
src/test/bench/shootout-fasta-redux.rs
src/test/bench/shootout-k-nucleotide.rs
src/test/bench/shootout-meteor.rs
src/test/bench/shootout-regex-dna.rs
src/test/bench/shootout-reverse-complement.rs
src/test/bench/sudoku.rs
src/test/compile-fail/borrowck-assign-comp-idx.rs
src/test/compile-fail/borrowck-for-loop-head-linkage.rs
src/test/compile-fail/borrowck-loan-vec-content.rs
src/test/run-pass/foreach-nested.rs
src/test/run-pass/hashmap-memory.rs
src/test/run-pass/issue-3563-3.rs
src/test/run-pass/issue-3991.rs
src/test/run-pass/overloaded-deref.rs
src/test/run-pass/send_str_hashmap.rs
src/test/run-pass/send_str_treemap.rs
src/test/run-pass/swap-2.rs
src/test/run-pass/unique-in-vec-copy.rs

index fcebfeac292987f4c12c24d3766a817daf0da1fa..ed394fc0de5f9adf6fbfa4811e2157ee5d2fac45 100644 (file)
@@ -417,7 +417,7 @@ pub fn spawn(&mut self, opts: TaskOpts, f: proc():Send) {
         }
 
         // Jettison the task away!
-        self.handles.get_mut(idx).send(TaskFromFriend(task));
+        self.handles[idx].send(TaskFromFriend(task));
     }
 
     /// Spawns a new scheduler into this M:N pool. A handle is returned to the
index b1c2695ac7d276826e88774487925455a33becbb..50b10873faf48c95e454f7b3911e0e0c076dfed7 100644 (file)
@@ -502,7 +502,7 @@ fn try_steals(&mut self) -> Option<Box<GreenTask>> {
         let len = work_queues.len();
         let start_index = self.rng.gen_range(0, len);
         for index in range(0, len).map(|i| (i + start_index) % len) {
-            match work_queues.get_mut(index).steal() {
+            match work_queues[index].steal() {
                 deque::Data(task) => {
                     rtdebug!("found task by stealing");
                     return Some(task)
index 81f856c29d5d3446803381135e08b7cda390bd93..7488cb59830a001889b299a13deb57466d9bcb55 100644 (file)
@@ -220,7 +220,7 @@ fn symbol_hash(tcx: &ty::ctxt,
 }
 
 fn get_symbol_hash(ccx: &CrateContext, t: ty::t) -> String {
-    match ccx.type_hashcodes().borrow().find(&t) {
+    match ccx.type_hashcodes().borrow().get(&t) {
         Some(h) => return h.to_string(),
         None => {}
     }
index 57c65ccebc5b2d4b622c91c98070c2f4b47fc58b..35ccbb4c7b4103e22eeac6073e4d9c430c774124 100644 (file)
@@ -127,7 +127,7 @@ pub fn add_lint(&self,
                     msg: String) {
         let lint_id = lint::LintId::of(lint);
         let mut lints = self.lints.borrow_mut();
-        match lints.find_mut(&id) {
+        match lints.get_mut(&id) {
             Some(arr) => { arr.push((lint_id, sp, msg)); return; }
             None => {}
         }
index b60b2ba984e165969e4f0fb9fc2155d88c3021c1..d42a9c69dc1251c9f95658505dca01d37b3c9cc7 100644 (file)
@@ -403,7 +403,7 @@ fn check_def(&mut self, sp: Span, ty_id: ast::NodeId, path_id: ast::NodeId) {
                                    libc::c_uint or libc::c_ulong should be used");
             }
             def::DefTy(..) => {
-                let tty = match self.cx.tcx.ast_ty_to_ty_cache.borrow().find(&ty_id) {
+                let tty = match self.cx.tcx.ast_ty_to_ty_cache.borrow().get(&ty_id) {
                     Some(&ty::atttce_resolved(t)) => t,
                     _ => panic!("ast_ty_to_ty_cache was incomplete after typeck!")
                 };
@@ -994,7 +994,7 @@ fn check_lifetime_decl(&mut self, cx: &Context, t: &ast::LifetimeDef) {
     fn check_pat(&mut self, cx: &Context, p: &ast::Pat) {
         match &p.node {
             &ast::PatIdent(_, ref path1, _) => {
-                match cx.tcx.def_map.borrow().find(&p.id) {
+                match cx.tcx.def_map.borrow().get(&p.id) {
                     Some(&def::DefLocal(_)) => {
                         self.check_snake_case(cx, "variable", path1.node, p.span);
                     }
@@ -1051,7 +1051,7 @@ fn check_item(&mut self, cx: &Context, it: &ast::Item) {
 
     fn check_pat(&mut self, cx: &Context, p: &ast::Pat) {
         // Lint for constants that look like binding identifiers (#7526)
-        match (&p.node, cx.tcx.def_map.borrow().find(&p.id)) {
+        match (&p.node, cx.tcx.def_map.borrow().get(&p.id)) {
             (&ast::PatIdent(_, ref path1, _), Some(&def::DefConst(..))) => {
                 let s = token::get_ident(path1.node);
                 if s.get().chars().any(|c| c.is_lowercase()) {
@@ -1211,7 +1211,7 @@ fn check_pat(&mut self, cx: &Context, pat: &ast::Pat) {
             ast::PatStruct(_, ref v, _) => {
                 for fieldpat in v.iter()
                                  .filter(|fieldpat| !fieldpat.node.is_shorthand)
-                                 .filter(|fieldpat| def_map.find(&fieldpat.node.pat.id)
+                                 .filter(|fieldpat| def_map.get(&fieldpat.node.pat.id)
                                     == Some(&def::DefLocal(fieldpat.node.pat.id))) {
                     match fieldpat.node.pat.node {
                         ast::PatIdent(_, ident, None) if ident.node.as_str()
@@ -1368,7 +1368,7 @@ fn check_expr(&mut self, cx: &Context, e: &ast::Expr) {
             _ => return
         }
 
-        match cx.tcx.adjustments.borrow().find(&e.id) {
+        match cx.tcx.adjustments.borrow().get(&e.id) {
             Some(adjustment) => {
                 match *adjustment {
                     ty::AdjustDerefRef(ty::AutoDerefRef { ref autoref, .. }) => {
@@ -1637,7 +1637,7 @@ fn check_expr(&mut self, cx: &Context, e: &ast::Expr) {
 
         let id = match e.node {
             ast::ExprPath(..) | ast::ExprStruct(..) => {
-                match cx.tcx.def_map.borrow().find(&e.id) {
+                match cx.tcx.def_map.borrow().get(&e.id) {
                     Some(&def) => def.def_id(),
                     None => return
                 }
@@ -1645,7 +1645,7 @@ fn check_expr(&mut self, cx: &Context, e: &ast::Expr) {
             ast::ExprMethodCall(i, _, _) => {
                 span = i.span;
                 let method_call = typeck::MethodCall::expr(e.id);
-                match cx.tcx.method_map.borrow().find(&method_call) {
+                match cx.tcx.method_map.borrow().get(&method_call) {
                     Some(method) => {
                         match method.origin {
                             typeck::MethodStatic(def_id) => {
index 6da74eee8a3195383e65b430a9e49519556ab3ff..76187f192c2b9676dc25b08a7479f738ea7f03ca 100644 (file)
@@ -84,7 +84,7 @@ enum TargetLint {
 
 impl LintStore {
     fn get_level_source(&self, lint: LintId) -> LevelSource {
-        match self.levels.find(&lint) {
+        match self.levels.get(&lint) {
             Some(&s) => s,
             None => (Allow, Default),
         }
@@ -124,7 +124,7 @@ pub fn register_pass(&mut self, sess: Option<&Session>,
             self.lints.push((*lint, from_plugin));
 
             let id = LintId::of(*lint);
-            if !self.by_name.insert(lint.name_lower(), Id(id)) {
+            if self.by_name.insert(lint.name_lower(), Id(id)).is_some() {
                 let msg = format!("duplicate specification of lint {}", lint.name_lower());
                 match (sess, from_plugin) {
                     // We load builtin lints first, so a duplicate is a compiler bug.
@@ -147,7 +147,7 @@ pub fn register_pass(&mut self, sess: Option<&Session>,
     pub fn register_group(&mut self, sess: Option<&Session>,
                           from_plugin: bool, name: &'static str,
                           to: Vec<LintId>) {
-        let new = self.lint_groups.insert(name, (to, from_plugin));
+        let new = self.lint_groups.insert(name, (to, from_plugin)).is_none();
 
         if !new {
             let msg = format!("duplicate specification of lint group {}", name);
@@ -437,11 +437,11 @@ pub fn sess(&'a self) -> &'a Session {
     /// Get the level of `lint` at the current position of the lint
     /// traversal.
     pub fn current_level(&self, lint: &'static Lint) -> Level {
-        self.lints.levels.find(&LintId::of(lint)).map_or(Allow, |&(lvl, _)| lvl)
+        self.lints.levels.get(&LintId::of(lint)).map_or(Allow, |&(lvl, _)| lvl)
     }
 
     fn lookup_and_emit(&self, lint: &'static Lint, span: Option<Span>, msg: &str) {
-        let (level, src) = match self.lints.levels.find(&LintId::of(lint)) {
+        let (level, src) = match self.lints.levels.get(&LintId::of(lint)) {
             None => return,
             Some(&(Warn, src)) => {
                 let lint_id = LintId::of(builtin::WARNINGS);
@@ -750,7 +750,7 @@ fn visit_attribute(&mut self, attr: &ast::Attribute) {
 // Output any lints that were previously added to the session.
 impl<'a, 'tcx> IdVisitingOperation for Context<'a, 'tcx> {
     fn visit_id(&mut self, id: ast::NodeId) {
-        match self.tcx.sess.lints.borrow_mut().pop(&id) {
+        match self.tcx.sess.lints.borrow_mut().remove(&id) {
             None => {}
             Some(lints) => {
                 for (lint_id, span, msg) in lints.into_iter() {
index e8c5f6f4910e063c5e8f2ce45ec19f2ff23d4214..36456b3c4a9a00d7de166d893fe5fab2dee4faa3 100644 (file)
@@ -213,7 +213,7 @@ pub fn add_extern_mod_stmt_cnum(&self,
 
     pub fn find_extern_mod_stmt_cnum(&self, emod_id: ast::NodeId)
                                      -> Option<ast::CrateNum> {
-        self.extern_mod_crate_map.borrow().find(&emod_id).map(|x| *x)
+        self.extern_mod_crate_map.borrow().get(&emod_id).map(|x| *x)
     }
 }
 
index 92f3b888dcd523576ce3d755ec9f601314c943e5..2fd6e2b47870ef0c9b4e765f287bee9108c76364 100644 (file)
@@ -1209,7 +1209,7 @@ pub fn translate_def_id(cdata: Cmd, did: ast::DefId) -> ast::DefId {
         return ast::DefId { krate: cdata.cnum, node: did.node };
     }
 
-    match cdata.cnum_map.find(&did.krate) {
+    match cdata.cnum_map.get(&did.krate) {
         Some(&n) => {
             ast::DefId {
                 krate: n,
@@ -1321,7 +1321,7 @@ pub fn get_dylib_dependency_formats(cdata: Cmd)
         let cnum = spec.split(':').nth(0).unwrap();
         let link = spec.split(':').nth(1).unwrap();
         let cnum = from_str(cnum).unwrap();
-        let cnum = match cdata.cnum_map.find(&cnum) {
+        let cnum = match cdata.cnum_map.get(&cnum) {
             Some(&n) => n,
             None => panic!("didn't find a crate in the cnum_map")
         };
index da7e78d272fd85694404b9b2014e0fa26f1427fe..66b647fabdc8a46a5598793a8ad9647ed1fc4a5c 100644 (file)
@@ -253,7 +253,7 @@ fn encode_symbol(ecx: &EncodeContext,
                  rbml_w: &mut Encoder,
                  id: NodeId) {
     rbml_w.start_tag(tag_items_data_item_symbol);
-    match ecx.item_symbols.borrow().find(&id) {
+    match ecx.item_symbols.borrow().get(&id) {
         Some(x) => {
             debug!("encode_symbol(id={}, str={})", id, *x);
             rbml_w.writer.write(x.as_bytes());
@@ -397,7 +397,7 @@ fn encode_reexported_static_base_methods(ecx: &EncodeContext,
                                          exp: &middle::resolve::Export2)
                                          -> bool {
     let impl_items = ecx.tcx.impl_items.borrow();
-    match ecx.tcx.inherent_impls.borrow().find(&exp.def_id) {
+    match ecx.tcx.inherent_impls.borrow().get(&exp.def_id) {
         Some(implementations) => {
             for base_impl_did in implementations.iter() {
                 for &method_did in (*impl_items)[*base_impl_did].iter() {
@@ -426,7 +426,7 @@ fn encode_reexported_static_trait_methods(ecx: &EncodeContext,
                                           rbml_w: &mut Encoder,
                                           exp: &middle::resolve::Export2)
                                           -> bool {
-    match ecx.tcx.trait_items_cache.borrow().find(&exp.def_id) {
+    match ecx.tcx.trait_items_cache.borrow().get(&exp.def_id) {
         Some(trait_items) => {
             for trait_item in trait_items.iter() {
                 match *trait_item {
@@ -531,7 +531,7 @@ fn encode_reexports(ecx: &EncodeContext,
                     id: NodeId,
                     path: PathElems) {
     debug!("(encoding info for module) encoding reexports for {}", id);
-    match ecx.reexports2.find(&id) {
+    match ecx.reexports2.get(&id) {
         Some(ref exports) => {
             debug!("(encoding info for module) found reexports for {}", id);
             for exp in exports.iter() {
@@ -978,7 +978,7 @@ fn should_inline(attrs: &[Attribute]) -> bool {
 fn encode_inherent_implementations(ecx: &EncodeContext,
                                    rbml_w: &mut Encoder,
                                    def_id: DefId) {
-    match ecx.tcx.inherent_impls.borrow().find(&def_id) {
+    match ecx.tcx.inherent_impls.borrow().get(&def_id) {
         None => {}
         Some(implementations) => {
             for &impl_def_id in implementations.iter() {
@@ -994,7 +994,7 @@ fn encode_inherent_implementations(ecx: &EncodeContext,
 fn encode_extension_implementations(ecx: &EncodeContext,
                                     rbml_w: &mut Encoder,
                                     trait_def_id: DefId) {
-    match ecx.tcx.trait_impls.borrow().find(&trait_def_id) {
+    match ecx.tcx.trait_impls.borrow().get(&trait_def_id) {
         None => {}
         Some(implementations) => {
             for &impl_def_id in implementations.borrow().iter() {
@@ -1987,7 +1987,7 @@ fn encode_crate_triple(rbml_w: &mut Encoder, triple: &str) {
 
 fn encode_dylib_dependency_formats(rbml_w: &mut Encoder, ecx: &EncodeContext) {
     rbml_w.start_tag(tag_dylib_dependency_formats);
-    match ecx.tcx.dependency_formats.borrow().find(&config::CrateTypeDylib) {
+    match ecx.tcx.dependency_formats.borrow().get(&config::CrateTypeDylib) {
         Some(arr) => {
             let s = arr.iter().enumerate().filter_map(|(i, slot)| {
                 slot.map(|kind| (format!("{}:{}", i + 1, match kind {
index b9660dbd46629c0871c7b7509643c258fe1c807b..227a6f71bfda9a9202f7b3955613e60c2ea3b522 100644 (file)
@@ -675,16 +675,16 @@ fn parse_builtin_bounds(st: &mut PState, _conv: conv_did) -> ty::BuiltinBounds {
     loop {
         match next(st) {
             'S' => {
-                builtin_bounds.add(ty::BoundSend);
+                builtin_bounds.insert(ty::BoundSend);
             }
             'Z' => {
-                builtin_bounds.add(ty::BoundSized);
+                builtin_bounds.insert(ty::BoundSized);
             }
             'P' => {
-                builtin_bounds.add(ty::BoundCopy);
+                builtin_bounds.insert(ty::BoundCopy);
             }
             'T' => {
-                builtin_bounds.add(ty::BoundSync);
+                builtin_bounds.insert(ty::BoundSync);
             }
             '.' => {
                 return builtin_bounds;
index 5fb1fec53400cfe2b47f3deae2e51dc92740f62e..027b9980a32b9e4d94a723c57de347a9f9276173 100644 (file)
@@ -50,7 +50,7 @@ pub struct ty_abbrev {
 pub type abbrev_map = RefCell<HashMap<ty::t, ty_abbrev>>;
 
 pub fn enc_ty(w: &mut SeekableMemWriter, cx: &ctxt, t: ty::t) {
-    match cx.abbrevs.borrow_mut().find(&t) {
+    match cx.abbrevs.borrow_mut().get(&t) {
         Some(a) => { w.write(a.s.as_bytes()); return; }
         None => {}
     }
index 5410417ec3f5c48aeaeaf27d2fc0816261897a2f..9268418ef94e9e0e738032267516416c04e3d689 100644 (file)
@@ -1151,14 +1151,14 @@ fn encode_side_tables_for_id(ecx: &e::EncodeContext,
 
     debug!("Encoding side tables for id {}", id);
 
-    for def in tcx.def_map.borrow().find(&id).iter() {
+    for def in tcx.def_map.borrow().get(&id).iter() {
         rbml_w.tag(c::tag_table_def, |rbml_w| {
             rbml_w.id(id);
             rbml_w.tag(c::tag_table_val, |rbml_w| (*def).encode(rbml_w).unwrap());
         })
     }
 
-    for &ty in tcx.node_types.borrow().find(&(id as uint)).iter() {
+    for &ty in tcx.node_types.borrow().get(&(id as uint)).iter() {
         rbml_w.tag(c::tag_table_node_type, |rbml_w| {
             rbml_w.id(id);
             rbml_w.tag(c::tag_table_val, |rbml_w| {
@@ -1167,7 +1167,7 @@ fn encode_side_tables_for_id(ecx: &e::EncodeContext,
         })
     }
 
-    for &item_substs in tcx.item_substs.borrow().find(&id).iter() {
+    for &item_substs in tcx.item_substs.borrow().get(&id).iter() {
         rbml_w.tag(c::tag_table_item_subst, |rbml_w| {
             rbml_w.id(id);
             rbml_w.tag(c::tag_table_val, |rbml_w| {
@@ -1176,7 +1176,7 @@ fn encode_side_tables_for_id(ecx: &e::EncodeContext,
         })
     }
 
-    for &fv in tcx.freevars.borrow().find(&id).iter() {
+    for &fv in tcx.freevars.borrow().get(&id).iter() {
         rbml_w.tag(c::tag_table_freevars, |rbml_w| {
             rbml_w.id(id);
             rbml_w.tag(c::tag_table_val, |rbml_w| {
@@ -1209,7 +1209,7 @@ fn encode_side_tables_for_id(ecx: &e::EncodeContext,
         }
     }
 
-    for &cm in tcx.capture_modes.borrow().find(&id).iter() {
+    for &cm in tcx.capture_modes.borrow().get(&id).iter() {
         rbml_w.tag(c::tag_table_capture_modes, |rbml_w| {
             rbml_w.id(id);
             rbml_w.tag(c::tag_table_val, |rbml_w| {
@@ -1219,7 +1219,7 @@ fn encode_side_tables_for_id(ecx: &e::EncodeContext,
     }
 
     let lid = ast::DefId { krate: ast::LOCAL_CRATE, node: id };
-    for &pty in tcx.tcache.borrow().find(&lid).iter() {
+    for &pty in tcx.tcache.borrow().get(&lid).iter() {
         rbml_w.tag(c::tag_table_tcache, |rbml_w| {
             rbml_w.id(id);
             rbml_w.tag(c::tag_table_val, |rbml_w| {
@@ -1228,7 +1228,7 @@ fn encode_side_tables_for_id(ecx: &e::EncodeContext,
         })
     }
 
-    for &type_param_def in tcx.ty_param_defs.borrow().find(&id).iter() {
+    for &type_param_def in tcx.ty_param_defs.borrow().get(&id).iter() {
         rbml_w.tag(c::tag_table_param_defs, |rbml_w| {
             rbml_w.id(id);
             rbml_w.tag(c::tag_table_val, |rbml_w| {
@@ -1238,7 +1238,7 @@ fn encode_side_tables_for_id(ecx: &e::EncodeContext,
     }
 
     let method_call = MethodCall::expr(id);
-    for &method in tcx.method_map.borrow().find(&method_call).iter() {
+    for &method in tcx.method_map.borrow().get(&method_call).iter() {
         rbml_w.tag(c::tag_table_method_map, |rbml_w| {
             rbml_w.id(id);
             rbml_w.tag(c::tag_table_val, |rbml_w| {
@@ -1247,7 +1247,7 @@ fn encode_side_tables_for_id(ecx: &e::EncodeContext,
         })
     }
 
-    for &trait_ref in tcx.object_cast_map.borrow().find(&id).iter() {
+    for &trait_ref in tcx.object_cast_map.borrow().get(&id).iter() {
         rbml_w.tag(c::tag_table_object_cast_map, |rbml_w| {
             rbml_w.id(id);
             rbml_w.tag(c::tag_table_val, |rbml_w| {
@@ -1256,11 +1256,11 @@ fn encode_side_tables_for_id(ecx: &e::EncodeContext,
         })
     }
 
-    for &adjustment in tcx.adjustments.borrow().find(&id).iter() {
+    for &adjustment in tcx.adjustments.borrow().get(&id).iter() {
         match *adjustment {
             _ if ty::adjust_is_object(adjustment) => {
                 let method_call = MethodCall::autoobject(id);
-                for &method in tcx.method_map.borrow().find(&method_call).iter() {
+                for &method in tcx.method_map.borrow().get(&method_call).iter() {
                     rbml_w.tag(c::tag_table_method_map, |rbml_w| {
                         rbml_w.id(id);
                         rbml_w.tag(c::tag_table_val, |rbml_w| {
@@ -1273,7 +1273,7 @@ fn encode_side_tables_for_id(ecx: &e::EncodeContext,
                 assert!(!ty::adjust_is_object(adjustment));
                 for autoderef in range(0, adj.autoderefs) {
                     let method_call = MethodCall::autoderef(id, autoderef);
-                    for &method in tcx.method_map.borrow().find(&method_call).iter() {
+                    for &method in tcx.method_map.borrow().get(&method_call).iter() {
                         rbml_w.tag(c::tag_table_method_map, |rbml_w| {
                             rbml_w.id(id);
                             rbml_w.tag(c::tag_table_val, |rbml_w| {
@@ -1299,7 +1299,7 @@ fn encode_side_tables_for_id(ecx: &e::EncodeContext,
 
     for unboxed_closure in tcx.unboxed_closures
                               .borrow()
-                              .find(&ast_util::local_def(id))
+                              .get(&ast_util::local_def(id))
                               .iter() {
         rbml_w.tag(c::tag_table_unboxed_closures, |rbml_w| {
             rbml_w.id(id);
index 98376726913c351fe982ad487430b703781a76a8..2a92db3e7d4ec9e14e20aebcdc6ae5f7078a8b3a 100644 (file)
@@ -242,7 +242,7 @@ pub fn move_path(&self,
          * base paths that do not yet have an index.
          */
 
-        match self.path_map.borrow().find(&lp) {
+        match self.path_map.borrow().get(&lp) {
             Some(&index) => {
                 return index;
             }
@@ -577,7 +577,7 @@ pub fn kind_of_move_of_path(&self,
         //! Returns the kind of a move of `loan_path` by `id`, if one exists.
 
         let mut ret = None;
-        for loan_path_index in self.move_data.path_map.borrow().find(&*loan_path).iter() {
+        for loan_path_index in self.move_data.path_map.borrow().get(&*loan_path).iter() {
             self.dfcx_moves.each_gen_bit(id, |move_index| {
                 let the_move = self.move_data.moves.borrow();
                 let the_move = (*the_move)[move_index];
index 146891825d6846a2b01dc2b7206efea5e4a9c9de..1e38250ceb38db8ecb3f87b046d7ab3d542c477f 100644 (file)
@@ -512,7 +512,7 @@ fn call<'a, I: Iterator<&'a ast::Expr>>(&mut self,
             func_or_rcvr: &ast::Expr,
             args: I) -> CFGIndex {
         let method_call = typeck::MethodCall::expr(call_expr.id);
-        let return_ty = ty::ty_fn_ret(match self.tcx.method_map.borrow().find(&method_call) {
+        let return_ty = ty::ty_fn_ret(match self.tcx.method_map.borrow().get(&method_call) {
             Some(method) => method.ty,
             None => ty::expr_ty(self.tcx, func_or_rcvr)
         });
@@ -610,7 +610,7 @@ fn find_scope(&self,
             }
 
             Some(_) => {
-                match self.tcx.def_map.borrow().find(&expr.id) {
+                match self.tcx.def_map.borrow().get(&expr.id) {
                     Some(&def::DefLabel(loop_id)) => {
                         for l in self.loop_scopes.iter() {
                             if l.loop_id == loop_id {
index 6cf1a93b40b7b85d52eeb276653c1d1ce019646a..b03fe0f3f6fb8e72f1d70cf6b11f339d625d9d3d 100644 (file)
@@ -143,7 +143,7 @@ fn check_expr(v: &mut CheckCrateVisitor, e: &Expr) -> bool {
                           "paths in constants may only refer to items without \
                            type parameters");
             }
-            match v.tcx.def_map.borrow().find(&e.id) {
+            match v.tcx.def_map.borrow().get(&e.id) {
                 Some(&DefStatic(..)) |
                 Some(&DefConst(..)) |
                 Some(&DefFn(..)) |
@@ -162,7 +162,7 @@ fn check_expr(v: &mut CheckCrateVisitor, e: &Expr) -> bool {
             }
         }
         ExprCall(ref callee, _) => {
-            match v.tcx.def_map.borrow().find(&callee.id) {
+            match v.tcx.def_map.borrow().get(&callee.id) {
                 Some(&DefStruct(..)) |
                 Some(&DefVariant(..)) => {}    // OK.
 
index fe38669ea6c29a89c5c19036def93c242238af88..4dcd5d8873ea467cb4dd25fdced4b26ba5aae6ec 100644 (file)
@@ -639,7 +639,7 @@ fn pat_constructors(cx: &MatchCheckCtxt, p: &Pat,
     let pat = raw_pat(p);
     match pat.node {
         PatIdent(..) =>
-            match cx.tcx.def_map.borrow().find(&pat.id) {
+            match cx.tcx.def_map.borrow().get(&pat.id) {
                 Some(&DefConst(..)) =>
                     cx.tcx.sess.span_bug(pat.span, "const pattern should've \
                                                     been rewritten"),
@@ -648,7 +648,7 @@ fn pat_constructors(cx: &MatchCheckCtxt, p: &Pat,
                 _ => vec!()
             },
         PatEnum(..) =>
-            match cx.tcx.def_map.borrow().find(&pat.id) {
+            match cx.tcx.def_map.borrow().get(&pat.id) {
                 Some(&DefConst(..)) =>
                     cx.tcx.sess.span_bug(pat.span, "const pattern should've \
                                                     been rewritten"),
@@ -656,7 +656,7 @@ fn pat_constructors(cx: &MatchCheckCtxt, p: &Pat,
                 _ => vec!(Single)
             },
         PatStruct(..) =>
-            match cx.tcx.def_map.borrow().find(&pat.id) {
+            match cx.tcx.def_map.borrow().get(&pat.id) {
                 Some(&DefConst(..)) =>
                     cx.tcx.sess.span_bug(pat.span, "const pattern should've \
                                                     been rewritten"),
index 1c83bf199192039cf68e8f0aabce35441d177f7f..a3738f031a9655329d33d2d8d663896bc5e34843 100644 (file)
@@ -95,7 +95,7 @@ fn visit_item(&mut self, it: &ast::Item) {
     fn visit_expr(&mut self, e: &ast::Expr) {
         match e.node {
             ast::ExprPath(..) => {
-                match self.def_map.borrow().find(&e.id) {
+                match self.def_map.borrow().get(&e.id) {
                     Some(&DefStatic(def_id, _)) |
                     Some(&DefConst(def_id)) if
                             ast_util::is_local(def_id) => {
index ce91bd1b1538889e7eefc883689136816f5a60a6..fdda5f1a860e6dce1248bec81427880393582d8a 100644 (file)
@@ -123,7 +123,7 @@ fn variant_expr<'a>(variants: &'a [P<ast::Variant>], id: ast::NodeId)
             Some(_) => None
         }
     } else {
-        match tcx.extern_const_variants.borrow().find(&variant_def) {
+        match tcx.extern_const_variants.borrow().get(&variant_def) {
             Some(&ast::DUMMY_NODE_ID) => return None,
             Some(&expr_id) => {
                 return Some(tcx.map.expect_expr(expr_id));
@@ -163,7 +163,7 @@ pub fn lookup_const_by_id<'a>(tcx: &'a ty::ctxt, def_id: ast::DefId)
             Some(_) => None
         }
     } else {
-        match tcx.extern_const_statics.borrow().find(&def_id) {
+        match tcx.extern_const_statics.borrow().get(&def_id) {
             Some(&ast::DUMMY_NODE_ID) => return None,
             Some(&expr_id) => {
                 return Some(tcx.map.expect_expr(expr_id));
@@ -192,7 +192,7 @@ struct ConstEvalVisitor<'a, 'tcx: 'a> {
 impl<'a, 'tcx> ConstEvalVisitor<'a, 'tcx> {
     fn classify(&mut self, e: &Expr) -> constness {
         let did = ast_util::local_def(e.id);
-        match self.ccache.find(&did) {
+        match self.ccache.get(&did) {
             Some(&x) => return x,
             None => {}
         }
index 612c9a00bbef40ee0a4efe6b8e1c5aaee5d84743..97dfa4ecd361a403f9146226c6531abe162a9217 100644 (file)
@@ -86,7 +86,7 @@ struct PropagationContext<'a, 'b: 'a, 'tcx: 'b, O: 'a> {
 }
 
 fn to_cfgidx_or_die(id: ast::NodeId, index: &NodeMap<CFGIndex>) -> CFGIndex {
-    let opt_cfgindex = index.find(&id).map(|&i|i);
+    let opt_cfgindex = index.get(&id).map(|&i|i);
     opt_cfgindex.unwrap_or_else(|| {
         panic!("nodeid_to_index does not have entry for NodeId {}", id);
     })
@@ -397,7 +397,7 @@ pub fn add_kills_from_flow_exits(&mut self, cfg: &cfg::CFG) {
 
             let mut changed = false;
             for &node_id in edge.data.exiting_scopes.iter() {
-                let opt_cfg_idx = self.nodeid_to_index.find(&node_id).map(|&i|i);
+                let opt_cfg_idx = self.nodeid_to_index.get(&node_id).map(|&i|i);
                 match opt_cfg_idx {
                     Some(cfg_idx) => {
                         let (start, end) = self.compute_id_range(cfg_idx);
index ec09706f97e80b66b4bd0f0db388951a24df91bc..2ae2f9bfe7a027fc5f0c0d0dc2cab87e6725b9ea 100644 (file)
@@ -74,7 +74,7 @@ fn check_def_id(&mut self, def_id: ast::DefId) {
     }
 
     fn lookup_and_handle_definition(&mut self, id: &ast::NodeId) {
-        self.tcx.def_map.borrow().find(id).map(|def| {
+        self.tcx.def_map.borrow().get(id).map(|def| {
             match def {
                 &def::DefConst(_) => {
                     self.check_def_id(def.def_id())
@@ -95,7 +95,7 @@ fn lookup_and_handle_definition(&mut self, id: &ast::NodeId) {
     fn lookup_and_handle_method(&mut self, id: ast::NodeId,
                                 span: codemap::Span) {
         let method_call = typeck::MethodCall::expr(id);
-        match self.tcx.method_map.borrow().find(&method_call) {
+        match self.tcx.method_map.borrow().get(&method_call) {
             Some(method) => {
                 match method.origin {
                     typeck::MethodStatic(def_id) => {
@@ -493,7 +493,7 @@ fn symbol_is_live(&mut self, id: ast::NodeId,
         // method of a private type is used, but the type itself is never
         // called directly.
         let impl_items = self.tcx.impl_items.borrow();
-        match self.tcx.inherent_impls.borrow().find(&local_def(id)) {
+        match self.tcx.inherent_impls.borrow().get(&local_def(id)) {
             None => (),
             Some(impl_list) => {
                 for impl_did in impl_list.iter() {
index 20be740620492984ef0be1cfc70c77629ae6c6f2..bfabcc958d7c113e9df9235fbd6516caabc3835b 100644 (file)
@@ -158,7 +158,7 @@ fn calculate_type(sess: &session::Session,
 
     // Collect what we've got so far in the return vector.
     let mut ret = range(1, sess.cstore.next_crate_num()).map(|i| {
-        match formats.find(&i).map(|v| *v) {
+        match formats.get(&i).map(|v| *v) {
             v @ Some(cstore::RequireDynamic) => v,
             _ => None,
         }
@@ -209,7 +209,7 @@ fn add_library(sess: &session::Session,
                cnum: ast::CrateNum,
                link: cstore::LinkagePreference,
                m: &mut HashMap<ast::CrateNum, cstore::LinkagePreference>) {
-    match m.find(&cnum) {
+    match m.get(&cnum) {
         Some(&link2) => {
             // If the linkages differ, then we'd have two copies of the library
             // if we continued linking. If the linkages are both static, then we
index e8a85b89b58474d5d1373dd65cd761b858cd1f30..d12b612b03361e331345e3ff104d91ca19e0101b 100644 (file)
@@ -162,7 +162,7 @@ fn from_unboxed_closure(tcx: &ty::ctxt, closure_did: ast::DefId)
         let trait_did =
             tcx.unboxed_closures
                .borrow()
-               .find(&closure_did)
+               .get(&closure_did)
                .expect("OverloadedCallType::from_unboxed_closure: didn't \
                         find closure id")
                .kind
@@ -535,7 +535,7 @@ fn walk_callee(&mut self, call: &ast::Expr, callee: &ast::Expr) {
                     match self.tcx()
                               .method_map
                               .borrow()
-                              .find(&MethodCall::expr(call.id)) {
+                              .get(&MethodCall::expr(call.id)) {
                     Some(ref method_callee) => {
                         OverloadedCallType::from_method_origin(
                             self.tcx(),
@@ -686,7 +686,7 @@ fn contains_field_named(field: &ty::field,
     // process.
     fn walk_adjustment(&mut self, expr: &ast::Expr) {
         let typer = self.typer;
-        match typer.adjustments().borrow().find(&expr.id) {
+        match typer.adjustments().borrow().get(&expr.id) {
             None => { }
             Some(adjustment) => {
                 match *adjustment {
index 08202897558fb69f13146d4e9cdbe1350cd248ec..1f3473c159f22c0d13100985fdc36c684e0d5936 100644 (file)
@@ -173,7 +173,7 @@ pub fn collect_item(&mut self, item_index: uint,
         }
 
         // Matched.
-        *self.items.items.get_mut(item_index) = Some(item_def_id);
+        self.items.items[item_index] = Some(item_def_id);
     }
 
     pub fn collect_local_language_items(&mut self, krate: &ast::Crate) {
index b5847a94b8d9b9ccec3884050270e4593874ce7f..dff9c45611aa9f634cf6f736e01068a9717921ed 100644 (file)
@@ -322,7 +322,7 @@ fn add_variable(&mut self, vk: VarKind) -> Variable {
     }
 
     fn variable(&self, node_id: NodeId, span: Span) -> Variable {
-        match self.variable_map.find(&node_id) {
+        match self.variable_map.get(&node_id) {
           Some(&var) => var,
           None => {
             self.tcx
@@ -591,7 +591,7 @@ fn new(ir: &'a mut IrMaps<'a, 'tcx>, specials: Specials) -> Liveness<'a, 'tcx> {
     }
 
     fn live_node(&self, node_id: NodeId, span: Span) -> LiveNode {
-        match self.ir.live_node_map.find(&node_id) {
+        match self.ir.live_node_map.get(&node_id) {
           Some(&ln) => ln,
           None => {
             // This must be a mismatch between the ir_map construction
@@ -719,7 +719,7 @@ fn find_loop_scope(&self,
             Some(_) => {
                 // Refers to a labeled loop. Use the results of resolve
                 // to find with one
-                match self.ir.tcx.def_map.borrow().find(&id) {
+                match self.ir.tcx.def_map.borrow().get(&id) {
                     Some(&DefLabel(loop_id)) => loop_id,
                     _ => self.ir.tcx.sess.span_bug(sp, "label on break/loop \
                                                         doesn't refer to a loop")
@@ -988,7 +988,7 @@ fn propagate_through_expr(&mut self, expr: &Expr, succ: LiveNode)
 
                  // the construction of a closure itself is not important,
                  // but we have to consider the closed over variables.
-                 let caps = match this.ir.capture_info_map.find(&expr.id) {
+                 let caps = match this.ir.capture_info_map.get(&expr.id) {
                     Some(caps) => caps.clone(),
                     None => {
                         this.ir.tcx.sess.span_bug(expr.span, "no registered caps");
@@ -1096,7 +1096,7 @@ fn propagate_through_expr(&mut self, expr: &Expr, succ: LiveNode)
               // Now that we know the label we're going to,
               // look it up in the break loop nodes table
 
-              match self.break_ln.find(&sc) {
+              match self.break_ln.get(&sc) {
                   Some(&b) => b,
                   None => self.ir.tcx.sess.span_bug(expr.span,
                                                     "break to unknown label")
@@ -1110,7 +1110,7 @@ fn propagate_through_expr(&mut self, expr: &Expr, succ: LiveNode)
               // Now that we know the label we're going to,
               // look it up in the continue loop nodes table
 
-              match self.cont_ln.find(&sc) {
+              match self.cont_ln.get(&sc) {
                   Some(&b) => b,
                   None => self.ir.tcx.sess.span_bug(expr.span,
                                                     "loop to unknown label")
@@ -1167,7 +1167,7 @@ fn propagate_through_expr(&mut self, expr: &Expr, succ: LiveNode)
 
           ExprMethodCall(_, _, ref args) => {
             let method_call = typeck::MethodCall::expr(expr.id);
-            let method_ty = self.ir.tcx.method_map.borrow().find(&method_call).unwrap().ty;
+            let method_ty = self.ir.tcx.method_map.borrow().get(&method_call).unwrap().ty;
             let diverges = ty::ty_fn_ret(method_ty) == ty::FnDiverging;
             let succ = if diverges {
                 self.s.exit_ln
@@ -1520,7 +1520,7 @@ fn fn_ret(&self, id: NodeId) -> ty::FnOutput {
             ty::ty_unboxed_closure(closure_def_id, _, _) =>
                 self.ir.tcx.unboxed_closures()
                     .borrow()
-                    .find(&closure_def_id)
+                    .get(&closure_def_id)
                     .unwrap()
                     .closure_type
                     .sig
index c0188cac259ced92a9509683844e371c9103305a..4c396a5a2051030c650b61b0db54f71739900fc4 100644 (file)
@@ -389,7 +389,7 @@ fn expr_ty(&self, expr: &ast::Expr) -> McResult<ty::t> {
     fn expr_ty_adjusted(&self, expr: &ast::Expr) -> McResult<ty::t> {
         let unadjusted_ty = if_ok!(self.expr_ty(expr));
         Ok(ty::adjust_ty(self.tcx(), expr.span, expr.id, unadjusted_ty,
-                         self.typer.adjustments().borrow().find(&expr.id),
+                         self.typer.adjustments().borrow().get(&expr.id),
                          |method_call| self.typer.node_method_ty(method_call)))
     }
 
@@ -402,7 +402,7 @@ fn pat_ty(&self, pat: &ast::Pat) -> McResult<ty::t> {
     }
 
     pub fn cat_expr(&self, expr: &ast::Expr) -> McResult<cmt> {
-        match self.typer.adjustments().borrow().find(&expr.id) {
+        match self.typer.adjustments().borrow().get(&expr.id) {
             None => {
                 // No adjustments.
                 self.cat_expr_unadjusted(expr)
@@ -861,7 +861,7 @@ fn cat_deref<N:ast_node>(&self,
                              deref_cnt: uint,
                              implicit: bool)
                              -> cmt {
-        let adjustment = match self.typer.adjustments().borrow().find(&node.id()) {
+        let adjustment = match self.typer.adjustments().borrow().get(&node.id()) {
             Some(adj) if ty::adjust_is_object(adj) => typeck::AutoObject,
             _ if deref_cnt != 0 => typeck::AutoDeref(deref_cnt),
             _ => typeck::NoAdjustment
@@ -1170,7 +1170,7 @@ pub fn cat_pattern(&self,
             // variant(..)
           }
           ast::PatEnum(_, Some(ref subpats)) => {
-            match self.tcx().def_map.borrow().find(&pat.id) {
+            match self.tcx().def_map.borrow().get(&pat.id) {
                 Some(&def::DefVariant(enum_did, _, _)) => {
                     // variant(x, y, z)
 
index 357f4cdf0ebcf464799a589d58539d5dd224f095..958f65d7efb25357c94bfa635c255d262f4a22a5 100644 (file)
@@ -34,7 +34,7 @@ pub fn pat_is_refutable(dm: &resolve::DefMap, pat: &Pat) -> bool {
     match pat.node {
         PatLit(_) | PatRange(_, _) => true,
         PatEnum(_, _) | PatIdent(_, _, None) | PatStruct(..) => {
-            match dm.borrow().find(&pat.id) {
+            match dm.borrow().get(&pat.id) {
                 Some(&DefVariant(..)) => true,
                 _ => false
             }
@@ -47,7 +47,7 @@ pub fn pat_is_refutable(dm: &resolve::DefMap, pat: &Pat) -> bool {
 pub fn pat_is_variant_or_struct(dm: &resolve::DefMap, pat: &Pat) -> bool {
     match pat.node {
         PatEnum(_, _) | PatIdent(_, _, None) | PatStruct(..) => {
-            match dm.borrow().find(&pat.id) {
+            match dm.borrow().get(&pat.id) {
                 Some(&DefVariant(..)) | Some(&DefStruct(..)) => true,
                 _ => false
             }
@@ -59,7 +59,7 @@ pub fn pat_is_variant_or_struct(dm: &resolve::DefMap, pat: &Pat) -> bool {
 pub fn pat_is_const(dm: &resolve::DefMap, pat: &Pat) -> bool {
     match pat.node {
         PatIdent(_, _, None) | PatEnum(..) => {
-            match dm.borrow().find(&pat.id) {
+            match dm.borrow().get(&pat.id) {
                 Some(&DefConst(..)) => true,
                 _ => false
             }
index 4fbffa2a819d55f9b4a74b751d05f73293d6d3c2..24c653e415e57f95227dd3e5990d7ccff64ff4ec 100644 (file)
@@ -399,7 +399,7 @@ fn def_privacy(&self, did: ast::DefId) -> PrivacyResult {
             }
             debug!("privacy - is {} a public method", did);
 
-            return match self.tcx.impl_or_trait_items.borrow().find(&did) {
+            return match self.tcx.impl_or_trait_items.borrow().get(&did) {
                 Some(&ty::MethodTraitItem(ref meth)) => {
                     debug!("privacy - well at least it's a method: {}",
                            *meth);
@@ -462,7 +462,7 @@ fn def_privacy(&self, did: ast::DefId) -> PrivacyResult {
         debug!("privacy - local {} not public all the way down",
                self.tcx.map.node_to_string(did.node));
         // return quickly for things in the same module
-        if self.parents.find(&did.node) == self.parents.find(&self.curitem) {
+        if self.parents.get(&did.node) == self.parents.get(&self.curitem) {
             debug!("privacy - same parent, we're done here");
             return Allowable;
         }
@@ -855,7 +855,7 @@ fn visit_expr(&mut self, expr: &ast::Expr) {
             }
             ast::ExprMethodCall(ident, _, _) => {
                 let method_call = MethodCall::expr(expr.id);
-                match self.tcx.method_map.borrow().find(&method_call) {
+                match self.tcx.method_map.borrow().get(&method_call) {
                     None => {
                         self.tcx.sess.span_bug(expr.span,
                                                 "method call not in \
@@ -909,7 +909,7 @@ struct type?!"),
                              with private fields");
                     }
                 };
-                match self.tcx.def_map.borrow().find(&expr.id) {
+                match self.tcx.def_map.borrow().get(&expr.id) {
                     Some(&def::DefStruct(did)) => {
                         guard(if is_local(did) {
                             local_def(self.tcx.map.get_parent(did.node))
@@ -986,7 +986,7 @@ fn visit_pat(&mut self, pattern: &ast::Pat) {
                         }
                     }
                     ty::ty_enum(_, _) => {
-                        match self.tcx.def_map.borrow().find(&pattern.id) {
+                        match self.tcx.def_map.borrow().get(&pattern.id) {
                             Some(&def::DefVariant(_, variant_id, _)) => {
                                 for field in fields.iter() {
                                     self.check_field(pattern.span, variant_id,
index 4506cd7e463497c6e414b382bc4f62b138570ac0..dbeb2e289fb74f4a6a1cf97e8bad8930331bf9b6 100644 (file)
@@ -106,7 +106,7 @@ fn visit_expr(&mut self, expr: &ast::Expr) {
 
         match expr.node {
             ast::ExprPath(_) => {
-                let def = match self.tcx.def_map.borrow().find(&expr.id) {
+                let def = match self.tcx.def_map.borrow().get(&expr.id) {
                     Some(&def) => def,
                     None => {
                         self.tcx.sess.span_bug(expr.span,
index 32e373f5851c069cc678129e8ef297a4b307ab74..d380c35580d181e2f3bacb0f90fdbc9748d6d443 100644 (file)
@@ -103,7 +103,7 @@ struct RegionResolutionVisitor<'a> {
 
 impl RegionMaps {
     pub fn relate_free_regions(&self, sub: FreeRegion, sup: FreeRegion) {
-        match self.free_region_map.borrow_mut().find_mut(&sub) {
+        match self.free_region_map.borrow_mut().get_mut(&sub) {
             Some(sups) => {
                 if !sups.iter().any(|x| x == &sup) {
                     sups.push(sup);
@@ -149,13 +149,13 @@ pub fn mark_as_terminating_scope(&self, scope_id: ast::NodeId) {
 
     pub fn opt_encl_scope(&self, id: ast::NodeId) -> Option<ast::NodeId> {
         //! Returns the narrowest scope that encloses `id`, if any.
-        self.scope_map.borrow().find(&id).map(|x| *x)
+        self.scope_map.borrow().get(&id).map(|x| *x)
     }
 
     #[allow(dead_code)] // used in middle::cfg
     pub fn encl_scope(&self, id: ast::NodeId) -> ast::NodeId {
         //! Returns the narrowest scope that encloses `id`, if any.
-        match self.scope_map.borrow().find(&id) {
+        match self.scope_map.borrow().get(&id) {
             Some(&r) => r,
             None => { panic!("no enclosing scope for id {}", id); }
         }
@@ -165,7 +165,7 @@ pub fn var_scope(&self, var_id: ast::NodeId) -> ast::NodeId {
         /*!
          * Returns the lifetime of the local variable `var_id`
          */
-        match self.var_map.borrow().find(&var_id) {
+        match self.var_map.borrow().get(&var_id) {
             Some(&r) => r,
             None => { panic!("no enclosing scope for id {}", var_id); }
         }
@@ -175,7 +175,7 @@ pub fn temporary_scope(&self, expr_id: ast::NodeId) -> Option<ast::NodeId> {
         //! Returns the scope when temp created by expr_id will be cleaned up
 
         // check for a designated rvalue scope
-        match self.rvalue_scopes.borrow().find(&expr_id) {
+        match self.rvalue_scopes.borrow().get(&expr_id) {
             Some(&s) => {
                 debug!("temporary_scope({}) = {} [custom]", expr_id, s);
                 return Some(s);
@@ -232,7 +232,7 @@ pub fn is_subscope_of(&self,
 
         let mut s = subscope;
         while superscope != s {
-            match self.scope_map.borrow().find(&s) {
+            match self.scope_map.borrow().get(&s) {
                 None => {
                     debug!("is_subscope_of({}, {}, s={})=false",
                            subscope, superscope, s);
@@ -356,7 +356,7 @@ fn ancestors_of(this: &RegionMaps, scope: ast::NodeId)
             let mut result = vec!(scope);
             let mut scope = scope;
             loop {
-                match this.scope_map.borrow().find(&scope) {
+                match this.scope_map.borrow().get(&scope) {
                     None => return result,
                     Some(&superscope) => {
                         result.push(superscope);
index ed7d9296c701d2db5773998767ba2c3727a32677..a8adbbe8fecac4b897ff2e174ae68ef6c2857ac2 100644 (file)
@@ -2234,7 +2234,7 @@ fn build_import_directive(&mut self,
 
                 let mut import_resolutions = module_.import_resolutions
                                                     .borrow_mut();
-                match import_resolutions.find_mut(&target) {
+                match import_resolutions.get_mut(&target) {
                     Some(resolution) => {
                         debug!("(building import directive) bumping \
                                 reference");
@@ -2552,7 +2552,7 @@ fn resolve_single_import(&mut self,
         // Search for direct children of the containing module.
         self.populate_module_if_necessary(&containing_module);
 
-        match containing_module.children.borrow().find(&source) {
+        match containing_module.children.borrow().get(&source) {
             None => {
                 // Continue.
             }
@@ -2588,7 +2588,7 @@ fn resolve_single_import(&mut self,
                 }
 
                 // Now search the exported imports within the containing module.
-                match containing_module.import_resolutions.borrow().find(&source) {
+                match containing_module.import_resolutions.borrow().get(&source) {
                     None => {
                         debug!("(resolving single import) no import");
                         // The containing module definitely doesn't have an
@@ -2853,7 +2853,7 @@ fn resolve_glob_import(&mut self,
 
             // Here we merge two import resolutions.
             let mut import_resolutions = module_.import_resolutions.borrow_mut();
-            match import_resolutions.find_mut(ident) {
+            match import_resolutions.get_mut(ident) {
                 Some(dest_import_resolution) => {
                     // Merge the two import resolutions at a finer-grained
                     // level.
@@ -3046,7 +3046,7 @@ fn check_for_conflicts_between_imports_and_items(&mut self,
 
         // Check for item conflicts.
         let children = module.children.borrow();
-        let name_bindings = match children.find(&name) {
+        let name_bindings = match children.get(&name) {
             None => {
                 // There can't be any conflicts.
                 return
@@ -3432,7 +3432,7 @@ fn resolve_item_in_lexical_scope(&mut self,
         // its immediate children.
         self.populate_module_if_necessary(&module_);
 
-        match module_.children.borrow().find(&name) {
+        match module_.children.borrow().get(&name) {
             Some(name_bindings)
                     if name_bindings.defined_in_namespace(namespace) => {
                 debug!("top name bindings succeeded");
@@ -3448,7 +3448,7 @@ fn resolve_item_in_lexical_scope(&mut self,
         // all its imports in the usual way; this is because chains of
         // adjacent import statements are processed as though they mutated the
         // current scope.
-        match module_.import_resolutions.borrow().find(&name) {
+        match module_.import_resolutions.borrow().get(&name) {
             None => {
                 // Not found; continue.
             }
@@ -3705,7 +3705,7 @@ fn resolve_name_in_module(&mut self,
         // First, check the direct children of the module.
         self.populate_module_if_necessary(&module_);
 
-        match module_.children.borrow().find(&name) {
+        match module_.children.borrow().get(&name) {
             Some(name_bindings)
                     if name_bindings.defined_in_namespace(namespace) => {
                 debug!("(resolving name in module) found node as child");
@@ -3728,7 +3728,7 @@ fn resolve_name_in_module(&mut self,
         }
 
         // Check the list of resolved imports.
-        match module_.import_resolutions.borrow().find(&name) {
+        match module_.import_resolutions.borrow().get(&name) {
             Some(import_resolution) if allow_private_imports ||
                                        import_resolution.is_public => {
 
@@ -3967,7 +3967,7 @@ fn with_scope(&mut self, name: Option<Name>, f: |&mut Resolver|) {
             Some(name) => {
                 self.populate_module_if_necessary(&orig_module);
 
-                match orig_module.children.borrow().find(&name) {
+                match orig_module.children.borrow().get(&name) {
                     None => {
                         debug!("!!! (with scope) didn't find `{}` in `{}`",
                                token::get_name(name),
@@ -4691,7 +4691,7 @@ fn with_optional_trait_ref<T>(&mut self, id: NodeId,
             Some(ref trait_ref) => {
                 self.resolve_trait_reference(id, trait_ref, TraitImplementation);
 
-                match self.def_map.borrow().find(&trait_ref.ref_id) {
+                match self.def_map.borrow().get(&trait_ref.ref_id) {
                     Some(def) => {
                         let did = def.def_id();
                         Some((did, trait_ref.clone()))
@@ -4767,7 +4767,7 @@ fn resolve_implementation(&mut self,
                 // a type (shadowing any imported modules or types with this name), leading
                 // to weird user-visible bugs. So we ward this off here. See #15060.
                 TyPath(ref path, _, path_id) => {
-                    match self.def_map.borrow().find(&path_id) {
+                    match self.def_map.borrow().get(&path_id) {
                         // FIXME: should we catch other options and give more precise errors?
                         Some(&DefMod(_)) => {
                             self.resolve_error(path.span, "inherent implementations are not \
@@ -4785,7 +4785,7 @@ fn resolve_implementation(&mut self,
     fn check_trait_item(&self, name: Name, span: Span) {
         // If there is a TraitRef in scope for an impl, then the method must be in the trait.
         for &(did, ref trait_ref) in self.current_trait_ref.iter() {
-            if self.trait_item_map.find(&(name, did)).is_none() {
+            if self.trait_item_map.get(&(name, did)).is_none() {
                 let path_str = self.path_names_to_string(&trait_ref.path);
                 self.resolve_error(span,
                                     format!("method `{}` is not a member of trait `{}`",
@@ -4849,7 +4849,7 @@ fn check_consistent_bindings(&mut self, arm: &Arm) {
             let map_i = self.binding_mode_map(&**p);
 
             for (&key, &binding_0) in map_0.iter() {
-                match map_i.find(&key) {
+                match map_i.get(&key) {
                   None => {
                     self.resolve_error(
                         p.span,
@@ -4908,7 +4908,7 @@ fn resolve_block(&mut self, block: &Block) {
 
         // Move down in the graph, if there's an anonymous module rooted here.
         let orig_module = self.current_module.clone();
-        match orig_module.anonymous_children.borrow().find(&block.id) {
+        match orig_module.anonymous_children.borrow().get(&block.id) {
             None => { /* Nothing to do. */ }
             Some(anonymous_module) => {
                 debug!("(resolving block) found anonymous module, moving \
@@ -4943,7 +4943,7 @@ fn resolve_type(&mut self, ty: &Ty) {
 
                     match self.primitive_type_table
                             .primitive_types
-                            .find(&id.name) {
+                            .get(&id.name) {
 
                         Some(&primitive_type) => {
                             result_def =
@@ -5181,7 +5181,7 @@ struct or enum variant",
                                                            token::get_ident(
                                                                ident))
                                                    .as_slice())
-                            } else if bindings_list.find(&renamed) ==
+                            } else if bindings_list.get(&renamed) ==
                                     Some(&pat_id) {
                                 // Then this is a duplicate variable in the
                                 // same disjunction, which is an error.
@@ -5407,7 +5407,7 @@ fn resolve_definition_of_name_in_module(&mut self,
         // First, search children.
         self.populate_module_if_necessary(&containing_module);
 
-        match containing_module.children.borrow().find(&name) {
+        match containing_module.children.borrow().get(&name) {
             Some(child_name_bindings) => {
                 match child_name_bindings.def_for_namespace(namespace) {
                     Some(def) => {
@@ -5426,7 +5426,7 @@ fn resolve_definition_of_name_in_module(&mut self,
         }
 
         // Next, search import resolutions.
-        match containing_module.import_resolutions.borrow().find(&name) {
+        match containing_module.import_resolutions.borrow().get(&name) {
             Some(import_resolution) if import_resolution.is_public => {
                 match (*import_resolution).target_for_namespace(namespace) {
                     Some(target) => {
@@ -5715,10 +5715,10 @@ fn get_module(this: &mut Resolver, span: Span, name_path: &[ast::Name])
             let last_name = name_path.last().unwrap();
 
             if name_path.len() == 1 {
-                match this.primitive_type_table.primitive_types.find(last_name) {
+                match this.primitive_type_table.primitive_types.get(last_name) {
                     Some(_) => None,
                     None => {
-                        match this.current_module.children.borrow().find(last_name) {
+                        match this.current_module.children.borrow().get(last_name) {
                             Some(child) => child.get_module_if_available(),
                             None => None
                         }
@@ -5746,10 +5746,10 @@ fn get_module(this: &mut Resolver, span: Span, name_path: &[ast::Name])
 
         if allowed == Everything {
             // Look for a field with the same name in the current self_type.
-            match self.def_map.borrow().find(&node_id) {
+            match self.def_map.borrow().get(&node_id) {
                  Some(&DefTy(did, _))
                 | Some(&DefStruct(did))
-                | Some(&DefVariant(_, did, _)) => match self.structs.find(&did) {
+                | Some(&DefVariant(_, did, _)) => match self.structs.get(&did) {
                     None => {}
                     Some(fields) => {
                         if fields.iter().any(|&field_name| name == field_name) {
@@ -5765,7 +5765,7 @@ fn get_module(this: &mut Resolver, span: Span, name_path: &[ast::Name])
 
         // Look for a method in the current self type's impl module.
         match get_module(self, path.span, name_path.as_slice()) {
-            Some(module) => match module.children.borrow().find(&name) {
+            Some(module) => match module.children.borrow().get(&name) {
                 Some(binding) => {
                     let p_str = self.path_names_to_string(&path);
                     match binding.def_for_namespace(ValueNS) {
@@ -5790,7 +5790,7 @@ fn get_module(this: &mut Resolver, span: Span, name_path: &[ast::Name])
             Some((did, ref trait_ref)) => {
                 let path_str = self.path_names_to_string(&trait_ref.path);
 
-                match self.trait_item_map.find(&(name, did)) {
+                match self.trait_item_map.get(&(name, did)) {
                     Some(&StaticMethodTraitItemKind) => {
                         return TraitMethod(path_str)
                     }
@@ -6270,7 +6270,7 @@ fn finalize_import(&mut self, id: NodeId, span: Span) {
                                   "unused import".to_string());
         }
 
-        let (v_priv, t_priv) = match self.last_private.find(&id) {
+        let (v_priv, t_priv) = match self.last_private.get(&id) {
             Some(&LastImport {
                 value_priv: v,
                 value_used: _,
index 09bd0f52985b1799334e4f6e47d83dae9c2ab66b..7fcc58d8f4e4b4ff75fc10494669ccf77bdf6b1c 100644 (file)
@@ -906,7 +906,7 @@ fn check_candidate_cache(&mut self,
     {
         let cache = self.pick_candidate_cache(&cache_skol_trait_ref);
         let hashmap = cache.hashmap.borrow();
-        hashmap.find(&cache_skol_trait_ref).map(|c| (*c).clone())
+        hashmap.get(&cache_skol_trait_ref).map(|c| (*c).clone())
     }
 
     fn insert_candidate_cache(&mut self,
@@ -1032,7 +1032,7 @@ fn assemble_unboxed_candidates(&mut self,
                self_ty.repr(self.tcx()),
                obligation.repr(self.tcx()));
 
-        let closure_kind = match self.typer.unboxed_closures().borrow().find(&closure_def_id) {
+        let closure_kind = match self.typer.unboxed_closures().borrow().get(&closure_def_id) {
             Some(closure) => closure.kind,
             None => {
                 self.tcx().sess.span_bug(
@@ -1282,7 +1282,7 @@ fn builtin_bound(&mut self,
 
                             ty::BoundSync |
                             ty::BoundSend => {
-                                if c.bounds.builtin_bounds.contains_elem(bound) {
+                                if c.bounds.builtin_bounds.contains(&bound) {
                                     Ok(If(Vec::new()))
                                 } else {
                                     Err(Unimplemented)
@@ -1306,7 +1306,7 @@ fn builtin_bound(&mut self,
 
                             ty::BoundSync |
                             ty::BoundSend => {
-                                if c.bounds.builtin_bounds.contains_elem(bound) {
+                                if c.bounds.builtin_bounds.contains(&bound) {
                                     Ok(If(Vec::new()))
                                 } else {
                                     Err(Unimplemented)
@@ -1323,7 +1323,7 @@ fn builtin_bound(&mut self,
                         Err(Unimplemented)
                     }
                     ty::BoundCopy | ty::BoundSync | ty::BoundSend => {
-                        if bounds.builtin_bounds.contains_elem(bound) {
+                        if bounds.builtin_bounds.contains(&bound) {
                             Ok(If(Vec::new()))
                         } else {
                             Err(Unimplemented)
@@ -1428,7 +1428,7 @@ fn builtin_bound(&mut self,
                 // is reserve judgement and then intertwine this
                 // analysis with closure inference.
                 assert_eq!(def_id.krate, ast::LOCAL_CRATE);
-                match self.tcx().freevars.borrow().find(&def_id.node) {
+                match self.tcx().freevars.borrow().get(&def_id.node) {
                     None => {
                         // No upvars.
                         Ok(If(Vec::new()))
@@ -1690,7 +1690,7 @@ fn confirm_unboxed_closure_candidate(&mut self,
                closure_def_id.repr(self.tcx()),
                substs.repr(self.tcx()));
 
-        let closure_type = match self.typer.unboxed_closures().borrow().find(&closure_def_id) {
+        let closure_type = match self.typer.unboxed_closures().borrow().get(&closure_def_id) {
             Some(closure) => closure.closure_type.clone(),
             None => {
                 self.tcx().sess.span_bug(
@@ -1973,7 +1973,7 @@ fn all_impls(&self, trait_def_id: ast::DefId) -> Vec<ast::DefId> {
 
         ty::populate_implementations_for_trait_if_necessary(self.tcx(),
                                                             trait_def_id);
-        match self.tcx().trait_impls.borrow().find(&trait_def_id) {
+        match self.tcx().trait_impls.borrow().get(&trait_def_id) {
             None => Vec::new(),
             Some(impls) => impls.borrow().clone()
         }
index 70aef4504f031c1e1602ab9f6338698e0bb18a8a..e148261b1bf265c0065cef050fbfae08345306cc 100644 (file)
@@ -696,13 +696,13 @@ fn any_irrefutable_adt_pat(tcx: &ty::ctxt, m: &[Match], col: uint) -> bool {
         match pat.node {
             ast::PatTup(_) => true,
             ast::PatStruct(..) => {
-                match tcx.def_map.borrow().find(&pat.id) {
+                match tcx.def_map.borrow().get(&pat.id) {
                     Some(&def::DefVariant(..)) => false,
                     _ => true,
                 }
             }
             ast::PatEnum(..) | ast::PatIdent(_, _, None) => {
-                match tcx.def_map.borrow().find(&pat.id) {
+                match tcx.def_map.borrow().get(&pat.id) {
                     Some(&def::DefStruct(..)) => true,
                     _ => false
                 }
index d3658e89a2a5353d97ec36f3766b12bbbc8deb6a..7ff94c28d93bc73896d0e46efc292130047bcfaa 100644 (file)
@@ -147,7 +147,7 @@ pub fn represent_node(bcx: Block, node: ast::NodeId) -> Rc<Repr> {
 /// Decides how to represent a given type.
 pub fn represent_type(cx: &CrateContext, t: ty::t) -> Rc<Repr> {
     debug!("Representing: {}", ty_to_string(cx.tcx(), t));
-    match cx.adt_reprs().borrow().find(&t) {
+    match cx.adt_reprs().borrow().get(&t) {
         Some(repr) => return repr.clone(),
         None => {}
     }
index b80425e7ac85568be16c1d7a96a4338418b59b45..3b3b886c6d06e3d3329fb624500d52d0198e9084 100644 (file)
@@ -316,7 +316,7 @@ pub fn get_extern_const(ccx: &CrateContext, did: ast::DefId,
                         t: ty::t) -> ValueRef {
     let name = csearch::get_symbol(&ccx.sess().cstore, did);
     let ty = type_of(ccx, t);
-    match ccx.externs().borrow_mut().find(&name) {
+    match ccx.externs().borrow_mut().get(&name) {
         Some(n) => return *n,
         None => ()
     }
@@ -409,7 +409,7 @@ pub fn malloc_raw_dyn_proc<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, t: ty::t) -> Resu
 // Type descriptor and type glue stuff
 
 pub fn get_tydesc(ccx: &CrateContext, t: ty::t) -> Rc<tydesc_info> {
-    match ccx.tydescs().borrow().find(&t) {
+    match ccx.tydescs().borrow().get(&t) {
         Some(inf) => return inf.clone(),
         _ => { }
     }
@@ -2100,7 +2100,7 @@ fn enum_variant_size_lint(ccx: &CrateContext, enum_def: &ast::EnumDef, sp: Span,
 
     let levels = ccx.tcx().node_lint_levels.borrow();
     let lint_id = lint::LintId::of(lint::builtin::VARIANT_SIZE_DIFFERENCES);
-    let lvlsrc = match levels.find(&(id, lint_id)) {
+    let lvlsrc = match levels.get(&(id, lint_id)) {
         None | Some(&(lint::Allow, _)) => return,
         Some(&lvlsrc) => lvlsrc,
     };
@@ -2645,7 +2645,7 @@ fn create_entry_fn(ccx: &CrateContext,
 
 fn exported_name(ccx: &CrateContext, id: ast::NodeId,
                  ty: ty::t, attrs: &[ast::Attribute]) -> String {
-    match ccx.external_srcs().borrow().find(&id) {
+    match ccx.external_srcs().borrow().get(&id) {
         Some(&did) => {
             let sym = csearch::get_symbol(&ccx.sess().cstore, did);
             debug!("found item {} in other crate...", sym);
@@ -3123,7 +3123,7 @@ pub fn trans_crate<'tcx>(analysis: CrateAnalysis<'tcx>)
         .collect();
 
     let mut reachable: Vec<String> = shared_ccx.reachable().iter().filter_map(|id| {
-        shared_ccx.item_symbols().borrow().find(id).map(|s| s.to_string())
+        shared_ccx.item_symbols().borrow().get(id).map(|s| s.to_string())
     }).collect();
 
     // For the purposes of LTO, we add to the reachable set all of the upstream
index 81428937e4b1f3d179ccc1fe5dcb3625d26f11ac..b692b01f765d51f9526b413967158b42cfccac74 100644 (file)
@@ -81,7 +81,7 @@ pub fn count_insn(&self, category: &str) {
                 s.push('/');
                 s.push_str(category);
 
-                let n = match h.find(&s) {
+                let n = match h.get(&s) {
                     Some(&n) => n,
                     _ => 0u
                 };
index decd238627c20b554fce4794b9ccc6037447df5e..16db4daba46b8ba767aa99ebef481f1f192dfcfc 100644 (file)
@@ -438,7 +438,7 @@ pub fn get_or_create_declaration_if_unboxed_closure<'blk, 'tcx>(bcx: Block<'blk,
         params: params
     };
 
-    match ccx.unboxed_closure_vals().borrow().find(&mono_id) {
+    match ccx.unboxed_closure_vals().borrow().get(&mono_id) {
         Some(llfn) => {
             debug!("get_or_create_declaration_if_unboxed_closure(): found \
                     closure");
@@ -564,7 +564,7 @@ pub fn get_wrapper_for_bare_fn(ccx: &CrateContext,
         }
     };
 
-    match ccx.closure_bare_wrapper_cache().borrow().find(&fn_ptr) {
+    match ccx.closure_bare_wrapper_cache().borrow().get(&fn_ptr) {
         Some(&llval) => return llval,
         None => {}
     }
index 8b5e82ecf90120ee28b7f7cc58d6e18b369a379c..18501dd9e34cb23c266ef8e4b07a8f7970491361 100644 (file)
@@ -466,7 +466,7 @@ pub fn expr_to_string(&self, e: &ast::Expr) -> String {
     }
 
     pub fn def(&self, nid: ast::NodeId) -> def::Def {
-        match self.tcx().def_map.borrow().find(&nid) {
+        match self.tcx().def_map.borrow().get(&nid) {
             Some(v) => v.clone(),
             None => {
                 self.tcx().sess.bug(format!(
@@ -505,7 +505,7 @@ fn node_method_ty(&self, method_call: typeck::MethodCall) -> Option<ty::t> {
         self.tcx()
             .method_map
             .borrow()
-            .find(&method_call)
+            .get(&method_call)
             .map(|method| monomorphize_type(self, method.ty))
     }
 
@@ -647,7 +647,7 @@ pub fn C_u8(ccx: &CrateContext, i: uint) -> ValueRef {
 // our boxed-and-length-annotated strings.
 pub fn C_cstr(cx: &CrateContext, s: InternedString, null_terminated: bool) -> ValueRef {
     unsafe {
-        match cx.const_cstr_cache().borrow().find(&s) {
+        match cx.const_cstr_cache().borrow().get(&s) {
             Some(&llval) => return llval,
             None => ()
         }
@@ -813,7 +813,7 @@ pub fn fulfill_obligation(ccx: &CrateContext,
     let trait_ref = ty_fold::erase_regions(tcx, trait_ref);
 
     // First check the cache.
-    match ccx.trait_cache().borrow().find(&trait_ref) {
+    match ccx.trait_cache().borrow().get(&trait_ref) {
         Some(vtable) => {
             info!("Cache hit: {}", trait_ref.repr(ccx.tcx()));
             return (*vtable).clone();
index 6ba6ff6fb2113ea4023d1d2037f82372159ab50d..ced6c2f49492df46442279d74a988718cb30b281 100644 (file)
@@ -90,7 +90,7 @@ pub fn const_lit(cx: &CrateContext, e: &ast::Expr, lit: &ast::Lit)
 pub fn const_ptrcast(cx: &CrateContext, a: ValueRef, t: Type) -> ValueRef {
     unsafe {
         let b = llvm::LLVMConstPointerCast(a, t.ptr_to().to_ref());
-        assert!(cx.const_globals().borrow_mut().insert(b as int, a));
+        assert!(cx.const_globals().borrow_mut().insert(b as int, a).is_none());
         b
     }
 }
@@ -125,7 +125,7 @@ pub fn const_addr_of(cx: &CrateContext, cv: ValueRef, mutbl: ast::Mutability) ->
 }
 
 fn const_deref_ptr(cx: &CrateContext, v: ValueRef) -> ValueRef {
-    let v = match cx.const_globals().borrow().find(&(v as int)) {
+    let v = match cx.const_globals().borrow().get(&(v as int)) {
         Some(&v) => v,
         None => v
     };
index 911ae42e142d87e867c5a572471a05817a29cfa5..714d5ab248d5ede123622e48867934f012eeaf90 100644 (file)
@@ -421,7 +421,7 @@ pub fn trans_break_cont<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
     let loop_id = match opt_label {
         None => fcx.top_loop_scope(),
         Some(_) => {
-            match bcx.tcx().def_map.borrow().find(&expr_id) {
+            match bcx.tcx().def_map.borrow().get(&expr_id) {
                 Some(&def::DefLabel(loop_id)) => loop_id,
                 ref r => {
                     bcx.tcx().sess.bug(format!("{} in def-map for label",
index ea7f28796f03c3b01befab8e7febdc784c4c2c24..c84543773a4a4060d82c6ec7eb0e24ae0c5b9f1a 100644 (file)
@@ -282,7 +282,7 @@ fn register_type_with_metadata(&mut self,
                                    cx: &CrateContext,
                                    type_: ty::t,
                                    metadata: DIType) {
-        if !self.type_to_metadata.insert(ty::type_id(type_), metadata) {
+        if self.type_to_metadata.insert(ty::type_id(type_), metadata).is_some() {
             cx.sess().bug(format!("Type metadata for ty::t '{}' is already in the TypeMap!",
                                    ppaux::ty_to_string(cx.tcx(), type_)).as_slice());
         }
@@ -294,7 +294,7 @@ fn register_unique_id_with_metadata(&mut self,
                                         cx: &CrateContext,
                                         unique_type_id: UniqueTypeId,
                                         metadata: DIType) {
-        if !self.unique_id_to_metadata.insert(unique_type_id, metadata) {
+        if self.unique_id_to_metadata.insert(unique_type_id, metadata).is_some() {
             let unique_type_id_str = self.get_unique_type_id_as_string(unique_type_id);
             cx.sess().bug(format!("Type metadata for unique id '{}' is already in the TypeMap!",
                                   unique_type_id_str.as_slice()).as_slice());
@@ -468,7 +468,7 @@ fn get_unique_type_id_of_type(&mut self, cx: &CrateContext, type_: ty::t) -> Uni
             },
             ty::ty_unboxed_closure(ref def_id, _, ref substs) => {
                 let closure_ty = cx.tcx().unboxed_closures.borrow()
-                                   .find(def_id).unwrap().closure_type.subst(cx.tcx(), substs);
+                                   .get(def_id).unwrap().closure_type.subst(cx.tcx(), substs);
                 self.get_unique_type_id_of_closure_type(cx,
                                                         closure_ty,
                                                         &mut unique_type_id);
@@ -2939,7 +2939,7 @@ fn type_metadata(cx: &CrateContext,
         }
         ty::ty_unboxed_closure(ref def_id, _, ref substs) => {
             let sig = cx.tcx().unboxed_closures.borrow()
-                        .find(def_id).unwrap().closure_type.sig.subst(cx.tcx(), substs);
+                        .get(def_id).unwrap().closure_type.sig.subst(cx.tcx(), substs);
             subroutine_type_metadata(cx, unique_type_id, &sig, usage_site_span)
         }
         ty::ty_struct(def_id, ref substs) => {
index a0ba2996334b9a62a4c59493cbd89a0afbc49670..b01d891270b13c29e7fc51fce6976cac045ef32d 100644 (file)
@@ -212,7 +212,7 @@ fn apply_adjustments<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
                         // Don't skip a conversion from Box<T> to &T, etc.
                         ty::ty_rptr(..) => {
                             let method_call = MethodCall::autoderef(expr.id, adj.autoderefs-1);
-                            let method = bcx.tcx().method_map.borrow().find(&method_call).is_some();
+                            let method = bcx.tcx().method_map.borrow().get(&method_call).is_some();
                             if method {
                                 // Don't skip an overloaded deref.
                                 (adj.autoderefs, true)
@@ -601,7 +601,7 @@ fn trans_datum_unadjusted<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
             let method_ty = ccx.tcx()
                                .method_map
                                .borrow()
-                               .find(&method_call)
+                               .get(&method_call)
                                .map(|method| method.ty);
             let base_datum = unpack_datum!(bcx, trans(bcx, &**base));
 
@@ -736,7 +736,7 @@ fn trans_index<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
     let method_ty = ccx.tcx()
                        .method_map
                        .borrow()
-                       .find(&method_call)
+                       .get(&method_call)
                        .map(|method| method.ty);
     let elt_datum = match method_ty {
         Some(method_ty) => {
@@ -1114,7 +1114,7 @@ fn trans_rvalue_dps_unadjusted<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
             if ty::type_is_trait(node_id_type(bcx, expr.id)) {
                 let trait_ref =
                     bcx.tcx().object_cast_map.borrow()
-                                             .find(&expr.id)
+                                             .get(&expr.id)
                                              .map(|t| (*t).clone())
                                              .unwrap();
                 let trait_ref =
@@ -1232,7 +1232,7 @@ pub fn trans_local_var<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
         def::DefUpvar(nid, _, _) => {
             // Can't move upvars, so this is never a ZeroMemLastUse.
             let local_ty = node_id_type(bcx, nid);
-            match bcx.fcx.llupvars.borrow().find(&nid) {
+            match bcx.fcx.llupvars.borrow().get(&nid) {
                 Some(&val) => Datum::new(val, local_ty, Lvalue),
                 None => {
                     bcx.sess().bug(format!(
@@ -1242,7 +1242,7 @@ pub fn trans_local_var<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
             }
         }
         def::DefLocal(nid) => {
-            let datum = match bcx.fcx.lllocals.borrow().find(&nid) {
+            let datum = match bcx.fcx.lllocals.borrow().get(&nid) {
                 Some(&v) => v,
                 None => {
                     bcx.sess().bug(format!(
@@ -2089,7 +2089,7 @@ fn deref_once<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
 
     // Check for overloaded deref.
     let method_ty = ccx.tcx().method_map.borrow()
-                       .find(&method_call).map(|method| method.ty);
+                       .get(&method_call).map(|method| method.ty);
     let datum = match method_ty {
         Some(method_ty) => {
             // Overloaded. Evaluate `trans_overloaded_op`, which will
index fb85e6198666726d1bad7c346059f782b86e8ba0..eb6e67efd49a6d598208e81de5e7ccf3f62ce176 100644 (file)
@@ -144,7 +144,7 @@ pub fn get_drop_glue(ccx: &CrateContext, t: ty::t) -> ValueRef {
     debug!("make drop glue for {}", ppaux::ty_to_string(ccx.tcx(), t));
     let t = get_drop_glue_type(ccx, t);
     debug!("drop glue type {}", ppaux::ty_to_string(ccx.tcx(), t));
-    match ccx.drop_glues().borrow().find(&t) {
+    match ccx.drop_glues().borrow().get(&t) {
         Some(&glue) => return glue,
         _ => { }
     }
@@ -157,7 +157,7 @@ pub fn get_drop_glue(ccx: &CrateContext, t: ty::t) -> ValueRef {
 
     let llfnty = Type::glue_fn(ccx, llty);
 
-    let (glue, new_sym) = match ccx.available_drop_glues().borrow().find(&t) {
+    let (glue, new_sym) = match ccx.available_drop_glues().borrow().get(&t) {
         Some(old_sym) => {
             let glue = decl_cdecl_fn(ccx, old_sym.as_slice(), llfnty, ty::mk_nil());
             (glue, None)
index 048402782a6d96b5a41d07ae4bd7efb533f0ff73..65d7749b489272d5304d49f9edd403a294dae0f1 100644 (file)
@@ -21,7 +21,7 @@
 fn instantiate_inline(ccx: &CrateContext, fn_id: ast::DefId)
     -> Option<ast::DefId> {
     let _icx = push_ctxt("maybe_instantiate_inline");
-    match ccx.external().borrow().find(&fn_id) {
+    match ccx.external().borrow().get(&fn_id) {
         Some(&Some(node_id)) => {
             // Already inline
             debug!("maybe_instantiate_inline({}): already inline as node id {}",
index fbd4db959ce0cbbca74fb3b3f7e15ce841d3002c..0ae728c71ee63dcf827c538efd8111d219febffb 100644 (file)
@@ -116,7 +116,7 @@ pub fn trans_method_callee<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
     let (origin, method_ty) =
         bcx.tcx().method_map
                  .borrow()
-                 .find(&method_call)
+                 .get(&method_call)
                  .map(|method| (method.origin.clone(), method.ty))
                  .unwrap();
 
@@ -308,7 +308,7 @@ fn method_with_name(ccx: &CrateContext, impl_id: ast::DefId, name: ast::Name)
 
     let impl_items = ccx.tcx().impl_items.borrow();
     let impl_items =
-        impl_items.find(&impl_id)
+        impl_items.get(&impl_id)
                   .expect("could not find impl while translating");
     let meth_did = impl_items.iter()
                              .find(|&did| {
@@ -559,7 +559,7 @@ pub fn get_vtable(bcx: Block,
 
     // Check the cache.
     let cache_key = (box_ty, trait_ref.clone());
-    match ccx.vtables().borrow().find(&cache_key) {
+    match ccx.vtables().borrow().get(&cache_key) {
         Some(&val) => { return val }
         None => { }
     }
@@ -599,7 +599,7 @@ pub fn get_vtable(bcx: Block,
                                               .unboxed_closures
                                               .borrow();
                     let closure_info =
-                        unboxed_closures.find(&closure_def_id)
+                        unboxed_closures.get(&closure_def_id)
                                         .expect("get_vtable(): didn't find \
                                                  unboxed closure");
                     if closure_info.kind == ty::FnOnceUnboxedClosureKind {
index 258d12e631f2fb1a8f741b4d86c56df542476bb9..f9d42240f35b7bcb37232982f2c7baf8f961cb7b 100644 (file)
@@ -54,7 +54,7 @@ pub fn monomorphic_fn(ccx: &CrateContext,
         params: real_substs.types.clone()
     };
 
-    match ccx.monomorphized().borrow().find(&hash_id) {
+    match ccx.monomorphized().borrow().get(&hash_id) {
         Some(&val) => {
             debug!("leaving monomorphic fn {}",
             ty::item_path_str(ccx.tcx(), fn_id));
@@ -106,7 +106,7 @@ pub fn monomorphic_fn(ccx: &CrateContext,
     let depth;
     {
         let mut monomorphizing = ccx.monomorphizing().borrow_mut();
-        depth = match monomorphizing.find(&fn_id) {
+        depth = match monomorphizing.get(&fn_id) {
             Some(&d) => d, None => 0
         };
 
index 7b8eb4e02b2bc26ec950ae8fec9a18753c80ccfd..175b0d7adde0a5494fa9feb861fd217a895ace0e 100644 (file)
@@ -332,7 +332,7 @@ pub fn new() -> TypeNames {
 
     pub fn associate_type(&self, s: &str, t: &Type) {
         assert!(self.named_types.borrow_mut().insert(s.to_string(),
-                                                     t.to_ref()));
+                                                     t.to_ref()).is_none());
     }
 
     pub fn find_type(&self, s: &str) -> Option<Type> {
index 649dbbacc698447789e7e9de9fd8d9b31ec8e480..d1b8f767bc85018e312b2e028b743b7d80f22332 100644 (file)
@@ -272,7 +272,7 @@ fn type_of_unsize_info(cx: &CrateContext, t: ty::t) -> Type {
     }
 
     // Check the cache.
-    match cx.lltypes().borrow().find(&t) {
+    match cx.lltypes().borrow().get(&t) {
         Some(&llty) => return llty,
         None => ()
     }
index 76caa42b850230ef07a398c1fd8bda8d9161a54a..421042a86489ae1d7f6ce250976d139a894b6fb1 100644 (file)
@@ -1080,14 +1080,14 @@ pub enum BuiltinBound {
 }
 
 pub fn empty_builtin_bounds() -> BuiltinBounds {
-    EnumSet::empty()
+    EnumSet::new()
 }
 
 pub fn all_builtin_bounds() -> BuiltinBounds {
-    let mut set = EnumSet::empty();
-    set.add(BoundSend);
-    set.add(BoundSized);
-    set.add(BoundSync);
+    let mut set = EnumSet::new();
+    set.insert(BoundSend);
+    set.insert(BoundSized);
+    set.insert(BoundSync);
     set
 }
 
@@ -1584,7 +1584,7 @@ pub fn mk_t(cx: &ctxt, st: sty) -> t {
 
     let key = intern_key { sty: &st };
 
-    match cx.interner.borrow().find(&key) {
+    match cx.interner.borrow().get(&key) {
         Some(t) => unsafe { return mem::transmute(&t.sty); },
         _ => ()
     }
@@ -2418,11 +2418,11 @@ fn tc_ty(cx: &ctxt,
         // value for the type contents of list.  The correct value is
         // TC::OwnsOwned.  This manifested as issue #4821.
         let ty_id = type_id(ty);
-        match cache.find(&ty_id) {
+        match cache.get(&ty_id) {
             Some(tc) => { return *tc; }
             None => {}
         }
-        match cx.tc_cache.borrow().find(&ty_id) {    // Must check both caches!
+        match cx.tc_cache.borrow().get(&ty_id) {    // Must check both caches!
             Some(tc) => { return *tc; }
             None => {}
         }
@@ -3192,7 +3192,7 @@ pub fn array_element_ty(t: t) -> Option<t> {
 }
 
 pub fn node_id_to_trait_ref(cx: &ctxt, id: ast::NodeId) -> Rc<ty::TraitRef> {
-    match cx.trait_refs.borrow().find(&id) {
+    match cx.trait_refs.borrow().get(&id) {
         Some(t) => t.clone(),
         None => cx.sess.bug(
             format!("node_id_to_trait_ref: no trait ref for node `{}`",
@@ -3214,14 +3214,14 @@ pub fn node_id_to_type(cx: &ctxt, id: ast::NodeId) -> t {
 }
 
 pub fn node_id_to_type_opt(cx: &ctxt, id: ast::NodeId) -> Option<t> {
-    match cx.node_types.borrow().find(&(id as uint)) {
+    match cx.node_types.borrow().get(&(id as uint)) {
        Some(&t) => Some(t),
        None => None
     }
 }
 
 pub fn node_id_item_substs(cx: &ctxt, id: ast::NodeId) -> ItemSubsts {
-    match cx.item_substs.borrow().find(&id) {
+    match cx.item_substs.borrow().get(&id) {
       None => ItemSubsts::empty(),
       Some(ts) => ts.clone(),
     }
@@ -3361,8 +3361,8 @@ pub fn expr_ty_adjusted(cx: &ctxt, expr: &ast::Expr) -> t {
      */
 
     adjust_ty(cx, expr.span, expr.id, expr_ty(cx, expr),
-              cx.adjustments.borrow().find(&expr.id),
-              |method_call| cx.method_map.borrow().find(&method_call).map(|method| method.ty))
+              cx.adjustments.borrow().get(&expr.id),
+              |method_call| cx.method_map.borrow().get(&method_call).map(|method| method.ty))
 }
 
 pub fn expr_span(cx: &ctxt, id: NodeId) -> Span {
@@ -3553,7 +3553,7 @@ pub fn unsize_ty(cx: &ctxt,
 }
 
 pub fn resolve_expr(tcx: &ctxt, expr: &ast::Expr) -> def::Def {
-    match tcx.def_map.borrow().find(&expr.id) {
+    match tcx.def_map.borrow().get(&expr.id) {
         Some(&def) => def,
         None => {
             tcx.sess.span_bug(expr.span, format!(
@@ -3690,7 +3690,7 @@ pub fn expr_kind(tcx: &ctxt, expr: &ast::Expr) -> ExprKind {
         }
 
         ast::ExprCast(..) => {
-            match tcx.node_types.borrow().find(&(expr.id as uint)) {
+            match tcx.node_types.borrow().get(&(expr.id as uint)) {
                 Some(&t) => {
                     if type_is_trait(t) {
                         RvalueDpsExpr
@@ -3736,7 +3736,7 @@ pub fn expr_kind(tcx: &ctxt, expr: &ast::Expr) -> ExprKind {
 
         ast::ExprBox(ref place, _) => {
             // Special case `Box<T>` for now:
-            let definition = match tcx.def_map.borrow().find(&place.id) {
+            let definition = match tcx.def_map.borrow().get(&place.id) {
                 Some(&def) => def,
                 None => panic!("no def for place"),
             };
@@ -4003,7 +4003,7 @@ pub fn note_and_explain_type_err(cx: &ctxt, err: &type_err) {
 }
 
 pub fn provided_source(cx: &ctxt, id: ast::DefId) -> Option<ast::DefId> {
-    cx.provided_method_sources.borrow().find(&id).map(|x| *x)
+    cx.provided_method_sources.borrow().get(&id).map(|x| *x)
 }
 
 pub fn provided_trait_methods(cx: &ctxt, id: ast::DefId) -> Vec<Rc<Method>> {
@@ -4113,7 +4113,7 @@ pub fn impl_or_trait_item(cx: &ctxt, id: ast::DefId) -> ImplOrTraitItem {
 pub fn is_associated_type(cx: &ctxt, id: ast::DefId) -> bool {
     memoized(&cx.associated_types, id, |id: ast::DefId| {
         if id.krate == ast::LOCAL_CRATE {
-            match cx.impl_or_trait_items.borrow().find(&id) {
+            match cx.impl_or_trait_items.borrow().get(&id) {
                 Some(ref item) => {
                     match **item {
                         TypeTraitItem(_) => true,
@@ -4198,7 +4198,7 @@ pub fn impl_trait_ref(cx: &ctxt, id: ast::DefId) -> Option<Rc<TraitRef>> {
 
 pub fn trait_ref_to_def_id(tcx: &ctxt, tr: &ast::TraitRef) -> ast::DefId {
     let def = *tcx.def_map.borrow()
-                     .find(&tr.ref_id)
+                     .get(&tr.ref_id)
                      .expect("no def-map entry for trait");
     def.def_id()
 }
@@ -4215,7 +4215,7 @@ pub fn try_add_builtin_trait(
     //! is a builtin trait.
 
     match tcx.lang_items.to_builtin_kind(trait_def_id) {
-        Some(bound) => { builtin_bounds.add(bound); true }
+        Some(bound) => { builtin_bounds.insert(bound); true }
         None => false
     }
 }
@@ -4346,7 +4346,7 @@ pub fn has_drop_flag(&self) -> bool {
 /* If struct_id names a struct with a dtor, return Some(the dtor's id).
    Otherwise return none. */
 pub fn ty_dtor(cx: &ctxt, struct_id: DefId) -> DtorKind {
-    match cx.destructor_for_type.borrow().find(&struct_id) {
+    match cx.destructor_for_type.borrow().get(&struct_id) {
         Some(&method_def_id) => {
             let flag = !has_attr(cx, struct_id, "unsafe_no_drop_flag");
 
@@ -4569,7 +4569,7 @@ pub fn lookup_field_type(tcx: &ctxt,
 pub fn lookup_struct_fields(cx: &ctxt, did: ast::DefId) -> Vec<field_ty> {
     if did.krate == ast::LOCAL_CRATE {
         let struct_fields = cx.struct_fields.borrow();
-        match struct_fields.find(&did) {
+        match struct_fields.get(&did) {
             Some(fields) => (**fields).clone(),
             _ => {
                 cx.sess.bug(
@@ -4632,7 +4632,7 @@ pub fn unboxed_closure_upvars(tcx: &ctxt, closure_id: ast::DefId, substs: &Subst
     // implemented.
     assert!(closure_id.krate == ast::LOCAL_CRATE);
     let capture_mode = tcx.capture_modes.borrow().get_copy(&closure_id.node);
-    match tcx.freevars.borrow().find(&closure_id.node) {
+    match tcx.freevars.borrow().get(&closure_id.node) {
         None => vec![],
         Some(ref freevars) => {
             freevars.iter().map(|freevar| {
@@ -4898,7 +4898,7 @@ fn push_region_bounds(region_bounds: &[ty::Region],
                           all_bounds: &mut Vec<ty::Region>) {
         all_bounds.push_all(region_bounds.as_slice());
 
-        if builtin_bounds.contains_elem(ty::BoundSend) {
+        if builtin_bounds.contains(&ty::BoundSend) {
             all_bounds.push(ty::ReStatic);
         }
     }
@@ -4921,7 +4921,7 @@ pub fn item_variances(tcx: &ctxt, item_id: ast::DefId) -> Rc<ItemVariances> {
 pub fn record_trait_implementation(tcx: &ctxt,
                                    trait_def_id: DefId,
                                    impl_def_id: DefId) {
-    match tcx.trait_impls.borrow().find(&trait_def_id) {
+    match tcx.trait_impls.borrow().get(&trait_def_id) {
         Some(impls_for_trait) => {
             impls_for_trait.borrow_mut().push(impl_def_id);
             return;
@@ -5094,7 +5094,7 @@ pub fn trait_of_item(tcx: &ctxt, def_id: ast::DefId) -> Option<ast::DefId> {
 /// Otherwise, return `None`.
 pub fn trait_item_of_item(tcx: &ctxt, def_id: ast::DefId)
                           -> Option<ImplOrTraitItemId> {
-    let impl_item = match tcx.impl_or_trait_items.borrow().find(&def_id) {
+    let impl_item = match tcx.impl_or_trait_items.borrow().get(&def_id) {
         Some(m) => m.clone(),
         None => return None,
     };
@@ -5449,7 +5449,7 @@ fn node_ty(&self, id: ast::NodeId) -> mc::McResult<ty::t> {
     }
 
     fn node_method_ty(&self, method_call: typeck::MethodCall) -> Option<ty::t> {
-        self.method_map.borrow().find(&method_call).map(|method| method.ty)
+        self.method_map.borrow().get(&method_call).map(|method| method.ty)
     }
 
     fn adjustments<'a>(&'a self) -> &'a RefCell<NodeMap<ty::AutoAdjustment>> {
@@ -5561,7 +5561,7 @@ pub struct Freevar {
 pub type CaptureModeMap = NodeMap<ast::CaptureClause>;
 
 pub fn with_freevars<T>(tcx: &ty::ctxt, fid: ast::NodeId, f: |&[Freevar]| -> T) -> T {
-    match tcx.freevars.borrow().find(&fid) {
+    match tcx.freevars.borrow().get(&fid) {
         None => f(&[]),
         Some(d) => f(d.as_slice())
     }
index 7c8d9309df3b823898f5328117a5991fb06cb9a1..32fd385aa5d023c9477323e35d6bc329ccea4c09 100644 (file)
@@ -99,7 +99,7 @@ fn associated_type_binding(&self,
 
 pub fn ast_region_to_region(tcx: &ty::ctxt, lifetime: &ast::Lifetime)
                             -> ty::Region {
-    let r = match tcx.named_region_map.find(&lifetime.id) {
+    let r = match tcx.named_region_map.get(&lifetime.id) {
         None => {
             // should have been recorded by the `resolve_lifetime` pass
             tcx.sess.span_bug(lifetime.span, "unresolved lifetime");
@@ -467,7 +467,7 @@ fn check_path_args(tcx: &ty::ctxt,
 pub fn ast_ty_to_prim_ty(tcx: &ty::ctxt, ast_ty: &ast::Ty) -> Option<ty::t> {
     match ast_ty.node {
         ast::TyPath(ref path, _, id) => {
-            let a_def = match tcx.def_map.borrow().find(&id) {
+            let a_def = match tcx.def_map.borrow().get(&id) {
                 None => {
                     tcx.sess.span_bug(ast_ty.span,
                                       format!("unbound path {}",
@@ -524,7 +524,7 @@ pub fn ast_ty_to_builtin_ty<'tcx, AC: AstConv<'tcx>, RS: RegionScope>(
 
     match ast_ty.node {
         ast::TyPath(ref path, _, id) => {
-            let a_def = match this.tcx().def_map.borrow().find(&id) {
+            let a_def = match this.tcx().def_map.borrow().get(&id) {
                 None => {
                     this.tcx()
                         .sess
@@ -675,7 +675,7 @@ fn mk_pointer<'tcx, AC: AstConv<'tcx>, RS: RegionScope>(
             // Note that the "bounds must be empty if path is not a trait"
             // restriction is enforced in the below case for ty_path, which
             // will run after this as long as the path isn't a trait.
-            match tcx.def_map.borrow().find(&id) {
+            match tcx.def_map.borrow().get(&id) {
                 Some(&def::DefPrimTy(ast::TyStr)) => {
                     check_path_args(tcx, path, NO_TPS | NO_REGIONS);
                     match ptr_ty {
@@ -802,7 +802,7 @@ pub fn ast_ty_to_ty<'tcx, AC: AstConv<'tcx>, RS: RegionScope>(
     let tcx = this.tcx();
 
     let mut ast_ty_to_ty_cache = tcx.ast_ty_to_ty_cache.borrow_mut();
-    match ast_ty_to_ty_cache.find(&ast_ty.id) {
+    match ast_ty_to_ty_cache.get(&ast_ty.id) {
         Some(&ty::atttce_resolved(ty)) => return ty,
         Some(&ty::atttce_unresolved) => {
             tcx.sess.span_fatal(ast_ty.span,
@@ -900,7 +900,7 @@ pub fn ast_ty_to_ty<'tcx, AC: AstConv<'tcx>, RS: RegionScope>(
                 ty::mk_err()
             }
             ast::TyPath(ref path, ref bounds, id) => {
-                let a_def = match tcx.def_map.borrow().find(&id) {
+                let a_def = match tcx.def_map.borrow().get(&id) {
                     None => {
                         tcx.sess
                            .span_bug(ast_ty.span,
@@ -990,7 +990,7 @@ pub fn ast_ty_to_ty<'tcx, AC: AstConv<'tcx>, RS: RegionScope>(
                 }
             }
             ast::TyQPath(ref qpath) => {
-                match tcx.def_map.borrow().find(&ast_ty.id) {
+                match tcx.def_map.borrow().get(&ast_ty.id) {
                     None => {
                         tcx.sess.span_bug(ast_ty.span,
                                           "unbound qualified path")
@@ -1549,7 +1549,7 @@ pub fn partition_bounds<'a>(tcx: &ty::ctxt,
             ast::TraitTyParamBound(ref b) => {
                 match lookup_def_tcx(tcx, b.path.span, b.ref_id) {
                     def::DefTrait(trait_did) => {
-                        match trait_def_ids.find(&trait_did) {
+                        match trait_def_ids.get(&trait_did) {
                             // Already seen this trait. We forbid
                             // duplicates in the list (for some
                             // reason).
index a686a5e72a0a7cafcbca071db595c5ba8ebc091c..7070f16da3bfd25e18eee82ff37018050bc30a86 100644 (file)
@@ -324,7 +324,7 @@ pub fn check_pat_struct(pcx: &pat_ctxt, pat: &ast::Pat,
 
     let item_substs = fcx
         .item_substs()
-        .find(&pat.id)
+        .get(&pat.id)
         .map(|substs| substs.substs.clone())
         .unwrap_or_else(|| Substs::empty());
 
index f854bc52acd7b3a009c4f230f58ff527f8b5483b..557b92d439d917a6081da56ae3a559015d490ddc 100644 (file)
@@ -678,7 +678,7 @@ fn push_extension_candidates(&mut self, expr_id: ast::NodeId) {
         debug!("push_extension_candidates(expr_id={})", expr_id);
 
         let mut duplicates = HashSet::new();
-        let opt_applicable_traits = self.fcx.ccx.trait_map.find(&expr_id);
+        let opt_applicable_traits = self.fcx.ccx.trait_map.get(&expr_id);
         for applicable_traits in opt_applicable_traits.into_iter() {
             for &trait_did in applicable_traits.iter() {
                 if duplicates.insert(trait_did) {
@@ -912,7 +912,7 @@ fn push_inherent_impl_candidates_for_type(&mut self, did: DefId) {
         // metadata if necessary.
         ty::populate_implementations_for_type_if_necessary(self.tcx(), did);
 
-        for impl_infos in self.tcx().inherent_impls.borrow().find(&did).iter() {
+        for impl_infos in self.tcx().inherent_impls.borrow().get(&did).iter() {
             for impl_did in impl_infos.iter() {
                 self.push_candidates_from_inherent_impl(*impl_did);
             }
@@ -1627,7 +1627,7 @@ fn fixup_derefs_on_method_receiver_if_necessary(&self,
                                             .inh
                                             .adjustments
                                             .borrow()
-                                            .find(&expr.id) {
+                                            .get(&expr.id) {
                 Some(&ty::AdjustDerefRef(ty::AutoDerefRef {
                     autoderefs: autoderef_count,
                     autoref: _
@@ -1658,7 +1658,7 @@ fn fixup_derefs_on_method_receiver_if_necessary(&self,
                 match expr.node {
                     ast::ExprIndex(ref base_expr, _) => {
                         let mut base_adjustment =
-                            match self.fcx.inh.adjustments.borrow().find(&base_expr.id) {
+                            match self.fcx.inh.adjustments.borrow().get(&base_expr.id) {
                                 Some(&ty::AdjustDerefRef(ref adr)) => (*adr).clone(),
                                 None => ty::AutoDerefRef { autoderefs: 0, autoref: None },
                                 Some(_) => {
@@ -1839,7 +1839,7 @@ fn impl_method(tcx: &ty::ctxt,
                -> Option<Rc<ty::Method>>
 {
     let impl_items = tcx.impl_items.borrow();
-    let impl_items = impl_items.find(&impl_def_id).unwrap();
+    let impl_items = impl_items.get(&impl_def_id).unwrap();
     impl_items
         .iter()
         .map(|&did| ty::impl_or_trait_item(tcx, did.def_id()))
index bcb875a6aa830de52350c615ddf051b11c8858cf..b83c81cd9863068294d145211facef3948576847 100644 (file)
@@ -298,7 +298,7 @@ fn node_ty(&self, id: ast::NodeId) -> McResult<ty::t> {
     }
     fn node_method_ty(&self, method_call: typeck::MethodCall)
                       -> Option<ty::t> {
-        self.inh.method_map.borrow().find(&method_call).map(|m| m.ty)
+        self.inh.method_map.borrow().get(&method_call).map(|m| m.ty)
     }
     fn adjustments<'a>(&'a self) -> &'a RefCell<NodeMap<ty::AutoAdjustment>> {
         &self.inh.adjustments
@@ -1556,7 +1556,7 @@ pub fn tag(&self) -> String {
     }
 
     pub fn local_ty(&self, span: Span, nid: ast::NodeId) -> ty::t {
-        match self.inh.locals.borrow().find(&nid) {
+        match self.inh.locals.borrow().get(&nid) {
             Some(&t) => t,
             None => {
                 self.tcx().sess.span_bug(
@@ -1808,7 +1808,7 @@ pub fn pat_to_string(&self, pat: &ast::Pat) -> String {
     }
 
     pub fn expr_ty(&self, ex: &ast::Expr) -> ty::t {
-        match self.inh.node_types.borrow().find(&ex.id) {
+        match self.inh.node_types.borrow().get(&ex.id) {
             Some(&t) => t,
             None => {
                 self.tcx().sess.bug(format!("no type for expr in fcx {}",
@@ -1824,7 +1824,7 @@ pub fn expr_ty_adjusted(&self, expr: &ast::Expr) -> ty::t {
          */
 
         let adjustments = self.inh.adjustments.borrow();
-        let adjustment = adjustments.find(&expr.id);
+        let adjustment = adjustments.get(&expr.id);
         self.adjust_expr_ty(expr, adjustment)
     }
 
@@ -1845,12 +1845,12 @@ pub fn adjust_expr_ty(&self,
                       raw_ty,
                       adjustment,
                       |method_call| self.inh.method_map.borrow()
-                                                       .find(&method_call)
+                                                       .get(&method_call)
                                                        .map(|method| method.ty))
     }
 
     pub fn node_ty(&self, id: ast::NodeId) -> ty::t {
-        match self.inh.node_types.borrow().find(&id) {
+        match self.inh.node_types.borrow().get(&id) {
             Some(&t) => t,
             None => {
                 self.tcx().sess.bug(
@@ -1868,7 +1868,7 @@ pub fn item_substs<'a>(&'a self) -> Ref<'a, NodeMap<ty::ItemSubsts>> {
     pub fn opt_node_ty_substs(&self,
                               id: ast::NodeId,
                               f: |&ty::ItemSubsts|) {
-        match self.inh.item_substs.borrow().find(&id) {
+        match self.inh.item_substs.borrow().get(&id) {
             Some(s) => { f(s) }
             None => { }
         }
@@ -3554,7 +3554,7 @@ fn check_expr_fn(fcx: &FnCtxt,
                     let (bounds, onceness) = match expr.node {
                         ast::ExprProc(..) => {
                             let mut bounds = ty::region_existential_bound(ty::ReStatic);
-                            bounds.builtin_bounds.add(ty::BoundSend); // FIXME
+                            bounds.builtin_bounds.insert(ty::BoundSend); // FIXME
                             (bounds, ast::Once)
                         }
                         _ => {
@@ -3763,7 +3763,7 @@ fn check_struct_or_variant_fields(fcx: &FnCtxt,
         for field in ast_fields.iter() {
             let mut expected_field_type = ty::mk_err();
 
-            let pair = class_field_map.find(&field.ident.node.name).map(|x| *x);
+            let pair = class_field_map.get(&field.ident.node.name).map(|x| *x);
             match pair {
                 None => {
                     fcx.type_error_message(
@@ -4422,7 +4422,7 @@ fn check_struct_fields_on_error(fcx: &FnCtxt,
       }
       ast::ExprStruct(ref path, ref fields, ref base_expr) => {
         // Resolve the path.
-        let def = tcx.def_map.borrow().find(&id).map(|i| *i);
+        let def = tcx.def_map.borrow().get(&id).map(|i| *i);
         let struct_id = match def {
             Some(def::DefVariant(enum_id, variant_id, true)) => {
                 check_struct_enum_variant(fcx, id, expr.span, enum_id,
@@ -5603,7 +5603,7 @@ pub fn may_break(cx: &ty::ctxt, id: ast::NodeId, b: &ast::Block) -> bool {
     (block_query(b, |e| {
         match e.node {
             ast::ExprBreak(Some(_)) => {
-                match cx.def_map.borrow().find(&e.id) {
+                match cx.def_map.borrow().get(&e.id) {
                     Some(&def::DefLabel(loop_id)) if id == loop_id => true,
                     _ => false,
                 }
index acc3cf0307b9655fcc1baf0e4b810299b46459b9..014180a11553ab93389e684b9854fa3eaf1c09ae 100644 (file)
@@ -327,7 +327,7 @@ fn resolve_node_type(&self, id: ast::NodeId) -> ty::t {
 
     fn resolve_method_type(&self, method_call: MethodCall) -> Option<ty::t> {
         let method_ty = self.fcx.inh.method_map.borrow()
-                            .find(&method_call).map(|method| method.ty);
+                            .get(&method_call).map(|method| method.ty);
         method_ty.map(|method_ty| self.resolve_type(method_ty))
     }
 
@@ -339,7 +339,7 @@ pub fn resolve_expr_type_adjusted(&mut self, expr: &ast::Expr) -> ty::t {
         } else {
             let tcx = self.fcx.tcx();
             ty::adjust_ty(tcx, expr.span, expr.id, ty_unadjusted,
-                          self.fcx.inh.adjustments.borrow().find(&expr.id),
+                          self.fcx.inh.adjustments.borrow().get(&expr.id),
                           |method_call| self.resolve_method_type(method_call))
         }
     }
@@ -351,7 +351,7 @@ fn visit_fn_body(&mut self,
         // When we enter a function, we can derive
 
         let fn_sig_map = self.fcx.inh.fn_sig_map.borrow();
-        let fn_sig = match fn_sig_map.find(&id) {
+        let fn_sig = match fn_sig_map.get(&id) {
             Some(f) => f,
             None => {
                 self.tcx().sess.bug(
@@ -370,7 +370,7 @@ fn visit_region_obligations(&mut self, node_id: ast::NodeId)
     {
         debug!("visit_region_obligations: node_id={}", node_id);
         let region_obligations = self.fcx.inh.region_obligations.borrow();
-        match region_obligations.find(&node_id) {
+        match region_obligations.get(&node_id) {
             None => { }
             Some(vec) => {
                 for r_o in vec.iter() {
@@ -594,7 +594,7 @@ fn visit_expr(rcx: &mut Rcx, expr: &ast::Expr) {
     let has_method_map = rcx.fcx.inh.method_map.borrow().contains_key(&method_call);
 
     // Check any autoderefs or autorefs that appear.
-    for &adjustment in rcx.fcx.inh.adjustments.borrow().find(&expr.id).iter() {
+    for &adjustment in rcx.fcx.inh.adjustments.borrow().get(&expr.id).iter() {
         debug!("adjustment={}", adjustment);
         match *adjustment {
             ty::AdjustDerefRef(ty::AutoDerefRef {autoderefs, autoref: ref opt_autoref}) => {
@@ -686,7 +686,7 @@ fn visit_expr(rcx: &mut Rcx, expr: &ast::Expr) {
         ast::ExprUnary(ast::UnDeref, ref base) => {
             // For *a, the lifetime of a must enclose the deref
             let method_call = MethodCall::expr(expr.id);
-            let base_ty = match rcx.fcx.inh.method_map.borrow().find(&method_call) {
+            let base_ty = match rcx.fcx.inh.method_map.borrow().get(&method_call) {
                 Some(method) => {
                     constrain_call(rcx, expr, Some(&**base),
                                    None::<ast::Expr>.iter(), true);
@@ -950,7 +950,7 @@ fn ensure_free_variable_types_outlive_closure_bound(
             let raw_var_ty = rcx.resolve_node_type(var_node_id);
             let upvar_id = ty::UpvarId { var_id: var_node_id,
                                          closure_expr_id: expr.id };
-            let var_ty = match rcx.fcx.inh.upvar_borrow_map.borrow().find(&upvar_id) {
+            let var_ty = match rcx.fcx.inh.upvar_borrow_map.borrow().get(&upvar_id) {
                 Some(upvar_borrow) => {
                     ty::mk_rptr(rcx.tcx(),
                                 upvar_borrow.region,
@@ -1195,7 +1195,7 @@ fn constrain_autoderefs(rcx: &mut Rcx,
                i, derefs);
 
         let method_call = MethodCall::autoderef(deref_expr.id, i);
-        derefd_ty = match rcx.fcx.inh.method_map.borrow().find(&method_call) {
+        derefd_ty = match rcx.fcx.inh.method_map.borrow().get(&method_call) {
             Some(method) => {
                 // Treat overloaded autoderefs as if an AutoRef adjustment
                 // was applied on the base type, as that is always the case.
@@ -1301,7 +1301,7 @@ fn type_of_node_must_outlive(
     // report errors later on in the writeback phase.
     let ty0 = rcx.resolve_node_type(id);
     let ty = ty::adjust_ty(tcx, origin.span(), id, ty0,
-                           rcx.fcx.inh.adjustments.borrow().find(&id),
+                           rcx.fcx.inh.adjustments.borrow().get(&id),
                            |method_call| rcx.resolve_method_type(method_call));
     debug!("constrain_regions_in_type_of_node(\
             ty={}, ty0={}, id={}, minimum_lifetime={})",
@@ -1582,7 +1582,7 @@ fn link_reborrowed_region(rcx: &Rcx,
         mc::NoteUpvarRef(ref upvar_id) => {
             let mut upvar_borrow_map =
                 rcx.fcx.inh.upvar_borrow_map.borrow_mut();
-            match upvar_borrow_map.find_mut(upvar_id) {
+            match upvar_borrow_map.get_mut(upvar_id) {
                 Some(upvar_borrow) => {
                     // Adjust mutability that we infer for the upvar
                     // so it can accommodate being borrowed with
@@ -1845,7 +1845,7 @@ fn link_upvar_borrow_kind_for_nested_closures(rcx: &mut Rcx,
 
     let mut upvar_borrow_map = rcx.fcx.inh.upvar_borrow_map.borrow_mut();
     let inner_borrow = upvar_borrow_map.get_copy(&inner_upvar_id);
-    match upvar_borrow_map.find_mut(&outer_upvar_id) {
+    match upvar_borrow_map.get_mut(&outer_upvar_id) {
         Some(outer_borrow) => {
             adjust_upvar_borrow_kind(rcx, outer_upvar_id, outer_borrow, inner_borrow.kind);
         }
index d011e807ce7dc61505f343220c51fdc40886fb2f..cf78ef1621986de1d57bf55e4d11f1caf581a713 100644 (file)
@@ -263,7 +263,7 @@ fn visit_node_id(&self, reason: ResolveReason, id: ast::NodeId) {
     }
 
     fn visit_adjustments(&self, reason: ResolveReason, id: ast::NodeId) {
-        match self.fcx.inh.adjustments.borrow_mut().pop(&id) {
+        match self.fcx.inh.adjustments.borrow_mut().remove(&id) {
             None => {
                 debug!("No adjustments for node {}", id);
             }
@@ -275,7 +275,7 @@ fn visit_adjustments(&self, reason: ResolveReason, id: ast::NodeId) {
                         // FIXME(eddyb) #2190 Allow only statically resolved
                         // bare functions to coerce to a closure to avoid
                         // constructing (slower) indirect call wrappers.
-                        match self.tcx().def_map.borrow().find(&id) {
+                        match self.tcx().def_map.borrow().get(&id) {
                             Some(&def::DefFn(..)) |
                             Some(&def::DefStaticMethod(..)) |
                             Some(&def::DefVariant(..)) |
@@ -320,7 +320,7 @@ fn visit_method_map_entry(&self,
                               reason: ResolveReason,
                               method_call: MethodCall) {
         // Resolve any method map entry
-        match self.fcx.inh.method_map.borrow_mut().pop(&method_call) {
+        match self.fcx.inh.method_map.borrow_mut().remove(&method_call) {
             Some(method) => {
                 debug!("writeback::resolve_method_map_entry(call={}, entry={})",
                        method_call,
index ac18f53de046599cc8ac9651e4c5a6e6ef3812ca..19ff82469b5155906df2bdadf2c473fc8e04d681 100644 (file)
@@ -294,7 +294,7 @@ fn instantiate_default_methods(
     }
 
     fn add_inherent_impl(&self, base_def_id: DefId, impl_def_id: DefId) {
-        match self.inherent_impls.borrow().find(&base_def_id) {
+        match self.inherent_impls.borrow().get(&base_def_id) {
             Some(implementation_list) => {
                 implementation_list.borrow_mut().push(impl_def_id);
                 return;
index ccfa31df8264674ec182c60cc272079fd8b4c00f..933c2c81ac269380b0ad7a04070ad31e00a7fdd2 100644 (file)
@@ -114,7 +114,7 @@ fn check_if_impls_overlap(&self,
     fn push_impls_of_trait(&self,
                            trait_def_id: ast::DefId,
                            out: &mut Vec<ast::DefId>) {
-        match self.tcx.trait_impls.borrow().find(&trait_def_id) {
+        match self.tcx.trait_impls.borrow().get(&trait_def_id) {
             Some(impls) => { out.push_all(impls.borrow().as_slice()); }
             None => { /* no impls */ }
         }
index 0374a64261f02b4bee370e730d42f65350039502..d137e5536a5ff661529e1fa6d0adb04b96030639 100644 (file)
@@ -1243,7 +1243,7 @@ pub fn convert_struct(ccx: &CrateCtxt,
         let result = convert_field(ccx, &pty.generics, f, local_def(id));
 
         if result.name != special_idents::unnamed_field.name {
-            let dup = match seen_fields.find(&result.name) {
+            let dup = match seen_fields.get(&result.name) {
                 Some(prev_span) => {
                     span_err!(tcx.sess, f.span, E0124,
                               "field `{}` is already declared",
@@ -1386,7 +1386,7 @@ fn get_trait_def(ccx: &CrateCtxt, trait_id: ast::DefId) -> Rc<ty::TraitDef> {
 pub fn trait_def_of_item(ccx: &CrateCtxt, it: &ast::Item) -> Rc<ty::TraitDef> {
     let def_id = local_def(it.id);
     let tcx = ccx.tcx;
-    match tcx.trait_defs.borrow().find(&def_id) {
+    match tcx.trait_defs.borrow().get(&def_id) {
         Some(def) => return def.clone(),
         _ => {}
     }
@@ -1486,7 +1486,7 @@ pub fn ty_of_item(ccx: &CrateCtxt, it: &ast::Item)
                   -> ty::Polytype {
     let def_id = local_def(it.id);
     let tcx = ccx.tcx;
-    match tcx.tcache.borrow().find(&def_id) {
+    match tcx.tcache.borrow().get(&def_id) {
         Some(pty) => return pty.clone(),
         _ => {}
     }
@@ -1528,7 +1528,7 @@ pub fn ty_of_item(ccx: &CrateCtxt, it: &ast::Item)
             return pty;
         }
         ast::ItemTy(ref t, ref generics) => {
-            match tcx.tcache.borrow_mut().find(&local_def(it.id)) {
+            match tcx.tcache.borrow_mut().get(&local_def(it.id)) {
                 Some(pty) => return pty.clone(),
                 None => { }
             }
@@ -1933,7 +1933,7 @@ fn get_or_create_type_parameter_def<'tcx,AC>(this: &AC,
                                              -> ty::TypeParameterDef
     where AC: AstConv<'tcx>
 {
-    match this.tcx().ty_param_defs.borrow().find(&param.id) {
+    match this.tcx().ty_param_defs.borrow().get(&param.id) {
         Some(d) => { return (*d).clone(); }
         None => { }
     }
@@ -2027,13 +2027,13 @@ fn check_bounds_compatible(tcx: &ty::ctxt,
                            span: Span) {
     // Currently the only bound which is incompatible with other bounds is
     // Sized/Unsized.
-    if !param_bounds.builtin_bounds.contains_elem(ty::BoundSized) {
+    if !param_bounds.builtin_bounds.contains(&ty::BoundSized) {
         ty::each_bound_trait_and_supertraits(
             tcx,
             param_bounds.trait_bounds.as_slice(),
             |trait_ref| {
                 let trait_def = ty::lookup_trait_def(tcx, trait_ref.def_id);
-                if trait_def.bounds.builtin_bounds.contains_elem(ty::BoundSized) {
+                if trait_def.bounds.builtin_bounds.contains(&ty::BoundSized) {
                     span_err!(tcx.sess, span, E0129,
                               "incompatible bounds on type parameter `{}`, \
                                bound `{}` does not allow unsized type",
@@ -2136,7 +2136,7 @@ fn merge_param_bounds<'a>(tcx: &ty::ctxt,
         let predicate_param_id =
             tcx.def_map
                .borrow()
-               .find(&predicate.id)
+               .get(&predicate.id)
                .expect("compute_bounds(): resolve didn't resolve the type \
                         parameter identifier in a `where` clause")
                .def_id();
index bfa0f94a74751d466da59005e3294b4afcedcf4c..20c14580b3bee7991001de6dc4adfb8bd2931a85 100644 (file)
@@ -1240,7 +1240,7 @@ fn rebuild_arg_ty_or_output(&self,
                     ty_queue.push(&*mut_ty.ty);
                 }
                 ast::TyPath(ref path, ref bounds, id) => {
-                    let a_def = match self.tcx.def_map.borrow().find(&id) {
+                    let a_def = match self.tcx.def_map.borrow().get(&id) {
                         None => {
                             self.tcx
                                 .sess
index cdc45890c09ea71d9df79ea44fe2572639970760..70c4a245b2c269fa1e667d90e69605d90ff9e96f 100644 (file)
@@ -367,7 +367,7 @@ fn add_constraint(&self,
         debug!("RegionVarBindings: add_constraint({})",
                constraint.repr(self.tcx));
 
-        if self.constraints.borrow_mut().insert(constraint, origin) {
+        if self.constraints.borrow_mut().insert(constraint, origin).is_none() {
             if self.in_snapshot() {
                 self.undo_log.borrow_mut().push(AddConstraint(constraint));
             }
@@ -559,7 +559,7 @@ pub fn combine_vars(&self,
                                  new_r: Region|)
                         -> Region {
         let vars = TwoRegions { a: a, b: b };
-        match self.combine_map(t).borrow().find(&vars) {
+        match self.combine_map(t).borrow().get(&vars) {
             Some(&c) => {
                 return ReInfer(ReVar(c));
             }
@@ -991,7 +991,7 @@ fn expansion(&self, var_data: &mut [VarData]) {
             debug!("expansion: constraint={} origin={}",
                    constraint.repr(self.tcx),
                    self.constraints.borrow()
-                                   .find(constraint)
+                                   .get(constraint)
                                    .unwrap()
                                    .repr(self.tcx));
             match *constraint {
@@ -1075,7 +1075,7 @@ fn contraction(&self,
             debug!("contraction: constraint={} origin={}",
                    constraint.repr(self.tcx),
                    self.constraints.borrow()
-                                   .find(constraint)
+                                   .get(constraint)
                                    .unwrap()
                                    .repr(self.tcx));
             match *constraint {
index f44fa1ac1c69689272482f0e9b8472428a071823..d2f315f2a4b608a13f0aeb5271b0e6db79a1cd8c 100644 (file)
@@ -113,7 +113,7 @@ fn builtin_bounds(&self, a: BuiltinBounds, b: BuiltinBounds)
         // e.g., fn:Copy() <: fn(), because the former is a function
         // that only closes over copyable things, but the latter is
         // any function at all.
-        if a.contains(b) {
+        if a.is_superset(&b) {
             Ok(a)
         } else {
             Err(ty::terr_builtin_bounds(expected_found(self, a, b)))
index 22898221d9b53468a5839592dbafd2e7e9b6b748..5ca0de47ad500b7dc5910e835ce34ffea590fbee 100644 (file)
@@ -301,7 +301,7 @@ pub fn write_substs_to_tcx(tcx: &ty::ctxt,
     }
 }
 pub fn lookup_def_tcx(tcx:&ty::ctxt, sp: Span, id: ast::NodeId) -> def::Def {
-    match tcx.def_map.borrow().find(&id) {
+    match tcx.def_map.borrow().get(&id) {
         Some(x) => x.clone(),
         _ => {
             tcx.sess.span_fatal(sp, "internal error looking up a definition")
index 9a90381854a6ce62050f33b74f8b9b91cd01fcf4..4227cc521b48b8d95bb2cba7cd97c7d4691b408e 100644 (file)
@@ -322,7 +322,7 @@ fn add_inferred(&mut self,
                                                 index: index,
                                                 param_id: param_id,
                                                 term: term });
-        let newly_added = self.inferred_map.insert(param_id, inf_index);
+        let newly_added = self.inferred_map.insert(param_id, inf_index).is_none();
         assert!(newly_added);
 
         debug!("add_inferred(item_id={}, \
@@ -376,7 +376,7 @@ fn visit_item(&mut self, item: &ast::Item) {
                 if self.num_inferred() == inferreds_on_entry {
                     let newly_added = self.tcx.item_variance_map.borrow_mut().insert(
                         ast_util::local_def(item.id),
-                        self.empty_variances.clone());
+                        self.empty_variances.clone()).is_none();
                     assert!(newly_added);
                 }
 
@@ -556,7 +556,7 @@ fn tcx(&self) -> &'a ty::ctxt<'tcx> {
     }
 
     fn inferred_index(&self, param_id: ast::NodeId) -> InferredIndex {
-        match self.terms_cx.inferred_map.find(&param_id) {
+        match self.terms_cx.inferred_map.get(&param_id) {
             Some(&index) => index,
             None => {
                 self.tcx().sess.bug(format!(
@@ -569,7 +569,7 @@ fn inferred_index(&self, param_id: ast::NodeId) -> InferredIndex {
     fn find_binding_for_lifetime(&self, param_id: ast::NodeId) -> ast::NodeId {
         let tcx = self.terms_cx.tcx;
         assert!(is_lifetime(&tcx.map, param_id));
-        match tcx.named_region_map.find(&param_id) {
+        match tcx.named_region_map.get(&param_id) {
             Some(&rl::DefEarlyBoundRegion(_, _, lifetime_decl_id))
                 => lifetime_decl_id,
             Some(_) => panic!("should not encounter non early-bound cases"),
@@ -810,7 +810,7 @@ fn add_constraints_from_ty(&mut self,
 
             ty::ty_param(ty::ParamTy { ref def_id, .. }) => {
                 assert_eq!(def_id.krate, ast::LOCAL_CRATE);
-                match self.terms_cx.inferred_map.find(&def_id.node) {
+                match self.terms_cx.inferred_map.get(&def_id.node) {
                     Some(&index) => {
                         self.add_constraint(index, variance);
                     }
@@ -1060,7 +1060,7 @@ fn write(&self) {
             }
 
             let newly_added = tcx.item_variance_map.borrow_mut()
-                                 .insert(item_def_id, Rc::new(item_variances));
+                                 .insert(item_def_id, Rc::new(item_variances)).is_none();
             assert!(newly_added);
         }
     }
index cf807cb22bc2a61443f84ac3f079b0ca66328560..577d92744e6dcc7cbbe1c0de9cd2d31d1b24e3cf 100644 (file)
@@ -139,7 +139,7 @@ pub fn can_reach<S,H:Hasher<S>,T:Eq+Clone+Hash<S>>(
     let mut queue = vec!(source);
     let mut i = 0;
     while i < queue.len() {
-        match edges_map.find(&queue[i]) {
+        match edges_map.get(&queue[i]) {
             Some(edges) => {
                 for target in edges.iter() {
                     if *target == destination {
@@ -200,7 +200,7 @@ pub fn memoized_with_key<T, K: Hash<S> + Eq, U: Clone, S, H: Hasher<S>>(
     k: |&T| -> K
 ) -> U {
     let key = k(&arg);
-    let result = cache.borrow().find(&key).map(|result| result.clone());
+    let result = cache.borrow().get(&key).map(|result| result.clone());
     match result {
         Some(result) => result,
         None => {
index 33e1419753249453245ad72a3fa9adc5edd23b8f..9080b12c5436abfb0f701ad684a2cddfbfd48b57 100644 (file)
@@ -451,7 +451,7 @@ fn infer_ty_to_string(cx: &ctxt, ty: ty::InferTy) -> String {
         ty_str => "str".to_string(),
         ty_unboxed_closure(ref did, _, ref substs) => {
             let unboxed_closures = cx.unboxed_closures.borrow();
-            unboxed_closures.find(did).map(|cl| {
+            unboxed_closures.get(did).map(|cl| {
                 closure_to_string(cx, &cl.closure_type.subst(cx, substs))
             }).unwrap_or_else(|| "closure".to_string())
         }
@@ -1108,7 +1108,7 @@ fn user_string(&self, tcx: &ctxt) -> String {
 
 impl UserString for ty::ExistentialBounds {
     fn user_string(&self, tcx: &ctxt) -> String {
-        if self.builtin_bounds.contains_elem(ty::BoundSend) &&
+        if self.builtin_bounds.contains(&ty::BoundSend) &&
             self.region_bound == ty::ReStatic
         { // Region bound is implied by builtin bounds:
             return self.builtin_bounds.repr(tcx);
@@ -1277,7 +1277,7 @@ impl UserString for ParamTy {
     fn user_string(&self, tcx: &ctxt) -> String {
         let id = self.idx;
         let did = self.def_id;
-        let ident = match tcx.ty_param_defs.borrow().find(&did.node) {
+        let ident = match tcx.ty_param_defs.borrow().get(&did.node) {
             Some(def) => token::get_name(def.name).get().to_string(),
 
             // This can only happen when a type mismatch error happens and
index d87d8776d4a6cecb27236f3b858b09789d0013ee..545eeaf7406f3ac2be65dedff537312ec77f9f4f 100644 (file)
@@ -45,7 +45,7 @@ pub fn try_inline(cx: &DocContext, id: ast::NodeId, into: Option<ast::Ident>)
         Some(tcx) => tcx,
         None => return None,
     };
-    let def = match tcx.def_map.borrow().find(&id) {
+    let def = match tcx.def_map.borrow().get(&id) {
         Some(def) => *def,
         None => return None,
     };
@@ -223,7 +223,7 @@ fn build_impls(cx: &DocContext, tcx: &ty::ctxt,
     ty::populate_implementations_for_type_if_necessary(tcx, did);
     let mut impls = Vec::new();
 
-    match tcx.inherent_impls.borrow().find(&did) {
+    match tcx.inherent_impls.borrow().get(&did) {
         None => {}
         Some(i) => {
             impls.extend(i.iter().map(|&did| { build_impl(cx, tcx, did) }));
index f96b3916f06dee31cdf5a2f6ae16b2f4a680ac8f..bd6c696ad74606f3e69ec082df94bf1257c80a96 100644 (file)
@@ -1395,7 +1395,7 @@ fn clean(&self, cx: &DocContext) -> Item {
         let (name, attrs) = if self.name == unnamed_field.name {
             (None, None)
         } else {
-            (Some(self.name), Some(attr_map.find(&self.id.node).unwrap()))
+            (Some(self.name), Some(attr_map.get(&self.id.node).unwrap()))
         };
 
         let ty = ty::lookup_item_type(cx.tcx(), self.id);
@@ -2090,7 +2090,7 @@ fn resolve_type(cx: &DocContext, path: Path,
         None => return Primitive(Bool),
     };
     debug!("searching for {} in defmap", id);
-    let def = match tcx.def_map.borrow().find(&id) {
+    let def = match tcx.def_map.borrow().get(&id) {
         Some(&k) => k,
         None => panic!("unresolved id not in defmap")
     };
@@ -2159,7 +2159,7 @@ fn resolve_use_source(cx: &DocContext, path: Path, id: ast::NodeId) -> ImportSou
 
 fn resolve_def(cx: &DocContext, id: ast::NodeId) -> Option<ast::DefId> {
     cx.tcx_opt().and_then(|tcx| {
-        tcx.def_map.borrow().find(&id).map(|&def| register_def(cx, def))
+        tcx.def_map.borrow().get(&id).map(|&def| register_def(cx, def))
     })
 }
 
index f9177c8d61578797a79a5af5f234f287edcb591c..320f84adea7a17325041dff293ea94de0376e5f2 100644 (file)
@@ -208,7 +208,7 @@ fn resolved_path(w: &mut fmt::Formatter, did: ast::DefId, p: &clean::Path,
             }
         },
         |cache| {
-            match cache.paths.find(&did) {
+            match cache.paths.get(&did) {
                 None => None,
                 Some(&(ref fqp, shortty)) => Some((fqp.clone(), shortty))
             }
@@ -313,7 +313,7 @@ fn primitive_link(f: &mut fmt::Formatter,
                   name: &str) -> fmt::Result {
     let m = cache_key.get().unwrap();
     let mut needs_termination = false;
-    match m.primitive_locations.find(&prim) {
+    match m.primitive_locations.get(&prim) {
         Some(&ast::LOCAL_CRATE) => {
             let loc = current_location_key.get().unwrap();
             let len = if loc.len() == 0 {0} else {loc.len() - 1};
index 3f1590773aa7c06ded09286bc1af43d00f9b3877..9dacee1652a4a235f4f4c997d19305dc44a46813 100644 (file)
@@ -242,7 +242,7 @@ pub fn render(w: &mut fmt::Formatter, s: &str, print_toc: bool) -> fmt::Result {
 
         // Make sure our hyphenated ID is unique for this page
         let map = used_header_map.get().unwrap();
-        let id = match map.borrow_mut().find_mut(&id) {
+        let id = match map.borrow_mut().get_mut(&id) {
             None => id,
             Some(a) => { *a += 1; format!("{}-{}", id, *a - 1) }
         };
index 9af2b22adea455c1392769e395a9db701e347c88..fbd2611acb92d444e8f6c49002917e08e4d2e8d9 100644 (file)
@@ -389,7 +389,7 @@ fn build_index(krate: &clean::Crate, cache: &mut Cache) -> io::IoResult<String>
         // has since been learned.
         for &(pid, ref item) in orphan_methods.iter() {
             let did = ast_util::local_def(pid);
-            match paths.find(&did) {
+            match paths.get(&did) {
                 Some(&(ref fqp, _)) => {
                     search_index.push(IndexItem {
                         ty: shortty(item),
@@ -443,7 +443,7 @@ fn build_index(krate: &clean::Crate, cache: &mut Cache) -> io::IoResult<String>
                     item.desc.to_json().to_string()));
         match item.parent {
             Some(nodeid) => {
-                let pathid = *nodeid_to_pathid.find(&nodeid).unwrap();
+                let pathid = *nodeid_to_pathid.get(&nodeid).unwrap();
                 try!(write!(&mut w, ",{}", pathid));
             }
             None => {}
@@ -454,7 +454,7 @@ fn build_index(krate: &clean::Crate, cache: &mut Cache) -> io::IoResult<String>
     try!(write!(&mut w, r#"],"paths":["#));
 
     for (i, &did) in pathid_to_nodeid.iter().enumerate() {
-        let &(ref fqp, short) = cache.paths.find(&did).unwrap();
+        let &(ref fqp, short) = cache.paths.get(&did).unwrap();
         if i > 0 {
             try!(write!(&mut w, ","));
         }
@@ -543,7 +543,7 @@ fn collect(path: &Path, krate: &str,
         //
         // FIXME: this is a vague explanation for why this can't be a `get`, in
         //        theory it should be...
-        let &(ref remote_path, remote_item_type) = match cache.paths.find(&did) {
+        let &(ref remote_path, remote_item_type) = match cache.paths.get(&did) {
             Some(p) => p,
             None => continue,
         };
@@ -838,7 +838,7 @@ fn fold_item(&mut self, item: clean::Item) -> Option<clean::Item> {
                         } else {
                             let last = self.parent_stack.last().unwrap();
                             let did = *last;
-                            let path = match self.paths.find(&did) {
+                            let path = match self.paths.get(&did) {
                                 Some(&(_, item_type::Trait)) =>
                                     Some(self.stack[..self.stack.len() - 1]),
                                 // The current stack not necessarily has correlation for
@@ -1170,7 +1170,7 @@ fn render(w: io::File, cx: &Context, it: &clean::Item,
                                     &Item{ cx: cx, item: it }));
             } else {
                 let mut url = "../".repeat(cx.current.len());
-                match cache_key.get().unwrap().paths.find(&it.def_id) {
+                match cache_key.get().unwrap().paths.get(&it.def_id) {
                     Some(&(ref names, _)) => {
                         for name in names[..names.len() - 1].iter() {
                             url.push_str(name.as_slice());
@@ -1735,7 +1735,7 @@ fn trait_item(w: &mut fmt::Formatter, m: &clean::TraitMethod)
         <h2 id='implementors'>Implementors</h2>
         <ul class='item-list' id='implementors-list'>
     "));
-    match cache.implementors.find(&it.def_id) {
+    match cache.implementors.get(&it.def_id) {
         Some(implementors) => {
             for i in implementors.iter() {
                 try!(writeln!(w, "<li>{}<code>impl{} {} for {}{}</code></li>",
@@ -1992,7 +1992,7 @@ fn render_struct(w: &mut fmt::Formatter, it: &clean::Item,
 }
 
 fn render_methods(w: &mut fmt::Formatter, it: &clean::Item) -> fmt::Result {
-    match cache_key.get().unwrap().impls.find(&it.def_id) {
+    match cache_key.get().unwrap().impls.get(&it.def_id) {
         Some(v) => {
             let (non_trait, traits) = v.partitioned(|i| i.impl_.trait_.is_none());
             if non_trait.len() > 0 {
@@ -2080,7 +2080,7 @@ fn render_default_methods(w: &mut fmt::Formatter,
     match i.impl_.trait_ {
         Some(clean::ResolvedPath { did, .. }) => {
             try!({
-                match cache_key.get().unwrap().traits.find(&did) {
+                match cache_key.get().unwrap().traits.get(&did) {
                     Some(t) => try!(render_default_methods(w, t, &i.impl_)),
                     None => {}
                 }
index bd3c618a5ed46149b2075c7ed319ddc38a24b3b9..5e2f56e00fc0db828fd0f4b45fc33694004d12a1 100644 (file)
@@ -417,7 +417,7 @@ fn json_input(input: &str) -> Result<Output, String> {
         Ok(json::Object(obj)) => {
             let mut obj = obj;
             // Make sure the schema is what we expect
-            match obj.pop(&"schema".to_string()) {
+            match obj.remove(&"schema".to_string()) {
                 Some(json::String(version)) => {
                     if version.as_slice() != SCHEMA_VERSION {
                         return Err(format!(
@@ -428,7 +428,7 @@ fn json_input(input: &str) -> Result<Output, String> {
                 Some(..) => return Err("malformed json".to_string()),
                 None => return Err("expected a schema version".to_string()),
             }
-            let krate = match obj.pop(&"crate".to_string()) {
+            let krate = match obj.remove(&"crate".to_string()) {
                 Some(json) => {
                     let mut d = json::Decoder::new(json);
                     Decodable::decode(&mut d).unwrap()
index 7129f14720911f8cbaa2b0f588b305349558fa23..4a16bcf939e7b32ebed586f223cacbf0bc4c9bf7 100644 (file)
@@ -186,7 +186,7 @@ pub fn replace(&'static self, data: Option<T>) -> Option<T> {
 
         // The following match takes a mutable borrow on the map. In order to insert
         // our data if the key isn't present, we need to let the match end first.
-        let data = match (map.find_mut(&keyval), data) {
+        let data = match (map.get_mut(&keyval), data) {
             (None, Some(data)) => {
                 // The key doesn't exist and we need to insert it. To make borrowck
                 // happy, return it up a scope and insert it there.
@@ -266,7 +266,7 @@ pub fn get(&'static self) -> Option<Ref<T>> {
         };
         let keyval = key_to_key_value(self);
 
-        match map.find(&keyval) {
+        match map.get(&keyval) {
             Some(slot) => {
                 let value_box = slot.box_ptr as *mut TLDValueBox<T>;
                 if unsafe { *(*value_box).refcount.get() } >= 1 {
index 79166935a5e7f4764a8c0a17f783773e8bc7269e..d2d1f5fa8b091e90c74ba82475521c45e1d972b1 100644 (file)
@@ -39,7 +39,7 @@ fn decode(d: &mut D) -> Result<DList<T>, E> {
         d.read_seq(|d, len| {
             let mut list = DList::new();
             for i in range(0u, len) {
-                list.push(try!(d.read_seq_elt(i, |d| Decodable::decode(d))));
+                list.push_back(try!(d.read_seq_elt(i, |d| Decodable::decode(d))));
             }
             Ok(list)
         })
@@ -66,7 +66,7 @@ fn decode(d: &mut D) -> Result<RingBuf<T>, E> {
         d.read_seq(|d, len| {
             let mut deque: RingBuf<T> = RingBuf::new();
             for i in range(0u, len) {
-                deque.push(try!(d.read_seq_elt(i, |d| Decodable::decode(d))));
+                deque.push_back(try!(d.read_seq_elt(i, |d| Decodable::decode(d))));
             }
             Ok(deque)
         })
@@ -165,10 +165,10 @@ impl<
 > Decodable<D, E> for EnumSet<T> {
     fn decode(d: &mut D) -> Result<EnumSet<T>, E> {
         let bits = try!(d.read_uint());
-        let mut set = EnumSet::empty();
+        let mut set = EnumSet::new();
         for bit in range(0, uint::BITS) {
             if bits & (1 << bit) != 0 {
-                set.add(CLike::from_uint(1 << bit));
+                set.insert(CLike::from_uint(1 << bit));
             }
         }
         Ok(set)
index dbdfa17bfc2285198d67b38f2b9de1a1f26d8797..9f40cd2d277e74bd41f6b2be7bae95039c799018 100644 (file)
@@ -2113,7 +2113,7 @@ fn read_enum_variant<T>(&mut self,
         let name = match self.pop() {
             String(s) => s,
             Object(mut o) => {
-                let n = match o.pop(&"variant".to_string()) {
+                let n = match o.remove(&"variant".to_string()) {
                     Some(String(s)) => s,
                     Some(val) => {
                         return Err(ExpectedError("String".to_string(), format!("{}", val)))
@@ -2122,7 +2122,7 @@ fn read_enum_variant<T>(&mut self,
                         return Err(MissingFieldError("variant".to_string()))
                     }
                 };
-                match o.pop(&"fields".to_string()) {
+                match o.remove(&"fields".to_string()) {
                     Some(List(l)) => {
                         for field in l.into_iter().rev() {
                             self.stack.push(field);
@@ -2192,7 +2192,7 @@ fn read_struct_field<T>(&mut self,
         debug!("read_struct_field(name={}, idx={})", name, idx);
         let mut obj = try!(expect!(self.pop(), Object));
 
-        let value = match obj.pop(&name.to_string()) {
+        let value = match obj.remove(&name.to_string()) {
             None => {
                 // Add a Null and try to parse it as an Option<_>
                 // to get None as a default value.
@@ -3072,8 +3072,8 @@ fn test_decode_map() {
                   \"fields\":[\"Henry\", 349]}}";
         let mut map: TreeMap<string::String, Animal> = super::decode(s).unwrap();
 
-        assert_eq!(map.pop(&"a".to_string()), Some(Dog));
-        assert_eq!(map.pop(&"b".to_string()), Some(Frog("Henry".to_string(), 349)));
+        assert_eq!(map.remove(&"a".to_string()), Some(Dog));
+        assert_eq!(map.remove(&"b".to_string()), Some(Frog("Henry".to_string(), 349)));
     }
 
     #[test]
index ebf541a63dafaa1d0d347712cf5fd878e83a29ff..0e75e4610abf98e13b32767062892a4ccf54e52f 100644 (file)
@@ -627,7 +627,7 @@ fn read_byte(&mut self) -> IoResult<u8> {
     /// as `Err(IoError)`. See `read()` for more details.
     fn push(&mut self, len: uint, buf: &mut Vec<u8>) -> IoResult<uint> {
         let start_len = buf.len();
-        buf.reserve_additional(len);
+        buf.reserve(len);
 
         let n = {
             let s = unsafe { slice_vec_capacity(buf, start_len, start_len + len) };
@@ -658,7 +658,7 @@ fn push_at_least(&mut self, min: uint, len: uint, buf: &mut Vec<u8>) -> IoResult
         }
 
         let start_len = buf.len();
-        buf.reserve_additional(len);
+        buf.reserve(len);
 
         // we can't just use self.read_at_least(min, slice) because we need to push
         // successful reads onto the vector before any returned errors.
index 493e1b559d7b7d823c11eb186f8c831d6a522c5f..698e0a3460f2878946a6b11bc9e59c9b54a53e52 100644 (file)
@@ -1137,7 +1137,7 @@ fn env_map_keys_ci() {
         cmd.env("path", "foo");
         cmd.env("Path", "bar");
         let env = &cmd.env.unwrap();
-        let val = env.find(&EnvKey("PATH".to_c_str()));
+        let val = env.get(&EnvKey("PATH".to_c_str()));
         assert!(val.unwrap() == &"bar".to_c_str());
     }
 }
index d9d549f6841252da37ef21ac3ec76e2565f0bfe1..d077fbd7bf00f58cdfec3bd8098c9248a723d623 100644 (file)
@@ -63,7 +63,7 @@ pub fn expand_diagnostic_used<'cx>(ecx: &'cx mut ExtCtxt,
         ()
     });
     with_used_diagnostics(|diagnostics| {
-        match diagnostics.swap(code.name, span) {
+        match diagnostics.insert(code.name, span) {
             Some(previous_span) => {
                 ecx.span_warn(span, format!(
                     "diagnostic code {} already used", token::get_ident(code).get()
@@ -93,7 +93,7 @@ pub fn expand_register_diagnostic<'cx>(ecx: &'cx mut ExtCtxt,
         _ => unreachable!()
     };
     with_registered_diagnostics(|diagnostics| {
-        if !diagnostics.insert(code.name, description) {
+        if diagnostics.insert(code.name, description).is_some() {
             ecx.span_err(span, format!(
                 "diagnostic code {} already registered", token::get_ident(*code).get()
             ).as_slice());
index 152b89b86e7a60f512f725ce1d856e6f25a4e8c2..5401da8cd053bf7d6e0b424d677f64df3369a421 100644 (file)
@@ -768,7 +768,7 @@ fn find_escape_frame<'a>(&'a mut self) -> &'a mut MapChainFrame {
 
     pub fn find(&self, k: &Name) -> Option<Rc<SyntaxExtension>> {
         for frame in self.chain.iter().rev() {
-            match frame.map.find(k) {
+            match frame.map.get(k) {
                 Some(v) => return Some(v.clone()),
                 None => {}
             }
index 486ce910e2b6f9e6d40dd66af4888666573d60b1..a28f24e76635d283235d3de2f4b30f52fd70b6db 100644 (file)
@@ -252,7 +252,7 @@ fn verify_arg_type(&mut self, arg: Position, ty: ArgumentType) {
             }
 
             Named(name) => {
-                let span = match self.names.find(&name) {
+                let span = match self.names.get(&name) {
                     Some(e) => e.span,
                     None => {
                         let msg = format!("there is no argument named `{}`", name);
@@ -260,7 +260,7 @@ fn verify_arg_type(&mut self, arg: Position, ty: ArgumentType) {
                         return;
                     }
                 };
-                self.verify_same(span, &ty, self.name_types.find(&name));
+                self.verify_same(span, &ty, self.name_types.get(&name));
                 if !self.name_types.contains_key(&name) {
                     self.name_types.insert(name.clone(), ty);
                 }
@@ -555,11 +555,11 @@ fn to_expr(mut self, invocation: Invocation) -> P<ast::Expr> {
             heads.push(self.ecx.expr_addr_of(e.span, e));
         }
         for name in self.name_ordering.iter() {
-            let e = match self.names.pop(name) {
+            let e = match self.names.remove(name) {
                 Some(e) => e,
                 None => continue
             };
-            let arg_ty = match self.name_types.find(name) {
+            let arg_ty = match self.name_types.get(name) {
                 Some(ty) => ty,
                 None => continue
             };
index bebe16286c97acdc89e8cf18ad879af8bd2d958d..15fe7fc42b27507b0d80710dedc100e1b892686f 100644 (file)
@@ -182,7 +182,7 @@ fn resolve_internal(id: Ident,
                     resolve_table: &mut ResolveTable) -> Name {
     let key = (id.name, id.ctxt);
 
-    match resolve_table.find(&key) {
+    match resolve_table.get(&key) {
         Some(&name) => return name,
         None => {}
     }
index e6c98a9e3d09abdce17ebcd70619a2280675d4a1..bc6d6d7a5216d091c1a15741747102590a533d80 100644 (file)
@@ -45,7 +45,7 @@ pub fn prefill(init: &[T]) -> Interner<T> {
 
     pub fn intern(&self, val: T) -> Name {
         let mut map = self.map.borrow_mut();
-        match (*map).find(&val) {
+        match (*map).get(&val) {
             Some(&idx) => return idx,
             None => (),
         }
index 74bead9e5f2ddee67760115105cf9f7065861b21..4d6aefb2a178d466ae5ac16dbc0f19e12335dc13 100644 (file)
@@ -1209,7 +1209,7 @@ pub fn compare_to_old(&self, old: &MetricMap,
         let MetricMap(ref selfmap) = *self;
         let MetricMap(ref old) = *old;
         for (k, vold) in old.iter() {
-            let r = match selfmap.find(k) {
+            let r = match selfmap.get(k) {
                 None => MetricRemoved,
                 Some(v) => {
                     let delta = v.value - vold.value;
@@ -1678,31 +1678,31 @@ pub fn test_metricmap_compare() {
 
         let diff1 = m2.compare_to_old(&m1, None);
 
-        assert_eq!(*(diff1.find(&"in-both-noise".to_string()).unwrap()), LikelyNoise);
-        assert_eq!(*(diff1.find(&"in-first-noise".to_string()).unwrap()), MetricRemoved);
-        assert_eq!(*(diff1.find(&"in-second-noise".to_string()).unwrap()), MetricAdded);
-        assert_eq!(*(diff1.find(&"in-both-want-downwards-but-regressed".to_string()).unwrap()),
+        assert_eq!(*(diff1.get(&"in-both-noise".to_string()).unwrap()), LikelyNoise);
+        assert_eq!(*(diff1.get(&"in-first-noise".to_string()).unwrap()), MetricRemoved);
+        assert_eq!(*(diff1.get(&"in-second-noise".to_string()).unwrap()), MetricAdded);
+        assert_eq!(*(diff1.get(&"in-both-want-downwards-but-regressed".to_string()).unwrap()),
                    Regression(100.0));
-        assert_eq!(*(diff1.find(&"in-both-want-downwards-and-improved".to_string()).unwrap()),
+        assert_eq!(*(diff1.get(&"in-both-want-downwards-and-improved".to_string()).unwrap()),
                    Improvement(50.0));
-        assert_eq!(*(diff1.find(&"in-both-want-upwards-but-regressed".to_string()).unwrap()),
+        assert_eq!(*(diff1.get(&"in-both-want-upwards-but-regressed".to_string()).unwrap()),
                    Regression(50.0));
-        assert_eq!(*(diff1.find(&"in-both-want-upwards-and-improved".to_string()).unwrap()),
+        assert_eq!(*(diff1.get(&"in-both-want-upwards-and-improved".to_string()).unwrap()),
                    Improvement(100.0));
         assert_eq!(diff1.len(), 7);
 
         let diff2 = m2.compare_to_old(&m1, Some(200.0));
 
-        assert_eq!(*(diff2.find(&"in-both-noise".to_string()).unwrap()), LikelyNoise);
-        assert_eq!(*(diff2.find(&"in-first-noise".to_string()).unwrap()), MetricRemoved);
-        assert_eq!(*(diff2.find(&"in-second-noise".to_string()).unwrap()), MetricAdded);
-        assert_eq!(*(diff2.find(&"in-both-want-downwards-but-regressed".to_string()).unwrap()),
+        assert_eq!(*(diff2.get(&"in-both-noise".to_string()).unwrap()), LikelyNoise);
+        assert_eq!(*(diff2.get(&"in-first-noise".to_string()).unwrap()), MetricRemoved);
+        assert_eq!(*(diff2.get(&"in-second-noise".to_string()).unwrap()), MetricAdded);
+        assert_eq!(*(diff2.get(&"in-both-want-downwards-but-regressed".to_string()).unwrap()),
                    LikelyNoise);
-        assert_eq!(*(diff2.find(&"in-both-want-downwards-and-improved".to_string()).unwrap()),
+        assert_eq!(*(diff2.get(&"in-both-want-downwards-and-improved".to_string()).unwrap()),
                    LikelyNoise);
-        assert_eq!(*(diff2.find(&"in-both-want-upwards-but-regressed".to_string()).unwrap()),
+        assert_eq!(*(diff2.get(&"in-both-want-upwards-but-regressed".to_string()).unwrap()),
                    LikelyNoise);
-        assert_eq!(*(diff2.find(&"in-both-want-upwards-and-improved".to_string()).unwrap()),
+        assert_eq!(*(diff2.get(&"in-both-want-upwards-and-improved".to_string()).unwrap()),
                    LikelyNoise);
         assert_eq!(diff2.len(), 7);
     }
@@ -1727,29 +1727,29 @@ pub fn ratchet_test() {
         let (diff1, ok1) = m2.ratchet(&pth, None);
         assert_eq!(ok1, false);
         assert_eq!(diff1.len(), 2);
-        assert_eq!(*(diff1.find(&"runtime".to_string()).unwrap()), Regression(10.0));
-        assert_eq!(*(diff1.find(&"throughput".to_string()).unwrap()), LikelyNoise);
+        assert_eq!(*(diff1.get(&"runtime".to_string()).unwrap()), Regression(10.0));
+        assert_eq!(*(diff1.get(&"throughput".to_string()).unwrap()), LikelyNoise);
 
         // Check that it was not rewritten.
         let m3 = MetricMap::load(&pth);
         let MetricMap(m3) = m3;
         assert_eq!(m3.len(), 2);
-        assert_eq!(*(m3.find(&"runtime".to_string()).unwrap()), Metric::new(1000.0, 2.0));
-        assert_eq!(*(m3.find(&"throughput".to_string()).unwrap()), Metric::new(50.0, 2.0));
+        assert_eq!(*(m3.get(&"runtime".to_string()).unwrap()), Metric::new(1000.0, 2.0));
+        assert_eq!(*(m3.get(&"throughput".to_string()).unwrap()), Metric::new(50.0, 2.0));
 
         // Ask for a ratchet with an explicit noise-percentage override,
         // that should advance.
         let (diff2, ok2) = m2.ratchet(&pth, Some(10.0));
         assert_eq!(ok2, true);
         assert_eq!(diff2.len(), 2);
-        assert_eq!(*(diff2.find(&"runtime".to_string()).unwrap()), LikelyNoise);
-        assert_eq!(*(diff2.find(&"throughput".to_string()).unwrap()), LikelyNoise);
+        assert_eq!(*(diff2.get(&"runtime".to_string()).unwrap()), LikelyNoise);
+        assert_eq!(*(diff2.get(&"throughput".to_string()).unwrap()), LikelyNoise);
 
         // Check that it was rewritten.
         let m4 = MetricMap::load(&pth);
         let MetricMap(m4) = m4;
         assert_eq!(m4.len(), 2);
-        assert_eq!(*(m4.find(&"runtime".to_string()).unwrap()), Metric::new(1100.0, 2.0));
-        assert_eq!(*(m4.find(&"throughput".to_string()).unwrap()), Metric::new(50.0, 2.0));
+        assert_eq!(*(m4.get(&"runtime".to_string()).unwrap()), Metric::new(1100.0, 2.0));
+        assert_eq!(*(m4.get(&"throughput".to_string()).unwrap()), Metric::new(50.0, 2.0));
     }
 }
index 3933a33446d6346e520191d258c35c335ce74690..ac6104cc38b0e3ccf3ae9f1a7162785ccf3ee607 100644 (file)
@@ -30,18 +30,18 @@ trait MutableMap {
 
 impl MutableMap for TreeMap<uint, uint> {
     fn insert(&mut self, k: uint, v: uint) { self.insert(k, v); }
-    fn remove(&mut self, k: &uint) -> bool { self.remove(k) }
-    fn find(&self, k: &uint) -> Option<&uint> { self.find(k) }
+    fn remove(&mut self, k: &uint) -> bool { self.remove(k).is_some() }
+    fn find(&self, k: &uint) -> Option<&uint> { self.get(k) }
 }
 impl MutableMap for HashMap<uint, uint> {
     fn insert(&mut self, k: uint, v: uint) { self.insert(k, v); }
-    fn remove(&mut self, k: &uint) -> bool { self.remove(k) }
-    fn find(&self, k: &uint) -> Option<&uint> { self.find(k) }
+    fn remove(&mut self, k: &uint) -> bool { self.remove(k).is_some() }
+    fn find(&self, k: &uint) -> Option<&uint> { self.get(k) }
 }
 impl MutableMap for TrieMap<uint> {
     fn insert(&mut self, k: uint, v: uint) { self.insert(k, v); }
-    fn remove(&mut self, k: &uint) -> bool { self.remove(k) }
-    fn find(&self, k: &uint) -> Option<&uint> { self.find(k) }
+    fn remove(&mut self, k: &uint) -> bool { self.remove(k).is_some() }
+    fn find(&self, k: &uint) -> Option<&uint> { self.get(k) }
 }
 
 fn ascending<M: MutableMap>(map: &mut M, n_keys: uint) {
index abcd9f90333438473b78e555b1eceae061d5250e..191f70ac492188d186a5590c4de857d4b58ba29f 100644 (file)
@@ -197,8 +197,8 @@ fn rendezvous(nn: uint, set: Vec<Color>) {
 
         creatures_met += 2;
 
-        to_creature.get_mut(fst_creature.name).send(snd_creature);
-        to_creature.get_mut(snd_creature.name).send(fst_creature);
+        to_creature[fst_creature.name].send(snd_creature);
+        to_creature[snd_creature.name].send(fst_creature);
     }
 
     // tell each creature to stop
index e151369ff38ac645a5cc50dabf966fb3bb896b9f..0a3370fa487e89c6e95daedd20c8d455fd35165a 100644 (file)
@@ -100,7 +100,7 @@ fn sum_and_scale(a: &'static [AminoAcid]) -> Vec<AminoAcid> {
         result.push(a_i);
     }
     let result_len = result.len();
-    result.get_mut(result_len - 1).p = LOOKUP_SCALE;
+    result[result_len - 1].p = LOOKUP_SCALE;
     result
 }
 
index d0e6aacdbb2ad0c30a026322913d760808b26087..6ada34a5a584d4e8e518c8095a8bc00004b51564 100644 (file)
@@ -171,13 +171,13 @@ fn lookup<C:TableCallback>(&mut self, key: Code, c: C) {
                     next: None,
                 };
                 c.f(&mut *entry);
-                *self.items.get_mut(index as uint) = Some(entry);
+                self.items[index as uint] = Some(entry);
                 return;
             }
         }
 
         {
-            let entry = self.items.get_mut(index as uint).as_mut().unwrap();
+            let entry = self.items[index as uint].as_mut().unwrap();
             if entry.code == key {
                 c.f(&mut **entry);
                 return;
index 47e1969172d2f0cb49bd3abe2dab0f0ae0ad587b..d8df3eea83b0556b44429c08724e4a00b7495158 100644 (file)
@@ -194,7 +194,7 @@ fn is_board_unfeasible(board: u64, masks: &Vec<Vec<Vec<u64>>>) -> bool {
 fn filter_masks(masks: &mut Vec<Vec<Vec<u64>>>) {
     for i in range(0, masks.len()) {
         for j in range(0, (*masks)[i].len()) {
-            *masks.get_mut(i).get_mut(j) =
+            masks[i][j] =
                 (*masks)[i][j].iter().map(|&m| m)
                 .filter(|&m| !is_board_unfeasible(m, masks))
                 .collect();
@@ -217,7 +217,7 @@ fn to_vec(raw_sol: &List<u64>) -> Vec<u8> {
         let id = '0' as u8 + get_id(m);
         for i in range(0u, 50) {
             if m & 1 << i != 0 {
-                *sol.get_mut(i) = id;
+                sol[i] = id;
             }
         }
     }
index dccdafe9cf832d07c240661ccc28fdb3db539168..81de7a1269067b3d89dfab65ef19ce881532dfd8 100644 (file)
@@ -114,7 +114,7 @@ fn main() {
     }
 
     for (i, variant) in variant_strs.iter().enumerate() {
-        println!("{} {}", variant, counts.get_mut(i).get());
+        println!("{} {}", variant, counts[i].get());
     }
     println!("");
     println!("{}", ilen);
index 5ce1b2fc40d0464709888cee39636cd450d99453..d7d8e94c8a7dbd5d468db9641fe8aebbe42b5795 100644 (file)
@@ -112,14 +112,15 @@ fn read_to_end<R: Reader>(r: &mut R) -> IoResult<Vec<u8>> {
     let mut vec = Vec::with_capacity(CHUNK);
     loop {
         // workaround: very fast growing
-        if vec.capacity() - vec.len() < CHUNK {
+        let len = vec.len();
+        if vec.capacity() - len < CHUNK {
             let cap = vec.capacity();
             let mult = if cap < 256 * 1024 * 1024 {
                 16
             } else {
                 2
             };
-            vec.reserve_exact(mult * cap);
+            vec.reserve_exact(mult * cap - len);
         }
         match r.push_at_least(1, CHUNK, &mut vec) {
             Ok(_) => {}
index ae7594ea8a20e74b29cd49e0c71f19ebdfadbcd3..54824d7259fa9b49731a870f5182638676e3832a 100644 (file)
@@ -79,7 +79,7 @@ pub fn read(mut reader: BufferedReader<StdReader>) -> Sudoku {
             if comps.len() == 3u {
                 let row     = from_str::<uint>(comps[0]).unwrap() as u8;
                 let col     = from_str::<uint>(comps[1]).unwrap() as u8;
-                *g.get_mut(row as uint).get_mut(col as uint) =
+                g[row as uint][col as uint] =
                     from_str::<uint>(comps[2]).unwrap() as u8;
             }
             else {
@@ -139,10 +139,10 @@ fn next_color(&mut self, row: u8, col: u8, start_color: u8) -> bool {
 
             // find first remaining color that is available
             let next = avail.next();
-            *self.grid.get_mut(row as uint).get_mut(col as uint) = next;
+            self.grid[row as uint][col as uint] = next;
             return 0u8 != next;
         }
-        *self.grid.get_mut(row as uint).get_mut(col as uint) = 0u8;
+        self.grid[row as uint][col as uint] = 0u8;
         return false;
     }
 
index 5bc2edba301342704c21b84a208811d1823d1290..e14911d3508da46ddd106a4cb141152f1efe27e1 100644 (file)
@@ -19,7 +19,7 @@ fn a() {
     // Create an immutable pointer into p's contents:
     let q: &int = &p[0];
 
-    *p.get_mut(0) = 5; //~ ERROR cannot borrow
+    p[0] = 5; //~ ERROR cannot borrow
 
     println!("{}", *q);
 }
@@ -34,7 +34,7 @@ fn b() {
 
     borrow(
         p.as_slice(),
-        || *p.get_mut(0) = 5); //~ ERROR cannot borrow `p` as mutable
+        || p[0] = 5); //~ ERROR cannot borrow `p` as mutable
 }
 
 fn c() {
@@ -42,7 +42,7 @@ fn c() {
     // modification:
     let mut p = vec!(1);
     borrow(p.as_slice(), ||{});
-    *p.get_mut(0) = 5;
+    p[0] = 5;
 }
 
 fn main() {
index cdfb384d47ca27580bec9743e38245ceee9e91fb..d712810589200bd2e53e02dd2a09e8d646dc0285 100644 (file)
@@ -13,7 +13,7 @@ fn main() {
     for &x in vector.iter() {
         let cap = vector.capacity();
         vector.grow(cap, 0u);      //~ ERROR cannot borrow
-        *vector.get_mut(1u) = 5u;   //~ ERROR cannot borrow
+        vector[1u] = 5u;   //~ ERROR cannot borrow
     }
 }
 
index 31b5c44df66637a2206d76bc9a3dfe6181c76e79..200d208d140b69a054538222bf1d7d10c8fdf4a0 100644 (file)
@@ -26,7 +26,7 @@ fn has_mut_vec_but_tries_to_change_it() {
     takes_imm_elt(
         &v[0],
         || { //~ ERROR cannot borrow `v` as mutable
-            *v.get_mut(1) = 4;
+            v[1] = 4;
         })
 }
 
index af6ca3c93d5cf915596cb6be0dc71eb6c145de2d..2a54f22ee665b44f843e7deee0c12805c296c5e1 100644 (file)
@@ -15,7 +15,7 @@ pub fn main() {
     let mut a: Vec<int> = vec!(-1, -1, -1, -1);
     let mut p: int = 0;
     two(|i| {
-        two(|j| { *a.get_mut(p as uint) = 10 * i + j; p += 1; })
+        two(|j| { a[p as uint] = 10 * i + j; p += 1; })
     });
     assert_eq!(a[0], 0);
     assert_eq!(a[1], 1);
index 87afd1601f6bdbc19776242561dd3aad0cd8c841..4a6a6782fb3db5191acce2ffd91cb00249fc60ad 100644 (file)
@@ -83,7 +83,7 @@ pub fn map_reduce(inputs: Vec<String>) {
               mapper_done => { num_mappers -= 1; }
               find_reducer(k, cc) => {
                 let mut c;
-                match reducers.find(&str::from_utf8(
+                match reducers.get(&str::from_utf8(
                         k.as_slice()).unwrap().to_string()) {
                   Some(&_c) => { c = _c; }
                   None => { c = 0; }
index 84f303de7057b43ffc1efff1e7a9cefb07206b9f..4e330b9a0e7dd98ec2b0e76f49dd001993a7b778 100644 (file)
@@ -86,8 +86,8 @@ fn add_pt(&mut self, x: int, y: int) {
                 // element is:
                 // 1) potentially large
                 // 2) needs to be modified
-                let row = self.lines.get_mut(v);
-                *row.get_mut(h) = self.fill;
+                let row = &mut self.lines[v];
+                row[h] = self.fill;
             }
         }
     }
index da22da31d5b52a4148b546e9d0ebaa302d6ce4fa..37144fb9cce771f62332a09f96cf1a00b672f614 100644 (file)
@@ -15,7 +15,7 @@ struct HasNested {
 
 impl HasNested {
     fn method_push_local(&mut self) {
-        self.nest.get_mut(0).push(0);
+        self.nest[0].push(0);
     }
 }
 
index b63db29cf916ed97c796786a3738da82c63aaf97..ca820830f023f65a1aada2c29f6b96a857d0abc1 100644 (file)
@@ -44,8 +44,8 @@ pub fn main() {
     assert_eq!(*(*p).borrow(), Point {x: 3, y: 5});
 
     let v = Rc::new(RefCell::new(vec!(1i, 2, 3)));
-    *(*(*v).borrow_mut()).get_mut(0) = 3;
-    *(*(*v).borrow_mut()).get_mut(1) += 3;
+    (*(*v).borrow_mut())[0] = 3;
+    (*(*v).borrow_mut())[1] += 3;
     assert_eq!(((*(*v).borrow())[0],
                 (*(*v).borrow())[1],
                 (*(*v).borrow())[2]), (3, 5, 3));
index 1edce811bcb2107e5a9d59555dc8c1aae24cc8ba..55003a07b5bbe1a86eecfbcb7b4a64a5bcc3bc15 100644 (file)
 
 pub fn main() {
     let mut map: HashMap<SendStr, uint> = HashMap::new();
-    assert!(map.insert(Slice("foo"), 42));
-    assert!(!map.insert(Owned("foo".to_string()), 42));
-    assert!(!map.insert(Slice("foo"), 42));
-    assert!(!map.insert(Owned("foo".to_string()), 42));
+    assert!(map.insert(Slice("foo"), 42).is_none());
+    assert!(map.insert(Owned("foo".to_string()), 42).is_some());
+    assert!(map.insert(Slice("foo"), 42).is_some());
+    assert!(map.insert(Owned("foo".to_string()), 42).is_some());
 
-    assert!(!map.insert(Slice("foo"), 43));
-    assert!(!map.insert(Owned("foo".to_string()), 44));
-    assert!(!map.insert(Slice("foo"), 45));
-    assert!(!map.insert(Owned("foo".to_string()), 46));
+    assert!(map.insert(Slice("foo"), 43).is_some());
+    assert!(map.insert(Owned("foo".to_string()), 44).is_some());
+    assert!(map.insert(Slice("foo"), 45).is_some());
+    assert!(map.insert(Owned("foo".to_string()), 46).is_some());
 
     let v = 46;
 
-    assert_eq!(map.find(&Owned("foo".to_string())), Some(&v));
-    assert_eq!(map.find(&Slice("foo")), Some(&v));
+    assert_eq!(map.get(&Owned("foo".to_string())), Some(&v));
+    assert_eq!(map.get(&Slice("foo")), Some(&v));
 
     let (a, b, c, d) = (50, 51, 52, 53);
 
-    assert!(map.insert(Slice("abc"), a));
-    assert!(map.insert(Owned("bcd".to_string()), b));
-    assert!(map.insert(Slice("cde"), c));
-    assert!(map.insert(Owned("def".to_string()), d));
+    assert!(map.insert(Slice("abc"), a).is_none());
+    assert!(map.insert(Owned("bcd".to_string()), b).is_none());
+    assert!(map.insert(Slice("cde"), c).is_none());
+    assert!(map.insert(Owned("def".to_string()), d).is_none());
 
-    assert!(!map.insert(Slice("abc"), a));
-    assert!(!map.insert(Owned("bcd".to_string()), b));
-    assert!(!map.insert(Slice("cde"), c));
-    assert!(!map.insert(Owned("def".to_string()), d));
+    assert!(map.insert(Slice("abc"), a).is_some());
+    assert!(map.insert(Owned("bcd".to_string()), b).is_some());
+    assert!(map.insert(Slice("cde"), c).is_some());
+    assert!(map.insert(Owned("def".to_string()), d).is_some());
 
-    assert!(!map.insert(Owned("abc".to_string()), a));
-    assert!(!map.insert(Slice("bcd"), b));
-    assert!(!map.insert(Owned("cde".to_string()), c));
-    assert!(!map.insert(Slice("def"), d));
+    assert!(map.insert(Owned("abc".to_string()), a).is_some());
+    assert!(map.insert(Slice("bcd"), b).is_some());
+    assert!(map.insert(Owned("cde".to_string()), c).is_some());
+    assert!(map.insert(Slice("def"), d).is_some());
 
     assert_eq!(map.find_equiv("abc"), Some(&a));
     assert_eq!(map.find_equiv("bcd"), Some(&b));
index f73ab8f52d7ed32f9cbea446735c8968aa653c36..c52f9458f99d5fb9ced11707b0b23b4239bfc880 100644 (file)
 
 pub fn main() {
     let mut map: TreeMap<SendStr, uint> = TreeMap::new();
-    assert!(map.insert(Slice("foo"), 42));
-    assert!(!map.insert(Owned("foo".to_string()), 42));
-    assert!(!map.insert(Slice("foo"), 42));
-    assert!(!map.insert(Owned("foo".to_string()), 42));
+    assert!(map.insert(Slice("foo"), 42).is_none());
+    assert!(map.insert(Owned("foo".to_string()), 42).is_some());
+    assert!(map.insert(Slice("foo"), 42).is_some());
+    assert!(map.insert(Owned("foo".to_string()), 42).is_some());
 
-    assert!(!map.insert(Slice("foo"), 43));
-    assert!(!map.insert(Owned("foo".to_string()), 44));
-    assert!(!map.insert(Slice("foo"), 45));
-    assert!(!map.insert(Owned("foo".to_string()), 46));
+    assert!(map.insert(Slice("foo"), 43).is_some());
+    assert!(map.insert(Owned("foo".to_string()), 44).is_some());
+    assert!(map.insert(Slice("foo"), 45).is_some());
+    assert!(map.insert(Owned("foo".to_string()), 46).is_some());
 
     let v = 46;
 
-    assert_eq!(map.find(&Owned("foo".to_string())), Some(&v));
-    assert_eq!(map.find(&Slice("foo")), Some(&v));
+    assert_eq!(map.get(&Owned("foo".to_string())), Some(&v));
+    assert_eq!(map.get(&Slice("foo")), Some(&v));
 
     let (a, b, c, d) = (50, 51, 52, 53);
 
-    assert!(map.insert(Slice("abc"), a));
-    assert!(map.insert(Owned("bcd".to_string()), b));
-    assert!(map.insert(Slice("cde"), c));
-    assert!(map.insert(Owned("def".to_string()), d));
+    assert!(map.insert(Slice("abc"), a).is_none());
+    assert!(map.insert(Owned("bcd".to_string()), b).is_none());
+    assert!(map.insert(Slice("cde"), c).is_none());
+    assert!(map.insert(Owned("def".to_string()), d).is_none());
 
-    assert!(!map.insert(Slice("abc"), a));
-    assert!(!map.insert(Owned("bcd".to_string()), b));
-    assert!(!map.insert(Slice("cde"), c));
-    assert!(!map.insert(Owned("def".to_string()), d));
+    assert!(map.insert(Slice("abc"), a).is_some());
+    assert!(map.insert(Owned("bcd".to_string()), b).is_some());
+    assert!(map.insert(Slice("cde"), c).is_some());
+    assert!(map.insert(Owned("def".to_string()), d).is_some());
 
-    assert!(!map.insert(Owned("abc".to_string()), a));
-    assert!(!map.insert(Slice("bcd"), b));
-    assert!(!map.insert(Owned("cde".to_string()), c));
-    assert!(!map.insert(Slice("def"), d));
+    assert!(map.insert(Owned("abc".to_string()), a).is_some());
+    assert!(map.insert(Slice("bcd"), b).is_some());
+    assert!(map.insert(Owned("cde".to_string()), c).is_some());
+    assert!(map.insert(Slice("def"), d).is_some());
 
-    assert_eq!(map.find(&Slice("abc")), Some(&a));
-    assert_eq!(map.find(&Slice("bcd")), Some(&b));
-    assert_eq!(map.find(&Slice("cde")), Some(&c));
-    assert_eq!(map.find(&Slice("def")), Some(&d));
+    assert_eq!(map.get(&Slice("abc")), Some(&a));
+    assert_eq!(map.get(&Slice("bcd")), Some(&b));
+    assert_eq!(map.get(&Slice("cde")), Some(&c));
+    assert_eq!(map.get(&Slice("def")), Some(&d));
 
-    assert_eq!(map.find(&Owned("abc".to_string())), Some(&a));
-    assert_eq!(map.find(&Owned("bcd".to_string())), Some(&b));
-    assert_eq!(map.find(&Owned("cde".to_string())), Some(&c));
-    assert_eq!(map.find(&Owned("def".to_string())), Some(&d));
+    assert_eq!(map.get(&Owned("abc".to_string())), Some(&a));
+    assert_eq!(map.get(&Owned("bcd".to_string())), Some(&b));
+    assert_eq!(map.get(&Owned("cde".to_string())), Some(&c));
+    assert_eq!(map.get(&Owned("def".to_string())), Some(&d));
 
-    assert!(map.pop(&Slice("foo")).is_some());
+    assert!(map.remove(&Slice("foo")).is_some());
     assert_eq!(map.into_iter().map(|(k, v)| format!("{}{}", k, v))
                               .collect::<Vec<String>>()
                               .concat(),
index 4eb9274551f923e4d5941fba8a441e53e5da3900..3c0f9505736a962a0bda461dec549b2b121d65f1 100644 (file)
@@ -16,7 +16,7 @@ pub fn main() {
     assert_eq!(a[2], 4);
     assert_eq!(a[4], 2);
     let mut n = 42;
-    swap(&mut n, a.get_mut(0));
+    swap(&mut n, &mut a[0]);
     assert_eq!(a[0], 42);
     assert_eq!(n, 0);
 }
index 33a28ddb2fca77864034f6731f859bee40b46469..577a8f1430b2f9021d7c1ab5776ad931fb3296b8 100644 (file)
@@ -17,7 +17,7 @@ pub fn main() {
     assert_eq!(*b[0], 10);
 
     // This should only modify the value in a, not b
-    **a.get_mut(0) = 20;
+    *a[0] = 20;
 
     assert_eq!(*a[0], 20);
     assert_eq!(*b[0], 10);