@@ -29,7 +29,7 @@ use hir::*;
29
29
use hir:: print as pprust;
30
30
31
31
use arena:: TypedArena ;
32
- use std:: cell:: { RefCell , Ref } ;
32
+ use std:: cell:: RefCell ;
33
33
use std:: io;
34
34
use std:: mem;
35
35
@@ -221,7 +221,7 @@ pub struct Map<'ast> {
221
221
/// plain old integers.
222
222
map : RefCell < Vec < MapEntry < ' ast > > > ,
223
223
224
- definitions : RefCell < Definitions > ,
224
+ definitions : Definitions ,
225
225
226
226
/// All NodeIds that are numerically greater or equal to this value come
227
227
/// from inlined items.
@@ -392,16 +392,16 @@ impl<'ast> Map<'ast> {
392
392
}
393
393
394
394
pub fn num_local_def_ids ( & self ) -> usize {
395
- self . definitions . borrow ( ) . len ( )
395
+ self . definitions . len ( )
396
396
}
397
397
398
- pub fn definitions ( & self ) -> Ref < Definitions > {
399
- self . definitions . borrow ( )
398
+ pub fn definitions ( & self ) -> & Definitions {
399
+ & self . definitions
400
400
}
401
401
402
402
pub fn def_key ( & self , def_id : DefId ) -> DefKey {
403
403
assert ! ( def_id. is_local( ) ) ;
404
- self . definitions . borrow ( ) . def_key ( def_id. index )
404
+ self . definitions . def_key ( def_id. index )
405
405
}
406
406
407
407
pub fn def_path_from_id ( & self , id : NodeId ) -> Option < DefPath > {
@@ -412,11 +412,11 @@ impl<'ast> Map<'ast> {
412
412
413
413
pub fn def_path ( & self , def_id : DefId ) -> DefPath {
414
414
assert ! ( def_id. is_local( ) ) ;
415
- self . definitions . borrow ( ) . def_path ( def_id. index )
415
+ self . definitions . def_path ( def_id. index )
416
416
}
417
417
418
418
pub fn def_index_for_def_key ( & self , def_key : DefKey ) -> Option < DefIndex > {
419
- self . definitions . borrow ( ) . def_index_for_def_key ( def_key)
419
+ self . definitions . def_index_for_def_key ( def_key)
420
420
}
421
421
422
422
pub fn local_def_id ( & self , node : NodeId ) -> DefId {
@@ -427,11 +427,11 @@ impl<'ast> Map<'ast> {
427
427
}
428
428
429
429
pub fn opt_local_def_id ( & self , node : NodeId ) -> Option < DefId > {
430
- self . definitions . borrow ( ) . opt_local_def_id ( node)
430
+ self . definitions . opt_local_def_id ( node)
431
431
}
432
432
433
433
pub fn as_local_node_id ( & self , def_id : DefId ) -> Option < NodeId > {
434
- self . definitions . borrow ( ) . as_local_node_id ( def_id)
434
+ self . definitions . as_local_node_id ( def_id)
435
435
}
436
436
437
437
fn entry_count ( & self ) -> usize {
@@ -940,7 +940,7 @@ pub fn map_crate<'ast>(forest: &'ast mut Forest,
940
940
forest : forest,
941
941
dep_graph : forest. dep_graph . clone ( ) ,
942
942
map : RefCell :: new ( map) ,
943
- definitions : RefCell :: new ( definitions) ,
943
+ definitions : definitions,
944
944
local_node_id_watermark : local_node_id_watermark,
945
945
local_def_id_watermark : local_def_id_watermark,
946
946
}
0 commit comments