rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rust: macros: fix documentation of the paste! macro
@ 2024-10-19  7:22 Paolo Bonzini
  2024-10-21  8:19 ` Alice Ryhl
  2024-10-21 18:14 ` Miguel Ojeda
  0 siblings, 2 replies; 3+ messages in thread
From: Paolo Bonzini @ 2024-10-19  7:22 UTC (permalink / raw)
  To: rust-for-linux

One of the example in this section uses a curious mix of the constant
and function declaration syntaxes; fix it.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 rust/macros/lib.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/rust/macros/lib.rs b/rust/macros/lib.rs
index 520eae5fd792..d60359880b5a 100644
--- a/rust/macros/lib.rs
+++ b/rust/macros/lib.rs
@@ -322,7 +322,7 @@ pub fn pinned_drop(args: TokenStream, input: TokenStream) -> TokenStream {
 /// macro_rules! pub_no_prefix {
 ///     ($prefix:ident, $($newname:ident),+) => {
 ///         kernel::macros::paste! {
-///             $(pub(crate) const fn [<$newname:lower:span>]: u32 = [<$prefix $newname:span>];)+
+///             $(pub(crate) const fn [<$newname:lower:span>]() -> u32 { [<$prefix $newname:span>] })+
 ///         }
 ///     };
 /// }
-- 
2.46.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] rust: macros: fix documentation of the paste! macro
  2024-10-19  7:22 [PATCH] rust: macros: fix documentation of the paste! macro Paolo Bonzini
@ 2024-10-21  8:19 ` Alice Ryhl
  2024-10-21 18:14 ` Miguel Ojeda
  1 sibling, 0 replies; 3+ messages in thread
From: Alice Ryhl @ 2024-10-21  8:19 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: rust-for-linux

On Sat, Oct 19, 2024 at 9:22 AM Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> One of the example in this section uses a curious mix of the constant
> and function declaration syntaxes; fix it.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

The `pub_no_prefix` examples usually defines constants rather than
functions. I guess it is a function here to showcase the :lower
modifier, which doesn't make sense for constants? I guess that makes
sense.

Reviewed-by: Alice Ryhl <aliceryhl@google.com>

Alice

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] rust: macros: fix documentation of the paste! macro
  2024-10-19  7:22 [PATCH] rust: macros: fix documentation of the paste! macro Paolo Bonzini
  2024-10-21  8:19 ` Alice Ryhl
@ 2024-10-21 18:14 ` Miguel Ojeda
  1 sibling, 0 replies; 3+ messages in thread
From: Miguel Ojeda @ 2024-10-21 18:14 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: rust-for-linux

On Sat, Oct 19, 2024 at 9:22 AM Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> One of the example in this section uses a curious mix of the constant
> and function declaration syntaxes; fix it.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Applied to `rust-next` -- thanks!

I will send a small series to fix a few other things in those examples.

Cheers,
Miguel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-10-21 18:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-19  7:22 [PATCH] rust: macros: fix documentation of the paste! macro Paolo Bonzini
2024-10-21  8:19 ` Alice Ryhl
2024-10-21 18:14 ` Miguel Ojeda

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).