Skip to content

Fix test module path in riscv.rs to resolve correctly under Rust module rules #144568

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 1 commit into from

Conversation

CaiWeiran
Copy link

What this PR does

This PR fixes a build failure when running ./x test due to Rust being unable to locate the tests module declared in library/std_detect/src/detect/os/riscv.rs.
Rust's default module resolution expects mod tests; to resolve to os/tests.rs or os/tests/mod.rs. However, in this case, the tests are located in os/riscv/tests.rs.
To correct this, I explicitly set the path using:

#[cfg(test)]
#[path = "riscv/tests.rs"]
mod tests;

This allows the test module to be compiled correctly when testing, without needing to inline or move the file.

Why it's needed

Without this change, ./x test fails with:

error[E0583]: file not found for module `tests`

This fix enables successful test discovery and execution on riscv.rs.

Notes

  • No functional logic changes were made.
  • Only affects test compilation.

@rustbot
Copy link
Collaborator

rustbot commented Jul 28, 2025

r? @Mark-Simulacrum

rustbot has assigned @Mark-Simulacrum.
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 S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jul 28, 2025
@CaiWeiran CaiWeiran closed this Aug 1, 2025
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants