Module rustc_borrowck::consumers

source ·
Expand description

A public API provided for the Rust compiler consumers. This file provides API for compiler consumers.


  • A Body with information computed by the borrow checker. This struct is intended to be consumed by compiler consumers.
  • Borrows stores the data used in the analyses that track the flow of borrows.
  • Maps between a MIR Location, which identifies a particular statement within a basic block, to a “rich location”, which identifies at a finer granularity. In particular, we distinguish the start of a statement and the mid-point. The mid-point is the point just before the statement takes effect; in particular, for an assignment A = B, it is the point where B is about to be written into A. This mid-point is a kind of hack to work around our inability to track the position information at sufficient granularity through outlives relations; however, the rich location table serves another purpose: it compresses locations from multiple words into a single u32.


  • Options determining the output behavior of get_body_with_borrowck_facts.
  • When checking if a place conflicts with another place, this enum is used to influence decisions where a place might be equal or disjoint with another place, such as if a[i] == a[j]. PlaceConflictBias::Overlap would bias toward assuming that i might equal j and that these places overlap. PlaceConflictBias::NoOverlap assumes that for the purposes of the predicate being run in the calling context, the conservative choice is to assume the compared indices are disjoint (and therefore, do not overlap).



  • This function computes borrowck facts for the given body. The ConsumerOptions determine which facts are returned. This function makes a copy of the body because it needs to regenerate the region identifiers. It should never be invoked during a typical compilation session due to the unnecessary overhead of returning BodyWithBorrowckFacts.
  • Helper function for checking if places conflict with a mutable borrow and deep access depth. This is used to check for places conflicting outside of the borrow checking code (such as in dataflow).

Type Aliases§