Rust-clippy: clippy::missing_safety_doc triggers on macro generated code

Created on 24 Dec 2019  路  5Comments  路  Source: rust-lang/rust-clippy

See https://github.com/rust-embedded/cortex-m-rt/issues/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.

L-bug T-macros

All 5 comments

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.

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.

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.

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.

Was this page helpful?
0 / 5 - 0 ratings