pub fn reject_alias_cycle(ast: &Ast) -> Result<(), ProbeError>Expand description
Refuse a model whose typedefs close a cycle, before any walk follows one.
IDL 4.2 §7.4.1.4.4.4 has no declaration that closes a typedef cycle —
a typedef names a type that must already be declared, and the
forward declaration IDL does have is for structures, unions and
interfaces, not for aliases. So typedef T T; is not IDL. The
frontend admits it anyway, measured 2026-08-31 on
typedef Tee Tee; @final struct Ess { Tee ex; };, which
model_from_idl accepts with no diagnostic.
What that model then does is the reason this exists. Every walk in
this crate and in zerodds-wire-probe sees a typedef the same way —
resolve the target, recurse on it, with nothing else changing — so a
chain that returns to itself is an unbounded recursion in each of
them. Thirteen of them ran into the stack rather than answering:
canonicalise, the five fill emitters, the five dump emitters,
ros_idl::ros_package and recursion::recursive_aggregates. A
probe that aborts has measured nothing, and an empty cell reads as a
vendor difference.
Called once at the entry of each walk rather than at each alias arm: the answer is a property of the model, not of the position in it, and one scan up front leaves every arm below free to follow a chain that is now known to be finite.
Every alias in the model and not only the ones below root: an
unreachable cyclic typedef is a declaration the frontend should have
refused, and a probe run over a file holding one is measuring a model
nobody can write down.
§Errors
ProbeError::NoLayout, naming the typedef the chain returns to.