diff options
| author | Wesley Wiser <wwiser@gmail.com> | 2025-01-19 13:04:28 -0600 |
|---|---|---|
| committer | Wesley Wiser <wwiser@gmail.com> | 2025-01-29 21:44:21 -0600 |
| commit | 51eaa0d56aadeea9eb3a3c011189d20bf9333bc7 (patch) | |
| tree | ec1fbea10a72a2c5ac5dd9804817a2243529da7b /compiler/rustc_session/src/session.rs | |
| parent | 4a5f1cc52b7546c61462f1d92b60cc80d40e170f (diff) | |
| download | rust-51eaa0d56aadeea9eb3a3c011189d20bf9333bc7.tar.gz rust-51eaa0d56aadeea9eb3a3c011189d20bf9333bc7.zip | |
Clean up uses of the unstable `dwarf_version` option
- Consolidate calculation of the effective value. - Check the target `DebuginfoKind` instead of using `is_like_msvc`.
Diffstat (limited to 'compiler/rustc_session/src/session.rs')
| -rw-r--r-- | compiler/rustc_session/src/session.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/compiler/rustc_session/src/session.rs b/compiler/rustc_session/src/session.rs index 1f03de3f53d..c0f5f0d4a9e 100644 --- a/compiler/rustc_session/src/session.rs +++ b/compiler/rustc_session/src/session.rs @@ -732,6 +732,11 @@ impl Session { self.opts.cg.split_debuginfo.unwrap_or(self.target.split_debuginfo) } + /// Returns the DWARF version passed on the CLI or the default for the target. + pub fn dwarf_version(&self) -> u32 { + self.opts.unstable_opts.dwarf_version.unwrap_or(self.target.default_dwarf_version) + } + pub fn stack_protector(&self) -> StackProtector { if self.target.options.supports_stack_protector { self.opts.unstable_opts.stack_protector @@ -1263,8 +1268,7 @@ fn validate_commandline_args_with_session_available(sess: &Session) { } if sess.opts.unstable_opts.embed_source { - let dwarf_version = - sess.opts.unstable_opts.dwarf_version.unwrap_or(sess.target.default_dwarf_version); + let dwarf_version = sess.dwarf_version(); if dwarf_version < 5 { sess.dcx().emit_warn(errors::EmbedSourceInsufficientDwarfVersion { dwarf_version }); |
