Skip to content

Arc::from_inner / Rc::from_inner should probably be marked unsafe #89740

Closed
@sdroege

Description

@sdroege

See

fn from_inner(ptr: NonNull<ArcInner<T>>) -> Self {
Self { ptr, phantom: PhantomData }
}

This can be called like

let dangling_arc = Arc::from_inner(NonNull::dangling());

without any unsafe code and results in an Arc to a dangling pointer, which will cause fun when trying to use it.

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