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

Cycle with super traits and negative bounds #111207

Closed
cynecx opened this issue May 4, 2023 · 1 comment · Fixed by #111211
Closed

Cycle with super traits and negative bounds #111207

cynecx opened this issue May 4, 2023 · 1 comment · Fixed by #111211
Assignees
Labels
C-bug Category: This is a bug.

Comments

@cynecx
Copy link
Contributor

cynecx commented May 4, 2023

I tried this code:

#![feature(negative_bounds)]

trait A: !B {}
trait B: !A {}

fn main() {}

I expected to see this happen: Should compile (because this isn't a cycle due to the negative bound).

Instead, this happened: errors with

error[E0391]: cycle detected when computing the super predicates of `A`
 --> m.rs:3:10
  |
3 | trait A: !B {}
  |          ^^
  |
note: ...which requires computing the super predicates of `B`...
 --> m.rs:4:10
  |
4 | trait B: !A {}
  |          ^^
  = note: ...which again requires computing the super predicates of `A`, completing the cycle
note: cycle used when collecting item types in top-level module
 --> m.rs:3:1
  |
3 | trait A: !B {}
  | ^^^^^^^^^^^^^^

Meta

rustc --version --verbose:

rustc 1.71.0-nightly (473f916d8 2023-05-03)
binary: rustc
commit-hash: 473f916d836cc662c5bdbb0d40af9fb4678fab9e
commit-date: 2023-05-03
host: aarch64-apple-darwin
release: 1.71.0-nightly
LLVM version: 16.0.2

I am fully aware that this feature just landed for internal experimentation only. So if this bug isn't an actual bug or is simply out of scope, feel free to close this issue :)

@cynecx cynecx added the C-bug Category: This is a bug. label May 4, 2023
@compiler-errors
Copy link
Member

I am going to recommend against messing with negative bounds for now. They are an internal-facing, incomplete, very buggy, and unintuitive feature that's mostly there for us to make internal test cases. I can fix this case specifically because why not, but I don't think it's super useful reporting more bugs like this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants