Skip to content

Commit 561c4e1

Browse files
authored
Auto merge of #35079 - nikomatsakis:incr-comp-ich-32753, r=mw
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)
2 parents 576f766 + 83068eb commit 561c4e1

File tree

16 files changed

+815
-483
lines changed

16 files changed

+815
-483
lines changed

src/librustc/dep_graph/dep_node.rs

+1
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ impl<D: Clone + Debug> DepNode<D> {
150150
check! {
151151
CollectItem,
152152
BorrowCheck,
153+
Hir,
153154
TransCrateItem,
154155
TypeckItemType,
155156
TypeckItemBody,

src/librustc/ty/context.rs

+11
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ use dep_graph::{DepGraph, DepTrackingMap};
1414
use session::Session;
1515
use middle;
1616
use middle::cstore::LOCAL_CRATE;
17+
use hir::TraitMap;
1718
use hir::def::DefMap;
1819
use hir::def_id::{DefId, DefIndex};
1920
use hir::map as ast_map;
@@ -299,8 +300,16 @@ pub struct GlobalCtxt<'tcx> {
299300
pub types: CommonTypes<'tcx>,
300301

301302
pub sess: &'tcx Session,
303+
304+
/// Map from path id to the results from resolve; generated
305+
/// initially by resolve and updated during typeck in some cases
306+
/// (e.g., UFCS paths)
302307
pub def_map: RefCell<DefMap>,
303308

309+
/// Map indicating what traits are in scope for places where this
310+
/// is relevant; generated by resolve.
311+
pub trait_map: TraitMap,
312+
304313
pub named_region_map: resolve_lifetime::NamedRegionMap,
305314

306315
pub region_maps: RegionMaps,
@@ -666,6 +675,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
666675
pub fn create_and_enter<F, R>(s: &'tcx Session,
667676
arenas: &'tcx CtxtArenas<'tcx>,
668677
def_map: DefMap,
678+
trait_map: TraitMap,
669679
named_region_map: resolve_lifetime::NamedRegionMap,
670680
map: ast_map::Map<'tcx>,
671681
freevars: FreevarMap,
@@ -694,6 +704,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
694704
variance_computed: Cell::new(false),
695705
sess: s,
696706
def_map: RefCell::new(def_map),
707+
trait_map: trait_map,
697708
tables: RefCell::new(Tables::empty()),
698709
impl_trait_refs: RefCell::new(DepTrackingMap::new(dep_graph.clone())),
699710
trait_defs: RefCell::new(DepTrackingMap::new(dep_graph.clone())),

src/librustc_driver/driver.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -846,10 +846,10 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session,
846846

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

849-
let trait_map = resolutions.trait_map;
850849
TyCtxt::create_and_enter(sess,
851850
arenas,
852851
resolutions.def_map,
852+
resolutions.trait_map,
853853
named_region_map,
854854
hir_map,
855855
resolutions.freevars,
@@ -864,7 +864,7 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session,
864864
|| rustc_incremental::load_dep_graph(tcx));
865865

866866
// passes are timed inside typeck
867-
try_with_f!(typeck::check_crate(tcx, trait_map), (tcx, None, analysis));
867+
try_with_f!(typeck::check_crate(tcx), (tcx, None, analysis));
868868

869869
time(time_passes,
870870
"const checking",

src/librustc_driver/test.rs

+1
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ fn test_env<F>(source_string: &str,
131131
TyCtxt::create_and_enter(&sess,
132132
&arenas,
133133
resolutions.def_map,
134+
resolutions.trait_map,
134135
named_region_map.unwrap(),
135136
ast_map,
136137
resolutions.freevars,

0 commit comments

Comments
 (0)