Skip to content

Commit f483aa3

Browse files
committed
auto merge of #14102 : moonglum/rust/slice-clarification-in-readme, r=kballard
There are no arrays in Rust, they are slices. Especially in the tutorial beginners should not be confused with wrong terminology. It helps to know the right names for things when you want to find something in the documentation. @erickt explained that today to me and it helped me a lot when getting started 😉 Maybe we should also explain what a slice and what a vector is in the tutorial. If you like that, I will try to do that and attach that to the pull request 😉
2 parents 20356e4 + 1895ad2 commit f483aa3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/doc/tutorial.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -2385,7 +2385,7 @@ fn print_all<T: Printable>(printable_things: ~[T]) {
23852385
Declaring `T` as conforming to the `Printable` trait (as we earlier
23862386
did with `Clone`) makes it possible to call methods from that trait
23872387
on values of type `T` inside the function. It will also cause a
2388-
compile-time error when anyone tries to call `print_all` on an array
2388+
compile-time error when anyone tries to call `print_all` on a vector
23892389
whose element type does not have a `Printable` implementation.
23902390

23912391
Type parameters can have multiple bounds by separating them with `+`,
@@ -2428,9 +2428,9 @@ fn draw_all<T: Drawable>(shapes: ~[T]) {
24282428
# draw_all(~[c]);
24292429
~~~~
24302430

2431-
You can call that on an array of circles, or an array of rectangles
2431+
You can call that on a vector of circles, or a vector of rectangles
24322432
(assuming those have suitable `Drawable` traits defined), but not on
2433-
an array containing both circles and rectangles. When such behavior is
2433+
a vector containing both circles and rectangles. When such behavior is
24342434
needed, a trait name can alternately be used as a type, called
24352435
an _object_.
24362436

0 commit comments

Comments
 (0)