Remove use of RefCell<DefMap> in check_static_recursion
This commit is contained in:
parent
8a69a00941
commit
f5781f143c
@ -27,7 +27,7 @@ use std::cell::RefCell;
|
||||
|
||||
struct CheckCrateVisitor<'a, 'ast: 'a> {
|
||||
sess: &'a Session,
|
||||
def_map: &'a RefCell<DefMap>,
|
||||
def_map: &'a DefMap,
|
||||
ast_map: &'a ast_map::Map<'ast>,
|
||||
// `discriminant_map` is a cache that associates the `NodeId`s of local
|
||||
// variant definitions with the discriminant expression that applies to
|
||||
@ -92,7 +92,7 @@ impl<'a, 'ast: 'a> Visitor<'ast> for CheckCrateVisitor<'a, 'ast> {
|
||||
|
||||
pub fn check_crate<'ast>(sess: &Session,
|
||||
krate: &'ast hir::Crate,
|
||||
def_map: &RefCell<DefMap>,
|
||||
def_map: &DefMap,
|
||||
ast_map: &ast_map::Map<'ast>) {
|
||||
let mut visitor = CheckCrateVisitor {
|
||||
sess: sess,
|
||||
@ -108,7 +108,7 @@ struct CheckItemRecursionVisitor<'a, 'ast: 'a> {
|
||||
root_span: &'a Span,
|
||||
sess: &'a Session,
|
||||
ast_map: &'a ast_map::Map<'ast>,
|
||||
def_map: &'a RefCell<DefMap>,
|
||||
def_map: &'a DefMap,
|
||||
discriminant_map: &'a RefCell<NodeMap<Option<&'ast hir::Expr>>>,
|
||||
idstack: Vec<ast::NodeId>,
|
||||
}
|
||||
@ -237,7 +237,7 @@ impl<'a, 'ast: 'a> Visitor<'ast> for CheckItemRecursionVisitor<'a, 'ast> {
|
||||
fn visit_expr(&mut self, e: &'ast hir::Expr) {
|
||||
match e.node {
|
||||
hir::ExprPath(..) => {
|
||||
match self.def_map.borrow().get(&e.id).map(|d| d.base_def) {
|
||||
match self.def_map.get(&e.id).map(|d| d.base_def) {
|
||||
Some(DefStatic(def_id, _)) |
|
||||
Some(DefAssociatedConst(def_id)) |
|
||||
Some(DefConst(def_id)) => {
|
||||
|
@ -718,7 +718,7 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session,
|
||||
middle::check_loop::check_crate(sess, krate));
|
||||
|
||||
time(time_passes, "static item recursion checking", ||
|
||||
middle::check_static_recursion::check_crate(sess, krate, &def_map, &ast_map));
|
||||
middle::check_static_recursion::check_crate(sess, krate, &def_map.borrow(), &ast_map));
|
||||
|
||||
ty::ctxt::create_and_enter(sess,
|
||||
arenas,
|
||||
|
Loading…
x
Reference in New Issue
Block a user