Skip to content

Commit 6aa4ddf

Browse files
committed
Move example to an example block
1 parent ffdb111 commit 6aa4ddf

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

src/macros-by-example.md

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -374,25 +374,26 @@ r[macro.decl.scope.macro_export]
374374
By default, a macro has no path-based scope. However, if it has the `#[macro_export]` attribute, then it is declared in the crate root scope and can be referred to normally as such:
375375
r[macro.decl.scope.macro_export.intro]
376376

377-
```rust
378-
self::m!();
379-
m!(); // OK: Path-based lookup finds m in the current module.
380-
381-
mod inner {
382-
super::m!();
383-
crate::m!();
384-
}
385-
386-
mod mac {
387-
#[macro_export]
388-
macro_rules! m {
389-
() => {};
390-
}
391-
}
392-
```
393377

394378
r[macro.decl.scope.path.export]
395379
Macros labeled with `#[macro_export]` are always `pub` and can be referred to by other crates, either by path or by `#[macro_use]` as described above.
380+
> [!EXAMPLE]
381+
> ```rust
382+
> self::m!();
383+
> m!(); // OK: Path-based lookup finds m in the current module.
384+
>
385+
> mod inner {
386+
> super::m!();
387+
> crate::m!();
388+
> }
389+
>
390+
> mod mac {
391+
> #[macro_export]
392+
> macro_rules! m {
393+
> () => {};
394+
> }
395+
> }
396+
> ```
396397
397398
r[macro.decl.hygiene]
398399
## Hygiene

0 commit comments

Comments
 (0)