diff options
| author | bors <bors@rust-lang.org> | 2025-08-28 13:41:38 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-08-28 13:41:38 +0000 |
| commit | 1f7dcc878d73c45cc40018aac6e5c767446df110 (patch) | |
| tree | 1aea0e97a7daea5e9b5377eccdb8601a47446ac4 /compiler/rustc_error_messages/src/lib.rs | |
| parent | b41634205b549a62cfa55363d1e00c4143d30033 (diff) | |
| parent | 556d2fa94b7d6da252bdf34b683970e1cd016b14 (diff) | |
| download | rust-1f7dcc878d73c45cc40018aac6e5c767446df110.tar.gz rust-1f7dcc878d73c45cc40018aac6e5c767446df110.zip | |
Auto merge of #145958 - Zalathar:rollup-ii9z77c, r=Zalathar
Rollup of 9 pull requests Successful merges: - rust-lang/rust#142727 (wasm: rm static mut) - rust-lang/rust#143193 (Port `#[link]` to the new attribute parsing infrastructure ) - rust-lang/rust#144864 (No source fixes) - rust-lang/rust#145913 (Add spin_loop hint for LoongArch) - rust-lang/rust#145926 (compiletest: Remove several remnants of the old libtest-based executor) - rust-lang/rust#145928 (Rename `Location::file_with_nul` to `file_as_c_str`) - rust-lang/rust#145930 (`const`ify (the unstable) `str::as_str`) - rust-lang/rust#145941 (Disable `integer_to_ptr_transmutes` suggestion for unsized types) - rust-lang/rust#145953 (Update `icu_list` to 2.0) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_error_messages/src/lib.rs')
| -rw-r--r-- | compiler/rustc_error_messages/src/lib.rs | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/compiler/rustc_error_messages/src/lib.rs b/compiler/rustc_error_messages/src/lib.rs index d8bacbe762b..7b7843f6cf3 100644 --- a/compiler/rustc_error_messages/src/lib.rs +++ b/compiler/rustc_error_messages/src/lib.rs @@ -15,7 +15,6 @@ use fluent_bundle::FluentResource; pub use fluent_bundle::types::FluentType; pub use fluent_bundle::{self, FluentArgs, FluentError, FluentValue}; use fluent_syntax::parser::ParserError; -use icu_provider_adapters::fallback::{LocaleFallbackProvider, LocaleFallbacker}; use intl_memoizer::concurrent::IntlLangMemoizer; use rustc_data_structures::sync::{DynSend, IntoDynSyncSend}; use rustc_macros::{Decodable, Encodable}; @@ -515,8 +514,8 @@ impl From<Vec<Span>> for MultiSpan { } } -fn icu_locale_from_unic_langid(lang: LanguageIdentifier) -> Option<icu_locid::Locale> { - icu_locid::Locale::try_from_bytes(lang.to_string().as_bytes()).ok() +fn icu_locale_from_unic_langid(lang: LanguageIdentifier) -> Option<icu_locale::Locale> { + icu_locale::Locale::try_from_str(&lang.to_string()).ok() } pub fn fluent_value_from_str_list_sep_by_and(l: Vec<Cow<'_, str>>) -> FluentValue<'_> { @@ -568,21 +567,15 @@ pub fn fluent_value_from_str_list_sep_by_and(l: Vec<Cow<'_, str>>) -> FluentValu where Self: Sized, { - let baked_data_provider = rustc_baked_icu_data::baked_data_provider(); - let locale_fallbacker = - LocaleFallbacker::try_new_with_any_provider(&baked_data_provider) - .expect("Failed to create fallback provider"); - let data_provider = - LocaleFallbackProvider::new_with_fallbacker(baked_data_provider, locale_fallbacker); let locale = icu_locale_from_unic_langid(lang) .unwrap_or_else(|| rustc_baked_icu_data::supported_locales::EN); - let list_formatter = - icu_list::ListFormatter::try_new_and_with_length_with_any_provider( - &data_provider, - &locale.into(), - icu_list::ListLength::Wide, - ) - .expect("Failed to create list formatter"); + let list_formatter = icu_list::ListFormatter::try_new_and_unstable( + &rustc_baked_icu_data::BakedDataProvider, + locale.into(), + icu_list::options::ListFormatterOptions::default() + .with_length(icu_list::options::ListLength::Wide), + ) + .expect("Failed to create list formatter"); Ok(MemoizableListFormatter(list_formatter)) } |
