Skip to content

Commit

Permalink
rustc_session: make cli early_fatal messages translatable
Browse files Browse the repository at this point in the history
  • Loading branch information
GrigorenkoPV committed Aug 9, 2024
1 parent 7325f55 commit 18128d0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
5 changes: 5 additions & 0 deletions compiler/rustc_session/messages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ session_crate_name_empty = crate name must not be empty
session_crate_name_invalid = crate names cannot start with a `-`, but `{$s}` has a leading hyphen
session_empty_search_path = empty search path given via `-L`
session_expr_parentheses_needed = parentheses are required to parse this as an expression
session_failed_to_create_profiler = failed to create profiler: {$err}
Expand Down Expand Up @@ -86,6 +88,9 @@ session_profile_sample_use_file_does_not_exist = file `{$path}` passed to `-C pr
session_profile_use_file_does_not_exist = file `{$path}` passed to `-C profile-use` does not exist
session_rustc_builtin =
the `-Z unstable-options` flag must also be passed to enable the use of `@RUSTC_BUILTIN`
session_sanitizer_cfi_canonical_jump_tables_requires_cfi = `-Zsanitizer-cfi-canonical-jump-tables` requires `-Zsanitizer=cfi`
session_sanitizer_cfi_generalize_pointers_requires_cfi = `-Zsanitizer-cfi-generalize-pointers` requires `-Zsanitizer=cfi` or `-Zsanitizer=kcfi`
Expand Down
11 changes: 3 additions & 8 deletions compiler/rustc_session/src/search_paths.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use rustc_macros::{Decodable, Encodable, HashStable_Generic};
use rustc_target::spec::TargetTriple;

use crate::filesearch::make_target_lib_path;
use crate::EarlyDiagCtxt;
use crate::{fluent_generated, EarlyDiagCtxt};

#[derive(Clone, Debug)]
pub struct SearchPath {
Expand Down Expand Up @@ -73,20 +73,15 @@ impl SearchPath {
let dir = match path.strip_prefix("@RUSTC_BUILTIN") {
Some(stripped) => {
if !is_unstable_enabled {
#[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable
early_dcx.early_fatal(
"the `-Z unstable-options` flag must also be passed to \
enable the use of `@RUSTC_BUILTIN`",
);
early_dcx.early_fatal(fluent_generated::session_rustc_builtin);
}

make_target_lib_path(sysroot, triple.triple()).join("builtin").join(stripped)
}
None => PathBuf::from(path),
};
if dir.as_os_str().is_empty() {
#[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable
early_dcx.early_fatal("empty search path given via `-L`");
early_dcx.early_fatal(fluent_generated::session_empty_search_path);
}

Self::new(kind, dir)
Expand Down

0 comments on commit 18128d0

Please sign in to comment.