File tree Expand file tree Collapse file tree 3 files changed +6
-4
lines changed Expand file tree Collapse file tree 3 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -56,7 +56,8 @@ impl EffectCheckVisitor {
56
56
UnsafeBlock ( block_id) => {
57
57
// OK, but record this.
58
58
debug ! ( "effect: recording unsafe block as used: {:?}" , block_id) ;
59
- let _ = self . tcx . used_unsafe . insert ( block_id) ;
59
+ let mut used_unsafe = self . tcx . used_unsafe . borrow_mut ( ) ;
60
+ let _ = used_unsafe. get ( ) . insert ( block_id) ;
60
61
}
61
62
UnsafeFn => { }
62
63
}
Original file line number Diff line number Diff line change @@ -1001,8 +1001,9 @@ fn check_unused_unsafe(cx: &Context, e: &ast::Expr) {
1001
1001
match e. node {
1002
1002
// Don't warn about generated blocks, that'll just pollute the output.
1003
1003
ast:: ExprBlock ( ref blk) => {
1004
+ let used_unsafe = cx. tcx . used_unsafe . borrow ( ) ;
1004
1005
if blk. rules == ast:: UnsafeBlock ( ast:: UserProvided ) &&
1005
- !cx . tcx . used_unsafe . contains ( & blk. id ) {
1006
+ !used_unsafe. get ( ) . contains ( & blk. id ) {
1006
1007
cx. span_lint ( unused_unsafe, blk. span ,
1007
1008
"unnecessary `unsafe` block" ) ;
1008
1009
}
Original file line number Diff line number Diff line change @@ -348,7 +348,7 @@ struct ctxt_ {
348
348
349
349
// Set of used unsafe nodes (functions or blocks). Unsafe nodes not
350
350
// present in this set can be warned about.
351
- used_unsafe : @ mut HashSet < ast:: NodeId > ,
351
+ used_unsafe : RefCell < HashSet < ast:: NodeId > > ,
352
352
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
@@ -1004,7 +1004,7 @@ pub fn mk_ctxt(s: session::Session,
1004
1004
trait_impls : RefCell :: new ( HashMap :: new ( ) ) ,
1005
1005
inherent_impls : RefCell :: new ( HashMap :: new ( ) ) ,
1006
1006
impls : RefCell :: new ( HashMap :: new ( ) ) ,
1007
- used_unsafe : @ mut HashSet :: new ( ) ,
1007
+ used_unsafe : RefCell :: new ( HashSet :: new ( ) ) ,
1008
1008
used_mut_nodes : @mut HashSet :: new ( ) ,
1009
1009
impl_vtables : RefCell :: new ( HashMap :: new ( ) ) ,
1010
1010
populated_external_types : @mut HashSet :: new ( ) ,
You can’t perform that action at this time.
0 commit comments