Skip to content

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

Closed
@sebschmi

Description

@sebschmi

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

Activity

added
C-bugCategory: This is a bug.
regression-untriagedUntriaged performance or correctness regression.
on May 3, 2022
added
I-prioritizeIssue: Indicates that prioritization has been requested for this issue.
and removed
regression-untriagedUntriaged performance or correctness regression.
on May 3, 2022
added
E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example
on May 3, 2022
sebschmi

sebschmi commented on May 3, 2022

@sebschmi
Author

@inquisitivecrystal I added an mcve

removed
E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example
on May 4, 2022
lqd

lqd commented on May 4, 2022

@lqd
Member

This is another one introduced by #93803 cc @cjgillot

added
T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
on May 4, 2022
apiraino

apiraino commented on May 4, 2022

@apiraino
Contributor

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

@rustbot label -I-prioritize +P-high

added
P-highHigh priority
and removed
I-prioritizeIssue: Indicates that prioritization has been requested for this issue.
on May 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.P-highHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Participants

      @lqd@apiraino@inquisitivecrystal@rustbot@sebschmi

      Issue actions

        cycle detected when computing the super predicates of `...` · Issue #96665 · rust-lang/rust