mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-09 02:24:58 -06:00
rust: let bilge use "let ... else"
"let ... else" was stabilized in 1.65.0; bumping the minimum supported Rust version means we don't need to patch it out anymore. Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org> Reviewed-by: Zhao Liu <zhao1.liu@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
e4fb0be1d1
commit
51209c2aed
3 changed files with 0 additions and 49 deletions
|
@ -76,9 +76,6 @@ are missing:
|
||||||
|
|
||||||
* ``cast_mut()``/``cast_const()`` (1.65.0). Use ``as`` instead.
|
* ``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)
|
* Generic Associated Types (1.65.0)
|
||||||
|
|
||||||
* ``CStr::from_bytes_with_nul()`` as a ``const`` function (1.72.0).
|
* ``CStr::from_bytes_with_nul()`` as a ``const`` function (1.72.0).
|
||||||
|
|
|
@ -5,7 +5,6 @@ source_filename = bilge-impl-0.2.0.tar.gz
|
||||||
source_hash = feb11e002038ad243af39c2068c8a72bcf147acf05025dcdb916fcc000adb2d8
|
source_hash = feb11e002038ad243af39c2068c8a72bcf147acf05025dcdb916fcc000adb2d8
|
||||||
#method = cargo
|
#method = cargo
|
||||||
patch_directory = bilge-impl-0.2-rs
|
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:
|
# bump this version number on every change to meson.build or the patches:
|
||||||
# v2
|
# v2
|
||||||
|
|
|
@ -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 {
|
|
Loading…
Add table
Add a link
Reference in a new issue