File tree Expand file tree Collapse file tree 4 files changed +12
-5
lines changed Expand file tree Collapse file tree 4 files changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -357,7 +357,10 @@ impl<'a> CheckLoanCtxt<'a> {
357
357
mc:: cat_local( id) |
358
358
mc:: cat_arg( id) |
359
359
mc:: cat_self( id) => {
360
- this. tcx ( ) . used_mut_nodes . insert ( id) ;
360
+ let mut used_mut_nodes = this. tcx ( )
361
+ . used_mut_nodes
362
+ . borrow_mut ( ) ;
363
+ used_mut_nodes. get ( ) . insert ( id) ;
361
364
return ;
362
365
}
363
366
Original file line number Diff line number Diff line change @@ -607,7 +607,10 @@ impl<'a> GatherLoanCtxt<'a> {
607
607
608
608
match * loan_path {
609
609
LpVar ( local_id) => {
610
- self . tcx ( ) . used_mut_nodes . insert ( local_id) ;
610
+ let mut used_mut_nodes = self . tcx ( )
611
+ . used_mut_nodes
612
+ . borrow_mut ( ) ;
613
+ used_mut_nodes. get ( ) . insert ( local_id) ;
611
614
}
612
615
LpExtend ( base, mc:: McInherited , _) => {
613
616
self . mark_loan_path_as_mutated ( base) ;
Original file line number Diff line number Diff line change @@ -1038,7 +1038,8 @@ fn check_unused_mut_pat(cx: &Context, p: &ast::Pat) {
1038
1038
}
1039
1039
} ;
1040
1040
1041
- if !initial_underscore && !cx. tcx . used_mut_nodes . contains ( & p. id ) {
1041
+ let used_mut_nodes = cx. tcx . used_mut_nodes . borrow ( ) ;
1042
+ if !initial_underscore && !used_mut_nodes. get ( ) . contains ( & p. id ) {
1042
1043
cx. span_lint ( unused_mut, p. span ,
1043
1044
"variable does not need to be mutable" ) ;
1044
1045
}
Original file line number Diff line number Diff line change @@ -353,7 +353,7 @@ struct ctxt_ {
353
353
// Set of nodes which mark locals as mutable which end up getting used at
354
354
// some point. Local variable definitions not in this set can be warned
355
355
// about.
356
- used_mut_nodes : @ mut HashSet < ast:: NodeId > ,
356
+ used_mut_nodes : RefCell < HashSet < ast:: NodeId > > ,
357
357
358
358
// vtable resolution information for impl declarations
359
359
impl_vtables : typeck:: impl_vtable_map ,
@@ -1005,7 +1005,7 @@ pub fn mk_ctxt(s: session::Session,
1005
1005
inherent_impls : RefCell :: new ( HashMap :: new ( ) ) ,
1006
1006
impls : RefCell :: new ( HashMap :: new ( ) ) ,
1007
1007
used_unsafe : RefCell :: new ( HashSet :: new ( ) ) ,
1008
- used_mut_nodes : @ mut HashSet :: new ( ) ,
1008
+ used_mut_nodes : RefCell :: new ( HashSet :: new ( ) ) ,
1009
1009
impl_vtables : RefCell :: new ( HashMap :: new ( ) ) ,
1010
1010
populated_external_types : @mut HashSet :: new ( ) ,
1011
1011
populated_external_traits : @mut HashSet :: new ( ) ,
You can’t perform that action at this time.
0 commit comments