Skip to main content

Module region_constraint

Module region_constraint 

Source
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
HigherRankedAliasMatcher πŸ”’
MakeHigherRankederer
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:
RegionConstraint
An And and an Or constraint both in canonical forms, with two additional constraints:
RootDestructuredConstraints

EnumsΒ§

AndRelation πŸ”’
LeafRegionConstraint

TraitsΒ§

ConstraintSpan
The span stored in a RegionConstraint and friends.

FunctionsΒ§

alias_outlives_candidates_from_assumptions πŸ”’
Converts an AliasTyOutlivesViaEnv constraint into an OR of region outlives constraints by matching the alias against any Alias: 'a assumptions. 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 u and other regions as those are always satisfied. This requires some care to handle correctly for example: '!a_u1: '?x_u1: '!b_u1 should result in us requiring '!a_u1: '!b_u1 rather 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 u into OR constraints involving regions from smaller universes with known relationships to the placeholder. For example:
regions_outlived_by
Returns all regions r2 for which r: r2 is known to hold in the universe associated with assumptions
regions_outlived_by_placeholder
Returns all regions r for which !t: r is known to hold in the universe associated with assumptions
regions_outliving
Returns all regions r2 for which r2: r is known to hold in the universe associated with assumptions
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.