Skip to main content

Module hax

Module hax 

Source

Re-exports§

pub use rustc_trait_elaboration as elaboration;
pub use crate::hax::*;
pub use crate::hax::state::*;

Modules§

constant_utils 🔒
mir_kinds
Enumerates the kinds of Mir bodies. TODO: use const generics instead of an open list of types.
options
prelude 🔒
rustc
rustc_utils 🔒
sinto 🔒
state
traits 🔒
types 🔒

Macros§

sinto_as_usize
sinto_reexport
sinto_todo

Structs§

Adt
ADts (Struct, Enum and Union map to this).
AdtTy
Alias
This type merges the information from [ty::AliasTyKind] and [ty::AliasTy].
Align
Reflects [rustc_abi::Align]. We store the exponent of the alignment.
ArrayTy
AssocConst
Associated constant: trait MyTrait { const ASSOC: usize; }
AssocFn
Associated function: impl MyStruct { fn associated() {} } or trait Foo { fn associated() {} }
AssocItem
Reflects [ty::AssocItem]
AssocTy
Associated type: trait MyTrait { type Assoc; }
Binder
Reflects [ty::Binder]
BoundRegion
Reflects [ty::BoundRegion]
BoundTy
Reflects [ty::BoundTy]
BoundTyRef
Canonical
Reflects [rustc_middle::infer::canonical::Canonical]
CanonicalUserTypeAnnotation
Reflects [ty::CanonicalUserTypeAnnotation]
Clause
Reflects [ty::Clause] and adds a hash-consed predicate identifier.
Closure
A closure, coroutine, or coroutine-closure.
ClosureTy
Reflects [ty::ClosureArgs]
CoercePredicate
Reflects [ty::CoercePredicate]
Const
ConstOperand
The contents of Operand::Const.
ConstantExpr
Rustc has different representations for constants: one for MIR ([rustc_middle::mir::Const]), one for the type system ([rustc_middle::ty::ConstKind]). For simplicity hax maps those two constructs to the same ConstantExpr type.
ConstantFieldExpr
CoroutineTy
Ctor
The constructor function of a tuple/unit struct or tuple/unit enum variant.
DefId
Reflects rustc_hir::def_id::DefId, augmented to also give ids to promoted constants (which have their own ad-hoc numbering scheme in rustc for now).
DefIdContents
DisambiguatedDefPathItem
Reflects [rustc_hir::definitions::DisambiguatedDefPathData]
DiscriminantValue
Reflects [ty::util::Discr]
DynBinder
A representation of exists<T: Trait1 + Trait2>(value): we create a fresh type id and the appropriate trait clauses. The contained value may refer to the fresh ty and the in-scope trait clauses. This is used to represent types related to dyn Trait.
DynTraitTy
EarlyParamRegion
Reflects [ty::EarlyParamRegion]
ElaborationCtx
ExistentialProjection
Reflects [ty::ExistentialProjection]
ExistentialTraitRef
Reflects [ty::ExistentialTraitRef]
FieldDef
Reflects [ty::FieldDef]
Fn
FnDefTy
FnPointer
FnPtrShape
Represents the “shape” of a function pointer, i.e. the most general signature we can obtain from it without breaking the higher-kinded variables. E.g. for<'a> fn(&'a u32) -> Adt<'a, u32> is considered to be an instantiation of the shape for<'a> fn(&'a A) -> Adt<'a, B> with A=B=u32.
FnPtrTy
FnTraitImpls
The virtual Fn* impls of a callable type.
ForeignMod
An extern block.
ForeignTy
FullDef
Gathers a lot of definition information about a rustc_hir::def_id::DefId.
GenericParamDef
Reflects [ty::GenericParamDef]
GenericPredicate
GenericPredicates
Reflects [ty::GenericPredicates]
ImplAssocItem
An associated item in a trait impl. This can be an item provided by the trait impl, or an item that reuses the trait decl default value.
ImplAssocItemValue
The item is provided by the trait impl.
InherentImpl
ItemPredicate
ItemPredicates
ItemRef
Reference to an item, with generics. Basically any mention of an item (function, type, etc) uses this.
ItemRefContents
Contents of ItemRef.
LateParamRegion
Reflects [ty::LateParamRegion]
Mod
OutlivesPredicate
Reflects [ty::OutlivesPredicate] as a named struct instead of a tuple struct. This is because the script converting JSONSchema types to OCaml doesn’t support tuple structs, and this is the only tuple struct in the whole AST.
ParamConst
Reflects [ty::ParamConst]
ParamEnv
The combination of type generics and related predicates.
ParamTy
Reflects [ty::ParamTy]
PatTy
PathBuf
An owned, mutable path (akin to String).
Placeholder
Reflects [ty::Placeholder]
Predicate
Reflects [ty::Predicate] and adds a hash-consed predicate identifier.
ProjectionPredicate
Expresses a constraints over an associated type.
RawPtrTy
Rc
A single-threaded reference-counting pointer. ‘Rc’ stands for ‘Reference Counted’.
RefTy
Region
Reflects [ty::Region]
ReprFlags
The representation flags without the ones irrelevant outside of rustc.
ReprOptions
Reflects [rustc_abi::ReprOptions].
SliceTy
Static
StrTy
SubtypePredicate
Reflects [ty::SubtypePredicate]
SyntheticItemData
Trait
TraitAlias
Trait alias: trait IntIterator = Iterator<Item = i32>;
TraitImpl
TraitItemBinder
The binding context to use when translating a trait impl associated item.
TraitPredicate
Reflects [ty::TraitClause]
TraitProof
A TraitProof describes the full data of a trait implementation. Because of generics, this may need to combine several concrete trait implementation items. For example, ((1u8, 2u8), "hello").clone() combines the generic implementation of Clone for (A, B) with the concrete implementations for u8 and &str, represented as a tree.
TraitProofContents
TupleTy
Ty
Reflects [rustc_middle::ty::Ty]
TyAlias
Type alias: type Foo = Bar;
TyFnSig
Reflects [ty::FnSig]
TyGenerics
Reflects [ty::Generics]
TypeAndMut
Reflects [ty::TypeAndMut]
UserArgs
Reflects [ty::UserArgs]
UserSelfTy
Reflects [ty::UserSelfTy]
VariantDef
Reflects [ty::VariantDef]
VirtualImplAssocItem
VirtualTraitImpl
Partial data for a trait impl, used for fake trait impls that we generate ourselves such as FnOnce and Drop impls.
VirtualTraitMethod
A method of a virtual trait impl.
ByteSymbol
Like Symbol, but for byte strings. ByteSymbol is used less widely, so it has fewer operations defined than Symbol.
FieldIdx
The source-order index of a field in a variant.
IndexVec
An owned contiguous collection of Ts, indexed by I rather than by usize.
MacroKinds
A set of macro kinds, for macros that can have more than one kind
PromotedId
RAllocId
RDefId
A DefId identifies a particular definition, by combining a crate index and a def index.
Span
A compressed span.
Spanned
Symbol
An interned UTF-8 string.
VariantIdx
The source-order index of a variant in a type.

Enums§

AdtKind
Reflects [ty::AdtKind]
AliasKind
Reflects [rustc_middle::ty::AliasTyKind].
AssocItemContainer
AssocItemResolution
AssocKind
Reflects [ty::AssocKind]
AssocTypeData
Reflects [ty::AssocTypeData]
BoundRegionKind
Reflects [ty::BoundRegionKind]
BoundTyKind
Reflects [ty::BoundTyKind]
BoundVarIndexKind
Reflects [ty::BoundVarIndexKind]
BoundVariableKind
Reflects [ty::BoundVariableKind]
BuiltinTraitData
ClauseKind
Reflects [ty::ClauseKind]
ClosureKind
Reflects [ty::ClosureKind]
ConstKind
The kind of a constant item.
ConstOperandKind
ConstSource
A constant that we can ask rustc to evaluate.
ConstantByte
A byte of an evaluated constant, in the MiniRust sense.
ConstantByteProvenance
What a pointer byte in an evaluated constant points to.
ConstantExprKind
The subset of expressions that corresponds to constants.
ConstantInt
ConstantLiteral
ConstantProjectionElem
Projects a place inside the pointee of a constant pointer.
ConstantPtrBase
The place a constant pointer starts from.
DefIdBase
DefKind
Reflects rustc_hir::def::DefKind
DefPathItem
Reflects [rustc_hir::definitions::DefPathData]
DestructData
DiscriminantDefinition
Reflects [ty::VariantDiscr]
ErrorGuaranteed
ExistentialPredicate
A predicate without Self, for use in dyn Trait.
FloatTy
Reflects [ty::FloatTy]
FnPtrTarget
The function a function pointer points to.
FullDefKind
Imbues rustc_hir::def::DefKind with a lot of extra information.
GenericArg
Reflects both [ty::GenericArg] and [ty::GenericArgKind]
GenericParamDefKind
Reflects [ty::GenericParamDefKind]
GenericPredicateId
Uniquely identifies a predicate.
GlobalRef
A global allocation.
HostEffectClause
ImplTraitInTraitData
Reflects [ty::ImplTraitInTraitData]
InferTy
Reflects partially [ty::InferTy]
InlineAttr
Reflects [rustc_hir::attrs::InlineAttr]
IntTy
Reflects [ty::IntTy]
ItemPredicateId
Uniquely identifies a predicate.
LateParamRegionKind
Reflects [ty::LateParamRegionKind]
LitIntType
Reflects [rustc_ast::ast::LitIntType]
NormalizesTo
Pattern
PredicateDirection
PredicateKind
Reflects [ty::PredicateKind]
ReadMode
How to read back an evaluated constant.
RegionKind
Reflects [ty::RegionKind]
SyntheticItem
We create some extra DefIds to represent things that rustc doesn’t have a DefId for. This makes the pipeline much easier to have “real” def_ids for them, as we can then solve traits for them etc, and works well with monomorphization.
Term
Reflects [ty::Term]
TraitProofImpliedPredicate
TraitProofKind
The source of a particular trait implementation. Most often this is either Concrete for a concrete impl Trait for Type {} item, or LocalBound for a context-bound where T: Trait.
TyKind
Reflects [ty::TyKind]
UintTy
Reflects [ty::UintTy]
UnsizingMetadata
The metadata to attach to the newly-unsized ptr.
UserType
Reflects [ty::UserType]: this is currently disabled, and everything is printed as debug in the UserType::Todo variant.
Variance
Reflects [ty::Variance]
VariantKind
Describe the kind of a variant
Visibility
Reflects [ty::Visibility]
CtorKind
What kind of constructor something is.
CtorOf
Encodes if a DefKind::Ctor is the constructor of an enum variant or a struct.
ExternAbi
ABI we expect to see within extern "{abi}"
Mutability
RDefKind
What kind of definition something is; e.g., mod vs struct. enum DefPathData may need to be updated if a new variant is added here.
Safety
SolverTraitLangItem

Traits§

IsMirKind
ItemId
The identifier of an item; generalizes over rustc’s DefId to allow for virtual items.
SInto
SubstBinder
ToPolyTraitRef

Functions§

alias_ty_kind_def_id
assoc_tys_for_trait
Generates a list of <trait_ref>::Ty type aliases for each non-gat associated type of the given trait and its parents, in a specific order.
closure_once_shim
closure_sig
Retrieve a closure’s signature.
compute_unsizing_metadata
drop_glue_shim
dyn_self_ty
Generates a dyn Trait<Args.., Ty = <Self as Trait>::Ty..> type for the given trait ref.
erase_and_norm
erase_free_regions
Erase free regions from the given value. Largely copied from tcx.erase_and_anonymize_regions, but also erases bound regions that are bound outside value, so we can call this function inside a Binder.
fn_sig_bound_region_variances
Computes the variance of each region bound by sig.
get_foreign_mod_children
Gets the children of an extern block. Empty if the block is not defined in the current crate.
get_method_sig
The signature of a method impl may be a subtype of the one expected from the trait decl, as in the example below. For correctness, we must be able to map from the method generics declared in the trait to the actual method generics. Because this would require type inference, we instead simply return the declared signature. This will cause issues if it is possible to use such a more-specific implementation with its more-specific type, but we have a few other issues with lifetime-generic function pointers anyway so this is unlikely to cause problems.
get_mod_children
Gets the children of a module.
identity_args_with_inferred
Closures and inline consts have special type params that are used as inference variables. After analysis, they can be computed from the rest of the args (modulo some erased regions). This computes the identity args for this def_id with the inference ars properly inferred.
inst_binder
Instantiate this binder with the provided args. Use None if the args are known to be the identity args.
name_of_local
normalize
Normalize a value.
read_const
Evaluate src and read it back as a ConstantExpr.
self_clause_for_item
Retrieve the Self: Trait clause for a trait associated item.
self_predicate
The special “self” predicate on a trait.
solve_copy
Solve the T: Copy predicate.
solve_destruct
Solve the T: Destruct predicate.
solve_item_implied_traits
Solve the trait obligations for implementing a trait (or for trait associated type bounds) in the current context.
solve_sized
Solve the T: Sized predicate.
solve_trait
This is the entrypoint of the solving.
substitute
Instantiate this value with the provided args. Use None if the args are known to be the identity args.
super_clause_to_clause_and_trait_proof
Given a clause clause in the context of some impl block impl_did, susbts correctly Self from clause and (1) derive a Clause and (2) resolve a TraitProof.
translate_item_ref
Translate a reference to an item, resolving the appropriate trait clauses as needed.
translate_user_annotation
Convert a type annotation into data we can use, by fetching the types that rustc inferred and gathering the predicates that still need to be checked at borrowck time.
unerase_lifetimes
Replace each erased region in this value with a fresh placeholder region.
vtable_receiver_is_by_value
Whether the trait method declared by method_decl_id takes self: Self by value.

Type Aliases§

BoundVar
CanonicalUserType
Reflects [ty::CanonicalUserType]
DebruijnIndex
HashMap
Type alias for a hash map that uses the Fx hashing algorithm.
Ident
Reflects [rustc_span::symbol::Ident]
PlaceholderConst
Reflects [ty::PlaceholderConst]
PlaceholderRegion
Reflects [ty::PlaceholderRegion]
PlaceholderTy
Reflects [ty::PlaceholderType]
PolyFnSig
Reflects [ty::PolyFnSig]
PredicateSearcher
RegionOutlivesPredicate
Reflects [ty::RegionOutlivesPredicate]
RegionVid
TraitRef
Reflects [ty::TraitRef] Contains the def_id and arguments passed to the trait. The first type argument is the Self type. The trait proofs are the required predicate for this trait; currently they are always empty because we consider all trait predicates as implied. self.in_trait is always None because a trait can’t be associated to another one.
TypeOutlivesPredicate
Reflects [ty::TypeOutlivesPredicate]
UnitBinder
UserAnnotation
The data of a user annotation, bound in an existentially-quantified binder.
UserAnnotationData
The data of a user annotation: for each used projection we get the type of the corresponding place, and we record outlives predicates that must hold. The first vec matches the input list of projections, the second is free-form.
UserAnnotationProj
Denotes a subplace of a user annotation, e.g. in let Foo { x, .. }: Self = ...; the annotation will have a projection for x.

Derive Macros§

AdtInto
AdtInto derives a SInto instance. This helps at transporting a algebraic data type A to another ADT B when A and B shares a lot of structure.