Skip to content

std::io::Read incorrectly has no marked required methods #163675

Closed

Description

@AlaskanEmily

Location (URL)

https://doc.rust-lang.org/std/io/trait.Read.html

Summary

The base read method is marked as "provided" in the current method list, which is inconsistent with the rest of the documentation:

Readers are defined by one required method, read()

Activity

  1. added
    A-docsArea: Documentation for any part of the project, including the compiler, standard library, and tools
    on Oct 2, 2026
  2. added
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Oct 2, 2026
  3. asquared31415 commented on Oct 2, 2026

    @asquared31415
    Contributor

    Technically at least one of read or the unstable read_buf must be implemented, and the default implementations of those methods use each other. You can see this in the error message when you fail to implement them:

    error[E0046]: not all trait items implemented, missing one of: `read_buf`, `read`
      --> src/main.rs:16:1
       |
    16 | impl std::io::Read for MyStruct {}
       | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing one of `read_buf`, `read` in implementation
    

    Because both of these methods have a default implementation, they're not considered "required" by rustdoc. It should probably parse #[rustc_must_implement_one_of(read_buf, read)] and display this somehow (no idea how to concisely represent this).

    @rustbot label +T-rustdoc -needs-triage

  4. added
    T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.
    and removed
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Oct 2, 2026
  5. integral-830 commented on Oct 4, 2026

    @integral-830

    @rustbot claim

  6. integral-830 commented on Oct 5, 2026

    @integral-830

    @AlaskanEmily @asquared31415 when a trait has #[rustc_must_implement_one_of], show the
    "Required Methods" entry in the sidebar (linking to the existing section).
    Would you also want the declaration comment changed, or is the sidebar
    enough?

  7. GuillaumeGomez commented on Oct 13, 2026

    @GuillaumeGomez
    Member

    This issue was already kinda solved. Opened #164266 to cover the missing bits.

  8. added a commit that references this issue on Oct 14, 2026
  9. added 4 commits that reference this issue on Oct 14, 2026
  10. added a commit that references this issue on Oct 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsT-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions