@@ -626,35 +626,31 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs {
626626 if codegen_fn_attrs. flags . contains ( CodegenFnAttrFlags :: RUSTC_STD_INTERNAL_SYMBOL )
627627 && codegen_fn_attrs. flags . contains ( CodegenFnAttrFlags :: NO_MANGLE )
628628 {
629- let ( span , lang_item) = lang_items :: extract ( attrs )
630- . map_or ( ( None , None ) , |( name, span ) | ( Some ( span ) , LangItem :: from_name ( name) ) ) ;
629+ let lang_item =
630+ lang_items :: extract ( attrs ) . map_or ( None , |( name, _span ) | LangItem :: from_name ( name) ) ;
631631 // This should never use the default as `no_mangle` is present in the attributes list
632632 let no_mangle_span = no_mangle_span. unwrap_or_default ( ) ;
633- let label = if let Some ( lang_item) = lang_item {
634- format ! ( "should be the {} item" , lang_item. name( ) )
635- } else {
636- format ! ( "should be the internal language item" )
637- } ;
638633 let mut err = tcx
639634 . dcx ( )
640635 . struct_span_err (
641636 no_mangle_span,
642637 "`#[no_mangle]` cannot be used on internal language items" ,
643638 )
644639 . with_note ( "Rustc requires this item to have a specific mangled name." )
645- . with_note ( "If you are trying to prevent mangling to ease debugging, many" )
646- . with_note ( "debuggers support a command such as `rbreak {sym}` to" )
647- . with_note ( "match `.*{sym}.*` instead of `break {sym}` on a specific name" )
648- . with_span_label ( tcx. def_span ( did) , label) ;
640+ . with_span_label ( tcx. def_span ( did) , "should be the internal language item" ) ;
649641 if let Some ( lang_item) = lang_item {
650- if let Some ( span) = span {
651- let label_attr = format ! ( "this defines it as the `{}` item" , lang_item. name( ) ) ;
652- err = err. with_span_label ( span, label_attr) ;
653- }
654642 if let Some ( link_name) = lang_item. link_name ( ) {
655- let renamed =
656- format ! ( "In this case it is automatically renamed to `{}`" , link_name) ;
657- err = err. with_note ( renamed) ;
643+ // let renamed =
644+ // format!("In this case it is automatically renamed to `{}`", link_name);
645+ // err = err.with_note(renamed);
646+ err = err
647+ . with_note ( "If you are trying to prevent mangling to ease debugging, many" )
648+ . with_note ( format ! (
649+ "debuggers support a command such as `rbreak {link_name}` to"
650+ ) )
651+ . with_note ( format ! (
652+ "match `.*{link_name}.*` instead of `break {link_name}` on a specific name"
653+ ) )
658654 }
659655 }
660656
0 commit comments