From 7f4d97428d73f057b604c7b5a2b46f2f2b37490c Mon Sep 17 00:00:00 2001 From: rltq Date: Tue, 7 Apr 2026 06:49:43 +0900 Subject: [PATCH] Ch. 4: Clarify definition on reference/variable scope (#4706) --- src/ch04-02-references-and-borrowing.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ch04-02-references-and-borrowing.md b/src/ch04-02-references-and-borrowing.md index 8c37601d57..cea15156c1 100644 --- a/src/ch04-02-references-and-borrowing.md +++ b/src/ch04-02-references-and-borrowing.md @@ -171,8 +171,10 @@ from under them! However, multiple immutable references are allowed because no one who is just reading the data has the ability to affect anyone else’s reading of the data. -Note that a reference’s scope starts from where it is introduced and continues -through the last time that reference is used. For instance, this code will +Note that a reference's scope is different from the variable scope we discussed +earlier. While a variable's scope extends to the end of the block where it is declared, +a reference's scope starts from where it is introduced and continues through +the last time that reference is used. For instance, this code will compile because the last usage of the immutable references is in the `println!`, before the mutable reference is introduced: