File tree 1 file changed +4
-1
lines changed
compiler/rustc_typeck/src
1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -2724,7 +2724,10 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, id: DefId) -> CodegenFnAttrs {
2724
2724
} else if tcx. sess . check_name ( attr, sym:: naked) {
2725
2725
codegen_fn_attrs. flags |= CodegenFnAttrFlags :: NAKED ;
2726
2726
} else if tcx. sess . check_name ( attr, sym:: no_mangle) {
2727
- codegen_fn_attrs. flags |= CodegenFnAttrFlags :: NO_MANGLE ;
2727
+ // no_mangle is ignored on items other than functions and statics
2728
+ if let DefKind :: Static | DefKind :: Fn | DefKind :: AssocFn = tcx. def_kind ( id) {
2729
+ codegen_fn_attrs. flags |= CodegenFnAttrFlags :: NO_MANGLE ;
2730
+ }
2728
2731
} else if tcx. sess . check_name ( attr, sym:: no_coverage) {
2729
2732
codegen_fn_attrs. flags |= CodegenFnAttrFlags :: NO_COVERAGE ;
2730
2733
} else if tcx. sess . check_name ( attr, sym:: rustc_std_internal_symbol) {
You can’t perform that action at this time.
0 commit comments