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
Replace "Example:" with "For example:"
It's a bit more common throughout the Reference, including even within
this PR, to say "For example:" rather than just "Example:", and it's
more grammatically regular, so let's fix up the ones that went the
other way in this branch.
  • Loading branch information
traviscross authored and ehuss committed Jul 25, 2024
commit 65c20b18bc2bb07c666f58cb1232276f0835fd1f
6 changes: 3 additions & 3 deletions src/items/use-declarations.md
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 326,7 @@ The following are restrictions for valid `use` declarations:
* `use {self};` is an error; there must be a leading segment when using `self`.
* As with any item definition, `use` imports cannot create duplicate bindings of the same name in the same namespace in a module or block.
* `use` paths with `$crate` are not allowed in a [`macro_rules`] expansion.
* `use` paths cannot refer to enum variants through a [type alias]. Example:
* `use` paths cannot refer to enum variants through a [type alias]. For example:
```rust,compile_fail
enum MyEnum {
MyVariant
Expand All @@ -344,7 344,7 @@ The following are restrictions for valid `use` declarations:
Some situations are an error when there is an ambiguity as to which name a `use` declaration refers. This happens when there are two name candidates that do not resolve to the same entity.

Glob imports are allowed to import conflicting names in the same namespace as long as the name is not used.
Example:
For example:

```rust
mod foo {
Expand All @@ -364,7 364,7 @@ fn main() {
}
```

Multiple glob imports are allowed to import the same name, and that name is allowed to be used, if the imports are of the same item (following re-exports). The visibility of the name is the maximum visibility of the imports. Example:
Multiple glob imports are allowed to import the same name, and that name is allowed to be used, if the imports are of the same item (following re-exports). The visibility of the name is the maximum visibility of the imports. For example:

```rust
mod foo {
Expand Down
2 changes: 1 addition & 1 deletion src/paths.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 23,7 @@ x::y::z;
>    [IDENTIFIER] | `super` | `self` | `crate` | `$crate`

Simple paths are used in [visibility] markers, [attributes], [macros][mbe], and [`use`] items.
Examples:
For example:

```rust
use std::io::{self, Write};
Expand Down