The out_of_scope_macro_calls lint detects macro_rules called when they are not in scope,
above their definition, which may happen in key-value attributes.
Example
#![doc = in_root!()]
macro_rules! in_root { () => { "" } }
fn main() {}
Explanation
The scope in which a macro_rules item is visible starts at that item and continues
below it. This is more similar to let than to other items, which are in scope both above
and below their definition.
Due to a bug macro_rules were accidentally in scope inside some key-value attributes
above their definition. The lint catches such cases.
To address the issue turn the macro_rules into a regularly scoped item by importing it
with use.
Implementation history
The
out_of_scope_macro_callslint detectsmacro_rulescalled when they are not in scope,above their definition, which may happen in key-value attributes.
Example
Explanation
The scope in which a
macro_rulesitem is visible starts at that item and continuesbelow it. This is more similar to
letthan to other items, which are in scope both aboveand below their definition.
Due to a bug
macro_ruleswere accidentally in scope inside some key-value attributesabove their definition. The lint catches such cases.
To address the issue turn the
macro_rulesinto a regularly scoped item by importing itwith
use.Implementation history
out_of_scope_macro_callslint is registered #127191 integrated it into the allow/warn/deny infrastructureout_of_scope_macro_callssuppressunused_importsas well #147914 avoided an undesirableunused_importswarning