qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Junjie Mao <junjie.mao@hotmail.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>,
	qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [PATCH] rust: introduce alternative implementation of offset_of!
Date: Tue, 22 Oct 2024 10:39:26 +0800	[thread overview]
Message-ID: <ME0P300MB1040E6BDA927461C0CEE255F954C2@ME0P300MB1040.AUSP300.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <CABgObfZWHKvGFRhfUHoCVeqB1bH=ui6x3rORYXH8WsE905=eLw@mail.gmail.com>


Paolo Bonzini <pbonzini@redhat.com> writes:

> Il lun 21 ott 2024, 09:24 Junjie Mao <junjie.mao@hotmail.com> ha scritto:
>
>  > Thanks.  I still prefer to keep the procedural macro code minimal, and have the
>  > code generation in a separate macro, but this is a nice start!
>  >
>
>  I'm not sure if I get your point right.
>
>  My understanding is that preferring minimizing proc macros is because
>  they generate a big, arbitrary block of code that is hard to read and
>  debug directly (which requires cargo expand the whole crate). That is
>  thus more error-prone and makes maintenance harder.
>
>  As for having "the code generation in a separate macro", are you
>  referring to `macro_rules!`?
>
> Yes, keeping the generation of the impl block in with_offsets!. Then you can get the best of both worlds in my opinion, for example the #[repr(C)] check is more robust in the procedural macro.

Got it. Will try that approach in v2.

>
>  Sure. Will use quote_spanned! here and make reported errors being a
>  tuple of error msg and span to use.
>
> If it's okay for you let's first get the fixes in, and then I can repost the MSRV series and include your procedural macro and unit tests.

The v2 fixes look good to me overall. Thanks!

--
Best Regards
Junjie Mao


      reply	other threads:[~2024-10-22  2:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-21  5:40 [PATCH] rust: introduce alternative implementation of offset_of! Junjie Mao
2024-10-21  6:31 ` Paolo Bonzini
2024-10-21  6:46   ` Junjie Mao
2024-10-21  8:04     ` Paolo Bonzini
2024-10-22  2:39       ` Junjie Mao [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=ME0P300MB1040E6BDA927461C0CEE255F954C2@ME0P300MB1040.AUSP300.PROD.OUTLOOK.COM \
    --to=junjie.mao@hotmail.com \
    --cc=manos.pitsidianakis@linaro.org \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@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).