Skip to content

diagnostics flipflopping with Zthreads #142063

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

Open
matthiaskrgr opened this issue Jun 5, 2025 · 0 comments
Open

diagnostics flipflopping with Zthreads #142063

matthiaskrgr opened this issue Jun 5, 2025 · 0 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-parallel-compiler Area: parallel compiler A-reproducibility Area: Reproducible / deterministic builds C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

matthiaskrgr commented Jun 5, 2025

I tried this code:

trait A { fn foo() -> A; }
trait B { fn foo() -> A; }

I expected to see this happen:
consistent diagnostics

Instead, this happened:
compiling with --edition=2024 -Zthreads=8 --crate-type=lib

sometimes rustc prints

error[E0391]: cycle detected when computing function signature of `A::foo`
 --> b.rs:1:11
  |
1 | trait A { fn foo() -> A; }
  |           ^^^^^^^^^^^^^^
  |
note: ...which requires checking if trait `A` is dyn-compatible...
 --> b.rs:1:1
  |
1 | trait A { fn foo() -> A; }
  | ^^^^^^^
note: ...which requires determining dyn-compatibility of trait `A`...
 --> b.rs:1:1
  |
1 | trait A { fn foo() -> A; }
  | ^^^^^^^
  = note: ...which again requires computing function signature of `A::foo`, completing the cycle
note: cycle used when checking that `A::foo` is well-formed
 --> b.rs:1:11
  |
1 | trait A { fn foo() -> A; }
  |           ^^^^^^^^^^^^^^
  = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information

error: aborting due to 1 previous error

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

but other times it prints

error[E0782]: expected a type, found a trait
 --> b.rs:1:23
  |
1 | trait A { fn foo() -> A; }
  |                       ^
  |
help: `A` is dyn-incompatible, use `impl A` to return an opaque type, as long as you return a single underlying type
  |
1 | trait A { fn foo() -> impl A; }
  |                       ++++

error[E0782]: expected a type, found a trait
 --> b.rs:2:23
  |
2 | trait B { fn foo() -> A; }
  |                       ^
  |
help: `A` is dyn-incompatible, use `impl A` to return an opaque type, as long as you return a single underlying type
  |
2 | trait B { fn foo() -> impl A; }
  |                       ++++

error: associated item referring to unboxed trait object for its own trait
 --> b.rs:1:23
  |
1 | trait A { fn foo() -> A; }
  |       - in this trait ^
  |
help: you might have meant to use `Self` to refer to the implementing type
  |
1 - trait A { fn foo() -> A; }
1 + trait A { fn foo() -> Self; }
  |

error: aborting due to 3 previous errors

Meta

rustc --version --verbose:

rustc 1.89.0-nightly (4b27a04cc 2025-06-04)
binary: rustc
commit-hash: 4b27a04cc8ed4da10a546a871e23e665d03f7a79
commit-date: 2025-06-04
host: x86_64-unknown-linux-gnu
release: 1.89.0-nightly
LLVM version: 20.1.5
@matthiaskrgr matthiaskrgr added the C-bug Category: This is a bug. label Jun 5, 2025
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jun 5, 2025
@matthiaskrgr matthiaskrgr added A-diagnostics Area: Messages for errors, warnings, and lints and removed C-bug Category: This is a bug. labels Jun 5, 2025
@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jun 5, 2025
@matthiaskrgr matthiaskrgr added C-bug Category: This is a bug. A-diagnostics Area: Messages for errors, warnings, and lints A-parallel-compiler Area: parallel compiler and removed A-diagnostics Area: Messages for errors, warnings, and lints labels Jun 5, 2025
@jieyouxu jieyouxu added A-reproducibility Area: Reproducible / deterministic builds and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Jun 5, 2025
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 A-parallel-compiler Area: parallel compiler A-reproducibility Area: Reproducible / deterministic builds C-bug Category: This is a bug. 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