Skip to content
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

feat: forward cargo-check arguments; refactor cargo-rap #65

Merged

Conversation

zjp-CN
Copy link
Contributor

@zjp-CN zjp-CN commented Oct 26, 2024

cargo rap [rap options] -- [cargo check options]

e.g.
1. detect use-after-free and memory leak for a riscv target:
   cargo rap -F -M -- --target riscv64gc-unknown-none-elf
2. detect use-after-free and memory leak for tests:
   cargo rap -F -M -- --tests
3. detect use-after-free and memory leak for all members:
   cargo rap -F -M -- --workspace

Marjor changes:

  • cargo-rap won't run cargo clean any more: this imporves checking time, and is fine for most cases; sometimes cargo caches won't emit MIRs, then users should run cargo clean, especially for the existing cached projects.
  • cargo-rap won't handle crates selection any more: all crates to be checked is handled via cargo check, which means
    • by default, if no cargo check options are specified, cargo-rap only checks lib.rs and main.rs as cargo check does
    • use -- cargo check options as shown above to select what to check

Internal changes:

  • purge rustc_version and cargo_metadata dependencies and related code: crates analsis and selection are needless
  • add #[macro_use] pub mod utils; to import log macros to all sub modules via #[macro_use] extern crate rap; from the root module

zjp-CN added 30 commits October 26, 2024 15:59
Defining an iterator is a overkill for get_arg_flag_value.
is_target_crate fn is outdated, because --target may not be passed
by user; but we don't need it to work: rustc can handle without it.
e.g.
cargo rap -F -M -- --target riscv64gc-unknown-none-elf
also rename rap_args => args_group1, cargo_args => args_group2,
due to two phases in cargo-rap: in rustc phase, the field name is
incorrect.
there is a typo in original code:
--crate--type will be never matched, so it's needless to call it.

In this commit, is_crate_type_lib is refactored with get_arg_flag_value.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants