File reproducible.patch of Package rage-encryption
This is https://github.com/kellpossible/cargo-i18n/pull/151
For reproducible builds
* https://github.com/str4d/rage/issues/568
* https://bugzilla.suse.com/show_bug.cgi?id=1244083
index a7cb31b6..27adc933 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1290,8 +1290,6 @@ dependencies = [
[[package]]
name = "i18n-embed-fl"
version = "0.9.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f6e9571c3cba9eba538eaa5ee40031b26debe76f0c7e17bafc97ea57a76cd82e"
dependencies = [
"dashmap",
"find-crate",
diff --git a/Cargo.toml b/Cargo.toml
index 8468db45..7a14ba14 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -65,3 +65,6 @@ clap = { version = "4.3", features = ["derive"] }
console = { version = "0.15", default-features = false }
env_logger = "0.10"
log = "0.4"
+
+[patch.crates-io]
+i18n-embed-fl = { path="vendor/i18n-embed-fl-0.9.2" }
diff --git a/vendor/i18n-embed-fl-0.9.2/src/lib.rs b/vendor/i18n-embed-fl-0.9.2/src/lib.rs
index 6598997f..ef1ca69c 100644
--- a/vendor/i18n-embed-fl-0.9.2/src/lib.rs
+++ b/vendor/i18n-embed-fl-0.9.2/src/lib.rs
@@ -58,7 +58,7 @@ enum FlArgs {
/// arg3 = calc_value());
/// ```
KeyValuePairs {
- specified_args: HashMap<syn::LitStr, Box<syn::Expr>>,
+ specified_args: Vec<(syn::LitStr, Box<syn::Expr>)>,
},
/// `fl!(LOADER, "message", "optional-attribute")` no arguments after the message id and optional attribute id.
None,
@@ -75,7 +75,7 @@ impl Parse for FlArgs {
return Ok(FlArgs::HashMap(hash_map));
}
- let mut args_map: HashMap<syn::LitStr, Box<syn::Expr>> = HashMap::new();
+ let mut args: Vec<(syn::LitStr, Box<syn::Expr>)> = Vec::new();
while let Ok(expr) = input.parse::<syn::ExprAssign>() {
let argument_name_ident_opt = match &*expr.left {
@@ -100,7 +100,10 @@ impl Parse for FlArgs {
let argument_value = expr.right;
- if let Some(_duplicate) = args_map.insert(argument_name_lit_str, argument_value) {
+ if args
+ .iter()
+ .any(|(key, _value)| argument_name_lit_str == *key)
+ {
// There's no Clone implementation by default.
let argument_name_lit_str =
syn::LitStr::new(&argument_name_string, argument_name_ident.span());
@@ -112,20 +115,22 @@ impl Parse for FlArgs {
),
));
}
+ args.push((argument_name_lit_str, argument_value));
// parse the next comma if there is one
let _result = input.parse::<syn::Token![,]>();
}
- if args_map.is_empty() {
+ if args.is_empty() {
let span = match input.fork().parse::<syn::Expr>() {
Ok(expr) => expr.span(),
Err(_) => input.span(),
};
Err(syn::Error::new(span, "fl!() unable to parse args input"))
} else {
+ args.sort_by_key(|(s, _)| s.value());
Ok(FlArgs::KeyValuePairs {
- specified_args: args_map,
+ specified_args: args,
})
}
} else {
@@ -670,7 +675,7 @@ fn fuzzy_attribute_suggestions(
fn check_message_args(
message: FluentMessage<'_>,
- specified_args: &HashMap<syn::LitStr, Box<syn::Expr>>,
+ specified_args: &Vec<(syn::LitStr, Box<syn::Expr>)>,
) {
if let Some(pattern) = message.value() {
let mut args = Vec::new();
@@ -679,8 +684,8 @@ fn check_message_args(
let args_set: HashSet<&str> = args.into_iter().collect();
let key_args: Vec<String> = specified_args
- .keys()
- .map(|key| {
+ .iter()
+ .map(|(key, _value)| {
let arg = key.value();
if !args_set.contains(arg.as_str()) {
@@ -737,7 +742,7 @@ fn check_message_args(
fn check_attribute_args(
attr: FluentAttribute<'_>,
- specified_args: &HashMap<syn::LitStr, Box<syn::Expr>>,
+ specified_args: &Vec<(syn::LitStr, Box<syn::Expr>)>,
) {
let pattern = attr.value();
let mut args = Vec::new();
@@ -746,8 +751,8 @@ fn check_attribute_args(
let args_set: HashSet<&str> = args.into_iter().collect();
let key_args: Vec<String> = specified_args
- .keys()
- .map(|key| {
+ .iter()
+ .map(|(key, _value)| {
let arg = key.value();
if !args_set.contains(arg.as_str()) {