about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-11-17 09:26:57 +0000
committerbors <bors@rust-lang.org>2014-11-17 09:26:57 +0000
commitedfb83c9e28df2a8f326d688f3d5b1f6faa72db8 (patch)
treee9d163e9d31669e9b1233a1997ebc0fd148b76e2
parent803aacd5aef78f90fdd06ae7653fc20eec224992 (diff)
parentdfb7a811ae0cb8c98ceed93ecc3573555cca03db (diff)
downloadrust-edfb83c9e28df2a8f326d688f3d5b1f6faa72db8.tar.gz
rust-edfb83c9e28df2a8f326d688f3d5b1f6faa72db8.zip
auto merge of #18914 : Gankro/rust/cloned, r=aturon
Part of #18424. r? @aturon 

[breaking-change]
-rw-r--r--src/libcore/option.rs9
-rw-r--r--src/libcoretest/option.rs13
-rw-r--r--src/librustc/lint/builtin.rs4
-rw-r--r--src/librustc/metadata/encoder.rs2
-rw-r--r--src/librustc/metadata/tydecode.rs2
-rw-r--r--src/librustc/middle/astencode.rs3
-rw-r--r--src/librustc/middle/borrowck/move_data.rs4
-rw-r--r--src/librustc/middle/check_match.rs8
-rw-r--r--src/librustc/middle/const_eval.rs6
-rw-r--r--src/librustc/middle/expr_use_visitor.rs5
-rw-r--r--src/librustc/middle/liveness.rs6
-rw-r--r--src/librustc/middle/privacy.rs14
-rw-r--r--src/librustc/middle/resolve.rs20
-rw-r--r--src/librustc/middle/stability.rs2
-rw-r--r--src/librustc/middle/trans/_match.rs4
-rw-r--r--src/librustc/middle/trans/base.rs4
-rw-r--r--src/librustc/middle/trans/common.rs4
-rw-r--r--src/librustc/middle/trans/consts.rs12
-rw-r--r--src/librustc/middle/trans/context.rs2
-rw-r--r--src/librustc/middle/trans/debuginfo.rs18
-rw-r--r--src/librustc/middle/trans/expr.rs4
-rw-r--r--src/librustc/middle/trans/meth.rs2
-rw-r--r--src/librustc/middle/trans/type_of.rs2
-rw-r--r--src/librustc/middle/ty.rs24
-rw-r--r--src/librustc/middle/typeck/check/_match.rs8
-rw-r--r--src/librustc/middle/typeck/check/mod.rs6
-rw-r--r--src/librustc/middle/typeck/check/regionck.rs10
-rw-r--r--src/librustc/middle/typeck/coherence/mod.rs4
-rw-r--r--src/librustc/middle/typeck/infer/region_inference/mod.rs2
-rw-r--r--src/libstd/collections/hash/map.rs34
-rw-r--r--src/libsyntax/ext/tt/transcribe.rs2
31 files changed, 121 insertions, 119 deletions
diff --git a/src/libcore/option.rs b/src/libcore/option.rs
index af9efee0c8f..f05a681a526 100644
--- a/src/libcore/option.rs
+++ b/src/libcore/option.rs
@@ -150,6 +150,7 @@ use mem;
 use result::{Result, Ok, Err};
 use slice;
 use slice::AsSlice;
+use clone::Clone;
 
 // Note that this is not a lang item per se, but it has a hidden dependency on
 // `Iterator`, which is one. The compiler assumes that the `next` method of
@@ -691,6 +692,14 @@ impl<T> Option<T> {
     }
 }
 
+impl<'a, T: Clone> Option<&'a T> {
+    /// Maps an Option<&T> to an Option<T> by cloning the contents of the Option<&T>.
+    #[unstable = "recently added as part of collections reform"]
+    pub fn cloned(self) -> Option<T> {
+        self.map(|t| t.clone())
+    }
+}
+
 impl<T: Default> Option<T> {
     /// Returns the contained value or a default
     ///
diff --git a/src/libcoretest/option.rs b/src/libcoretest/option.rs
index 18444fc4240..6138986e1d1 100644
--- a/src/libcoretest/option.rs
+++ b/src/libcoretest/option.rs
@@ -11,6 +11,7 @@
 use core::option::*;
 use core::kinds::marker;
 use core::mem;
+use core::clone::Clone;
 
 #[test]
 fn test_get_ptr() {
@@ -239,3 +240,15 @@ fn test_collect() {
 
     assert!(v == None);
 }
+
+fn test_cloned() {
+    let s = 1u32;
+    let n: Option<&'static u32> = None;
+    let o = Some(&s);
+
+    assert_eq!(o.clone(), Some(&s));
+    assert_eq!(o.cloned(), Some(1u32));
+
+    assert_eq!(n.clone(), None);
+    assert_eq!(n.cloned(), None);
+}
\ No newline at end of file
diff --git a/src/librustc/lint/builtin.rs b/src/librustc/lint/builtin.rs
index d2793237c4d..ac2f6dd9d37 100644
--- a/src/librustc/lint/builtin.rs
+++ b/src/librustc/lint/builtin.rs
@@ -391,7 +391,7 @@ struct ImproperCTypesVisitor<'a, 'tcx: 'a> {
 
 impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
     fn check_def(&mut self, sp: Span, ty_id: ast::NodeId, path_id: ast::NodeId) {
-        match self.cx.tcx.def_map.borrow().get_copy(&path_id) {
+        match self.cx.tcx.def_map.borrow()[path_id].clone() {
             def::DefPrimTy(ast::TyInt(ast::TyI)) => {
                 self.cx.span_lint(IMPROPER_CTYPES, sp,
                                   "found rust type `int` in foreign module, while \
@@ -869,7 +869,7 @@ fn method_context(cx: &Context, m: &ast::Method) -> MethodContext {
         node: m.id
     };
 
-    match cx.tcx.impl_or_trait_items.borrow().find_copy(&did) {
+    match cx.tcx.impl_or_trait_items.borrow().get(&did).cloned() {
         None => cx.sess().span_bug(m.span, "missing method descriptor?!"),
         Some(md) => {
             match md {
diff --git a/src/librustc/metadata/encoder.rs b/src/librustc/metadata/encoder.rs
index 251b7c0c141..322191701e2 100644
--- a/src/librustc/metadata/encoder.rs
+++ b/src/librustc/metadata/encoder.rs
@@ -1863,7 +1863,7 @@ impl<'a, 'b, 'c, 'tcx, 'v> Visitor<'v> for ImplVisitor<'a, 'b, 'c, 'tcx> {
         match item.node {
             ItemImpl(_, Some(ref trait_ref), _, _) => {
                 let def_map = &self.ecx.tcx.def_map;
-                let trait_def = def_map.borrow().get_copy(&trait_ref.ref_id);
+                let trait_def = def_map.borrow()[trait_ref.ref_id].clone();
                 let def_id = trait_def.def_id();
 
                 // Load eagerly if this is an implementation of the Drop trait
diff --git a/src/librustc/metadata/tydecode.rs b/src/librustc/metadata/tydecode.rs
index 50c9a4a2a52..d660cc970e7 100644
--- a/src/librustc/metadata/tydecode.rs
+++ b/src/librustc/metadata/tydecode.rs
@@ -439,7 +439,7 @@ fn parse_ty(st: &mut PState, conv: conv_did) -> ty::t {
                                          pos: pos,
                                          len: len };
 
-        match st.tcx.rcache.borrow().find_copy(&key) {
+        match st.tcx.rcache.borrow().get(&key).cloned() {
           Some(tt) => return tt,
           None => {}
         }
diff --git a/src/librustc/middle/astencode.rs b/src/librustc/middle/astencode.rs
index 0ca53054f1c..e20a7901e65 100644
--- a/src/librustc/middle/astencode.rs
+++ b/src/librustc/middle/astencode.rs
@@ -1200,8 +1200,7 @@ fn encode_side_tables_for_id(ecx: &e::EncodeContext,
                                 var_id: var_id,
                                 closure_expr_id: id
                             };
-                            let upvar_borrow = tcx.upvar_borrow_map.borrow()
-                                                  .get_copy(&upvar_id);
+                            let upvar_borrow = tcx.upvar_borrow_map.borrow()[upvar_id].clone();
                             var_id.encode(rbml_w);
                             upvar_borrow.encode(rbml_w);
                         })
diff --git a/src/librustc/middle/borrowck/move_data.rs b/src/librustc/middle/borrowck/move_data.rs
index becc0dbf624..b38246647d6 100644
--- a/src/librustc/middle/borrowck/move_data.rs
+++ b/src/librustc/middle/borrowck/move_data.rs
@@ -295,7 +295,7 @@ impl MoveData {
 
     fn existing_move_path(&self, lp: &Rc<LoanPath>)
                           -> Option<MovePathIndex> {
-        self.path_map.borrow().find_copy(lp)
+        self.path_map.borrow().get(lp).cloned()
     }
 
     fn existing_base_paths(&self, lp: &Rc<LoanPath>)
@@ -312,7 +312,7 @@ impl MoveData {
          * paths of `lp` to `result`, but does not add new move paths
          */
 
-        match self.path_map.borrow().find_copy(lp) {
+        match self.path_map.borrow().get(lp).cloned() {
             Some(index) => {
                 self.each_base_path(index, |p| {
                     result.push(p);
diff --git a/src/librustc/middle/check_match.rs b/src/librustc/middle/check_match.rs
index 3968e6b6534..9e1e4552ee2 100644
--- a/src/librustc/middle/check_match.rs
+++ b/src/librustc/middle/check_match.rs
@@ -359,7 +359,7 @@ impl<'a, 'tcx> Folder for StaticInliner<'a, 'tcx> {
     fn fold_pat(&mut self, pat: P<Pat>) -> P<Pat> {
         match pat.node {
             PatIdent(..) | PatEnum(..) => {
-                let def = self.tcx.def_map.borrow().find_copy(&pat.id);
+                let def = self.tcx.def_map.borrow().get(&pat.id).cloned();
                 match def {
                     Some(DefConst(did)) => match lookup_const_by_id(self.tcx, did) {
                         Some(const_expr) => {
@@ -749,7 +749,7 @@ pub fn specialize<'a>(cx: &MatchCheckCtxt, r: &[&'a Pat],
             Some(Vec::from_elem(arity, DUMMY_WILD_PAT)),
 
         &PatIdent(_, _, _) => {
-            let opt_def = cx.tcx.def_map.borrow().find_copy(&pat_id);
+            let opt_def = cx.tcx.def_map.borrow().get(&pat_id).cloned();
             match opt_def {
                 Some(DefConst(..)) =>
                     cx.tcx.sess.span_bug(pat_span, "const pattern should've \
@@ -764,7 +764,7 @@ pub fn specialize<'a>(cx: &MatchCheckCtxt, r: &[&'a Pat],
         }
 
         &PatEnum(_, ref args) => {
-            let def = cx.tcx.def_map.borrow().get_copy(&pat_id);
+            let def = cx.tcx.def_map.borrow()[pat_id].clone();
             match def {
                 DefConst(..) =>
                     cx.tcx.sess.span_bug(pat_span, "const pattern should've \
@@ -782,7 +782,7 @@ pub fn specialize<'a>(cx: &MatchCheckCtxt, r: &[&'a Pat],
 
         &PatStruct(_, ref pattern_fields, _) => {
             // Is this a struct or an enum variant?
-            let def = cx.tcx.def_map.borrow().get_copy(&pat_id);
+            let def = cx.tcx.def_map.borrow()[pat_id].clone();
             let class_id = match def {
                 DefConst(..) =>
                     cx.tcx.sess.span_bug(pat_span, "const pattern should've \
diff --git a/src/librustc/middle/const_eval.rs b/src/librustc/middle/const_eval.rs
index 1fd5b81f499..a626a028e2e 100644
--- a/src/librustc/middle/const_eval.rs
+++ b/src/librustc/middle/const_eval.rs
@@ -85,7 +85,7 @@ pub fn join_all<It: Iterator<constness>>(mut cs: It) -> constness {
 }
 
 fn lookup_const<'a>(tcx: &'a ty::ctxt, e: &Expr) -> Option<&'a Expr> {
-    let opt_def = tcx.def_map.borrow().find_copy(&e.id);
+    let opt_def = tcx.def_map.borrow().get(&e.id).cloned();
     match opt_def {
         Some(def::DefConst(def_id)) => {
             lookup_const_by_id(tcx, def_id)
@@ -320,7 +320,7 @@ pub fn const_expr_to_pat(tcx: &ty::ctxt, expr: &Expr) -> P<Pat> {
             PatTup(exprs.iter().map(|expr| const_expr_to_pat(tcx, &**expr)).collect()),
 
         ExprCall(ref callee, ref args) => {
-            let def = tcx.def_map.borrow().get_copy(&callee.id);
+            let def = tcx.def_map.borrow()[callee.id].clone();
             match tcx.def_map.borrow_mut().entry(expr.id) {
               Vacant(entry) => { entry.set(def); }
               _ => {}
@@ -352,7 +352,7 @@ pub fn const_expr_to_pat(tcx: &ty::ctxt, expr: &Expr) -> P<Pat> {
         }
 
         ExprPath(ref path) => {
-            let opt_def = tcx.def_map.borrow().find_copy(&expr.id);
+            let opt_def = tcx.def_map.borrow().get(&expr.id).cloned();
             match opt_def {
                 Some(def::DefStruct(..)) =>
                     PatStruct(path.clone(), vec![], false),
diff --git a/src/librustc/middle/expr_use_visitor.rs b/src/librustc/middle/expr_use_visitor.rs
index 95ebdd8214e..16e8adb8adf 100644
--- a/src/librustc/middle/expr_use_visitor.rs
+++ b/src/librustc/middle/expr_use_visitor.rs
@@ -850,7 +850,7 @@ impl<'d,'t,'tcx,TYPER:mc::Typer<'tcx>> ExprUseVisitor<'d,'t,TYPER> {
 
                 // Each match binding is effectively an assignment to the
                 // binding being produced.
-                let def = def_map.borrow().get_copy(&pat.id);
+                let def = def_map.borrow()[pat.id].clone();
                 match mc.cat_def(pat.id, pat.span, pat_ty, def) {
                     Ok(binding_cmt) => {
                         delegate.mutate(pat.id, pat.span, binding_cmt, Init);
@@ -957,8 +957,7 @@ impl<'d,'t,'tcx,TYPER:mc::Typer<'tcx>> ExprUseVisitor<'d,'t,TYPER> {
             // inferred by regionbk
             let upvar_id = ty::UpvarId { var_id: id_var,
                                          closure_expr_id: closure_expr.id };
-            let upvar_borrow = self.tcx().upvar_borrow_map.borrow()
-                                   .get_copy(&upvar_id);
+            let upvar_borrow = self.tcx().upvar_borrow_map.borrow()[upvar_id].clone();
 
             self.delegate.borrow(closure_expr.id,
                                  closure_expr.span,
diff --git a/src/librustc/middle/liveness.rs b/src/librustc/middle/liveness.rs
index dff9c45611a..d1f78cf0417 100644
--- a/src/librustc/middle/liveness.rs
+++ b/src/librustc/middle/liveness.rs
@@ -449,7 +449,7 @@ fn visit_expr(ir: &mut IrMaps, expr: &Expr) {
     match expr.node {
       // live nodes required for uses or definitions of variables:
       ExprPath(_) => {
-        let def = ir.tcx.def_map.borrow().get_copy(&expr.id);
+        let def = ir.tcx.def_map.borrow()[expr.id].clone();
         debug!("expr {}: path that leads to {}", expr.id, def);
         match def {
             DefLocal(..) => ir.add_live_node_for_node(expr.id, ExprNode(expr.span)),
@@ -1316,7 +1316,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
 
     fn access_path(&mut self, expr: &Expr, succ: LiveNode, acc: uint)
                    -> LiveNode {
-        match self.ir.tcx.def_map.borrow().get_copy(&expr.id) {
+        match self.ir.tcx.def_map.borrow()[expr.id].clone() {
           DefLocal(nid) => {
             let ln = self.live_node(expr.id, expr.span);
             if acc != 0u {
@@ -1582,7 +1582,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
     fn check_lvalue(&mut self, expr: &Expr) {
         match expr.node {
           ExprPath(_) => {
-            match self.ir.tcx.def_map.borrow().get_copy(&expr.id) {
+            match self.ir.tcx.def_map.borrow()[expr.id].clone() {
               DefLocal(nid) => {
                 // Assignment to an immutable variable or argument: only legal
                 // if there is no later assignment. If this local is actually
diff --git a/src/librustc/middle/privacy.rs b/src/librustc/middle/privacy.rs
index 72f3e289992..d3b70afe39b 100644
--- a/src/librustc/middle/privacy.rs
+++ b/src/librustc/middle/privacy.rs
@@ -245,7 +245,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for EmbargoVisitor<'a, 'tcx> {
             ast::ItemImpl(_, _, ref ty, ref impl_items) => {
                 let public_ty = match ty.node {
                     ast::TyPath(_, _, id) => {
-                        match self.tcx.def_map.borrow().get_copy(&id) {
+                        match self.tcx.def_map.borrow()[id].clone() {
                             def::DefPrimTy(..) => true,
                             def => {
                                 let did = def.def_id();
@@ -313,7 +313,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for EmbargoVisitor<'a, 'tcx> {
             ast::ItemTy(ref ty, _) if public_first => {
                 match ty.node {
                     ast::TyPath(_, _, id) => {
-                        match self.tcx.def_map.borrow().get_copy(&id) {
+                        match self.tcx.def_map.borrow()[id].clone() {
                             def::DefPrimTy(..) | def::DefTyParam(..) => {},
                             def => {
                                 let did = def.def_id();
@@ -620,7 +620,7 @@ impl<'a, 'tcx> PrivacyVisitor<'a, 'tcx> {
                             ast::TyPath(_, _, id) => id,
                             _ => return Some((err_span, err_msg, None)),
                         };
-                        let def = self.tcx.def_map.borrow().get_copy(&id);
+                        let def = self.tcx.def_map.borrow()[id].clone();
                         let did = def.def_id();
                         assert!(is_local(did));
                         match self.tcx.map.get(did.node) {
@@ -706,7 +706,7 @@ impl<'a, 'tcx> PrivacyVisitor<'a, 'tcx> {
     // Checks that a path is in scope.
     fn check_path(&mut self, span: Span, path_id: ast::NodeId, path: &ast::Path) {
         debug!("privacy - path {}", self.nodestr(path_id));
-        let orig_def = self.tcx.def_map.borrow().get_copy(&path_id);
+        let orig_def = self.tcx.def_map.borrow()[path_id].clone();
         let ck = |tyname: &str| {
             let ck_public = |def: ast::DefId| {
                 let name = token::get_ident(path.segments
@@ -789,7 +789,7 @@ impl<'a, 'tcx> PrivacyVisitor<'a, 'tcx> {
         // def map is not. Therefore the names we work out below will not always
         // be accurate and we can get slightly wonky error messages (but type
         // checking is always correct).
-        match self.tcx.def_map.borrow().get_copy(&path_id) {
+        match self.tcx.def_map.borrow()[path_id].clone() {
             def::DefStaticMethod(..) => ck("static method"),
             def::DefFn(..) => ck("function"),
             def::DefStatic(..) => ck("static"),
@@ -873,7 +873,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for PrivacyVisitor<'a, 'tcx> {
                         }
                     }
                     ty::ty_enum(_, _) => {
-                        match self.tcx.def_map.borrow().get_copy(&expr.id) {
+                        match self.tcx.def_map.borrow()[expr.id].clone() {
                             def::DefVariant(_, variant_id, _) => {
                                 for field in fields.iter() {
                                     self.check_field(expr.span, variant_id,
@@ -1255,7 +1255,7 @@ struct CheckTypeForPrivatenessVisitor<'a, 'b: 'a, 'tcx: 'b> {
 
 impl<'a, 'tcx> VisiblePrivateTypesVisitor<'a, 'tcx> {
     fn path_is_private_type(&self, path_id: ast::NodeId) -> bool {
-        let did = match self.tcx.def_map.borrow().find_copy(&path_id) {
+        let did = match self.tcx.def_map.borrow().get(&path_id).cloned() {
             // `int` etc. (None doesn't seem to occur.)
             None | Some(def::DefPrimTy(..)) => return false,
             Some(def) => def.def_id()
diff --git a/src/librustc/middle/resolve.rs b/src/librustc/middle/resolve.rs
index 6749b8b2642..fd62d0cdc11 100644
--- a/src/librustc/middle/resolve.rs
+++ b/src/librustc/middle/resolve.rs
@@ -1097,7 +1097,7 @@ impl<'a> Resolver<'a> {
                                                                    sp);
 
         // Add or reuse the child.
-        let child = module_.children.borrow().find_copy(&name);
+        let child = module_.children.borrow().get(&name).cloned();
         match child {
             None => {
                 let child = Rc::new(NameBindings::new());
@@ -1381,7 +1381,7 @@ impl<'a> Resolver<'a> {
                         let mod_name = path.segments.last().unwrap().identifier.name;
 
                         let parent_opt = parent.module().children.borrow()
-                                               .find_copy(&mod_name);
+                                               .get(&mod_name).cloned();
                         let new_parent = match parent_opt {
                             // It already exists
                             Some(ref child) if child.get_module_if_available()
@@ -2676,7 +2676,7 @@ impl<'a> Resolver<'a> {
             BoundResult(..) => {}
             _ => {
                 match containing_module.external_module_children.borrow_mut()
-                                       .find_copy(&source) {
+                                       .get(&source).cloned() {
                     None => {} // Continue.
                     Some(module) => {
                         debug!("(resolving single import) found external \
@@ -3191,7 +3191,7 @@ impl<'a> Resolver<'a> {
         fn search_parent_externals(needle: Name, module: &Rc<Module>)
                                 -> Option<Rc<Module>> {
             module.external_module_children.borrow()
-                                            .find_copy(&needle)
+                                            .get(&needle).cloned()
                                             .map(|_| module.clone())
                                             .or_else(|| {
                 match module.parent_link.clone() {
@@ -3478,7 +3478,7 @@ impl<'a> Resolver<'a> {
 
         // Search for external modules.
         if namespace == TypeNS {
-            match module_.external_module_children.borrow().find_copy(&name) {
+            match module_.external_module_children.borrow().get(&name).cloned() {
                 None => {}
                 Some(module) => {
                     let name_bindings =
@@ -3763,7 +3763,7 @@ impl<'a> Resolver<'a> {
 
         // Finally, search through external children.
         if namespace == TypeNS {
-            match module_.external_module_children.borrow().find_copy(&name) {
+            match module_.external_module_children.borrow().get(&name).cloned() {
                 None => {}
                 Some(module) => {
                     let name_bindings =
@@ -4043,7 +4043,7 @@ impl<'a> Resolver<'a> {
                             // item, it's ok
                             match def {
                                 DefTyParam(_, did, _) if {
-                                    self.def_map.borrow().find_copy(&did.node)
+                                    self.def_map.borrow().get(&did.node).cloned()
                                         == Some(DefTyParamBinder(item_id))
                                 } => {} // ok
                                 DefSelfTy(did) if did == item_id => {} // ok
@@ -4096,7 +4096,7 @@ impl<'a> Resolver<'a> {
                             // item, it's ok
                             match def {
                                 DefTyParam(_, did, _) if {
-                                    self.def_map.borrow().find_copy(&did.node)
+                                    self.def_map.borrow().get(&did.node).cloned()
                                         == Some(DefTyParamBinder(item_id))
                                 } => {} // ok
                                 DefSelfTy(did) if did == item_id => {} // ok
@@ -4148,7 +4148,7 @@ impl<'a> Resolver<'a> {
         // FIXME #4950: Try caching?
 
         for (i, rib) in ribs.iter().enumerate().rev() {
-            match rib.bindings.find_copy(&name) {
+            match rib.bindings.get(&name).cloned() {
                 Some(def_like) => {
                     return self.upvarify(ribs[i + 1..], def_like, span);
                 }
@@ -5444,7 +5444,7 @@ impl<'a> Resolver<'a> {
         // Finally, search through external children.
         if namespace == TypeNS {
             match containing_module.external_module_children.borrow()
-                                   .find_copy(&name) {
+                                   .get(&name).cloned() {
                 None => {}
                 Some(module) => {
                     match module.def_id.get() {
diff --git a/src/librustc/middle/stability.rs b/src/librustc/middle/stability.rs
index 3b7ad9e8f6b..49bbfd0be47 100644
--- a/src/librustc/middle/stability.rs
+++ b/src/librustc/middle/stability.rs
@@ -139,7 +139,7 @@ pub fn lookup(tcx: &ty::ctxt, id: DefId) -> Option<Stability> {
             lookup(tcx, trait_method_id)
         }
         _ if is_local(id) => {
-            tcx.stability.borrow().local.find_copy(&id.node)
+            tcx.stability.borrow().local.get(&id.node).cloned()
         }
         _ => {
             let stab = csearch::get_stability(&tcx.sess.cstore, id);
diff --git a/src/librustc/middle/trans/_match.rs b/src/librustc/middle/trans/_match.rs
index e4409777686..7035df542c0 100644
--- a/src/librustc/middle/trans/_match.rs
+++ b/src/librustc/middle/trans/_match.rs
@@ -568,7 +568,7 @@ fn get_branches<'a, 'p, 'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
             ast::PatLit(ref l) => ConstantValue(ConstantExpr(&**l)),
             ast::PatIdent(..) | ast::PatEnum(..) | ast::PatStruct(..) => {
                 // This is either an enum variant or a variable binding.
-                let opt_def = tcx.def_map.borrow().find_copy(&cur.id);
+                let opt_def = tcx.def_map.borrow().get(&cur.id).cloned();
                 match opt_def {
                     Some(def::DefVariant(enum_id, var_id, _)) => {
                         let variant = ty::enum_variant_with_id(tcx, enum_id, var_id);
@@ -1642,7 +1642,7 @@ fn bind_irrefutable_pat<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
             }
         }
         ast::PatEnum(_, ref sub_pats) => {
-            let opt_def = bcx.tcx().def_map.borrow().find_copy(&pat.id);
+            let opt_def = bcx.tcx().def_map.borrow().get(&pat.id).cloned();
             match opt_def {
                 Some(def::DefVariant(enum_id, var_id, _)) => {
                     let repr = adt::represent_node(bcx, pat.id);
diff --git a/src/librustc/middle/trans/base.rs b/src/librustc/middle/trans/base.rs
index d4d532c1c44..86fe3e7a641 100644
--- a/src/librustc/middle/trans/base.rs
+++ b/src/librustc/middle/trans/base.rs
@@ -2266,7 +2266,7 @@ pub fn trans_item(ccx: &CrateContext, item: &ast::Item) {
                                          static");
               }
 
-              let v = ccx.static_values().borrow().get_copy(&item.id);
+              let v = ccx.static_values().borrow()[item.id].clone();
               unsafe {
                   if !(llvm::LLVMConstIntGetZExtValue(v) != 0) {
                       ccx.sess().span_fatal(expr.span, "static assertion failed");
@@ -2656,7 +2656,7 @@ fn contains_null(s: &str) -> bool {
 pub fn get_item_val(ccx: &CrateContext, id: ast::NodeId) -> ValueRef {
     debug!("get_item_val(id=`{}`)", id);
 
-    match ccx.item_vals().borrow().find_copy(&id) {
+    match ccx.item_vals().borrow().get(&id).cloned() {
         Some(v) => return v,
         None => {}
     }
diff --git a/src/librustc/middle/trans/common.rs b/src/librustc/middle/trans/common.rs
index c0380f87036..dbc4c58020f 100644
--- a/src/librustc/middle/trans/common.rs
+++ b/src/librustc/middle/trans/common.rs
@@ -526,12 +526,12 @@ impl<'blk, 'tcx> mc::Typer<'tcx> for BlockS<'blk, 'tcx> {
     }
 
     fn upvar_borrow(&self, upvar_id: ty::UpvarId) -> ty::UpvarBorrow {
-        self.tcx().upvar_borrow_map.borrow().get_copy(&upvar_id)
+        self.tcx().upvar_borrow_map.borrow()[upvar_id].clone()
     }
 
     fn capture_mode(&self, closure_expr_id: ast::NodeId)
                     -> ast::CaptureClause {
-        self.tcx().capture_modes.borrow().get_copy(&closure_expr_id)
+        self.tcx().capture_modes.borrow()[closure_expr_id].clone()
     }
 }
 
diff --git a/src/librustc/middle/trans/consts.rs b/src/librustc/middle/trans/consts.rs
index 330959d6871..1cdd681c8bc 100644
--- a/src/librustc/middle/trans/consts.rs
+++ b/src/librustc/middle/trans/consts.rs
@@ -184,7 +184,7 @@ pub fn get_const_val(cx: &CrateContext,
         }
     }
 
-    cx.const_values().borrow().get_copy(&def_id.node)
+    cx.const_values().borrow()[def_id.node].clone()
 }
 
 pub fn const_expr(cx: &CrateContext, e: &ast::Expr) -> (ValueRef, ty::t) {
@@ -192,7 +192,7 @@ pub fn const_expr(cx: &CrateContext, e: &ast::Expr) -> (ValueRef, ty::t) {
     let mut llconst = llconst;
     let ety = ty::expr_ty(cx.tcx(), e);
     let mut ety_adjusted = ty::expr_ty_adjusted(cx.tcx(), e);
-    let opt_adj = cx.tcx().adjustments.borrow().find_copy(&e.id);
+    let opt_adj = cx.tcx().adjustments.borrow().get(&e.id).cloned();
     match opt_adj {
         None => { }
         Some(adj) => {
@@ -551,7 +551,7 @@ fn const_expr_unadjusted(cx: &CrateContext, e: &ast::Expr) -> ValueRef {
                       _ => break,
                   }
               }
-              let opt_def = cx.tcx().def_map.borrow().find_copy(&cur.id);
+              let opt_def = cx.tcx().def_map.borrow().get(&cur.id).cloned();
               match opt_def {
                   Some(def::DefStatic(def_id, _)) => {
                       let ty = ty::expr_ty(cx.tcx(), e);
@@ -626,7 +626,7 @@ fn const_expr_unadjusted(cx: &CrateContext, e: &ast::Expr) -> ValueRef {
             // Assert that there are no type parameters in this path.
             assert!(pth.segments.iter().all(|seg| !seg.parameters.has_types()));
 
-            let opt_def = cx.tcx().def_map.borrow().find_copy(&e.id);
+            let opt_def = cx.tcx().def_map.borrow().get(&e.id).cloned();
             match opt_def {
                 Some(def::DefFn(def_id, _)) => {
                     if !ast_util::is_local(def_id) {
@@ -660,7 +660,7 @@ fn const_expr_unadjusted(cx: &CrateContext, e: &ast::Expr) -> ValueRef {
             }
           }
           ast::ExprCall(ref callee, ref args) => {
-              let opt_def = cx.tcx().def_map.borrow().find_copy(&callee.id);
+              let opt_def = cx.tcx().def_map.borrow().get(&callee.id).cloned();
               match opt_def {
                   Some(def::DefStruct(_)) => {
                       let ety = ty::expr_ty(cx.tcx(), e);
@@ -702,7 +702,7 @@ pub fn trans_static(ccx: &CrateContext, m: ast::Mutability, id: ast::NodeId) {
         let g = base::get_item_val(ccx, id);
         // At this point, get_item_val has already translated the
         // constant's initializer to determine its LLVM type.
-        let v = ccx.static_values().borrow().get_copy(&id);
+        let v = ccx.static_values().borrow()[id].clone();
         // boolean SSA values are i1, but they have to be stored in i8 slots,
         // otherwise some LLVM optimization passes don't work as expected
         let v = if llvm::LLVMTypeOf(v) == Type::i1(ccx).to_ref() {
diff --git a/src/librustc/middle/trans/context.rs b/src/librustc/middle/trans/context.rs
index 42da0573460..85700efec71 100644
--- a/src/librustc/middle/trans/context.rs
+++ b/src/librustc/middle/trans/context.rs
@@ -519,7 +519,7 @@ impl<'b, 'tcx> CrateContext<'b, 'tcx> {
     }
 
     pub fn get_intrinsic(&self, key: & &'static str) -> ValueRef {
-        match self.intrinsics().borrow().find_copy(key) {
+        match self.intrinsics().borrow().get(key).cloned() {
             Some(v) => return v,
             _ => {}
         }
diff --git a/src/librustc/middle/trans/debuginfo.rs b/src/librustc/middle/trans/debuginfo.rs
index f11ca1eec5a..6e909e6532e 100644
--- a/src/librustc/middle/trans/debuginfo.rs
+++ b/src/librustc/middle/trans/debuginfo.rs
@@ -301,11 +301,11 @@ impl TypeMap {
     }
 
     fn find_metadata_for_type(&self, type_: ty::t) -> Option<DIType> {
-        self.type_to_metadata.find_copy(&type_)
+        self.type_to_metadata.get(&type_).cloned()
     }
 
     fn find_metadata_for_unique_id(&self, unique_type_id: UniqueTypeId) -> Option<DIType> {
-        self.unique_id_to_metadata.find_copy(&unique_type_id)
+        self.unique_id_to_metadata.get(&unique_type_id).cloned()
     }
 
     // Get the string representation of a UniqueTypeId. This method will fail if
@@ -341,7 +341,7 @@ impl TypeMap {
         // unique vec box (~[]) -> {HEAP_VEC_BOX<:pointee-uid:>}
         // gc box               -> {GC_BOX<:pointee-uid:>}
 
-        match self.type_to_unique_id.find_copy(&type_) {
+        match self.type_to_unique_id.get(&type_).cloned() {
             Some(unique_type_id) => return unique_type_id,
             None => { /* generate one */}
         };
@@ -499,7 +499,7 @@ impl TypeMap {
             // First, find out the 'real' def_id of the type. Items inlined from
             // other crates have to be mapped back to their source.
             let source_def_id = if def_id.krate == ast::LOCAL_CRATE {
-                match cx.external_srcs().borrow().find_copy(&def_id.node) {
+                match cx.external_srcs().borrow().get(&def_id.node).cloned() {
                     Some(source_def_id) => {
                         // The given def_id identifies the inlined copy of a
                         // type definition, let's take the source of the copy.
@@ -853,7 +853,7 @@ pub fn create_local_var_metadata(bcx: Block, local: &ast::Local) {
     pat_util::pat_bindings(def_map, &*local.pat, |_, node_id, span, path1| {
         let var_ident = path1.node;
 
-        let datum = match bcx.fcx.lllocals.borrow().find_copy(&node_id) {
+        let datum = match bcx.fcx.lllocals.borrow().get(&node_id).cloned() {
             Some(datum) => datum,
             None => {
                 bcx.sess().span_bug(span,
@@ -1016,7 +1016,7 @@ pub fn create_argument_metadata(bcx: Block, arg: &ast::Arg) {
     let scope_metadata = bcx.fcx.debug_context.get_ref(cx, arg.pat.span).fn_metadata;
 
     pat_util::pat_bindings(def_map, &*arg.pat, |_, node_id, span, path1| {
-        let llarg = match bcx.fcx.lllocals.borrow().find_copy(&node_id) {
+        let llarg = match bcx.fcx.lllocals.borrow().get(&node_id).cloned() {
             Some(v) => v,
             None => {
                 bcx.sess().span_bug(span,
@@ -1707,7 +1707,7 @@ fn scope_metadata(fcx: &FunctionContext,
     let scope_map = &fcx.debug_context
                         .get_ref(fcx.ccx, error_reporting_span)
                         .scope_map;
-    match scope_map.borrow().find_copy(&node_id) {
+    match scope_map.borrow().get(&node_id).cloned() {
         Some(scope_metadata) => scope_metadata,
         None => {
             let node = fcx.ccx.tcx().map.get(node_id);
@@ -2417,7 +2417,7 @@ fn prepare_enum_metadata(cx: &CrateContext,
         // this cache.
         let cached_discriminant_type_metadata = debug_context(cx).created_enum_disr_types
                                                                  .borrow()
-                                                                 .find_copy(&enum_def_id);
+                                                                 .get(&enum_def_id).cloned();
         match cached_discriminant_type_metadata {
             Some(discriminant_type_metadata) => discriminant_type_metadata,
             None => {
@@ -3987,7 +3987,7 @@ fn namespace_for_item(cx: &CrateContext, def_id: ast::DefId) -> Rc<NamespaceTree
             current_key.push(name);
 
             let existing_node = debug_context(cx).namespace_map.borrow()
-                                                 .find_copy(&current_key);
+                                                 .get(&current_key).cloned();
             let current_node = match existing_node {
                 Some(existing_node) => existing_node,
                 None => {
diff --git a/src/librustc/middle/trans/expr.rs b/src/librustc/middle/trans/expr.rs
index 4b61f0c1409..ea590a669d0 100644
--- a/src/librustc/middle/trans/expr.rs
+++ b/src/librustc/middle/trans/expr.rs
@@ -184,7 +184,7 @@ fn apply_adjustments<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
 
     let mut bcx = bcx;
     let mut datum = datum;
-    let adjustment = match bcx.tcx().adjustments.borrow().find_copy(&expr.id) {
+    let adjustment = match bcx.tcx().adjustments.borrow().get(&expr.id).cloned() {
         None => {
             return DatumBlock::new(bcx, datum);
         }
@@ -1293,7 +1293,7 @@ pub fn with_field_tys<R>(tcx: &ty::ctxt,
                         ty.repr(tcx)).as_slice());
                 }
                 Some(node_id) => {
-                    let def = tcx.def_map.borrow().get_copy(&node_id);
+                    let def = tcx.def_map.borrow()[node_id].clone();
                     match def {
                         def::DefVariant(enum_id, variant_id, _) => {
                             let variant_info = ty::enum_variant_with_id(
diff --git a/src/librustc/middle/trans/meth.rs b/src/librustc/middle/trans/meth.rs
index f0af123221f..4af4b397a6e 100644
--- a/src/librustc/middle/trans/meth.rs
+++ b/src/librustc/middle/trans/meth.rs
@@ -301,7 +301,7 @@ pub fn trans_static_method_callee(bcx: Block,
 
 fn method_with_name(ccx: &CrateContext, impl_id: ast::DefId, name: ast::Name)
                     -> ast::DefId {
-    match ccx.impl_method_cache().borrow().find_copy(&(impl_id, name)) {
+    match ccx.impl_method_cache().borrow().get(&(impl_id, name)).cloned() {
         Some(m) => return m,
         None => {}
     }
diff --git a/src/librustc/middle/trans/type_of.rs b/src/librustc/middle/trans/type_of.rs
index 379d1e85b8b..c185a1ba539 100644
--- a/src/librustc/middle/trans/type_of.rs
+++ b/src/librustc/middle/trans/type_of.rs
@@ -174,7 +174,7 @@ pub fn type_of_fn_from_ty(cx: &CrateContext, fty: ty::t) -> Type {
 //     recursive types. For example, enum types rely on this behavior.
 
 pub fn sizing_type_of(cx: &CrateContext, t: ty::t) -> Type {
-    match cx.llsizingtypes().borrow().find_copy(&t) {
+    match cx.llsizingtypes().borrow().get(&t).cloned() {
         Some(t) => return t,
         None => ()
     }
diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs
index 97160e7a6d1..059394dc832 100644
--- a/src/librustc/middle/ty.rs
+++ b/src/librustc/middle/ty.rs
@@ -3189,7 +3189,7 @@ pub fn node_id_to_trait_ref(cx: &ctxt, id: ast::NodeId) -> Rc<ty::TraitRef> {
 }
 
 pub fn try_node_id_to_type(cx: &ctxt, id: ast::NodeId) -> Option<t> {
-    cx.node_types.borrow().find_copy(&id)
+    cx.node_types.borrow().get(&id).cloned()
 }
 
 pub fn node_id_to_type(cx: &ctxt, id: ast::NodeId) -> t {
@@ -4051,7 +4051,7 @@ fn lookup_locally_or_in_crate_store<V:Clone>(
      * the crate loading code (and cache the result for the future).
      */
 
-    match map.find_copy(&def_id) {
+    match map.get(&def_id).cloned() {
         Some(v) => { return v; }
         None => { }
     }
@@ -4073,7 +4073,7 @@ pub fn trait_item(cx: &ctxt, trait_did: ast::DefId, idx: uint)
 pub fn trait_items(cx: &ctxt, trait_did: ast::DefId)
                    -> Rc<Vec<ImplOrTraitItem>> {
     let mut trait_items = cx.trait_items_cache.borrow_mut();
-    match trait_items.find_copy(&trait_did) {
+    match trait_items.get(&trait_did).cloned() {
         Some(trait_items) => trait_items,
         None => {
             let def_ids = ty::trait_item_def_ids(cx, trait_did);
@@ -4623,7 +4623,7 @@ pub fn unboxed_closure_upvars(tcx: &ctxt, closure_id: ast::DefId, substs: &Subst
     // This may change if abstract return types of some sort are
     // implemented.
     assert!(closure_id.krate == ast::LOCAL_CRATE);
-    let capture_mode = tcx.capture_modes.borrow().get_copy(&closure_id.node);
+    let capture_mode = tcx.capture_modes.borrow()[closure_id.node].clone();
     match tcx.freevars.borrow().get(&closure_id.node) {
         None => vec![],
         Some(ref freevars) => {
@@ -4632,10 +4632,10 @@ pub fn unboxed_closure_upvars(tcx: &ctxt, closure_id: ast::DefId, substs: &Subst
                 let freevar_ty = node_id_to_type(tcx, freevar_def_id.node);
                 let mut freevar_ty = freevar_ty.subst(tcx, substs);
                 if capture_mode == ast::CaptureByRef {
-                    let borrow = tcx.upvar_borrow_map.borrow().get_copy(&ty::UpvarId {
+                    let borrow = tcx.upvar_borrow_map.borrow()[ty::UpvarId {
                         var_id: freevar_def_id.node,
                         closure_expr_id: closure_id.node
-                    });
+                    }].clone();
                     freevar_ty = mk_rptr(tcx, borrow.region, ty::mt {
                         ty: freevar_ty,
                         mutbl: borrow.kind.to_mutbl_lossy()
@@ -4734,7 +4734,7 @@ pub fn normalize_ty(cx: &ctxt, t: t) -> t {
         fn tcx(&self) -> &ctxt<'tcx> { let TypeNormalizer(c) = *self; c }
 
         fn fold_ty(&mut self, t: ty::t) -> ty::t {
-            match self.tcx().normalized_cache.borrow().find_copy(&t) {
+            match self.tcx().normalized_cache.borrow().get(&t).cloned() {
                 None => {}
                 Some(u) => return u
             }
@@ -4886,7 +4886,7 @@ pub fn required_region_bounds(tcx: &ctxt,
 
 pub fn get_tydesc_ty(tcx: &ctxt) -> Result<t, String> {
     tcx.lang_items.require(TyDescStructLangItem).map(|tydesc_lang_item| {
-        tcx.intrinsic_defs.borrow().find_copy(&tydesc_lang_item)
+        tcx.intrinsic_defs.borrow().get(&tydesc_lang_item).cloned()
             .expect("Failed to resolve TyDesc")
     })
 }
@@ -5037,7 +5037,7 @@ pub fn impl_of_method(tcx: &ctxt, def_id: ast::DefId)
             ImplContainer(def_id) => Some(def_id),
         };
     }
-    match tcx.impl_or_trait_items.borrow().find_copy(&def_id) {
+    match tcx.impl_or_trait_items.borrow().get(&def_id).cloned() {
         Some(trait_item) => {
             match trait_item.container() {
                 TraitContainer(_) => None,
@@ -5055,7 +5055,7 @@ pub fn trait_of_item(tcx: &ctxt, def_id: ast::DefId) -> Option<ast::DefId> {
     if def_id.krate != LOCAL_CRATE {
         return csearch::get_trait_of_item(&tcx.sess.cstore, def_id, tcx);
     }
-    match tcx.impl_or_trait_items.borrow().find_copy(&def_id) {
+    match tcx.impl_or_trait_items.borrow().get(&def_id).cloned() {
         Some(impl_or_trait_item) => {
             match impl_or_trait_item.container() {
                 TraitContainer(def_id) => Some(def_id),
@@ -5444,12 +5444,12 @@ impl<'tcx> mc::Typer<'tcx> for ty::ctxt<'tcx> {
     }
 
     fn upvar_borrow(&self, upvar_id: ty::UpvarId) -> ty::UpvarBorrow {
-        self.upvar_borrow_map.borrow().get_copy(&upvar_id)
+        self.upvar_borrow_map.borrow()[upvar_id].clone()
     }
 
     fn capture_mode(&self, closure_expr_id: ast::NodeId)
                     -> ast::CaptureClause {
-        self.capture_modes.borrow().get_copy(&closure_expr_id)
+        self.capture_modes.borrow()[closure_expr_id].clone()
     }
 
     fn unboxed_closures<'a>(&'a self)
diff --git a/src/librustc/middle/typeck/check/_match.rs b/src/librustc/middle/typeck/check/_match.rs
index c15b6e6ddae..90c3d8c4f3f 100644
--- a/src/librustc/middle/typeck/check/_match.rs
+++ b/src/librustc/middle/typeck/check/_match.rs
@@ -71,7 +71,7 @@ pub fn check_pat(pcx: &pat_ctxt, pat: &ast::Pat, expected: ty::t) {
             demand::eqtype(fcx, pat.span, expected, lhs_ty);
         }
         ast::PatEnum(..) | ast::PatIdent(..) if pat_is_const(&tcx.def_map, pat) => {
-            let const_did = tcx.def_map.borrow().get_copy(&pat.id).def_id();
+            let const_did = tcx.def_map.borrow()[pat.id].clone().def_id();
             let const_pty = ty::lookup_item_type(tcx, const_did);
             fcx.write_ty(pat.id, const_pty.ty);
             demand::suptype(fcx, pat.span, expected, const_pty.ty);
@@ -296,7 +296,7 @@ pub fn check_pat_struct(pcx: &pat_ctxt, pat: &ast::Pat,
     let fcx = pcx.fcx;
     let tcx = pcx.fcx.ccx.tcx;
 
-    let def = tcx.def_map.borrow().get_copy(&pat.id);
+    let def = tcx.def_map.borrow()[pat.id].clone();
     let def_type = ty::lookup_item_type(tcx, def.def_id());
     let (enum_def_id, variant_def_id) = match ty::get(def_type.ty).sty {
         ty::ty_struct(struct_def_id, _) =>
@@ -341,7 +341,7 @@ pub fn check_pat_enum(pcx: &pat_ctxt, pat: &ast::Pat,
     let fcx = pcx.fcx;
     let tcx = pcx.fcx.ccx.tcx;
 
-    let def = tcx.def_map.borrow().get_copy(&pat.id);
+    let def = tcx.def_map.borrow()[pat.id].clone();
     let enum_def = def.variant_def_ids()
         .map_or_else(|| def.def_id(), |(enum_def, _)| enum_def);
 
@@ -449,7 +449,7 @@ pub fn check_struct_pat_fields(pcx: &pat_ctxt,
             }
             Vacant(vacant) => {
                 vacant.set(span);
-                field_type_map.find_copy(&field.ident.name)
+                field_type_map.get(&field.ident.name).cloned()
                     .unwrap_or_else(|| {
                         span_err!(tcx.sess, span, E0026,
                             "struct `{}` does not have a field named `{}`",
diff --git a/src/librustc/middle/typeck/check/mod.rs b/src/librustc/middle/typeck/check/mod.rs
index 37fb368b54b..d783286272c 100644
--- a/src/librustc/middle/typeck/check/mod.rs
+++ b/src/librustc/middle/typeck/check/mod.rs
@@ -309,7 +309,7 @@ impl<'a, 'tcx> mem_categorization::Typer<'tcx> for FnCtxt<'a, 'tcx> {
         self.tcx().temporary_scope(rvalue_id)
     }
     fn upvar_borrow(&self, upvar_id: ty::UpvarId) -> ty::UpvarBorrow {
-        self.inh.upvar_borrow_map.borrow().get_copy(&upvar_id)
+        self.inh.upvar_borrow_map.borrow()[upvar_id].clone()
     }
     fn capture_mode(&self, closure_expr_id: ast::NodeId)
                     -> ast::CaptureClause {
@@ -450,7 +450,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for GatherLocalsVisitor<'a, 'tcx> {
         debug!("Local variable {} is assigned type {}",
                self.fcx.pat_to_string(&*local.pat),
                self.fcx.infcx().ty_to_string(
-                   self.fcx.inh.locals.borrow().get_copy(&local.id)));
+                   self.fcx.inh.locals.borrow()[local.id].clone()));
         visit::walk_local(self, local);
     }
 
@@ -467,7 +467,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for GatherLocalsVisitor<'a, 'tcx> {
                     debug!("Pattern binding {} is assigned to {} with type {}",
                            token::get_ident(path1.node),
                            self.fcx.infcx().ty_to_string(
-                               self.fcx.inh.locals.borrow().get_copy(&p.id)),
+                               self.fcx.inh.locals.borrow()[p.id].clone()),
                            var_ty.repr(self.fcx.tcx()));
                 }
             _ => {}
diff --git a/src/librustc/middle/typeck/check/regionck.rs b/src/librustc/middle/typeck/check/regionck.rs
index 9aa047e068f..c63e8944dbd 100644
--- a/src/librustc/middle/typeck/check/regionck.rs
+++ b/src/librustc/middle/typeck/check/regionck.rs
@@ -479,12 +479,12 @@ impl<'fcx, 'tcx> mc::Typer<'tcx> for Rcx<'fcx, 'tcx> {
     }
 
     fn upvar_borrow(&self, id: ty::UpvarId) -> ty::UpvarBorrow {
-        self.fcx.inh.upvar_borrow_map.borrow().get_copy(&id)
+        self.fcx.inh.upvar_borrow_map.borrow()[id].clone()
     }
 
     fn capture_mode(&self, closure_expr_id: ast::NodeId)
                     -> ast::CaptureClause {
-        self.tcx().capture_modes.borrow().get_copy(&closure_expr_id)
+        self.tcx().capture_modes.borrow()[closure_expr_id].clone()
     }
 
     fn unboxed_closures<'a>(&'a self)
@@ -871,7 +871,7 @@ fn check_expr_fn_block(rcx: &mut Rcx,
             });
         }
         ty::ty_unboxed_closure(_, region, _) => {
-            if tcx.capture_modes.borrow().get_copy(&expr.id) == ast::CaptureByRef {
+            if tcx.capture_modes.borrow()[expr.id].clone() == ast::CaptureByRef {
                 ty::with_freevars(tcx, expr.id, |freevars| {
                     if !freevars.is_empty() {
                         // Variables being referenced must be constrained and registered
@@ -896,7 +896,7 @@ fn check_expr_fn_block(rcx: &mut Rcx,
             })
         }
         ty::ty_unboxed_closure(..) => {
-            if tcx.capture_modes.borrow().get_copy(&expr.id) == ast::CaptureByRef {
+            if tcx.capture_modes.borrow()[expr.id].clone() == ast::CaptureByRef {
                 ty::with_freevars(tcx, expr.id, |freevars| {
                     propagate_upupvar_borrow_kind(rcx, expr, freevars);
                 });
@@ -1847,7 +1847,7 @@ fn link_upvar_borrow_kind_for_nested_closures(rcx: &mut Rcx,
            inner_upvar_id, outer_upvar_id);
 
     let mut upvar_borrow_map = rcx.fcx.inh.upvar_borrow_map.borrow_mut();
-    let inner_borrow = upvar_borrow_map.get_copy(&inner_upvar_id);
+    let inner_borrow = upvar_borrow_map[inner_upvar_id].clone();
     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);
diff --git a/src/librustc/middle/typeck/coherence/mod.rs b/src/librustc/middle/typeck/coherence/mod.rs
index ca03e9d96e8..574b04c9e99 100644
--- a/src/librustc/middle/typeck/coherence/mod.rs
+++ b/src/librustc/middle/typeck/coherence/mod.rs
@@ -317,7 +317,7 @@ impl<'a, 'tcx> CoherenceChecker<'a, 'tcx> {
 
     fn get_self_type_for_implementation(&self, impl_did: DefId)
                                         -> Polytype {
-        self.crate_context.tcx.tcache.borrow().get_copy(&impl_did)
+        self.crate_context.tcx.tcache.borrow()[impl_did].clone()
     }
 
     // Converts an implementation in the AST to a vector of items.
@@ -428,7 +428,7 @@ impl<'a, 'tcx> CoherenceChecker<'a, 'tcx> {
         };
 
         let impl_items = tcx.impl_items.borrow();
-        let trait_impls = match tcx.trait_impls.borrow().find_copy(&drop_trait) {
+        let trait_impls = match tcx.trait_impls.borrow().get(&drop_trait).cloned() {
             None => return, // No types with (new-style) dtors present.
             Some(found_impls) => found_impls
         };
diff --git a/src/librustc/middle/typeck/infer/region_inference/mod.rs b/src/librustc/middle/typeck/infer/region_inference/mod.rs
index dcf618d94c2..d57343e004b 100644
--- a/src/librustc/middle/typeck/infer/region_inference/mod.rs
+++ b/src/librustc/middle/typeck/infer/region_inference/mod.rs
@@ -1520,7 +1520,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
                     ConstrainVarSubReg(_, region) => {
                         state.result.push(RegionAndOrigin {
                             region: region,
-                            origin: this.constraints.borrow().get_copy(&edge.data)
+                            origin: this.constraints.borrow()[edge.data].clone()
                         });
                     }
                 }
diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs
index 4d26fa7e26c..779cd425d2a 100644
--- a/src/libstd/collections/hash/map.rs
+++ b/src/libstd/collections/hash/map.rs
@@ -37,7 +37,6 @@ use super::table::{
 };
 
 // FIXME(conventions): update capacity management to match other collections (no auto-shrink)
-// FIXME(conventions): axe find_copy/get_copy in favour of Option.cloned (also implement that)
 
 const INITIAL_LOG2_CAP: uint = 5;
 pub const INITIAL_CAPACITY: uint = 1 << INITIAL_LOG2_CAP; // 2^5
@@ -1220,36 +1219,18 @@ fn search_entry_hashed<'a, K: Eq, V>(table: &'a mut RawTable<K,V>, hash: SafeHas
 }
 
 impl<K: Eq + Hash<S>, V: Clone, S, H: Hasher<S>> HashMap<K, V, H> {
-    /// Return a copy of the value corresponding to the key.
-    ///
-    /// # Example
+    /// Deprecated: Use `map.get(k).cloned()`.
     ///
-    /// ```
-    /// use std::collections::HashMap;
-    ///
-    /// let mut map: HashMap<uint, String> = HashMap::new();
-    /// map.insert(1u, "foo".to_string());
-    /// let s: String = map.find_copy(&1).unwrap();
-    /// ```
+    /// Return a copy of the value corresponding to the key.
+    #[deprecated = "Use `map.get(k).cloned()`"]
     pub fn find_copy(&self, k: &K) -> Option<V> {
-        self.get(k).map(|v| (*v).clone())
+        self.get(k).cloned()
     }
 
-    /// Return a copy of the value corresponding to the key.
+    /// Deprecated: Use `map[k].clone()`.
     ///
-    /// # Panics
-    ///
-    /// Panics if the key is not present.
-    ///
-    /// # Example
-    ///
-    /// ```
-    /// use std::collections::HashMap;
-    ///
-    /// let mut map: HashMap<uint, String> = HashMap::new();
-    /// map.insert(1u, "foo".to_string());
-    /// let s: String = map.get_copy(&1);
-    /// ```
+    /// Return a copy of the value corresponding to the key.
+    #[deprecated = "Use `map[k].clone()`"]
     pub fn get_copy(&self, k: &K) -> V {
         self[*k].clone()
     }
@@ -1844,6 +1825,7 @@ mod test_map {
     }
 
     #[test]
+    #[allow(deprecated)]
     fn test_find_copy() {
         let mut m = HashMap::new();
         assert!(m.get(&1i).is_none());
diff --git a/src/libsyntax/ext/tt/transcribe.rs b/src/libsyntax/ext/tt/transcribe.rs
index 5842afe11ce..3cb861aac20 100644
--- a/src/libsyntax/ext/tt/transcribe.rs
+++ b/src/libsyntax/ext/tt/transcribe.rs
@@ -94,7 +94,7 @@ fn lookup_cur_matched_by_matched(r: &TtReader, start: Rc<NamedMatch>) -> Rc<Name
 }
 
 fn lookup_cur_matched(r: &TtReader, name: Ident) -> Option<Rc<NamedMatch>> {
-    let matched_opt = r.interpolations.find_copy(&name);
+    let matched_opt = r.interpolations.get(&name).cloned();
     matched_opt.map(|s| lookup_cur_matched_by_matched(r, s))
 }