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

Improve Borrow Checker to Handle Scopes and Borrow Checking #12

Merged
merged 1 commit into from
Jun 15, 2023

Conversation

notJoon
Copy link
Owner

@notJoon notJoon commented Jun 15, 2023

  1. Handle multiple immutable borrows: The BorrowChecker now allows multiple immutable borrows of the same variable, aligning with Rust's borrow rules. In short, no longer returns an error when a variable is immutably borrowed multiple times.

  2. Handle scopes correctly: The BorrowChecker now correctly handles variables declared in outer scopes when checking inner scopes. It uses a stack of scopes, each represented as a hashmap. When entering a new scope, it pushes a new hashmap onto the stack, and when leaving a scope, it pops the hashmap off the stack.

  3. Add more test cases

@notJoon notJoon added bug Something isn't working enhancement New feature or request labels Jun 15, 2023
@notJoon notJoon merged commit da3b2be into main Jun 15, 2023
1 check passed
@notJoon notJoon deleted the support-borrow-checking-in-nested-scope branch June 15, 2023 03:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant