Skip to main content

Module classify

Module classify 

Source
Expand description

Statement classification: which statements become graph nodes, and what each one does.

A node is a statement psync may move: a binding of an awaited or pure value, an awaited expression statement, or an ordinary statement (an effect, kept in order with other effects). A barrier stays exactly where it is and splits the block into independent regions. Early exits (?, return, break, continue) inside a node are allowed: code generation records them and re-raises them in program order (see crate::exits).

StructsΒ§

Exits πŸ”’
Finds awaits and early exits in an expression, without entering closures, async blocks or nested items (their awaits and exits belong to them).
Node πŸ”’
A movable statement and what the analysis knows about it.
Scope πŸ”’
Mutability facts about the enclosing function, needed to tell reads from writes.

EnumsΒ§

Class πŸ”’
The outcome of classifying one statement.

ConstantsΒ§

AWAITING_MACROS πŸ”’
Macros that await the futures they are given, with no .await in their tokens (tokio::select!, futures::join!). psync cannot see the calls inside them, so a statement using one is a barrier, and its effects are unknown writes.
CLOCK_CALLS πŸ”’
Clock reads (Instant::now(), started.elapsed()): when they run relative to the waits around them is what they measure, so statements making them are barriers.
DELAY_AWAITS πŸ”’
Deliberate delays: their position is the point. Statements awaiting these are barriers.
GUARD_AWAITS πŸ”’
Awaited operations that acquire something held afterwards (a lock, permit or transaction). A statement that keeps the guard is a barrier; one that drops it inside a nested block (its own critical section) may still move, since the lock itself keeps mutual exclusion.
GUARD_METHODS πŸ”’
Methods whose result, bound by a let, is a guard held afterwards (synchronous locks and RefCell borrows; read and write only without arguments, as on RwLock).
HINTS πŸ”’
The hint attributes psync reads and removes from its output.
LOG_MACROS πŸ”’
Logging statements: treated as pure so they do not split regions.
NET_PATHS πŸ”’
Synchronous calls that wait on the network or a process (Phase II): in a synchronous function, a statement making one plays the part of an await. A statement blocks when it names one of these paths and calls one of the methods that wait: Command::new("git") builds a command, .output() runs it, and Command::Reply or clap’s Command::parse_from are no process at all. reqwest counts only through reqwest::blocking.
NET_WAITS πŸ”’
PROCESS_WAITS πŸ”’
PURE_MACROS πŸ”’
Macros that build values without side effects.

FunctionsΒ§

any_token πŸ”’
Scans tokens outside closures and async blocks, which decide for themselves when they run, and outside macro arguments, whose effects psync cannot see (assert!(cmd.status()?..) must not become a blocking statement with no effects).
bindings_in πŸ”’
Every name bound by a pattern anywhere inside block.
blocks_on_world πŸ”’
A synchronous call to the network or a process: a path that reaches one, and a method that waits for it.
callee πŸ”’
The name of an awaited call: method for x.method(..), Type::f for Type::f(..).
classify πŸ”’
Classify one statement.
end_line_of πŸ”’
Last source line of a span (see line_of).
expr_attrs πŸ”’
The attributes of an expression statement (#[psync::speculate] api.delete(x).await?;).
inner_bindings πŸ”’
Every name bound by a pattern anywhere inside stmt, except the statement’s own bindings.
is_place πŸ”’
A place expression whose evaluation has no side effects (a variable, field or pure index).
is_psync_attr πŸ”’
True for #[psync::name] (or a bare #[graph]).
is_pure πŸ”’
Cheap expressions without side effects, which may move freely relative to awaits.
label_for πŸ”’
Short label for reports: the bindings and the first awaited call.
line_of πŸ”’
Source line of a span; only known when proc-macro2 tracks locations (the cli feature).
macro_name πŸ”’
pat_has_ref πŸ”’
True when a pattern binds by reference (ref x), which cannot be handed between scopes.
pat_idents πŸ”’
Bindings introduced by a pattern, with their mut flag.
pure_block πŸ”’
A block that is a single pure expression.
reads_clock πŸ”’
Whether tokens call a clock function outside closures and async blocks (f(..), x.f(..)).
takes_guard πŸ”’
.lock(), .borrow_mut(), .read() and the like: the value may be a guard.