rust-lang / rust-lang/rust

`*mut [T]::split_at_mut_unchecked` doesn't document the `mid > len` case

Open Beginner friendly
#155,409 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

*mut [T]::split_at_mut_unchecked can create unexpectedly large slices if mid > len as len - mid will overflow. Its documentation doesn't mention this behavior and it could lead to UB in callers.

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.

Research direction

Locate the documentation for *mut [T]::split_at_mut_unchecked and read its current safety notes, focusing on the mid > len case described in the issue. Update the documentation to explain the resulting overflow and potential for unexpectedly large slices or UB in callers; the issue is done when that behavior is explicit.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.