Skip to content

Commit 97b30f0

Browse files
committed
Replace attr::contains_name(..., "cold")
Part of #47320
1 parent 4f840a6 commit 97b30f0

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/librustc_mir/transform/inline.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
//! Inlining pass for MIR functions
1212
1313
use rustc::hir;
14+
use rustc::hir::TransFnAttrFlags;
1415
use rustc::hir::def_id::DefId;
1516

1617
use rustc_data_structures::bitvec::BitVector;
@@ -206,10 +207,9 @@ impl<'a, 'tcx> Inliner<'a, 'tcx> {
206207
return false;
207208
}
208209

209-
let attrs = tcx.get_attrs(callsite.callee);
210-
let hint = tcx.trans_fn_attrs(callsite.callee).inline;
210+
let trans_fn_attrs = tcx.trans_fn_attrs(callsite.callee);
211211

212-
let hinted = match hint {
212+
let hinted = match trans_fn_attrs.inline {
213213
// Just treat inline(always) as a hint for now,
214214
// there are cases that prevent inlining that we
215215
// need to check for first.
@@ -239,7 +239,7 @@ impl<'a, 'tcx> Inliner<'a, 'tcx> {
239239
};
240240

241241
// Significantly lower the threshold for inlining cold functions
242-
if attr::contains_name(&attrs[..], "cold") {
242+
if trans_fn_attrs.flags.contains(TransFnAttrFlags::COLD) {
243243
threshold /= 5;
244244
}
245245

@@ -344,7 +344,7 @@ impl<'a, 'tcx> Inliner<'a, 'tcx> {
344344
}
345345
}
346346

347-
if let attr::InlineAttr::Always = hint {
347+
if let attr::InlineAttr::Always = trans_fn_attrs.inline {
348348
debug!("INLINING {:?} because inline(always) [cost={}]", callsite, cost);
349349
true
350350
} else {

0 commit comments

Comments
 (0)