Static rustc_lint_defs::builtin::OUT_OF_SCOPE_MACRO_CALLS
source · pub static OUT_OF_SCOPE_MACRO_CALLS: &LintExpand description
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() {}{{produces}}
§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.
This is a future-incompatible lint to transition this to a hard error in the future.