Skip to content

Cycle with super traits and negative bounds #111207

Closed
@cynecx

Description

@cynecx

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 :)

Metadata

Metadata

Labels

C-bugCategory: This is a bug.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions