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 span for missing main function is too large #77968

Closed
lnicola opened this issue Oct 15, 2020 · 6 comments
Closed

Error span for missing main function is too large #77968

lnicola opened this issue Oct 15, 2020 · 6 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-bug Category: This is a bug. D-verbose Diagnostics: Too much output caused by a single piece of incorrect code. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@lnicola
Copy link
Member

lnicola commented Oct 15, 2020

I tried this code:

fn foo() {}
fn bar() {}
fn baz() {}

I expected to see this happen:

error[E0601]: `main` function not found in crate `hello`
 --> src/main.rs:4:1
3 | | fn baz() {}
4 | ^ consider adding a `main` function to `src/main.rs`

(or something similar -- an empty last line might be missing).

Instead, this happened:

error[E0601]: `main` function not found in crate `hello`
 --> src/main.rs:1:1
  |
1 | / fn foo() {}
2 | | fn bar() {}
3 | | fn baz() {}
  | |___________^ consider adding a `main` function to `src/main.rs`

This matters for IDE support, because using the whole file as an error span is a bit messy, marking potentially hundreds of lines as an error.

Meta

rustc --version:

rustc 1.49.0-nightly (91a79fb29 2020-10-07)
@lnicola lnicola added the C-bug Category: This is a bug. label Oct 15, 2020
@jonas-schievink jonas-schievink added A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 15, 2020
@euclio
Copy link
Contributor

euclio commented Oct 15, 2020

@rustbot claim

@jyn514 jyn514 added the D-verbose Diagnostics: Too much output caused by a single piece of incorrect code. label Oct 15, 2020
@GopherJ

This comment has been minimized.

@lnicola

This comment has been minimized.

@dtolnay
Copy link
Member

dtolnay commented Jan 27, 2022

I don't know when I'll be able to return to this. Closing for now. #79086 (comment)

@rustbot release-assignment

@euclio
Copy link
Contributor

euclio commented Mar 8, 2022

Looks like this was fixed by #93142.

@dtolnay
Copy link
Member

dtolnay commented Mar 9, 2022

Indeed! Thanks for finding that.

@dtolnay dtolnay closed this as completed Mar 9, 2022
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-verbose Diagnostics: Too much output caused by a single piece of incorrect code. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants