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

Misleading TAIT diagnostic on missing Send + Sync bound #99799

Closed
ivan770 opened this issue Jul 27, 2022 · 2 comments
Closed

Misleading TAIT diagnostic on missing Send + Sync bound #99799

ivan770 opened this issue Jul 27, 2022 · 2 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-bug Category: This is a bug. D-confusing Diagnostics: Confusing error or lint that should be reworked. F-type_alias_impl_trait `#[feature(type_alias_impl_trait)]` requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@ivan770
Copy link

ivan770 commented Jul 27, 2022

I tried this code:

https://gist.github.com/ivan770/709330e60ce2dcfbfcb04d5dd539247b
(I think it's possible to minimize it a bit, however I'm not sure on how to do that in this case)

I expected to see this happen: It provides a meaningful diagnostic that I have to add Send + Sync bound to NonSendSync.

Instead, this happened: Misleading error occures:

error[E0391]: cycle detected when type-checking `<impl at src/lib.rs:16:1: 16:35>::call`
  --> src/lib.rs:20:10
   |
20 |     ) -> TestFut<'yielder> {
   |          ^^^^^^^^^^^^^^^^^
   |
   = note: ...which requires evaluating trait selection obligation `for<'r, 's, 't0, 't1, 't2, 't3, 't4, 't5, 't6, 't7, 't8> {core::future::ResumeTy, NonSendSync, core::pin::Pin<&'r mut NonSendSync>, &'s mut enstream::Yielder<'t0, ()>, enstream::Yielder<'t1, ()>, (), impl for<'t2, 't3, 't4> core::future::future::Future<Output = ()>, &'t5 mut core::pin::Pin<&'t6 mut NonSendSync>, futures_util::stream::stream::next::Next<'t7, core::pin::Pin<&'t8 mut NonSendSync>>}: core::marker::Send`...
note: ...which requires computing type of `NonSendSync::{opaque#0}`...
  --> src/lib.rs:34:20
   |
34 | type NonSendSync = impl Stream<Item = ()>;
   |                    ^^^^^^^^^^^^^^^^^^^^^^
   = note: ...which again requires type-checking `<impl at src/lib.rs:16:1: 16:35>::call`, completing the cycle
note: cycle used when computing type of `TestFut::{opaque#0}`
  --> src/lib.rs:10:26
   |
10 | type TestFut<'yielder> = impl Future<Output = ()> + Send + Sync;
   |                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

For more information about this error, try `rustc --explain E0391`.

Meta

rustc --version --verbose:

rustc 1.64.0-nightly (6dbae3ad1 2022-07-25)
binary: rustc
commit-hash: 6dbae3ad19309bb541d9e76638e6aa4b5449f29a
commit-date: 2022-07-25
host: aarch64-unknown-linux-musl
release: 1.64.0-nightly
LLVM version: 14.0.6

@ivan770 ivan770 added the C-bug Category: This is a bug. label Jul 27, 2022
@ivan770
Copy link
Author

ivan770 commented Jul 27, 2022

@rustbot label +T-compiler +F-type_alias_impl_trait +A-diagnostics +D-confusing +requires-nightly

@rustbot rustbot added A-diagnostics Area: Messages for errors, warnings, and lints D-confusing Diagnostics: Confusing error or lint that should be reworked. F-type_alias_impl_trait `#[feature(type_alias_impl_trait)]` requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jul 27, 2022
@ivan770
Copy link
Author

ivan770 commented Jul 27, 2022

Duplicate of #55997

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-bug Category: This is a bug. D-confusing Diagnostics: Confusing error or lint that should be reworked. F-type_alias_impl_trait `#[feature(type_alias_impl_trait)]` requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Development

No branches or pull requests

2 participants