about summary refs log tree commit diff
path: root/compiler/rustc_error_messages
diff options
context:
space:
mode:
authorRobert Bastian <robertbastian@unicode.org>2025-08-28 09:09:15 +0000
committerRobert Bastian <robertbastian@unicode.org>2025-08-28 09:38:55 +0000
commitd82a20e025701be09e87fbfa3a49bc4c2ae5662c (patch)
tree8c3519b89d1f90cacb2e99a6263c5308cb6d3082 /compiler/rustc_error_messages
parent43a216604a7fc98deb0744513341fc0d09e461d4 (diff)
downloadrust-d82a20e025701be09e87fbfa3a49bc4c2ae5662c.tar.gz
rust-d82a20e025701be09e87fbfa3a49bc4c2ae5662c.zip
Bump icu_list to 2.0
Diffstat (limited to 'compiler/rustc_error_messages')
-rw-r--r--compiler/rustc_error_messages/Cargo.toml6
-rw-r--r--compiler/rustc_error_messages/src/lib.rs27
2 files changed, 17 insertions, 16 deletions
diff --git a/compiler/rustc_error_messages/Cargo.toml b/compiler/rustc_error_messages/Cargo.toml
index ce5106aae0a..b9f97a60fc3 100644
--- a/compiler/rustc_error_messages/Cargo.toml
+++ b/compiler/rustc_error_messages/Cargo.toml
@@ -7,9 +7,9 @@ edition = "2024"
 # tidy-alphabetical-start
 fluent-bundle = "0.16"
 fluent-syntax = "0.12"
-icu_list = "1.2"
-icu_locid = "1.2"
-icu_provider_adapters = "1.2"
+icu_list = { version = "2.0", default-features = false, features = ["alloc"] }
+icu_locale = { version = "2.0", default-features = false }
+icu_provider_adapters = "2.0"
 intl-memoizer = "0.5.1"
 rustc_ast = { path = "../rustc_ast" }
 rustc_ast_pretty = { path = "../rustc_ast_pretty" }
diff --git a/compiler/rustc_error_messages/src/lib.rs b/compiler/rustc_error_messages/src/lib.rs
index d8bacbe762b..abc298ed4a3 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<'_> {
@@ -570,19 +569,21 @@ pub fn fluent_value_from_str_list_sep_by_and(l: Vec<Cow<'_, str>>) -> FluentValu
         {
             let baked_data_provider = rustc_baked_icu_data::baked_data_provider();
             let locale_fallbacker =
-                LocaleFallbacker::try_new_with_any_provider(&baked_data_provider)
+                icu_locale::LocaleFallbacker::try_new_unstable(&baked_data_provider)
                     .expect("Failed to create fallback provider");
-            let data_provider =
-                LocaleFallbackProvider::new_with_fallbacker(baked_data_provider, locale_fallbacker);
+            let data_provider = icu_provider_adapters::fallback::LocaleFallbackProvider::new(
+                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(
+                &data_provider,
+                locale.into(),
+                icu_list::options::ListFormatterOptions::default()
+                    .with_length(icu_list::options::ListLength::Wide),
+            )
+            .expect("Failed to create list formatter");
 
             Ok(MemoizableListFormatter(list_formatter))
         }