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 next_solver::interner::attach_db;pub use next_solver::interner::attach_db_allow_change;pub use next_solver::interner::with_attached_db;pub use traits::ParamEnvAndCrate;pub use traits::check_orphan_rules;
Modulesยง
- autoderef
- In certain situations, rust automatically inserts derefs as necessary: for
example, field accesses
foo.barstill work whenfoois actually a reference to a type with the fieldbar. This is an approximation of the logic in rustc (which lives inrustc_hir_typeck/autoderef.rs). - builtin_
derive - Implementation of builtin derive impls.
- closure_
analysis - consteval
- 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
HirDisplaytrait, which serves two purposes: Turning various bits from HIR back into source code, and just displaying them for debugging/testing purposes. - drop
- Utilities for computing drop info about types.
- dyn_
compatibility - Compute the dyn-compatibility of a trait
- generics ๐
- Utilities for working with generics.
- infer ๐
- Type inference, i.e. the process of walking through the code and determining the type of each expression and pattern.
- inhabitedness ๐
- Type inhabitedness logic.
- lang_
items - Functions to detect special lang items
- layout
- Compute the binary representation of a type
- lower ๐
- Methods for lowering the HIR to types. There are two main cases here:
- 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_typeck/method/probe.rs. - mir
- MIR definitions and implementation
- next_
solver - Things relevant to the next trait solver.
- opaques ๐
- Handling of opaque types, detection of defining scope and hidden type.
- primitive
- A few helper functions for dealing with primitives.
- representability ๐
- Detecting whether a type is infinitely-sized.
- solver_
errors - Handling of trait solver errors and converting them to errors
hircan pass toide-diagnostics. - specialization ๐
- Impl specialization related things
- target_
feature ๐ - Stuff for handling
#[target_feature](needed for unsafe check). - traits
- Trait solving using next trait solver.
- upvars
- A simple query to collect tall locals (upvars) a closure use.
- utils ๐
- Helper functions for working with def, which donโt need to be a separate
query, but canโt be computed directly from
*Data(ie, which need adb). - variance ๐
- Module for inferring the variance of type and lifetime parameters. See the rustc dev guide chapter for more info.
Structsยง
- Adjustment
- Represents coercing a value to a different type of value.
- Binding
Mode - The mode of a binding (
mut,ref mut, etc). Used for both the explicit binding annotations given in the HIR for a binding and the final binding mode that we infer after type inference/match ergonomics..0is the by-reference mode (ref,ref mut, or by value),.1is the mutability of the binding. - Complex
Memory Map - Field
Type - Generic
Defaults - Generic
Defaults Ref - Generic
Predicates - Impl
Traits - Inference
Result - The result of type inference: A mapping from expressions and patterns to types.
- Overloaded
Deref - An overloaded autoderef step, representing a
Deref(Mut)::deref(_mut)call, with the signature&'a T -> &'a Uor&'a mut T -> &'a mut U. The target type isUin both cases, with the region and mutability being those shared by both the receiver and the returned reference. - Param
Collector ๐ - Target
Features - TyLowering
Context - TyLowering
Result
Enumsยง
- Adjust
- Auto
Borrow - ByRef
- Cast
Error - Explicit
Drop Method UseKind - Generic
Args Prohibited Reason - Impl
Trait Id - Incorrect
Generics LenKind - Infer
Body Id - A [
DefWithBodyId], or an anon const. - Inference
Diagnostic - Inference
TyDiagnostic Source - Lifetime
Elision Kind - Lifetime
Lowering Mode - Lowering
Mode - 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.
- 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 - Return
Kind - Span
- A
Spanrepresents some location in lowered code - a type, expression or pattern. - Target
Feature IsSafe InTarget - TyDefId
- TyLowering
Diagnostic - Unsafety
- Value
TyDef Id
Traitsยง
Functionsยง
- all_
super_ traits - Returns the whole super trait hierarchy (including the trait itself).
- associated_
type_ shorthand_ candidates - To be used from
hironly. - callable_
sig_ from_ fn_ trait - To be used from
hironly. - collect_
params - Returns unique params 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).
- infer_
query_ with_ inspect - is_
fn_ unsafe_ to_ call - known_
const_ to_ ast - lifetime_
param_ idx - replace_
errors_ with_ variables - โCanonicalizesโ the
tby replacing any errors with new variables. Also ensures there are no unbound variables or inference variables anywhere in thet. - setup_
tracing - target_
feature_ is_ safe_ in_ target - type_
or_ const_ param_ idx - Return an index of a parameter in the generic type parameter list by itโs id.