Hi,
I am looking for documentation on the rules for name resolution of items.
I've seen The rustc-guide is now the rustc-dev-guide but it doesnt explain resolution of items.
My current assumption is that scopes are traversed upwards, and for each scope: if an unambiguous explicit identifier is found, then it is used. If an unambiguous identifier is found from wildcards (*), then it is used.
Is this correct, and, is there any documentation on this?
Shown below, Example 1 and 2 binds differently.
Context:
mod m1 { pub fn foo() {panic!("");} }
mod m2 { pub fn foo() {} }
Example 1:
use m2::foo;
use m1::*;
{
foo(); // m2::foo
}
Example 2:
use m2::foo;
{
use m1::*;
foo(); // m1::foo
}