rust-lang / rust-lang/rust

Clarify that match_indices returns an iterator over byte indices

Open
#161,812 1 comment 0 reactions 1 assignee View on GitHub

@zepredos is already working on this.

Since Aug 26, 2026.

A-docs needs-triage
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

Location (URL)

Docs: https://doc.rust-lang.org/stable/std/string/struct.String.html#method.match_indices

Source: https://github.com/rust-lang/rust/blob/3ffb26fbf5bf232cf59e314e75ea325973f4f583/library/core/src/str/mod.rs#L2086-L2087

Summary

The comment at:
https://github.com/rust-lang/rust/blob/3ffb26fbf5bf232cf59e314e75ea325973f4f583/library/core/src/str/mod.rs#L2086-L2087

Could clarify:

     /// Returns an iterator over the disjoint matches of a pattern within this string
-    /// slice as well as the index that the match starts at.
+    /// slice as well as the byte index that the match starts at.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.