[PATCH 0/2] rust: switch from bilge to bitfield-struct

Paolo Bonzini posted 2 patches 1 month, 1 week ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20260817141559.940844-1-pbonzini@redhat.com
Maintainers: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>, "Alex Bennée" <alex.bennee@linaro.org>, Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Cargo.lock                                    |  71 +-----------
Cargo.toml                                    |   1 +
rust/hw/char/pl011/Cargo.toml                 |   3 +-
rust/hw/char/pl011/src/registers.rs           | 108 +++++++++---------
rust/migration/src/vmstate.rs                 |  45 +-------
scripts/archive-source.sh                     |   7 +-
scripts/make-release                          |   4 +-
subprojects/.gitignore                        |   8 +-
subprojects/arbitrary-int-1-rs.wrap           |   9 --
subprojects/bilge-0.2-rs.wrap                 |   9 --
subprojects/bilge-impl-0.2-rs.wrap            |   9 --
subprojects/bitfield-struct-0.13-rs.wrap      |   6 +
subprojects/either-1-rs.wrap                  |   9 --
subprojects/itertools-0.11-rs.wrap            |   9 --
.../proc-macro-error-1-rs/meson/meson.build   |   3 -
subprojects/proc-macro-error-1-rs.wrap        |  10 --
subprojects/proc-macro-error-attr-1-rs.wrap   |   9 --
17 files changed, 71 insertions(+), 249 deletions(-)
delete mode 100644 subprojects/arbitrary-int-1-rs.wrap
delete mode 100644 subprojects/bilge-0.2-rs.wrap
delete mode 100644 subprojects/bilge-impl-0.2-rs.wrap
create mode 100644 subprojects/bitfield-struct-0.13-rs.wrap
delete mode 100644 subprojects/either-1-rs.wrap
delete mode 100644 subprojects/itertools-0.11-rs.wrap
delete mode 100644 subprojects/packagefiles/proc-macro-error-1-rs/meson/meson.build
delete mode 100644 subprojects/proc-macro-error-1-rs.wrap
delete mode 100644 subprojects/proc-macro-error-attr-1-rs.wrap
[PATCH 0/2] rust: switch from bilge to bitfield-struct
Posted by Paolo Bonzini 1 month, 1 week ago
The bilge crate is heavily reliant on traits and, because trait functions
are never const, it does not work well with const; also important is
that bilge's support for the zerocopy crate is tied to an older version
and has never been updated.

The bitfield-struct crate, instead, is built from the ground up to
support const, and has much simpler code with fewer dependencies.
Its use is pretty much the same: device code does not change at
all, only register declarations do.  So, switch to it before it's
too late.

Paolo

Based-on: <20260817134538.924615-1-pbonzini@redhat.com>

Paolo Bonzini (2):
  rust: pl011: switch from bilge to bitfield-struct
  rust: remove bilge crate

 Cargo.lock                                    |  71 +-----------
 Cargo.toml                                    |   1 +
 rust/hw/char/pl011/Cargo.toml                 |   3 +-
 rust/hw/char/pl011/src/registers.rs           | 108 +++++++++---------
 rust/migration/src/vmstate.rs                 |  45 +-------
 scripts/archive-source.sh                     |   7 +-
 scripts/make-release                          |   4 +-
 subprojects/.gitignore                        |   8 +-
 subprojects/arbitrary-int-1-rs.wrap           |   9 --
 subprojects/bilge-0.2-rs.wrap                 |   9 --
 subprojects/bilge-impl-0.2-rs.wrap            |   9 --
 subprojects/bitfield-struct-0.13-rs.wrap      |   6 +
 subprojects/either-1-rs.wrap                  |   9 --
 subprojects/itertools-0.11-rs.wrap            |   9 --
 .../proc-macro-error-1-rs/meson/meson.build   |   3 -
 subprojects/proc-macro-error-1-rs.wrap        |  10 --
 subprojects/proc-macro-error-attr-1-rs.wrap   |   9 --
 17 files changed, 71 insertions(+), 249 deletions(-)
 delete mode 100644 subprojects/arbitrary-int-1-rs.wrap
 delete mode 100644 subprojects/bilge-0.2-rs.wrap
 delete mode 100644 subprojects/bilge-impl-0.2-rs.wrap
 create mode 100644 subprojects/bitfield-struct-0.13-rs.wrap
 delete mode 100644 subprojects/either-1-rs.wrap
 delete mode 100644 subprojects/itertools-0.11-rs.wrap
 delete mode 100644 subprojects/packagefiles/proc-macro-error-1-rs/meson/meson.build
 delete mode 100644 subprojects/proc-macro-error-1-rs.wrap
 delete mode 100644 subprojects/proc-macro-error-attr-1-rs.wrap

-- 
2.55.0
Re: [PATCH 0/2] rust: switch from bilge to bitfield-struct
Posted by Marc-André Lureau 1 month, 1 week ago
On Mon, Aug 17, 2026 at 6:17 PM Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> The bilge crate is heavily reliant on traits and, because trait functions
> are never const, it does not work well with const; also important is
> that bilge's support for the zerocopy crate is tied to an older version
> and has never been updated.
>
> The bitfield-struct crate, instead, is built from the ground up to
> support const, and has much simpler code with fewer dependencies.
> Its use is pretty much the same: device code does not change at
> all, only register declarations do.  So, switch to it before it's
> too late.
>
> Paolo
>
> Based-on: <20260817134538.924615-1-pbonzini@redhat.com>

lgtm
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>

>
> Paolo Bonzini (2):
>   rust: pl011: switch from bilge to bitfield-struct
>   rust: remove bilge crate
>
>  Cargo.lock                                    |  71 +-----------
>  Cargo.toml                                    |   1 +
>  rust/hw/char/pl011/Cargo.toml                 |   3 +-
>  rust/hw/char/pl011/src/registers.rs           | 108 +++++++++---------
>  rust/migration/src/vmstate.rs                 |  45 +-------
>  scripts/archive-source.sh                     |   7 +-
>  scripts/make-release                          |   4 +-
>  subprojects/.gitignore                        |   8 +-
>  subprojects/arbitrary-int-1-rs.wrap           |   9 --
>  subprojects/bilge-0.2-rs.wrap                 |   9 --
>  subprojects/bilge-impl-0.2-rs.wrap            |   9 --
>  subprojects/bitfield-struct-0.13-rs.wrap      |   6 +
>  subprojects/either-1-rs.wrap                  |   9 --
>  subprojects/itertools-0.11-rs.wrap            |   9 --
>  .../proc-macro-error-1-rs/meson/meson.build   |   3 -
>  subprojects/proc-macro-error-1-rs.wrap        |  10 --
>  subprojects/proc-macro-error-attr-1-rs.wrap   |   9 --
>  17 files changed, 71 insertions(+), 249 deletions(-)
>  delete mode 100644 subprojects/arbitrary-int-1-rs.wrap
>  delete mode 100644 subprojects/bilge-0.2-rs.wrap
>  delete mode 100644 subprojects/bilge-impl-0.2-rs.wrap
>  create mode 100644 subprojects/bitfield-struct-0.13-rs.wrap
>  delete mode 100644 subprojects/either-1-rs.wrap
>  delete mode 100644 subprojects/itertools-0.11-rs.wrap
>  delete mode 100644 subprojects/packagefiles/proc-macro-error-1-rs/meson/meson.build
>  delete mode 100644 subprojects/proc-macro-error-1-rs.wrap
>  delete mode 100644 subprojects/proc-macro-error-attr-1-rs.wrap
>
> --
> 2.55.0
>
>


-- 
Marc-André Lureau