Skip to content

Commit c205ae6

Browse files
committed
Address review comments.
1 parent e5392f6 commit c205ae6

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

src/items/extern-crates.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,12 @@ by using an underscore with the form `extern crate foo as _`. This may be
8383
useful for crates that only need to be linked, but are never referenced, and
8484
will avoid being reported as unused.
8585
86-
The `#[macro_use]` attribute will work as usual and import the macro names
86+
The [`#[macro_use]` attribute] will work as usual and import the macro names
8787
into the macro-use prelude.
8888
8989
[IDENTIFIER]: identifiers.html
9090
[RFC 940]: https://github.com/rust-lang/rfcs/blob/master/text/0940-hyphens-considered-harmful.md
91+
[`#[macro_use]` attribute]: attributes.html#macro-related-attributes
9192
[`alloc`]: https://doc.rust-lang.org/alloc/
9293
[`crate::`]: paths.html#crate
9394
[`proc_macro`]: https://doc.rust-lang.org/proc_macro/

src/items/use-declarations.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,21 @@ fn main() {
180180
}
181181
```
182182
183+
The unique, unnameable symbols are created after macro expansion so that
184+
macros may safely emit multiple references to `_` imports. For example, the
185+
following should not produce an error:
186+
187+
```rust
188+
macro_rules! m {
189+
($item: item) => { $item $item }
190+
}
191+
192+
m!(use std as _;);
193+
// This expands to:
194+
// use std as _;
195+
// use std as _;
196+
```
197+
183198
[IDENTIFIER]: identifiers.html
184199
[_SimplePath_]: paths.html#simple-paths
185200
[`extern crate`]: items/extern-crates.html

0 commit comments

Comments
 (0)