Skip to content

Add relative_path_in_macro_definition lint (#14472) #14645

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

Closed
wants to merge 5 commits into from

Conversation

KunWuChan
Copy link

@KunWuChan KunWuChan commented Apr 17, 2025

Implements the relative_path_in_macro_definition lint to warn about relative paths to core or kernel in macro definitions, as requested in #14472.
Includes tests in tests/ui/relative_path_in_macro_definition.rs and updates existing tests (incompatible_msrv.rs, swap_ptr_to_ref_unfixable.rs, arithmetic_side_effects.rs) with #![allow] to avoid interference.


changelog: add 'relative_path_in_macro_definition' lint. Warns about relative paths to `core` or `kernel` in macro definitions, recommending absolute paths to avoid ambiguity (#14472)

Implement lint to warn about relative `core`/`kernel` paths in macro
definitions.

Fixes #14472

Signed-off-by: Kunwu Chan <[email protected]>
Co-developed-by: Grace Deng <[email protected]>
Signed-off-by: Grace Deng <[email protected]>
Create `tests/ui/relative_path_in_macro_definition.rs` with positive and
negative cases to verify lint behavior.

Signed-off-by: Kunwu Chan <[email protected]>
Co-developed-by: Grace Deng <[email protected]>
Signed-off-by: Grace Deng <[email protected]>
Add `#![allow(clippy::relative_path_in_macro_definition)]` to
`incompatible_msrv.rs`, `swap_ptr_to_ref_unfixable.rs`, and
`arithmetic_side_effects.rs` to avoid lint interference. Update
corresponding `.stderr` files.

Signed-off-by: Kunwu Chan <[email protected]>
Co-developed-by: Grace Deng <[email protected]>
Signed-off-by: Grace Deng <[email protected]>
@rustbot
Copy link
Collaborator

rustbot commented Apr 17, 2025

r? @dswij

rustbot has assigned @dswij.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Apr 17, 2025
@rustbot
Copy link
Collaborator

rustbot commented Apr 17, 2025

⚠️ Warning ⚠️

  • There are issue links (such as #123) in the commit messages of the following commits.
    Please remove them as they will spam the issue with references to the commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New lint: relative_path_in_macro_definition
3 participants