Skip to content

docs(ch04-02): clarify reference scope vs variable scope (#4706) - #4778

Open
Dodothereal wants to merge 1 commit into
rust-lang:mainfrom
Dodothereal:fix/issue-4706-reference-scope-clarification
Open

docs(ch04-02): clarify reference scope vs variable scope (#4706)#4778
Dodothereal wants to merge 1 commit into
rust-lang:mainfrom
Dodothereal:fix/issue-4706-reference-scope-clarification

Conversation

@Dodothereal

Copy link
Copy Markdown
Contributor

Fixes #4706

Summary

Chapter 4-2 introduces a non-lexical-lifetime-style scope for
references but does not flag the shift away from the lexical scope
used for variables in earlier chapters. Beginners coming from
other languages may conflate the two meanings.

This commit prepends one sentence that makes the distinction
explicit, leaving the substantive explanation unchanged.

Test plan

  • git diff: single file, 6 insertions, 4 deletions
  • left dprint fmt untouched (no other files changed)

AI assistance

Prepared with help from an AI coding assistant.

Fixes rust-lang#4706: the phrase 'a reference's scope starts from where it is
introduced' implicitly shifts the meaning of the word 'scope' from
the lexical (curly-bracket) scope used for variables to the
non-lexical lifetime-style scope used for references. Without
acknowledging the shift, beginners may conflate the two.

Prepend one sentence to the existing paragraph to make the
distinguishing factor explicit.
@Dodothereal

Copy link
Copy Markdown
Contributor Author

Hi, just a gentle ping on this in case it slipped through - no rush at all. Happy to rebase, split, or adjust anything if that helps. Thanks for maintaining this project.

@rltq

rltq commented Aug 14, 2026

Copy link
Copy Markdown

Hi, according to contributing note, "it may take longer than you're used to for us to address your issue or pull request." because they "want to keep the online version of the book close to the print version when possible"

I've seen you made several new PRs(including other issues) which are duplicated, it would be better to comment on their PR if you have better suggestions, since there are plenty of works to do of maintainers as you said

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ch04: clarify the difference between variable scope and reference scope

2 participants