@samitouri / QOSamiQemu / commits / 3ac34c6d25

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>

Paolo Bonzini committed Jul 24, 2026 at 11:52 UTC 3ac34c6d25d84353c882ab0e11ea25229d4f1a48
13 files changed +5 -198
Cargo.lock
-73
@@ -8,12 +8,6 @@ version = "1.0.98"
8 source = "registry+https://github.com/rust-lang/crates.io-index"
9 checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487"
10
11 -[[package]]
12 -name = "arbitrary-int"
13 -version = "1.2.7"
14 -source = "registry+https://github.com/rust-lang/crates.io-index"
15 -checksum = "c84fc003e338a6f69fbd4f7fe9f92b535ff13e9af8997f3b14b6ddff8b1df46d"
16 -
11 [[package]]
12 name = "attrs"
13 version = "0.2.9"
@@ -35,29 +29,6 @@ dependencies = [
29 "syn",
30 ]
31
38 -[[package]]
39 -name = "bilge"
40 -version = "0.2.0"
41 -source = "registry+https://github.com/rust-lang/crates.io-index"
42 -checksum = "dc707ed8ebf81de5cd6c7f48f54b4c8621760926cdf35a57000747c512e67b57"
43 -dependencies = [
44 - "arbitrary-int",
45 - "bilge-impl",
46 -]
47 -
48 -[[package]]
49 -name = "bilge-impl"
50 -version = "0.2.0"
51 -source = "registry+https://github.com/rust-lang/crates.io-index"
52 -checksum = "feb11e002038ad243af39c2068c8a72bcf147acf05025dcdb916fcc000adb2d8"
53 -dependencies = [
54 - "itertools",
55 - "proc-macro-error",
56 - "proc-macro2",
57 - "quote",
58 - "syn",
59 -]
60 -
32 [[package]]
33 name = "bits"
34 version = "0.1.0"
@@ -114,12 +85,6 @@ dependencies = [
85 "qemu_macros",
86 ]
87
117 -[[package]]
118 -name = "either"
119 -version = "1.12.0"
120 -source = "registry+https://github.com/rust-lang/crates.io-index"
121 -checksum = "3dca9240753cf90908d7e4aac30f630662b02aebaa1b58a3cadabdb23385b58b"
122 -
88 [[package]]
89 name = "equivalent"
90 version = "1.0.2"
@@ -208,15 +173,6 @@ dependencies = [
173 "hashbrown",
174 ]
175
211 -[[package]]
212 -name = "itertools"
213 -version = "0.11.0"
214 -source = "registry+https://github.com/rust-lang/crates.io-index"
215 -checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57"
216 -dependencies = [
217 - "either",
218 -]
219 -
176 [[package]]
177 name = "libc"
178 version = "0.2.162"
@@ -274,29 +230,6 @@ version = "0.5.2"
230 source = "registry+https://github.com/rust-lang/crates.io-index"
231 checksum = "136558b6e1ebaecc92755d0ffaf9421f519531bed30cc2ad23b22cb00965cc5e"
232
277 -[[package]]
278 -name = "proc-macro-error"
279 -version = "1.0.4"
280 -source = "registry+https://github.com/rust-lang/crates.io-index"
281 -checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
282 -dependencies = [
283 - "proc-macro-error-attr",
284 - "proc-macro2",
285 - "quote",
286 - "version_check",
287 -]
288 -
289 -[[package]]
290 -name = "proc-macro-error-attr"
291 -version = "1.0.4"
292 -source = "registry+https://github.com/rust-lang/crates.io-index"
293 -checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
294 -dependencies = [
295 - "proc-macro2",
296 - "quote",
297 - "version_check",
298 -]
299 -
233 [[package]]
234 name = "proc-macro2"
235 version = "1.0.95"
@@ -529,12 +462,6 @@ version = "0.2.0"
462 source = "registry+https://github.com/rust-lang/crates.io-index"
463 checksum = "852e951cb7832cb45cb1169900d19760cfa39b82bc0ea9c0e5a14ae88411c98b"
464
532 -[[package]]
533 -name = "version_check"
534 -version = "0.9.4"
535 -source = "registry+https://github.com/rust-lang/crates.io-index"
536 -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
537 -
465 [[package]]
466 name = "winnow"
467 version = "1.0.4"
rust/migration/src/vmstate.rs
+4 -41
@@ -11,8 +11,7 @@
11 //! migration format for a struct. This is based on the [`VMState`] trait,
12 //! which is defined by all migratable types.
13 //!
14 -//! * [`impl_vmstate_forward`](crate::impl_vmstate_forward),
15 -//! [`impl_vmstate_bitsized`](crate::impl_vmstate_bitsized), and
14 +//! * [`impl_vmstate_forward`](crate::impl_vmstate_forward) and
15 //! [`impl_vmstate_struct`](crate::impl_vmstate_struct), which help with the
16 //! definition of the [`VMState`] trait (respectively for transparent structs,
17 //! nested structs and `bilge`-defined types)
@@ -90,7 +89,7 @@ macro_rules! call_func_with_field {
89 /// The contents of this trait go straight into structs that are parsed by C
90 /// code and used to introspect into other structs. Generally, you don't need
91 /// to implement it except via macros that do it for you, such as
93 -/// `impl_vmstate_bitsized!`.
92 +/// `impl_vmstate_forward!`.
93 pub unsafe trait VMState {
94 /// The base contents of a `VMStateField` (minus the name and offset) for
95 /// the type that is implementing the trait.
@@ -133,9 +132,8 @@ pub const fn vmstate_varray_flag<T: VMState>(_: PhantomData<T>) -> VMStateFlags
132 /// * an array of any of the above
133 ///
134 /// In order to support other types, the trait `VMState` must be implemented
136 -/// for them. The macros [`impl_vmstate_forward`](crate::impl_vmstate_forward),
137 -/// [`impl_vmstate_bitsized`](crate::impl_vmstate_bitsized), and
138 -/// [`impl_vmstate_struct`](crate::impl_vmstate_struct) help with this.
135 +/// for them. The macros [`impl_vmstate_forward`](crate::impl_vmstate_forward)
136 +/// and [`impl_vmstate_struct`](crate::impl_vmstate_struct) help with this.
137 ///
138 /// [`BqlCell`]: ../../bql/cell/struct.BqlCell.html
139 /// [`BqlRefCell`]: ../../bql/cell/struct.BqlRefCell.html
@@ -211,41 +209,6 @@ impl_vmstate_transparent!(std::pin::Pin<T> where T: VMState);
209 impl_vmstate_transparent!(common::Opaque<T> where T: VMState);
210 impl_vmstate_transparent!(std::mem::ManuallyDrop<T> where T: VMState);
211
214 -#[macro_export]
215 -macro_rules! impl_vmstate_bitsized {
216 - ($type:ty) => {
217 - unsafe impl $crate::vmstate::VMState for $type {
218 - const BASE: $crate::bindings::VMStateField =
219 - <<<$type as ::bilge::prelude::Bitsized>::ArbitraryInt
220 - as ::bilge::prelude::Number>::UnderlyingType
221 - as $crate::vmstate::VMState>::BASE;
222 - const VARRAY_FLAG: $crate::bindings::VMStateFlags =
223 - <<<$type as ::bilge::prelude::Bitsized>::ArbitraryInt
224 - as ::bilge::prelude::Number>::UnderlyingType
225 - as $crate::vmstate::VMState>::VARRAY_FLAG;
226 - }
227 -
228 - impl $crate::migratable::ToMigrationState for $type {
229 - type Migrated = <<$type as ::bilge::prelude::Bitsized>::ArbitraryInt
230 - as ::bilge::prelude::Number>::UnderlyingType;
231 -
232 - fn snapshot_migration_state(&self, target: &mut Self::Migrated) -> Result<(), $crate::InvalidError> {
233 - *target = Self::Migrated::from(*self);
234 - Ok(())
235 - }
236 -
237 - fn restore_migrated_state_mut(
238 - &mut self,
239 - source: Self::Migrated,
240 - version_id: u8,
241 - ) -> Result<(), $crate::InvalidError> {
242 - *self = Self::from(source);
243 - Ok(())
244 - }
245 - }
246 - };
247 -}
248 -
212 // Scalar types using predefined VMStateInfos
213
214 macro_rules! impl_vmstate_scalar {
scripts/archive-source.sh
-6
@@ -32,19 +32,13 @@ subprojects=(
32 attrs-0.2-rs
33 berkeley-softfloat-3
34 berkeley-testfloat-3
35 - bilge-0.2-rs
36 - bilge-impl-0.2-rs
35 bitfield-0.9-rs
38 - either-1-rs
36 foreign-0.3-rs
37 glib-sys-0.21-rs
41 - itertools-0.11-rs
38 keycodemapdb
39 libc-0.2-rs
40 libvfio-user
41 probe-0.5-rs
46 - proc-macro-error-1-rs
47 - proc-macro-error-attr-1-rs
42 proc-macro2-1-rs
43 quote-1-rs
44 syn-2-rs
scripts/make-release
+1 -4
@@ -41,10 +41,7 @@ fi
41 # Only include wraps that are invoked with subproject()
42 SUBPROJECTS="libvfio-user keycodemapdb berkeley-softfloat-3
43 berkeley-testfloat-3 anyhow-1-rs arbitrary-int-1-rs attrs-0.2-rs bilge-0.2-rs
44 - bilge-impl-0.2-rs either-1-rs foreign-0.3-rs itertools-0.11-rs
45 - bilge-impl-0.2-rs bitfield-0.9-rs either-1-rs foreign-0.3-rs itertools-0.11-rs
46 - libc-0.2-rs probe-0.5-rs proc-macro2-1-rs
47 - proc-macro-error-1-rs proc-macro-error-attr-1-rs quote-1-rs
44 + bitfield-0.9-rs foreign-0.3-rs libc-0.2-rs probe-0.5-rs proc-macro2-1-rs quote-1-rs
45 syn-2-rs unicode-ident-1-rs"
46
47 src="$1"
subprojects/.gitignore
-7
@@ -7,19 +7,12 @@
7 /libvfio-user
8 /slirp
9 /anyhow-*
10 -/arbitrary-int-*
10 /attrs-*
12 -/bilge-*
13 -/bilge-impl-*
11 /bitfield-struct-*
15 -/either-*
12 /foreign-*
13 /glib-sys-*
18 -/itertools-*
14 /libc-*
15 /probe-*
21 -/proc-macro-error-*
22 -/proc-macro-error-attr-*
16 /proc-macro*
17 /quote-*
18 /syn-*
subprojects/arbitrary-int-1-rs.wrap deleted
-9
@@ -1,9 +0,0 @@
1 -[wrap-file]
2 -directory = arbitrary-int-1.2.7
3 -source_url = https://crates.io/api/v1/crates/arbitrary-int/1.2.7/download
4 -source_filename = arbitrary-int-1.2.7.tar.gz
5 -source_hash = c84fc003e338a6f69fbd4f7fe9f92b535ff13e9af8997f3b14b6ddff8b1df46d
6 -method = cargo
7 -
8 -# bump this version number on every change to meson.build or the patches:
9 -# v2
subprojects/bilge-0.2-rs.wrap deleted
-9
@@ -1,9 +0,0 @@
1 -[wrap-file]
2 -directory = bilge-0.2.0
3 -source_url = https://crates.io/api/v1/crates/bilge/0.2.0/download
4 -source_filename = bilge-0.2.0.tar.gz
5 -source_hash = dc707ed8ebf81de5cd6c7f48f54b4c8621760926cdf35a57000747c512e67b57
6 -method = cargo
7 -
8 -# bump this version number on every change to meson.build or the patches:
9 -# v2
subprojects/bilge-impl-0.2-rs.wrap deleted
-9
@@ -1,9 +0,0 @@
1 -[wrap-file]
2 -directory = bilge-impl-0.2.0
3 -source_url = https://crates.io/api/v1/crates/bilge-impl/0.2.0/download
4 -source_filename = bilge-impl-0.2.0.tar.gz
5 -source_hash = feb11e002038ad243af39c2068c8a72bcf147acf05025dcdb916fcc000adb2d8
6 -method = cargo
7 -
8 -# bump this version number on every change to meson.build or the patches:
9 -# v2
subprojects/either-1-rs.wrap deleted
-9
@@ -1,9 +0,0 @@
1 -[wrap-file]
2 -directory = either-1.12.0
3 -source_url = https://crates.io/api/v1/crates/either/1.12.0/download
4 -source_filename = either-1.12.0.tar.gz
5 -source_hash = 3dca9240753cf90908d7e4aac30f630662b02aebaa1b58a3cadabdb23385b58b
6 -method = cargo
7 -
8 -# bump this version number on every change to meson.build or the patches:
9 -# v2
subprojects/itertools-0.11-rs.wrap deleted
-9
@@ -1,9 +0,0 @@
1 -[wrap-file]
2 -directory = itertools-0.11.0
3 -source_url = https://crates.io/api/v1/crates/itertools/0.11.0/download
4 -source_filename = itertools-0.11.0.tar.gz
5 -source_hash = b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57
6 -method = cargo
7 -
8 -# bump this version number on every change to meson.build or the patches:
9 -# v2
subprojects/packagefiles/proc-macro-error-1-rs/meson/meson.build deleted
-3
@@ -1,3 +0,0 @@
1 -extra_args = [
2 - '--cfg', 'use_fallback',
3 -]
subprojects/proc-macro-error-1-rs.wrap deleted
-10
@@ -1,10 +0,0 @@
1 -[wrap-file]
2 -directory = proc-macro-error-1.0.4
3 -source_url = https://crates.io/api/v1/crates/proc-macro-error/1.0.4/download
4 -source_filename = proc-macro-error-1.0.4.tar.gz
5 -source_hash = da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c
6 -method = cargo
7 -patch_directory = proc-macro-error-1-rs
8 -
9 -# bump this version number on every change to meson.build or the patches:
10 -# v3
subprojects/proc-macro-error-attr-1-rs.wrap deleted
-9
@@ -1,9 +0,0 @@
1 -[wrap-file]
2 -directory = proc-macro-error-attr-1.0.4
3 -source_url = https://crates.io/api/v1/crates/proc-macro-error-attr/1.0.4/download
4 -source_filename = proc-macro-error-attr-1.0.4.tar.gz
5 -source_hash = a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869
6 -method = cargo
7 -
8 -# bump this version number on every change to meson.build or the patches:
9 -# v2