docs(ch04-02): clarify slice is a type, not a kind of reference (#4768)#4785
Open
Dodothereal wants to merge 1 commit into
Open
docs(ch04-02): clarify slice is a type, not a kind of reference (#4768)#4785Dodothereal wants to merge 1 commit into
Dodothereal wants to merge 1 commit into
Conversation
…-lang#4768) Slices are a dynamically sized type (DST), not a kind of reference. The trailer of the section ("Next, we'll look at a different kind of reference: slices") mischaracterises the slice — it's the type on the right of a & borrow, not a reference itself. Replace with: "Next, we'll look at a different type: slices, which are often used behind a reference." Closes rust-lang#4768
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #4768
Summary
Replace the section trailer
with
Slices are a dynamically sized type (
[T]), not a kind of reference. Thesection header just below this line calls them "Reference and Borrowing";
readers coming out of this chapter expect slices to be a flavor of
&T, but they're actually a DST that lives "behind" a shared reference.This phrasing matches the issue suggester's recommended wording and is
consistent with the existing reference pages:
Test plan
mdbook test(or justmdbook build) recompiles the chapter withoutwarnings; the changed line is prose-only.
AI assistance
Drafted with assistance from Claude; reviewed line by line before
submission.