pub fn lower_tree(
cx: &StageCx<'_>,
inputs: &LoweringInputs<'_>,
tree_id: TreeId,
tree: &Arc<NodeTree<Flm>>,
) -> LoweringOutcomeExpand description
Lowers one frozen tree for one backend: runs the rounds, calls the selected rules, and returns the lowered tree with the diagnostics raised (see the module documentation).
cx is the calling stage’s context: the Lowerer reads the rules’
declared tables and options through it, and brings a spliced synthesized
value up to date through it. tree_id identifies the document tree of
which tree is the frozen form; it becomes the tree part of every
LoweredAddr into the result.
It never returns an error: a tree that cannot be lowered comes back with
LoweringOutcome::lowered set to None and an Error diagnostic. Call it
on a worker thread (the runner’s stages already run on one), since the walk
recurses as deeply as the tree nests.
§Panics
Panics if inputs.selected was built against a registry other than
inputs.registry, so that a selected rule’s index is out of range for that
registry’s rule list. The lowering stage and the pieces stage always pass a
matching pair; only inputs assembled by hand from two registries can reach
this.