Expand description
Defines how flux represents refinement types internally. Definitions in this module are used
during refinement type checking. A couple of important differences between definitions in this
module and in crate::fhir are:
- Types in this module use debruijn indices to represent local binders.
- Data structures are interned so they can be cheaply cloned.
Re-exportsΒ§
use std::borrow::Cow;πuse std::cmp::Ordering;πuse std::fmt;πuse std::hash::Hash;πuse std::hash::Hash;πuse std::sync::LazyLock;πpub use binder::Binder;pub use binder::BoundReftKind;pub use binder::BoundVariableKind;pub use binder::BoundVariableKinds;pub use binder::EarlyBinder;use bitflags::bitflags;πpub use expr::AggregateKind;pub use expr::AliasReft;pub use expr::BinOp;pub use expr::BoundReft;pub use expr::Constant;pub use expr::Ctor;pub use expr::ESpan;pub use expr::EVid;pub use expr::EarlyReftParam;pub use expr::Expr;pub use expr::ExprKind;pub use expr::FieldProj;pub use expr::HoleKind;pub use expr::InternalFuncKind;pub use expr::KVar;pub use expr::KVid;pub use expr::Lambda;pub use expr::Loc;pub use expr::Name;pub use expr::NameProvenance;pub use expr::Path;pub use expr::PrettyMap;pub use expr::PrettyVar;pub use expr::QuantDom;pub use expr::RawPtrField;pub use expr::Real;pub use expr::SpecFuncKind;pub use expr::UnOp;pub use expr::Var;pub use expr::WKVar;pub use expr::WKVid;use flux_arc_interner::Interned;πuse flux_common::bug;πuse flux_common::bug;πuse flux_common::tracked_span_assert_eq;πuse flux_common::tracked_span_bug;πuse flux_config::OverflowMode;πuse flux_macros::TypeFoldable;πuse flux_macros::TypeVisitable;πuse flux_rustc_bridge::ToRustc;πuse flux_rustc_bridge::mir::Place;πuse flux_rustc_bridge::mir::RawPtrKind;πuse flux_rustc_bridge::ty;πuse flux_rustc_bridge::ty::GenericArgsExt as _;πuse flux_rustc_bridge::ty::VariantDef;πuse itertools::Itertools;πuse rustc_abi;πuse rustc_abi;πuse rustc_attr_ir::LangItem;πuse rustc_data_structures::fx::FxIndexMap;πuse rustc_data_structures::snapshot_map::SnapshotMap;πuse rustc_data_structures::unord::UnordMap;πuse rustc_hir::Safety;πuse rustc_hir::def_id::DefId;πuse rustc_index::IndexSlice;πuse rustc_index::IndexVec;πuse rustc_index::newtype_index;πuse rustc_macros::Decodable;πuse rustc_macros::Encodable;πuse rustc_macros::TyDecodable;πuse rustc_macros::TyEncodable;πuse rustc_macros::extension;πuse rustc_middle::query::IntoQueryKey;πuse rustc_middle::ty::TyCtxt;πuse rustc_middle::ty::fast_reject::SimplifiedType;πuse rustc_span::DUMMY_SP;πuse rustc_span::Span;πuse rustc_span::Symbol;πuse rustc_span::sym;πuse rustc_span::symbol::kw;πuse rustc_type_ir::Upcast as _;πpub use spec_func::SpecFunc;pub use spec_func::SpecFuncs;pub use spec_func::deps;use self::fold::TypeFoldable;πpub use crate::fhir::InferMode;use crate::LocalDefId;πuse crate::def_id::FluxDefId;πuse crate::def_id::FluxLocalDefId;πuse crate::fhir;πuse crate::fhir::FhirId;πuse crate::fhir::FluxOwnerId;πuse crate::global_env::GlobalEnv;πuse crate::pretty::Pretty;πuse crate::pretty::PrettyCx;πuse crate::queries::QueryErr;πuse crate::queries::QueryResult;πuse crate::rty::subst::SortSubst;πpub use crate::_Int as Int;pub use crate::_Uint as Uint;pub use crate::_Bool as Bool;pub use crate::_Char as Char;pub use crate::_Ref as Ref;pub use flux_rustc_bridge::ty::Region::*;
ModulesΒ§
- binder π
- canonicalize
- A canonical type is a type where all existentials and constraint predicates are hoisted to
the top level. For example, the canonical version of
βa. {βb. i32[a + b] | b > 0}isβa,b. {i32[a + b] | b > 0}. - expr π
- fold
- This modules follows the implementation of folding in rustc. For more information read the
documentation in
rustc_type_ir::fold. - pretty π
- reduce
- refining
- Refining is the process of generating a refined version of a rust type.
- region_
matching - spec_
func π - subst
StructsΒ§
- AdtDef
- AdtDef
Data - AdtSort
Def - The definition of the data sort automatically generated for a struct or enum.
- AdtSort
DefData π - AdtSort
Variant - Alias
Term - Mirrors
flux_rustc_bridge::ty::AliasTerm. - AliasTy
- Assoc
Refinements - Assoc
Reft - Axiom
- An
Axiomis a (global) fact, typically about uninterpreted functions, that is assumed to hold for all values of the variables bound inbody. - Axiom
Body - Bound
Region - BvSize
Vid - A bit vector size vvariable id
- Clause
- Const
- Coroutine
Oblig Predicate - Existential
Projection - Existential
Trait Ref - FnOutput
- FnSig
- FnTrait
Predicate - Func
Sort - Generic
Param Def - Generic
Predicates - Generics
- Invariant
- Late
Param Region - Mirrors [
rustc_middle::ty::LateParamRegion]. - Local
Table InContext - Local
Table InContext Mut - Outlives
Predicate - Param
Sort ParamSortis used for polymorphic sorts (Set,Map, etc.) and bit-vector size parameters. They should occur βboundβ under aPolyFuncSortor anAdtSortDef. We assume thereβs a single binder and aParamSortrepresents a variable as an index into the list of variables bound by that binder, i.e., the representation doesntβt support higher-ranked sorts.- Poly
Func Sort - A polymorphic function sort parametric over sorts or bit-vector sizes.
- Prim
OpProp - A
PrimOpPropis a single property for a primitive operation which can be conjoined to get the definition of thePrimRelfor that primitive operation. - PrimRel
- All the properties of a primitive operation. The properties that apply to a function are
conjoined to get the definition of the primitive relation for that operation; see
crate::global_env::GlobalEnv::prim_rel_for. - Projection
Predicate - Qualifier
- Refine
Param - Refinement
Generics - Sort
Cstr - A sort constraint is a set of operations a sort must support.
- SortVid
- A sort vvariable id
- Subset
Ty - A subset type is a simplified version of a type that has the form
{b[e] | p}wherebis aBaseTy,ea refinement index, andpa predicate. - Trait
Predicate - Trait
Ref - Ty
- Uncovered
Axiom Var - The variable (by its position in the axiomβs binder) that does not occur in any pattern of an
ill-formed axiom. See
Axiom::new. - Variant
Sig - Wfck
Results - AdtFlags
- Bound
Var - Const
Vid - A
constvariable ID. - Debruijn
Index - A De Bruijn index is a standard means of representing regions (and perhaps later types) in a higher-ranked setting. In particular, imagine a type like this:
- Early
Param Region - Param
Const - ParamTy
- Region
Vid - A region variable ID.
- Scalar
Int - The raw bytes of a simple value.
- TyVid
- A type variable ID.
- Variant
Idx - The source-order index of a variant in a type.
EnumsΒ§
- Alias
Kind - Alias
Term Kind - BaseTy
- Bound
Region Kind - BvSize
- The size of a bit-vector
- Cast
Kind - Clause
Kind - Coercion
- Const
Kind - Constant
Info - Ensures
- Existential
Predicate - Generic
Arg - Generic
Param DefKind - Hint
Kind - Determines which functions a hint to the solver (a qualifier, an axiom or a primop property) is used for
- Opaqueness
- Option-like enum to explicitly mark that we donβt have information about an ADT because it was
annotated with
#[flux::opaque]. Note that only structs can be marked as opaque. - PtrKind
- Record
Ctor - Region
- Sort
- SortArg
- An argument for a generic parameter in a
Sortwhich can be either a generic sort or a generic bit-vector size. - Sort
Ctor - Sort
Param Kind - See
PolyFuncSort - Sort
VarVal - Unification value for sort variables used during sort checking.
- TyKind
- TyOr
Base - TyOr
Ctor - Closure
Kind - Represents the various closure traits in the language. This
will determine the type of the environment (
self, in the desugaring) argument that the closure expects. - FloatTy
- IntTy
- Late
Param Region Kind - When liberating bound regions, we map their [
ty::BoundRegionKind] to this as we need to track the index of anonymous regions. We otherwise end up liberating multiple bound regions to the same late-bound region. - Mutability
- UintTy
ConstantsΒ§
- SELF_
PARAM_ TY - FIRST_
VARIANT - Equivalent to
VariantIdx(0). - INNERMOST
StaticsΒ§
TraitsΒ§
FunctionsΒ§
- auto_
strong - The
auto_strongfunction transforms function signatures by automatically converting mutable reference parameters into strong references with associated ensures clauses. This transformation is applied only when the function signature does not already contain region variables in its return type. - can_
auto_ πstrong - char_
invariants π - int_
invariants π - raw_
ptr_ πinvariants - slice_
invariants π - All slices have 0 <= len <= usize::MAX, with the upper bound subject to overflow checking.
- to_
closure_ sig - uint_
invariants π
Type AliasesΒ§
- Clauses
- Generic
Args - Item
Local Map - List
- Poly
Existential Predicate - Poly
Existential Trait Ref - Poly
FnSig - Poly
Projection Predicate - Poly
Trait Predicate - Poly
Trait Ref - Poly
Variant - Poly
Variants - Refine
Args - Region
Outlives Predicate - Subset
TyCtor - A type constructor meant to be used as generic a argument of kind base. This is just an alias
to
Binder<SubsetTy>, but we expect the binder to have a single bound variable of the sort of the underlying base type. - TyCtor
- Type
Outlives Predicate