Skip to content

Commit

Permalink
Add erroneous code example for E0010
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Sep 5, 2015
1 parent ec4ba27 commit 771ab35
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/librustc/diagnostics.rs
Expand Up @@ -218,7 +218,14 @@ match x {
E0010: r##"
The value of statics and constants must be known at compile time, and they live
for the entire lifetime of a program. Creating a boxed value allocates memory on
the heap at runtime, and therefore cannot be done at compile time.
the heap at runtime, and therefore cannot be done at compile time. Erroneous
code example:
```
#![feature(box_syntax)]
const CON : Box<i32> = box 0;
```
"##,

E0011: r##"
Expand Down Expand Up @@ -335,7 +342,6 @@ is not allowed.
If you really want global mutable state, try using `static mut` or a global
`UnsafeCell`.
"##,

E0018: r##"
Expand Down Expand Up @@ -399,7 +405,13 @@ fn main() {

E0020: r##"
This error indicates that an attempt was made to divide by zero (or take the
remainder of a zero divisor) in a static or constant expression.
remainder of a zero divisor) in a static or constant expression. Erroneous
code example:
```
const X: i32 = 42 / 0;
// error: attempted to divide by zero in a constant expression
```
"##,

E0022: r##"
Expand Down

0 comments on commit 771ab35

Please sign in to comment.