Hello, today we've found some weird behaviour of array indexing.
Here is the example
Code snippet:
fn foo<'a>(a1: &'a mut Bar, a2: &'a mut Bar)
{
let a = [a1, a2];
for i in 0..42
{
let index = i % 2;
//a[i % 2].bar(); //<= error
a[index].bar(); //<= no error
}
}
The question is, why is the indexing operator behaves depending on whether we evaluate index in place or not.
Hello, today we've found some weird behaviour of array indexing.
Here is the example
Code snippet:
The question is, why is the indexing operator behaves depending on whether we evaluate
indexin place or not.