summaryrefslogtreecommitdiffstats
path: root/tests/ui/for-loop-while/foreach-external-iterators-nested.rs
blob: 8a95f160a1ace581fef6dee9dba378c57c697aba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// run-pass

pub fn main() {
    let x = [1; 100];
    let y = [2; 100];
    let mut p = 0;
    let mut q = 0;
    for i in &x[..] {
        for j in &y[..] {
            p += *j;
        }
        q += *i + p;
    }
    assert_eq!(q, 1010100);
}