Skip to content

Suggest appropriate place for type argument after associated type #57385

Closed
@estebank

Description

@estebank

Like we do for lifetimes, suggest the appropriate place for type arguments written after associated an type.

Given

trait Trait<T> { type Item; }
pub fn test<W, I: Trait<Item=(), W> >() {}
fn main() { }

we currently emit

error: type parameters must be declared prior to associated type bindings
  --> $DIR/issue-32214.rs:5:34
   |
LL | pub fn test<W, I: Trait<Item=(), W> >() {}
   |                                  ^

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions