Skip to content

Commit

Permalink
Move mir_opt_level getter into Options
Browse files Browse the repository at this point in the history
  • Loading branch information
ecstatic-morse committed Dec 3, 2021
1 parent ff23ad3 commit 386b1c5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
8 changes: 8 additions & 0 deletions compiler/rustc_session/src/options.rs
Expand Up @@ -101,6 +101,14 @@ macro_rules! top_level_options {
);
}

impl Options {
pub fn mir_opt_level(&self) -> usize {
self.debugging_opts
.mir_opt_level
.unwrap_or_else(|| if self.optimize != OptLevel::No { 2 } else { 1 })
}
}

top_level_options!(
/// The top-level command-line options struct.
///
Expand Down
5 changes: 1 addition & 4 deletions compiler/rustc_session/src/session.rs
Expand Up @@ -562,10 +562,7 @@ impl Session {
self.opts.debugging_opts.binary_dep_depinfo
}
pub fn mir_opt_level(&self) -> usize {
self.opts
.debugging_opts
.mir_opt_level
.unwrap_or_else(|| if self.opts.optimize != config::OptLevel::No { 2 } else { 1 })
self.opts.mir_opt_level()
}

/// Gets the features enabled for the current compilation session.
Expand Down

0 comments on commit 386b1c5

Please sign in to comment.