pub enum Binding {
Global,
Local,
Weak,
}Expand description
How far a function’s name reaches.
The three an object file can say, which is fewer than the five the IR has, and the narrowing is done where a function is lowered rather than where it is written out. What it is here for is to survive the trip: everything between the IR and the object file is handed machine functions, so a fact about the symbol that is not on one is a fact that is gone.
Variants§
Global
Visible to every other object, and the definition here is the definition. What a plain definition at file scope gets, which is why it is the one a function starts as.
Local
Invisible outside this object, which is what static at file scope means. Two files may
each have one of the same name and they are two functions.
Weak
Visible, and allowed to lose to a definition in another object.