Skip to content

doc: more consistent comments about vector types. #11796

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions doc/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -1545,7 +1545,7 @@ elements are mutable if the vector is mutable. Fixed-size strings do not exist.
let numbers = [1, 2, 3];
let more_numbers = numbers;

// The type of a fixed-size vector is written as `[Type, ..length]`
// The type of a fixed-size vector is written as [Type, ..length]
let five_zeroes: [int, ..5] = [0, ..5];
~~~

Expand All @@ -1559,7 +1559,7 @@ let mut numbers = ~[1, 2, 3];
numbers.push(4);
numbers.push(5);

// The type of a unique vector is written as ~[int]
// The type of a unique vector is written as ~[Type]
let more_numbers: ~[int] = numbers;

// The original `numbers` value can no longer be used, due to move semantics.
Expand All @@ -1576,7 +1576,7 @@ the elements.
// A slice
let xs = &[1, 2, 3];

// Slices have their type written as &[int]
// Slices have their type written as &[Type]
let ys: &[int] = xs;

// Other vector types coerce to slices
Expand All @@ -1600,7 +1600,7 @@ let mut xs = [1, 2, 3];
let view = xs.mut_slice(0, 2);
view[0] = 5;

// The type of a mutable slice is written as &mut [T]
// The type of a mutable slice is written as &mut [Type]
let ys: &mut [int] = &mut [1, 2, 3];
~~~

Expand Down