Skip to content

Commit 60b4958

Browse files
committed
translations(rustc_session): migrates session.rs and config.rs
1 parent 4af35b8 commit 60b4958

File tree

4 files changed

+174
-38
lines changed

4 files changed

+174
-38
lines changed

compiler/rustc_error_messages/locales/en-US/session.ftl

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,29 @@ session_feature_diagnostic_for_issue =
1414
1515
session_feature_diagnostic_help =
1616
add `#![feature({$feature})]` to the crate attributes to enable
17+
18+
session_target_data_layout_parse_error = {$err}
19+
20+
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
21+
22+
session_profile_use_file_does_not_exist = File `{$path}` passed to `-C profile-use` does not exist.
23+
24+
session_linker_plugin_lto_windows_not_supported = Linker plugin based LTO is not supported together with `-C prefer-dynamic` when targeting Windows-like targets"
25+
26+
session_profile_sample_use_file_does_not_exist = File `{$path}` passed to `-C profile-sample-use` does not exist.
27+
28+
session_target_requires_unwind_tables = target requires unwind tables, they cannot be disabled with `-C force-unwind-tables=no`."
29+
30+
session_sanitizer_not_supported = {$us} sanitizer is not supported for this target
31+
32+
session_sanitizers_not_supported = {$us} sanitizers are not supported for this target
33+
34+
session_cannot_mix_and_match_sanitizers = `-Zsanitizer={$first}` is incompatible with `-Zsanitizer={$second}`
35+
36+
session_cannot_enable_crt_static_linux = sanitizer is incompatible with statically linked libc, disable it using `-C target-feature=-crt-static`
37+
38+
session_sanitizer_cfi_enabled = `-Zsanitizer=cfi` requires `-Clto`
39+
40+
session_unstable_virtual_function_elimination = `-Zvirtual-function-elimination` requires `-Clto`
41+
42+
session_unsupported_dwarf_version = requested DWARF version {$dwarf_version} is greater than 5

compiler/rustc_session/src/config.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//! Contains infrastructure for configuring the compiler, including parsing
22
//! command-line options.
33
4+
use crate::errors::TargetDataLayoutParseError;
45
pub use crate::options::*;
56

67
use crate::search_paths::SearchPath;
@@ -898,7 +899,7 @@ fn default_configuration(sess: &Session) -> CrateConfig {
898899
let max_atomic_width = sess.target.max_atomic_width();
899900
let atomic_cas = sess.target.atomic_cas;
900901
let layout = TargetDataLayout::parse(&sess.target).unwrap_or_else(|err| {
901-
sess.fatal(&err);
902+
sess.emit_fatal(TargetDataLayoutParseError { err });
902903
});
903904

904905
let mut ret = CrateConfig::default();

compiler/rustc_session/src/errors.rs

Lines changed: 68 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::num::NonZeroU32;
22

3-
use crate as rustc_session;
43
use crate::cgu_reuse_tracker::CguReuse;
4+
use crate::{self as rustc_session};
55
use rustc_errors::MultiSpan;
66
use rustc_macros::SessionDiagnostic;
77
use rustc_span::{Span, Symbol};
@@ -43,3 +43,70 @@ pub struct FeatureDiagnosticForIssue {
4343
pub struct FeatureDiagnosticHelp {
4444
pub feature: Symbol,
4545
}
46+
47+
#[derive(SessionDiagnostic)]
48+
#[diag(session::target_data_layout_parse_error)]
49+
pub struct TargetDataLayoutParseError {
50+
pub err: String,
51+
}
52+
53+
#[derive(SessionDiagnostic)]
54+
#[diag(session::not_circumvent_feature)]
55+
pub struct NotCircumventFeature;
56+
57+
#[derive(SessionDiagnostic)]
58+
#[diag(session::linker_plugin_lto_windows_not_supported)]
59+
pub struct LinkerPluginToWindowsNotSupported;
60+
61+
#[derive(SessionDiagnostic)]
62+
#[diag(session::profile_use_file_does_not_exist)]
63+
pub struct ProfileUseFileDoesNotExist<'a> {
64+
pub path: &'a std::path::Path,
65+
}
66+
67+
#[derive(SessionDiagnostic)]
68+
#[diag(session::profile_sample_use_file_does_not_exist)]
69+
pub struct ProfileSampleUseFileDoesNotExist<'a> {
70+
pub path: &'a std::path::Path,
71+
}
72+
73+
#[derive(SessionDiagnostic)]
74+
#[diag(session::target_requires_unwind_tables)]
75+
pub struct TargetRequiresUnwindTables;
76+
77+
#[derive(SessionDiagnostic)]
78+
#[diag(session::sanitizer_not_supported)]
79+
pub struct SanitizerNotSupported {
80+
pub us: String,
81+
}
82+
83+
#[derive(SessionDiagnostic)]
84+
#[diag(session::sanitizers_not_supported)]
85+
pub struct SanitizersNotSupported {
86+
pub us: String,
87+
}
88+
89+
#[derive(SessionDiagnostic)]
90+
#[diag(session::cannot_mix_and_match_sanitizers)]
91+
pub struct CannotMixAndMatchSanitizers {
92+
pub first: String,
93+
pub second: String,
94+
}
95+
96+
#[derive(SessionDiagnostic)]
97+
#[diag(session::cannot_enable_crt_static_linux)]
98+
pub struct CannotEnableCrtStaticLinux;
99+
100+
#[derive(SessionDiagnostic)]
101+
#[diag(session::sanitizer_cfi_enabled)]
102+
pub struct SanitizerCfiEnabled;
103+
104+
#[derive(SessionDiagnostic)]
105+
#[diag(session::unstable_virtual_function_elimination)]
106+
pub struct UnstableVirtualFunctionElimination;
107+
108+
#[derive(SessionDiagnostic)]
109+
#[diag(session::unsupported_dwarf_version)]
110+
pub struct UnsupportedDwarfVersion {
111+
pub dwarf_version: u32,
112+
}

0 commit comments

Comments
 (0)