codegen_attrs: force inlining takes precedence
This commit is contained in:
parent
f86169a58f
commit
02d423cd24
1 changed files with 33 additions and 28 deletions
|
@ -523,7 +523,10 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs {
|
|||
mixed_export_name_no_mangle_lint_state.lint_if_mixed(tcx);
|
||||
|
||||
codegen_fn_attrs.inline = attrs.iter().fold(InlineAttr::None, |ia, attr| {
|
||||
if attr.has_name(sym::inline) {
|
||||
if !attr.has_name(sym::inline) {
|
||||
return ia;
|
||||
}
|
||||
|
||||
if attr.is_word() {
|
||||
InlineAttr::Hint
|
||||
} else if let Some(ref items) = attr.meta_item_list() {
|
||||
|
@ -545,7 +548,12 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs {
|
|||
} else {
|
||||
ia
|
||||
}
|
||||
} else if attr.has_name(sym::rustc_force_inline) && tcx.features().rustc_attrs() {
|
||||
});
|
||||
codegen_fn_attrs.inline = attrs.iter().fold(codegen_fn_attrs.inline, |ia, attr| {
|
||||
if !attr.has_name(sym::rustc_force_inline) || !tcx.features().rustc_attrs() {
|
||||
return ia;
|
||||
}
|
||||
|
||||
if attr.is_word() {
|
||||
InlineAttr::Force { attr_span: attr.span, reason: None }
|
||||
} else if let Some(val) = attr.value_str() {
|
||||
|
@ -554,9 +562,6 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs {
|
|||
debug!("`rustc_force_inline` not checked by attribute validation");
|
||||
ia
|
||||
}
|
||||
} else {
|
||||
ia
|
||||
}
|
||||
});
|
||||
|
||||
// naked function MUST NOT be inlined! This attribute is required for the rust compiler itself,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue