Skip to content

Add relative_path_in_macro_definition lint (#14472)#14645

Closed
KunWuChan wants to merge 5 commits intorust-lang:masterfrom
KunWuChan:issues-14472
Closed

Add relative_path_in_macro_definition lint (#14472)#14645
KunWuChan wants to merge 5 commits intorust-lang:masterfrom
KunWuChan:issues-14472

Conversation

@KunWuChan
Copy link
Copy Markdown

@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 <kunwu.chan@hotmail.com>
Co-developed-by: Grace Deng <Grace.Deng006@Gmail.com>
Signed-off-by: Grace Deng <Grace.Deng006@Gmail.com>
Create `tests/ui/relative_path_in_macro_definition.rs` with positive and
negative cases to verify lint behavior.

Signed-off-by: Kunwu Chan <kunwu.chan@hotmail.com>
Co-developed-by: Grace Deng <Grace.Deng006@Gmail.com>
Signed-off-by: Grace Deng <Grace.Deng006@Gmail.com>
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 <kunwu.chan@hotmail.com>
Co-developed-by: Grace Deng <Grace.Deng006@Gmail.com>
Signed-off-by: Grace Deng <Grace.Deng006@Gmail.com>
@rustbot
Copy link
Copy Markdown
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
Copy Markdown
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