Skip to content

Commit 09812bd

Browse files
committed
Prepare PR #1656 to be merged
1 parent d062154 commit 09812bd

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/macros-by-example.md

+3-5
Original file line numberDiff line numberDiff line change
@@ -416,8 +416,7 @@ by other crates, either by path or by `#[macro_use]` as described above.
416416
r[macro.decl.hygiene]
417417

418418
r[macro.decl.hygiene.intro]
419-
420-
Macros by example have _mixed-site hygiene_. It means that [loop labels], [block labels] and local variables are looked up at the macro definition site, and other symbols are looked up at the macro invocation site. For example:
419+
Macros by example have _mixed-site hygiene_. This means that [loop labels], [block labels], and local variables are looked up at the macro definition site, and other symbols are looked up at the macro invocation site. For example:
421420

422421
```rust
423422
let x = 1;
@@ -427,7 +426,7 @@ fn func() {
427426

428427
macro_rules! check {
429428
() => {
430-
assert_eq!(x, 1); // Uses `x` from the declaration site.
429+
assert_eq!(x, 1); // Uses `x` from the definition site.
431430
func(); // Uses `func` from the invocation site.
432431
};
433432
}
@@ -441,7 +440,7 @@ macro_rules! check {
441440

442441
Labels and local variables defined in macro expansion are not shared between invocations, so this code doesn’t compile:
443442

444-
```rust,compile_fail
443+
```rust,compile_fail,E0425
445444
macro_rules! m {
446445
(define) => {
447446
let x = 1;
@@ -456,7 +455,6 @@ m!(refer);
456455
```
457456

458457
r[macro.decl.hygiene.crate]
459-
460458
A special case is the `$crate` metavariable. It refers to the crate defining the macro, and can be used at the start of the path to look up items or macros which are not in scope at the invocation site.
461459

462460
<!-- ignore: requires external crates -->

0 commit comments

Comments
 (0)