From 989a3034db113d014d9247be62ea3af811888412 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Mon, 30 May 2016 15:17:16 +0200 Subject: [PATCH] Move driver::Resolutions::def_map out of its RefCell. --- src/librustc_driver/driver.rs | 10 +++++----- src/librustc_driver/test.rs | 5 +++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/librustc_driver/driver.rs b/src/librustc_driver/driver.rs index a8ddc7e7bda..d6d944fde5f 100644 --- a/src/librustc_driver/driver.rs +++ b/src/librustc_driver/driver.rs @@ -63,7 +63,7 @@ #[derive(Clone)] pub struct Resolutions { - pub def_map: RefCell, + 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, diff --git a/src/librustc_driver/test.rs b/src/librustc_driver/test.rs index e0d693c4230..b1df80403c0 100644 --- a/src/librustc_driver/test.rs +++ b/src/librustc_driver/test.rs @@ -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(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,