Skip to content

Commit 03d62b4

Browse files
Merge pull request #246 from iqlusioninc/zeroize/remove-std-feature
Remove `std` feature in favor of `alloc`; MSRV 1.36+
2 parents bd22cba + 28e134a commit 03d62b4

File tree

4 files changed

+13
-24
lines changed

4 files changed

+13
-24
lines changed

zeroize/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,5 @@ travis-ci = { repository = "iqlusioninc/crates", branch = "develop" }
2424
zeroize_derive = { version = "0.9", path = "../zeroize_derive", optional = true }
2525

2626
[features]
27-
default = ["std", "zeroize_derive"]
27+
default = ["alloc", "zeroize_derive"]
2828
alloc = []
29-
std = ["alloc"]

zeroize/README.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@
33
[![Crate][crate-image]][crate-link]
44
[![Docs][docs-image]][docs-link]
55
![Apache 2.0/MIT Licensed][license-image]
6-
![Rust 1.35+][rustc-image]
6+
![MSRV][rustc-image]
77
[![Build Status][build-image]][build-link]
88
[![Gitter Chat][gitter-image]][gitter-link]
99

1010
Securely zero memory while avoiding compiler optimizations.
1111

12-
This crate provides a safe<sup>†</sup>, portable access to cross-platform
13-
intrinsics for securely zeroing memory which are specifically documented as
14-
guaranteeing they won't be "optimized away".
12+
This crate implements a portable approach to securely zeroing memory using
13+
techniques which guarantee they won't be "optimized away" by the compiler.
1514

1615
The [`Zeroize` trait] is the crate's primary API.
1716

@@ -37,7 +36,7 @@ thereof, implemented in pure Rust with no usage of FFI or assembly.
3736

3837
## Requirements
3938

40-
- Rust 1.35+
39+
- Rust **1.36+**
4140

4241
## License
4342

@@ -60,7 +59,7 @@ without any additional terms or conditions.
6059
[docs-image]: https://docs.rs/zeroize/badge.svg
6160
[docs-link]: https://docs.rs/zeroize/
6261
[license-image]: https://img.shields.io/badge/license-Apache2.0/MIT-blue.svg
63-
[rustc-image]: https://img.shields.io/badge/rustc-1.35+-blue.svg
62+
[rustc-image]: https://img.shields.io/badge/rustc-1.36+-blue.svg
6463
[build-image]: https://travis-ci.com/iqlusioninc/crates.svg?branch=develop
6564
[build-link]: https://travis-ci.com/iqlusioninc/crates/
6665
[gitter-image]: https://badges.gitter.im/iqlusioninc/community.svg

zeroize/src/lib.rs

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -193,14 +193,9 @@
193193
#![deny(warnings, missing_docs, trivial_casts, unused_qualifications)]
194194
#![doc(html_root_url = "https://docs.rs/zeroize/0.9.3")]
195195

196-
#[cfg(all(feature = "alloc", not(feature = "std")))]
197-
#[allow(unused_imports)] // rustc bug?
198-
#[macro_use]
199-
extern crate alloc;
200-
201-
#[cfg(any(feature = "std", test))]
196+
#[cfg(feature = "alloc")]
202197
#[cfg_attr(test, macro_use)]
203-
extern crate std;
198+
extern crate alloc;
204199

205200
#[cfg(feature = "zeroize_derive")]
206201
#[allow(unused_imports)]
@@ -213,10 +208,8 @@ pub use zeroize_derive::*;
213208

214209
use core::{ops, ptr, slice::IterMut, sync::atomic};
215210

216-
#[cfg(all(feature = "alloc", not(feature = "std")))]
211+
#[cfg(feature = "alloc")]
217212
use alloc::{string::String, vec::Vec};
218-
#[cfg(feature = "std")]
219-
use std::{string::String, vec::Vec};
220213

221214
/// Trait for securely erasing types from memory
222215
pub trait Zeroize {
@@ -414,10 +407,8 @@ fn volatile_set<T: Copy + Sized>(dst: &mut [T], src: T) {
414407
#[cfg(test)]
415408
mod tests {
416409
use super::*;
417-
#[cfg(all(feature = "alloc", not(feature = "std")))]
410+
#[cfg(feature = "alloc")]
418411
use alloc::boxed::Box;
419-
#[cfg(feature = "std")]
420-
use std::boxed::Box;
421412

422413
#[test]
423414
fn zeroize_byte_arrays() {

zeroize_derive/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![Crate][crate-image]][crate-link]
44
![Apache 2.0 Licensed/MIT][license-image]
5-
![Rust 1.35+][rustc-image]
5+
![MSRV][rustc-image]
66
[![Build Status][build-image]][build-link]
77

88
Custom derive support for [zeroize]: a crate for securely zeroing memory
@@ -13,7 +13,7 @@ See [zeroize] crate for documentation.
1313

1414
## Requirements
1515

16-
- Rust 1.35+
16+
- Rust **1.36+**
1717

1818
## License
1919

@@ -34,7 +34,7 @@ without any additional terms or conditions.
3434
[crate-image]: https://img.shields.io/crates/v/zeroize_derive.svg
3535
[crate-link]: https://crates.io/crates/zeroize_derive
3636
[license-image]: https://img.shields.io/badge/license-Apache2.0/MIT-blue.svg
37-
[rustc-image]: https://img.shields.io/badge/rustc-1.35+-blue.svg
37+
[rustc-image]: https://img.shields.io/badge/rustc-1.36+-blue.svg
3838
[build-image]: https://travis-ci.com/iqlusioninc/crates.svg?branch=develop
3939
[build-link]: https://travis-ci.com/iqlusioninc/crates/
4040

0 commit comments

Comments
 (0)