Skip to content

Soundness conflicts #379

Open
Open
@RalfJung

Description

@RalfJung

Sometimes it happens that two unsafe-using libraries are sound in isolation, but unsound when combined. Each time that happens, Rust has to decide which side to consider sound. Ultimately this boils down to precisely specifying the safety invariants of all our types -- but doing that requires something like RustBelt, so it is hard to have that discussion in full generality. (Also that would involve T-types at least as much as WG-UCG / T-opsem.)

But meanwhile, it would be good to collect the cases of these conflicts here that we find out there in the wild.

The most famous case of this is of course leakpocalypse: Rc vs pre-Rust-1.0-scoped-threads, which famously got decided in favor of Rc (and mem::forget). Another case is that without union and ManuallyDrop, josephine would be sound. Again the resolution for the ecosystem is clearly in favor of unions and ManuallyDrop.

The point of this thread is not to discuss any of these conflicts and figure out which side we want to bless. It is solely to collect the known cases in a central location.

  • take_mut / replace_with vs partial-borrow: see here for details and discussion.
  • mk_static vs Stack Tokens: see reddit for details.
  • Pin is seriously under-specified and probably has quite a few of these conflicts, here is one.
  • "Partial move out of Drop type" vs a pattern that assumes that exactly that does not happen (coming up in this RFC).
  • TLS vs stackful coroutines.
  • Allowing vs not allowing some lifetime subtyping on dyn Trait.

Activity

RalfJung

RalfJung commented on Nov 24, 2022

@RalfJung
MemberAuthor

I am pretty sure I saw another case of this recently, but forgot where...

oskgo

oskgo commented on Aug 23, 2023

@oskgo
RustyYato

RustyYato commented on Aug 23, 2023

@RustyYato
oskgo

oskgo commented on Aug 23, 2023

@oskgo
RustyYato

RustyYato commented on Aug 23, 2023

@RustyYato
RalfJung

RalfJung commented on Aug 24, 2023

@RalfJung
Author
Jules-Bertholet

Jules-Bertholet commented on Oct 7, 2023

@Jules-Bertholet
RalfJung

RalfJung commented on Oct 8, 2023

@RalfJung
Author
RalfJung

RalfJung commented on Oct 8, 2023

@RalfJung
Author
steffahn

steffahn commented on Oct 28, 2023

@steffahn
RalfJung

RalfJung commented on Oct 28, 2023

@RalfJung
Author
matklad

matklad commented on Dec 11, 2023

@matklad
RalfJung

RalfJung commented on Dec 12, 2023

@RalfJung
Author
Jules-Bertholet

Jules-Bertholet commented on Dec 13, 2023

@Jules-Bertholet
adamreichold

adamreichold commented on Dec 14, 2023

@adamreichold

5 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-listCategory: A list/collection of some sort. Please help maintain it!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @RalfJung@matklad@steffahn@saethlin@adamreichold

        Issue actions

          Soundness conflicts · Issue #379 · rust-lang/unsafe-code-guidelines