Rename implied_const_bounds to explicit_implied_const_bounds

This commit is contained in:
Michael Goulet 2024-11-19 20:30:58 +00:00
parent 89b6885529
commit 588c4c45d5
12 changed files with 17 additions and 20 deletions

View File

@ -2083,7 +2083,7 @@ pub(super) fn check_type_bounds<'tcx>(
// Only in a const implementation do we need to check that the `~const` item bounds hold.
if tcx.is_conditionally_const(impl_ty_def_id) {
obligations.extend(
tcx.implied_const_bounds(trait_ty.def_id)
tcx.explicit_implied_const_bounds(trait_ty.def_id)
.iter_instantiated_copied(tcx, rebased_args)
.map(|(c, span)| {
traits::Obligation::new(

View File

@ -78,7 +78,7 @@ pub fn provide(providers: &mut Providers) {
predicates_of::explicit_supertraits_containing_assoc_item,
trait_explicit_predicates_and_bounds: predicates_of::trait_explicit_predicates_and_bounds,
const_conditions: predicates_of::const_conditions,
implied_const_bounds: predicates_of::implied_const_bounds,
explicit_implied_const_bounds: predicates_of::explicit_implied_const_bounds,
type_param_predicates: predicates_of::type_param_predicates,
trait_def,
adt_def,

View File

@ -1017,7 +1017,7 @@ pub(super) fn const_conditions<'tcx>(
}
}
pub(super) fn implied_const_bounds<'tcx>(
pub(super) fn explicit_implied_const_bounds<'tcx>(
tcx: TyCtxt<'tcx>,
def_id: LocalDefId,
) -> ty::EarlyBinder<'tcx, &'tcx [(ty::PolyTraitRef<'tcx>, Span)]> {
@ -1036,7 +1036,7 @@ pub(super) fn implied_const_bounds<'tcx>(
Node::TraitItem(hir::TraitItem { kind: hir::TraitItemKind::Type(..), .. }) => {
explicit_item_bounds_with_filter(tcx, def_id, PredicateFilter::ConstIfConst)
}
_ => bug!("implied_const_bounds called on wrong item: {def_id:?}"),
_ => bug!("explicit_implied_const_bounds called on wrong item: {def_id:?}"),
};
bounds.map_bound(|bounds| {

View File

@ -275,7 +275,7 @@ provide! { tcx, def_id, other, cdata,
defaultness => { table_direct }
constness => { table_direct }
const_conditions => { table }
implied_const_bounds => { table_defaulted_array }
explicit_implied_const_bounds => { table_defaulted_array }
coerce_unsized_info => {
Ok(cdata
.root

View File

@ -1463,8 +1463,8 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
record_array!(self.tables.module_children_non_reexports[def_id] <-
module_children.iter().map(|child| child.res.def_id().index));
if self.tcx.is_const_trait(def_id) {
record_defaulted_array!(self.tables.implied_const_bounds[def_id]
<- self.tcx.implied_const_bounds(def_id).skip_binder());
record_defaulted_array!(self.tables.explicit_implied_const_bounds[def_id]
<- self.tcx.explicit_implied_const_bounds(def_id).skip_binder());
}
}
if let DefKind::TraitAlias = def_kind {
@ -1654,8 +1654,8 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
self.encode_explicit_item_bounds(def_id);
self.encode_explicit_item_super_predicates(def_id);
if tcx.is_conditionally_const(def_id) {
record_defaulted_array!(self.tables.implied_const_bounds[def_id]
<- self.tcx.implied_const_bounds(def_id).skip_binder());
record_defaulted_array!(self.tables.explicit_implied_const_bounds[def_id]
<- self.tcx.explicit_implied_const_bounds(def_id).skip_binder());
}
}
}

View File

@ -391,7 +391,7 @@ define_tables! {
inferred_outlives_of: Table<DefIndex, LazyArray<(ty::Clause<'static>, Span)>>,
explicit_super_predicates_of: Table<DefIndex, LazyArray<(ty::Clause<'static>, Span)>>,
explicit_implied_predicates_of: Table<DefIndex, LazyArray<(ty::Clause<'static>, Span)>>,
implied_const_bounds: Table<DefIndex, LazyArray<(ty::PolyTraitRef<'static>, Span)>>,
explicit_implied_const_bounds: Table<DefIndex, LazyArray<(ty::PolyTraitRef<'static>, Span)>>,
inherent_impls: Table<DefIndex, LazyArray<DefIndex>>,
associated_types_for_impl_traits_in_associated_fn: Table<DefIndex, LazyArray<DefId>>,
opt_rpitit_info: Table<DefIndex, Option<LazyValue<ty::ImplTraitInTraitData>>>,

View File

@ -697,7 +697,7 @@ rustc_queries! {
separate_provide_extern
}
query implied_const_bounds(
query explicit_implied_const_bounds(
key: DefId
) -> ty::EarlyBinder<'tcx, &'tcx [(ty::PolyTraitRef<'tcx>, Span)]> {
desc { |tcx| "computing the implied `~const` bounds for `{}`",

View File

@ -387,12 +387,12 @@ impl<'tcx> Interner for TyCtxt<'tcx> {
)
}
fn implied_const_bounds(
fn explicit_implied_const_bounds(
self,
def_id: DefId,
) -> ty::EarlyBinder<'tcx, impl IntoIterator<Item = ty::Binder<'tcx, ty::TraitRef<'tcx>>>> {
ty::EarlyBinder::bind(
self.implied_const_bounds(def_id).iter_identity_copied().map(|(c, _)| c),
self.explicit_implied_const_bounds(def_id).iter_identity_copied().map(|(c, _)| c),
)
}

View File

@ -102,7 +102,7 @@ where
/// Assemble additional assumptions for an alias that are not included
/// in the item bounds of the alias. For now, this is limited to the
/// `implied_const_bounds` for an associated type.
/// `explicit_implied_const_bounds` for an associated type.
fn consider_additional_alias_assumptions(
ecx: &mut EvalCtxt<'_, D>,
goal: Goal<I, Self>,

View File

@ -84,12 +84,9 @@ where
let cx = ecx.cx();
let mut candidates = vec![];
// FIXME(const_trait_impl): We elaborate here because the implied const bounds
// aren't necessarily elaborated. We probably should prefix this query
// with `explicit_`...
for clause in elaborate::elaborate(
cx,
cx.implied_const_bounds(alias_ty.def_id)
cx.explicit_implied_const_bounds(alias_ty.def_id)
.iter_instantiated(cx, alias_ty.args)
.map(|trait_ref| trait_ref.to_host_effect_clause(cx, goal.predicate.constness)),
) {

View File

@ -157,7 +157,7 @@ impl<I: Interner, O: Elaboratable<I>> Elaborator<I, O> {
}
// `T: ~const Trait` implies `T: ~const Supertrait`.
ty::ClauseKind::HostEffect(data) => self.extend_deduped(
cx.implied_const_bounds(data.def_id()).iter_identity().map(|trait_ref| {
cx.explicit_implied_const_bounds(data.def_id()).iter_identity().map(|trait_ref| {
elaboratable.child(
trait_ref
.to_host_effect_clause(cx, data.constness)

View File

@ -228,7 +228,7 @@ pub trait Interner:
self,
def_id: Self::DefId,
) -> ty::EarlyBinder<Self, impl IntoIterator<Item = ty::Binder<Self, ty::TraitRef<Self>>>>;
fn implied_const_bounds(
fn explicit_implied_const_bounds(
self,
def_id: Self::DefId,
) -> ty::EarlyBinder<Self, impl IntoIterator<Item = ty::Binder<Self, ty::TraitRef<Self>>>>;