Merged
Conversation
ehuss
reviewed
Mar 10, 2024
kpreid
reviewed
Mar 10, 2024
Co-authored-by: Kevin Reid <kpreid@switchb.org>
Co-authored-by: Eric Huss <eric@huss.org>
Co-authored-by: Kevin Reid <kpreid@switchb.org>
Contributor
|
I think one of the biggest changes in 1.77 is rust-lang/rust#117703. We now support recursive async functions (as long as they use indirection), making the before: use async_recursion::async_recursion;
#[async_recursion]
async fn fib(n : u32) -> u32 {
match n {
0 | 1 => 1,
_ => fib(n-1).await + fib(n-2).await
}
}
// which expands to
use std::future::Future;
use std::pin::Pin;
fn fib(n: u32) -> Pin<Box<dyn Future<Output = u32> + Send>> {
Box::pin(async move {
match n {
0 | 1 => 1,
_ => fib(n - 1).await + fib(n - 2).await,
}
})
}after async fn fib(n : u32) -> u32 {
match n {
0 | 1 => 1,
_ => Box::pin(fib(n-1)).await + Box::pin(fib(n-2)).await
}
}By avoiding trait objects this should improve the runtime performance of such functions and avoids the "auto-trait bound" problem of |
nnethercote
reviewed
Mar 12, 2024
epage
reviewed
Mar 13, 2024
This comment was marked as duplicate.
This comment was marked as duplicate.
Member
Author
|
Alright, I think this is now updated per all the feedback here. Thanks! |
kpreid
reviewed
Mar 16, 2024
Co-authored-by: Kevin Reid <kpreid@switchb.org>
kpreid
approved these changes
Mar 16, 2024
cuviper
reviewed
Mar 17, 2024
Co-authored-by: Josh Stone <cuviper@gmail.com>
lcnr
reviewed
Mar 18, 2024
Co-authored-by: lcnr <rust@lcnr.de>
ekanna
reviewed
Mar 21, 2024
ekanna
reviewed
Mar 21, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
cc @rust-lang/release