Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Functions

Generalized Types and Parameter Environments

A generalized type is either a type or a region

A param env is a list of constraints; where a constraint takes the form:

  • ( outlives )
  • (All regions in outlive )
  • ( implements )

Outlives Judgments

The base outlives relation holds iff it can be derived from the following rules:

  1. Direct:
  2. Reflexivity:
  3. Transitivity: and implies

That is, the base outlives relation is the transitive closure of the region-outlives and type-outlives facts in .

There also exists an outlives relation such that implies . This relation is computed by Rust's type system and additionally accounts for outlives constraints implied by trait membership constraints in .

Function Signatures

A function signature is a pair .

A defined function signature is a tuple .

An instantiation of is the tuple ; where is a list of early-bound parameters.

The identity instantiation of is obtained by applying the identity substitution . Defined function calls are applied to instantiations of a function.

The generalized lifetime projections of a function instantiation is defined as the set:

Function Calls

A function call target is either an instantiation or a closure / function pointer .

A function call takes the form , where is a MIR place, and is a sequence of MIR operands.

is the parameter environment of the function with respect to the call site.

The lifetime projections of a function call is the union of the lifetime projections in and the lifetime projections in .

A function call is valid iff it satisfies the unique region property: each region in the lifetime projections of is unique.

We assume that function calls generated by directly extracting the result place and operands from a MIR body are valid. We note that converting the places to PCG places (which use the type derived from their local), does not necessarily maintain the validity of a function call.