File tree 2 files changed +5
-2
lines changed
compiler/rustc_const_eval/src/transform/check_consts
2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -89,7 +89,10 @@ impl<'tcx> NonConstOp<'tcx> for FnCallIndirect {
89
89
ccx : & ConstCx < ' _ , ' tcx > ,
90
90
span : Span ,
91
91
) -> DiagnosticBuilder < ' tcx , ErrorGuaranteed > {
92
- ccx. tcx . sess . struct_span_err ( span, "function pointers are not allowed in const fn" )
92
+ ccx. tcx . sess . struct_span_err (
93
+ span,
94
+ & format ! ( "function pointer calls are not allowed in {}s" , ccx. const_kind( ) ) ,
95
+ )
93
96
}
94
97
}
95
98
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ LL | const fn foo() { (||{})() }
7
7
= note: closures need an RFC before allowed to be called in constant functions
8
8
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
9
9
10
- error: function pointers are not allowed in const fn
10
+ error: function pointer calls are not allowed in constant functions
11
11
--> $DIR/issue-56164.rs:7:5
12
12
|
13
13
LL | input()
You can’t perform that action at this time.
0 commit comments