Skip to content

Commit

Permalink
Hand ownership of the Definitions to map_crate.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ms2ger committed May 11, 2016
1 parent e919f25 commit 5511e65
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/librustc/hir/map/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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> {
Expand Down Expand Up @@ -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);
Expand All @@ -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),
}
}

Expand Down
1 change: 0 additions & 1 deletion src/librustc_driver/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions src/librustc_driver/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);

Expand Down
1 change: 0 additions & 1 deletion src/librustdoc/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 0 additions & 2 deletions src/test/run-make/execution-engine/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit 5511e65

Please sign in to comment.