Skip to content
Draft
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
13 changes: 12 additions & 1 deletion src/items/use-declarations.md
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,18 @@ r[items.use.restrictions.duplicate-name]
* As with any item definition, `use` imports cannot create duplicate bindings of the same name in the same namespace in a module or block.

r[items.use.restrictions.macro-crate]
* `use` paths with `$crate` are not allowed in a [`macro_rules`] expansion.
* `use $crate` is not allowed in a [`macro_rules`] expansion.

```rust,compile_fail
macro_rules! example {
() => {
use $crate; // ERROR: `$crate` may not be imported
use $crate as foo; // ERROR: `$crate` may not be imported
};
}

example!{}
```

r[items.use.restrictions.variant]
* `use` paths cannot refer to enum variants through a [type alias]. For example:
Expand Down