]> git.lizzy.rs Git - rust.git/commitdiff
Replace attr::contains_name(..., "cold")
authorWesley Wiser <wwiser@gmail.com>
Mon, 5 Feb 2018 03:11:44 +0000 (22:11 -0500)
committerWesley Wiser <wwiser@gmail.com>
Wed, 7 Mar 2018 00:58:02 +0000 (19:58 -0500)
Part of #47320

src/librustc_mir/transform/inline.rs

index 485f870fccaa7f4564739ac3bd464a557fef0d37..64c702b99cdb3940350a841bef58b4717fa5ea70 100644 (file)
@@ -11,6 +11,7 @@
 //! Inlining pass for MIR functions
 
 use rustc::hir;
+use rustc::hir::TransFnAttrFlags;
 use rustc::hir::def_id::DefId;
 
 use rustc_data_structures::bitvec::BitVector;
@@ -206,10 +207,9 @@ fn should_inline(&self,
             return false;
         }
 
-        let attrs = tcx.get_attrs(callsite.callee);
-        let hint = tcx.trans_fn_attrs(callsite.callee).inline;
+        let trans_fn_attrs = tcx.trans_fn_attrs(callsite.callee);
 
-        let hinted = match hint {
+        let hinted = match trans_fn_attrs.inline {
             // Just treat inline(always) as a hint for now,
             // there are cases that prevent inlining that we
             // need to check for first.
@@ -239,7 +239,7 @@ fn should_inline(&self,
         };
 
         // Significantly lower the threshold for inlining cold functions
-        if attr::contains_name(&attrs[..], "cold") {
+        if trans_fn_attrs.flags.contains(TransFnAttrFlags::COLD) {
             threshold /= 5;
         }
 
@@ -344,7 +344,7 @@ fn should_inline(&self,
             }
         }
 
-        if let attr::InlineAttr::Always = hint {
+        if let attr::InlineAttr::Always = trans_fn_attrs.inline {
             debug!("INLINING {:?} because inline(always) [cost={}]", callsite, cost);
             true
         } else {