diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:18:32 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:18:32 +0000 |
commit | 4547b622d8d29df964fa2914213088b148c498fc (patch) | |
tree | 9fc6b25f3c3add6b745be9a2400a6e96140046e9 /vendor/unic-langid-impl/src | |
parent | Releasing progress-linux version 1.66.0+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-4547b622d8d29df964fa2914213088b148c498fc.tar.xz rustc-4547b622d8d29df964fa2914213088b148c498fc.zip |
Merging upstream version 1.67.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/unic-langid-impl/src')
5 files changed, 11 insertions, 12 deletions
diff --git a/vendor/unic-langid-impl/src/bin/generate_likelysubtags.rs b/vendor/unic-langid-impl/src/bin/generate_likelysubtags.rs index 4fec79939..a86ffa80d 100644 --- a/vendor/unic-langid-impl/src/bin/generate_likelysubtags.rs +++ b/vendor/unic-langid-impl/src/bin/generate_likelysubtags.rs @@ -1,6 +1,5 @@ use serde_json::Value; use std::fs; -use std::str::FromStr; use tinystr::TinyStr8; use unic_langid_impl::{subtags, LanguageIdentifier}; @@ -77,7 +76,7 @@ fn main() { match (lang, script, region) { (None, None, None) => lang_only.push(( - TinyStr8::from_str("und").unwrap().into(), + u64::from_le_bytes(*TinyStr8::from_str("und").unwrap().all_bytes()), (val_lang, val_script, val_region), )), (Some(l), None, None) => lang_only.push(( diff --git a/vendor/unic-langid-impl/src/subtags/language.rs b/vendor/unic-langid-impl/src/subtags/language.rs index 3703475e2..8b25bb609 100644 --- a/vendor/unic-langid-impl/src/subtags/language.rs +++ b/vendor/unic-langid-impl/src/subtags/language.rs @@ -34,7 +34,7 @@ impl Language { /// This function accepts any u64 that is exected to be a valid /// `TinyStr8` and a valid `Language` subtag. pub const unsafe fn from_raw_unchecked(v: u64) -> Self { - Self(Some(TinyStr8::new_unchecked(v))) + Self(Some(TinyStr8::from_bytes_unchecked(v.to_le_bytes()))) } pub fn matches<O: Borrow<Self>>( @@ -59,13 +59,13 @@ impl Language { impl From<Language> for Option<u64> { fn from(input: Language) -> Self { - input.0.map(|i| i.into()) + input.0.map(|i| u64::from_le_bytes(*i.all_bytes())) } } impl From<&Language> for Option<u64> { fn from(input: &Language) -> Self { - input.0.map(|i| i.into()) + input.0.map(|i| u64::from_le_bytes(*i.all_bytes())) } } diff --git a/vendor/unic-langid-impl/src/subtags/region.rs b/vendor/unic-langid-impl/src/subtags/region.rs index f14ac21bf..b7febe202 100644 --- a/vendor/unic-langid-impl/src/subtags/region.rs +++ b/vendor/unic-langid-impl/src/subtags/region.rs @@ -37,13 +37,13 @@ impl Region { /// This function accepts any u64 that is exected to be a valid /// `TinyStr4` and a valid `Region` subtag. pub const unsafe fn from_raw_unchecked(v: u32) -> Self { - Self(TinyStr4::new_unchecked(v)) + Self(TinyStr4::from_bytes_unchecked(v.to_le_bytes())) } } impl From<Region> for u32 { fn from(input: Region) -> Self { - input.0.into() + u32::from_le_bytes(*input.0.all_bytes()) } } diff --git a/vendor/unic-langid-impl/src/subtags/script.rs b/vendor/unic-langid-impl/src/subtags/script.rs index 63780e510..8cb38c8d5 100644 --- a/vendor/unic-langid-impl/src/subtags/script.rs +++ b/vendor/unic-langid-impl/src/subtags/script.rs @@ -25,13 +25,13 @@ impl Script { /// This function accepts any u64 that is exected to be a valid /// `TinyStr4` and a valid `Script` subtag. pub const unsafe fn from_raw_unchecked(v: u32) -> Self { - Self(TinyStr4::new_unchecked(v)) + Self(TinyStr4::from_bytes_unchecked(v.to_le_bytes())) } } impl From<Script> for u32 { fn from(input: Script) -> Self { - input.0.into() + u32::from_le_bytes(*input.0.all_bytes()) } } diff --git a/vendor/unic-langid-impl/src/subtags/variant.rs b/vendor/unic-langid-impl/src/subtags/variant.rs index 064ff3bb9..8b29a458e 100644 --- a/vendor/unic-langid-impl/src/subtags/variant.rs +++ b/vendor/unic-langid-impl/src/subtags/variant.rs @@ -35,19 +35,19 @@ impl Variant { /// This function accepts any u64 that is exected to be a valid /// `TinyStr8` and a valid `Variant` subtag. pub const unsafe fn from_raw_unchecked(v: u64) -> Self { - Self(TinyStr8::new_unchecked(v)) + Self(TinyStr8::from_bytes_unchecked(v.to_le_bytes())) } } impl From<Variant> for u64 { fn from(input: Variant) -> Self { - input.0.into() + u64::from_le_bytes(*input.0.all_bytes()) } } impl From<&Variant> for u64 { fn from(input: &Variant) -> Self { - input.0.into() + u64::from_le_bytes(*input.0.all_bytes()) } } |