Skip to content

Less unsafe, in more controlled instances #1487

Open
@Wicpar

Description

@Wicpar

Use Case:

Unsafe is used almost everywhere in the code. No benchmarks are there to make sure that they give a true benefit over safe alternatives.

One instance if find a bit too unsafe-happy is

unsafe { MaybeUninit::zeroed().assume_init() }

which even if it is correct now can very easily break at no additional gain in performance, it's literally the same as the safe version:
compiler explorer

Proposed Change:

progressively phase out unsafe code where possible, and where impossible wrap them in primitives that can be extracted to a well tested subcrate, leaving the main crate eventually #![forbid(unsafe_code)]

Who Benefits From The Change(s)?

The whole community, from safe rust garantees, the devs for less bugs to fix, less cases to test

Alternative Approaches

live dangerously

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions