librustc: De-@mut
used_unsafe
in the type context
This commit is contained in:
parent
7b71ca3ef7
commit
01e31683d8
@ -56,7 +56,8 @@ impl EffectCheckVisitor {
|
||||
UnsafeBlock(block_id) => {
|
||||
// OK, but record this.
|
||||
debug!("effect: recording unsafe block as used: {:?}", block_id);
|
||||
let _ = self.tcx.used_unsafe.insert(block_id);
|
||||
let mut used_unsafe = self.tcx.used_unsafe.borrow_mut();
|
||||
let _ = used_unsafe.get().insert(block_id);
|
||||
}
|
||||
UnsafeFn => {}
|
||||
}
|
||||
|
@ -1001,8 +1001,9 @@ fn check_unused_unsafe(cx: &Context, e: &ast::Expr) {
|
||||
match e.node {
|
||||
// Don't warn about generated blocks, that'll just pollute the output.
|
||||
ast::ExprBlock(ref blk) => {
|
||||
let used_unsafe = cx.tcx.used_unsafe.borrow();
|
||||
if blk.rules == ast::UnsafeBlock(ast::UserProvided) &&
|
||||
!cx.tcx.used_unsafe.contains(&blk.id) {
|
||||
!used_unsafe.get().contains(&blk.id) {
|
||||
cx.span_lint(unused_unsafe, blk.span,
|
||||
"unnecessary `unsafe` block");
|
||||
}
|
||||
|
@ -348,7 +348,7 @@ struct ctxt_ {
|
||||
|
||||
// Set of used unsafe nodes (functions or blocks). Unsafe nodes not
|
||||
// present in this set can be warned about.
|
||||
used_unsafe: @mut HashSet<ast::NodeId>,
|
||||
used_unsafe: RefCell<HashSet<ast::NodeId>>,
|
||||
|
||||
// Set of nodes which mark locals as mutable which end up getting used at
|
||||
// some point. Local variable definitions not in this set can be warned
|
||||
@ -1004,7 +1004,7 @@ pub fn mk_ctxt(s: session::Session,
|
||||
trait_impls: RefCell::new(HashMap::new()),
|
||||
inherent_impls: RefCell::new(HashMap::new()),
|
||||
impls: RefCell::new(HashMap::new()),
|
||||
used_unsafe: @mut HashSet::new(),
|
||||
used_unsafe: RefCell::new(HashSet::new()),
|
||||
used_mut_nodes: @mut HashSet::new(),
|
||||
impl_vtables: RefCell::new(HashMap::new()),
|
||||
populated_external_types: @mut HashSet::new(),
|
||||
|
Loading…
x
Reference in New Issue
Block a user