trait Inliner<'tcx> {
Show 13 methods
// Required methods
fn new(tcx: TyCtxt<'tcx>, def_id: DefId, body: &Body<'tcx>) -> Self;
fn tcx(&self) -> TyCtxt<'tcx>;
fn typing_env(&self) -> TypingEnv<'tcx>;
fn history(&self) -> &[DefId];
fn caller_def_id(&self) -> DefId;
fn changed(self) -> bool;
fn should_inline_for_callee(&self, def_id: DefId) -> bool;
fn check_caller_mir_body(&self, body: &Body<'tcx>) -> bool;
fn check_callee_mir_body(
&self,
callsite: &CallSite<'tcx>,
callee_body: &Body<'tcx>,
callee_attrs: &CodegenFnAttrs,
) -> Result<(), &'static str>;
fn inline_limit_for_block(&self) -> Option<usize>;
fn on_inline_success(
&mut self,
callsite: &CallSite<'tcx>,
caller_body: &mut Body<'tcx>,
new_blocks: Range<BasicBlock>,
);
fn on_inline_failure(&self, callsite: &CallSite<'tcx>, reason: &'static str);
fn on_inline_limit_reached(&self) -> bool;
}
Required Methods§
fn new(tcx: TyCtxt<'tcx>, def_id: DefId, body: &Body<'tcx>) -> Self
fn tcx(&self) -> TyCtxt<'tcx>
fn typing_env(&self) -> TypingEnv<'tcx>
fn history(&self) -> &[DefId]
fn caller_def_id(&self) -> DefId
Sourcefn should_inline_for_callee(&self, def_id: DefId) -> bool
fn should_inline_for_callee(&self, def_id: DefId) -> bool
Should inlining happen for a given callee?
fn check_caller_mir_body(&self, body: &Body<'tcx>) -> bool
Sourcefn check_callee_mir_body(
&self,
callsite: &CallSite<'tcx>,
callee_body: &Body<'tcx>,
callee_attrs: &CodegenFnAttrs,
) -> Result<(), &'static str>
fn check_callee_mir_body( &self, callsite: &CallSite<'tcx>, callee_body: &Body<'tcx>, callee_attrs: &CodegenFnAttrs, ) -> Result<(), &'static str>
Returns inlining decision that is based on the examination of callee MIR body. Assumes that codegen attributes have been checked for compatibility already.
fn inline_limit_for_block(&self) -> Option<usize>
Sourcefn on_inline_success(
&mut self,
callsite: &CallSite<'tcx>,
caller_body: &mut Body<'tcx>,
new_blocks: Range<BasicBlock>,
)
fn on_inline_success( &mut self, callsite: &CallSite<'tcx>, caller_body: &mut Body<'tcx>, new_blocks: Range<BasicBlock>, )
Called when inlining succeeds.
Sourcefn on_inline_failure(&self, callsite: &CallSite<'tcx>, reason: &'static str)
fn on_inline_failure(&self, callsite: &CallSite<'tcx>, reason: &'static str)
Called when inlining failed or was not performed.
Sourcefn on_inline_limit_reached(&self) -> bool
fn on_inline_limit_reached(&self) -> bool
Called when the inline limit for a body is reached.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.