incr.comp.: Use ensure() for some coherence-related queries.
This commit is contained in:
parent
dba52ced4c
commit
44a0522b18
@ -102,7 +102,7 @@ impl<'tcx> QueryDescription<'tcx> for queries::type_param_predicates<'tcx> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> QueryDescription<'tcx> for queries::coherent_trait<'tcx> {
|
impl<'tcx> QueryDescription<'tcx> for queries::coherent_trait<'tcx> {
|
||||||
fn describe(tcx: TyCtxt, (_, def_id): (CrateNum, DefId)) -> String {
|
fn describe(tcx: TyCtxt, def_id: DefId) -> String {
|
||||||
format!("coherence checking all impls of trait `{}`",
|
format!("coherence checking all impls of trait `{}`",
|
||||||
tcx.item_path_str(def_id))
|
tcx.item_path_str(def_id))
|
||||||
}
|
}
|
||||||
|
@ -187,7 +187,7 @@ define_maps! { <'tcx>
|
|||||||
|
|
||||||
[] fn has_typeck_tables: HasTypeckTables(DefId) -> bool,
|
[] fn has_typeck_tables: HasTypeckTables(DefId) -> bool,
|
||||||
|
|
||||||
[] fn coherent_trait: coherent_trait_dep_node((CrateNum, DefId)) -> (),
|
[] fn coherent_trait: CoherenceCheckTrait(DefId) -> (),
|
||||||
|
|
||||||
[] fn borrowck: BorrowCheck(DefId) -> Rc<BorrowCheckResult>,
|
[] fn borrowck: BorrowCheck(DefId) -> Rc<BorrowCheckResult>,
|
||||||
|
|
||||||
@ -385,10 +385,6 @@ fn fulfill_obligation_dep_node<'tcx>((param_env, trait_ref):
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn coherent_trait_dep_node<'tcx>((_, def_id): (CrateNum, DefId)) -> DepConstructor<'tcx> {
|
|
||||||
DepConstructor::CoherenceCheckTrait(def_id)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn crate_inherent_impls_dep_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
|
fn crate_inherent_impls_dep_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
|
||||||
DepConstructor::Coherence
|
DepConstructor::Coherence
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
//! misc. type-system utilities too small to deserve their own file
|
//! misc. type-system utilities too small to deserve their own file
|
||||||
|
|
||||||
use hir::def::Def;
|
use hir::def::Def;
|
||||||
use hir::def_id::{DefId, LOCAL_CRATE};
|
use hir::def_id::DefId;
|
||||||
use hir::map::{DefPathData, Node};
|
use hir::map::{DefPathData, Node};
|
||||||
use hir;
|
use hir;
|
||||||
use ich::NodeIdHashingMode;
|
use ich::NodeIdHashingMode;
|
||||||
@ -427,7 +427,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
|
|||||||
return None;
|
return None;
|
||||||
};
|
};
|
||||||
|
|
||||||
self.coherent_trait((LOCAL_CRATE, drop_trait));
|
ty::maps::queries::coherent_trait::ensure(self, drop_trait);
|
||||||
|
|
||||||
let mut dtor_did = None;
|
let mut dtor_did = None;
|
||||||
let ty = self.type_of(adt_did);
|
let ty = self.type_of(adt_did);
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
// done by the orphan and overlap modules. Then we build up various
|
// done by the orphan and overlap modules. Then we build up various
|
||||||
// mappings. That mapping code resides here.
|
// mappings. That mapping code resides here.
|
||||||
|
|
||||||
use hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
|
use hir::def_id::{DefId, LOCAL_CRATE};
|
||||||
use rustc::ty::{TyCtxt, TypeFoldable};
|
use rustc::ty::{self, TyCtxt, TypeFoldable};
|
||||||
use rustc::ty::maps::Providers;
|
use rustc::ty::maps::Providers;
|
||||||
|
|
||||||
use syntax::ast;
|
use syntax::ast;
|
||||||
@ -113,8 +113,7 @@ pub fn provide(providers: &mut Providers) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
fn coherent_trait<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
fn coherent_trait<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) {
|
||||||
(_, def_id): (CrateNum, DefId)) {
|
|
||||||
let impls = tcx.hir.trait_impls(def_id);
|
let impls = tcx.hir.trait_impls(def_id);
|
||||||
for &impl_id in impls {
|
for &impl_id in impls {
|
||||||
check_impl(tcx, impl_id);
|
check_impl(tcx, impl_id);
|
||||||
@ -127,7 +126,7 @@ fn coherent_trait<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
|||||||
|
|
||||||
pub fn check_coherence<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
|
pub fn check_coherence<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
|
||||||
for &trait_def_id in tcx.hir.krate().trait_impls.keys() {
|
for &trait_def_id in tcx.hir.krate().trait_impls.keys() {
|
||||||
tcx.coherent_trait((LOCAL_CRATE, trait_def_id));
|
ty::maps::queries::coherent_trait::ensure(tcx, trait_def_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafety::check(tcx);
|
unsafety::check(tcx);
|
||||||
@ -135,6 +134,6 @@ pub fn check_coherence<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
|
|||||||
overlap::check_auto_impls(tcx);
|
overlap::check_auto_impls(tcx);
|
||||||
|
|
||||||
// these queries are executed for side-effects (error reporting):
|
// these queries are executed for side-effects (error reporting):
|
||||||
tcx.crate_inherent_impls(LOCAL_CRATE);
|
ty::maps::queries::crate_inherent_impls::ensure(tcx, LOCAL_CRATE);
|
||||||
tcx.crate_inherent_impls_overlap_check(LOCAL_CRATE);
|
ty::maps::queries::crate_inherent_impls_overlap_check::ensure(tcx, LOCAL_CRATE);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user