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/nrvo.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/nrvo.rs')
| -rw-r--r-- | compiler/rustc_mir_transform/src/nrvo.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler/rustc_mir_transform/src/nrvo.rs b/compiler/rustc_mir_transform/src/nrvo.rs index 3ac4e77cf9a..88ec34b73ec 100644 --- a/compiler/rustc_mir_transform/src/nrvo.rs +++ b/compiler/rustc_mir_transform/src/nrvo.rs @@ -33,11 +33,11 @@ use crate::MirPass; pub struct RenameReturnPlace; impl<'tcx> MirPass<'tcx> for RenameReturnPlace { - fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut mir::Body<'tcx>) { - if tcx.sess.mir_opt_level() == 0 { - return; - } + fn is_enabled(&self, sess: &rustc_session::Session) -> bool { + sess.mir_opt_level() > 0 + } + fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut mir::Body<'tcx>) { let def_id = body.source.def_id(); let returned_local = match local_eligible_for_nrvo(body) { Some(l) => l, |
