Skip to content

constify TryFrom<Vec> for array#155616

Open
Lars-Schumann wants to merge 1 commit into
rust-lang:mainfrom
Lars-Schumann:const-array-try-from-vec
Open

constify TryFrom<Vec> for array#155616
Lars-Schumann wants to merge 1 commit into
rust-lang:mainfrom
Lars-Schumann:const-array-try-from-vec

Conversation

@Lars-Schumann
Copy link
Copy Markdown
Contributor

@Lars-Schumann Lars-Schumann commented Apr 21, 2026

Related issues #79597, #143773, #133214

this makes Vec const Destruct along the way.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Apr 21, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 21, 2026

r? @jackh726

rustbot has assigned @jackh726.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 72 candidates
  • Random selection from 18 candidates

@rust-log-analyzer

This comment has been minimized.

@Lars-Schumann Lars-Schumann marked this pull request as draft April 21, 2026 21:26
@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 21, 2026
@Lars-Schumann Lars-Schumann force-pushed the const-array-try-from-vec branch from 9c141c1 to f59366f Compare April 21, 2026 21:29
@rust-log-analyzer

This comment has been minimized.

@Lars-Schumann Lars-Schumann force-pushed the const-array-try-from-vec branch from f59366f to 8acdb36 Compare April 22, 2026 07:26
Comment thread library/alloc/src/vec/mod.rs
@Lars-Schumann Lars-Schumann marked this pull request as ready for review April 22, 2026 08:01
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 22, 2026
@jackh726
Copy link
Copy Markdown
Member

r? libs-api

@rustbot rustbot added the T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. label Apr 23, 2026
@rustbot rustbot assigned the8472 and unassigned jackh726 Apr 23, 2026
@Lars-Schumann
Copy link
Copy Markdown
Contributor Author

assigned reviewer seems inactive atm
r? rust-lang/wg-const-eval

@rustbot rustbot assigned lcnr and unassigned the8472 Apr 24, 2026
@lcnr
Copy link
Copy Markdown
Contributor

lcnr commented May 5, 2026

r? oli

is this blocked on figuring out std constification

@lcnr
Copy link
Copy Markdown
Contributor

lcnr commented May 5, 2026

r? oli-obk

@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 5, 2026

Failed to set assignee to oli: invalid assignee

Note: Only org members with at least the repository "read" role, users with write permissions, or people who have commented on the PR may be assigned.

@rustbot rustbot assigned oli-obk and unassigned lcnr May 5, 2026
@oli-obk
Copy link
Copy Markdown
Contributor

oli-obk commented May 6, 2026

Huh why does this affect mir-opts?

I think this is fine under std constification, because it tests a very specific use case of a core type like Vec. At minimum we should have const Drop for Vec

@oli-obk oli-obk removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 6, 2026
@oli-obk oli-obk added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label May 6, 2026
@Lars-Schumann
Copy link
Copy Markdown
Contributor Author

Lars-Schumann commented May 6, 2026

At minimum we should have const Drop for Vec

@oli-obk do you want me to limit the scope of this PR to that and remove the const TryFrom ?

@oli-obk
Copy link
Copy Markdown
Contributor

oli-obk commented May 6, 2026

I think it's trivial enough, and ppl were more worried about random std types than core types. So it should be fine, and feels like a core use case for const code to push things to a vec but still produce an array

@Lars-Schumann
Copy link
Copy Markdown
Contributor Author

So then @rustbot ready ?

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels May 6, 2026
@oli-obk
Copy link
Copy Markdown
Contributor

oli-obk commented May 6, 2026

why does this affect mir-opts?

This still baffles me. Can't merge it without knowing why.

Comment on lines +75 to +79
StorageLive(_7);
_7 = copy _4;
_4 = AddUnchecked(copy _7, const 1_usize);
_8 = Option::<usize>::Some(copy _7);
StorageDead(_7);
Copy link
Copy Markdown
Contributor

@oli-obk oli-obk May 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean, this is probably an improvement, but what causes it? Do we have mir-opts that are checking constness of functions out of some reason?

View changes since the review

@rust-bors

This comment has been minimized.

@Lars-Schumann Lars-Schumann force-pushed the const-array-try-from-vec branch from 8acdb36 to 74c398b Compare May 17, 2026 19:43
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 17, 2026

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants