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

error printed twice for deref recursion limit exceeded #38940

Closed
durka opened this issue Jan 9, 2017 · 2 comments
Closed

error printed twice for deref recursion limit exceeded #38940

durka opened this issue Jan 9, 2017 · 2 comments
Assignees
Labels
A-diagnostics Area: Messages for errors, warnings, and lints E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added.

Comments

@durka
Copy link
Contributor

durka commented Jan 9, 2017

I wrote some code for a rustc test which intentionally hits the recursion limit while trying to autoderef from &Top to &Bottom.

In nightly the error when autoderef hits the recursion limit is printed twice. The second time it is printed without a real span.

Stable and beta:

rustc 1.14.0 (e8a012324 2016-12-16)
error[E0055]: reached the recursion limit while auto-dereferencing I
  --> <anon>:60:22
   |
60 |     let x: &Bottom = &t;
   |                      ^^ deref recursion limit reached

error[E0308]: mismatched types
  --> <anon>:60:22
   |
60 |     let x: &Bottom = &t;
   |                      ^^ expected struct `Bottom`, found struct `Top`
   |
   = note: expected type `&Bottom`
   = note:    found type `&Top`

error: aborting due to 2 previous errors

Nightly:

error[E0055]: reached the recursion limit while auto-dereferencing I
  --> xx.rs:60:22
   |
60 |     let x: &Bottom = &t;
   |                      ^^ deref recursion limit reached

error[E0055]: reached the recursion limit while auto-dereferencing I

error[E0308]: mismatched types
  --> xx.rs:60:22
   |
60 |     let x: &Bottom = &t;
   |                      ^^ expected struct `Bottom`, found struct `Top`
   |
   = note: expected type `&Bottom`
   = note:    found type `&Top`

error: aborting due to 3 previous errors

It's clearer to see with --error-format=json that the second error has a dummy span attached: https://gist.github.com/durka/04031f5701b5740f0f413267fc913e87

cc @jseyfried @jonathandturner

@jseyfried jseyfried self-assigned this Jan 9, 2017
@Mark-Simulacrum Mark-Simulacrum added the A-diagnostics Area: Messages for errors, warnings, and lints label May 19, 2017
@Mark-Simulacrum
Copy link
Member

@jseyfried You assigned this to yourself, but I don't see any progress yet. Just checking in to make sure you're still aware of it :)

@Mark-Simulacrum Mark-Simulacrum added the C-bug Category: This is a bug. label Jul 26, 2017
@estebank estebank added E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. and removed C-bug Category: This is a bug. labels Sep 19, 2018
@estebank
Copy link
Contributor

No longer repros. Let's add a test and close.

kennytm added a commit to kennytm/rust that referenced this issue Sep 21, 2018
…tebank

Add UI test for deref recursion limit printing twice

Closes rust-lang#38940

Does ``NOTE`` in the test need to be changed to ``HELP`` if its in the stderr?
``help: consider adding a `#![recursion_limit="20"]` attribute to your crate``

It doesn't appear to complaining locally that the line isn't set to ``HELP`` in the test, and the guide says
 > HELP and SUGGESTION*
> * Note: SUGGESTION must follow immediately after HELP.

yet there's no concrete suggestion emitted.

r? @estebank
pietroalbini added a commit to pietroalbini/rust that referenced this issue Sep 22, 2018
…tebank

Add UI test for deref recursion limit printing twice

Closes rust-lang#38940

Does ``NOTE`` in the test need to be changed to ``HELP`` if its in the stderr?
``help: consider adding a `#![recursion_limit="20"]` attribute to your crate``

It doesn't appear to complaining locally that the line isn't set to ``HELP`` in the test, and the guide says
 > HELP and SUGGESTION*
> * Note: SUGGESTION must follow immediately after HELP.

yet there's no concrete suggestion emitted.

r? @estebank
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 E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
Projects
None yet
Development

No branches or pull requests

4 participants