Skip to content

Commit 242daf8

Browse files
committed
Handle selecting the default locale better
1 parent 6f92031 commit 242daf8

File tree

1 file changed

+5
-2
lines changed
  • compiler/rustc_error_messages/src

1 file changed

+5
-2
lines changed

compiler/rustc_error_messages/src/lib.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,10 @@ pub fn fluent_bundle(
135135

136136
let fallback_locale = langid!("en-US");
137137
let requested_fallback_locale = requested_locale.as_ref() == Some(&fallback_locale);
138-
138+
trace!(?requested_fallback_locale);
139+
if requested_fallback_locale && additional_ftl_path.is_none() {
140+
return Ok(None);
141+
}
139142
// If there is only `-Z additional-ftl-path`, assume locale is "en-US", otherwise use user
140143
// provided locale.
141144
let locale = requested_locale.clone().unwrap_or(fallback_locale);
@@ -153,7 +156,7 @@ pub fn fluent_bundle(
153156
bundle.set_use_isolating(with_directionality_markers);
154157

155158
// If the user requests the default locale then don't try to load anything.
156-
if !requested_fallback_locale && let Some(requested_locale) = requested_locale {
159+
if let Some(requested_locale) = requested_locale {
157160
let mut found_resources = false;
158161
for sysroot in user_provided_sysroot.iter_mut().chain(sysroot_candidates.iter_mut()) {
159162
sysroot.push("share");

0 commit comments

Comments
 (0)