rust-lang / rust-lang/rust

Tracking Issue for `os_str_slice`

Open
#118,485 14 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-tracking-issue T-libs
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

Feature gate: #![feature(os_str_slice)]

This is a tracking issue for an API for taking substrings of OsStr, which in combination with OsStr::as_encoded_bytes() would make it possible to implement most string operations in (portable) safe code.

Public API
impl OsStr {
    pub fn slice_encoded_bytes<R: ops::RangeBounds<usize>>(&self, range: R) -> &Self;
}
Steps / History
Unresolved Questions
  • Currently this enforces the same requirements on all platforms, but on Unix (and some other platforms) the internal encoding of OsStr is already fully specified to be arbitrary bytes by means of the OsStrExt trait. Should we:
    • Relax the requirements on these platforms,
    • Keep enforcing the lowest common denominator invariants, or
    • Use strict checks now, but leave the possibility of relaxing them later?

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

Start with the Public API and review the ACP plus implementation references #118484 and #118569. Examine the unresolved platform-requirement questions, then follow the feature lifecycle for the pending FCP and stabilization PR; completion means the API is ready for stabilization.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
api, operating-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.