From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: manos.pitsidianakis@linaro.org, qemu-rust@nongnu.org
Subject: [PATCH 04/11] rust: let bilge use "let ... else"
Date: Mon, 5 May 2025 11:04:29 +0200 [thread overview]
Message-ID: <20250505090438.24992-5-pbonzini@redhat.com> (raw)
In-Reply-To: <20250505090438.24992-1-pbonzini@redhat.com>
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
docs/devel/rust.rst | 3 --
subprojects/bilge-impl-0.2-rs.wrap | 1 -
.../packagefiles/bilge-impl-1.63.0.patch | 45 -------------------
3 files changed, 49 deletions(-)
delete mode 100644 subprojects/packagefiles/bilge-impl-1.63.0.patch
diff --git a/docs/devel/rust.rst b/docs/devel/rust.rst
index c7dfba98de1..8167ff49aa9 100644
--- a/docs/devel/rust.rst
+++ b/docs/devel/rust.rst
@@ -76,9 +76,6 @@ are missing:
* ``cast_mut()``/``cast_const()`` (1.65.0). Use ``as`` instead.
-* "let ... else" (1.65.0). Use ``if let`` instead. This is currently patched
- in QEMU's vendored copy of the bilge crate.
-
* Generic Associated Types (1.65.0)
* ``CStr::from_bytes_with_nul()`` as a ``const`` function (1.72.0).
diff --git a/subprojects/bilge-impl-0.2-rs.wrap b/subprojects/bilge-impl-0.2-rs.wrap
index d14c3dc769b..4f84eca1ccd 100644
--- a/subprojects/bilge-impl-0.2-rs.wrap
+++ b/subprojects/bilge-impl-0.2-rs.wrap
@@ -5,7 +5,6 @@ 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
# bump this version number on every change to meson.build or the patches:
# v2
diff --git a/subprojects/packagefiles/bilge-impl-1.63.0.patch b/subprojects/packagefiles/bilge-impl-1.63.0.patch
deleted file mode 100644
index 987428a6d65..00000000000
--- a/subprojects/packagefiles/bilge-impl-1.63.0.patch
+++ /dev/null
@@ -1,45 +0,0 @@
---- 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.49.0
next prev parent reply other threads:[~2025-05-05 9:06 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-05 9:04 [PATCH 00/11] rust: allow minimum version of 1.77 Paolo Bonzini
2025-05-05 9:04 ` [PATCH 01/11] lcitool: use newer Rust for Debian and Ubuntu Paolo Bonzini
2025-05-05 9:04 ` [PATCH 02/11] meson, cargo: require Rust 1.77.0 Paolo Bonzini
2025-05-05 9:29 ` Manos Pitsidianakis
2025-05-06 7:39 ` Zhao Liu
2025-05-05 9:04 ` [PATCH 03/11] rust: use std::ffi instead of std::os::raw Paolo Bonzini
2025-05-06 7:40 ` Zhao Liu
2025-05-05 9:04 ` Paolo Bonzini [this message]
2025-05-06 7:41 ` [PATCH 04/11] rust: let bilge use "let ... else" Zhao Liu
2025-05-05 9:04 ` [PATCH 05/11] rust: qemu_api_macros: make pattern matching more readable and efficient Paolo Bonzini
2025-05-06 7:48 ` Zhao Liu
2025-05-05 9:04 ` [PATCH 06/11] rust: use MaybeUninit::zeroed() in const context Paolo Bonzini
2025-05-06 7:56 ` Zhao Liu
2025-05-05 9:04 ` [PATCH 07/11] rust: qom: fix TODO about zeroability of classes Paolo Bonzini
2025-05-05 9:32 ` Manos Pitsidianakis
2025-05-06 8:01 ` Zhao Liu
2025-05-05 9:04 ` [PATCH 08/11] rust: enable clippy::ptr_cast_constness Paolo Bonzini
2025-05-06 8:04 ` Zhao Liu
2025-05-05 9:04 ` [PATCH 09/11] rust: remove offset_of replacement Paolo Bonzini
2025-05-05 9:34 ` Manos Pitsidianakis
2025-05-06 8:32 ` Zhao Liu
2025-05-05 9:04 ` [PATCH 10/11] rust: replace c_str! with c"" literals Paolo Bonzini
2025-05-06 8:34 ` Zhao Liu
2025-05-05 9:04 ` [PATCH 11/11] docs: rust: update for newer minimum supported version Paolo Bonzini
2025-05-05 9:35 ` Manos Pitsidianakis
2025-05-06 8:38 ` Zhao Liu
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=20250505090438.24992-5-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=manos.pitsidianakis@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-rust@nongnu.org \
/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).