@@ -245,7 +245,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for EmbargoVisitor<'a, 'tcx> {
245
245
ast:: ItemImpl ( _, _, ref ty, ref impl_items) => {
246
246
let public_ty = match ty. node {
247
247
ast:: TyPath ( _, _, id) => {
248
- match self . tcx . def_map . borrow ( ) . get_copy ( & id ) {
248
+ match self . tcx . def_map . borrow ( ) [ id ] . clone ( ) {
249
249
def:: DefPrimTy ( ..) => true ,
250
250
def => {
251
251
let did = def. def_id ( ) ;
@@ -313,7 +313,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for EmbargoVisitor<'a, 'tcx> {
313
313
ast:: ItemTy ( ref ty, _) if public_first => {
314
314
match ty. node {
315
315
ast:: TyPath ( _, _, id) => {
316
- match self . tcx . def_map . borrow ( ) . get_copy ( & id ) {
316
+ match self . tcx . def_map . borrow ( ) [ id ] . clone ( ) {
317
317
def:: DefPrimTy ( ..) | def:: DefTyParam ( ..) => { } ,
318
318
def => {
319
319
let did = def. def_id ( ) ;
@@ -620,7 +620,7 @@ impl<'a, 'tcx> PrivacyVisitor<'a, 'tcx> {
620
620
ast:: TyPath ( _, _, id) => id,
621
621
_ => return Some ( ( err_span, err_msg, None ) ) ,
622
622
} ;
623
- let def = self . tcx . def_map . borrow ( ) . get_copy ( & id ) ;
623
+ let def = self . tcx . def_map . borrow ( ) [ id ] . clone ( ) ;
624
624
let did = def. def_id ( ) ;
625
625
assert ! ( is_local( did) ) ;
626
626
match self . tcx . map . get ( did. node ) {
@@ -706,7 +706,7 @@ impl<'a, 'tcx> PrivacyVisitor<'a, 'tcx> {
706
706
// Checks that a path is in scope.
707
707
fn check_path ( & mut self , span : Span , path_id : ast:: NodeId , path : & ast:: Path ) {
708
708
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 ( ) ;
710
710
let ck = |tyname : & str | {
711
711
let ck_public = |def : ast:: DefId | {
712
712
let name = token:: get_ident ( path. segments
@@ -789,7 +789,7 @@ impl<'a, 'tcx> PrivacyVisitor<'a, 'tcx> {
789
789
// def map is not. Therefore the names we work out below will not always
790
790
// be accurate and we can get slightly wonky error messages (but type
791
791
// 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 ( ) {
793
793
def:: DefStaticMethod ( ..) => ck ( "static method" ) ,
794
794
def:: DefFn ( ..) => ck ( "function" ) ,
795
795
def:: DefStatic ( ..) => ck ( "static" ) ,
@@ -873,7 +873,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for PrivacyVisitor<'a, 'tcx> {
873
873
}
874
874
}
875
875
ty:: ty_enum( _, _) => {
876
- match self . tcx . def_map . borrow ( ) . get_copy ( & expr. id ) {
876
+ match self . tcx . def_map . borrow ( ) [ expr. id ] . clone ( ) {
877
877
def:: DefVariant ( _, variant_id, _) => {
878
878
for field in fields. iter ( ) {
879
879
self . check_field ( expr. span , variant_id,
@@ -1255,7 +1255,7 @@ struct CheckTypeForPrivatenessVisitor<'a, 'b: 'a, 'tcx: 'b> {
1255
1255
1256
1256
impl < ' a , ' tcx > VisiblePrivateTypesVisitor < ' a , ' tcx > {
1257
1257
fn path_is_private_type ( & self , path_id : ast:: NodeId ) -> bool {
1258
- let did = match self . tcx . def_map . borrow ( ) . find_copy ( & path_id) {
1258
+ let did = match self . tcx . def_map . borrow ( ) . get ( & path_id) . cloned ( ) {
1259
1259
// `int` etc. (None doesn't seem to occur.)
1260
1260
None | Some ( def:: DefPrimTy ( ..) ) => return false ,
1261
1261
Some ( def) => def. def_id ( )
0 commit comments