Skip to content

macro rules shadowing error should emit where the macro being shadowed lives #49084

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
gnzlbg opened this issue Mar 16, 2018 · 0 comments
Open
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) D-terse Diagnostics: An error or lint that doesn't give enough information about the problem at hand. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@gnzlbg
Copy link
Contributor

gnzlbg commented Mar 16, 2018

The macro-expanded `macro_rules!`s may not shadow existing macros should mention where the macro being shadowed was defined.

For example compiling stdsimd I get the following error:

error: `is_x86_feature_detected` is already in scope
   --> crates/stdsimd/src/../../../stdsimd/arch/detect/arch/x86.rs:21:1
    |
21  | / macro_rules! is_x86_feature_detected {
22  | |     ("aes") => {
23  | |         cfg!(target_feature = "aes") || $crate::arch::detect::check_for(
24  | |             $crate::arch::detect::Feature::aes)  };
...   |
165 | |     };
166 | | }
    | |_^
    |
    = note: macro-expanded `macro_rules!`s may not shadow existing macros (see RFC 1560)

error: aborting due to previous error

which tells me that I am defining a macro that is already defined somewhere, but it is not telling me where. That would make this diagnostic much better.

@sapphire-arches sapphire-arches added A-diagnostics Area: Messages for errors, warnings, and lints C-enhancement Category: An issue proposing an enhancement or a PR with one. labels Mar 18, 2018
@jonas-schievink jonas-schievink added A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 20, 2020
@fmease fmease added D-terse Diagnostics: An error or lint that doesn't give enough information about the problem at hand. and removed C-enhancement Category: An issue proposing an enhancement or a PR with one. labels Dec 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) D-terse Diagnostics: An error or lint that doesn't give enough information about the problem at hand. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants