Module flux_middle::rty
source · 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§
pub use evars::EVar;
pub use evars::EVarGen;
pub use crate::fhir::InferMode;
pub use flux_rustc_bridge::ty::Region::*;
pub use SortInfer::*;
Modules§
- binder 🔒
- 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 🔒
- This modules follows the implementation of folding in rustc. For more information read the documentation in
rustc_middle::ty::fold
. - pretty 🔒
- Refining is the process of generating a refined version of a rust type.
Macros§
Structs§
- The definition of the data sort automatically generated for a struct or enum.
- A bit vector size vvariable id
- In theory a kvar is just an unknown predicate that can use some variables in scope. In practice, fixpoint makes a difference between the first and the rest of the arguments, the first one being the kvar’s self argument. Fixpoint will only instantiate qualifiers that use the self argument. Flux generalizes the self argument to be a list. We call the rest of the arguments the scope.
- A lambda abstraction with an elaborated output sort. We need the output sort of lambdas for encoding into fixpoint
- A numeric vvariable id
- ParamSort is used for polymorphic sorts (Set, Map etc.) and bit-vector size parameters. They should occur “bound” under a
PolyFuncSort
or anAdtSortDef
; i.e. should be < than the number of params. - A polymorphic function sort parametric over sorts or bit-vector sizes.
- A sort vvariable id
- A subset type is a simplified version of a type that has the form
{b[e] | p}
whereb
is aBaseTy
,e
a refinement index, andp
a predicate. - A
const
variable ID. - 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:
- A region variable ID.
- The raw bytes of a simple value.
- A type variable ID.
- The source-order index of a variant in a type.
Enums§
- The size of a bit-vector
- 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. - An argument for a generic parameter in a
Sort
which can be either a generic sort or a generic bit-vector size. - A placeholder for a sort that needs to be inferred
- See
PolyFuncSort
- 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.
Constants§
- Equivalent to
VariantIdx(0)
.
Statics§
Traits§
Functions§
- returns the same invariants as for
usize
which is the length of a slice
Type Aliases§
- 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.