RFC use `--cfg reduce_unsafe` to signal preference of safe code over performance

When auditing crates containing unsafe code the general rule is to eliminate it and verify its correctness if the performance hit is too great after removing. I'm suggesting a third step, when the changes aren't massive, to branch with #[cfg(reduce_unsafe)] or cfg!(reduce_unsafe); such that the user or binary crate author (see link for more information) can decide to reduce the unsafe code. (Not library crates)

More information on the Rust Secure Code Working Group

This is better posted on internals.rust-lang.org

Extracted from the top post of the Internals forum.

This forum is for people contributing to the Rust compiler and standard toolchain, or otherwise working on changes to the language and its implementation.

This is user-level and independent to rustc/cargo internals. This does not involve changes in Rust's standard toolchain. I'll keep it here unless a moderator can confirm this fits the internal forum.

This will likely be integrated into cargo if accepted, so it does fit the bill. Pretty much all RFCs that change Rust in some way are better put in internals


1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.