about summary refs log tree commit diff
path: root/tests/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.panic-unwind.diff
diff options
context:
space:
mode:
authorJan Behrens <jbe@magnetkern.de>2022-07-19 11:40:40 +0200
committerJan Behrens <jbe@magnetkern.de>2022-07-19 11:40:40 +0200
commit551d921de0f13c54093ab4f6a3adbe69292e091a (patch)
tree029a334c4a5c19ce8c5a294b790259f5d65d6c39 /tests/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.panic-unwind.diff
parentc3f35504d15e80b4727872c17c8c2f4bbaee58cf (diff)
downloadrust-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