Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upLinkedList implementation violates aliasing rules #34417
Comments
alexcrichton
added
I-nominated
T-libs
labels
Jun 22, 2016
This comment has been minimized.
This comment has been minimized.
|
The declaration of It's not completely clear whether this particular use of unsafe will be considered undefined behavior under the new memory model (see rust-lang/rfcs#1643), but it's likely it will. |
This comment has been minimized.
This comment has been minimized.
|
I agree with @eefriedman that this usage is likely to turn out to be a problem -- because it uses |
alexcrichton
added
P-medium
and removed
I-nominated
labels
Jun 27, 2016
This comment has been minimized.
This comment has been minimized.
|
triage: P-medium Not actively causing breakage today, but we're likely to want to revisit this soon |
Amanieu commentedJun 22, 2016
The nodes in
LinkedListlook like this:BoxusesUnique, which requires that it "the referent of the pointer should not be modified without a unique path to the Unique reference". This effectively means thatUniquedoesn't allow aliases, but this rule violated by theprevpointer which point to the same node as aUnique.While Rust currently doesn't give
noaliassemantics toUnique, this is planned in the future and will silently breakLinkedList.