File tree 1 file changed +15
-3
lines changed
1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -218,7 +218,14 @@ match x {
218
218
E0010 : r##"
219
219
The value of statics and constants must be known at compile time, and they live
220
220
for the entire lifetime of a program. Creating a boxed value allocates memory on
221
- the heap at runtime, and therefore cannot be done at compile time.
221
+ the heap at runtime, and therefore cannot be done at compile time. Erroneous
222
+ code example:
223
+
224
+ ```
225
+ #![feature(box_syntax)]
226
+
227
+ const CON : Box<i32> = box 0;
228
+ ```
222
229
"## ,
223
230
224
231
E0011 : r##"
@@ -335,7 +342,6 @@ is not allowed.
335
342
336
343
If you really want global mutable state, try using `static mut` or a global
337
344
`UnsafeCell`.
338
-
339
345
"## ,
340
346
341
347
E0018 : r##"
@@ -399,7 +405,13 @@ fn main() {
399
405
400
406
E0020 : r##"
401
407
This error indicates that an attempt was made to divide by zero (or take the
402
- remainder of a zero divisor) in a static or constant expression.
408
+ remainder of a zero divisor) in a static or constant expression. Erroneous
409
+ code example:
410
+
411
+ ```
412
+ const X: i32 = 42 / 0;
413
+ // error: attempted to divide by zero in a constant expression
414
+ ```
403
415
"## ,
404
416
405
417
E0022 : r##"
You can’t perform that action at this time.
0 commit comments