File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -1099,10 +1099,15 @@ impl<T> [T] {
10991099 /// assert!(iter.next().is_none());
11001100 /// ```
11011101 ///
1102- /// There's no `windows_mut`, as that existing would let safe code violate the
1103- /// "only one `&mut` at a time to the same thing" rule. However, you can sometimes
1104- /// use [`Cell::as_slice_of_cells`](crate::cell::Cell::as_slice_of_cells) in
1105- /// conjunction with `windows` to accomplish something similar:
1102+ /// Because the [Iterator] trait cannot represent the required lifetimes,
1103+ /// there is no `windows_mut` analog to `windows`;
1104+ /// `[0,1,2].windows_mut(2).collect()` would violate [the rules of references]
1105+ /// (though a [LendingIterator] analog is possible). You can sometimes use
1106+ /// [`Cell::as_slice_of_cells`](crate::cell::Cell::as_slice_of_cells) in
1107+ /// conjunction with `windows` instead:
1108+ ///
1109+ /// [the rules of references]: https://doc.rust-lang.org/book/ch04-02-references-and-borrowing.html#the-rules-of-references
1110+ /// [LendingIterator]: https://blog.rust-lang.org/2022/10/28/gats-stabilization.html
11061111 /// ```
11071112 /// use std::cell::Cell;
11081113 ///
You can’t perform that action at this time.
0 commit comments