multiple mutable borrow error with get_mut #75112
Labels
A-borrow-checker
Area: The borrow checker
C-bug
Category: This is a bug.
fixed-by-polonius
Compiling with `-Zpolonius` fixes this issue.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
I tried this code:
I expected to see this happen: Code should compile because the latter
get_mut
calls don't overlap with preceding ones.Instead, this happened: Got following error
It works if I comment the if condition inside the second
if let
:if I comment the last
if let
, then also it works:So there are still multiple mutable borrows but it works for those cases. But why not in the first case? Is it incorrect borrowing pattern somehow that I am not seeing?
Meta
rustc --version --verbose
:Thanks
The text was updated successfully, but these errors were encountered: