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

For recursive impl trait point at statement that causes the recursion #57341

Closed
estebank opened this issue Jan 4, 2019 · 1 comment
Closed
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@estebank
Copy link
Contributor

estebank commented Jan 4, 2019

After #56074, the error is already good enough:

error[E0720]: opaque type expands to a recursive type
  --> $DIR/recursive-impl-trait-type.rs:6:22
   |
LL | fn option(i: i32) -> impl Sized { //~ ERROR
   |                      ^^^^^^^^^^ expands to self-referential type
   |
   = note: expanded type is `std::option::Option<(impl Sized, i32)>`

but it'd be nice if we pointed at the exact statement causing the recursion:

error[E0720]: opaque type expands to a recursive type
  --> $DIR/recursive-impl-trait-type.rs:6:22
   |
LL | fn option(i: i32) -> impl Sized { //~ ERROR
   |                      ^^^^^^^^^^ expands to self-referential type
...
LL |         Some((option(i - 1), i))
   |         ^^^^^^^^^^^^^^^^^^^^^^^^ expanded type is `std::option::Option<(impl Sized, i32)>`
LL |     }
LL | }
@estebank estebank added the A-diagnostics Area: Messages for errors, warnings, and lints label Jan 4, 2019
@crlf0710 crlf0710 added C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 11, 2020
@estebank
Copy link
Contributor Author

Fixed.

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. 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