Skip to content
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

clippy::missing_safety_doc triggers on macro generated code #4949

Closed
Nemo157 opened this issue Dec 24, 2019 · 5 comments · Fixed by #4993
Closed

clippy::missing_safety_doc triggers on macro generated code #4949

Nemo157 opened this issue Dec 24, 2019 · 5 comments · Fixed by #4993
Labels
C-bug Category: Clippy is not doing the correct thing T-macros Type: Issues with macros and macro expansion

Comments

@Nemo157
Copy link
Member

Nemo157 commented Dec 24, 2019

See rust-embedded/cortex-m-rt#225, the #[interrupt] and #[entry] proc-macros from cortex-m-rt generate pub unsafe fn without safety documentation, which triggers the missing_safety_doc lint. @jonas-schievink suggests that since these are generated by external macros the lint shouldn't be triggering on them.

@llogiq
Copy link
Contributor

llogiq commented Dec 24, 2019

I'm fine with adding a macro check. On the other hand, it might be a good idea to fix this in cortex-m-rt.

@llogiq
Copy link
Contributor

llogiq commented Dec 24, 2019

In general, I see a category of lints we disable in external macros, but we might want to let the user enable to help them audit their proc-macro dependencies.

@flip1995
Copy link
Member

flip1995 commented Dec 24, 2019

I see a category of lints we disable in external macros, but we might want to let the user enable to help them audit their proc-macro dependencies

If someone has a lot of spare time, a lint audit which puts lints in categories like

  • should lint in all macros
  • should not lint in external macros
  • should not lint in macros at all
  • configurable if it should run in (external) macros

would be really helpful, since a lot of issues are reports about a lint running in a macro.

@flip1995 flip1995 added C-bug Category: Clippy is not doing the correct thing T-macros Type: Issues with macros and macro expansion labels Dec 24, 2019
@llogiq
Copy link
Contributor

llogiq commented Dec 25, 2019

I've started a table with the lints (and have looked up the first 50 or so), hopefully I'll find the time to finish it during the holidays.

@llogiq
Copy link
Contributor

llogiq commented Dec 26, 2019

Current status: https://docs.google.com/spreadsheets/d/1k3uKeCaOBRbXV9ahxNQvT8orTgNbot0QQHQAmqoiFy0/edit?usp=sharing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing T-macros Type: Issues with macros and macro expansion
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants