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

Regression in async generator and fmt internals: loss of Send #93274

Closed
danielhenrymantilla opened this issue Jan 24, 2022 · 6 comments · Fixed by #93461
Closed

Regression in async generator and fmt internals: loss of Send #93274

danielhenrymantilla opened this issue Jan 24, 2022 · 6 comments · Fixed by #93461
Assignees
Labels
A-async-await Area: Async & Await C-bug Category: This is a bug. P-high High priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Milestone

Comments

@danielhenrymantilla
Copy link
Contributor

danielhenrymantilla commented Jan 24, 2022

If an .await occurs inside a formatting macro, the resulting generator is no longer Send.

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

@danielhenrymantilla danielhenrymantilla added C-bug Category: This is a bug. regression-untriaged Untriaged performance or correctness regression. labels Jan 24, 2022
@rustbot rustbot added I-prioritize Issue: Indicates that prioritization has been requested for this issue. regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. and removed regression-untriaged Untriaged performance or correctness regression. labels Jan 24, 2022
@Mark-Simulacrum Mark-Simulacrum added this to the 1.60.0 milestone Jan 24, 2022
@matthiaskrgr
Copy link
Member

Might be related to #91032 / #93165 ?

@danielhenrymantilla
Copy link
Contributor Author

@matthiaskrgr I was also suspecting one of those, although I have to admit not having looked into it any further

@lqd
Copy link
Member

lqd commented Jan 25, 2022

Does it work with #93284 btw ? That should completely disable drop range tracking. (I've launched a try build there so that we have artifacts ready for that soon).

There were also recent changes in the formatting macros/machinery last week IIRC. That could be related as well.

This should be easy enough to bisect, and make sure where the regression is coming from.

@lqd
Copy link
Member

lqd commented Jan 25, 2022

Answering my own questions:

@danielhenrymantilla
Copy link
Contributor Author

Nice investigation @lqd!

@apiraino apiraino added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jan 27, 2022
@apiraino
Copy link
Contributor

Assigning priority as discussed in the Zulip thread of the Prioritization Working Group.

@rustbot label -I-prioritize +P-high

@rustbot rustbot added P-high High priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Jan 27, 2022
@pnkfelix pnkfelix added the A-async-await Area: Async & Await label Jan 27, 2022
@dtolnay dtolnay self-assigned this Jan 29, 2022
@bors bors closed this as completed in c1e2948 Jan 31, 2022
jsparber added a commit to jsparber/matrix-rust-sdk that referenced this issue Mar 7, 2022
This removes the `info!()` log because of
rust-lang/rust#93274
jsparber added a commit to jsparber/matrix-rust-sdk that referenced this issue Mar 7, 2022
We can't use `.await` inside `info!()` because of
rust-lang/rust#93274
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-async-await Area: Async & Await C-bug Category: This is a bug. P-high High priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants