Skip to content

[BUG] Check weather a not-declared field of a struct (or struct enum) is assignable #41

@simonegazza

Description

@simonegazza

Description
Currently there is no check for a field of a struct to be in the struct itself. This check can (and should) be done with static semantics.

For example, this code should raise an error:

enum Message {
    Move { x: i32, y: i32 },
}

fn main() {
    let m = Message::Move {x : 1, y : 2};
    if let Message::Move{ x: a, z: b} = m2{
        println!("{}", a);
        println!("{}", b);
    }
}

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions