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

Added more const_closure functionality #102276

Merged
merged 3 commits into from
Sep 30, 2022

Conversation

onestacked
Copy link
Contributor

Enables ConstFnMutClosure to use a tuple of mutable references instead of just a mutable reference to a tuple.

Removes the new function, since it would barely be usable with this new code.

r? @fee1-dead

@rustbot rustbot added the T-libs Relevant to the library team, which will review and decide on the PR/issue. label Sep 25, 2022
@rustbot
Copy link
Collaborator

rustbot commented Sep 25, 2022

Hey! It looks like you've submitted a new PR for the library teams!

If this PR contains changes to any rust-lang/rust public library APIs then please comment with @rustbot label +T-libs-api -T-libs to tag it appropriately. If this PR contains changes to any unstable APIs please edit the PR description to add a link to the relevant API Change Proposal or create one if you haven't already. If you're unsure where your change falls no worries, just leave it as is and the reviewer will take a look and make a decision to forward on if necessary.

Examples of T-libs-api changes:

  • Stabilizing library features
  • Introducing insta-stable changes such as new implementations of existing stable traits on existing stable types
  • Introducing new or changing existing unstable library APIs (excluding permanently unstable features / features without a tracking issue)
  • Changing public documentation in ways that create new stability guarantees
  • Changing observable runtime behavior of library APIs

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 25, 2022
@onestacked onestacked force-pushed the const_closure_ext branch 2 times, most recently from 932c33b to d4e5e0b Compare September 25, 2022 18:40
Copy link
Member

@fee1-dead fee1-dead left a comment

Choose a reason for hiding this comment

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

This is an internal change so I don't think this would interfere with new developments and discussions around the feature.

library/core/src/iter/adapters/by_ref_sized.rs Outdated Show resolved Hide resolved
library/core/src/iter/adapters/mod.rs Outdated Show resolved Hide resolved
@fee1-dead
Copy link
Member

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Sep 30, 2022

📌 Commit fa93a1a476d53dbd93c0eef12a330a60c1915f38 has been approved by fee1-dead

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 30, 2022
@fee1-dead
Copy link
Member

@bors r-

@bors bors 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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Sep 30, 2022
Comment on lines 64 to 73
{
extern "rust-call" fn call_mut(&mut self, args: ClosureArguments) -> Self::Output {
#[allow(non_snake_case)]
let ($($var),*) = &mut self.data;
(self.func)(($($var),*), args)
}
}

impl<'a, CapturedData: ?Sized, ClosureArguments, Function, ClosureReturnValue> const
FnMut<ClosureArguments> for ConstFnMutClosure<'a, CapturedData, Function>
where
Function: ~const Fn(&mut CapturedData, ClosureArguments) -> ClosureReturnValue,
{
extern "rust-call" fn call_mut(&mut self, args: ClosureArguments) -> Self::Output {
(self.func)(self.data, args)
}
}
};
}
Copy link
Member

Choose a reason for hiding this comment

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

Sorry for the nits, but this isn't formatted properly. The last brace should have no spaces before them, and all of these should have four spaces.

r=me once you are done

@fee1-dead
Copy link
Member

@bors delegate+

After you are done, mention bors and r=fee1-dead.

@bors
Copy link
Contributor

bors commented Sep 30, 2022

✌️ @chriss0612 can now approve this pull request

@onestacked
Copy link
Contributor Author

@bors r=fee1-dead

@bors
Copy link
Contributor

bors commented Sep 30, 2022

📌 Commit 10739d4 has been approved by fee1-dead

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Sep 30, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 30, 2022
…iaskrgr

Rollup of 6 pull requests

Successful merges:

 - rust-lang#102276 (Added more const_closure functionality)
 - rust-lang#102382 (Manually order `DefId` on 64-bit big-endian)
 - rust-lang#102421 (remove the unused :: between trait and type to give user correct diag…)
 - rust-lang#102495 (Reinstate `hir-stats.rs` test for stage 1.)
 - rust-lang#102505 (rustdoc: remove no-op CSS `h3.variant, .sub-variant h4 { border-bottom: none }`)
 - rust-lang#102506 (Specify `DynKind::Dyn`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 3452d9d into rust-lang:master Sep 30, 2022
@rustbot rustbot added this to the 1.66.0 milestone Sep 30, 2022
@onestacked onestacked deleted the const_closure_ext branch November 2, 2022 22:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.

5 participants