Closed
Description
Code
struct Wrong {
x: 1,
}
fn oops(w: &Wrong) {
w.x;
}
Current output
Compiling playground v0.0.1 (/playground)
error: expected type, found `1`
--> src/lib.rs:2:8
|
1 | struct Wrong {
| ----- while parsing this struct
2 | x: 1,
| ^ expected type
error[E0609]: no field `x` on type `&Wrong`
--> src/lib.rs:6:7
|
6 | w.x;
| ^ unknown field
For more information about this error, try `rustc --explain E0609`.
error: could not compile `playground` (lib) due to 2 previous errors
Desired output
Compiling playground v0.0.1 (/playground)
error: expected type, found `1`
--> src/lib.rs:2:8
|
1 | struct Wrong {
| ----- while parsing this struct
2 | x: 1,
| ^ expected type
For more information about this error, try `rustc --explain E0609`.
error: could not compile `playground` (lib) due to 2 previous errors
Rationale and extra context
this can lead to an unmanageably large number of errors if there is a syntactic error in a struct that is used frequently throughout a crate, potentially even thousands of lines.
Other cases
No response
Rust Version
rustc 1.80.0-nightly (debd22da6 2024-05-29)
binary: rustc
commit-hash: debd22da66cfa97c74040ebf68e420672ac8560e
commit-date: 2024-05-29
host: x86_64-unknown-linux-gnu
release: 1.80.0-nightly
LLVM version: 18.1.6
Anything else?
No response