rust-lang / rust-lang/rust

Missing turbofish in nested type params has terse diagnostic

Open
#159,745 2 comments 0 reactions 1 assignee View on GitHub

@martonmoro is already working on this.

Since Jul 27, 2026.

A-diagnostics A-parser D-lack-of-suggestion D-papercut D-terse E-easy P-low T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

Code
fn main() {
    let _ = bar(Many<i32, Many<(), i32, S, S>, i32, i32>::new());
}

struct Many<A, B, C, D> {
    a: A, b: B, c: C, d: D,
}
impl<A, B, C, D> Many<A, B, C, D> {
    fn new() -> Self { todo!() }
}
fn bar<T>(_: Many<T, T, T, T>) {}
Current output
error: expected expression, found `,`
  --> tests/ui/suggestions/suggest-turbofish-parsed-as-comparisons.rs:28:46
   |
28 |     let _ = bar(Many<i32, Many<(), i32, S, S>, i32, i32>::new());
   |                                              ^ expected expression
Desired output
error: expected expression, found `,`
  --> tests/ui/suggestions/suggest-turbofish-parsed-as-comparisons.rs:28:46
   |
28 |     let _ = bar(Many<i32, Many<(), i32, S, S>, i32, i32>::new());
   |                                              ^ expected expression
help: you might have meant to write a "turbofish" `::<>`
   |
28 |     let _ = bar(Many::<i32, Many<(), i32, S, S>, i32, i32>::new());
   |                     ++
Rationale and extra context

The parse error provides no guidance to what the actual problem is.

Other cases

Rust Version
1.97
Anything else?

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.