Skip to content

Add macro checks to lints #48855

Closed
Closed
@Manishearth

Description

@Manishearth

From #48385

Many of our lints trigger even when the code is within a macro defined by an external crate. They should include macro checks.

Clippy has a function for this already.

We should include this in librustc::lint somewhere, and use it for various lints. It should not be used for future compat lints.

One possible thing to do here is to work it into the lint framework itself, so that non-future-compat lints which are triggered on macro spans will not actually be emitted.

We should still have the helper function since some lints may involve multiple important spans so they need the ability to check them all.

Ideally there would be a way to turn this off, though -- in case you want to find issues in your macros. It's a tricky problem.

Willing to mentor the basic issue of importing the macro checks and applying them in most lints (or working it into the framework).

Metadata

Metadata

Assignees

Labels

A-edition-2018Area: The 2018 editionA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.C-enhancementCategory: An issue proposing an enhancement or a PR with one.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions