Rollup merge of #127045 - compiler-errors:explicit, r=oli-obk

Rename `super_predicates_of` and similar queries to `explicit_*` to note that they're not elaborated

Rename:
* `super_predicates_of` -> `explicit_super_predicates_of`
* `implied_predicates_of` -> `explicit_implied_predicates_of`
* `supertraits_containing_assoc_item` -> `explicit_supertraits_containing_assoc_item`

This makes it clearer that, unlike (for example) [`TyCtxt::super_traits_of`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/context/struct.TyCtxt.html#method.super_traits_of), we don't automatically elaborate this set of predicates.

r? ``@lcnr`` or ``@oli-obk`` or someone from t-types idc
This commit is contained in:
Matthias Krüger 2024-06-29 09:14:57 +02:00 committed by GitHub
commit 411655217c
3 changed files with 3 additions and 3 deletions

View File

@ -246,7 +246,7 @@ fn collect_supertrait_bounds<'tcx>(cx: &LateContext<'tcx>, bounds: GenericBounds
&& let [.., path] = poly_trait.trait_ref.path.segments && let [.., path] = poly_trait.trait_ref.path.segments
&& poly_trait.bound_generic_params.is_empty() && poly_trait.bound_generic_params.is_empty()
&& let Some(trait_def_id) = path.res.opt_def_id() && let Some(trait_def_id) = path.res.opt_def_id()
&& let predicates = cx.tcx.super_predicates_of(trait_def_id).predicates && let predicates = cx.tcx.explicit_super_predicates_of(trait_def_id).predicates
// If the trait has no supertrait, there is no need to collect anything from that bound // If the trait has no supertrait, there is no need to collect anything from that bound
&& !predicates.is_empty() && !predicates.is_empty()
{ {

View File

@ -24,7 +24,7 @@ fn is_subtrait_of_any(cx: &LateContext<'_>, ty: Ty<'_>) -> bool {
cx.tcx.is_diagnostic_item(sym::Any, tr.def_id) cx.tcx.is_diagnostic_item(sym::Any, tr.def_id)
|| cx || cx
.tcx .tcx
.super_predicates_of(tr.def_id) .explicit_super_predicates_of(tr.def_id)
.predicates .predicates
.iter() .iter()
.any(|(clause, _)| { .any(|(clause, _)| {

View File

@ -91,7 +91,7 @@ fn search(cx: &LateContext<'_>, path: &mut Vec<DefId>) -> bool {
return true; return true;
} }
for &(predicate, _) in cx.tcx.super_predicates_of(trait_def_id).predicates { for &(predicate, _) in cx.tcx.explicit_super_predicates_of(trait_def_id).predicates {
if let ClauseKind::Trait(trait_predicate) = predicate.kind().skip_binder() if let ClauseKind::Trait(trait_predicate) = predicate.kind().skip_binder()
&& trait_predicate.polarity == PredicatePolarity::Positive && trait_predicate.polarity == PredicatePolarity::Positive
&& !path.contains(&trait_predicate.def_id()) && !path.contains(&trait_predicate.def_id())