Skip to content

Improve E0391 #60178

Closed
Closed

Description

@estebank

In #60126 we continue compiling on what used to be a hard error, causing both E0072 (recursive type) and E0391 (cycle detected when processing). In this case in particular, the later error shouldn't be emitted if it is already explained by another error. At the same time, the current output is less than ideal and could be improved:

error[E0391]: cycle detected when processing `MList`
  --> $DIR/infinite-tag-type-recursion.rs:1:1
   |
LL | enum MList { Cons(isize, MList), Nil }
   | ^^^^^^^^^^
   |
   = note: ...which again requires processing `MList`, completing the cycle
   = note: cycle used when computing dropck types for `Canonical { max_universe: U0, variables: [], value: ParamEnvAnd { param_env: ParamEnv { caller_bounds: [], reveal: UserFacing, def_id: None }, value: MList } }`

Activity

  1. added
    D-verboseDiagnostics: Too much output caused by a single piece of incorrect code.
    P-lowLow priority
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    on Jan 21, 2020
  2. added
    C-enhancementCategory: An issue proposing an enhancement or a PR with one.
    on Jan 26, 2020
  3. estebank commented on Dec 28, 2022

    @estebank
    ContributorAuthor

    Current output

    error[E0072]: recursive type `MList` has infinite size
     --> src/lib.rs:1:1
      |
    1 | enum MList { Cons(isize, MList), Nil }
      | ^^^^^^^^^^               ----- recursive without indirection
      |
    help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle
      |
    1 | enum MList { Cons(isize, Box<MList>), Nil }
      |                          ++++     +
    
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-verboseDiagnostics: Too much output caused by a single piece of incorrect code.P-lowLow priorityT-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