Rollup merge of #136358 - clubby789:opt-none-noinline, r=saethlin
`#[optimize(none)]` implies `#[inline(never)]` Fixes #136329
This commit is contained in:
commit
ce5db2f9f1
2 changed files with 26 additions and 1 deletions
|
@ -4,7 +4,7 @@ use std::iter;
|
|||
use std::ops::{Range, RangeFrom};
|
||||
|
||||
use rustc_abi::{ExternAbi, FieldIdx};
|
||||
use rustc_attr_parsing::InlineAttr;
|
||||
use rustc_attr_parsing::{InlineAttr, OptimizeAttr};
|
||||
use rustc_hir::def::DefKind;
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_index::Idx;
|
||||
|
@ -770,6 +770,10 @@ fn check_codegen_attributes<'tcx, I: Inliner<'tcx>>(
|
|||
return Err("never inline attribute");
|
||||
}
|
||||
|
||||
if let OptimizeAttr::DoNotOptimize = callee_attrs.optimize {
|
||||
return Err("has DoNotOptimize attribute");
|
||||
}
|
||||
|
||||
// Reachability pass defines which functions are eligible for inlining. Generally inlining
|
||||
// other functions is incorrect because they could reference symbols that aren't exported.
|
||||
let is_generic = callsite.callee.args.non_erasable_generics().next().is_some();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue