-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-async-awaitArea: Async & AwaitArea: Async & AwaitC-bugCategory: This is a bug.Category: This is a bug.P-highHigh priorityHigh priorityT-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.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.Performance or correctness regression from stable to nightly.
Milestone
Description
If an
.await
occurs inside a formatting macro, the resulting generator is no longerSend
.
Context
This has already tripped up some people which seem to get quite confused with this error message, so I'd rather we not regress here:
Code
I tried this code:
async fn foo() {
println!("{} {:?}", "", async {}.await);
}
const _ASSERT_SEND: fn() = || {
let _: &dyn Send = &foo();
};
I expected to see this happen: Code compiles fine: the type of foo()
is Send
.
Instead, this happened: The type of foo()
is not send, since the backing state-machine generator produced for it now captures part of the fmt
internals involving a &
reference to the extern { type Opaque; }
, which is not Sync
.
Version it worked on
It most recently worked on: beta
Version with regression
rustc --version --verbose
:
nightly-2022-01-23 84322efad553c7a79c80
@rustbot modify labels: +regression-from-stable-to-nightly -regression-untriaged
Metadata
Metadata
Assignees
Labels
A-async-awaitArea: Async & AwaitArea: Async & AwaitC-bugCategory: This is a bug.Category: This is a bug.P-highHigh priorityHigh priorityT-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.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.Performance or correctness regression from stable to nightly.