Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make impl_has_work compatible with more complex generics #1077

Open
y86-dev opened this issue Apr 26, 2024 · 1 comment
Open

make impl_has_work compatible with more complex generics #1077

y86-dev opened this issue Apr 26, 2024 · 1 comment
Labels
good first issue Good for newcomers • lib Related to the `rust/` library.

Comments

@y86-dev
Copy link
Collaborator

y86-dev commented Apr 26, 2024

The impl_has_work macro only supports idents as generic arguments:

macro_rules! impl_has_work {
    ($(impl$(<$($implarg:ident),*>)?
       HasWork<$work_type:ty $(, $id:tt)?>
       for $self:ident $(<$($selfarg:ident),*>)?
       { self.$field:ident }
    )*) => {$(

There is a workaround, see Alice's linked list patch:

    macro_rules! impl_list_item {
        (
            impl$({$($generics:tt)*})? ListItem<$num:tt> for $t:ty {
                using ListLinks;
            } $($rest:tt)*
        ) => {

Make the impl_has_work macro compatible with more complex generics such as lifetimes and const generic arguments.


This requires submitting a proper patch to the LKML and the Rust for Linux mailing list. Please recall to test your changes, to use a proper title for the commit, to sign your commit under the Developer's Certificate of Origin and so on. Please see https://docs.kernel.org/process/submitting-patches.html and https://rust-for-linux.com/contributing for details.

Please take this issue only if you are new to the kernel development process and you would like to use it as a test to submit your first patch to the kernel. Please do not take it if you do not plan to make other contributions to the kernel.

@y86-dev y86-dev added • lib Related to the `rust/` library. good first issue Good for newcomers labels Apr 26, 2024
@mu001999
Copy link

mu001999 commented May 22, 2024

I'd like to try this, and I sent an email, https://lore.kernel.org/rust-for-linux/ME0P282MB4890167E8316FECBA35D7533CCEB2@ME0P282MB4890.AUSP282.PROD.OUTLOOK.COM/T/#t. I don't know if I did the right thing

intel-lab-lkp pushed a commit to intel-lab-lkp/linux that referenced this issue May 22, 2024
Make the impl_has_work macro compatible with more complex generics such as lifetimes and const generic arguments.
See more in Rust-for-Linux#1077

Signed-off-by: mu001999 <mu001999@outlook.com>
intel-lab-lkp pushed a commit to intel-lab-lkp/linux that referenced this issue May 22, 2024
Make the impl_has_work macro compatible with more complex generics such as lifetimes and const generic arguments.
See more in Rust-for-Linux#1077

Signed-off-by: Roland Xu <mu001999@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers • lib Related to the `rust/` library.
Development

No branches or pull requests

2 participants