Add rustc_baked_icu_data
crate.
This commit is contained in:
parent
70fe5f08ff
commit
42d3bda08c
9
compiler/rustc_baked_icu_data/Cargo.toml
Normal file
9
compiler/rustc_baked_icu_data/Cargo.toml
Normal file
@ -0,0 +1,9 @@
|
||||
[package]
|
||||
name = "rustc_baked_icu_data"
|
||||
version = "0.0.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
icu_list = "1.0.0"
|
||||
icu_provider = "1.0.1"
|
||||
litemap = "0.6.0"
|
18
compiler/rustc_baked_icu_data/src/data/any.rs
Normal file
18
compiler/rustc_baked_icu_data/src/data/any.rs
Normal file
@ -0,0 +1,18 @@
|
||||
// @generated
|
||||
impl AnyProvider for BakedDataProvider {
|
||||
fn load_any(&self, key: DataKey, req: DataRequest) -> Result<AnyResponse, DataError> {
|
||||
const ANDLISTV1MARKER: ::icu_provider::DataKeyHash =
|
||||
::icu_list::provider::AndListV1Marker::KEY.hashed();
|
||||
#[allow(clippy::match_single_binding)]
|
||||
match key.hashed() {
|
||||
ANDLISTV1MARKER => list::and_v1::DATA
|
||||
.get_by(|k| req.locale.strict_cmp(k.as_bytes()).reverse())
|
||||
.copied()
|
||||
.map(AnyPayload::from_static_ref)
|
||||
.ok_or(DataErrorKind::MissingLocale),
|
||||
_ => Err(DataErrorKind::MissingDataKey),
|
||||
}
|
||||
.map_err(|e| e.with_req(key, req))
|
||||
.map(|payload| AnyResponse { payload: Some(payload), metadata: Default::default() })
|
||||
}
|
||||
}
|
1160
compiler/rustc_baked_icu_data/src/data/list/and_v1.rs
Normal file
1160
compiler/rustc_baked_icu_data/src/data/list/and_v1.rs
Normal file
File diff suppressed because it is too large
Load Diff
2
compiler/rustc_baked_icu_data/src/data/list/mod.rs
Normal file
2
compiler/rustc_baked_icu_data/src/data/list/mod.rs
Normal file
@ -0,0 +1,2 @@
|
||||
// @generated
|
||||
pub mod and_v1;
|
25
compiler/rustc_baked_icu_data/src/data/mod.rs
Normal file
25
compiler/rustc_baked_icu_data/src/data/mod.rs
Normal file
@ -0,0 +1,25 @@
|
||||
// @generated
|
||||
mod list;
|
||||
/// This data provider was programmatically generated by [`icu_datagen`](
|
||||
/// https://unicode-org.github.io/icu4x-docs/doc/icu_datagen/enum.Out.html#variant.Module).
|
||||
#[non_exhaustive]
|
||||
pub struct BakedDataProvider;
|
||||
use ::icu_provider::prelude::*;
|
||||
impl DataProvider<::icu_list::provider::AndListV1Marker> for BakedDataProvider {
|
||||
fn load(
|
||||
&self,
|
||||
req: DataRequest,
|
||||
) -> Result<DataResponse<::icu_list::provider::AndListV1Marker>, DataError> {
|
||||
Ok(DataResponse {
|
||||
metadata: Default::default(),
|
||||
payload: Some(DataPayload::from_owned(zerofrom::ZeroFrom::zero_from(
|
||||
*list::and_v1::DATA
|
||||
.get_by(|k| req.locale.strict_cmp(k.as_bytes()).reverse())
|
||||
.ok_or_else(|| {
|
||||
DataErrorKind::MissingLocale
|
||||
.with_req(::icu_list::provider::AndListV1Marker::KEY, req)
|
||||
})?,
|
||||
))),
|
||||
})
|
||||
}
|
||||
}
|
17
compiler/rustc_baked_icu_data/src/lib.rs
Normal file
17
compiler/rustc_baked_icu_data/src/lib.rs
Normal file
@ -0,0 +1,17 @@
|
||||
//! Baked ICU data for eager translation support.
|
||||
//!
|
||||
#![allow(elided_lifetimes_in_paths)]
|
||||
|
||||
// generated with:
|
||||
// ```text
|
||||
// icu4x-datagen -W --pretty --fingerprint --use-separate-crates --cldr-tag latest --icuexport-tag latest \
|
||||
// --format mod -l en es fr it ja pt ru tr zh-Hans zh-Hant -k list/and@1 -o src/data
|
||||
// ```
|
||||
|
||||
mod data;
|
||||
|
||||
pub use data::BakedDataProvider;
|
||||
|
||||
pub fn baked_data_provider() -> BakedDataProvider {
|
||||
data::BakedDataProvider
|
||||
}
|
@ -133,6 +133,10 @@
|
||||
"hashbrown",
|
||||
"hermit-abi",
|
||||
"humantime",
|
||||
"icu_list",
|
||||
"icu_locid",
|
||||
"icu_provider",
|
||||
"icu_provider_macros",
|
||||
"if_chain",
|
||||
"indexmap",
|
||||
"instant",
|
||||
@ -145,6 +149,7 @@
|
||||
"libc",
|
||||
"libloading",
|
||||
"libz-sys",
|
||||
"litemap",
|
||||
"lock_api",
|
||||
"log",
|
||||
"matchers",
|
||||
@ -253,9 +258,16 @@
|
||||
"winapi-i686-pc-windows-gnu",
|
||||
"winapi-util",
|
||||
"winapi-x86_64-pc-windows-gnu",
|
||||
"writeable",
|
||||
// this is a false-positive: it's only used by rustfmt, but because it's enabled through a
|
||||
// feature, tidy thinks it's used by rustc as well.
|
||||
"yansi-term",
|
||||
"yoke",
|
||||
"yoke-derive",
|
||||
"zerofrom",
|
||||
"zerofrom-derive",
|
||||
"zerovec",
|
||||
"zerovec-derive",
|
||||
];
|
||||
|
||||
const PERMITTED_CRANELIFT_DEPENDENCIES: &[&str] = &[
|
||||
|
Loading…
Reference in New Issue
Block a user