Expand description

Various data structures used by the Rust compiler. The intention is that code in here should not be specific to rustc, so that it can be easily unit tested and so forth.


This API is completely unstable and subject to change.


  • atomic_ref 🔒
  • Simple file-locking apis for each OS.
  • An immutable, owned value (except for interior mutability).
  • hashes 🔒
    rustc encodes a lot of hashes. If hashes are stored as u64 or u128, a derive(Encodable) will apply varint encoding to the hashes, which is less efficient than directly encoding the 8 or 16 bytes of the hash.
  • The ObligationForest is a utility data structure used in trait matching to track the set of outstanding obligations (those not yet resolved to success or error). It also tracks the “backtrace” of each pending obligation (why we are trying to figure this out in the first place).
  • Rust Compiler Self-Profiling
  • This is a copy of core::hash::sip adapted to providing 128 bit hashes.
  • A utility class for implementing “snapshottable” things; a snapshottable data structure permits you to take a snapshot (via start_snapshot) and then, after making some changes, elect either to rollback to the start of the snapshot or commit those changes.
  • Calculation and management of a Strict Version Hash for crates
  • This module defines various operations and types that are implemented in one way for the serial compiler, and another way the parallel compiler.
  • This module implements tagged pointers.
  • A singly-linked list.
  • Module which contains the snapshot/rollback functionality of the ena data structures.
  • Union-find implementation. The main type is UnificationTable.
  • This module contains collection types that don’t expose their internal ordering. This is a useful property for deterministic computations, such as required by the query system.



  • This is essentially an AtomicPtr but is guaranteed to always be valid
  • This is a marker for a fatal compiler error used with resume_unwind.


  • Returns a structure that calls f when dropped.
  • Turns a closure that takes an &mut Formatter into something that can be display-formatted.
  • This calls the passed function while ensuring it won’t be inlined into the caller.