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
.awaitin 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 andRefCellborrows;readandwriteonly without arguments, as onRwLock). - 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, andCommand::Replyor clapβsCommand::parse_fromare no process at all.reqwestcounts only throughreqwest::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:
methodforx.method(..),Type::fforType::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
clifeature). - 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
mutflag. - pure_
block π - A block that is a single pure expression.
- reads_
clock π - Whether
tokenscall 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.