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

?eval command produces less than ideal error messages due to the way the code is generated #108

Open
ilyvion opened this issue Jan 5, 2023 · 0 comments

Comments

@ilyvion
Copy link
Contributor

ilyvion commented Jan 5, 2023

Because it puts everything on the same line, you get the "irrelevant" surrounding code as part of your error message.

?eval `let () = 1;`
error[E0308]: mismatched types
 --> src/main.rs:1:34
  |
1 | fn main(){ println!("{:?}",{ let () = 1; 
  |                                  ^^   - this expression has type `{integer}`
  |                                  |
  |                                  expected integer, found `()`

The fn main(){ println!("{:?}",{ is irrelevant to my mistake and is just noise when you're trying to parse the error output. By putting the provided code on its own line, you could instead get an error message like

error[E0308]: mismatched types
 --> src/main.rs:2:5
  |
2 | let () = 1;
  |     ^^   - this expression has type `{integer}`
  |     |
  |     expected integer, found `()`

(I produced this second output by doing ?eval with a code block with a blank line before the code itself.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant