Skip to content

Compiler error message is confusing #64829

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

Closed
divinerapier opened this issue Sep 27, 2019 · 13 comments
Closed

Compiler error message is confusing #64829

divinerapier opened this issue Sep 27, 2019 · 13 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-bug Category: This is a bug. D-confusing Diagnostics: Confusing error or lint that should be reworked. E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@divinerapier
Copy link

I don't know what caused this error. Sorry, I can't provide simple code to reproduce it.

rust-compiler-error

$ rustup show
Default host: x86_64-apple-darwin

installed toolchains
--------------------

stable-x86_64-apple-darwin
nightly-2019-09-13-x86_64-apple-darwin (default)

Thanks.

@csmoe

This comment has been minimized.

@csmoe csmoe closed this as completed Sep 27, 2019
@divinerapier
Copy link
Author

@csmoe thank you for your reply. I mean the error message is useless. It says the types mismatched, but there is no context in the error message, so how can I fix it. I know how to fix but I don't know where to fix.

@csmoe

This comment has been minimized.

@csmoe csmoe reopened this Sep 27, 2019
@divinerapier

This comment has been minimized.

@csmoe csmoe added A-diagnostics Area: Messages for errors, warnings, and lints E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example labels Sep 27, 2019
@Centril
Copy link
Contributor

Centril commented Sep 27, 2019

Unfortunately, this is report is not actionable without knowing more about the situation, which we will need to know about to fashion a more tailored error message.

@eddyb
Copy link
Member

eddyb commented Sep 27, 2019

@Centril That's not the problem, the problem is there's no span at all.

@divinerapier Are you using any custom derives? That's the only thing I can think of that could be able to cause this. If you can provide a list of your (proc-macro) dependencies, that could help a lot.

If you want to try to reduce your code, you can start by taking various functions and replacing their bodies with unimplemented!(). If at any point the error goes away, that's the culprit. Otherwise, you can now try to remove various methods and types.

@jonas-schievink jonas-schievink added C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 27, 2019
@estebank
Copy link
Contributor

This is a problem that needs to be solved. I'm pretty sure it's a duplicate of #51635.

@divinerapier
Copy link
Author

divinerapier commented Sep 28, 2019

@eddyb When I reduce the code, I find when function_name::named is deleted, the error message will be correct. I hope this will help.

crate function_name

@estebank estebank added the D-confusing Diagnostics: Confusing error or lint that should be reworked. label Oct 8, 2019
@steveklabnik
Copy link
Member

Triage: this really needs some way to reproduce.

@estebank
Copy link
Contributor

estebank commented Sep 19, 2020

@steveklabnik there have been multiple changes that @Aaron1011 has made to the macro machinery to preserve their token streams to avoid the most egregious of these errors, but they will still happen when proc_macros rewrite the output TTS. I don't recall what the tracking issue for that work is.

Edit: #51635 (comment):

The general problem of losing line numbers with proc-macros is tracked at #43081. I suspect that the gen::< Result<(),()> >(); issue mentioned by najamelan will be fixed by #72306

@Aaron1011
Copy link
Member

The tracking issue is #43081
I'm currently working on the last major piece (as far as stable code is concerned) in #76130.

@bbros-dev
Copy link

bbros-dev commented Aug 7, 2021

@Aaron1011 given issue #43081 is resolved can this be considered resolved?

I've a confusing compiler error use case to report, and am looking for open issues that might cover my case. It doesn't look like this is my issue, but this issue appears to be resolved by issue #43081

@Aaron1011
Copy link
Member

@bbros-dev: That's correct - we now preserve spans in all stable code, and in almost all unstable code. Feel free to open a new issue for the compiler error that you're getting.

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-bug Category: This is a bug. D-confusing Diagnostics: Confusing error or lint that should be reworked. E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example 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

9 participants