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.

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

    Issue actions