Skip to content

Cycle error when accidentally comparing a function inside itself #66667

Closed
@RalfJung

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.

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