trait Inliner<'tcx> {
// 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_codegen_attributes_extra(
&self,
callee_attrs: &CodegenFnAttrs,
) -> Result<(), &'static str>;
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 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);
}
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_codegen_attributes_extra( &self, callee_attrs: &CodegenFnAttrs, ) -> Result<(), &'static str>
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.
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.
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.