1818 */
1919
2020use driver:: session:: Session ;
21- use std:: cell:: RefCell ;
2221use std:: vec_ng:: Vec ;
2322use util:: nodemap:: NodeMap ;
2423use syntax:: ast;
@@ -42,7 +41,7 @@ fn lifetime_show(lt_name: &ast::Name) -> token::InternedString {
4241
4342struct LifetimeContext < ' a > {
4443 sess : & ' a Session ,
45- named_region_map : @ RefCell < NamedRegionMap > ,
44+ named_region_map : NamedRegionMap ,
4645}
4746
4847enum ScopeChain < ' a > {
@@ -60,10 +59,10 @@ enum ScopeChain<'a> {
6059
6160type Scope < ' a > = & ' a ScopeChain < ' a > ;
6261
63- pub fn krate ( sess : & Session , krate : & ast:: Crate ) -> @ RefCell < NamedRegionMap > {
62+ pub fn krate ( sess : & Session , krate : & ast:: Crate ) -> NamedRegionMap {
6463 let mut ctxt = LifetimeContext {
6564 sess : sess,
66- named_region_map : @ RefCell :: new ( NodeMap :: new ( ) )
65+ named_region_map : NodeMap :: new ( )
6766 } ;
6867 visit:: walk_crate ( & mut ctxt, krate, & RootScope ) ;
6968 sess. abort_if_errors ( ) ;
@@ -236,7 +235,7 @@ impl<'a> LifetimeContext<'a> {
236235 debug ! ( "popping fn scope id={} due to fn item/method" , n) ;
237236 }
238237
239- fn resolve_lifetime_ref ( & self ,
238+ fn resolve_lifetime_ref ( & mut self ,
240239 lifetime_ref : & ast:: Lifetime ,
241240 scope : Scope ) {
242241 // Walk up the scope chain, tracking the number of fn scopes
@@ -292,7 +291,7 @@ impl<'a> LifetimeContext<'a> {
292291 self . unresolved_lifetime_ref ( lifetime_ref) ;
293292 }
294293
295- fn resolve_free_lifetime_ref ( & self ,
294+ fn resolve_free_lifetime_ref ( & mut self ,
296295 scope_id : ast:: NodeId ,
297296 lifetime_ref : & ast:: Lifetime ,
298297 scope : Scope ) {
@@ -373,7 +372,7 @@ impl<'a> LifetimeContext<'a> {
373372 }
374373 }
375374
376- fn insert_lifetime ( & self ,
375+ fn insert_lifetime ( & mut self ,
377376 lifetime_ref : & ast:: Lifetime ,
378377 def : ast:: DefRegion ) {
379378 if lifetime_ref. id == ast:: DUMMY_NODE_ID {
@@ -386,8 +385,7 @@ impl<'a> LifetimeContext<'a> {
386385 lifetime_to_str( lifetime_ref) ,
387386 lifetime_ref. id,
388387 def) ;
389- let mut named_region_map = self . named_region_map . borrow_mut ( ) ;
390- named_region_map. get ( ) . insert ( lifetime_ref. id , def) ;
388+ self . named_region_map . insert ( lifetime_ref. id , def) ;
391389 }
392390}
393391
0 commit comments