Skip to content

cycle detected when computing the super predicates of ... #96665

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
sebschmi opened this issue May 3, 2022 · 3 comments · Fixed by #96715
Closed

cycle detected when computing the super predicates of ... #96665

sebschmi opened this issue May 3, 2022 · 3 comments · Fixed by #96715
Labels
C-bug Category: This is a bug. P-high High priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@sebschmi
Copy link

sebschmi commented May 3, 2022

Code

I tried this code:

pub trait Sequence<Item, Subsequence: Sequence<Item, Subsequence>> {}

pub trait NodeWalk<Graph: GraphBase, NodeSubwalk: NodeWalk<Graph, NodeSubwalk>>:
    Sequence<Graph::NodeIndex, NodeSubwalk>
{
}

pub trait GraphBase {
    type NodeIndex;
}

pub trait WalkableGraph: GraphBase {}

playground

(this example was created by stripping down https://crates.io/crates/traitgraph/0.10.0)

I expected to see this happen: it should build on nightly as it does on beta and stable

Instead, this happened:

Compiling playground v0.0.1 (/playground)
error[E0391]: cycle detected when computing the super predicates of `NodeWalk`
 --> src/lib.rs:5:1
  |
5 | / pub trait NodeWalk<Graph: GraphBase, NodeSubwalk: NodeWalk<Graph, NodeSubwalk>>:
6 | |     Sequence<Graph::NodeIndex, NodeSubwalk>
7 | | {
8 | | }
  | |_^
  |
note: ...which requires computing the super traits of `NodeWalk`...
 --> src/lib.rs:6:14
  |
6 |     Sequence<Graph::NodeIndex, NodeSubwalk>
  |              ^^^^^^^^^^^^^^^^
note: ...which requires computing the bounds for type parameter `Graph`...
 --> src/lib.rs:5:20
  |
5 | pub trait NodeWalk<Graph: GraphBase, NodeSubwalk: NodeWalk<Graph, NodeSubwalk>>:
  |                    ^^^^^
  = note: ...which again requires computing the super predicates of `NodeWalk`, completing the cycle
note: cycle used when collecting item types in top-level module
 --> src/lib.rs:5:1
  |
5 | / pub trait NodeWalk<Graph: GraphBase, NodeSubwalk: NodeWalk<Graph, NodeSubwalk>>:
6 | |     Sequence<Graph::NodeIndex, NodeSubwalk>
7 | | {
8 | | }
  | |_^

For more information about this error, try `rustc --explain E0391`.
error: could not compile `playground` due to previous error

Version it worked on

It most recently worked on: stable 1.60.0 and 1.61.0-beta.4 (69a6d12 2022-04-25)

Version with regression

rustc --version --verbose:

rustc 1.62.0-nightly (bed05e996 2022-05-02)
binary: rustc
commit-hash: bed05e996e37e44b1a3980b84754af621fd3c4ce
commit-date: 2022-05-02
host: x86_64-unknown-linux-gnu
release: 1.62.0-nightly
LLVM version: 14.0.1

@rustbot modify labels: +regression-from-stable-to-nightly -regression-untriaged

@sebschmi sebschmi added C-bug Category: This is a bug. regression-untriaged Untriaged performance or correctness regression. labels May 3, 2022
@rustbot rustbot added regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. I-prioritize Issue: Indicates that prioritization has been requested for this issue. and removed regression-untriaged Untriaged performance or correctness regression. labels May 3, 2022
@inquisitivecrystal inquisitivecrystal added the E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example label May 3, 2022
@sebschmi
Copy link
Author

sebschmi commented May 3, 2022

@inquisitivecrystal I added an mcve

@lqd lqd removed the E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example label May 4, 2022
@lqd
Copy link
Member

lqd commented May 4, 2022

This is another one introduced by #93803 cc @cjgillot

@apiraino apiraino added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label May 4, 2022
@apiraino
Copy link
Contributor

apiraino commented May 4, 2022

Assigning priority as discussed in the Zulip thread of the Prioritization Working Group.

@rustbot label -I-prioritize +P-high

@rustbot rustbot added P-high High priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels May 4, 2022
@bors bors closed this as completed in 362010d May 10, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
C-bug Category: This is a bug. P-high High priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants