Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tracking Issue for raw array getters (array_ptr_get) #119834

Open
2 of 4 tasks
yotamofek opened this issue Jan 10, 2024 · 0 comments
Open
2 of 4 tasks

Tracking Issue for raw array getters (array_ptr_get) #119834

yotamofek opened this issue Jan 10, 2024 · 0 comments
Labels
C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@yotamofek
Copy link
Contributor

yotamofek commented Jan 10, 2024

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 (Arbitrary self types v2 rfcs#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.

Footnotes

  1. https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html

@yotamofek yotamofek added C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels Jan 10, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Mar 17, 2024
Add as_(mut_)ptr and as_(mut_)slice to raw array pointers

Hey, first time contributing to the standard libraries so not completely sure about the process.

These functions are complementary to the ones being added in rust-lang#74265 . I found them missing on array pointers.

See also:
- ACP: rust-lang/libs-team#321
- Tracking issue: rust-lang#119834
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Mar 17, 2024
Add as_(mut_)ptr and as_(mut_)slice to raw array pointers

Hey, first time contributing to the standard libraries so not completely sure about the process.

These functions are complementary to the ones being added in rust-lang#74265 . I found them missing on array pointers.

See also:
- ACP: rust-lang/libs-team#321
- Tracking issue: rust-lang#119834
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Mar 17, 2024
Rollup merge of rust-lang#119411 - yotamofek:array-ptr-get, r=Nilstrieb

Add as_(mut_)ptr and as_(mut_)slice to raw array pointers

Hey, first time contributing to the standard libraries so not completely sure about the process.

These functions are complementary to the ones being added in rust-lang#74265 . I found them missing on array pointers.

See also:
- ACP: rust-lang/libs-team#321
- Tracking issue: rust-lang#119834
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

1 participant