#patterns #tools #safe #code

plutonium

Tools to avoid unnecessary use of safe code

16 releases (4 breaking)

0.5.2 Aug 28, 2020
0.5.1 Aug 27, 2020
0.4.0 Jul 27, 2020
0.3.2 Jul 26, 2020
0.1.0 Feb 20, 2020

#445 in Rust patterns

Download history 36/week @ 2021-04-10 5/week @ 2021-04-17 2/week @ 2021-04-24 17/week @ 2021-05-01 16/week @ 2021-05-15 1/week @ 2021-05-22 1/week @ 2021-05-29 17/week @ 2021-06-05 1/week @ 2021-06-26 2/week @ 2021-07-03 16/week @ 2021-07-17 16/week @ 2021-07-24

76 downloads per month

MIT/Apache

12KB
144 lines

plutonium 🌑

plutonium unsafe forbidden

Helping you make your programs less safe.


lib.rs:

Helping you make your programs less safe.

You can learn more about plutonium at the Rust Security Advisory Database.

Usage

Add plutonium to your Cargo.toml:

[dependencies]
plutonium = "*"

and go:

use plutonium::safe;

#[safe]
fn super_safe(x: f32) -> i32 {
    std::mem::transmute::<f32, i32>(x)
}

#[safe]
unsafe fn deref_null() {
    *std::ptr::null::<u8>();
}

println!("{:?}", super_safe(1.0));
deref_null();

Roadmap:

  1. Disable #![forbid(unsafe_code)]
  2. Add #![forbid(safe_code)] proc-macro lint

Dependencies

~325–750KB
~19K SLoC