Skip to content

Default type parameters are handled improperly when calling methods #26634

Closed
@Tobba

Description

@Tobba
pub trait Foo {
    type A;
}

pub trait Bar: Foo {
    fn foo<A, B=<Self as Foo>::A>(&self, a: A, b: B) { }
}

struct Baz;

impl Foo for Baz {
    type A = u32;
}

impl Bar for Baz { }

fn main() {
    let baz = Baz;
    Bar::foo::<u32>(&baz, 0, 0); // This works
    baz.foo::<u32>(0); // error: incorrect number of type parameters given for this method
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-inferenceArea: Type inferenceA-type-systemArea: Type systemC-bugCategory: This is a bug.T-langRelevant to the language team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions