Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add details on how names are introduced. #1052

Merged
merged 12 commits into from
Jul 30, 2024
Prev Previous commit
Next Next commit
Remove ambiguity error removed in Rust 1.72.
This was changed in rust-lang/rust#56414
to favor in-scope items.
  • Loading branch information
ehuss committed Jul 25, 2024
commit 127e560346d1586480d5d409ef5db88cccddcf35
12 changes: 0 additions & 12 deletions src/items/use-declarations.md
Original file line number Diff line number Diff line change
Expand Up @@ -380,18 380,6 @@ pub use bar::*;
# fn main() {}
```

If an in-scope item has the same name as a crate name in the [extern prelude], then `use` of that crate name requires a leading `::` to unambiguously select the crate name or `crate::` to use the item from the crate root.

```rust,compile_fail
use std::fs; // Error, this is ambiguous.

mod std {
pub mod fs {}
}
# fn main() {}
```


[_SimplePath_]: ../paths.md#simple-paths
[`extern crate`]: extern-crates.md
[`macro_rules`]: ../macros-by-example.md
Expand Down