-
Notifications
You must be signed in to change notification settings - Fork 13.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LinkedList implementation violates aliasing rules #34417
Comments
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. |
I agree with @eefriedman that this usage is likely to turn out to be a problem -- because it uses |
triage: P-medium Not actively causing breakage today, but we're likely to want to revisit this soon |
Replace `LinkedList`'s use of `Box` with `Shared` Closes #34417
The nodes in
LinkedList
look like this:Box
usesUnique
, which requires that it "the referent of the pointer should not be modified without a unique path to the Unique reference". This effectively means thatUnique
doesn't allow aliases, but this rule violated by theprev
pointer which point to the same node as aUnique
.While Rust currently doesn't give
noalias
semantics toUnique
, this is planned in the future and will silently breakLinkedList
.The text was updated successfully, but these errors were encountered: