Skip to content

Conversation

@bend-n
Copy link
Contributor

@bend-n bend-n commented Sep 26, 2025

adds the const_array feature
reimplements try_map with "iterator"

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Sep 26, 2025
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@bend-n bend-n marked this pull request as ready for review September 26, 2025 18:44
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 26, 2025
@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Sep 26, 2025
@rustbot
Copy link
Collaborator

rustbot commented Sep 26, 2025

r? @ibraheemdev

rustbot has assigned @ibraheemdev.
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

else {
// SAFETY: this slice will contain only initialized objects.
unsafe {
x.array_mut.get_unchecked_mut(..x.initialized).assume_init_drop();
Copy link
Contributor

Choose a reason for hiding this comment

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

What part of this isn't const evaluable? The get_unchecked_mut?

Copy link
Contributor Author

@bend-n bend-n Oct 11, 2025

Choose a reason for hiding this comment

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

assume_init_drop, and changing it to be const had some rammifications for some reason, causing some tests to fail. #147071 (comment)

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like just trivial stderr file changes. Feel free to just bless them.

But is that code path testable in const? Since it's only happening in a panic path, I think it's unreachable anyway in const contexts. They never unwind and never will unwind. So maybe just document that and move the entire drop method body into the non-const code path... Or can we keep it non-const and avoid any drop happening for it by "disarming it" in the success path?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

its used in try_from_fn, so it can get dropped in const context?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah right. Hmm. Wondering how to write an observable test for this. I think if you use a type with a reference to a Cell and in its const drop impl increment that cell, you should see in a const context that the cell isn't incremented if try_map errors/returns None.

#[inline]
#[stable(feature = "array_from_fn", since = "1.63.0")]
pub fn from_fn<T, const N: usize, F>(f: F) -> [T; N]
#[rustc_const_unstable(feature = "const_array", issue = "none")]
Copy link
Contributor

Choose a reason for hiding this comment

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

Please create a tracking issue and use its id here

@oli-obk oli-obk assigned oli-obk and unassigned ibraheemdev Oct 11, 2025
@rustbot
Copy link
Collaborator

rustbot commented Oct 11, 2025

The Miri subtree was changed

cc @rust-lang/miri

@bend-n bend-n force-pushed the const_array-ops branch 3 times, most recently from e95a529 to 0021344 Compare October 11, 2025 11:43
@bend-n bend-n force-pushed the const_array-ops branch 2 times, most recently from 43edafa to 7bec7a4 Compare October 11, 2025 12:03
@rustbot

This comment has been minimized.

where
F: [const] FnMut(T) -> U,
{
extern "rust-call" fn call_mut(&mut self, (i,): (usize,)) -> Self::Output {
Copy link
Contributor Author

@bend-n bend-n Oct 11, 2025

Choose a reason for hiding this comment

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

it would be possible to ignore this i and just use moved, but, uh, i think that would be somewhat confusing.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rustbot

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Collaborator

bors commented Oct 15, 2025

☔ The latest upstream changes (presumably #147692) made this pull request unmergeable. Please resolve the merge conflicts.

@rustbot

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@oli-obk oli-obk 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 Oct 19, 2025
@rustbot

This comment has been minimized.

@bend-n
Copy link
Contributor Author

bend-n commented Oct 21, 2025

@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 Oct 21, 2025
@bors
Copy link
Collaborator

bors commented Oct 22, 2025

☔ The latest upstream changes (presumably #147957) made this pull request unmergeable. Please resolve the merge conflicts.

@rustbot
Copy link
Collaborator

rustbot commented Oct 22, 2025

This PR was rebased onto a different master 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.

@rust-log-analyzer

This comment has been minimized.

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-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants