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

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

Closed
okaneco opened this issue Sep 24, 2024 · 1 comment · Fixed by #130870
Closed
Assignees
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-parser Area: The parsing of Rust source code to an AST T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@okaneco
Copy link
Contributor

okaneco commented Sep 24, 2024

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

@okaneco okaneco added A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 24, 2024
@fmease fmease added the A-parser Area: The parsing of Rust source code to an AST label Sep 24, 2024
@surechen
Copy link
Contributor

@rustbot claim

surechen added a commit to surechen/rust that referenced this issue Sep 27, 2024
…efinition.

for example: `fn invalid_path_separator::<T>() {}`

fixes: rust-lang#130791
surechen added a commit to surechen/rust that referenced this issue Sep 27, 2024
…efinition.

for example: `fn invalid_path_separator::<T>() {}`

fixes: rust-lang#130791
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Oct 12, 2024
…rors

Add suggestion for removing invalid path sep `::` in fn def

Add suggestion for removing invalid path separator `::` in function definition.

for example: `fn invalid_path_separator::<T>() {}`

fixes rust-lang#130791
tgross35 added a commit to tgross35/rust that referenced this issue Oct 12, 2024
…rors

Add suggestion for removing invalid path sep `::` in fn def

Add suggestion for removing invalid path separator `::` in function definition.

for example: `fn invalid_path_separator::<T>() {}`

fixes rust-lang#130791
@bors bors closed this as completed in d016595 Oct 12, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Oct 12, 2024
Rollup merge of rust-lang#130870 - surechen:fix_130791, r=compiler-errors

Add suggestion for removing invalid path sep `::` in fn def

Add suggestion for removing invalid path separator `::` in function definition.

for example: `fn invalid_path_separator::<T>() {}`

fixes rust-lang#130791
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-parser Area: The parsing of Rust source code to an AST T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants