@@ -245,7 +245,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for EmbargoVisitor<'a, 'tcx> {
245245 ast:: ItemImpl ( _, _, ref ty, ref impl_items) => {
246246 let public_ty = match ty. node {
247247 ast:: TyPath ( _, _, id) => {
248- match self . tcx . def_map . borrow ( ) . get_copy ( & id ) {
248+ match self . tcx . def_map . borrow ( ) [ id ] . clone ( ) {
249249 def:: DefPrimTy ( ..) => true ,
250250 def => {
251251 let did = def. def_id ( ) ;
@@ -313,7 +313,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for EmbargoVisitor<'a, 'tcx> {
313313 ast:: ItemTy ( ref ty, _) if public_first => {
314314 match ty. node {
315315 ast:: TyPath ( _, _, id) => {
316- match self . tcx . def_map . borrow ( ) . get_copy ( & id ) {
316+ match self . tcx . def_map . borrow ( ) [ id ] . clone ( ) {
317317 def:: DefPrimTy ( ..) | def:: DefTyParam ( ..) => { } ,
318318 def => {
319319 let did = def. def_id ( ) ;
@@ -620,7 +620,7 @@ impl<'a, 'tcx> PrivacyVisitor<'a, 'tcx> {
620620 ast:: TyPath ( _, _, id) => id,
621621 _ => return Some ( ( err_span, err_msg, None ) ) ,
622622 } ;
623- let def = self . tcx . def_map . borrow ( ) . get_copy ( & id ) ;
623+ let def = self . tcx . def_map . borrow ( ) [ id ] . clone ( ) ;
624624 let did = def. def_id ( ) ;
625625 assert ! ( is_local( did) ) ;
626626 match self . tcx . map . get ( did. node ) {
@@ -706,7 +706,7 @@ impl<'a, 'tcx> PrivacyVisitor<'a, 'tcx> {
706706 // Checks that a path is in scope.
707707 fn check_path ( & mut self , span : Span , path_id : ast:: NodeId , path : & ast:: Path ) {
708708 debug ! ( "privacy - path {}" , self . nodestr( path_id) ) ;
709- let orig_def = self . tcx . def_map . borrow ( ) . get_copy ( & path_id ) ;
709+ let orig_def = self . tcx . def_map . borrow ( ) [ path_id ] . clone ( ) ;
710710 let ck = |tyname : & str | {
711711 let ck_public = |def : ast:: DefId | {
712712 let name = token:: get_ident ( path. segments
@@ -789,7 +789,7 @@ impl<'a, 'tcx> PrivacyVisitor<'a, 'tcx> {
789789 // def map is not. Therefore the names we work out below will not always
790790 // be accurate and we can get slightly wonky error messages (but type
791791 // checking is always correct).
792- match self . tcx . def_map . borrow ( ) . get_copy ( & path_id ) {
792+ match self . tcx . def_map . borrow ( ) [ path_id ] . clone ( ) {
793793 def:: DefStaticMethod ( ..) => ck ( "static method" ) ,
794794 def:: DefFn ( ..) => ck ( "function" ) ,
795795 def:: DefStatic ( ..) => ck ( "static" ) ,
@@ -873,7 +873,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for PrivacyVisitor<'a, 'tcx> {
873873 }
874874 }
875875 ty:: ty_enum( _, _) => {
876- match self . tcx . def_map . borrow ( ) . get_copy ( & expr. id ) {
876+ match self . tcx . def_map . borrow ( ) [ expr. id ] . clone ( ) {
877877 def:: DefVariant ( _, variant_id, _) => {
878878 for field in fields. iter ( ) {
879879 self . check_field ( expr. span , variant_id,
@@ -1254,7 +1254,7 @@ struct CheckTypeForPrivatenessVisitor<'a, 'b: 'a, 'tcx: 'b> {
12541254
12551255impl < ' a , ' tcx > VisiblePrivateTypesVisitor < ' a , ' tcx > {
12561256 fn path_is_private_type ( & self , path_id : ast:: NodeId ) -> bool {
1257- let did = match self . tcx . def_map . borrow ( ) . find_copy ( & path_id) {
1257+ let did = match self . tcx . def_map . borrow ( ) . get ( & path_id) . cloned ( ) {
12581258 // `int` etc. (None doesn't seem to occur.)
12591259 None | Some ( def:: DefPrimTy ( ..) ) => return false ,
12601260 Some ( def) => def. def_id ( )
0 commit comments