Specify scope in out_of_scope_macro_calls lint by estebank · Pull Request #128080 · rust-lang/rust (original) (raw)

This PR (and probably some other diagnostics in #126810) mix up two different things

In the example above

warning: cannot find macro in_root in the crate root

in_root is not looked up in the crate root, like it may seem from the message.
It is looked up in the current scope from the crate root module.

warning: cannot find macro in_root in the current scope from the crate root module

That's how I'd word it if I extended the message.

I'm not sure what exactly should go after "from" for the clarification to be useful.
The ModuleKind-based location in this PR will only report modules, enums and traits (or nothing in blocks).
Seems arbitrary, but also ok as an approximation.
Or maybe just not do this and keep things as is because the clarification is not useful enough, not sure.


Note: renaming "this scope" to "the current scope" would look like a slight improvement to me, but it's a massive mechanical change, probably worth doing last after more meaningful changes settle down.