rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
98.35k stars 12.72k forks source link

Unhelpful error with braces after type in parameters #111109

Open asquared31415 opened 1 year ago

asquared31415 commented 1 year ago

Code

fn uwu<T>(x: T{}) {}

Current output

error: expected parameter name, found `{`
 --> src/lib.rs:1:15
  |
1 | fn uwu<T>(x: T{}) {}
  |               ^ expected parameter name

error: expected one of `!`, `(`, `)`, `+`, `,`, `::`, or `<`, found `{`
 --> src/lib.rs:1:15
  |
1 | fn uwu<T>(x: T{}) {}
  |               ^
  |               |
  |               expected one of 7 possible tokens
  |               help: missing `,`

Desired output

No response

Rationale and extra context

No response

Other cases

No response

Anything else?

No response

Noratrieb commented 1 year ago

What error would you expect? T {} is not a valid type, maybe it should suggest just removing the braces?