Skip to content

Allow less than all the generic parameters to be specified #1989

@strega-nil

Description

@strega-nil
fn foo<T, U>(u: U) -> T
  where T: From<U>
{
  From::from(u)
}

fn main() {
  println!("{}", foo(0u16): u16); // works
  println!("{}", foo::<u16>(0u16)); // doesn't work
  println!("{}", foo::<u16, _>(0u16)); // works
  println!("{}", foo::<u16, u16>(0u16)); // works
}

I want the second one to work (and to be equivalent to the third). There's no real reason for it not to, and it does work in C++.

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-langRelevant to the language team, which will review and decide on the RFC.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions