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

Send bound of trait object make unexpected async block is not general enough error #130596

Open
ethe opened this issue Sep 20, 2024 · 1 comment
Labels
A-async-await Area: Async & Await A-diagnostics Area: Messages for errors, warnings, and lints A-trait-system Area: Trait system C-bug Category: This is a bug.

Comments

@ethe
Copy link

ethe commented Sep 20, 2024

I tried this code:
https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=4f2133cbf38d27366a8edd106b5485e5

I expected to see this happen: Same as below, compile pass:
https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=69e324c356bd126e575a971a7cbbf2fa

Instead, this happened:

error: implementation of `From` is not general enough
  --> src/lib.rs:44:9
   |
44 | /         Box::pin(async move {
45 | |             let response = self.send_request(request).await;
46 | |             match response {
47 | |                 Ok(response) => todo!(),
...  |
51 | |             }
52 | |         })
   | |__________^ implementation of `From` is not general enough
   |
   = note: `Box<(dyn std::error::Error + Send + Sync + 'static)>` must implement `From<Box<(dyn std::error::Error + Send + Sync + '0)>>`, for any lifetime `'0`...
   = note: ...but it actually implements `From<Box<(dyn std::error::Error + Send + Sync + 'static)>>`

error: could not compile `playground` (lib) due to 1 previous error; 1 warning emitted
@ethe ethe added the C-bug Category: This is a bug. label Sep 20, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Sep 20, 2024
@ethe ethe changed the title RPITIT + Send takes unexpected async block is not general enough error RPITIT + Send makes unexpected async block is not general enough error Sep 20, 2024
@ethe ethe changed the title RPITIT + Send makes unexpected async block is not general enough error Send requirement of trait object make unexpected async block is not general enough error Sep 20, 2024
@ethe ethe changed the title Send requirement of trait object make unexpected async block is not general enough error Send bound of trait object make unexpected async block is not general enough error Sep 20, 2024
@csmoe
Copy link
Member

csmoe commented Sep 20, 2024

Duplicate of #64552

Convert the type alias to a struct can workaround this https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=b310f0b751f46eac66956c4eb1f85e7f

@lolbinarycat lolbinarycat added A-diagnostics Area: Messages for errors, warnings, and lints A-trait-system Area: Trait system A-async-await Area: Async & Await labels Oct 9, 2024
@Noratrieb Noratrieb removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Nov 9, 2024
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 A-diagnostics Area: Messages for errors, warnings, and lints A-trait-system Area: Trait system C-bug Category: This is a bug.
Projects
None yet
Development

No branches or pull requests

5 participants