Skip to content

Commit d29dd5e

Browse files
authored
19.2 Vectors Error in Code Example
https://doc.rust-lang.org/1.29.2/rust-by-example/std/vec.html Code contain an error in the following places: Line number 3: let collected_iterator: Vec = (0..10).collect(); Should be: let mut collected_iterator: Vec = (0..10).collect(); Or else Line number16 can't borrow mutably
1 parent 1ff0f8e commit d29dd5e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/std/vec.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ be surpassed, the vector is reallocated with a larger capacity.
1010
```rust,editable,ignore,mdbook-runnable
1111
fn main() {
1212
// Iterators can be collected into vectors
13-
let collected_iterator: Vec<i32> = (0..10).collect();
13+
let mut collected_iterator: Vec<i32> = (0..10).collect();
1414
println!("Collected (0..10) into: {:?}", collected_iterator);
1515
1616
// The `vec!` macro can be used to initialize a vector

0 commit comments

Comments
 (0)