Crate rustc_type_ir
source ·Re-exports
Modules
- A folding traversal mechanism for complex data structures that contain type information.
- macros 🔒
- This module contains implementations of the
TypeFoldable
andTypeVisitable
traits for various types in the Rust compiler. Most are written by hand, though we’ve recently added some macros and proc-macros to help with the tedium. - A visiting traversal mechanism for complex data structures that contain type information.
Structs
- A De Bruijn index is a standard means of representing regions (and perhaps later types) in a higher-ranked setting. In particular, imagine a type like this:
- A floating-point (
f32
orf64
) type variable ID. - An integral (
u32
,i32
,usize
, etc.) type variable ID. - A type variable ID.
- Flags that we track on types. These flags are propagated upwards through the type during type construction, so that we can quickly check whether the type has various kinds of types in it without recursing over the type itself.
- “Universes” are used during type- and trait-checking in the presence of
for<..>
binders to control what sets of names are visible. Universes are arranged into a tree: the root universe contains names that are always visible. Each child then adds a new set of names that are visible, in addition to those of its parent. We say that the child universe “extends” the parent universe with new names.
Enums
- A placeholder for a type that hasn’t been inferred yet.
Constants
Traits
- Imagine you have a function
F: FnOnce(&[T]) -> R
, plus an iteratoriter
that producesT
items. You could combine them withf(&iter.collect::<Vec<_>>())
, but this requires allocating memory for theVec
. - Needed so we can use #[derive(HashStable_Generic)]