mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-24 07:44:10 +00:00
11 lines
250 B
Rust
11 lines
250 B
Rust
use std::iter::repeat;
|
|
|
|
fn main() {
|
|
let mut vector = vec![1, 2];
|
|
for &x in &vector {
|
|
let cap = vector.capacity();
|
|
vector.extend(repeat(0)); //~ ERROR cannot borrow
|
|
vector[1] = 5; //~ ERROR cannot borrow
|
|
}
|
|
}
|