Skip to content

Commit a11922d

Browse files
committed
rustc_const_eval: make LazyLock suggestion translatable
1 parent 3a18c6b commit a11922d

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

compiler/rustc_const_eval/messages.ftl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,9 @@ const_eval_invalid_vtable_pointer =
203203
const_eval_invalid_vtable_trait =
204204
using vtable for trait `{$vtable_trait}` but trait `{$expected_trait}` was expected
205205
206+
const_eval_lazy_lock =
207+
consider wrapping this expression in `std::sync::LazyLock::new(|| ...)`
208+
206209
const_eval_live_drop =
207210
destructor of `{$dropped_ty}` cannot be evaluated at compile-time
208211
.label = the destructor for this type cannot be evaluated in {const_eval_const_context}s

compiler/rustc_const_eval/src/check_consts/ops.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ impl<'tcx> NonConstOp<'tcx> for FnCallNonConst<'tcx> {
310310
}
311311

312312
if let ConstContext::Static(_) = ccx.const_kind() {
313-
err.note("consider wrapping this expression in `std::sync::LazyLock::new(|| ...)`");
313+
err.note(fluent_generated::const_eval_lazy_lock);
314314
}
315315

316316
err

0 commit comments

Comments
 (0)