-
Notifications
You must be signed in to change notification settings - Fork 445
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
Fix macro referencing core
and kernel
crates
#1150
Comments
We also might want to have a clippy lint for this, I quickly tried to find one, but didn't. |
Sounds like a good idea -- in general it would be nice to do that for all crates (or at least non-leaf ones) that we are aware, i.e. I don't think we will want modules named the same way as crates -- it can get confusing fast. |
Yeah, I was thinking that the clippy lint would report any non-absolute path inside of a macro. |
Hello @y86-dev I would like to work on the issue |
No, |
To prevent issues where user-defined modules named `core` or `kernel` could be picked up instead of the standard ones, update macros to use absolute paths, `::core::...` and `::kernel::...`, for core and kernel references. Suggested-by: y86-dev <y86-dev@protonmail.com> Closes: Rust-for-Linux#1150 Signed-off-by: Igor Korotin <igor.korotin@yahoo.com>
Ok, I'll try to work on that. |
Hey, @ipv6forever you should send the patch to email-list rather than github. "sign your commit under the Developer's Certificate of Origin and to add a Suggested-by: tag, and a Link: tag to this issue. " |
Hi @KunWuChan. |
Update macros to always use absolute paths for crates `core` and `kernel`. This guarantees that macros will not pick up user-defined crates `core` or `kernel` by accident. Changes since v1: - Fixed paths in auto-generated code. Suggested-by: Benno Lossin <benno.lossin@proton.me> Closes: Rust-for-Linux#1150 Signed-off-by: Igor Korotin <igor.korotin@yahoo.com>
Hello @y86-dev I don't get what I did wrong, but I don't see one of the letters I have sent in LKML, though I see both in my e-mail. |
Not sure what you are referring to, I see both of your mails on the list. Though they are in response to my mail and not as their own thread. I'll reply with more details there. |
When macros refer to items from the
core
orkernel
crate, they should do so by using absolute paths::core::...
and::kernel::...
. That is because a user of the macro can declare their own module namedcore
orkernel
, which the macro will then pick up. Some of our macros currently don't follow this rule. One such instance is in thestatic_assert!
macro. Please search for other such instances and fix them.This requires submitting a proper patch to the LKML and the Rust for Linux mailing list. Please recall to test your changes (including generating the documentation if changed, running the Rust doctests if changed, etc.), to use a proper title for the commit, to sign your commit under the Developer's Certificate of Origin and to add a
Suggested-by:
tag, and aLink:
tag to this issue. 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.
The text was updated successfully, but these errors were encountered: