Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Improve AsRef / AsMut docs on blanket impls #99460

Merged
merged 4 commits into from
Oct 3, 2022

Commits on Jul 19, 2022

  1. 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 rust-lang#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`.
    JanBeh committed Jul 19, 2022
    Configuration menu
    Copy the full SHA
    551d921 View commit details
    Browse the repository at this point in the history
  2. fixup! docs: Improve AsRef / AsMut docs on blanket impls

    Fixed examples in sections "Generic Implementations" of `AsRef`'s and
    `AsMut`'s doc comments, which failed tests.
    JanBeh committed Jul 19, 2022
    Configuration menu
    Copy the full SHA
    9f68e3e View commit details
    Browse the repository at this point in the history
  3. fixup! docs: Improve AsRef / AsMut docs on blanket impls

    Better conform to Rust API Documentation Conventions
    JanBeh committed Jul 19, 2022
    Configuration menu
    Copy the full SHA
    e4a259b View commit details
    Browse the repository at this point in the history

Commits on Jul 21, 2022

  1. fixup! docs: Improve AsRef / AsMut docs on blanket impls

    Changed wording in sections on "Reflexivity":
    replaced "that is there is" with "i.e. there would be" and removed comma
    before "with"
    
    Reason: "there is" somewhat contradicted the "would be" hypothetical.
    A slightly redundant wording has now been chosen for better clarity.
    The comma seemed to be superfluous.
    JanBeh committed Jul 21, 2022
    Configuration menu
    Copy the full SHA
    e6b761b View commit details
    Browse the repository at this point in the history