Skip to content

Commit f5781f1

Browse files
committed
Remove use of RefCell<DefMap> in check_static_recursion
1 parent 8a69a00 commit f5781f1

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/librustc/middle/check_static_recursion.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use std::cell::RefCell;
2727

2828
struct CheckCrateVisitor<'a, 'ast: 'a> {
2929
sess: &'a Session,
30-
def_map: &'a RefCell<DefMap>,
30+
def_map: &'a DefMap,
3131
ast_map: &'a ast_map::Map<'ast>,
3232
// `discriminant_map` is a cache that associates the `NodeId`s of local
3333
// variant definitions with the discriminant expression that applies to
@@ -92,7 +92,7 @@ impl<'a, 'ast: 'a> Visitor<'ast> for CheckCrateVisitor<'a, 'ast> {
9292

9393
pub fn check_crate<'ast>(sess: &Session,
9494
krate: &'ast hir::Crate,
95-
def_map: &RefCell<DefMap>,
95+
def_map: &DefMap,
9696
ast_map: &ast_map::Map<'ast>) {
9797
let mut visitor = CheckCrateVisitor {
9898
sess: sess,
@@ -108,7 +108,7 @@ struct CheckItemRecursionVisitor<'a, 'ast: 'a> {
108108
root_span: &'a Span,
109109
sess: &'a Session,
110110
ast_map: &'a ast_map::Map<'ast>,
111-
def_map: &'a RefCell<DefMap>,
111+
def_map: &'a DefMap,
112112
discriminant_map: &'a RefCell<NodeMap<Option<&'ast hir::Expr>>>,
113113
idstack: Vec<ast::NodeId>,
114114
}
@@ -237,7 +237,7 @@ impl<'a, 'ast: 'a> Visitor<'ast> for CheckItemRecursionVisitor<'a, 'ast> {
237237
fn visit_expr(&mut self, e: &'ast hir::Expr) {
238238
match e.node {
239239
hir::ExprPath(..) => {
240-
match self.def_map.borrow().get(&e.id).map(|d| d.base_def) {
240+
match self.def_map.get(&e.id).map(|d| d.base_def) {
241241
Some(DefStatic(def_id, _)) |
242242
Some(DefAssociatedConst(def_id)) |
243243
Some(DefConst(def_id)) => {

src/librustc_driver/driver.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,7 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session,
718718
middle::check_loop::check_crate(sess, krate));
719719

720720
time(time_passes, "static item recursion checking", ||
721-
middle::check_static_recursion::check_crate(sess, krate, &def_map, &ast_map));
721+
middle::check_static_recursion::check_crate(sess, krate, &def_map.borrow(), &ast_map));
722722

723723
ty::ctxt::create_and_enter(sess,
724724
arenas,

0 commit comments

Comments
 (0)