diff options
Diffstat (limited to 'tests/ui/borrowck/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.rs')
-rw-r--r-- | tests/ui/borrowck/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/ui/borrowck/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.rs b/tests/ui/borrowck/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.rs new file mode 100644 index 000000000..97107c2e3 --- /dev/null +++ b/tests/ui/borrowck/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.rs @@ -0,0 +1,10 @@ +fn main() { + let mut _a = 3; + let b = &mut _a; + { + let c = &*b; + _a = 4; //~ ERROR cannot assign to `_a` because it is borrowed + drop(c); + } + drop(b); +} |