Skip to content

Methods with explicit self can be called on structs that don't match that type #3268

Closed
@msullivan

Description

@msullivan

The following code compiles and segfaults

struct thing {
    x: int;
    new () { self.x = 0; }
    fn foo(@self) -> int { self.x }
}

fn main() {
    let z = thing();
    z.foo();
}

it should be rejected

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