Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

LinkedList implementation violates aliasing rules #34417

Copy link
Copy link
@Amanieu

Description

@Amanieu
Issue body actions

The nodes in LinkedList look like this:

struct Node<T> {
    next: Option<Box<Node<T>>>,
    prev: Option<Shared<Node<T>>>,
    value: T,
}

Box uses Unique, which requires that it "the referent of the pointer should not be modified without a unique path to the Unique reference". This effectively means that Unique doesn't allow aliases, but this rule violated by the prev pointer which point to the same node as a Unique.

While Rust currently doesn't give noalias semantics to Unique, this is planned in the future and will silently break LinkedList.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P-mediumMedium priorityMedium priorityT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.