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

Confusing compile error messages about algebraic data type #86265

Open
fukatani opened this issue Jun 13, 2021 · 0 comments
Open

Confusing compile error messages about algebraic data type #86265

fukatani opened this issue Jun 13, 2021 · 0 comments
Labels
A-suggestion-diagnostics Area: Suggestions generated by the compiler applied by `cargo fix`. C-bug Category: This is a bug. D-invalid-suggestion Diagnostics: A structured suggestion resulting in incorrect code. E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@fukatani
Copy link
Contributor

I tried to compile this code:

async fn update_first_ac_of_problems<'a, I: Iterator<Item = &'a int>> (
    &self,
    first_ac_submissions: I,
) -> Result<()> {

I got compile error message,

error: future cannot be sent between threads safely
  --> sql-client/src/first_ac_submissions.rs:19:21
   |
19 |       ) -> Result<()> {
   |  _____________________^
20 | |         Ok(())
21 | |     }
   | |_____^ future created by async block is not `Send`
   |
note: captured value is not `Send`
  --> sql-client/src/first_ac_submissions.rs:18:9
   |
18 |         first_ac_submissions: I,
   |         ^^^^^^^^^^^^^^^^^^^^ has type `I` which is not `Send`
   = note: required for the cast to the object type `dyn futures::Future<Output = std::result::Result<(), anyhow::Error>> + std::marker::Send`
help: consider further restricting this bound
   |
16 |     async fn update_first_ac_of_problems<'a, I + std::marker::Send: Iterator<Item = &'a i32>> (
   |                                                ^^^^^^^^^^^^^^^^^^^

I expect 16 | async fn update_first_ac_of_problems<'a, I: Iterator<Item = &'a i32> + std::marker::Send> ( is right.

Meta

rustc --version --verbose:

rustc 1.51.0 (2fd73fabe 2021-03-23)
Backtrace

<backtrace>

@fukatani fukatani added the C-bug Category: This is a bug. label Jun 13, 2021
@jonas-schievink jonas-schievink added A-suggestion-diagnostics Area: Suggestions generated by the compiler applied by `cargo fix`. D-invalid-suggestion Diagnostics: A structured suggestion resulting in incorrect code. labels Jun 13, 2021
@JohnTitor JohnTitor added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jun 13, 2021
@JohnTitor JohnTitor added the E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example label Jul 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-suggestion-diagnostics Area: Suggestions generated by the compiler applied by `cargo fix`. C-bug Category: This is a bug. D-invalid-suggestion Diagnostics: A structured suggestion resulting in incorrect code. E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants