Commit 3ac34c6d25 for qemu.org
commit 3ac34c6d25d84353c882ab0e11ea25229d4f1a48
Author: Paolo Bonzini <pbonzini@redhat.com>
Date: Fri Jul 24 11:52:41 2026 +0200
rust: remove bilge crate
It has just been replaced with bitfield-struct.
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
diff --git a/Cargo.lock b/Cargo.lock
index 6f683e8bb1..ad664a812d 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -8,12 +8,6 @@ version = "1.0.98"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487"
-[[package]]
-name = "arbitrary-int"
-version = "1.2.7"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c84fc003e338a6f69fbd4f7fe9f92b535ff13e9af8997f3b14b6ddff8b1df46d"
-
[[package]]
name = "attrs"
version = "0.2.9"
@@ -35,29 +29,6 @@ dependencies = [
"syn",
]
-[[package]]
-name = "bilge"
-version = "0.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dc707ed8ebf81de5cd6c7f48f54b4c8621760926cdf35a57000747c512e67b57"
-dependencies = [
- "arbitrary-int",
- "bilge-impl",
-]
-
-[[package]]
-name = "bilge-impl"
-version = "0.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "feb11e002038ad243af39c2068c8a72bcf147acf05025dcdb916fcc000adb2d8"
-dependencies = [
- "itertools",
- "proc-macro-error",
- "proc-macro2",
- "quote",
- "syn",
-]
-
[[package]]
name = "bits"
version = "0.1.0"
@@ -114,12 +85,6 @@ dependencies = [
"qemu_macros",
]
-[[package]]
-name = "either"
-version = "1.12.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3dca9240753cf90908d7e4aac30f630662b02aebaa1b58a3cadabdb23385b58b"
-
[[package]]
name = "equivalent"
version = "1.0.2"
@@ -208,15 +173,6 @@ dependencies = [
"hashbrown",
]
-[[package]]
-name = "itertools"
-version = "0.11.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57"
-dependencies = [
- "either",
-]
-
[[package]]
name = "libc"
version = "0.2.162"
@@ -274,29 +230,6 @@ version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "136558b6e1ebaecc92755d0ffaf9421f519531bed30cc2ad23b22cb00965cc5e"
-[[package]]
-name = "proc-macro-error"
-version = "1.0.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
-dependencies = [
- "proc-macro-error-attr",
- "proc-macro2",
- "quote",
- "version_check",
-]
-
-[[package]]
-name = "proc-macro-error-attr"
-version = "1.0.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
-dependencies = [
- "proc-macro2",
- "quote",
- "version_check",
-]
-
[[package]]
name = "proc-macro2"
version = "1.0.95"
@@ -529,12 +462,6 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "852e951cb7832cb45cb1169900d19760cfa39b82bc0ea9c0e5a14ae88411c98b"
-[[package]]
-name = "version_check"
-version = "0.9.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
-
[[package]]
name = "winnow"
version = "1.0.4"
diff --git a/rust/migration/src/vmstate.rs b/rust/migration/src/vmstate.rs
index 63d78b4f27..7409b592a2 100644
--- a/rust/migration/src/vmstate.rs
+++ b/rust/migration/src/vmstate.rs
@@ -11,8 +11,7 @@
//! migration format for a struct. This is based on the [`VMState`] trait,
//! which is defined by all migratable types.
//!
-//! * [`impl_vmstate_forward`](crate::impl_vmstate_forward),
-//! [`impl_vmstate_bitsized`](crate::impl_vmstate_bitsized), and
+//! * [`impl_vmstate_forward`](crate::impl_vmstate_forward) and
//! [`impl_vmstate_struct`](crate::impl_vmstate_struct), which help with the
//! definition of the [`VMState`] trait (respectively for transparent structs,
//! nested structs and `bilge`-defined types)
@@ -90,7 +89,7 @@ const fn phantom__<T>(_: &T) -> ::core::marker::PhantomData<T> { ::core::marker:
/// The contents of this trait go straight into structs that are parsed by C
/// code and used to introspect into other structs. Generally, you don't need
/// to implement it except via macros that do it for you, such as
-/// `impl_vmstate_bitsized!`.
+/// `impl_vmstate_forward!`.
pub unsafe trait VMState {
/// The base contents of a `VMStateField` (minus the name and offset) for
/// the type that is implementing the trait.
@@ -133,9 +132,8 @@ pub const fn vmstate_varray_flag<T: VMState>(_: PhantomData<T>) -> VMStateFlags
/// * an array of any of the above
///
/// In order to support other types, the trait `VMState` must be implemented
-/// for them. The macros [`impl_vmstate_forward`](crate::impl_vmstate_forward),
-/// [`impl_vmstate_bitsized`](crate::impl_vmstate_bitsized), and
-/// [`impl_vmstate_struct`](crate::impl_vmstate_struct) help with this.
+/// for them. The macros [`impl_vmstate_forward`](crate::impl_vmstate_forward)
+/// and [`impl_vmstate_struct`](crate::impl_vmstate_struct) help with this.
///
/// [`BqlCell`]: ../../bql/cell/struct.BqlCell.html
/// [`BqlRefCell`]: ../../bql/cell/struct.BqlRefCell.html
@@ -211,41 +209,6 @@ unsafe impl<$base> $crate::vmstate::VMState for $type where $base: $crate::vmsta
impl_vmstate_transparent!(common::Opaque<T> where T: VMState);
impl_vmstate_transparent!(std::mem::ManuallyDrop<T> where T: VMState);
-#[macro_export]
-macro_rules! impl_vmstate_bitsized {
- ($type:ty) => {
- unsafe impl $crate::vmstate::VMState for $type {
- const BASE: $crate::bindings::VMStateField =
- <<<$type as ::bilge::prelude::Bitsized>::ArbitraryInt
- as ::bilge::prelude::Number>::UnderlyingType
- as $crate::vmstate::VMState>::BASE;
- const VARRAY_FLAG: $crate::bindings::VMStateFlags =
- <<<$type as ::bilge::prelude::Bitsized>::ArbitraryInt
- as ::bilge::prelude::Number>::UnderlyingType
- as $crate::vmstate::VMState>::VARRAY_FLAG;
- }
-
- impl $crate::migratable::ToMigrationState for $type {
- type Migrated = <<$type as ::bilge::prelude::Bitsized>::ArbitraryInt
- as ::bilge::prelude::Number>::UnderlyingType;
-
- fn snapshot_migration_state(&self, target: &mut Self::Migrated) -> Result<(), $crate::InvalidError> {
- *target = Self::Migrated::from(*self);
- Ok(())
- }
-
- fn restore_migrated_state_mut(
- &mut self,
- source: Self::Migrated,
- version_id: u8,
- ) -> Result<(), $crate::InvalidError> {
- *self = Self::from(source);
- Ok(())
- }
- }
- };
-}
-
// Scalar types using predefined VMStateInfos
macro_rules! impl_vmstate_scalar {
diff --git a/scripts/archive-source.sh b/scripts/archive-source.sh
index 5d52644df9..399b2d99e8 100755
--- a/scripts/archive-source.sh
+++ b/scripts/archive-source.sh
@@ -32,19 +32,13 @@ subprojects=(
attrs-0.2-rs
berkeley-softfloat-3
berkeley-testfloat-3
- bilge-0.2-rs
- bilge-impl-0.2-rs
bitfield-0.9-rs
- either-1-rs
foreign-0.3-rs
glib-sys-0.21-rs
- itertools-0.11-rs
keycodemapdb
libc-0.2-rs
libvfio-user
probe-0.5-rs
- proc-macro-error-1-rs
- proc-macro-error-attr-1-rs
proc-macro2-1-rs
quote-1-rs
syn-2-rs
diff --git a/scripts/make-release b/scripts/make-release
index fc0dc4bceb..b5944d3928 100755
--- a/scripts/make-release
+++ b/scripts/make-release
@@ -41,10 +41,7 @@ fi
# Only include wraps that are invoked with subproject()
SUBPROJECTS="libvfio-user keycodemapdb berkeley-softfloat-3
berkeley-testfloat-3 anyhow-1-rs arbitrary-int-1-rs attrs-0.2-rs bilge-0.2-rs
- bilge-impl-0.2-rs either-1-rs foreign-0.3-rs itertools-0.11-rs
- bilge-impl-0.2-rs bitfield-0.9-rs either-1-rs foreign-0.3-rs itertools-0.11-rs
- libc-0.2-rs probe-0.5-rs proc-macro2-1-rs
- proc-macro-error-1-rs proc-macro-error-attr-1-rs quote-1-rs
+ bitfield-0.9-rs foreign-0.3-rs libc-0.2-rs probe-0.5-rs proc-macro2-1-rs quote-1-rs
syn-2-rs unicode-ident-1-rs"
src="$1"
diff --git a/subprojects/.gitignore b/subprojects/.gitignore
index 984f5865dc..3559b2c758 100644
--- a/subprojects/.gitignore
+++ b/subprojects/.gitignore
@@ -7,19 +7,12 @@
/libvfio-user
/slirp
/anyhow-*
-/arbitrary-int-*
/attrs-*
-/bilge-*
-/bilge-impl-*
/bitfield-struct-*
-/either-*
/foreign-*
/glib-sys-*
-/itertools-*
/libc-*
/probe-*
-/proc-macro-error-*
-/proc-macro-error-attr-*
/proc-macro*
/quote-*
/syn-*
diff --git a/subprojects/arbitrary-int-1-rs.wrap b/subprojects/arbitrary-int-1-rs.wrap
deleted file mode 100644
index 5cf4b11e4a..0000000000
--- a/subprojects/arbitrary-int-1-rs.wrap
+++ /dev/null
@@ -1,9 +0,0 @@
-[wrap-file]
-directory = arbitrary-int-1.2.7
-source_url = https://crates.io/api/v1/crates/arbitrary-int/1.2.7/download
-source_filename = arbitrary-int-1.2.7.tar.gz
-source_hash = c84fc003e338a6f69fbd4f7fe9f92b535ff13e9af8997f3b14b6ddff8b1df46d
-method = cargo
-
-# bump this version number on every change to meson.build or the patches:
-# v2
diff --git a/subprojects/bilge-0.2-rs.wrap b/subprojects/bilge-0.2-rs.wrap
deleted file mode 100644
index cff10f6710..0000000000
--- a/subprojects/bilge-0.2-rs.wrap
+++ /dev/null
@@ -1,9 +0,0 @@
-[wrap-file]
-directory = bilge-0.2.0
-source_url = https://crates.io/api/v1/crates/bilge/0.2.0/download
-source_filename = bilge-0.2.0.tar.gz
-source_hash = dc707ed8ebf81de5cd6c7f48f54b4c8621760926cdf35a57000747c512e67b57
-method = cargo
-
-# bump this version number on every change to meson.build or the patches:
-# v2
diff --git a/subprojects/bilge-impl-0.2-rs.wrap b/subprojects/bilge-impl-0.2-rs.wrap
deleted file mode 100644
index f8963eba73..0000000000
--- a/subprojects/bilge-impl-0.2-rs.wrap
+++ /dev/null
@@ -1,9 +0,0 @@
-[wrap-file]
-directory = bilge-impl-0.2.0
-source_url = https://crates.io/api/v1/crates/bilge-impl/0.2.0/download
-source_filename = bilge-impl-0.2.0.tar.gz
-source_hash = feb11e002038ad243af39c2068c8a72bcf147acf05025dcdb916fcc000adb2d8
-method = cargo
-
-# bump this version number on every change to meson.build or the patches:
-# v2
diff --git a/subprojects/either-1-rs.wrap b/subprojects/either-1-rs.wrap
deleted file mode 100644
index 51c97df153..0000000000
--- a/subprojects/either-1-rs.wrap
+++ /dev/null
@@ -1,9 +0,0 @@
-[wrap-file]
-directory = either-1.12.0
-source_url = https://crates.io/api/v1/crates/either/1.12.0/download
-source_filename = either-1.12.0.tar.gz
-source_hash = 3dca9240753cf90908d7e4aac30f630662b02aebaa1b58a3cadabdb23385b58b
-method = cargo
-
-# bump this version number on every change to meson.build or the patches:
-# v2
diff --git a/subprojects/itertools-0.11-rs.wrap b/subprojects/itertools-0.11-rs.wrap
deleted file mode 100644
index e123ab389a..0000000000
--- a/subprojects/itertools-0.11-rs.wrap
+++ /dev/null
@@ -1,9 +0,0 @@
-[wrap-file]
-directory = itertools-0.11.0
-source_url = https://crates.io/api/v1/crates/itertools/0.11.0/download
-source_filename = itertools-0.11.0.tar.gz
-source_hash = b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57
-method = cargo
-
-# bump this version number on every change to meson.build or the patches:
-# v2
diff --git a/subprojects/packagefiles/proc-macro-error-1-rs/meson/meson.build b/subprojects/packagefiles/proc-macro-error-1-rs/meson/meson.build
deleted file mode 100644
index 52a244d2b1..0000000000
--- a/subprojects/packagefiles/proc-macro-error-1-rs/meson/meson.build
+++ /dev/null
@@ -1,3 +0,0 @@
-extra_args = [
- '--cfg', 'use_fallback',
-]
diff --git a/subprojects/proc-macro-error-1-rs.wrap b/subprojects/proc-macro-error-1-rs.wrap
deleted file mode 100644
index e57921bfad..0000000000
--- a/subprojects/proc-macro-error-1-rs.wrap
+++ /dev/null
@@ -1,10 +0,0 @@
-[wrap-file]
-directory = proc-macro-error-1.0.4
-source_url = https://crates.io/api/v1/crates/proc-macro-error/1.0.4/download
-source_filename = proc-macro-error-1.0.4.tar.gz
-source_hash = da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c
-method = cargo
-patch_directory = proc-macro-error-1-rs
-
-# bump this version number on every change to meson.build or the patches:
-# v3
diff --git a/subprojects/proc-macro-error-attr-1-rs.wrap b/subprojects/proc-macro-error-attr-1-rs.wrap
deleted file mode 100644
index 456d2c2b6d..0000000000
--- a/subprojects/proc-macro-error-attr-1-rs.wrap
+++ /dev/null
@@ -1,9 +0,0 @@
-[wrap-file]
-directory = proc-macro-error-attr-1.0.4
-source_url = https://crates.io/api/v1/crates/proc-macro-error-attr/1.0.4/download
-source_filename = proc-macro-error-attr-1.0.4.tar.gz
-source_hash = a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869
-method = cargo
-
-# bump this version number on every change to meson.build or the patches:
-# v2