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

Match operand expected permissions doesn't match branches #100

Open
willcrichton opened this issue Aug 8, 2023 · 1 comment
Open

Match operand expected permissions doesn't match branches #100

willcrichton opened this issue Aug 8, 2023 · 1 comment
Assignees
Labels
bug Something isn't working permissions

Comments

@willcrichton
Copy link
Collaborator

This program:

fn main() {
let opt: Option<String> = 
    Some(String::from("Hello world"));

match opt {
    Some(_) => println!("Some!"),
    None => println!("None!")
};

println!("{:?}", opt);
}

Is visualized with these permission:

Screen Shot 2023-08-08 at 3 48 30 PM

The match on opt should not require the own permission. Case in point, if you do let x = &opt and x is live across the match, the program still compiles.

@willcrichton willcrichton added bug Something isn't working interpreter labels Aug 8, 2023
@gavinleroy gavinleroy self-assigned this Aug 11, 2023
@willcrichton
Copy link
Collaborator Author

Core issue is that match operand really only expects R for the discriminant operation. Any additional permission expectations should be placed on the patterns where things get bound.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working permissions
Projects
None yet
Development

No branches or pull requests

2 participants