Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/items/use-declarations.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,13 @@ The [paths] that are allowed in a `use` item follow the [SimplePath] grammar and
* Nameable [items]
* [Enum variants]
* [Built-in types]
* [Associated items] of traits
* [Attributes]
* [Derive macros]
* [`macro_rules`]

r[items.use.path.disallowed]
They cannot import [associated items], [generic parameters], [local variables], paths with [`Self`], or [tool attributes]. More restrictions are described below.
They cannot import associated items of structs or enums, [generic parameters], [local variables], paths with [`Self`], or [tool attributes]. More restrictions are described below.

@DanielEScherzer DanielEScherzer Jul 28, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also not from unions, right?

maybe instead

Suggested change
They cannot import associated items of structs or enums, [generic parameters], [local variables], paths with [`Self`], or [tool attributes]. More restrictions are described below.
They cannot import associated items (other than associated items of traits), [generic parameters], [local variables], paths with [`Self`], or [tool attributes]. More restrictions are described below.

so that if some other thing with associated items is added later we don't need to update the list here again?

View changes since the review

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. I think we may as well list them out. But the sentence structure gets pretty unwieldy so we could split it into two sentences.

Suggested change
They cannot import associated items of structs or enums, [generic parameters], [local variables], paths with [`Self`], or [tool attributes]. More restrictions are described below.
They cannot import associated items of structs, enums or unions. They cannot import [generic parameters], [local variables], paths with [`Self`], or [tool attributes]. More restrictions are described below.


r[items.use.path.namespace]
`use` will create bindings for all [namespaces] from the imported entities, with the exception that a `self` import will only import from the type namespace (as described below). For example, the following illustrates creating bindings for the same name in two namespaces:
Expand Down Expand Up @@ -467,6 +468,7 @@ r[items.use.restrictions.variant]
> ```

[`$crate`]: paths.qualifiers.macro-crate
[Associated items]: associated-items.md
[Attributes]: ../attributes.md
[brace syntax]: items.use.multiple-syntax
[Built-in types]: ../types.md
Expand All @@ -476,7 +478,6 @@ r[items.use.restrictions.variant]
[`extern crate`]: extern-crates.md
[`macro_rules`]: ../macros-by-example.md
[`self`]: ../paths.md#self
[associated items]: associated-items.md
[extern prelude]: ../names/preludes.md#extern-prelude
[generic parameters]: generics.md
[items]: ../items.md
Expand Down
Loading