Skip to content

docs(ch02): clarify String is heap-allocated (#4758)#4776

Open
Dodothereal wants to merge 1 commit into
rust-lang:mainfrom
Dodothereal:fix/issue-4758-string-clarification
Open

docs(ch02): clarify String is heap-allocated (#4758)#4776
Dodothereal wants to merge 1 commit into
rust-lang:mainfrom
Dodothereal:fix/issue-4758-string-clarification

Conversation

@Dodothereal

Copy link
Copy Markdown

Fixes #4758

Summary

The phrase 'a growable, UTF-8 encoded bit of text' in Chapter 2 is
grammatically ambiguous: 'growable' can be read as modifying 'bit of
text', which can mislead learners into thinking the value is mutable
by default. Adding 'heap-allocated' shifts the mental model to the
container while keeping the substantive content the same.

A one-word prepended qualifier is the minimum change that addresses
the issue's framing without rewriting the sentence structure.

Test plan

  • git diff reviewed: single-file, single-line change, no whitespace drift.
  • dprint on the touched file reports pre-existing whitespace
    issues that exist in upstream main on multiple files. The fixed
    sentence is closer to dprint's expected layout than upstream; no
    additional formatting was applied to avoid touching unrelated files.

AI assistance

Prepared with help from an AI coding assistant; reviewed end-to-end
before submission.

Fixes rust-lang#4758: the original phrasing 'a growable, UTF-8 encoded bit of
text' is grammatically ambiguous: 'growable' is parsed as modifying
'bit of text', which can mislead learners into believing the value is
mutable by default. Prepending 'heap-allocated' shifts the mental
model to the container while keeping the substantive content the same.

Pre-existing-comment-link targets retained.
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.

Clarification needed for String definition in Chapter 2: Storing Values with Variables

1 participant