diff options
| author | Luis Cardoso <61982523+LuisCardosoOliveira@users.noreply.github.com> | 2022-09-08 08:15:37 +0200 |
|---|---|---|
| committer | Luis Cardoso <61982523+LuisCardosoOliveira@users.noreply.github.com> | 2022-09-08 12:22:51 +0200 |
| commit | 0e497a714ebfefbee094b8475ea9aa4eeaa7b692 (patch) | |
| tree | 765b0cc3bea0410594f7c8668bd1b703cd21d7d7 /compiler/rustc_session/src | |
| parent | 24de9435e2d4efe2bde043f389579a72fb532c6f (diff) | |
| download | rust-0e497a714ebfefbee094b8475ea9aa4eeaa7b692.tar.gz rust-0e497a714ebfefbee094b8475ea9aa4eeaa7b692.zip | |
translations(rustc_session): migrates two diagnostics in session.rs
Diffstat (limited to 'compiler/rustc_session/src')
| -rw-r--r-- | compiler/rustc_session/src/errors.rs | 14 | ||||
| -rw-r--r-- | compiler/rustc_session/src/session.rs | 18 |
2 files changed, 22 insertions, 10 deletions
diff --git a/compiler/rustc_session/src/errors.rs b/compiler/rustc_session/src/errors.rs index a4e13e22ae2..3c93cfab183 100644 --- a/compiler/rustc_session/src/errors.rs +++ b/compiler/rustc_session/src/errors.rs @@ -6,6 +6,7 @@ use rustc_errors::{fluent, DiagnosticBuilder, Handler, MultiSpan}; use rustc_macros::SessionDiagnostic; use rustc_span::{Span, Symbol}; use rustc_target::abi::TargetDataLayoutErrors; +use rustc_target::spec::{SplitDebuginfo, StackProtector, TargetTriple}; #[derive(SessionDiagnostic)] #[diag(session::incorrect_cgu_reuse_type)] @@ -156,3 +157,16 @@ pub struct UnstableVirtualFunctionElimination; pub struct UnsupportedDwarfVersion { pub dwarf_version: u32, } + +#[derive(SessionDiagnostic)] +#[diag(session::target_stack_protector_not_supported)] +pub struct StackProtectorNotSupportedForTarget<'a> { + pub stack_protector: StackProtector, + pub target_triple: &'a TargetTriple, +} + +#[derive(SessionDiagnostic)] +#[diag(session::split_debuginfo_unstable_platform)] +pub struct SplitDebugInfoUnstablePlatform { + pub debuginfo: SplitDebuginfo, +} diff --git a/compiler/rustc_session/src/session.rs b/compiler/rustc_session/src/session.rs index 6add576cdff..caf9d582ab0 100644 --- a/compiler/rustc_session/src/session.rs +++ b/compiler/rustc_session/src/session.rs @@ -5,8 +5,9 @@ use crate::config::{self, CrateType, InstrumentCoverage, OptLevel, OutputType, S use crate::errors::{ CannotEnableCrtStaticLinux, CannotMixAndMatchSanitizers, LinkerPluginToWindowsNotSupported, NotCircumventFeature, ProfileSampleUseFileDoesNotExist, ProfileUseFileDoesNotExist, - SanitizerCfiEnabled, SanitizerNotSupported, SanitizersNotSupported, TargetRequiresUnwindTables, - UnstableVirtualFunctionElimination, UnsupportedDwarfVersion, + SanitizerCfiEnabled, SanitizerNotSupported, SanitizersNotSupported, + SplitDebugInfoUnstablePlatform, StackProtectorNotSupportedForTarget, + TargetRequiresUnwindTables, UnstableVirtualFunctionElimination, UnsupportedDwarfVersion, }; use crate::parse::{add_feature_diagnostics, ParseSess}; use crate::search_paths::{PathKind, SearchPath}; @@ -1544,10 +1545,10 @@ fn validate_commandline_args_with_session_available(sess: &Session) { if sess.opts.unstable_opts.stack_protector != StackProtector::None { if !sess.target.options.supports_stack_protector { - sess.warn(&format!( - "`-Z stack-protector={}` is not supported for target {} and will be ignored", - sess.opts.unstable_opts.stack_protector, sess.opts.target_triple - )) + sess.emit_warning(StackProtectorNotSupportedForTarget { + stack_protector: sess.opts.unstable_opts.stack_protector, + target_triple: &sess.opts.target_triple, + }); } } @@ -1560,10 +1561,7 @@ fn validate_commandline_args_with_session_available(sess: &Session) { if !sess.target.options.supported_split_debuginfo.contains(&sess.split_debuginfo()) && !sess.opts.unstable_opts.unstable_options { - sess.err(&format!( - "`-Csplit-debuginfo={}` is unstable on this platform", - sess.split_debuginfo() - )); + sess.emit_err(SplitDebugInfoUnstablePlatform { debuginfo: sess.split_debuginfo() }); } } |
