about summary refs log tree commit diff
path: root/compiler/rustc_const_eval/src/transform
diff options
context:
space:
mode:
authornidnogg <henriquevt98@gmail.com>2022-08-18 02:11:52 -0300
committernidnogg <henriquevt98@gmail.com>2022-08-21 23:22:51 -0300
commit70ea98633e44b1220e40c1e8bcdc82edcc18da77 (patch)
treebed016c561f7d635a419dd38b438b36e966d89d1 /compiler/rustc_const_eval/src/transform
parent6af8e46a9af03b94baec980d188798a58f3eb75c (diff)
downloadrust-70ea98633e44b1220e40c1e8bcdc82edcc18da77.tar.gz
rust-70ea98633e44b1220e40c1e8bcdc82edcc18da77.zip
Migrated Unallowed function pointer calls in interpreter/ops
Diffstat (limited to 'compiler/rustc_const_eval/src/transform')
-rw-r--r--compiler/rustc_const_eval/src/transform/check_consts/ops.rs7
1 files changed, 2 insertions, 5 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 c9cfc1f3f46..ba7f2d07277 100644
--- a/compiler/rustc_const_eval/src/transform/check_consts/ops.rs
+++ b/compiler/rustc_const_eval/src/transform/check_consts/ops.rs
@@ -25,7 +25,7 @@ use rustc_trait_selection::traits::SelectionContext;
 use super::ConstCx;
 use crate::errors::{
     MutDerefErr, NonConstOpErr, PanicNonStrErr, RawPtrToIntErr, StaticAccessErr,
-    TransientMutBorrowErr, TransientMutBorrowErrRaw,
+    TransientMutBorrowErr, TransientMutBorrowErrRaw, UnallowedFnPointerCall,
 };
 use crate::util::{call_kind, CallDesugaringKind, CallKind};
 
@@ -97,10 +97,7 @@ impl<'tcx> NonConstOp<'tcx> for FnCallIndirect {
         ccx: &ConstCx<'_, 'tcx>,
         span: Span,
     ) -> DiagnosticBuilder<'tcx, ErrorGuaranteed> {
-        ccx.tcx.sess.struct_span_err(
-            span,
-            &format!("function pointer calls are not allowed in {}s", ccx.const_kind()),
-        )
+        ccx.tcx.sess.create_err(UnallowedFnPointerCall { span, kind: ccx.const_kind() })
     }
 }