Skip to content

Commit fd3a387

Browse files
committed
librustc: removed the RefCell around DefMap in resolve_lifetime
1 parent 70e77c7 commit fd3a387

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

src/librustc/middle/resolve_lifetime.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ use syntax::visit;
3333
use syntax::visit::Visitor;
3434
use util::nodemap::NodeMap;
3535

36-
use std::cell::RefCell;
37-
3836
#[derive(Clone, Copy, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable, Debug)]
3937
pub enum DefRegion {
4038
DefStaticRegion,
@@ -55,7 +53,7 @@ struct LifetimeContext<'a> {
5553
sess: &'a Session,
5654
named_region_map: &'a mut NamedRegionMap,
5755
scope: Scope<'a>,
58-
def_map: &'a RefCell<DefMap>,
56+
def_map: &'a DefMap,
5957
// Deep breath. Our representation for poly trait refs contains a single
6058
// binder and thus we only allow a single level of quantification. However,
6159
// the syntax of Rust permits quantification in two places, e.g., `T: for <'a> Foo<'a>`
@@ -91,7 +89,7 @@ type Scope<'a> = &'a ScopeChain<'a>;
9189

9290
static ROOT_SCOPE: ScopeChain<'static> = RootScope;
9391

94-
pub fn krate(sess: &Session, krate: &ast::Crate, def_map: &RefCell<DefMap>) -> NamedRegionMap {
92+
pub fn krate(sess: &Session, krate: &ast::Crate, def_map: &DefMap) -> NamedRegionMap {
9593
let mut named_region_map = NodeMap();
9694
visit::walk_crate(&mut LifetimeContext {
9795
sess: sess,
@@ -174,7 +172,7 @@ impl<'a, 'v> Visitor<'v> for LifetimeContext<'a> {
174172
ast::TyPath(None, ref path) => {
175173
// if this path references a trait, then this will resolve to
176174
// a trait ref, which introduces a binding scope.
177-
match self.def_map.borrow().get(&ty.id).map(|d| (d.base_def, d.depth)) {
175+
match self.def_map.get(&ty.id).map(|d| (d.base_def, d.depth)) {
178176
Some((def::DefTrait(..), 0)) => {
179177
self.with(LateScope(&Vec::new(), self.scope), |_, this| {
180178
this.visit_path(path, ty.id);

src/librustc_driver/driver.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,8 @@ pub fn phase_3_run_analysis_passes<'tcx>(sess: Session,
600600
syntax::ext::mtwt::clear_tables();
601601

602602
let named_region_map = time(time_passes, "lifetime resolution", (),
603-
|_| middle::resolve_lifetime::krate(&sess, krate, &def_map));
603+
|_| middle::resolve_lifetime::krate(&sess, krate,
604+
&def_map.borrow()));
604605

605606
time(time_passes, "looking for entry point", (),
606607
|_| middle::entry::find_entry_point(&sess, &ast_map));

0 commit comments

Comments
 (0)