Skip to content

Default type parameters are handled improperly when calling methods #26634

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

Closed
Tobba opened this issue Jun 28, 2015 · 2 comments
Closed

Default type parameters are handled improperly when calling methods #26634

Tobba opened this issue Jun 28, 2015 · 2 comments
Labels
A-inference Area: Type inference A-type-system Area: Type system C-bug Category: This is a bug. T-lang Relevant to the language team, which will review and decide on the PR/issue.

Comments

@Tobba
Copy link
Contributor

Tobba commented Jun 28, 2015

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
}
@steveklabnik steveklabnik added the A-type-system Area: Type system label Jun 29, 2015
@steveklabnik
Copy link
Member

Triage: still relevant today

@Mark-Simulacrum Mark-Simulacrum added A-inference Area: Type inference C-bug Category: This is a bug. labels Jul 22, 2017
@jonas-schievink jonas-schievink added the T-lang Relevant to the language team, which will review and decide on the PR/issue. label Jun 6, 2019
@jonas-schievink
Copy link
Contributor

This now fails to compile with "defaults for type parameters are only allowed in struct, enum, type, or trait definitions". We might want to close this just like #26633.

@cjgillot cjgillot closed this as completed Mar 5, 2022
@fmease fmease added A-type-system Area: Type system and removed A-type-system Area: Type system labels Dec 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-inference Area: Type inference A-type-system Area: Type system C-bug Category: This is a bug. T-lang Relevant to the language team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

6 participants