qemu-rust.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Zhao Liu <zhao1.liu@intel.com>
To: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	qemu-devel@nongnu.org, qemu-rust@nongnu.org
Subject: Re: [PATCH v2] rust/qemu-macros: Convert bit value to u8 within #[property]
Date: Sat, 25 Oct 2025 16:52:26 +0800	[thread overview]
Message-ID: <aPyPyvvb+G6Df6Qw@intel.com> (raw)
In-Reply-To: <t4mjqw.dx8x6zfu0m3i@linaro.org>

> >+                quote! {
> >+                    {
> >+                        const {
> >+                            assert!(#bitval >= 0 && #bitval < #field_ty::BITS as _,
> >+                                    "bit number exceeds type bits 
> >range");
> 
> Const panic messages cannot use formatting parameters yet, but.
> Can we interpolate the type (e.g u32) in the compile-time panic message? 

Good idea! `concat!` with `stringify!(#field_ty)` should work.

> Not important but would make the error message friendlier.

Yeah, let me refresh a v3.

> Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>

Thanks!

Regards,
Zhao


      reply	other threads:[~2025-10-25  8:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-24  4:13 [PATCH v2] rust/qemu-macros: Convert bit value to u8 within #[property] Zhao Liu
2025-10-24  6:59 ` Manos Pitsidianakis
2025-10-25  8:52   ` Zhao Liu [this message]

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=aPyPyvvb+G6Df6Qw@intel.com \
    --to=zhao1.liu@intel.com \
    --cc=manos.pitsidianakis@linaro.org \
    --cc=pbonzini@redhat.com \
    --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).