-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
Closed
Labels
A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsArea: Documentation for any part of the project, including the compiler, standard library, and toolsT-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.
Description
Location
Summary
The documentation for slice::windows states:
There’s no windows_mut, as that existing would let safe code violate the “only one &mut at a time to the same thing” rule.
Either I don't understand how it would violate the unique reference rules of Rust or that statement is false. Using GATs it's possible to implement a version of windows_mut today as shown here, however that version is limited to slice windows of size known at compile time. But that limitation doesn't change the fact that it is - at leas to my understanding - perfectly fine to have multiple unique references to slice elements as long as they are not pointing to the same element, which can't happen by definition in slice::window.
Metadata
Metadata
Assignees
Labels
A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsArea: Documentation for any part of the project, including the compiler, standard library, and toolsT-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.