Expand description
The type system. We currently use this to infer types for completion, hover information and various assists.
Re-exports§
pub use autoderef::autoderef;
pub use method_resolution::check_orphan_rules;
pub use traits::TraitEnvironment;
Modules§
- autoderef
- In certain situations, rust automatically inserts derefs as necessary: for
example, field accesses
foo.bar
still work whenfoo
is actually a reference to a type with the fieldbar
. This is an approximation of the logic in rustc (which lives in rustc_hir_analysis/check/autoderef.rs). - consteval
- Constant evaluation details
- consteval_
nextsolver - Constant evaluation details
- db
- The home of
HirDatabase
, which is the Salsa database containing all the type inference-related queries. - diagnostics
- Type inference-based diagnostics.
- display
- The
HirDisplay
trait, which serves two purposes: Turning various bits from HIR back into source code, and just displaying them for debugging/testing purposes. - dyn_
compatibility - Compute the dyn-compatibility of a trait
- generics
- Utilities for working with generics.
- lang_
items - Functions to detect special lang items
- layout
- Compute the binary representation of a type
- method_
resolution - This module is concerned with finding methods that a given type provides. For details about how this works in rustc, see the method lookup page in the rustc guide and the corresponding code mostly in rustc_hir_analysis/check/method/probe.rs.
- mir
- MIR definitions and implementation
- next_
solver - Things relevant to the next trait solver.
- primitive
- A few helper functions for dealing with primitives.
- traits
- Trait solving using Chalk.
Macros§
Structs§
- Adjustment
- Represents coercing a value to a different type of value.
- AdtId
- The id for an Abstract Data Type (i.e. structs, unions and enums).
- Bound
Var - Identifies a particular bound variable within a binder.
Variables are identified by the combination of a
DebruijnIndex
, which identifies the binder, and an index within that binder. - Callable
Sig - A function signature as seen by type inference: Several parameter types and one return type.
- Captured
Item - Complex
Memory Map - Debruijn
Index - References the binder at the given depth. The index is a de
Bruijn index, so it counts back through the in-scope binders,
with 0 being the innermost binder. This is used in impls and
the like. For example, if we had a rule like
for<T> { (T: Clone) :- (T: Copy) }
, thenT
would be represented as aBoundVar(0)
(as thefor
is the innermost binder). - Impl
Trait - Impl
Traits - Inference
Result - The result of type inference: A mapping from expressions and patterns to types.
- Interner
- Overloaded
Deref - An overloaded autoderef step, representing a
Deref(Mut)::deref(_mut)
call, with the signature&'a T -> &'a U
or&'a mut T -> &'a mut U
. The target type isU
in both cases, with the region and mutability being those shared by both the receiver and the returned reference. - Target
Features - TyBuilder
- This is a builder for
Ty
or anything that needs aSubstitution
. - TyLowering
Context - TyLowering
Diagnostic
Enums§
- Adjust
- Auto
Borrow - Binding
Mode - Binding modes inferred for patterns. https://doc.rust-lang.org/reference/patterns.html#binding-modes
- Capture
Kind - Cast
Error - Const
Scalar - A concrete constant value
- Const
Scalar Ns - A concrete constant value
- Drop
Glue - FnAbi
- Generic
Args Prohibited Reason - Impl
Trait Id - Impl
Trait Lowering Mode - Incorrect
Generics LenKind - Inference
Diagnostic - Inference
TyDiagnostic Source - Lifetime
Elision Kind - Memory
Map - A constant can have reference to other things. Memory map job is holding the necessary bits of memory of the const eval session to keep the constant meaningful.
- Mutability
- Whether a type is mutable or not.
- Param
Kind - Param
Lowering Mode - Path
Generics Source - A path can have many generic arguments: each segment may have one associated with the segment, and in addition, each associated type binding may have generic arguments. This enum abstracts over both.
- Path
Lowering Diagnostic - Pointer
Cast - Safety
- Whether a function is safe or not.
- Scalar
- Types of scalar values.
- TyDefId
- TyLowering
Diagnostic Kind - TyVariable
Kind - Represents some extra knowledge we may have about the type variable.
- Unsafety
- Value
TyDef Id - Variance
Traits§
- Cast
- The
Cast
trait is used to make annoying upcasts between logically equivalent types that imply wrappers. For example, one could convert aDomainGoal
into aGoal
by doing: - DynTy
Ext - Projection
TyExt - ToChalk
- Trait
RefExt - TyExt
- Type
Super Visitable - For types where “visit” invokes a callback on the
visitor
, theTypeSuperVisitable
trait captures the recursive behavior that visits all the contents of the type. - Type
Visitable - Applies the given
visitor
to a value, producing a visited result of typeTypeVisitor::Result
. - Type
Visitor - A “visitor” recursively folds some term – that is, some bit of IR,
such as a
Goal
, and computes a value as a result.
Functions§
- all_
super_ traits - Returns an iterator over the whole super trait hierarchy (including the trait itself).
- associated_
type_ shorthand_ candidates - callable_
sig_ from_ fn_ trait - collect_
placeholders - Returns unique placeholders for types and consts contained in
value
. - could_
coerce - could_
unify - Check if types unify.
- could_
unify_ deeply - Check if types unify eagerly making sure there are no unresolved goals.
- direct_
super_ traits - Returns an iterator over the direct super traits (including the trait itself).
- error_
lifetime - from_
assoc_ type_ id - from_
chalk_ trait_ id - from_
foreign_ def_ id - from_
placeholder_ idx - is_
fn_ unsafe_ to_ call - known_
const_ to_ ast - lt_
from_ placeholder_ idx - lt_
to_ placeholder_ idx - param_
idx - Return an index of a parameter in the generic type parameter list by it’s id.
- replace_
errors_ with_ variables - ‘Canonicalizes’ the
t
by replacing any errors with new variables. Also ensures there are no unbound variables or inference variables anywhere in thet
. - setup_
tracing - static_
lifetime - to_
assoc_ type_ id - to_
chalk_ trait_ id - to_
foreign_ def_ id - to_
placeholder_ idx
Type Aliases§
- AliasEq
- AliasTy
- Assoc
Type Id - Binders
- Represents generic parameters and an item bound by them. When the item has parent, the binders also contain the generic parameters for its parent. See chalk’s documentation for details.
- Canonical
- Canonical
VarKinds - Closure
Id - Const
- Const
Value - FnDefId
- FnPointer
- Foreign
DefId - Generic
Arg - Generic
ArgData - Impl
Trait Idx - InEnvironment
- Opaque
TyId - Placeholder
Index - Poly
FnSig - A polymorphic function signature.
- Projection
Ty - Quantified
Where Clause - Substitution
- Interned list of generic arguments for an item. When an item has parent, the
Substitution
for it contains generic arguments for both its parent and itself. See chalk’s documentation for details. - Trait
Ref - Ty
- TyKind
- Type
Flags - Where
Clause