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 {array, slice}::{from_ref, from_mut} as const fn #90206

Open
3 of 4 tasks
WaffleLapkin opened this issue Oct 23, 2021 · 10 comments
Open
3 of 4 tasks

Tracking Issue for {array, slice}::{from_ref, from_mut} as const fn #90206

WaffleLapkin opened this issue Oct 23, 2021 · 10 comments
Labels
A-array Area: `[T; N]` C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@WaffleLapkin
Copy link
Member

WaffleLapkin commented Oct 23, 2021

Feature gates: #![feature(const_array_from_ref)] and #![feature(const_slice_from_ref)]

This is a tracking issue for {array, slice}::{from_ref, from_mut} functions marked as const fn

Public API

This feature makes the following APIs const:

// core::array
pub const fn from_mut<T>(s: &mut T) -> &mut [T; 1];

// core::slice
pub const fn from_mut<T>(s: &mut T) -> &mut [T];

These functions as const were previously tracked here, but are now stabilized:

// core::array
pub const fn from_ref<T>(s: &T) -> &[T; 1];

// core::slice
pub const fn from_ref<T>(s: &T) -> &[T];

Steps / History

Unresolved Questions

  • None yet.
@WaffleLapkin WaffleLapkin 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 Oct 23, 2021
@Amanieu
Copy link
Member

Amanieu commented May 23, 2022

@rfcbot fcp merge

@rfcbot
Copy link

rfcbot commented May 23, 2022

Team member @Amanieu has proposed to merge this. The next step is review by the rest of the tagged team members:

No concerns currently listed.

Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

See this document for info about what commands tagged team members can give me.

@rfcbot rfcbot added proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. labels May 23, 2022
@WaffleLapkin
Copy link
Member Author

Note that from_mut is not being stabilized as &mut is unstable in const context.

cc @oli-obk

@Amanieu
Copy link
Member

Amanieu commented May 23, 2022

Tracking issue for &mut in const: #57349

@rfcbot rfcbot added final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. and removed proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. labels May 24, 2022
@rfcbot
Copy link

rfcbot commented May 24, 2022

🔔 This is now entering its final comment period, as per the review above. 🔔

@oli-obk
Copy link
Contributor

oli-obk commented May 24, 2022

cc @rust-lang/wg-const-eval

@rfcbot rfcbot added finished-final-comment-period The final comment period is finished for this PR / Issue. to-announce Announce this issue on triage meeting and removed final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. labels Jun 3, 2022
@rfcbot
Copy link

rfcbot commented Jun 3, 2022

The final comment period, with a disposition to merge, as per the review above, is now complete.

As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed.

This will be merged soon.

Dylan-DPC added a commit to Dylan-DPC/rust that referenced this issue Jun 3, 2022
…from_ref, r=dtolnay

Stabilize `{slice,array}::from_ref`

This PR stabilizes the following APIs as `const` functions in Rust `1.63`:
```rust
// core::array
pub const fn from_ref<T>(s: &T) -> &[T; 1];

// core::slice
pub const fn from_ref<T>(s: &T) -> &[T];
```

Note that the `mut` versions are not stabilized as unique references (`&mut _`) are [unstable in const context].

FCP: rust-lang#90206 (comment)

r? rust-lang/libs-api `@rustbot` label +T-libs-api -T-libs

[unstable in const context]: rust-lang#57349
@apiraino apiraino removed the to-announce Announce this issue on triage meeting label Jun 9, 2022
workingjubilee pushed a commit to tcdi/postgrestd that referenced this issue Sep 15, 2022
… r=dtolnay

Stabilize `{slice,array}::from_ref`

This PR stabilizes the following APIs as `const` functions in Rust `1.63`:
```rust
// core::array
pub const fn from_ref<T>(s: &T) -> &[T; 1];

// core::slice
pub const fn from_ref<T>(s: &T) -> &[T];
```

Note that the `mut` versions are not stabilized as unique references (`&mut _`) are [unstable in const context].

FCP: rust-lang/rust#90206 (comment)

r? rust-lang/libs-api `@rustbot` label +T-libs-api -T-libs

[unstable in const context]: rust-lang/rust#57349
@workingjubilee workingjubilee added the A-array Area: `[T; N]` label Mar 7, 2023
@WaffleLapkin
Copy link
Member Author

This still tracks {array,slice}::from_mut as a const fn.

@dtolnay
Copy link
Member

dtolnay commented Sep 22, 2024

@rust-lang/libs-api:
@rfcbot fcp merge

from_ref was stabilized for const in 1.63. Now from_mut has been unblocked by the stabilization of #57349.

@dtolnay
Copy link
Member

dtolnay commented Sep 22, 2024

FCP for from_mut: #130538 (comment)

bors added a commit to rust-lang-ci/rust that referenced this issue Oct 9, 2024
…r=workingjubilee

Stabilize const `{slice,array}::from_mut`

This PR stabilizes the following APIs as const stable as of rust `1.83`:
```rs
// core::array
pub const fn from_mut<T>(s: &mut T) -> &mut [T; 1];

// core::slice
pub const fn from_mut<T>(s: &mut T) -> &mut [T];
```
This is made possible by `const_mut_refs` being stabilized (yay).

Tracking issue: rust-lang#90206
workingjubilee added a commit to workingjubilee/rustc that referenced this issue Oct 10, 2024
…, r=workingjubilee

Stabilize const `{slice,array}::from_mut`

This PR stabilizes the following APIs as const stable as of rust `1.83`:
```rs
// core::array
pub const fn from_mut<T>(s: &mut T) -> &mut [T; 1];

// core::slice
pub const fn from_mut<T>(s: &mut T) -> &mut [T];
```
This is made possible by `const_mut_refs` being stabilized (yay).

Tracking issue: rust-lang#90206
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Oct 10, 2024
…, r=workingjubilee

Stabilize const `{slice,array}::from_mut`

This PR stabilizes the following APIs as const stable as of rust `1.83`:
```rs
// core::array
pub const fn from_mut<T>(s: &mut T) -> &mut [T; 1];

// core::slice
pub const fn from_mut<T>(s: &mut T) -> &mut [T];
```
This is made possible by `const_mut_refs` being stabilized (yay).

Tracking issue: rust-lang#90206
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Oct 10, 2024
Rollup merge of rust-lang#130538 - ultrabear:ultrabear_const_from_ref, r=workingjubilee

Stabilize const `{slice,array}::from_mut`

This PR stabilizes the following APIs as const stable as of rust `1.83`:
```rs
// core::array
pub const fn from_mut<T>(s: &mut T) -> &mut [T; 1];

// core::slice
pub const fn from_mut<T>(s: &mut T) -> &mut [T];
```
This is made possible by `const_mut_refs` being stabilized (yay).

Tracking issue: rust-lang#90206
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-array Area: `[T; N]` C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. 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

7 participants