rust-lang / rust-lang/rust

Tracking Issue for raw array getters (array_ptr_get)

Open
#119,834 12 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(array_ptr_get)]

This is a tracking issue for as_(mut_)ptr and as_(mut_)slice methods on raw array pointers, i.e. *(const/mut) [T; N].

See also:

Public API
impl<T, const N: usize> *mut [T; N] {
    pub fn as_mut_ptr(self) -> *mut T {}
    pub fn as_mut_slice(self) -> *mut [T] {}
}

impl<T, const N: usize> *const [T; N] {
    pub const fn as_ptr(self) -> *const T {}
    pub const fn as_slice(self) -> *const [T] {}
}
Steps / History
Unresolved Questions
  • If arbitrary_self_types (https://github.com/rust-lang/rfcs/pull/3519) is accepted, these methods may be changed to have a *(const/mut) Self receiver. Also, if a deref-like coercion mechanism is added (specifically, *[T; N] -> *[T], similar to the non-raw counterparts), these methods might become redundant.

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 by reviewing the feature-gated API and the completed implementation in #119411, then read the linked stabilization guidance and the unresolved questions. Done means completing the remaining final comment period and stabilization PR steps for array_ptr_get.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
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.