Rename traits_in_crate
query to traits
This commit is contained in:
parent
c2ccc855e7
commit
cc1ec49a14
@ -324,7 +324,7 @@ provide! { tcx, def_id, other, cdata,
|
|||||||
|
|
||||||
extra_filename => { cdata.root.extra_filename.clone() }
|
extra_filename => { cdata.root.extra_filename.clone() }
|
||||||
|
|
||||||
traits_in_crate => { tcx.arena.alloc_from_iter(cdata.get_traits()) }
|
traits => { tcx.arena.alloc_from_iter(cdata.get_traits()) }
|
||||||
trait_impls_in_crate => { tcx.arena.alloc_from_iter(cdata.get_trait_impls()) }
|
trait_impls_in_crate => { tcx.arena.alloc_from_iter(cdata.get_trait_impls()) }
|
||||||
implementations_of_trait => { cdata.get_implementations_of_trait(tcx, other) }
|
implementations_of_trait => { cdata.get_implementations_of_trait(tcx, other) }
|
||||||
crate_incoherent_impls => { cdata.get_incoherent_impls(tcx, other) }
|
crate_incoherent_impls => { cdata.get_incoherent_impls(tcx, other) }
|
||||||
|
@ -1930,7 +1930,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
|
|||||||
|
|
||||||
fn encode_traits(&mut self) -> LazyArray<DefIndex> {
|
fn encode_traits(&mut self) -> LazyArray<DefIndex> {
|
||||||
empty_proc_macro!(self);
|
empty_proc_macro!(self);
|
||||||
self.lazy_array(self.tcx.traits_in_crate(LOCAL_CRATE).iter().map(|def_id| def_id.index))
|
self.lazy_array(self.tcx.traits(LOCAL_CRATE).iter().map(|def_id| def_id.index))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Encodes an index, mapping each trait to its (local) implementations.
|
/// Encodes an index, mapping each trait to its (local) implementations.
|
||||||
@ -2321,7 +2321,7 @@ pub fn provide(providers: &mut Providers) {
|
|||||||
.get(&def_id)
|
.get(&def_id)
|
||||||
.expect("no traits in scope for a doc link")
|
.expect("no traits in scope for a doc link")
|
||||||
},
|
},
|
||||||
traits_in_crate: |tcx, LocalCrate| {
|
traits: |tcx, LocalCrate| {
|
||||||
let mut traits = Vec::new();
|
let mut traits = Vec::new();
|
||||||
for id in tcx.hir().items() {
|
for id in tcx.hir().items() {
|
||||||
if matches!(tcx.def_kind(id.owner_id), DefKind::Trait | DefKind::TraitAlias) {
|
if matches!(tcx.def_kind(id.owner_id), DefKind::Trait | DefKind::TraitAlias) {
|
||||||
|
@ -36,7 +36,10 @@ use crate::traits::query::{
|
|||||||
OutlivesBound,
|
OutlivesBound,
|
||||||
};
|
};
|
||||||
use crate::traits::specialization_graph;
|
use crate::traits::specialization_graph;
|
||||||
use crate::traits::{self, ImplSource};
|
use crate::traits::{
|
||||||
|
CanonicalChalkEnvironmentAndGoal, CodegenObligationError, EvaluationResult, ImplSource,
|
||||||
|
ObjectSafetyViolation, ObligationCause, OverflowError, WellFormedLoc,
|
||||||
|
};
|
||||||
use crate::ty::fast_reject::SimplifiedType;
|
use crate::ty::fast_reject::SimplifiedType;
|
||||||
use crate::ty::layout::ValidityRequirement;
|
use crate::ty::layout::ValidityRequirement;
|
||||||
use crate::ty::query::{
|
use crate::ty::query::{
|
||||||
@ -1278,7 +1281,7 @@ rustc_queries! {
|
|||||||
|
|
||||||
query codegen_select_candidate(
|
query codegen_select_candidate(
|
||||||
key: (ty::ParamEnv<'tcx>, ty::PolyTraitRef<'tcx>)
|
key: (ty::ParamEnv<'tcx>, ty::PolyTraitRef<'tcx>)
|
||||||
) -> Result<&'tcx ImplSource<'tcx, ()>, traits::CodegenObligationError> {
|
) -> Result<&'tcx ImplSource<'tcx, ()>, CodegenObligationError> {
|
||||||
cache_on_disk_if { true }
|
cache_on_disk_if { true }
|
||||||
desc { |tcx| "computing candidate for `{}`", key.1 }
|
desc { |tcx| "computing candidate for `{}`", key.1 }
|
||||||
}
|
}
|
||||||
@ -1299,7 +1302,7 @@ rustc_queries! {
|
|||||||
desc { |tcx| "building specialization graph of trait `{}`", tcx.def_path_str(trait_id) }
|
desc { |tcx| "building specialization graph of trait `{}`", tcx.def_path_str(trait_id) }
|
||||||
cache_on_disk_if { true }
|
cache_on_disk_if { true }
|
||||||
}
|
}
|
||||||
query object_safety_violations(trait_id: DefId) -> &'tcx [traits::ObjectSafetyViolation] {
|
query object_safety_violations(trait_id: DefId) -> &'tcx [ObjectSafetyViolation] {
|
||||||
desc { |tcx| "determining object safety of trait `{}`", tcx.def_path_str(trait_id) }
|
desc { |tcx| "determining object safety of trait `{}`", tcx.def_path_str(trait_id) }
|
||||||
}
|
}
|
||||||
query check_is_object_safe(trait_id: DefId) -> bool {
|
query check_is_object_safe(trait_id: DefId) -> bool {
|
||||||
@ -1837,8 +1840,7 @@ rustc_queries! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// A list of all traits in a crate, used by rustdoc and error reporting.
|
/// A list of all traits in a crate, used by rustdoc and error reporting.
|
||||||
/// NOTE: Not named just `traits` due to a naming conflict.
|
query traits(_: CrateNum) -> &'tcx [DefId] {
|
||||||
query traits_in_crate(_: CrateNum) -> &'tcx [DefId] {
|
|
||||||
desc { "fetching all traits in a crate" }
|
desc { "fetching all traits in a crate" }
|
||||||
separate_provide_extern
|
separate_provide_extern
|
||||||
}
|
}
|
||||||
@ -1952,12 +1954,12 @@ rustc_queries! {
|
|||||||
/// `infcx.predicate_must_hold()` instead.
|
/// `infcx.predicate_must_hold()` instead.
|
||||||
query evaluate_obligation(
|
query evaluate_obligation(
|
||||||
goal: CanonicalPredicateGoal<'tcx>
|
goal: CanonicalPredicateGoal<'tcx>
|
||||||
) -> Result<traits::EvaluationResult, traits::OverflowError> {
|
) -> Result<EvaluationResult, OverflowError> {
|
||||||
desc { "evaluating trait selection obligation `{}`", goal.value.value }
|
desc { "evaluating trait selection obligation `{}`", goal.value.value }
|
||||||
}
|
}
|
||||||
|
|
||||||
query evaluate_goal(
|
query evaluate_goal(
|
||||||
goal: traits::CanonicalChalkEnvironmentAndGoal<'tcx>
|
goal: CanonicalChalkEnvironmentAndGoal<'tcx>
|
||||||
) -> Result<
|
) -> Result<
|
||||||
&'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, ()>>,
|
&'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, ()>>,
|
||||||
NoSolution
|
NoSolution
|
||||||
@ -2127,8 +2129,8 @@ rustc_queries! {
|
|||||||
/// all of the cases that the normal `ty::Ty`-based wfcheck does. This is fine,
|
/// all of the cases that the normal `ty::Ty`-based wfcheck does. This is fine,
|
||||||
/// because the `ty::Ty`-based wfcheck is always run.
|
/// because the `ty::Ty`-based wfcheck is always run.
|
||||||
query diagnostic_hir_wf_check(
|
query diagnostic_hir_wf_check(
|
||||||
key: (ty::Predicate<'tcx>, traits::WellFormedLoc)
|
key: (ty::Predicate<'tcx>, WellFormedLoc)
|
||||||
) -> &'tcx Option<traits::ObligationCause<'tcx>> {
|
) -> &'tcx Option<ObligationCause<'tcx>> {
|
||||||
arena_cache
|
arena_cache
|
||||||
eval_always
|
eval_always
|
||||||
no_hash
|
no_hash
|
||||||
|
@ -1197,7 +1197,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||||||
pub fn all_traits(self) -> impl Iterator<Item = DefId> + 'tcx {
|
pub fn all_traits(self) -> impl Iterator<Item = DefId> + 'tcx {
|
||||||
iter::once(LOCAL_CRATE)
|
iter::once(LOCAL_CRATE)
|
||||||
.chain(self.crates(()).iter().copied())
|
.chain(self.crates(()).iter().copied())
|
||||||
.flat_map(move |cnum| self.traits_in_crate(cnum).iter().copied())
|
.flat_map(move |cnum| self.traits(cnum).iter().copied())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user