Skip to content

docs(ch04-02): clarify slice is a type, not a kind of reference (#4768)#4785

Open
Dodothereal wants to merge 1 commit into
rust-lang:mainfrom
Dodothereal:fix/issue-4768-slice-not-a-reference
Open

docs(ch04-02): clarify slice is a type, not a kind of reference (#4768)#4785
Dodothereal wants to merge 1 commit into
rust-lang:mainfrom
Dodothereal:fix/issue-4768-slice-not-a-reference

Conversation

@Dodothereal

Copy link
Copy Markdown

Closes #4768

Summary

Replace the section trailer

Next, we'll look at a different kind of reference: slices.

with

Next, we'll look at a different type: slices, which are often used behind a reference.

Slices are a dynamically sized type ([T]), not a kind of reference. The
section 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 just mdbook build) recompiles the chapter without
    warnings; the changed line is prose-only.

AI assistance

Drafted with assistance from Claude; reviewed line by line before
submission.

…-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
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.

Definition of slices does not match the rust reference

1 participant