1- error: function or method calls as the initial value in zero-sized array initializers may cause side effects
1+ error: expression with side effects as the initial value in a zero-sized array initializer
22 --> tests/ui/zero_repeat_side_effects.rs:16:5
33 |
44LL | let a = [f(); 0];
@@ -12,7 +12,7 @@ LL - let a = [f(); 0];
1212LL + f(); let a: [i32; 0] = [];
1313 |
1414
15- error: function or method calls as the initial value in zero-sized array initializers may cause side effects
15+ error: expression with side effects as the initial value in a zero-sized array initializer
1616 --> tests/ui/zero_repeat_side_effects.rs:19:5
1717 |
1818LL | b = [f(); 0];
@@ -24,7 +24,7 @@ LL - b = [f(); 0];
2424LL + f(); b = [] as [i32; 0];
2525 |
2626
27- error: function or method calls as the initial value in zero-sized array initializers may cause side effects
27+ error: expression with side effects as the initial value in a zero-sized array initializer
2828 --> tests/ui/zero_repeat_side_effects.rs:24:5
2929 |
3030LL | let c = vec![f(); 0];
@@ -36,7 +36,7 @@ LL - let c = vec![f(); 0];
3636LL + f(); let c: std::vec::Vec<i32> = vec![];
3737 |
3838
39- error: function or method calls as the initial value in zero-sized array initializers may cause side effects
39+ error: expression with side effects as the initial value in a zero-sized array initializer
4040 --> tests/ui/zero_repeat_side_effects.rs:27:5
4141 |
4242LL | d = vec![f(); 0];
@@ -48,7 +48,7 @@ LL - d = vec![f(); 0];
4848LL + f(); d = vec![] as std::vec::Vec<i32>;
4949 |
5050
51- error: function or method calls as the initial value in zero-sized array initializers may cause side effects
51+ error: expression with side effects as the initial value in a zero-sized array initializer
5252 --> tests/ui/zero_repeat_side_effects.rs:31:5
5353 |
5454LL | let e = [println!("side effect"); 0];
@@ -60,7 +60,7 @@ LL - let e = [println!("side effect"); 0];
6060LL + println!("side effect"); let e: [(); 0] = [];
6161 |
6262
63- error: function or method calls as the initial value in zero-sized array initializers may cause side effects
63+ error: expression with side effects as the initial value in a zero-sized array initializer
6464 --> tests/ui/zero_repeat_side_effects.rs:35:5
6565 |
6666LL | let g = [{ f() }; 0];
@@ -72,7 +72,7 @@ LL - let g = [{ f() }; 0];
7272LL + { f() }; let g: [i32; 0] = [];
7373 |
7474
75- error: function or method calls as the initial value in zero-sized array initializers may cause side effects
75+ error: expression with side effects as the initial value in a zero-sized array initializer
7676 --> tests/ui/zero_repeat_side_effects.rs:39:10
7777 |
7878LL | drop(vec![f(); 0]);
@@ -84,7 +84,7 @@ LL - drop(vec![f(); 0]);
8484LL + drop({ f(); vec![] as std::vec::Vec<i32> });
8585 |
8686
87- error: function or method calls as the initial value in zero-sized array initializers may cause side effects
87+ error: expression with side effects as the initial value in a zero-sized array initializer
8888 --> tests/ui/zero_repeat_side_effects.rs:43:5
8989 |
9090LL | vec![f(); 0];
@@ -96,7 +96,7 @@ LL - vec![f(); 0];
9696LL + { f(); vec![] as std::vec::Vec<i32> };
9797 |
9898
99- error: function or method calls as the initial value in zero-sized array initializers may cause side effects
99+ error: expression with side effects as the initial value in a zero-sized array initializer
100100 --> tests/ui/zero_repeat_side_effects.rs:45:5
101101 |
102102LL | [f(); 0];
@@ -108,5 +108,29 @@ LL - [f(); 0];
108108LL + { f(); [] as [i32; 0] };
109109 |
110110
111- error: aborting due to 9 previous errors
111+ error: expression with side effects as the initial value in a zero-sized array initializer
112+ --> tests/ui/zero_repeat_side_effects.rs:99:10
113+ |
114+ LL | foo(&[Some(f()); 0]);
115+ | ^^^^^^^^^^^^^^
116+ |
117+ help: consider performing the side effect separately
118+ |
119+ LL - foo(&[Some(f()); 0]);
120+ LL + foo(&{ Some(f()); [] as [std::option::Option<i32>; 0] });
121+ |
122+
123+ error: expression with side effects as the initial value in a zero-sized array initializer
124+ --> tests/ui/zero_repeat_side_effects.rs:101:10
125+ |
126+ LL | foo(&[Some(Some(S::new())); 0]);
127+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
128+ |
129+ help: consider performing the side effect separately
130+ |
131+ LL - foo(&[Some(Some(S::new())); 0]);
132+ LL + foo(&{ Some(Some(S::new())); [] as [std::option::Option<std::option::Option<S>>; 0] });
133+ |
134+
135+ error: aborting due to 11 previous errors
112136
0 commit comments