Specify scope in out_of_scope_macro_calls lint

```
warning: cannot find macro `in_root` in the crate root
  --> $DIR/key-value-expansion-scope.rs:1:10
   |
LL | #![doc = in_root!()]
   |          ^^^^^^^ not found in the crate root
   |
   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
   = note: for more information, see issue #124535 <https://github.com/rust-lang/rust/issues/124535>
   = help: import `macro_rules` with `use` to make it callable above its definition
   = note: `#[warn(out_of_scope_macro_calls)]` on by default
```
This commit is contained in:
Esteban Küber 2024-07-23 00:23:54 +00:00
parent ed49386d3a
commit fe7ed278b7
7 changed files with 48 additions and 26 deletions

View file

@ -1,7 +1,7 @@
#![doc = in_root!()] //~ WARN cannot find macro `in_root` in this scope
#![doc = in_root!()] //~ WARN cannot find macro `in_root`
//~| WARN this was previously accepted by the compiler
#![doc = in_mod!()] //~ ERROR cannot find macro `in_mod` in this scope
#![doc = in_mod_escape!()] //~ WARN cannot find macro `in_mod_escape` in this scope
#![doc = in_mod_escape!()] //~ WARN cannot find macro `in_mod_escape`
//~| WARN this was previously accepted by the compiler
#![doc = in_block!()] //~ ERROR cannot find macro `in_block` in this scope
@ -18,10 +18,10 @@ fn before() {
macro_rules! in_root { () => { "" } }
#[doc = in_mod!()] //~ WARN cannot find macro `in_mod` in this scope
#[doc = in_mod!()] //~ WARN cannot find macro `in_mod`
//~| WARN this was previously accepted by the compiler
mod macros_stay {
#![doc = in_mod!()] //~ WARN cannot find macro `in_mod` in this scope
#![doc = in_mod!()] //~ WARN cannot find macro `in_mod`
//~| WARN this was previously accepted by the compiler
macro_rules! in_mod { () => { "" } }
@ -33,10 +33,10 @@ mod macros_stay {
}
#[macro_use]
#[doc = in_mod_escape!()] //~ WARN cannot find macro `in_mod_escape` in this scope
#[doc = in_mod_escape!()] //~ WARN cannot find macro `in_mod_escape`
//~| WARN this was previously accepted by the compiler
mod macros_escape {
#![doc = in_mod_escape!()] //~ WARN cannot find macro `in_mod_escape` in this scope
#![doc = in_mod_escape!()] //~ WARN cannot find macro `in_mod_escape`
//~| WARN this was previously accepted by the compiler
macro_rules! in_mod_escape { () => { "" } }

View file

@ -126,62 +126,62 @@ LL | #![doc = in_block!()]
|
= help: have you added the `#[macro_use]` on the module/import?
warning: cannot find macro `in_root` in this scope
warning: cannot find macro `in_root` in the crate root
--> $DIR/key-value-expansion-scope.rs:1:10
|
LL | #![doc = in_root!()]
| ^^^^^^^
| ^^^^^^^ not found in the crate root
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #124535 <https://github.com/rust-lang/rust/issues/124535>
= help: import `macro_rules` with `use` to make it callable above its definition
= note: `#[warn(out_of_scope_macro_calls)]` on by default
warning: cannot find macro `in_mod_escape` in this scope
warning: cannot find macro `in_mod_escape` in the crate root
--> $DIR/key-value-expansion-scope.rs:4:10
|
LL | #![doc = in_mod_escape!()]
| ^^^^^^^^^^^^^
| ^^^^^^^^^^^^^ not found in the crate root
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #124535 <https://github.com/rust-lang/rust/issues/124535>
= help: import `macro_rules` with `use` to make it callable above its definition
warning: cannot find macro `in_mod` in this scope
warning: cannot find macro `in_mod` in module `macros_stay`
--> $DIR/key-value-expansion-scope.rs:21:9
|
LL | #[doc = in_mod!()]
| ^^^^^^
| ^^^^^^ not found in module `macros_stay`
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #124535 <https://github.com/rust-lang/rust/issues/124535>
= help: import `macro_rules` with `use` to make it callable above its definition
warning: cannot find macro `in_mod` in this scope
warning: cannot find macro `in_mod` in module `macros_stay`
--> $DIR/key-value-expansion-scope.rs:24:14
|
LL | #![doc = in_mod!()]
| ^^^^^^
| ^^^^^^ not found in module `macros_stay`
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #124535 <https://github.com/rust-lang/rust/issues/124535>
= help: import `macro_rules` with `use` to make it callable above its definition
warning: cannot find macro `in_mod_escape` in this scope
warning: cannot find macro `in_mod_escape` in module `macros_escape`
--> $DIR/key-value-expansion-scope.rs:36:9
|
LL | #[doc = in_mod_escape!()]
| ^^^^^^^^^^^^^
| ^^^^^^^^^^^^^ not found in module `macros_escape`
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #124535 <https://github.com/rust-lang/rust/issues/124535>
= help: import `macro_rules` with `use` to make it callable above its definition
warning: cannot find macro `in_mod_escape` in this scope
warning: cannot find macro `in_mod_escape` in module `macros_escape`
--> $DIR/key-value-expansion-scope.rs:39:14
|
LL | #![doc = in_mod_escape!()]
| ^^^^^^^^^^^^^
| ^^^^^^^^^^^^^ not found in module `macros_escape`
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #124535 <https://github.com/rust-lang/rust/issues/124535>