rust: macros: vtable: add `#[optional]` attribute
Status from this message: Applied to `rust-next` -- thanks everyone!
Get series with b4
b4 am [email protected] change-id 20260811-vtable_macro-12a8f557381bVersions newest first
Patches in v1 Applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/3 | rust: macros: vtable: hide generated `HAS_` constants for required methodsrust/ | +13 | 0 replies | |
| 2/3 | rust: macros: vtable: add `#[optional]` attributerust/ rust/ | +36 | 0 replies | |
| 3/3 | rust: misc: use `#[optional]` attribute of `#[vtable]` macrorust/ | +13 | 2 replies |
Reviews trailers per patch
1 of 3 patches has a Reviewed-by or Acked-by.
| Patch | Greg Kroah-Hartman |
|---|---|
| 1/3 | |
| 2/3 | |
| 3/3 | A-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH 0/3] rust: macros: vtable: add `#[optional]` attribute
Currently there are a lot of boilerplate with the build_error!(VTABLE_DEFAULT_ERROR) because Rust want a default implementation but we insert NULL into C vtable and never call the Rust-side method if it is not overridden.
Add an #[optional] attribute that injects the same default implementation to avoid duplicating this everywhere. As an example, the misc device vtable trait is converted.
---
Gary Guo (3):
rust: macros: vtable: hide generated HAS_ constants for required methods
rust: macros: vtable: add #[optional] attribute
rust: misc: use #[optional] attribute of #[vtable] macro
rust/kernel/miscdevice.rs | 35 +++++++++++++---------------------- rust/macros/lib.rs | 39 +++++++++++---------------------------- rust/macros/vtable.rs | 43 ++++++++++++++++++++++++++++++++++++++----- 3 files changed, 62 insertions(+), 55 deletions(-)
---
base-commit: 6b8c8af514d739d0335f5579b585e02babe8a727
change-id: 20260811-vtable_macro-12a8f557381b
Best regards,
Signature · 1 line
Gary Guo <[email protected]>