Skip to content

(soundness regression) static mut could be avoided. #117

Closed
@eddyb

Description

@eddyb

At least for inline_lazy, the Option<T> can be wrapped in Cell, needing only:

unsafe impl<T: Sync> Sync for Lazy<T> {}

Then we can just have a regular static and get can take &'static self safely.

EDIT: As noted below (#117 (comment)), the use of &'static mut Lazy<T> is unsound.
Also, the impl above exists already, UB was introduced by regression at a308da1.

cc @anp @RalfJung

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions