Skip to content

Commit 3a18c6b

Browse files
committed
rustc_const_eval: make message about "const stable" translatable
1 parent 43f3a21 commit 3a18c6b

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

compiler/rustc_const_eval/messages.ftl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ const_eval_const_context = {$kind ->
4141
*[other] {""}
4242
}
4343
44+
const_eval_const_stable = const-stable functions can only call other const-stable functions
45+
4446
const_eval_copy_nonoverlapping_overlapping =
4547
`copy_nonoverlapping` called on overlapping ranges
4648

compiler/rustc_const_eval/src/check_consts/ops.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use rustc_trait_selection::traits::SelectionContext;
2323
use tracing::debug;
2424

2525
use super::ConstCx;
26-
use crate::errors;
26+
use crate::{errors, fluent_generated};
2727

2828
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
2929
pub enum Status {
@@ -334,7 +334,7 @@ impl<'tcx> NonConstOp<'tcx> for FnCallUnstable {
334334
// FIXME: make this translatable
335335
#[allow(rustc::untranslatable_diagnostic)]
336336
if ccx.is_const_stable_const_fn() {
337-
err.help("const-stable functions can only call other const-stable functions");
337+
err.help(fluent_generated::const_eval_const_stable);
338338
} else if ccx.tcx.sess.is_nightly_build() {
339339
if let Some(feature) = feature {
340340
err.help(format!("add `#![feature({feature})]` to the crate attributes to enable"));

0 commit comments

Comments
 (0)