Open
Description
Code
This code is wrong, it lacks an open "(" to call abs():
pub fn foo(x: i64) -> i64 {
x.abs)
}
fn main() {}
Current output
rustc 1.87.0-nightly gives the error messages:
error: mismatched closing delimiter: `)`
--> ...\test.rs:1:27
|
1 | pub fn foo(x: i64) -> i64 {
| ^ unclosed delimiter
2 | x.abs)
| ^ mismatched closing delimiter
error: unexpected closing delimiter: `}`
--> ...\test.rs:3:1
|
2 | x.abs)
| - missing open `(` for this delimiter
3 | }
| ^ unexpected closing delimiter
error: aborting due to 2 previous errors
Desired output
On this code I'd like rustc to give only one error, that says "- missing open (
for this delimiter", or something similar.
Rationale and extra context
I think rustc should consider {} () [] as totally distinct pairs of things. I think it isn't common for a programmer to mix them by mistake. It happens, but I think it happens quite less often than missing a correct pairing of { with } or ( with ) or [ with ] by mistake.
Other cases
Rust Version
rustc 1.87.0-nightly (665025243 2025-03-11)
binary: rustc
commit-hash: 6650252439d4e03368b305c42a10006e36f1545e
commit-date: 2025-03-11
host: x86_64-pc-windows-gnu
release: 1.87.0-nightly
LLVM version: 20.1.0
Anything else?
No response