summary refs log tree commit diff
path: root/src/test/compile-fail/reference-in-loop.rs
blob: 403e0bb07cb78134ab561b7ee03f1160957c8848 (plain)
1
2
3
4
5
6
7
8
9
10
// error-pattern: overwriting x will invalidate reference y

fn main() {
    let x = [];
    let &y = x;
    while true {
        log(error, y);
        x = [1];
    }
}