Module chalk_solve::rust_ir

source ·
Expand description

Contains the definition for the “Rust IR” – this is basically a “lowered” version of the AST, roughly corresponding to [the HIR] in the Rust compiler.


  • Information about the size and alignment of an ADT.
  • Represents an alias equality bound on e.g. a type or type parameter. Does not know anything about what it’s binding.
  • Represents an associated type declaration found inside of a trait:
  • Encodes the parts of AssociatedTyDatum where the parameters P0..Pm are in scope (bounds and where_clauses).
  • Represents the value of an associated type that is assigned from within some impl.
  • Identifier for an “associated type value” found in some impl.
  • Represents a coroutine type.
  • The nested types for a coroutine. This always appears inside a CoroutineDatum
  • The coroutine witness data. Each CoroutineId has both a CoroutineDatum and a CoroutineWitnessDatum - these represent two distinct types in Rust. CoroutineWitnessDatum is logically ‘inside’ a coroutine - this only matters when we treat the witness type as a ’constituent type for the purposes of determining auto trait implementations.
  • The coroutine witness types, together with existentially bound lifetimes. Each ‘witness type’ represents a type stored inside the coroutine across a yield. When a coroutine type is constructed, the precise region relationships found in the coroutine body are erased. As a result, we are left with existential lifetimes - each type is parameterized over some lifetimes, but we do not know their precise values.
  • A rust intermediate representation (rust_ir) of a function definition/declaration. For example, in the following rust code:
  • Represents the bounds on a FnDefDatum, including the function definition’s type signature and where clauses.
  • Represents the inputs and outputs on a FnDefDatum. This is split from the where clauses, since these can contain bound lifetimes.
  • Represents the bounds for an impl Trait type.
  • Represents a trait bound on e.g. a type or type parameter. Does not know anything about what it’s binding.
  • A rust intermediate representation (rust_ir) of a Trait Definition. For example, given the following rust code:


  • Indicates the “most permissive” Fn-like trait that the closure implements. If the closure kind for a closure is FnMut, for example, then the closure implements FnMut and FnOnce.
  • An inline bound, e.g. : Foo<K> in impl<K, T: Foo<K>> SomeType<T>.
  • A list of the traits that are “well known” to chalk, which means that the chalk-solve crate has special, hard-coded impls for them.


Type Aliases§