[][src]Module c2rust_refactor::analysis::ownership

This module contains an analysis to infer ownership information for pointers. It analyzes code using raw pointers and indicates, for each pointer, whether it appears to be owned, mutably borrowed, or immutably borrowed. It can also infer ownership-polymorphic function signatures, which handles cases where the original C code used a single accessor for both mutable and immutable access to a field.

The analysis operates on constraint sets over "permission variables", which can be take on the concrete permissions "READ", "WRITE", and "MOVE". The analysis runs in two phases. First, for each function, it analyzes the function and produces a set of constraints relating variables in the function's signature, variables appearing in static locations (such as struct field types). Since interprocedural information is not available yet, this phase leaves holes where constraints for callee functions can be plugged in. The second phase fills in holes in function summaries to produce complete summaries that are useful to analysis consumers. It runs interprocedurally to a fixed point, on each function plugging in the complete summaries of its callees and simplifying to produce a complete summary for the current function.

Modules

constraint

ConstraintSet and related definitions.

Structs

AnalysisResult

The collected results of running the analysis.

FnSig

A generic labeled function signature.

FuncRef

A reference to a function.

FunctionResult

Results specific to an analysis-level function.

MonoResult

Results specific to a function monomorphization.

Var

A variable index.

VariantResult

Results specific to a variant fn.

Enums

ConcretePerm

One of the concrete permission values, READ, WRITE, or MOVE.

PermVar

A permission variable.

Functions

analyze

Run the analysis.

dump_results

Print the analysis results to stderr, for debugging.

Type Definitions

LTy

A type where pointer type constructors are labeled with permission variables.

PFnSig

A signature where pointers are labeled with concrete permissions.

PTy

A type where pointers are labeled with concrete permissions.

VFnSig

A signature where pointers are labeled with variables.

VTy

A type where pointers are labeled with variables.