From 47da9b1285e037f8801beeacaab8c5cd5e5d35c6 Mon Sep 17 00:00:00 2001 From: Paul Date: Thu, 13 Apr 2023 15:40:52 +0200 Subject: [PATCH] Fixed logical mistake ``` //let xr = &mut x; // Error - there is already an immutable ref, so we ``` Should be xr1 (or any other name here), with just xr it will compile just fine --- borrowed.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/borrowed.md b/borrowed.md index 143ce30..04ecedf 100644 --- a/borrowed.md +++ b/borrowed.md @@ -67,7 +67,7 @@ fn foo() { let mut x = 5; let xr = &x; // Ok (creates an immutable ref) //*xr = 4; // Error - mutating immutable ref - //let xr = &mut x; // Error - there is already an immutable ref, so we + //let xr1 = &mut x; // Error - there is already an immutable ref, so we // can't make a mutable one let mut x = 5;