1
Fork 0

move defining_opaque_types out of Canonical

This commit is contained in:
lcnr 2024-10-15 18:43:41 +02:00
parent 5834ba1ab7
commit 3360c1773a
25 changed files with 130 additions and 120 deletions

View file

@ -34,6 +34,7 @@ use crate::infer::MemberConstraint;
use crate::mir::ConstraintCategory;
use crate::ty::{self, GenericArg, List, Ty, TyCtxt, TypeFlags, TypeVisitableExt};
pub type CanonicalQueryInput<'tcx, V> = ir::CanonicalQueryInput<TyCtxt<'tcx>, V>;
pub type Canonical<'tcx, V> = ir::Canonical<TyCtxt<'tcx>, V>;
pub type CanonicalVarInfo<'tcx> = ir::CanonicalVarInfo<TyCtxt<'tcx>>;
pub type CanonicalVarValues<'tcx> = ir::CanonicalVarValues<TyCtxt<'tcx>>;
@ -182,7 +183,6 @@ impl<'tcx> CanonicalParamEnvCache<'tcx> {
max_universe: ty::UniverseIndex::ROOT,
variables: List::empty(),
value: key,
defining_opaque_types: ty::List::empty(),
};
}

View file

@ -7,7 +7,7 @@ use rustc_span::symbol::{Ident, Symbol};
use rustc_span::{DUMMY_SP, Span};
use rustc_target::abi;
use crate::infer::canonical::Canonical;
use crate::infer::canonical::CanonicalQueryInput;
use crate::ty::fast_reject::SimplifiedType;
use crate::ty::layout::{TyAndLayout, ValidityRequirement};
use crate::ty::{self, GenericArg, GenericArgsRef, Ty, TyCtxt};
@ -485,7 +485,7 @@ impl Key for Option<Symbol> {
/// Canonical query goals correspond to abstract trait operations that
/// are not tied to any crate in particular.
impl<'tcx, T: Clone> Key for Canonical<'tcx, T> {
impl<'tcx, T: Clone> Key for CanonicalQueryInput<'tcx, T> {
type Cache<V> = DefaultCache<Self, V>;
fn default_span(&self, _tcx: TyCtxt<'_>) -> Span {

View file

@ -2011,7 +2011,7 @@ rustc_queries! {
&'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, NormalizationResult<'tcx>>>,
NoSolution,
> {
desc { "normalizing `{}`", goal.value.value }
desc { "normalizing `{}`", goal.canonical.value.value }
}
/// <div class="warning">
@ -2025,7 +2025,7 @@ rustc_queries! {
&'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, NormalizationResult<'tcx>>>,
NoSolution,
> {
desc { "normalizing `{}`", goal.value.value }
desc { "normalizing `{}`", goal.canonical.value.value }
}
/// <div class="warning">
@ -2039,7 +2039,7 @@ rustc_queries! {
&'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, NormalizationResult<'tcx>>>,
NoSolution,
> {
desc { "normalizing `{}`", goal.value.value }
desc { "normalizing `{}`", goal.canonical.value.value }
}
/// Do not call this query directly: invoke `try_normalize_erasing_regions` instead.
@ -2055,7 +2055,7 @@ rustc_queries! {
&'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, Vec<OutlivesBound<'tcx>>>>,
NoSolution,
> {
desc { "computing implied outlives bounds for `{}`", goal.value.value.ty }
desc { "computing implied outlives bounds for `{}`", goal.canonical.value.value.ty }
}
query implied_outlives_bounds(
@ -2064,7 +2064,7 @@ rustc_queries! {
&'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, Vec<OutlivesBound<'tcx>>>>,
NoSolution,
> {
desc { "computing implied outlives bounds v2 for `{}`", goal.value.value.ty }
desc { "computing implied outlives bounds v2 for `{}`", goal.canonical.value.value.ty }
}
/// Do not call this query directly:
@ -2075,7 +2075,7 @@ rustc_queries! {
&'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, DropckOutlivesResult<'tcx>>>,
NoSolution,
> {
desc { "computing dropck types for `{}`", goal.value.value.dropped_ty }
desc { "computing dropck types for `{}`", goal.canonical.value.value.dropped_ty }
}
/// Do not call this query directly: invoke `infcx.predicate_may_hold()` or
@ -2083,7 +2083,7 @@ rustc_queries! {
query evaluate_obligation(
goal: CanonicalPredicateGoal<'tcx>
) -> Result<EvaluationResult, OverflowError> {
desc { "evaluating trait selection obligation `{}`", goal.value.value }
desc { "evaluating trait selection obligation `{}`", goal.canonical.value.value }
}
/// Do not call this query directly: part of the `Eq` type-op
@ -2093,7 +2093,7 @@ rustc_queries! {
&'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, ()>>,
NoSolution,
> {
desc { "evaluating `type_op_ascribe_user_type` `{:?}`", goal.value.value }
desc { "evaluating `type_op_ascribe_user_type` `{:?}`", goal.canonical.value.value }
}
/// Do not call this query directly: part of the `ProvePredicate` type-op
@ -2103,7 +2103,7 @@ rustc_queries! {
&'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, ()>>,
NoSolution,
> {
desc { "evaluating `type_op_prove_predicate` `{:?}`", goal.value.value }
desc { "evaluating `type_op_prove_predicate` `{:?}`", goal.canonical.value.value }
}
/// Do not call this query directly: part of the `Normalize` type-op
@ -2113,7 +2113,7 @@ rustc_queries! {
&'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, Ty<'tcx>>>,
NoSolution,
> {
desc { "normalizing `{}`", goal.value.value.value }
desc { "normalizing `{}`", goal.canonical.value.value.value }
}
/// Do not call this query directly: part of the `Normalize` type-op
@ -2123,7 +2123,7 @@ rustc_queries! {
&'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, ty::Clause<'tcx>>>,
NoSolution,
> {
desc { "normalizing `{:?}`", goal.value.value.value }
desc { "normalizing `{:?}`", goal.canonical.value.value.value }
}
/// Do not call this query directly: part of the `Normalize` type-op
@ -2133,7 +2133,7 @@ rustc_queries! {
&'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, ty::PolyFnSig<'tcx>>>,
NoSolution,
> {
desc { "normalizing `{:?}`", goal.value.value.value }
desc { "normalizing `{:?}`", goal.canonical.value.value.value }
}
/// Do not call this query directly: part of the `Normalize` type-op
@ -2143,7 +2143,7 @@ rustc_queries! {
&'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, ty::FnSig<'tcx>>>,
NoSolution,
> {
desc { "normalizing `{:?}`", goal.value.value.value }
desc { "normalizing `{:?}`", goal.canonical.value.value.value }
}
query instantiate_and_check_impossible_predicates(key: (DefId, GenericArgsRef<'tcx>)) -> bool {
@ -2164,7 +2164,7 @@ rustc_queries! {
query method_autoderef_steps(
goal: CanonicalTyGoal<'tcx>
) -> MethodAutoderefStepsResult<'tcx> {
desc { "computing autoderef types for `{}`", goal.value.value }
desc { "computing autoderef types for `{}`", goal.canonical.value.value }
}
query supported_target_features(_: CrateNum) -> &'tcx UnordMap<String, Option<Symbol>> {

View file

@ -11,7 +11,7 @@ use rustc_span::Span;
pub use rustc_type_ir::solve::NoSolution;
use crate::error::DropCheckOverflow;
use crate::infer::canonical::{Canonical, QueryResponse};
use crate::infer::canonical::{Canonical, CanonicalQueryInput, QueryResponse};
use crate::ty::{self, GenericArg, Ty, TyCtxt};
pub mod type_op {
@ -58,31 +58,34 @@ pub mod type_op {
}
}
pub type CanonicalAliasGoal<'tcx> = Canonical<'tcx, ty::ParamEnvAnd<'tcx, ty::AliasTy<'tcx>>>;
pub type CanonicalAliasGoal<'tcx> =
CanonicalQueryInput<'tcx, ty::ParamEnvAnd<'tcx, ty::AliasTy<'tcx>>>;
pub type CanonicalTyGoal<'tcx> = Canonical<'tcx, ty::ParamEnvAnd<'tcx, Ty<'tcx>>>;
pub type CanonicalTyGoal<'tcx> = CanonicalQueryInput<'tcx, ty::ParamEnvAnd<'tcx, Ty<'tcx>>>;
pub type CanonicalPredicateGoal<'tcx> = Canonical<'tcx, ty::ParamEnvAnd<'tcx, ty::Predicate<'tcx>>>;
pub type CanonicalPredicateGoal<'tcx> =
CanonicalQueryInput<'tcx, ty::ParamEnvAnd<'tcx, ty::Predicate<'tcx>>>;
pub type CanonicalTypeOpAscribeUserTypeGoal<'tcx> =
Canonical<'tcx, ty::ParamEnvAnd<'tcx, type_op::AscribeUserType<'tcx>>>;
CanonicalQueryInput<'tcx, ty::ParamEnvAnd<'tcx, type_op::AscribeUserType<'tcx>>>;
pub type CanonicalTypeOpEqGoal<'tcx> = Canonical<'tcx, ty::ParamEnvAnd<'tcx, type_op::Eq<'tcx>>>;
pub type CanonicalTypeOpEqGoal<'tcx> =
CanonicalQueryInput<'tcx, ty::ParamEnvAnd<'tcx, type_op::Eq<'tcx>>>;
pub type CanonicalTypeOpSubtypeGoal<'tcx> =
Canonical<'tcx, ty::ParamEnvAnd<'tcx, type_op::Subtype<'tcx>>>;
CanonicalQueryInput<'tcx, ty::ParamEnvAnd<'tcx, type_op::Subtype<'tcx>>>;
pub type CanonicalTypeOpProvePredicateGoal<'tcx> =
Canonical<'tcx, ty::ParamEnvAnd<'tcx, type_op::ProvePredicate<'tcx>>>;
CanonicalQueryInput<'tcx, ty::ParamEnvAnd<'tcx, type_op::ProvePredicate<'tcx>>>;
pub type CanonicalTypeOpNormalizeGoal<'tcx, T> =
Canonical<'tcx, ty::ParamEnvAnd<'tcx, type_op::Normalize<T>>>;
CanonicalQueryInput<'tcx, ty::ParamEnvAnd<'tcx, type_op::Normalize<T>>>;
pub type CanonicalImpliedOutlivesBoundsGoal<'tcx> =
Canonical<'tcx, ty::ParamEnvAnd<'tcx, type_op::ImpliedOutlivesBounds<'tcx>>>;
CanonicalQueryInput<'tcx, ty::ParamEnvAnd<'tcx, type_op::ImpliedOutlivesBounds<'tcx>>>;
pub type CanonicalDropckOutlivesGoal<'tcx> =
Canonical<'tcx, ty::ParamEnvAnd<'tcx, type_op::DropckOutlives<'tcx>>>;
CanonicalQueryInput<'tcx, ty::ParamEnvAnd<'tcx, type_op::DropckOutlives<'tcx>>>;
#[derive(Clone, Debug, Default, HashStable, TypeFoldable, TypeVisitable)]
pub struct DropckOutlivesResult<'tcx> {