Hand ownership of the Definitions to map_crate.

This commit is contained in:
Ms2ger 2016-05-10 15:43:51 +02:00
parent e919f25180
commit 5511e6568f
6 changed files with 4 additions and 10 deletions

View file

@ -196,7 +196,7 @@ pub struct Map<'ast> {
/// plain old integers.
map: RefCell<Vec<MapEntry<'ast>>>,
definitions: &'ast RefCell<Definitions>,
definitions: RefCell<Definitions>,
}
impl<'ast> Map<'ast> {
@ -790,7 +790,7 @@ pub fn collect_definitions<'ast>(krate: &'ast ast::Crate) -> Definitions {
}
pub fn map_crate<'ast>(forest: &'ast mut Forest,
definitions: &'ast RefCell<Definitions>)
definitions: Definitions)
-> Map<'ast> {
let mut collector = NodeCollector::root(&forest.krate);
intravisit::walk_crate(&mut collector, &forest.krate);
@ -816,7 +816,7 @@ pub fn map_crate<'ast>(forest: &'ast mut Forest,
forest: forest,
dep_graph: forest.dep_graph.clone(),
map: RefCell::new(map),
definitions: definitions,
definitions: RefCell::new(definitions),
}
}

View file

@ -165,7 +165,6 @@ pub fn compile_input(sess: &Session,
syntax::ext::mtwt::clear_tables();
}
let defs = &RefCell::new(defs);
let arenas = ty::CtxtArenas::new();
// Construct the HIR map

View file

@ -29,7 +29,6 @@ use rustc_metadata::cstore::CStore;
use rustc_metadata::creader::LocalCrateReader;
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;
@ -129,7 +128,6 @@ fn test_env<F>(source_string: &str,
MakeGlobMap::No)
};
let defs = &RefCell::new(defs);
let arenas = ty::CtxtArenas::new();
let ast_map = hir_map::map_crate(&mut hir_forest, defs);

View file

@ -162,7 +162,6 @@ pub fn run_core(search_paths: SearchPaths,
resolve::MakeGlobMap::No)
};
let defs = &RefCell::new(defs);
let arenas = ty::CtxtArenas::new();
let hir_map = hir_map::map_crate(&mut hir_forest, defs);

View file

@ -95,7 +95,7 @@ pub fn run(input: &str,
.expect("phase_2_configure_and_expand aborted in rustdoc!");
let krate = driver::assign_node_ids(&sess, krate);
let dep_graph = DepGraph::new(false);
let defs = &RefCell::new(hir_map::collect_definitions(&krate));
let defs = hir_map::collect_definitions(&krate);
let mut dummy_resolver = DummyResolver;
let lcx = LoweringContext::new(&sess, Some(&krate), &mut dummy_resolver);

View file

@ -20,7 +20,6 @@ extern crate rustc_metadata;
extern crate rustc_resolve;
#[macro_use] extern crate syntax;
use std::cell::RefCell;
use std::ffi::{CStr, CString};
use std::mem::transmute;
use std::path::PathBuf;
@ -246,7 +245,6 @@ fn compile_program(input: &str, sysroot: PathBuf)
driver::lower_and_resolve(&sess, &id, &mut defs, &krate, dep_graph, MakeGlobMap::No)
};
let defs = &RefCell::new(defs);
let arenas = ty::CtxtArenas::new();
let ast_map = ast_map::map_crate(&mut hir_forest, defs);