@@ -18,7 +18,7 @@ for the entire lifetime of a program. Creating a boxed value allocates memory on
1818the heap at runtime, and therefore cannot be done at compile time. Erroneous
1919code example:
2020
21- ```compile_fail
21+ ```compile_fail,E0010
2222#![feature(box_syntax)]
2323
2424const CON : Box<i32> = box 0;
@@ -30,7 +30,7 @@ Static and const variables can refer to other const variables. But a const
3030variable cannot refer to a static variable. For example, `Y` cannot refer to
3131`X` here:
3232
33- ```compile_fail
33+ ```compile_fail,E0013
3434static X: i32 = 42;
3535const Y: i32 = X;
3636```
@@ -66,7 +66,7 @@ E0016: r##"
6666Blocks in constants may only contain items (such as constant, function
6767definition, etc...) and a tail expression. Erroneous code example:
6868
69- ```compile_fail
69+ ```compile_fail,E0016
7070const FOO: i32 = { let x = 0; x }; // 'x' isn't an item!
7171```
7272
@@ -81,7 +81,7 @@ E0017: r##"
8181References in statics and constants may only refer to immutable values.
8282Erroneous code example:
8383
84- ```compile_fail
84+ ```compile_fail,E0017
8585static X: i32 = 1;
8686const C: i32 = 2;
8787
@@ -107,7 +107,7 @@ vary.
107107
108108For example, if you write:
109109
110- ```compile_fail
110+ ```compile_fail,E0018
111111static MY_STATIC: u32 = 42;
112112static MY_STATIC_ADDR: usize = &MY_STATIC as *const _ as usize;
113113static WHAT: usize = (MY_STATIC_ADDR^17) + MY_STATIC_ADDR;
@@ -152,7 +152,7 @@ impl Test {
152152fn main() {
153153 const FOO: Test = Test::V1;
154154
155- const A: i32 = FOO.test(); // You can't call Test::func() here !
155+ const A: i32 = FOO.test(); // You can't call Test::func() here!
156156}
157157```
158158
@@ -214,14 +214,13 @@ static B: &'static u32 = &A; // ok!
214214```
215215"## ,
216216
217-
218217E0395 : r##"
219218The value assigned to a constant scalar must be known at compile time,
220219which is not the case when comparing raw pointers.
221220
222221Erroneous code example:
223222
224- ```compile_fail
223+ ```compile_fail,E0395
225224static FOO: i32 = 42;
226225static BAR: i32 = 42;
227226
@@ -250,7 +249,7 @@ The value behind a raw pointer can't be determined at compile-time
250249(or even link-time), which means it can't be used in a constant
251250expression. Erroneous code example:
252251
253- ```compile_fail
252+ ```compile_fail,E0396
254253const REG_ADDR: *const u8 = 0x5f3759df as *const u8;
255254
256255const VALUE: u8 = unsafe { *REG_ADDR };
@@ -272,7 +271,7 @@ E0492: r##"
272271A borrow of a constant containing interior mutability was attempted. Erroneous
273272code example:
274273
275- ```compile_fail
274+ ```compile_fail,E0492
276275use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT};
277276
278277const A: AtomicUsize = ATOMIC_USIZE_INIT;
@@ -299,7 +298,7 @@ static B: &'static AtomicUsize = &A; // ok!
299298
300299You can also have this error while using a cell type:
301300
302- ```compile_fail
301+ ```compile_fail,E0492
303302#![feature(const_fn)]
304303
305304use std::cell::Cell;
@@ -351,7 +350,7 @@ E0493: r##"
351350A type with a destructor was assigned to an invalid type of variable. Erroneous
352351code example:
353352
354- ```compile_fail
353+ ```compile_fail,E0493
355354struct Foo {
356355 a: u32
357356}
@@ -374,7 +373,7 @@ E0494: r##"
374373A reference of an interior static was assigned to another const/static.
375374Erroneous code example:
376375
377- ```compile_fail
376+ ```compile_fail,E0494
378377struct Foo {
379378 a: u32
380379}
0 commit comments