File tree 2 files changed +14
-1
lines changed
tests/ui/consts/const-eval
2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -9,4 +9,9 @@ const fn print() {
9
9
//~| ERROR cannot call non-const function `_print` in constant functions
10
10
}
11
11
12
+ const fn format_args ( ) {
13
+ format_args ! ( "{}" , 0 ) ;
14
+ //~^ ERROR cannot call non-const formatting macro in constant functions
15
+ }
16
+
12
17
fn main ( ) { }
Original file line number Diff line number Diff line change @@ -24,6 +24,14 @@ LL | println!("{:?}", 0);
24
24
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
25
25
= note: this error originates in the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
26
26
27
- error: aborting due to 3 previous errors
27
+ error[E0015]: cannot call non-const formatting macro in constant functions
28
+ --> $DIR/format.rs:13:5
29
+ |
30
+ LL | format_args!("{}", 0);
31
+ | ^^^^^^^^^^^^^^^^^^^^^
32
+ |
33
+ = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
34
+
35
+ error: aborting due to 4 previous errors
28
36
29
37
For more information about this error, try `rustc --explain E0015`.
You can’t perform that action at this time.
0 commit comments