Auto merge of #147404 - JamieCunliffe:inline-always, r=jackh726 · rust-lang/rust@1eb0657 (original) (raw)
`@@ -16,7 +16,7 @@ use rustc_codegen_ssa::mir::place::PlaceRef;
`
16
16
`use rustc_codegen_ssa::traits::*;
`
17
17
`use rustc_data_structures::small_c_str::SmallCStr;
`
18
18
`use rustc_hir::def_id::DefId;
`
19
``
`-
use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrs;
`
``
19
`+
use rustc_middle::middle::codegen_fn_attrs::{CodegenFnAttrs, TargetFeature, TargetFeatureKind};
`
20
20
`use rustc_middle::ty::layout::{
`
21
21
`FnAbiError, FnAbiOfHelpers, FnAbiRequest, HasTypingEnv, LayoutError, LayoutOfHelpers,
`
22
22
`TyAndLayout,
`
`@@ -1405,14 +1405,18 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
`
1405
1405
`// Attributes on the function definition being called
`
1406
1406
`let fn_defn_attrs = self.cx.tcx.codegen_fn_attrs(instance.def_id());
`
1407
1407
`if let Some(fn_call_attrs) = fn_call_attrs
`
1408
``
`-
&& !fn_call_attrs.target_features.is_empty()
`
1409
1408
`// If there is an inline attribute and a target feature that matches
`
1410
1409
`// we will add the attribute to the callsite otherwise we'll omit
`
1411
1410
`// this and not add the attribute to prevent soundness issues.
`
1412
1411
` && let Some(inlining_rule) = attributes::inline_attr(&self.cx, self.cx.tcx, instance)
`
1413
1412
` && self.cx.tcx.is_target_feature_call_safe(
`
1414
``
`-
&fn_call_attrs.target_features,
`
1415
1413
`&fn_defn_attrs.target_features,
`
``
1414
`+
&fn_call_attrs.target_features.iter().cloned().chain(
`
``
1415
`+
self.cx.tcx.sess.target_features.iter().map(|feat| TargetFeature {
`
``
1416
`+
name: *feat,
`
``
1417
`+
kind: TargetFeatureKind::Implied,
`
``
1418
`+
})
`
``
1419
`+
).collect::<Vec<_>>(),
`
1416
1420
`)
`
1417
1421
`{
`
1418
1422
` attributes::apply_to_callsite(
`