Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Improve E0391 #60178

Closed
estebank opened this issue Apr 22, 2019 · 1 comment
Closed

Improve E0391 #60178

estebank opened this issue Apr 22, 2019 · 1 comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-enhancement Category: An issue proposing an enhancement or a PR with one. D-verbose Diagnostics: Too much output caused by a single piece of incorrect code. P-low Low priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@estebank
Copy link
Contributor

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 } }`
@estebank estebank added the A-diagnostics Area: Messages for errors, warnings, and lints label Apr 22, 2019
@estebank estebank added D-verbose Diagnostics: Too much output caused by a single piece of incorrect code. P-low Low priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 21, 2020
@JohnTitor JohnTitor added the C-enhancement Category: An issue proposing an enhancement or a PR with one. label Jan 26, 2020
@estebank
Copy link
Contributor Author

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
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-enhancement Category: An issue proposing an enhancement or a PR with one. D-verbose Diagnostics: Too much output caused by a single piece of incorrect code. P-low Low priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

2 participants