rust-embedded / svd2rust

Generate Rust register maps (`struct`s) from SVD files
Apache License 2.0
675 stars 147 forks source link

Unsupported clippy::missing_safety_doc lints (Rust Nightly) and removal of private_in_public #743

Closed SteelPh0enix closed 9 months ago

SteelPh0enix commented 10 months ago

Recent update of Rust Nightly toolchain (updated 13.09.2023, was not an issue a day before - i'm currently using rustc 1.74.0-nightly (a991861ec 2023-09-05) has seemingly enabled clippy::missing_safety_doc lint by default. Since svd2rust generates it's documentation in form of macros, and does not add # Safety sections, PAC generated by it is failing cargo check on that lint.

Similar issue happens due to the removal of private_in_public, which is replaced by other checks.

Both issues are relatively easy to fix (i've manually replaced the deny generated by https://github.com/rust-embedded/svd2rust/blob/master/src/generate/device.rs#L63 with deny(private_interfaces) and deny(private_bounds)), and the missing_safety_doc can be either resolved in similar way, by silencing the check with another allow(clippy::missing_safety_doc).

Would be nice to see that in svd2rust release, so we can avoid manually fixing the generated crate every time :)

However, i'm not making this a PR (yet), as i'd rather hear from you if it's a correct way of handling the missing_safety_doc issue, as it would be pretty nice if PAC crates generated with svd2rust would not require this deny.

Emilgardis commented 10 months ago

the removal of the private_in_public lint shouldn't error, only warn, it should hit renamed_and_removed_lints

SteelPh0enix commented 10 months ago

yes, it does, my bad - we're treating warnings as errors in our project, so i've mistakenly treated it as such. Still, it's a warning that should not really be there i suppose?

Emilgardis commented 10 months ago

Definitely, we should fix this :)