Skip to main content

Crate hir_ty

Crate hir_ty 

Source
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;
pub use utils::TargetFeatureIsSafeInTarget;
pub use utils::Unsafety;
pub use utils::all_super_traits;
pub use utils::direct_super_traits;
pub use utils::is_fn_unsafe_to_call;
pub use utils::target_feature_is_safe_in_target;

Modules§

autoderef
In certain situations, rust automatically inserts derefs as necessary: for example, field accesses foo.bar still work when foo is actually a reference to a type with the field bar. This is an approximation of the logic in rustc (which lives in rustc_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.
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 hir can pass to ide-diagnostics.
specialization 🔒
Impl specialization related things
target_feature 🔒
Stuff for handling #[target_feature] (needed for unsafe check).
traits
Trait solving using next trait solver.
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 a db).
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.
BindingMode
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. .0 is the by-reference mode (ref, ref mut, or by value), .1 is the mutability of the binding.
ComplexMemoryMap
FieldType
GenericDefaults
GenericDefaultsRef
GenericPredicates
InferenceResult
The result of type inference: A mapping from expressions and patterns to types.
OverloadedDeref
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 is U in both cases, with the region and mutability being those shared by both the receiver and the returned reference.
ParamCollector 🔒
TargetFeatures
TyLoweringContext
TyLoweringResult

Enums§

Adjust
AutoBorrow
ByRef
CastError
ExplicitDropMethodUseKind
GenericArgsProhibitedReason
ImplTraitId
IncorrectGenericsLenKind
InferBodyId
A DefWithBodyId, or an anon const.
InferenceDiagnostic
LifetimeElisionKind
LifetimeLoweringMode
LoweringMode
MemoryMap
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.
PathGenericsSource
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.
PathLoweringDiagnostic
PointerCast
ReturnKind
Span
A Span represents some location in lowered code - a type, expression or pattern.
TyDefId
TyLoweringDiagnostic
ValueTyDefId

Traits§

TyLoweringInferVarsCtx

Functions§

associated_type_shorthand_candidates
To be used from hir only.
callable_sig_from_fn_trait
To be used from hir only.
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.
infer_query_with_inspect
lifetime_param_idx
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 the t.
setup_tracing
type_or_const_param_idx
Returns the index of a parameter in the generic type parameter list by its id.