]> git.lizzy.rs Git - rust.git/blob - tests/ui/array-slice-vec/mutability-inherits-through-fixed-length-vec.rs
Rollup merge of #106726 - cmorin6:fix-comment-typos, r=Nilstrieb
[rust.git] / tests / ui / array-slice-vec / mutability-inherits-through-fixed-length-vec.rs
1 // run-pass
2
3
4 fn test1() {
5     let mut ints = [0; 32];
6     ints[0] += 1;
7     assert_eq!(ints[0], 1);
8 }
9
10 fn test2() {
11     let mut ints = [0; 32];
12     for i in &mut ints { *i += 22; }
13     for i in &ints { assert_eq!(*i, 22); }
14 }
15
16 pub fn main() {
17     test1();
18     test2();
19 }