Skip to main content

initialisation_items

Function initialisation_items 

Source
pub fn initialisation_items(module: &Module) -> Vec<Item>
Expand description

The items of module that take no parameter, in the order they must be initialised: each only after every parameterless item it depends on, directly or through a function it mentions.

Module::initialisation_order is that order for the declarations alone, and is where this starts: every declaration in it keeps its place, and the others follow in the order they were found, each placed after what it depends on. An instance’s bindings are not in the graph that order was computed from, since which instance a name reaches is a fact about types; and a specialisation was not there to be found. So this reads what each item mentions in the IR, now that every mention names its target, and puts what a parameterless item reaches ahead of it. An item in a cycle is placed once and the cycle is left as it is, in name order: canonicalization rejects a cycle of declarations, and one through an instance is a language question and not this function’s.

A module that holds no instance member and no specialisation gets exactly Module::initialisation_order, as Item::Declarations.