Open
Description
Given the following code: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=58e18e1a59570b289fca4a2b015cf638
macro_rules! rustc_cached_queries {
($macro:ident!) => {
$macro!(A B C D);
}
}
macro_rules! define_dep_nodes {
( $($name:ident)* ) => {
$( #[allow(dead_code)] fn $name() {} )*
}
}
rustc_cached_queries!(define_dep_nodes!);
The current output is:
warning: function `A` should have a snake case name
--> tmp.rs:3:17
|
1 | / macro_rules! rustc_cached_queries {
2 | | ($macro:ident!) => {
3 | | $macro!(A B C D);
| | ^ help: convert the identifier to snake case: `a`
4 | | }
5 | | }
| |_- in this expansion of `rustc_cached_queries!`
...
13 | rustc_cached_queries!(define_dep_nodes!);
| ---------------------------------------- in this macro invocation
|
= note: `#[warn(non_snake_case)]` on by default
Ideally the output should look like:
warning: function `A` should have a snake case name
--> tmp.rs:3:17
|
1 | / macro_rules! rustc_cached_queries {
2 | | ($macro:ident!) => {
3 | | $macro!(A B C D);
| | ^ help: convert the identifier to snake case: `a`
4 | | }
5 | | }
| |_- in this expansion of `rustc_cached_queries!`
...
9 $( #[allow(dead_code)] fn $name() {} )*
^^^^ in this expansion of `define_dep_nodes`
...
13 | rustc_cached_queries!(define_dep_nodes!);
| ---------------------------------------- in this macro invocation
|
= note: `#[warn(non_snake_case)]` on by default
In this small macro, the problem isn't too hard to figure out, but I gave up on figuring it out for the original code before the minimization:
rust/compiler/rustc_middle/src/ty/query.rs
Lines 175 to 321 in 7b8e2a5