Rust
E0659 Ambiguous Name Fix
Two glob imports can each bring a perfectly good item under the same name, and nothing is wrong until the code uses that name - then E0659 asks which one you meant. This guide works that ambiguity for a function, a struct, a constant, a static, a module, and a trait, shows why an unused ambiguous name compiles, and matches each shape to its repair.
Written November 30, 2026 · Tested with Rust 1.99.1 · 24 min read
- The rule underneath: glob imports defer the choice
- How to read the diagnostic
- The first failure: a function through two globs
- The same error on a type: a struct through two globs
Written November 30, 2026
Tested with Rust 1.99.1
What this guide is
Error E0659 is a name the compiler cannot resolve because two glob imports supply it. The error codes index states it in one line - "An item usage is ambiguous" - and its erroneous example re-exports two modules with pub use crate::moon::*; and pub use crate::earth::*;, each defining a foo, then fails at the call crate::collider::foo() with "ERROR: foo is ambiguous". Its explanation is that the error "generally appears when two items with the same name are imported into a module", and its repair keeps the path before the item at the use site.
The practical payoff is the shape of the fix. Neither glob import is an error, neither item is an error, and renaming an item is almost never the right move. The ambiguity lives only at the use site, so the repair lives there too, or in one added explicit import: pick the item you meant, once, in a way the compiler can follow. The forms in this guide each reproduce E0659 with a small, complete program - a function, a tuple struct, a constant, a static, a module, and a trait - followed by the repairs, the shapes that raise no error at all, and the neighboring duplicate-name errors that are not this one.
Build every program in this guide with rustc --edition 2021. In the compiler transcripts below, the file names are the bare names shown on the command line.
The rule underneath: glob imports defer the choice
A glob import, use bar::*;, brings all the importable items of a module into scope at once. The use declarations chapter of the Rust Reference describes the form as binding all paths matching a given prefix, using the asterisk wildcard syntax use a::b::*;. When two globs each bring a name, neither glob wins: the name is present twice over, and the compiler holds both candidates instead of choosing one. That holding pattern is legal right up to the moment the code uses the name - at the use site there is no rule left to apply, so resolution fails with E0659.
The same chapter states the two rules that resolve the standoff. First: "Items and named imports are allowed to shadow names from glob imports in the same namespace." A local item, or an explicit named import, outranks both globs - which is why adding use bar::foo; on top of the two globs is a complete repair, and why a local foo raises no error at all. Second, a use declaration creates bindings for all namespaces of the imported entities, so a globbed name can be ambiguous in whichever namespace the use site consults: a function or a constant in the value namespace, a struct, a module, or a trait in the type namespace. The namespaces chapter frames that split: a namespace is a "logical grouping of declared names", names "are segregated into separate namespaces based on the kind of entity the name refers to", and its type namespace holds module, struct, union, enum, and trait declarations and type aliases, while its value namespace holds function, constant, and static declarations together with struct and enum variant constructors.
The Rust Book gives the writer's-side warning that predicts this error: "Be careful when using the glob operator! Glob can make it harder to tell what names are in scope and where a name used in your program was defined", and if a dependency adds a definition with the same name as another, the imported set changes and compiler errors can follow. Two globs over modules that both grow a foo are exactly that hazard, arriving inside one crate.
Two consequences follow. First, the error is reported at the use site, never at the imports - if a program imports an ambiguous name and never uses it, there is no E0659. Second, every repair works by supplying the missing choice: name one source explicitly, qualify the name at the use site, or remove one of the globs so only one candidate remains.
How to read the diagnostic
The header is "foo is ambiguous", with the code E0659, naming whichever name collided. The first label underlines the name at its use site and reads "ambiguous name" - that underline, in a call, a constructor, an annotation, a bound, or an impl header, is the exact spot to repair or qualify. Below it, a note states the cause in one line: "ambiguous because of multiple glob imports of a name in the same module". Then come two notes, one per glob, each pointing at a use line: "foo could refer to the function imported here" and "foo could also refer to the function imported here". The wording after "could refer to the" names the kind of item in dispute - the function, the tuple struct, the struct, the constant, the static, the module, or the trait - and each note carries the same help: "consider adding an explicit import of foo to disambiguate". That help is the first repair in reach order, offered by the compiler itself.
One diagnostic detail separates this error from its neighbors at a glance: there is no "defined multiple times" header and no redefinition label. The name was never defined twice in this module - it was imported twice over, through globs, and the failure is ambiguity at a use, not duplication at a definition.
The first failure: a function through two globs
This is the classic form - two helper modules each define a foo, both are glob-imported, and main calls the bare name. Each module also defines one distinct function, and main calls those too, so each glob is in genuine use:
use bar::*;
use baz::*;
mod bar { pub fn foo() -> i32 { 9 } pub fn left() -> i32 { 1 } }
mod baz { pub fn foo() -> i32 { 10 } pub fn right() -> i32 { 2 } }
fn main() { println!("{} {} {}", foo(), left(), right()); }
error[E0659]: `foo` is ambiguous
--> q1.rs:5:34
|
5 | fn main() { println!("{} {} {}", foo(), left(), right()); }
| ^^^ ambiguous name
|
= note: ambiguous because of multiple glob imports of a name in the same module
note: `foo` could refer to the function imported here
--> q1.rs:1:5
|
1 | use bar::*;
| ^^^^^^
= help: consider adding an explicit import of `foo` to disambiguate
note: `foo` could also refer to the function imported here
--> q1.rs:2:5
|
2 | use baz::*;
| ^^^^^^
= help: consider adding an explicit import of `foo` to disambiguate
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0659`.
Only the foo() call fails. left() arrives through exactly one glob and right() through exactly one glob, so both resolve; the diagnostic underlines only the one call that has two candidates. The repair the compiler suggests - an explicit import on top of the globs - is worked in the fixes section below.
The same error on a type: a struct through two globs
A tuple struct name used as a constructor sits in both namespaces at once - the type in the type namespace, the constructor in the value namespace - and the glob ambiguity applies to it in the same way. Each module here also defines one distinct tag struct, and main constructs those too:
use bar::*;
use baz::*;
mod bar { pub struct Widget(pub i32); pub struct BarTag(pub i32); }
mod baz { pub struct Widget(pub i32); pub struct BazTag(pub i32); }
fn main() { let w = Widget(4); let a = BarTag(1); let b = BazTag(2); println!("{} {} {}", w.0, a.0, b.0); }
error[E0659]: `Widget` is ambiguous
--> q2.rs:5:21
|
5 | fn main() { let w = Widget(4); let a = BarTag(1); let b = BazTag(2); println!("{} {} {}", w.0, a.0, b.0); }
| ^^^^^^ ambiguous name
|
= note: ambiguous because of multiple glob imports of a name in the same module
note: `Widget` could refer to the tuple struct imported here
--> q2.rs:1:5
|
1 | use bar::*;
| ^^^^^^
= help: consider adding an explicit import of `Widget` to disambiguate
note: `Widget` could also refer to the tuple struct imported here
--> q2.rs:2:5
|
2 | use baz::*;
| ^^^^^^
= help: consider adding an explicit import of `Widget` to disambiguate
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0659`.
The notes now read "could refer to the tuple struct imported here", because the use site is a constructor call. The same name in a type annotation draws the same error with one wording change - the notes read "could refer to the struct imported here", because the annotation consults the type namespace:
use bar::*;
use baz::*;
mod bar { pub struct Widget(pub i32); pub fn left() -> i32 { 1 } }
mod baz { pub struct Widget(pub i32); pub fn right() -> i32 { 2 } }
fn show(w: Widget) -> i32 { w.0 }
fn main() { println!("{} {} {}", show(bar::Widget(4)), left(), right()); }
error[E0659]: `Widget` is ambiguous
--> q2b.rs:5:12
|
5 | fn show(w: Widget) -> i32 { w.0 }
| ^^^^^^ ambiguous name
|
= note: ambiguous because of multiple glob imports of a name in the same module
note: `Widget` could refer to the struct imported here
--> q2b.rs:1:5
|
1 | use bar::*;
| ^^^^^^
= help: consider adding an explicit import of `Widget` to disambiguate
note: `Widget` could also refer to the struct imported here
--> q2b.rs:2:5
|
2 | use baz::*;
| ^^^^^^
= help: consider adding an explicit import of `Widget` to disambiguate
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0659`.
Note what did not fail in that program: bar::Widget(4) in main is a qualified construction and resolves on its own. Only the bare annotation in show is ambiguous. The explicit-import repair for the constructor form keeps all three constructions, now under one chosen Widget:
use bar::*;
use baz::*;
use bar::Widget;
mod bar { pub struct Widget(pub i32); pub struct BarTag(pub i32); }
mod baz { pub struct Widget(pub i32); pub struct BazTag(pub i32); }
fn main() { let w = Widget(4); let a = BarTag(1); let b = BazTag(2); println!("{} {} {}", w.0, a.0, b.0); }
4 1 2
The output is 4 1 2: the chosen bar struct's field, then the two tag structs' fields. The named import shadows both glob candidates, in both namespaces the tuple struct occupies.
The same error on a constant and a static
Constants and statics are value-namespace items, and each takes the function's form with its own wording in the notes. A constant, with one distinct constant arriving through each glob alongside it:
use bar::*;
use baz::*;
mod bar { pub const LIMIT: i32 = 4; pub const LEFT: i32 = 1; }
mod baz { pub const LIMIT: i32 = 9; pub const RIGHT: i32 = 2; }
fn main() { println!("{} {} {}", LIMIT, LEFT, RIGHT); }
error[E0659]: `LIMIT` is ambiguous
--> q3.rs:5:34
|
5 | fn main() { println!("{} {} {}", LIMIT, LEFT, RIGHT); }
| ^^^^^ ambiguous name
|
= note: ambiguous because of multiple glob imports of a name in the same module
note: `LIMIT` could refer to the constant imported here
--> q3.rs:1:5
|
1 | use bar::*;
| ^^^^^^
= help: consider adding an explicit import of `LIMIT` to disambiguate
note: `LIMIT` could also refer to the constant imported here
--> q3.rs:2:5
|
2 | use baz::*;
| ^^^^^^
= help: consider adding an explicit import of `LIMIT` to disambiguate
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0659`.
A static draws the identical diagnostic with "the static" in place of "the constant":
use bar::*;
use baz::*;
mod bar { pub static LIMIT: i32 = 4; pub static LEFT: i32 = 1; }
mod baz { pub static LIMIT: i32 = 9; pub static RIGHT: i32 = 2; }
fn main() { println!("{} {} {}", LIMIT, LEFT, RIGHT); }
error[E0659]: `LIMIT` is ambiguous
--> q3s.rs:5:34
|
5 | fn main() { println!("{} {} {}", LIMIT, LEFT, RIGHT); }
| ^^^^^ ambiguous name
|
= note: ambiguous because of multiple glob imports of a name in the same module
note: `LIMIT` could refer to the static imported here
--> q3s.rs:1:5
|
1 | use bar::*;
| ^^^^^^
= help: consider adding an explicit import of `LIMIT` to disambiguate
note: `LIMIT` could also refer to the static imported here
--> q3s.rs:2:5
|
2 | use baz::*;
| ^^^^^^
= help: consider adding an explicit import of `LIMIT` to disambiguate
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0659`.
In both programs the distinct names LEFT and RIGHT resolve through their single globs; only the shared name fails, and the item kind in the notes is the only difference between the two diagnostics.
The same error on a module and a trait
A module name is a type-namespace name, so two globs that each bring a module of the same name collide when a path goes through that name:
use bar::*;
use baz::*;
mod bar { pub mod inner { pub fn value() -> i32 { 9 } } pub fn left() -> i32 { 1 } }
mod baz { pub mod inner { pub fn value() -> i32 { 10 } } pub fn right() -> i32 { 2 } }
fn main() { println!("{} {} {}", inner::value(), left(), right()); }
error[E0659]: `inner` is ambiguous
--> q8.rs:5:34
|
5 | fn main() { println!("{} {} {}", inner::value(), left(), right()); }
| ^^^^^ ambiguous name
|
= note: ambiguous because of multiple glob imports of a name in the same module
note: `inner` could refer to the module imported here
--> q8.rs:1:5
|
1 | use bar::*;
| ^^^^^^
= help: consider adding an explicit import of `inner` to disambiguate
note: `inner` could also refer to the module imported here
--> q8.rs:2:5
|
2 | use baz::*;
| ^^^^^^
= help: consider adding an explicit import of `inner` to disambiguate
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0659`.
The underline covers only inner, the first segment of the path - value is never reached, because the path has no starting point until inner resolves. A trait name collides in a generic bound the same way:
use bar::*;
use baz::*;
mod bar { pub trait Greeter { fn value(&self) -> i32; } pub fn left() -> i32 { 1 } }
mod baz { pub trait Greeter { fn value(&self) -> i32; } pub fn right() -> i32 { 2 } }
fn show<T: Greeter>(t: T) -> i32 { t.value() }
struct Local;
impl bar::Greeter for Local { fn value(&self) -> i32 { 4 } }
fn main() { println!("{} {} {}", show(Local), left(), right()); }
error[E0659]: `Greeter` is ambiguous
--> q9.rs:5:12
|
5 | fn show<T: Greeter>(t: T) -> i32 { t.value() }
| ^^^^^^^ ambiguous name
|
= note: ambiguous because of multiple glob imports of a name in the same module
note: `Greeter` could refer to the trait imported here
--> q9.rs:1:5
|
1 | use bar::*;
| ^^^^^^
= help: consider adding an explicit import of `Greeter` to disambiguate
note: `Greeter` could also refer to the trait imported here
--> q9.rs:2:5
|
2 | use baz::*;
| ^^^^^^
= help: consider adding an explicit import of `Greeter` to disambiguate
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0659`.
The impl in that program names its trait in qualified form, bar::Greeter, and is not the failure - the bare bound is. Naming the trait bare in an impl header fails at the header instead, and that form carries an extra warning alongside the error, because a method call through an ambiguously imported trait is also flagged as a future-incompatible use:
use bar::*;
use baz::*;
mod bar { pub trait Greeter { fn value(&self) -> i32; } pub struct Unit; impl Greeter for Unit { fn value(&self) -> i32 { 9 } } }
mod baz { pub trait Greeter { fn value(&self) -> i32; } }
struct Local;
impl Greeter for Local { fn value(&self) -> i32 { 4 } }
fn main() { println!("{}", Local.value()); }
error[E0659]: `Greeter` is ambiguous
--> p9.rs:6:6
|
6 | impl Greeter for Local { fn value(&self) -> i32 { 4 } }
| ^^^^^^^ ambiguous name
|
= note: ambiguous because of multiple glob imports of a name in the same module
note: `Greeter` could refer to the trait imported here
--> p9.rs:1:5
|
1 | use bar::*;
| ^^^^^^
= help: consider adding an explicit import of `Greeter` to disambiguate
note: `Greeter` could also refer to the trait imported here
--> p9.rs:2:5
|
2 | use baz::*;
| ^^^^^^
= help: consider adding an explicit import of `Greeter` to disambiguate
warning: unused import: `baz::*`
--> p9.rs:2:5
|
2 | use baz::*;
| ^^^^^^
|
= note: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default
warning: Use of ambiguously glob imported trait `Greeter`
--> p9.rs:7:34
|
1 | use bar::*;
| --- `Greeter` imported ambiguously here
...
7 | fn main() { println!("{}", Local.value()); }
| ^^^^^
|
= help: Import `Greeter` explicitly
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #152822 <https://github.com/rust-lang/rust/issues/152822>
= note: `#[warn(ambiguous_glob_imported_traits)]` (part of `#[warn(future_incompatible)]`) on by default
error: aborting due to 1 previous error; 2 warnings emitted
For more information about this error, try `rustc --explain E0659`.
That transcript is the one form in this guide where E0659 does not arrive alone: an unused-import warning for the second glob and the future-incompatible trait warning ride along with it. The error itself is the same - the use site, here the impl header, is where the choice has to be supplied.
The name that is never used: no error
Ambiguity is an error only at a use site. This program glob-imports the same colliding pair as the first failure, then never calls the shared name - main calls only the two distinct functions:
use bar::*;
use baz::*;
mod bar { pub fn foo() -> i32 { 9 } pub fn apple() -> i32 { 1 } }
mod baz { pub fn foo() -> i32 { 10 } pub fn banana() -> i32 { 2 } }
fn main() { println!("{} {}", apple(), banana()); }
1 2
The output is 1 2, and the program compiles and runs. Both foo definitions sit unused behind the globs, and no diagnostic names them: with no use site, there is no moment at which the compiler must choose. This is why E0659 often appears late in a module's life - the globs and the colliding items can coexist quietly until the first line of code actually reaches for the shared name.
Shadowing: the two shapes that raise no error
The shadowing rule - items and named imports shadow glob imports in the same namespace - produces two non-errors that look, at a glance, like they should be this error. A local item with the shared name shadows both globs:
use bar::*;
use baz::*;
fn foo() -> i32 { 4 }
mod bar { pub fn foo() -> i32 { 9 } }
mod baz { pub fn foo() -> i32 { 10 } }
fn main() { println!("{}", foo()); }
4
The output is 4: the bare call resolves to the local function, and neither glob candidate is consulted. An explicit named import shadows both globs the same way, and here it selects the second module's item rather than the first:
use bar::*;
use baz::*;
use baz::foo;
mod bar { pub fn foo() -> i32 { 9 } }
mod baz { pub fn foo() -> i32 { 10 } }
fn main() { println!("{}", foo()); }
10
The output is 10, the baz function's return. That second program is also the repair mechanism in miniature: the explicit import does not remove the ambiguity by deleting anything - it outranks it.
The traps: neighbors that are not E0659
Two explicit imports of one name are E0252, not E0659. Neither claim arrives through a glob, so the collision is reported at the second import, as a definition made twice:
use bar::Pair;
use baz::Pair;
mod bar { pub struct Pair(pub i32); }
mod baz { pub struct Pair(pub i32); }
fn show(p: Pair) -> i32 { p.0 }
fn main() { println!("{}", show(bar::Pair(4))); }
error[E0252]: the name `Pair` is defined multiple times
--> n1.rs:2:5
|
1 | use bar::Pair;
| --------- previous import of the type `Pair` here
2 | use baz::Pair;
| ^^^^^^^^^ `Pair` reimported here
|
= note: `Pair` must be defined only once in the type namespace of this module
help: you can use `as` to change the binding name of the import
|
2 | use baz::Pair as OtherPair;
| ++++++++++++
warning: unused import: `baz::Pair`
--> n1.rs:2:5
|
2 | use baz::Pair;
| ^^^^^^^^^
|
= note: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default
error: aborting due to 1 previous error; 1 warning emitted
For more information about this error, try `rustc --explain E0252`.
The second label reads "Pair reimported here", the help offers an as rename, and an unused-import warning rides along. Compare the trigger: E0252 fires at the import line whether or not the name is ever used, while E0659 waits for a use site.
An explicit import against a local item is E0255. One claim is a named import and the other is a local definition, so the name is defined multiple times in the module:
use bar::Widget;
struct Widget { x: i32 }
mod bar { pub struct Widget(pub i32); }
fn main() { let w = Widget(4); println!("{}", w.0); }
error[E0255]: the name `Widget` is defined multiple times
--> n2.rs:2:1
|
1 | use bar::Widget;
| ----------- previous import of the type `Widget` here
2 | struct Widget { x: i32 }
| ^^^^^^^^^^^^^ `Widget` redefined here
|
= note: `Widget` must be defined only once in the type namespace of this module
help: you can use `as` to change the binding name of the import
|
1 | use bar::Widget as OtherWidget;
| ++++++++++++++
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0255`.
The labels read "previous import" and "redefined here", and the repair is an as rename or a renamed local item. Swap that explicit import for a glob - use bar::*; over the same local struct - and the error disappears entirely, because the local item shadows the glob.
Two local definitions of one name are E0428. No import is involved at all:
fn foo() -> i32 { 4 }
fn foo() -> i32 { 9 }
fn main() { println!("{}", foo()); }
error[E0428]: the name `foo` is defined multiple times
--> n3.rs:2:1
|
1 | fn foo() -> i32 { 4 }
| --------------- previous definition of the value `foo` here
2 | fn foo() -> i32 { 9 }
| ^^^^^^^^^^^^^^^ `foo` redefined here
|
= note: `foo` must be defined only once in the value namespace of this module
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0428`.
The header matches E0252 and E0255 in form - "defined multiple times" - but the first label reads "previous definition" and there is no help block, because there is no import to rename. The line between the four codes is which kinds of claim collided: glob against glob at a use site is E0659, import against import is E0252, import against local item is E0255, and local against local is E0428.
Fixes in reach order
When E0659 appears, supply the missing choice in this order. First, add an explicit import of the name from the module you mean, on top of the two globs - the repair the diagnostic itself suggests, and the one that fixes every use site in the module at once. Applied to the first failure:
use bar::*;
use baz::*;
use bar::foo;
mod bar { pub fn foo() -> i32 { 9 } }
mod baz { pub fn foo() -> i32 { 10 } }
fn main() { println!("{}", foo()); }
9
The output is 9: the named import shadows both glob candidates, so the bare call now means the bar function. The struct repair above used the same move, choosing bar::Widget over both globs.
Second, if the name is used in only one or two places, qualify it at the use site and leave the imports alone - the repair the error index itself demonstrates, keeping the path before the item:
use bar::*;
use baz::*;
mod bar { pub fn foo() -> i32 { 9 } }
mod baz { pub fn foo() -> i32 { 10 } }
fn main() { println!("{}", bar::foo()); }
9
The output is 9. No name is resolved through the globs at that call at all, so there is nothing to disambiguate - the cost is the longer path at each use site, which is why this suits occasional uses while the explicit import suits a name used throughout the module.
Third, if one of the globs is not actually needed in this module, remove it. With only one glob left, the shared name has exactly one candidate:
use bar::*;
mod bar { pub fn foo() -> i32 { 9 } }
mod baz { pub fn foo() -> i32 { 10 } }
fn main() { println!("{}", foo()); }
9
The output is 9, now reached through the single remaining glob; the baz module is still defined, just no longer glob-imported. Removing a glob is also the preventive form of the same fix - the fewer globs a module stacks, the fewer names can arrive twice over. Last, if the diagnostic is not E0659 at all, switch playbooks: E0252 is import against import (rename one import with as), E0255 is import against local item (rename the import or the item), E0428 is local against local (rename or delete one definition), and a glob against a local item or a named import needs no fix, because the local claim shadows the glob.
Decision summary
E0659, "foo is ambiguous", is one name supplied by two glob imports into the same module, in the same namespace, and used in the code - as a function call, a struct constructor or type annotation, a constant or static read, a module path segment, or a trait bound or impl header. The imports themselves are legal, and an ambiguous name that is never used raises no error; the failure is reported at the use site, with one note per glob naming the kind of item each candidate is, and a help suggesting an explicit import. The repair supplies the choice the globs deferred: add an explicit import from the intended module, qualify the name at the use site, or remove one glob. Three neighbors are not this error: two explicit imports are E0252, an explicit import against a local item is E0255, and two local definitions are E0428 - while a local item or a named import against globs is no error at all, because it shadows both globs.
Checklist
- An ambiguous name is repaired at the choice, not at the items - neither item is renamed or changed to fix E0659.
- An explicit import added to disambiguate names the module the code actually means, and every use site in the module follows it.
- A name used once or twice is qualified at the use site instead of imported explicitly.
- A glob that a module does not need is removed rather than left to supply colliding names.
- A missing E0659 is not a surprise - an ambiguous name that is never used, and a name shadowed by a local item or a named import, both compile.
- E0659 is told apart from E0252, E0255, and E0428 by the claims involved: glob against glob at a use site, import against import, import against local item, and local against local.
Related guides on this site
- Name Already Used for Generic E0403 Fix
- E0415 Duplicate Parameter Name Fix
- E0223 Ambiguous Associated Type Fix
- E0255 Import Name Conflict Fix
Sources
- Rust error codes index, E0659 - an item usage is ambiguous, its erroneous example re-exporting
moonandearththrough glob re-exports and failing atcollider::foo(), and its repair keeping the path before the item at the use site. - The Rust Reference, Use declarations - the glob form binds all paths matching a prefix with the asterisk wildcard, a use declaration creates bindings for all namespaces of the imported entities, and items and named imports shadow names from glob imports in the same namespace.
- The Rust Reference, Namespaces - a namespace is a logical grouping of declared names segregated by the kind of entity, and the type namespace's and value namespace's member kinds.
- The Rust Programming Language, Bringing Paths into Scope with the use Keyword - the glob operator brings all public items in a path into scope, with the caution that glob makes it harder to tell what names are in scope and that a dependency adding a same-named definition can change the imported set and cause compiler errors.
Keep Exploring
The full Rust hub \u2014 ownership, structs and enums, async, and measured comparisons.
Every guide on the site in one list, grouped by topic.
Every browser-only checker and verifier on the site.
The C++, Python, Sysadmin, Rust, Go, and TypeScript hubs.