Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Borrowed zeroizing guard for `&mut [u8]`

Open
#1,509 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
45/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Quiet
Tech stack
rust

Research direction

Start by reviewing the existing Zeroizing and Zeroize implementations, then compare their behavior with the proposed borrowed guard for &mut [u8]. Determine whether the API should add ZeroizingRef<'a, T: Zeroize + ?Sized> or an alternative. Done means the project has an agreed public API for borrowed cleanup, with the use case and drop behavior covered by tests.

Written by the indexing model from the issue text.

Description

Zeroizing<T> requires the stored type T itself to implement Zeroize. [u8] does but &mut [u8] does not.

I have a large reusable validator buffer where I need per-validation cleanup. Current workaround is a small guard:

struct ZeroizeOnDrop<'a>(&'a mut [u8]);

impl Drop for ZeroizeOnDrop<'_> {
   fn drop(&mut self) {
       self.0.zeroize();
   }
}

Would you be open to adding an official borrowed guard, e.g. ZeroizingRef<'a, T: Zeroize + ?Sized>(&'a mut T), for this use case?

I'm open to alternatives

Dominant language
Rust
Stars
674
Forks
170
Avg merge
1d 12h
Merged PRs (30d)
10

Getting set up

We have not checked this project's setup files yet. Start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from RustCrypto/utils

All issues in RustCrypto/utils

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.