From c619df8f7013feac348ec4ad5de5d9cfb2cd4063 Mon Sep 17 00:00:00 2001 From: Robert Bastian Date: Thu, 10 Aug 2023 16:44:53 +0200 Subject: [PATCH] Be semver safe for `icu_capi/test_provider` (#3833) --- ffi/diplomat/Cargo.toml | 2 +- ffi/diplomat/cpp/docs/source/locale_ffi.rst | 4 ++-- ffi/diplomat/cpp/docs/source/provider_ffi.rst | 4 ++-- ffi/diplomat/cpp/include/ICU4XDataProvider.hpp | 4 ++-- ffi/diplomat/cpp/include/ICU4XLocale.hpp | 4 ++-- ffi/diplomat/js/docs/source/locale_ffi.rst | 4 ++-- ffi/diplomat/js/docs/source/provider_ffi.rst | 4 ++-- ffi/diplomat/js/include/ICU4XDataProvider.d.ts | 4 ++-- ffi/diplomat/js/include/ICU4XLocale.d.ts | 4 ++-- ffi/diplomat/src/datetime_formatter.rs | 2 -- ffi/diplomat/src/locale.rs | 8 ++++---- ffi/diplomat/src/provider.rs | 6 +++--- 12 files changed, 24 insertions(+), 26 deletions(-) diff --git a/ffi/diplomat/Cargo.toml b/ffi/diplomat/Cargo.toml index 160f6390653..c250ffe21a7 100644 --- a/ffi/diplomat/Cargo.toml +++ b/ffi/diplomat/Cargo.toml @@ -65,7 +65,7 @@ logging = ["icu_provider/logging", "dep:log"] simple_logger = ["dep:simple_logger", "logging"] # Legacy features -provider_test = [] +provider_test = ["compiled_data"] cpp_default = ["logging"] wasm_default = ["logging"] diff --git a/ffi/diplomat/cpp/docs/source/locale_ffi.rst b/ffi/diplomat/cpp/docs/source/locale_ffi.rst index f1897450119..f65b6589724 100644 --- a/ffi/diplomat/cpp/docs/source/locale_ffi.rst +++ b/ffi/diplomat/cpp/docs/source/locale_ffi.rst @@ -166,14 +166,14 @@ .. cpp:function:: static ICU4XLocale create_en() - Unconditionally panics. + Deprecated Use `create_from_string("en"). .. cpp:function:: static ICU4XLocale create_bn() - Unconditionally panics. + Deprecated Use `create_from_string("bn"). diff --git a/ffi/diplomat/cpp/docs/source/provider_ffi.rst b/ffi/diplomat/cpp/docs/source/provider_ffi.rst index a185ccf0821..fcd53586cdd 100644 --- a/ffi/diplomat/cpp/docs/source/provider_ffi.rst +++ b/ffi/diplomat/cpp/docs/source/provider_ffi.rst @@ -26,9 +26,9 @@ .. cpp:function:: static ICU4XDataProvider create_test() - Unconditionally panics. + Deprecated - It used to provide a test data provider, but has been superseded by ``create_compiled``. + Use ``create_compiled()``. .. cpp:function:: static diplomat::result create_from_byte_slice(const diplomat::span blob) diff --git a/ffi/diplomat/cpp/include/ICU4XDataProvider.hpp b/ffi/diplomat/cpp/include/ICU4XDataProvider.hpp index b382c1de33f..48ab9b29740 100644 --- a/ffi/diplomat/cpp/include/ICU4XDataProvider.hpp +++ b/ffi/diplomat/cpp/include/ICU4XDataProvider.hpp @@ -52,9 +52,9 @@ class ICU4XDataProvider { static diplomat::result create_fs(const std::string_view path); /** - * Unconditionally panics. + * Deprecated * - * It used to provide a test data provider, but has been superseded by `create_compiled`. + * Use `create_compiled()`. */ static ICU4XDataProvider create_test(); diff --git a/ffi/diplomat/cpp/include/ICU4XLocale.hpp b/ffi/diplomat/cpp/include/ICU4XLocale.hpp index ba6b6342587..8d00ba208cd 100644 --- a/ffi/diplomat/cpp/include/ICU4XLocale.hpp +++ b/ffi/diplomat/cpp/include/ICU4XLocale.hpp @@ -197,14 +197,14 @@ class ICU4XLocale { ICU4XOrdering strict_cmp(const std::string_view other) const; /** - * Unconditionally panics. + * Deprecated * * Use `create_from_string("en"). */ static ICU4XLocale create_en(); /** - * Unconditionally panics. + * Deprecated * * Use `create_from_string("bn"). */ diff --git a/ffi/diplomat/js/docs/source/locale_ffi.rst b/ffi/diplomat/js/docs/source/locale_ffi.rst index ed2ca2543b7..8c780979469 100644 --- a/ffi/diplomat/js/docs/source/locale_ffi.rst +++ b/ffi/diplomat/js/docs/source/locale_ffi.rst @@ -115,14 +115,14 @@ .. js:function:: create_en() - Unconditionally panics. + Deprecated Use `create_from_string("en"). .. js:function:: create_bn() - Unconditionally panics. + Deprecated Use `create_from_string("bn"). diff --git a/ffi/diplomat/js/docs/source/provider_ffi.rst b/ffi/diplomat/js/docs/source/provider_ffi.rst index e55c05c6dbd..50c7d5e717f 100644 --- a/ffi/diplomat/js/docs/source/provider_ffi.rst +++ b/ffi/diplomat/js/docs/source/provider_ffi.rst @@ -26,9 +26,9 @@ .. js:function:: create_test() - Unconditionally panics. + Deprecated - It used to provide a test data provider, but has been superseded by ``create_compiled``. + Use ``create_compiled()``. .. js:function:: create_from_byte_slice(blob) diff --git a/ffi/diplomat/js/include/ICU4XDataProvider.d.ts b/ffi/diplomat/js/include/ICU4XDataProvider.d.ts index 4a0443f2b36..88bc5902da7 100644 --- a/ffi/diplomat/js/include/ICU4XDataProvider.d.ts +++ b/ffi/diplomat/js/include/ICU4XDataProvider.d.ts @@ -31,9 +31,9 @@ export class ICU4XDataProvider { /** - * Unconditionally panics. + * Deprecated - * It used to provide a test data provider, but has been superseded by `create_compiled`. + * Use `create_compiled()`. */ static create_test(): ICU4XDataProvider; diff --git a/ffi/diplomat/js/include/ICU4XLocale.d.ts b/ffi/diplomat/js/include/ICU4XLocale.d.ts index fb472542a9d..b18b577302d 100644 --- a/ffi/diplomat/js/include/ICU4XLocale.d.ts +++ b/ffi/diplomat/js/include/ICU4XLocale.d.ts @@ -143,7 +143,7 @@ export class ICU4XLocale { /** - * Unconditionally panics. + * Deprecated * Use `create_from_string("en"). */ @@ -151,7 +151,7 @@ export class ICU4XLocale { /** - * Unconditionally panics. + * Deprecated * Use `create_from_string("bn"). */ diff --git a/ffi/diplomat/src/datetime_formatter.rs b/ffi/diplomat/src/datetime_formatter.rs index a9da7cafe1d..c68b3381e93 100644 --- a/ffi/diplomat/src/datetime_formatter.rs +++ b/ffi/diplomat/src/datetime_formatter.rs @@ -25,8 +25,6 @@ pub mod ffi { #[diplomat::opaque] /// An ICU4X TimeFormatter object capable of formatting an [`ICU4XTime`] type (and others) as a string #[diplomat::rust_link(icu::datetime::TimeFormatter, Struct)] - // TODO(#2153) - Rename to ICU4XTimeFormatter when we remove the dependency on calendar - // from TimeFormatter. pub struct ICU4XTimeFormatter(pub TimeFormatter); #[diplomat::enum_convert(length::Time, needs_wildcard)] diff --git a/ffi/diplomat/src/locale.rs b/ffi/diplomat/src/locale.rs index da43ccebb39..c6c5401a55e 100644 --- a/ffi/diplomat/src/locale.rs +++ b/ffi/diplomat/src/locale.rs @@ -185,20 +185,20 @@ pub mod ffi { self.0.strict_cmp(other).into() } - /// Unconditionally panics. + /// Deprecated /// /// Use `create_from_string("en"). #[cfg(feature = "provider_test")] pub fn create_en() -> Box { - unimplemented!() + Box::new(ICU4XLocale(icu_locid::locale!("en"))) } - /// Unconditionally panics. + /// Deprecated /// /// Use `create_from_string("bn"). #[cfg(feature = "provider_test")] pub fn create_bn() -> Box { - unimplemented!() + Box::new(ICU4XLocale(icu_locid::locale!("bn"))) } } } diff --git a/ffi/diplomat/src/provider.rs b/ffi/diplomat/src/provider.rs index 095bf80732a..e08f57dcb37 100644 --- a/ffi/diplomat/src/provider.rs +++ b/ffi/diplomat/src/provider.rs @@ -75,15 +75,15 @@ pub mod ffi { ))) } - /// Unconditionally panics. + /// Deprecated /// - /// It used to provide a test data provider, but has been superseded by `create_compiled`. + /// Use `create_compiled()`. #[cfg(all( feature = "provider_test", any(feature = "any_provider", feature = "buffer_provider") ))] pub fn create_test() -> Box { - unimplemented!() + Self::create_compiled() } /// Constructs a `BlobDataProvider` and returns it as an [`ICU4XDataProvider`].