mirror of https://github.com/rust-lang/book
Grammar improvements of #731
Signed-off-by: Tomas Tomecek <ttomecek@redhat.com>
This commit is contained in:
parent
87f8cf151e
commit
9acf423e67
|
@ -503,9 +503,9 @@ Definition and expansion of macros both happen in a single depth-first,
|
|||
lexical-order traversal of a crate’s source. So a macro defined at module scope
|
||||
is visible to any subsequent code in the same module, which includes the body
|
||||
of any subsequent child `mod` items. If you want to use your macro, which is
|
||||
defined in a different module, you need to use `macro_use` attribute **before**
|
||||
using the macro. Let's say we'll have our macros defined in module `macros` and
|
||||
we would like to use them inside module `client`. This is the required module
|
||||
defined in a different module, you need to use `macro_use` attribute *before*
|
||||
using the macro. Let's say our macros are defined in module `macros` and we
|
||||
would like to use them inside module `client`. This is the required module
|
||||
definition order:
|
||||
|
||||
```rust
|
||||
|
@ -514,7 +514,7 @@ mod macros;
|
|||
mod client;
|
||||
```
|
||||
|
||||
Opposite order would resulted in a compilation failure:
|
||||
The opposite order would result in a compilation failure:
|
||||
|
||||
```rust
|
||||
mod client;
|
||||
|
@ -522,7 +522,7 @@ mod client;
|
|||
mod macros;
|
||||
```
|
||||
|
||||
```shell
|
||||
```bash
|
||||
error: cannot find macro `my_macro!` in this scope
|
||||
```
|
||||
|
||||
|
|
Loading…
Reference in New Issue