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

ACP: Make <[[T; N]]>::flatten const #218

Closed
KamilaBorowska opened this issue May 3, 2023 · 2 comments
Closed

ACP: Make <[[T; N]]>::flatten const #218

KamilaBorowska opened this issue May 3, 2023 · 2 comments
Labels
ACP-accepted API Change Proposal is accepted (seconded with no objections) api-change-proposal A proposal to add or alter unstable APIs in the standard libraries T-libs-api

Comments

@KamilaBorowska
Copy link

Proposal

Problem statement

Allow using <[[T; N]]>::flatten within const fn.

Motivation, use-cases

Could be useful for code like this where you have an array containing arrays (for instance from u32::to_be_bytes) to return an array. For example, Ipv6Addr::new in standard library could make use of it.

[f(a), f(b), f(c), f(d)].flatten().try_into().unwrap()

Solution sketches

Add const keyword. The current implementation is already const-compatible, and I don't see a reason why this would change.

Links and related work

What happens now?

This issue is part of the libs-api team API change proposal process. Once this issue is filed the libs-api team will review open proposals in its weekly meeting. You should receive feedback within a week or two.

@KamilaBorowska KamilaBorowska added api-change-proposal A proposal to add or alter unstable APIs in the standard libraries T-libs-api labels May 3, 2023
@scottmcm
Copy link
Member

scottmcm commented May 3, 2023

Thanks for the ACP! For an unstable method, I'm going to consider this something that can be done as a tweak under the existing tracking issue, and not something that needs to wait on a libs-api decision, given that the implementation change is trivial. I've approved the PR.

libs-api folks, please feel free to yell at me if you disagree 🙃

Manishearth added a commit to Manishearth/rust that referenced this issue May 3, 2023
Manishearth added a commit to Manishearth/rust that referenced this issue May 3, 2023
Manishearth added a commit to Manishearth/rust that referenced this issue May 3, 2023
Manishearth added a commit to Manishearth/rust that referenced this issue May 3, 2023
@pitaj
Copy link

pitaj commented May 14, 2023

This can now be closed.

thomcc pushed a commit to tcdi/postgrestd that referenced this issue Jul 18, 2023
@the8472 the8472 closed this as completed Sep 19, 2023
@dtolnay dtolnay added the ACP-accepted API Change Proposal is accepted (seconded with no objections) label Nov 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ACP-accepted API Change Proposal is accepted (seconded with no objections) api-change-proposal A proposal to add or alter unstable APIs in the standard libraries T-libs-api
Projects
None yet
Development

No branches or pull requests

5 participants