From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: berrange@redhat.com, kwolf@redhat.com, junjie.mao@hotmail.com,
manos.pitsidianakis@linaro.org, Zhao Liu <zhao1.liu@intel.com>
Subject: [PATCH v2 01/14] rust: patch bilge-impl to allow compilation with 1.63.0
Date: Tue, 22 Oct 2024 12:09:42 +0200 [thread overview]
Message-ID: <20241022100956.196657-2-pbonzini@redhat.com> (raw)
In-Reply-To: <20241022100956.196657-1-pbonzini@redhat.com>
Apply a patch that removes "let ... else" constructs, replacing them with
"if let ... else" or "let ... = match ...". "let ... else" was stabilized in
Rust 1.65.0.
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
.gitattributes | 2 +
subprojects/bilge-impl-0.2-rs.wrap | 1 +
subprojects/packagefiles/.gitattributes | 1 +
.../packagefiles/bilge-impl-1.63.0.patch | 45 +++++++++++++++++++
4 files changed, 49 insertions(+)
create mode 100644 subprojects/packagefiles/.gitattributes
create mode 100644 subprojects/packagefiles/bilge-impl-1.63.0.patch
diff --git a/.gitattributes b/.gitattributes
index 6dc6383d3d1..9ce7a19581a 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -5,3 +5,5 @@
*.rs diff=rust
*.rs.inc diff=rust
Cargo.lock diff=toml merge=binary
+
+*.patch -text -whitespace
diff --git a/subprojects/bilge-impl-0.2-rs.wrap b/subprojects/bilge-impl-0.2-rs.wrap
index eefb10c36c2..b24c34a9043 100644
--- a/subprojects/bilge-impl-0.2-rs.wrap
+++ b/subprojects/bilge-impl-0.2-rs.wrap
@@ -5,3 +5,4 @@ source_filename = bilge-impl-0.2.0.tar.gz
source_hash = feb11e002038ad243af39c2068c8a72bcf147acf05025dcdb916fcc000adb2d8
#method = cargo
patch_directory = bilge-impl-0.2-rs
+diff_files = bilge-impl-1.63.0.patch
diff --git a/subprojects/packagefiles/.gitattributes b/subprojects/packagefiles/.gitattributes
new file mode 100644
index 00000000000..bf5b766d75d
--- /dev/null
+++ b/subprojects/packagefiles/.gitattributes
@@ -0,0 +1 @@
+/*.patch -text
diff --git a/subprojects/packagefiles/bilge-impl-1.63.0.patch b/subprojects/packagefiles/bilge-impl-1.63.0.patch
new file mode 100644
index 00000000000..987428a6d65
--- /dev/null
+++ b/subprojects/packagefiles/bilge-impl-1.63.0.patch
@@ -0,0 +1,45 @@
+--- a/src/shared/discriminant_assigner.rs
++++ b/src/shared/discriminant_assigner.rs
+@@ -26,20 +26,20 @@
+ let discriminant_expr = &discriminant.1;
+ let variant_name = &variant.ident;
+
+- let Expr::Lit(ExprLit { lit: Lit::Int(int), .. }) = discriminant_expr else {
++ if let Expr::Lit(ExprLit { lit: Lit::Int(int), .. }) = discriminant_expr {
++ let discriminant_value: u128 = int.base10_parse().unwrap_or_else(unreachable);
++ if discriminant_value > self.max_value() {
++ abort!(variant, "Value of variant exceeds the given number of bits")
++ }
++
++ Some(discriminant_value)
++ } else {
+ abort!(
+ discriminant_expr,
+ "variant `{}` is not a number", variant_name;
+ help = "only literal integers currently supported"
+ )
+- };
+-
+- let discriminant_value: u128 = int.base10_parse().unwrap_or_else(unreachable);
+- if discriminant_value > self.max_value() {
+- abort!(variant, "Value of variant exceeds the given number of bits")
+ }
+-
+- Some(discriminant_value)
+ }
+
+ fn assign(&mut self, variant: &Variant) -> u128 {
+--- a/src/shared/fallback.rs
++++ b/src/shared/fallback.rs
+@@ -22,8 +22,9 @@
+ }
+ Unnamed(fields) => {
+ let variant_fields = fields.unnamed.iter();
+- let Ok(fallback_value) = variant_fields.exactly_one() else {
+- abort!(variant, "fallback variant must have exactly one field"; help = "use only one field or change to a unit variant")
++ let fallback_value = match variant_fields.exactly_one() {
++ Ok(ok) => ok,
++ _ => abort!(variant, "fallback variant must have exactly one field"; help = "use only one field or change to a unit variant")
+ };
+
+ if !is_last_variant {
--
2.46.2
next prev parent reply other threads:[~2024-10-22 10:13 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-22 10:09 [PATCH v2 00/14] rust: allow older versions of rustc and bindgen Paolo Bonzini
2024-10-22 10:09 ` Paolo Bonzini [this message]
2024-10-24 2:12 ` [PATCH v2 01/14] rust: patch bilge-impl to allow compilation with 1.63.0 Junjie Mao
2024-10-24 10:43 ` Alex Bennée
2024-10-22 10:09 ` [PATCH v2 02/14] rust: fix cfgs of proc-macro2 for 1.63.0 Paolo Bonzini
2024-10-24 2:33 ` Junjie Mao
2024-10-24 9:02 ` Paolo Bonzini
2024-10-24 9:09 ` Paolo Bonzini
2024-10-22 10:09 ` [PATCH v2 03/14] rust: use std::os::raw instead of core::ffi Paolo Bonzini
2024-10-22 10:09 ` [PATCH v2 04/14] rust: introduce a c_str macro Paolo Bonzini
2024-10-22 10:09 ` [PATCH v2 05/14] rust: silence unknown warnings for the sake of old compilers Paolo Bonzini
2024-10-22 10:09 ` [PATCH v2 06/14] rust: synchronize dependencies between subprojects and Cargo.lock Paolo Bonzini
2024-10-24 2:53 ` Junjie Mao
2024-10-24 9:04 ` Paolo Bonzini
2024-10-22 10:09 ` [PATCH v2 07/14] rust: introduce alternative implementation of offset_of! Paolo Bonzini
2024-10-22 10:09 ` [PATCH v2 08/14] rust: do not use MaybeUninit::zeroed() Paolo Bonzini
2024-10-22 10:09 ` [PATCH v2 09/14] rust: clean up detection of the language Paolo Bonzini
2024-10-22 10:09 ` [PATCH v2 10/14] rust: allow version 1.63.0 of rustc Paolo Bonzini
2024-10-22 10:09 ` [PATCH v2 11/14] rust: do not use --generate-cstr Paolo Bonzini
2024-10-22 10:09 ` [PATCH v2 12/14] rust: allow older version of bindgen Paolo Bonzini
2024-10-22 10:09 ` [PATCH v2 13/14] rust: make rustfmt optional Paolo Bonzini
2024-10-22 10:09 ` [PATCH v2 14/14] dockerfiles: install bindgen from cargo on Ubuntu 22.04 Paolo Bonzini
2024-10-24 11:28 ` [PATCH v2 00/14] rust: allow older versions of rustc and bindgen Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241022100956.196657-2-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=berrange@redhat.com \
--cc=junjie.mao@hotmail.com \
--cc=kwolf@redhat.com \
--cc=manos.pitsidianakis@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=zhao1.liu@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).