-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Closed
Labels
A-async-awaitArea: Async & AwaitArea: Async & AwaitC-bugCategory: This is a bug.Category: This is a bug.I-heavyIssue: Problems and improvements with respect to binary size of generated code.Issue: Problems and improvements with respect to binary size of generated code.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
I'm using the following wrapper function:
pub async fn log_error<F>(future: F)
where
F: Future<Output = Result<(), Box<dyn Error + Send + Sync + 'static>>>
{
if let Err(err) = future.await {
print_error(err);
}
}
Using std::mem::size_of_val
, the size of any future returned by this function is a bit more than twice the size of the future passed to it. This is a pretty severe penalty for a simple helper function.
Stargateur
Metadata
Metadata
Assignees
Labels
A-async-awaitArea: Async & AwaitArea: Async & AwaitC-bugCategory: This is a bug.Category: This is a bug.I-heavyIssue: Problems and improvements with respect to binary size of generated code.Issue: Problems and improvements with respect to binary size of generated code.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.