mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 23:04:33 +00:00
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() }
|
||||
|
||||
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()) }
|
||||
implementations_of_trait => { cdata.get_implementations_of_trait(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> {
|
||||
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.
|
||||
@ -2321,7 +2321,7 @@ pub fn provide(providers: &mut Providers) {
|
||||
.get(&def_id)
|
||||
.expect("no traits in scope for a doc link")
|
||||
},
|
||||
traits_in_crate: |tcx, LocalCrate| {
|
||||
traits: |tcx, LocalCrate| {
|
||||
let mut traits = Vec::new();
|
||||
for id in tcx.hir().items() {
|
||||
if matches!(tcx.def_kind(id.owner_id), DefKind::Trait | DefKind::TraitAlias) {
|
||||
|
@ -36,7 +36,10 @@ use crate::traits::query::{
|
||||
OutlivesBound,
|
||||
};
|
||||
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::layout::ValidityRequirement;
|
||||
use crate::ty::query::{
|
||||
@ -1278,7 +1281,7 @@ rustc_queries! {
|
||||
|
||||
query codegen_select_candidate(
|
||||
key: (ty::ParamEnv<'tcx>, ty::PolyTraitRef<'tcx>)
|
||||
) -> Result<&'tcx ImplSource<'tcx, ()>, traits::CodegenObligationError> {
|
||||
) -> Result<&'tcx ImplSource<'tcx, ()>, CodegenObligationError> {
|
||||
cache_on_disk_if { true }
|
||||
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) }
|
||||
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) }
|
||||
}
|
||||
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.
|
||||
/// NOTE: Not named just `traits` due to a naming conflict.
|
||||
query traits_in_crate(_: CrateNum) -> &'tcx [DefId] {
|
||||
query traits(_: CrateNum) -> &'tcx [DefId] {
|
||||
desc { "fetching all traits in a crate" }
|
||||
separate_provide_extern
|
||||
}
|
||||
@ -1952,12 +1954,12 @@ rustc_queries! {
|
||||
/// `infcx.predicate_must_hold()` instead.
|
||||
query evaluate_obligation(
|
||||
goal: CanonicalPredicateGoal<'tcx>
|
||||
) -> Result<traits::EvaluationResult, traits::OverflowError> {
|
||||
) -> Result<EvaluationResult, OverflowError> {
|
||||
desc { "evaluating trait selection obligation `{}`", goal.value.value }
|
||||
}
|
||||
|
||||
query evaluate_goal(
|
||||
goal: traits::CanonicalChalkEnvironmentAndGoal<'tcx>
|
||||
goal: CanonicalChalkEnvironmentAndGoal<'tcx>
|
||||
) -> Result<
|
||||
&'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, ()>>,
|
||||
NoSolution
|
||||
@ -2127,8 +2129,8 @@ rustc_queries! {
|
||||
/// all of the cases that the normal `ty::Ty`-based wfcheck does. This is fine,
|
||||
/// because the `ty::Ty`-based wfcheck is always run.
|
||||
query diagnostic_hir_wf_check(
|
||||
key: (ty::Predicate<'tcx>, traits::WellFormedLoc)
|
||||
) -> &'tcx Option<traits::ObligationCause<'tcx>> {
|
||||
key: (ty::Predicate<'tcx>, WellFormedLoc)
|
||||
) -> &'tcx Option<ObligationCause<'tcx>> {
|
||||
arena_cache
|
||||
eval_always
|
||||
no_hash
|
||||
|
@ -1197,7 +1197,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||
pub fn all_traits(self) -> impl Iterator<Item = DefId> + 'tcx {
|
||||
iter::once(LOCAL_CRATE)
|
||||
.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]
|
||||
|
Loading…
Reference in New Issue
Block a user