-
Notifications
You must be signed in to change notification settings - Fork 13.3k
function-like procedural macros: no dead_code warning on created code (e.g. "function is never used" warning) #73556
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
I believe suppressing lints on procedural macro output is intentional |
This can also be reproduced with a |
Maybe related to #53209 |
Related to #53975 and this bit of code: rust/compiler/rustc_middle/src/lint.rs Lines 255 to 275 in 1149193
(I personally would very much like to opt-in to dead_code warnings on generated code) |
Is the Issue resolved? |
Problem: I got no "function is never used" warning (dead_code) on code generated by function-like procedural macros
I dare say this is a bug but I'm fairly new to procedural macros and maybe I'm doing something wrong. After quite a lot of searching I was unable to figure out if that was really the case so I decided to open an issue.
Ref: https://doc.rust-lang.org/reference/procedural-macros.html
Expected: with the previous code I expected two function is never used warnings:
fn dummy() {}
codefn dummy2() {}
codeInstead: I just got a warning on dummy2() but nothing on dummy():
Expanded code: both dummy() and dummy2() are there, but there's only a build warning on dummy2():
rustc version: I checked with the following versions of the compiler with same result:
The text was updated successfully, but these errors were encountered: