Skip to content

fn f(*) {} successfully compiles in method position #33413

Closed
@petrochenkov

Description

@petrochenkov
struct S {
    lol: u8
}

impl S {
    fn f(*) -> u8 {
        self.lol
    }
}

fn main() {
    println!("{}", S{lol:10}.f());
}

prints 10 on stable/beta/nightly.

This is the coolest syntax I've seen this year, now I'll always use * instead of self to save 3 keystrokes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions