Expand description
The bulk of the logic for implementing -Zassumptions-on-binders
Re-exportsΒ§
use derive_where::derive_where;πuse indexmap::IndexSet;πuse rustc_data_structures::transitive_relation::TransitiveRelation;πuse rustc_data_structures::transitive_relation::TransitiveRelationBuilder;πuse rustc_macros::StableHash_NoContext;πuse rustc_type_ir_macros::GenericTypeVisitable;πuse rustc_type_ir_macros::TypeFoldable_Generic;πuse rustc_type_ir_macros::TypeVisitable_Generic;πuse tracing::debug;πuse tracing::instrument;πuse tracing::instrument;πuse crate::Const;πuse smallvec::SmallVec;πuse crate::data_structures::IndexMap;πuse crate::fold::TypeSuperFoldable;πuse crate::relate::Relate;πuse crate::relate::RelateResult;πuse crate::relate::TypeRelation;πuse crate::relate::VarianceDiagInfo;πuse crate::visit::TypeVisitableExt;πuse crate::AliasTy;πuse crate::Binder;πuse crate::BoundRegion;πuse crate::BoundRegionKind;πuse crate::BoundVar;πuse crate::BoundVariableKind;πuse crate::ClauseKind;πuse crate::DebruijnIndex;πuse crate::InferCtxtLike;πuse crate::Interner;πuse crate::IsRigid;πuse crate::OutlivesClause;πuse crate::Region;πuse crate::RegionKind;πuse crate::TyKind;πuse crate::TypeFoldable;πuse crate::TypeFolder;πuse crate::TypingMode;πuse crate::UniverseIndex;πuse crate::Variance;πuse crate::elaborate;πuse crate::max_universe;πuse crate::set_aliases_to_non_rigid;πuse crate::inherent::*;π
StructsΒ§
- And
- An AND of leaf constraints. Always in βcanonical formβ, meaning:
- Assumptions
- Higher
Ranked πAlias Matcher - Make
Higher Rankederer - NoSpan
- Placeholder for constraints which do not carry a span, see
ConstraintSpan. - Or
- An OR of AND of LEAF constraints. Always in βcanonical formβ meaning:
- Region
Constraint - An
Andand anOrconstraint both in canonical forms, with two additional constraints: - Root
Destructured Constraints
EnumsΒ§
TraitsΒ§
- Constraint
Span - The span stored in a
RegionConstraintand friends.
FunctionsΒ§
- alias_
outlives_ πcandidates_ from_ assumptions - Converts an
AliasTyOutlivesViaEnvconstraint into an OR of region outlives constraints by matching the alias against anyAlias: 'aassumptions. This is somewhat tricky as we have a potentially higher ranked alias being equated with a potentially higher ranked assumption and we donβt handle it correctly right now (though it is a somewhat reasonable halfway step). - compute_
new_ πregion_ constraints - Filter our region constraints to not include constraints between region variables from
uand other regions as those are always satisfied. This requires some care to handle correctly for example:'!a_u1: '?x_u1: '!b_u1should result in us requiring'!a_u1: '!b_u1rather than dropping the two constraints entirely. - destructure_
type_ outlives_ constraints_ in_ root - Converts type outlives constraints into region outlives constraints. This assumes the complete set of assumptions are known. This should not be called until the end of type checking.
- eagerly_
handle_ placeholders_ in_ universe - Takes any constraints involving placeholders from the current universe and eagerly checks them. This can be done a few ways:
- pull_
region_ πoutlives_ constraints_ out_ of_ universe - Handles converting region outlives constraints involving placeholders from
uinto OR constraints involving regions from smaller universes with known relationships to the placeholder. For example: - regions_
outlived_ by - Returns all regions
r2for whichr: r2is known to hold in the universe associated withassumptions - regions_
outlived_ by_ placeholder - Returns all regions
rfor which!t: ris known to hold in the universe associated withassumptions - regions_
outliving - Returns all regions
r2for whichr2: ris known to hold in the universe associated withassumptions - rewrite_
alias_ πty_ outlives_ constraints_ in_ universe_ for_ eager_ placeholder_ handling - rewrite_
placeholder_ πty_ outlives_ constraints_ in_ universe_ for_ eager_ placeholder_ handling - rewrite_
type_ πoutlives_ constraints_ in_ universe_ for_ eager_ placeholder_ handling - Converts type outlives constraints into either region outlives constraints, or type outlives
constraints which do not contain anything from
u.