[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <DFOJ1M33ZPDF.1WHDQ1LMIAOUN@garyguo.net>
Date: Wed, 14 Jan 2026 18:34:53 +0000
From: "Gary Guo" <gary@...yguo.net>
To: "Benno Lossin" <lossin@...nel.org>, "Gary Guo" <gary@...yguo.net>,
"Miguel Ojeda" <ojeda@...nel.org>, "Boqun Feng" <boqun.feng@...il.com>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>, "Andreas
Hindborg" <a.hindborg@...nel.org>, "Alice Ryhl" <aliceryhl@...gle.com>,
"Trevor Gross" <tmgross@...ch.edu>, "Danilo Krummrich" <dakr@...nel.org>,
"Fiona Behrens" <me@...enk.dev>, "Tamir Duberstein" <tamird@...il.com>,
"Alban Kurti" <kurti@...icto.ai>
Cc: <rust-for-linux@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v3 06/15] rust: pin-init: rewrite the `#[pinned_drop]`
attribute macro using `syn`
On Wed Jan 14, 2026 at 6:18 PM GMT, Benno Lossin wrote:
> Rewrite the attribute macro for implementing `PinnedDrop` using `syn`.
> Otherwise no functional changes intended aside from improved error
> messages on syntactic and semantical errors. For example:
>
> When missing the `drop` function in the implementation, the old error
> was:
>
> error: no rules expected `)`
> --> tests/ui/compile-fail/pinned_drop/no_fn.rs:6:1
> |
> 6 | #[pinned_drop]
> | ^^^^^^^^^^^^^^ no rules expected this token in macro call
> |
> note: while trying to match keyword `fn`
> --> src/macros.rs
> |
> | fn drop($($sig:tt)*) {
> | ^^
> = note: this error originates in the attribute macro `pinned_drop` (in Nightly builds, run with -Z macro-backtrace for more info)
>
> And the new one is:
>
> error[E0046]: not all trait items implemented, missing: `drop`
> --> tests/ui/compile-fail/pinned_drop/no_fn.rs:7:1
> |
> 7 | impl PinnedDrop for Foo {}
> | ^^^^^^^^^^^^^^^^^^^^^^^ missing `drop` in implementation
> |
> = help: implement the missing item: `fn drop(self: Pin<&mut Self>, _: OnlyCallFromDrop) { todo!() }`
>
> Tested-by: Andreas Hindborg <a.hindborg@...nel.org>
> Signed-off-by: Benno Lossin <lossin@...nel.org>
Reviewed-by: Gary Guo <gary@...yguo.net>
> ---
> Changes in v3:
> * use DiagCtxt error handling
> Changes in v2:
> * improved error handling
> * improved error span
> ---
> rust/pin-init/internal/src/lib.rs | 4 +-
> rust/pin-init/internal/src/pinned_drop.rs | 86 +++++++++++++----------
> rust/pin-init/src/macros.rs | 28 --------
> 3 files changed, 52 insertions(+), 66 deletions(-)
Powered by blists - more mailing lists