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

Future is not Send anymore when it uses format! because core::fmt::Opaque is not Sync #93458

Closed
kangalio opened this issue Jan 29, 2022 · 3 comments
Labels
C-bug Category: This is a bug. regression-from-stable-to-nightly Performance or correctness regression from stable to nightly.

Comments

@kangalio
Copy link

Code

I tried this code:

async fn say(_: String) {}
async fn mention() -> u32 {
    123
}

fn assert_send<T: Send>(_: T) {}

fn main() {
    assert_send(async {
        say(format!("{}{}", mention().await, mention().await)).await;
    });
}

I expected to see this happen: successful compilation

Instead, this happened:

error: future cannot be sent between threads safely
 --> src/main.rs:9:5
  |
9 |     assert_send(async {
  |     ^^^^^^^^^^^ future created by async block is not `Send`
  |
  = help: the trait `Sync` is not implemented for `core::fmt::Opaque`
note: required by a bound in `assert_send`
 --> src/main.rs:6:19
  |
6 | fn assert_send<T: Send>(_: T) {}
  |                   ^^^^ required by this bound in `assert_send`

Version it worked on

It most recently worked on: Rust 1.59.0-beta

Version with regression

rustc --version --verbose:

rustc 1.56.1 (59eed8a2a 2021-11-01)
binary: rustc
commit-hash: 59eed8a2aac0230a8b53e89d4e99d55912ba6b35
commit-date: 2021-11-01
host: x86_64-unknown-linux-gnu
release: 1.56.1
LLVM version: 13.0.0

Backtrace

Backtrace

<backtrace>

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

Urgau commented Jan 29, 2022

This is probably related to #91359

cc @dtolnay

@danielhenrymantilla
Copy link
Contributor

danielhenrymantilla commented Jan 29, 2022

Duplicate of #93274 (but it's nice to have better keywords to find it 🙂)

@kangalio
Copy link
Author

kangalio commented Jan 29, 2022

Duplicate of #93274

Ah, you're right

@apiraino apiraino removed the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Jan 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. regression-from-stable-to-nightly Performance or correctness regression from stable to nightly.
Projects
None yet
Development

No branches or pull requests

5 participants