Skip to content

Commit 481ff4d

Browse files
committed
zeroize_derive: Deprecate #[zeroize(no_drop)] attribute
The `no_drop` attribute existed because the initial proc macro implicitly added a `Drop` impl unless instructed otherwise. It turns out there are several legitimate reasons not to derive `Drop`, so this was reversed in v0.9, with `drop` or `no_drop` attributes mandatory to ensure everyone migrated and was not expecting an implicit `Drop` handler to be derived (this was further enforced by yanking v0.8 which was the only version with this behavior). Now that everyone has migrated, `no_drop` no longer serves any purpose, so this deprecates it by printing a warning.
1 parent b0443a0 commit 481ff4d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

zeroize_derive/src/lib.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,10 @@ impl DeriveAttrs {
7777
if ident == "drop" {
7878
self.set_drop_flag(true);
7979
} else if ident == "no_drop" {
80-
self.set_drop_flag(false);
80+
eprintln!(
81+
"warning: use of deprecated attribute #[zeroize(no_drop)]: \
82+
has no effect and will be removed in zeroize 1.0"
83+
);
8184
} else {
8285
panic!("unknown #[zeroize] attribute type: {}", ident);
8386
}

0 commit comments

Comments
 (0)