rust/tests/ui/borrowck/borrowck-for-loop-head-linkage.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

11 lines
250 B
Rust
Raw Normal View History

use std::iter::repeat;
fn main() {
let mut vector = vec![1, 2];
2015-01-31 11:20:46 -06:00
for &x in &vector {
let cap = vector.capacity();
vector.extend(repeat(0)); //~ ERROR cannot borrow
vector[1] = 5; //~ ERROR cannot borrow
}
}