Crate ra_ap_hir_ty

source ·
Expand description

The type system. We currently use this to infer types for completion, hover information and various assists.

Re-exports§

Modules§

  • 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_analysis/check/autoderef.rs).
  • Constant evaluation details
  • The home of HirDatabase, which is the Salsa database containing all the type inference-related queries.
  • Type inference-based diagnostics.
  • The HirDisplay trait, which serves two purposes: Turning various bits from HIR back into source code, and just displaying them for debugging/testing purposes.
  • Functions to detect special lang items
  • Compute the binary representation of a type
  • 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 definitions and implementation
  • A few helper functions for dealing with primitives.
  • Trait solving using Chalk.

Macros§

Structs§

  • Represents coercing a value to a different type of value.
  • The id for an Abstract Data Type (i.e. structs, unions and enums).
  • 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.
  • A function signature as seen by type inference: Several parameter types and one return type.
  • 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) }, then T would be represented as a BoundVar(0) (as the for is the innermost binder).
  • A wrapper for the substs on a Fn.
  • The result of type inference: A mapping from expressions and patterns to types.
  • 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.
  • This is a builder for Ty or anything that needs a Substitution.

Enums§

Traits§

Functions§

Type Aliases§