Skip to content

Ability to specify self parameter in static method call #8888

Closed
@erickt

Description

@erickt

The commit 8693943 removed the ability for us to do:

trait SizeOf {
     fn size_of() -> uint { sys::size_of::<T>() } 
}

fn size_of<T: SizeOf>() -> uint {
    SizeOf::size_of::<T>()
}

@pcwalton has proposed that we add support for expressing the Self type of a static method with:

fn size_of<T: SizeOf>() -> uint {
    SizeOf::<for T>::size_of()
}

but I've heard that we haven't settled on this syntax yet.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions