summaryrefslogtreecommitdiffstats
path: root/tests/ui/borrowck/borrowck-for-loop-head-linkage.rs
blob: a84b695aafb8b2a6ea68cc9a3dbd3654b237525a (plain)
1
2
3
4
5
6
7
8
9
10
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
    }
}