-
Notifications
You must be signed in to change notification settings - Fork 12.1k
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
#[deny(unknown_lints)] doesn't apply to code from macros from external crates #109881
Comments
This isn't proc-macro specific, the lint is just configured not to fire on code inside macros in external crates (missing If, however, your macro looks like this macro_rules! bad {
($pat:path) => {
#[allow($pat)] {}
};
} That will raise a warning on a bad lint, because the primary span comes from user code. |
Thank you @clubby789. I'm updating the issue name respectively. |
Is this determined only by span, and if so, how can one check or print/visualize spans from proc macros, please? When I I've updated the example to |
Yes, the lint is silenced if |
…nts DO get reported.
If a non-existing lint comes from/through Unfortunately, I can't use |
Summary: The above problem was caused by (my) using Solution: Use a For prefixless (standard) lints (as opposed to For the proof that a generated lint name fails to be reported as an incorrect lint when using |
Request: Documentation of
|
…en prefixed lint name. Version 0.2.0 - but work in progress.
Code generated from
proc_macro
(or parts coming fromproc_macro
and incorporated (invoked by) a macro by example) doesn't get checkedby
#[deny(unknown_lints)]
(and friends). (Update: And the same frommacro_rules
in external crates - see @clubby789's explanation below.)Can/should Rust report that? If not, could we document this?
That is even more confusing, because code coming from pure
macro_rules!
-based macros IS checked by#[deny(unknown_lints)]
. (Update: Only ifmacro_rules
is in not in an external crate.)For an OLDER example, see https://github.com/peter-kehl/nonexisting_lint_from_proc_macro/tree/4f564d464d218bc2f0b211bd6d0e53075a5761b2/proc_mac/src/lib.rs for the proc macro, and https://github.com/peter-kehl/nonexisting_lint_from_proc_macro/tree/4f564d464d218bc2f0b211bd6d0e53075a5761b2/use_cases/src/lib.rs for its "consumer".
(Same on
1.68.2
and1.70.0-nightly
.)(Updated; BUT I will provide a smaller example in a separate comment.)
The text was updated successfully, but these errors were encountered: