File tree Expand file tree Collapse file tree 1 file changed +14
-12
lines changed
compiler/rustc_const_eval/src/check_consts Expand file tree Collapse file tree 1 file changed +14
-12
lines changed Original file line number Diff line number Diff line change @@ -386,18 +386,20 @@ fn build_error_for_const_call<'tcx>(
386
386
`{trait_name}` is not const",
387
387
) ,
388
388
) ;
389
- let indentation = ccx
390
- . tcx
391
- . sess
392
- . source_map ( )
393
- . indentation_before ( trait_span)
394
- . unwrap_or_default ( ) ;
395
- err. span_suggestion_verbose (
396
- trait_span. shrink_to_lo ( ) ,
397
- format ! ( "consider making trait `{trait_name}` const" ) ,
398
- format ! ( "#[const_trait]\n {indentation}" ) ,
399
- Applicability :: MachineApplicable ,
400
- ) ;
389
+ if parent. is_local ( ) {
390
+ let indentation = ccx
391
+ . tcx
392
+ . sess
393
+ . source_map ( )
394
+ . indentation_before ( trait_span)
395
+ . unwrap_or_default ( ) ;
396
+ err. span_suggestion_verbose (
397
+ trait_span. shrink_to_lo ( ) ,
398
+ format ! ( "consider making trait `{trait_name}` const" ) ,
399
+ format ! ( "#[const_trait]\n {indentation}" ) ,
400
+ Applicability :: MachineApplicable ,
401
+ ) ;
402
+ }
401
403
}
402
404
} else if ccx. tcx . constness ( callee) != hir:: Constness :: Const {
403
405
let name = ccx. tcx . item_name ( callee) ;
You can’t perform that action at this time.
0 commit comments