Rollup merge of #33964 - Ms2ger:refcell-resolutions, r=Manishearth

Move driver::Resolutions::def_map out of its RefCell.
This commit is contained in:
Manish Goregaokar 2016-05-30 20:35:47 +05:30
commit 26c209897f
2 changed files with 8 additions and 7 deletions

View File

@ -63,7 +63,7 @@
#[derive(Clone)]
pub struct Resolutions {
pub def_map: RefCell<DefMap>,
pub def_map: DefMap,
pub freevars: FreevarMap,
pub trait_map: TraitMap,
pub maybe_unused_trait_imports: NodeSet,
@ -818,7 +818,7 @@ pub fn lower_and_resolve<'a>(sess: &Session,
name: &id,
glob_map: if resolver.make_glob_map { Some(resolver.glob_map) } else { None },
}, Resolutions {
def_map: RefCell::new(resolver.def_map),
def_map: resolver.def_map,
freevars: resolver.freevars,
trait_map: resolver.trait_map,
maybe_unused_trait_imports: resolver.maybe_unused_trait_imports,
@ -866,7 +866,7 @@ macro_rules! try_with_f {
"lifetime resolution",
|| middle::resolve_lifetime::krate(sess,
&hir_map,
&resolutions.def_map.borrow()))?;
&resolutions.def_map))?;
time(time_passes,
"looking for entry point",
@ -886,14 +886,14 @@ macro_rules! try_with_f {
time(time_passes,
"static item recursion checking",
|| static_recursion::check_crate(sess, &resolutions.def_map.borrow(), &hir_map))?;
|| static_recursion::check_crate(sess, &resolutions.def_map, &hir_map))?;
let index = stability::Index::new(&hir_map);
let trait_map = resolutions.trait_map;
TyCtxt::create_and_enter(sess,
arenas,
resolutions.def_map,
RefCell::new(resolutions.def_map),
named_region_map,
hir_map,
resolutions.freevars,

View File

@ -29,6 +29,7 @@
use rustc_metadata::creader::read_local_crates;
use rustc::hir::map as hir_map;
use rustc::session::{self, config};
use std::cell::RefCell;
use std::rc::Rc;
use syntax::ast;
use syntax::abi::Abi;
@ -134,12 +135,12 @@ fn test_env<F>(source_string: &str,
// run just enough stuff to build a tcx:
let lang_items = lang_items::collect_language_items(&sess, &ast_map);
let named_region_map = resolve_lifetime::krate(&sess, &ast_map, &resolutions.def_map.borrow());
let named_region_map = resolve_lifetime::krate(&sess, &ast_map, &resolutions.def_map);
let region_map = region::resolve_crate(&sess, &ast_map);
let index = stability::Index::new(&ast_map);
TyCtxt::create_and_enter(&sess,
&arenas,
resolutions.def_map,
RefCell::new(resolutions.def_map),
named_region_map.unwrap(),
ast_map,
resolutions.freevars,