Skip to content

Commit 1d31972

Browse files
committed
temp
1 parent d1611e3 commit 1d31972

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

compiler/rustc_const_eval/messages.ftl

+2
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,8 @@ const_eval_unreachable_unwind =
385385
const_eval_unsigned_offset_from_overflow =
386386
`ptr_offset_from_unsigned` called when first pointer has smaller offset than second: {$a_offset} < {$b_offset}
387387
const_eval_unsized_local = unsized locals are not supported
388+
389+
const_eval_unstable_declared_here = `{$def_path}` declaired here
388390
const_eval_unstable_const_fn = `{$def_path}` is not yet stable as a const fn
389391
390392
const_eval_unstable_in_stable =

compiler/rustc_const_eval/src/errors.rs

+3
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,9 @@ pub(crate) struct UnstableConstFn {
129129
#[primary_span]
130130
pub span: Span,
131131
pub def_path: String,
132+
133+
#[label(const_eval_declared_here)]
134+
pub declared: Span,
132135
}
133136

134137
#[derive(Diagnostic)]

compiler/rustc_const_eval/src/transform/check_consts/ops.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -339,10 +339,11 @@ impl<'tcx> NonConstOp<'tcx> for FnCallUnstable {
339339
) -> DiagnosticBuilder<'tcx, ErrorGuaranteed> {
340340
let FnCallUnstable(def_id, feature) = *self;
341341

342-
let mut err = ccx
343-
.tcx
344-
.sess
345-
.create_err(errors::UnstableConstFn { span, def_path: ccx.tcx.def_path_str(def_id) });
342+
let mut err = ccx.tcx.sess.create_err(errors::UnstableConstFn {
343+
span,
344+
def_path: ccx.tcx.def_path_str(def_id),
345+
declared: ccx.tcx.def_span(def_id),
346+
});
346347

347348
if ccx.is_const_stable_const_fn() {
348349
err.help("const-stable functions can only call other const-stable functions");

0 commit comments

Comments
 (0)