Skip to content

Unhelpful "add a parameter list" suggestion for double colons in generic function definition #130791

Closed
@okaneco

Description

@okaneco

Code

fn test::<T>() {}

Current output

error: missing parameters for function definition
 --> src/lib.rs:1:8
  |
1 | fn test::<T>() {}
  |        ^
  |
help: add a parameter list
  |
1 | fn test()::<T>() {}
  |        ++

error: expected one of `->`, `<`, `where`, or `{`, found `::`
 --> src/lib.rs:1:8
  |
1 | fn test::<T>() {}
  |        ^^ expected one of `->`, `<`, `where`, or `{`

error: could not compile `playground` (lib) due to 2 previous errors

Desired output

error: *TBD*
 --> src/lib.rs:1:8
  |
1 | fn test::<T>() {}
  |        ^
  |
help: remove the double colons
  |
1 | fn test<T>() {}
  |

error: expected one of `->`, `<`, `where`, or `{`, found `::`
 --> src/lib.rs:1:8
  |
1 | fn test::<T>() {}
  |        ^^ expected one of `->`, `<`, `where`, or `{`

error: could not compile `playground` (lib) due to 2 previous errors

Rationale and extra context

No response

Other cases

No response

Rust Version

Playground nightly, I don't see a way to verbosely print this information.

1.83.0-nightly (2024-09-23 7042c269c)

Anything else?

No response

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsA-parserArea: The lexing & parsing of Rust source code to an ASTT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions