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 @@ -383,18 +383,20 @@ fn build_error_for_const_call<'tcx>(
383383 `{trait_name}` is not const",
384384 ) ,
385385 ) ;
386- let indentation = ccx
387- . tcx
388- . sess
389- . source_map ( )
390- . indentation_before ( trait_span)
391- . unwrap_or_default ( ) ;
392- err. span_suggestion_verbose (
393- trait_span. shrink_to_lo ( ) ,
394- format ! ( "consider making trait `{trait_name}` const" ) ,
395- format ! ( "#[const_trait]\n {indentation}" ) ,
396- Applicability :: MachineApplicable ,
397- ) ;
386+ if parent. is_local ( ) {
387+ let indentation = ccx
388+ . tcx
389+ . sess
390+ . source_map ( )
391+ . indentation_before ( trait_span)
392+ . unwrap_or_default ( ) ;
393+ err. span_suggestion_verbose (
394+ trait_span. shrink_to_lo ( ) ,
395+ format ! ( "consider making trait `{trait_name}` const" ) ,
396+ format ! ( "#[const_trait]\n {indentation}" ) ,
397+ Applicability :: MachineApplicable ,
398+ ) ;
399+ }
398400 }
399401 } else if ccx. tcx . constness ( callee) != hir:: Constness :: Const {
400402 let name = ccx. tcx . item_name ( callee) ;
You can’t perform that action at this time.
0 commit comments