diff options
| author | Jan Behrens <jbe@magnetkern.de> | 2022-07-19 11:40:40 +0200 |
|---|---|---|
| committer | Jan Behrens <jbe@magnetkern.de> | 2022-07-19 11:40:40 +0200 |
| commit | 551d921de0f13c54093ab4f6a3adbe69292e091a (patch) | |
| tree | 029a334c4a5c19ce8c5a294b790259f5d65d6c39 /tests/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.panic-unwind.diff | |
| parent | c3f35504d15e80b4727872c17c8c2f4bbaee58cf (diff) | |
| download | rust-551d921de0f13c54093ab4f6a3adbe69292e091a.tar.gz rust-551d921de0f13c54093ab4f6a3adbe69292e091a.zip | |
docs: Improve AsRef / AsMut docs on blanket impls
- Explicitly mention that `AsRef` and `AsMut` do not auto-dereference generally for all dereferencable types (but only if inner type is a shared and/or mutable reference) - Give advice to not use `AsRef` or `AsMut` for the sole purpose of dereferencing - Suggest providing a transitive `AsRef` or `AsMut` implementation for types which implement `Deref` - Add new section "Reflexivity" in documentation comments for `AsRef` and `AsMut` - Provide better example for `AsMut` - Added heading "Relation to `Borrow`" in `AsRef`'s docs to improve structure Issue #45742 and a corresponding FIXME in the libcore suggest that `AsRef` and `AsMut` should provide a blanket implementation over `Deref`. As that is difficult to realize at the moment, this commit updates the documentation to better describe the status-quo and to give advice on how to use `AsRef` and `AsMut`.
Diffstat (limited to 'tests/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.panic-unwind.diff')
0 files changed, 0 insertions, 0 deletions
