about summary refs log tree commit diff
path: root/compiler/rustc_const_eval/src
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2024-12-23 21:04:17 +0000
committerMichael Goulet <michael@errs.io>2025-01-09 16:15:19 +0000
commitb321cd5573d5bfc4b21f456be146c8d29d67bd1d (patch)
treecc9a68601f2c64dc3fdc55749aa6001dcfcc4cb1 /compiler/rustc_const_eval/src
parentec12cd8436aab693d8847b3077c26fe2de4ed661 (diff)
downloadrust-b321cd5573d5bfc4b21f456be146c8d29d67bd1d.tar.gz
rust-b321cd5573d5bfc4b21f456be146c8d29d67bd1d.zip
Add note back to conditionally-const error message
Diffstat (limited to 'compiler/rustc_const_eval/src')
-rw-r--r--compiler/rustc_const_eval/src/check_consts/ops.rs12
1 files changed, 10 insertions, 2 deletions
diff --git a/compiler/rustc_const_eval/src/check_consts/ops.rs b/compiler/rustc_const_eval/src/check_consts/ops.rs
index ebd680ac28a..55e43f5af35 100644
--- a/compiler/rustc_const_eval/src/check_consts/ops.rs
+++ b/compiler/rustc_const_eval/src/check_consts/ops.rs
@@ -92,7 +92,7 @@ impl<'tcx> NonConstOp<'tcx> for ConditionallyConstCall<'tcx> {
     }
 
     fn build_error(&self, ccx: &ConstCx<'_, 'tcx>, span: Span) -> Diag<'tcx> {
-        ccx.tcx.sess.create_feature_err(
+        let mut err = ccx.tcx.sess.create_feature_err(
             errors::ConditionallyConstCall {
                 span,
                 def_path_str: ccx.tcx.def_path_str_with_args(self.callee, self.args),
@@ -100,7 +100,15 @@ impl<'tcx> NonConstOp<'tcx> for ConditionallyConstCall<'tcx> {
                 kind: ccx.const_kind(),
             },
             sym::const_trait_impl,
-        )
+        );
+
+        err.note(format!(
+            "calls in {}s are limited to constant functions, \
+             tuple structs and tuple variants",
+            ccx.const_kind(),
+        ));
+
+        err
     }
 }