Skip to content

Cycle error when accidentally comparing a function inside itself #66667

Closed

Description

@RalfJung

The following code leads to an inscrutable error message:

fn up() {
    up == 1
}
error[E0391]: cycle detected when processing `up`
 --> src/lib.rs:1:1
  |
1 | fn up() {
  | ^^^^^^^
  |
  = note: ...which again requires processing `up`, completing the cycle
  = note: cycle used when type-checking all item bodies

error: aborting due to previous error

I had this happen in a 10-line function and it took me a bit to realize that I typo'd the function instead of a variable name somewhere. There is no indication where inside the function the bad use is.

Activity

  1. added
    A-diagnosticsArea: Messages for errors, warnings, and lints
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    C-enhancementCategory: An issue proposing an enhancement or a PR with one.
    on Nov 23, 2019
  2. added
    D-confusingDiagnostics: Confusing error or lint that should be reworked.
    D-papercutDiagnostics: An error or lint that needs small tweaks.
    on Jan 13, 2020
  3. added a commit that references this issue on Mar 11, 2020
    ff65bff
  4. added a commit that references this issue on Mar 27, 2020
    f635c37
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

    A-diagnosticsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.D-confusingDiagnostics: Confusing error or lint that should be reworked.D-papercutDiagnostics: An error or lint that needs small tweaks.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions