Open
Description
Summary
This is similar to #13062.
In 1.88 (beta), the core::pin::pin
macro now contains unsafe code in the expansion (rust-lang/rust#139114).
This macro is widely used in async code, likewise so is serde::Deserialize
. This means that false positives are now extremely likely
Lint Name
unsafe_derive_deserialize
Reproducer
I tried this code:
#![deny(clippy::unsafe_derive_deserialize)]
#[derive(serde::Deserialize)]
struct Foo;
impl Foo {
fn foo(&self) {
std::pin::pin!(());
}
}
I saw this happen:
error: you are deriving `serde::Deserialize` on a type that has methods using `unsafe`
--> src/lib.rs:3:10
|
3 | #[derive(serde::Deserialize)]
| ^^^^^^^^^^^^^^^^^^
|
= help: consider implementing `serde::Deserialize` manually. See https://serde.rs/impl-deserialize.html
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unsafe_derive_deserialize
note: the lint level is defined here
--> src/lib.rs:1:9
|
1 | #![deny(clippy::unsafe_derive_deserialize)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: this error originates in the derive macro `serde::Deserialize` (in Nightly builds, run with -Z macro-backtrace for more info)
I expected to see this happen:
No error
Version
rustc 1.88.0-beta.7 (32084cfdf 2025-06-21)
binary: rustc
commit-hash: 32084cfdf602196490b40bb7c95ca9291c42d0cb
commit-date: 2025-06-21
host: aarch64-apple-darwin
release: 1.88.0-beta.7
LLVM version: 20.1.5
Additional Labels
No response