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

Scope format_args temporaries #183

Merged
merged 2 commits into from
Nov 4, 2021
Merged

Scope format_args temporaries #183

merged 2 commits into from
Nov 4, 2021

Conversation

dtolnay
Copy link
Owner

@dtolnay dtolnay commented Nov 4, 2021

Fixes #182.

Currently fails with:

    error: future cannot be sent between threads safely
      --> tests/test_macros.rs:51:5
       |
    51 |     require_send_sync(async {
       |     ^^^^^^^^^^^^^^^^^ future created by async block is not `Send`
       |
       = help: the trait `Sync` is not implemented for `core::fmt::Opaque`
    note: future is not `Send` as this value is used across an await
      --> tests/test_macros.rs:56:9
       |
    56 |         future::ready(anyhow!("...")).await;
       |         ^^^^^^^^^^^^^^--------------^^^^^^^- `$crate::private::format_args!($msg)` is later dropped here
       |         |             |
       |         |             has type `[ArgumentV1<'_>; 0]` which is not `Send`
       |         await occurs here, with `$crate::private::format_args!($msg)` maybe used later
    note: required by a bound in `require_send_sync`
      --> tests/test_macros.rs:49:34
       |
    49 |     fn require_send_sync(_: impl Send + Sync) {}
       |                                  ^^^^ required by this bound in `require_send_sync`
@dtolnay dtolnay merged commit ab865f3 into master Nov 4, 2021
@dtolnay dtolnay deleted the temporaries branch November 4, 2021 04:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Format_args temporary across await point leads to a non-Sync future
1 participant