Skip to main content

Module types

Module types 

Source

Re-exports§

pub use mir_kinds::IsMirKind;
use crate::frontend::prelude::*; 🔒

Modules§

adt 🔒
def_id 🔒
This module contains the type definition for DefId and the types DefId depends on.
full_def
item_ref
mir 🔒
Copies of the relevant MIR types. MIR represents a rust (function) body as a CFG. It’s a semantically rich representation that contains no high-level control-flow operations like loops or patterns; instead the control flow is entirely described by gotos and switches on integer values.
mir_kinds
Enumerates the kinds of Mir bodies. TODO: use const generics instead of an open list of types.
new 🔒
This module contains type definitions that have no equivalent in Rustc.
predicates 🔒
synthetic_items
traits 🔒
ty 🔒
Frontend representations of Rust types and related type operations.
vars 🔒

Structs§

Adt
ADts (Struct, Enum and Union map to this).
AdtTy
Alias
This type merges the information from [ty::AliasTyKind] and [ty::AliasTy].
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]
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.
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
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
ForeignMod
An extern block.
ForeignTy
FullDef
Gathers a lot of definition information about a rustc_hir::def_id::DefId.
GenericParamDef
Reflects [ty::GenericParamDef]
GenericParamDefIds
This is a pretty criminal hack: I want to generate ty::Generics for my fake items. This requires DefIds for the generic parameters. rustc has an affordance for creating new DefIds (tcx.create_def()) but I could not figure out a way to use it that didn’t end up ICEing during metadata encoding. So instead I’m reusing the DefIds of generic parameters from core functions.
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
ItemRef
Reference to an item, with generics. Basically any mention of an item (function, type, etc) uses this.
ItemRefContents
Contents of ItemRef.
LateBinder
A binder that wraps something that may mention the late-bound variables of an item. This does not count for de Bruijn indices: the late bound vars will instead be referred to using LateParam, using the def_id of this binder. That def_id is always that of the item, except in cases where the item doesn’t have a rustc DefId, in which case we use a dummy one.
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.
ParamEnv
The combination of type generics and related predicates.
PatTy
Placeholder
Reflects [ty::Placeholder]
Predicate
Reflects [ty::Predicate] and adds a hash-consed predicate identifier.
ProjectionPredicate
Expresses a constraints over an associated type.
RawPtrTy
RefTy
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]
TupleTy
Ty
Reflects [rustc_middle::ty::Ty]
TyAlias
Type alias: type Foo = Bar;
TyFnSig
Reflects [ty::FnSig]
TyGenerics
Reflects [rustc_trait_elaboration::GenericParams].
TypeAndMut
Reflects [ty::TypeAndMut]
UserArgs
Reflects [ty::UserArgs]
UserSelfTy
Reflects [ty::UserSelfTy]
VariantDef
Reflects [ty::VariantDef]
VirtualImplAssocItem
Align
Alignment of a type in bytes (always a power of two).
BoundVar
ByteSymbol
Like Symbol, but for byte strings. ByteSymbol is used less widely, so it has fewer operations defined than Symbol.
DebruijnIndex
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:
EarlyParamRegion
FieldIdx
The source-order index of a field in a variant.
MacroKinds
A set of macro kinds, for macros that can have more than one kind
ParamConst
ParamTy
PromotedId
RAllocId
Span
A compressed span.
Spanned
Symbol
An interned UTF-8 string.

Enums§

AdtKind
Reflects [ty::AdtKind]
AliasKind
Reflects [rustc_middle::ty::AliasTyKind].
AssocItemContainer
AssocTyKind
BoundRegionKind
Reflects [ty::BoundRegionKind]
BoundTyKind
Reflects [ty::BoundTyKind]
BoundVariableKind
Reflects [ty::BoundVariableKind]
ClauseKind
Reflects [ty::ClauseKind]
ClosureKind
Reflects [ty::ClosureKind]
ConstKind
The kind of a constant item.
ConstOperandKind
DefIdBase
DefKind
Reflects rustc_hir::def::DefKind
DefPathItem
Reflects [rustc_hir::definitions::DefPathData]
DerivedItemKind
DiscriminantDefinition
Reflects [ty::VariantDiscr]
ExistentialPredicate
A predicate without Self, for use in dyn Trait.
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.
HostEffectClause
NormalizesTo
Pattern
PredicateKind
Reflects [ty::PredicateKind]
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]
TyKind
Reflects [ty::TyKind]
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.
Visibility
Reflects [ty::Visibility]
AssocConstData
AssocKind
AssocTypeData
BoundVarIndexKind
Okay, we do something fun for Bound types/regions/consts: Specifically, we distinguish between canonically bound things and for<> bound things. And, really, it comes down to caching during canonicalization and instantiation.
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}"
FloatTy
ImplTraitInTraitData
Useful source information about where a desugared associated type for an RPITIT originated from.
InferTy
A placeholder for a type that hasn’t been inferred yet.
InlineAttr
IntTy
Mutability
Safety
UintTy
Variance

Constants§

SYNTHETIC_CRATE_NAME
The crate name under which synthetic items are exported under.

Traits§

BinderVariances
Lets types declare how to compute the variance of bound parameters.

Functions§

alias_ty_kind_def_id
assoc_items_of
The associated items of the trait or inherent impl that owns s, in definition order.
closure_sig
Retrieve a closure’s signature.
compute_unsizing_metadata
gen_vtable_sig
The vtable signature of the method, along with the state of its container.
get_def_kind
Gets the kind of the definition. Can’t use def_kind directly because this crashes on the crate root.
get_implied_predicates
get_param_env
get_self_predicate
get_trait_decl_dyn_self_ty
Generates a dyn Trait<Args.., Ty = <Self as Trait>::Ty..> type for this trait.
late_bound_for_def
lifetime_param_name
local_names
resolve_for_dyn
self_trait_ref
translate_full_def
Construct the FullDef for this item. If args is Some, the returned FullDef will be instantiated with the provided generics.
translate_full_def_kind
Construct the FullDefKind for this item.
translate_mir_const
Translate a MIR constant.
type_param_name
vtable_sig_with_dyn_self
The signature of method_decl as stored in a vtable, i.e. with its Self type replaced by the given dyn Trait<..> type.

Type Aliases§

CanonicalUserType
Reflects [ty::CanonicalUserType]
Ident
Reflects [rustc_span::symbol::Ident]
PlaceholderConst
Reflects [ty::PlaceholderConst]
PlaceholderTy
Reflects [ty::PlaceholderType]
PolyFnSig
Reflects [ty::PolyFnSig]
RegionOutlivesPredicate
Reflects [ty::RegionOutlivesPredicate]
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
PlaceholderRegion
Region