diff options
| author | Dylan MacKenzie <ecstaticmorse@gmail.com> | 2021-12-02 09:17:32 -0800 | 
|---|---|---|
| committer | Dylan MacKenzie <ecstaticmorse@gmail.com> | 2021-12-02 17:31:38 -0800 | 
| commit | fd18b45e112d07c20d12303aa5d7d7ffd28830b7 (patch) | |
| tree | 539aa8d26fb7341c8f5f989b44bf831570da82c3 /compiler/rustc_mir_transform/src/inline.rs | |
| parent | c1a501b131ae99cb139b0843125f27d548b4cd1b (diff) | |
| download | rust-fd18b45e112d07c20d12303aa5d7d7ffd28830b7.tar.gz rust-fd18b45e112d07c20d12303aa5d7d7ffd28830b7.zip  | |
Update passes with new interface
Diffstat (limited to 'compiler/rustc_mir_transform/src/inline.rs')
| -rw-r--r-- | compiler/rustc_mir_transform/src/inline.rs | 19 | 
1 files changed, 7 insertions, 12 deletions
diff --git a/compiler/rustc_mir_transform/src/inline.rs b/compiler/rustc_mir_transform/src/inline.rs index 84a1e3fb600..62686b0b718 100644 --- a/compiler/rustc_mir_transform/src/inline.rs +++ b/compiler/rustc_mir_transform/src/inline.rs @@ -37,21 +37,16 @@ struct CallSite<'tcx> { source_info: SourceInfo, } -/// Returns true if MIR inlining is enabled in the current compilation session. -crate fn is_enabled(tcx: TyCtxt<'_>) -> bool { - if let Some(enabled) = tcx.sess.opts.debugging_opts.inline_mir { - return enabled; - } - - tcx.sess.mir_opt_level() >= 3 -} - impl<'tcx> MirPass<'tcx> for Inline { - fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) { - if !is_enabled(tcx) { - return; + fn is_enabled(&self, sess: &rustc_session::Session) -> bool { + if let Some(enabled) = sess.opts.debugging_opts.inline_mir { + return enabled; } + sess.opts.mir_opt_level() >= 3 + } + + fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) { let span = trace_span!("inline", body = %tcx.def_path_str(body.source.def_id())); let _guard = span.enter(); if inline(tcx, body) {  | 
