Skip to content

Type parameters on static methods don't work right #4096

Closed
@brson

Description

@brson

This test specifies the type parameters to from_inty but rustc says it didn't.

pub trait Nummy {
    static pure fn from_inty<T>() -> self;
}

impl float: Nummy {
    static pure fn from_inty<T>() -> float { 0.0 }
}

fn main() {
    let _1:float = Nummy::from_inty::<int>(1i);
}
/home/brian/dev/rust/src/test/run-pass/test.rs:10:19: 10:42 error: not enough type parameters provided for this item
/home/brian/dev/rust/src/test/run-pass/test.rs:10     let _1:float = Nummy::from_inty::<int>(1i);
                                                                     ^~~~~~~~~~~~~~~~~~~~~~~
/home/brian/dev/rust/src/test/run-pass/test.rs:10:19: 10:47 error: this function takes 0 parameters but 1 parameter was supplied
/home/brian/dev/rust/src/test/run-pass/test.rs:10     let _1:float = Nummy::from_inty::<int>(1i);
                                                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: aborting due to 2 previous errors

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions