Skip to content

Add relative_path_in_macro_definition lint (#14472) #14645 #14648

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

KunWuChan
Copy link

@KunWuChan KunWuChan commented Apr 18, 2025

Add relative_path_in_macro_definition lint (#14472) #14645

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.

Fixes New lint: relative_path_in_macro_definition #14472
Tests pass: cargo test, cargo test --test compile-test, cargo test --test integration
cargo fmt clean

changelog: add 'relative_path_in_macro_definition' lint.

Signed-off-by: Kunwu Chan [email protected]
Co-developed-by: Grace Deng [email protected]
Signed-off-by: Grace Deng [email protected]

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

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 18, 2025

r? @llogiq

rustbot has assigned @llogiq.
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 18, 2025
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.

3 participants