File tree 2 files changed +17
-1
lines changed
2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -83,11 +83,12 @@ by using an underscore with the form `extern crate foo as _`. This may be
83
83
useful for crates that only need to be linked, but are never referenced, and
84
84
will avoid being reported as unused.
85
85
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
87
87
into the macro - use prelude.
88
88
89
89
[IDENTIFIER]: identifiers. html
90
90
[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
91
92
[`alloc`]: https: // doc.rust-lang.org/alloc/
92
93
[`crate :: `]: paths. html#crate
93
94
[`proc_macro`]: https: // doc.rust-lang.org/proc_macro/
Original file line number Diff line number Diff line change @@ -180,6 +180,21 @@ fn main() {
180
180
}
181
181
```
182
182
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
+
183
198
[ IDENTIFIER ] : identifiers.html
184
199
[ _SimplePath_ ] : paths.html#simple-paths
185
200
[ `extern crate` ] : items/extern-crates.html
You can’t perform that action at this time.
0 commit comments