diff options
| author | mbartlett21 <mjmouse9999@gmail.com> | 2022-05-17 04:11:18 +0000 |
|---|---|---|
| committer | mbartlett21 <mjmouse9999@gmail.com> | 2022-05-17 04:13:20 +0000 |
| commit | 56649bb844ebf3d1861b3ee1d2616ccd22aab851 (patch) | |
| tree | 12c58653c7a60762fabfbf381666316b6cc27eb7 /compiler/rustc_const_eval/src | |
| parent | c1cfdd1fb225d64e78b8d8cbab83564ac2dd5ec2 (diff) | |
| download | rust-56649bb844ebf3d1861b3ee1d2616ccd22aab851.tar.gz rust-56649bb844ebf3d1861b3ee1d2616ccd22aab851.zip | |
Update function pointer call error message
It now uses the type of context. (issue 97082)
Diffstat (limited to 'compiler/rustc_const_eval/src')
| -rw-r--r-- | compiler/rustc_const_eval/src/transform/check_consts/ops.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/rustc_const_eval/src/transform/check_consts/ops.rs b/compiler/rustc_const_eval/src/transform/check_consts/ops.rs index 122471b208d..4e71baa77b0 100644 --- a/compiler/rustc_const_eval/src/transform/check_consts/ops.rs +++ b/compiler/rustc_const_eval/src/transform/check_consts/ops.rs @@ -89,7 +89,10 @@ impl<'tcx> NonConstOp<'tcx> for FnCallIndirect { ccx: &ConstCx<'_, 'tcx>, span: Span, ) -> DiagnosticBuilder<'tcx, ErrorGuaranteed> { - ccx.tcx.sess.struct_span_err(span, "function pointers are not allowed in const fn") + ccx.tcx.sess.struct_span_err( + span, + &format!("function pointer calls are not allowed in {}s", ccx.const_kind()), + ) } } |
