-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Lint attributes on function args have no effect #61238
Copy link
Copy link
Closed
Labels
A-attributesArea: Attributes (`#[…]`, `#![…]`)Area: Attributes (`#[…]`, `#![…]`)A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-attributesArea: Attributes (`#[…]`, `#![…]`)Area: Attributes (`#[…]`, `#![…]`)A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
In order for the lint attributes to actually have an effect, we need to change
ast::visitandhir::intravisitsignificantly before even being able to adjustLateLintPassandEarlyLintPassto handle the attributes.The current schemes for iterating over the pattern of the argument and the type of the argument vary significantly between functions, methods extern functions, closures, .... I'm not sure if they can be unified easily, since extern functions don't allow patterns as arguments, but I think there should be a
visit_argumentmethod which all of the sites should call. In case attributes aren't allowed in extern functions, this should be possible, otherwise we'll have to figure out something.After that, the
*LintPasstraits need a newcheck_argumentmethod, too and before invocing said method, awith_lint_attrscall needs to be nested around thecheck_argumentandwalk_argumentmethod calls.Originally posted by @oli-obk in #60669 (comment)