Skip to content

Commit

Permalink
Auto merge of #35079 - nikomatsakis:incr-comp-ich-32753, r=mw
Browse files Browse the repository at this point in the history
Various improvements to the SVH

This fixes a few points for the SVH:

- incorporate resolve results into the SVH;
- don't include nested items.

r? @michaelwoerister

cc #32753 (not fully fixed I don't think)
  • Loading branch information
bors authored Aug 10, 2016
2 parents 576f766 + 83068eb commit 561c4e1
Show file tree
Hide file tree
Showing 16 changed files with 815 additions and 483 deletions.
1 change: 1 addition & 0 deletions src/librustc/dep_graph/dep_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ impl<D: Clone + Debug> DepNode<D> {
check! {
CollectItem,
BorrowCheck,
Hir,
TransCrateItem,
TypeckItemType,
TypeckItemBody,
Expand Down
11 changes: 11 additions & 0 deletions src/librustc/ty/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use dep_graph::{DepGraph, DepTrackingMap};
use session::Session;
use middle;
use middle::cstore::LOCAL_CRATE;
use hir::TraitMap;
use hir::def::DefMap;
use hir::def_id::{DefId, DefIndex};
use hir::map as ast_map;
Expand Down Expand Up @@ -299,8 +300,16 @@ pub struct GlobalCtxt<'tcx> {
pub types: CommonTypes<'tcx>,

pub sess: &'tcx Session,

/// Map from path id to the results from resolve; generated
/// initially by resolve and updated during typeck in some cases
/// (e.g., UFCS paths)
pub def_map: RefCell<DefMap>,

/// Map indicating what traits are in scope for places where this
/// is relevant; generated by resolve.
pub trait_map: TraitMap,

pub named_region_map: resolve_lifetime::NamedRegionMap,

pub region_maps: RegionMaps,
Expand Down Expand Up @@ -666,6 +675,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
pub fn create_and_enter<F, R>(s: &'tcx Session,
arenas: &'tcx CtxtArenas<'tcx>,
def_map: DefMap,
trait_map: TraitMap,
named_region_map: resolve_lifetime::NamedRegionMap,
map: ast_map::Map<'tcx>,
freevars: FreevarMap,
Expand Down Expand Up @@ -694,6 +704,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
variance_computed: Cell::new(false),
sess: s,
def_map: RefCell::new(def_map),
trait_map: trait_map,
tables: RefCell::new(Tables::empty()),
impl_trait_refs: RefCell::new(DepTrackingMap::new(dep_graph.clone())),
trait_defs: RefCell::new(DepTrackingMap::new(dep_graph.clone())),
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_driver/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -846,10 +846,10 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session,

let index = stability::Index::new(&hir_map);

let trait_map = resolutions.trait_map;
TyCtxt::create_and_enter(sess,
arenas,
resolutions.def_map,
resolutions.trait_map,
named_region_map,
hir_map,
resolutions.freevars,
Expand All @@ -864,7 +864,7 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session,
|| rustc_incremental::load_dep_graph(tcx));

// passes are timed inside typeck
try_with_f!(typeck::check_crate(tcx, trait_map), (tcx, None, analysis));
try_with_f!(typeck::check_crate(tcx), (tcx, None, analysis));

time(time_passes,
"const checking",
Expand Down
1 change: 1 addition & 0 deletions src/librustc_driver/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ fn test_env<F>(source_string: &str,
TyCtxt::create_and_enter(&sess,
&arenas,
resolutions.def_map,
resolutions.trait_map,
named_region_map.unwrap(),
ast_map,
resolutions.freevars,
Expand Down
Loading

0 comments on commit 561c4e1

Please sign in to comment.