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

E0599 doesn't show enough context for misformatted code #108603

Closed
punkeel opened this issue Mar 1, 2023 · 0 comments · Fixed by #108609
Closed

E0599 doesn't show enough context for misformatted code #108603

punkeel opened this issue Mar 1, 2023 · 0 comments · Fixed by #108609
Labels
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.

Comments

@punkeel
Copy link

punkeel commented Mar 1, 2023

Code

// https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=7c60867045215214d0aae813162a5cf5

use std::collections::HashMap;

fn main() -> Result<(), ()> {
    HashMap::
    Ok(())
}

Current output

Compiling playground v0.0.1 (/playground)
error[E0599]: no associated item named `Ok` found for struct `HashMap` in the current scope
 --> src/main.rs:5:5
  |
5 |     Ok(())
  |     ^^ associated item not found in `HashMap<_, _, _>`

For more information about this error, try `rustc --explain E0599`.
error: could not compile `playground` due to previous error

Desired output

Compiling playground v0.0.1 (/playground)
error[E0599]: no associated item named `Ok` found for struct `HashMap` in the current scope
 --> src/main.rs:5:5
  |
+ 4 |     HashMap::
5 |     Ok(())
  |     ^^ associated item not found in `HashMap<_, _, _>`

For more information about this error, try `rustc --explain E0599`.
error: could not compile `playground` due to previous error

Rationale and extra context

The error is correct when the code is properly formatted, otherwise it doesn't show enough code-context.

This happened to me today as I was making changes to a file, literally typed SomeType:: .. then Run (cargo run), and was greeted by this error.

Other cases

No response

Anything else?

No response

@punkeel punkeel 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 Mar 1, 2023
@bors bors closed this as completed in 832987b Mar 2, 2023
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 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.

1 participant