Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
simonegazza opened this issue Jul 20, 2022 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@simonegazza
Copy link
Collaborator

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);
    }
}
@simonegazza simonegazza added the enhancement New feature or request label Jul 20, 2022
@simonegazza simonegazza self-assigned this Jul 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant