translations(rustc_session): migrates two diagnostics in session.rs
This commit is contained in:
parent
24de9435e2
commit
0e497a714e
4 changed files with 30 additions and 13 deletions
|
@ -15,8 +15,6 @@ session_feature_diagnostic_for_issue =
|
|||
session_feature_diagnostic_help =
|
||||
add `#![feature({$feature})]` to the crate attributes to enable
|
||||
|
||||
session_target_data_layout_parse_error = {$err}
|
||||
|
||||
session_not_circumvent_feature = `-Zunleash-the-miri-inside-of-you` may not be used to circumvent feature gates, except when testing error paths in the CTFE engine
|
||||
|
||||
session_profile_use_file_does_not_exist = file `{$path}` passed to `-C profile-use` does not exist.
|
||||
|
@ -54,3 +52,7 @@ session_target_inconsistent_architecture = inconsistent target specification: "d
|
|||
session_target_inconsistent_pointer_width = inconsistent target specification: "data-layout" claims pointers are {$pointer_size}-bit, while "target-pointer-width" is `{$target}`
|
||||
|
||||
session_target_invalid_bits_size = {$err}
|
||||
|
||||
session_target_stack_protector_not_supported = `-Z stack-protector={$stack_protector}` is not supported for target {$target_triple} and will be ignored
|
||||
|
||||
session_split_debuginfo_unstable_platform = `-Csplit-debuginfo={$debuginfo}` is unstable on this platform
|
||||
|
|
|
@ -10,7 +10,7 @@ use rustc_lint_defs::{Applicability, LintExpectationId};
|
|||
use rustc_span::edition::LATEST_STABLE_EDITION;
|
||||
use rustc_span::symbol::{Ident, MacroRulesNormalizedIdent, Symbol};
|
||||
use rustc_span::{edition::Edition, Span, DUMMY_SP};
|
||||
use rustc_target::spec::PanicStrategy;
|
||||
use rustc_target::spec::{PanicStrategy, SplitDebuginfo, StackProtector, TargetTriple};
|
||||
use std::borrow::Cow;
|
||||
use std::fmt;
|
||||
use std::hash::{Hash, Hasher};
|
||||
|
@ -93,6 +93,9 @@ into_diagnostic_arg_using_display!(
|
|||
Ident,
|
||||
MacroRulesNormalizedIdent,
|
||||
ParseIntError,
|
||||
StackProtector,
|
||||
&TargetTriple,
|
||||
SplitDebuginfo
|
||||
);
|
||||
|
||||
impl IntoDiagnosticArg for bool {
|
||||
|
|
|
@ -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,
|
||||
}
|
||||
|
|
|
@ -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() });
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue