Remove use of RefCell<DefMap> in check_static_recursion

This commit is contained in:
Jonathan S 2015-11-04 00:20:31 -06:00
parent 8a69a00941
commit f5781f143c
2 changed files with 5 additions and 5 deletions

View File

@ -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)) => {

View File

@ -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,