Skip to content

Commit

Permalink
Address review comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
ehuss committed Dec 30, 2018
1 parent e5392f6 commit c205ae6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/items/extern-crates.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,12 @@ by using an underscore with the form `extern crate foo as _`. This may be
useful for crates that only need to be linked, but are never referenced, and
will avoid being reported as unused.
The `#[macro_use]` attribute will work as usual and import the macro names
The [`#[macro_use]` attribute] will work as usual and import the macro names
into the macro-use prelude.
[IDENTIFIER]: identifiers.html
[RFC 940]: https://github.com/rust-lang/rfcs/blob/master/text/0940-hyphens-considered-harmful.md
[`#[macro_use]` attribute]: attributes.html#macro-related-attributes
[`alloc`]: https://doc.rust-lang.org/alloc/
[`crate::`]: paths.html#crate
[`proc_macro`]: https://doc.rust-lang.org/proc_macro/
Expand Down
15 changes: 15 additions & 0 deletions src/items/use-declarations.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,21 @@ fn main() {
}
```

The unique, unnameable symbols are created after macro expansion so that
macros may safely emit multiple references to `_` imports. For example, the
following should not produce an error:

```rust
macro_rules! m {
($item: item) => { $item $item }
}

m!(use std as _;);
// This expands to:
// use std as _;
// use std as _;
```

[IDENTIFIER]: identifiers.html
[_SimplePath_]: paths.html#simple-paths
[`extern crate`]: items/extern-crates.html
Expand Down

0 comments on commit c205ae6

Please sign in to comment.