rust/library
Yuki Okushi 1698773263
Rollup merge of #79360 - wchargin:wchargin-doc-iter-by-reference, r=m-ou-se
std::iter: document iteration over `&T` and `&mut T`

A colleague of mine is new to Rust, and mentioned that it was “slightly
confusing” to figure out what `&mut` does in iterating over `&mut foo`:

```rust
for value in &mut self.my_vec {
    // ...
}
```

My colleague had read the `std::iter` docs and not found the answer
there. There is a brief section at the top about “the three forms of
iteration”, which mentions `iter_mut`, but it doesn’t cover the purpose
of `&mut coll` for a collection `coll`. This patch adds an explanatory
section to the docs. I opted to create a new section so that it can
appear after the note that `impl<I: Iterator> IntoIterator for I`, and
it’s nice for the existing “three forms of iteration” to appear near the
top.

Test Plan:
Ran `./x.py doc library/core`, and the result looked good, including
links. Manually copy-pasted the two doctests into the playground and ran
them.

wchargin-branch: doc-iter-by-reference
2020-12-13 11:05:22 +09:00
..
alloc Rollup merge of #79860 - rust-lang:frewsxcv-patch-2, r=jyn514 2020-12-10 21:33:14 -08:00
backtrace@af078ecc0b std: Update the backtrace crate submodule 2020-11-20 11:56:07 -08:00
core Rollup merge of #79360 - wchargin:wchargin-doc-iter-by-reference, r=m-ou-se 2020-12-13 11:05:22 +09:00
panic_abort Drop support for cloudabi targets 2020-11-22 17:11:41 -05:00
panic_unwind Drop support for cloudabi targets 2020-11-22 17:11:41 -05:00
proc_macro Auto merge of #79336 - camelid:rename-feature-oibit-to-auto, r=oli-obk 2020-11-25 07:25:19 +00:00
profiler_builtins Fix warning whe building profiler_builtins crate 2020-09-04 15:10:29 +02:00
rtstartup Rename optin_builtin_traits to auto_traits 2020-11-23 14:14:06 -08:00
rustc-std-workspace-alloc
rustc-std-workspace-core
rustc-std-workspace-std
std Auto merge of #79893 - RalfJung:forget-windows, r=oli-obk 2020-12-11 07:54:35 +00:00
stdarch@777efaf564 Enable AVX512 *epi64 variants by updating stdarch 2020-11-17 11:50:52 +01:00
term
test Dogfood 'str_split_once()` in the std lib 2020-12-07 14:24:05 -07:00
unwind Drop support for cloudabi targets 2020-11-22 17:11:41 -05:00