From 97b30f096154970dc7fbc86543140f7c21a4912a Mon Sep 17 00:00:00 2001 From: Wesley Wiser Date: Sun, 4 Feb 2018 22:11:44 -0500 Subject: [PATCH] Replace attr::contains_name(..., "cold") Part of #47320 --- src/librustc_mir/transform/inline.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/librustc_mir/transform/inline.rs b/src/librustc_mir/transform/inline.rs index 485f870fcca..64c702b99cd 100644 --- a/src/librustc_mir/transform/inline.rs +++ b/src/librustc_mir/transform/inline.rs @@ -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 {