File tree 3 files changed +10
-4
lines changed
compiler/rustc_const_eval
3 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -385,6 +385,8 @@ const_eval_unreachable_unwind =
385
385
const_eval_unsigned_offset_from_overflow =
386
386
`ptr_offset_from_unsigned` called when first pointer has smaller offset than second: { $a_offset } < { $b_offset }
387
387
const_eval_unsized_local = unsized locals are not supported
388
+
389
+ const_eval_unstable_declared_here = `{ $def_path } ` declaired here
388
390
const_eval_unstable_const_fn = `{ $def_path } ` is not yet stable as a const fn
389
391
390
392
const_eval_unstable_in_stable =
Original file line number Diff line number Diff line change @@ -129,6 +129,9 @@ pub(crate) struct UnstableConstFn {
129
129
#[ primary_span]
130
130
pub span : Span ,
131
131
pub def_path : String ,
132
+
133
+ #[ label( const_eval_declared_here) ]
134
+ pub declared : Span ,
132
135
}
133
136
134
137
#[ derive( Diagnostic ) ]
Original file line number Diff line number Diff line change @@ -339,10 +339,11 @@ impl<'tcx> NonConstOp<'tcx> for FnCallUnstable {
339
339
) -> DiagnosticBuilder < ' tcx , ErrorGuaranteed > {
340
340
let FnCallUnstable ( def_id, feature) = * self ;
341
341
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
+ } ) ;
346
347
347
348
if ccx. is_const_stable_const_fn ( ) {
348
349
err. help ( "const-stable functions can only call other const-stable functions" ) ;
You can’t perform that action at this time.
0 commit comments