Rust: Reuse Cargo target dir when running QL tests - #22446
Open
paldepind wants to merge 1 commit into
Open
Conversation
paldepind
force-pushed
the
rust/reuse-cargo-target-dir
branch
from
August 28, 2026 08:01
0e6875f to
dc29b10
Compare
paldepind
marked this pull request as ready for review
August 28, 2026 08:19
Contributor
There was a problem hiding this comment.
Copilot review overview
Review tier: Balanced
Findings: 1
New issues introduced by this change (3)
| Severity | Finding |
|---|---|
rust/extractor/src/config.rs — cargo_extra_env is applied afterward and can override or remove RUSTFLAGS, while cargo_check… |
|
rust/extractor/src/config.rs — The documented default for cargo_target_dir is now inaccurate: rust/codeql-extractor.yml:38-39… |
|
rust/extractor/src/config.rs — Correct the spelling of “necessary.” |
What changed in this PR
Reuses Cargo build artifacts during Rust QL tests to reduce extraction time.
Changes:
- Shares the test-local Cargo target directory with rust-analyzer.
- Aligns default
RUSTFLAGSbetween Cargo invocations.
| File | Description |
|---|---|
rust/extractor/src/qltest.rs |
Configures preliminary Cargo checks to use the shared target directory. |
rust/extractor/src/config.rs |
Selects target directories and configures rust-analyzer’s environment. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
paldepind
force-pushed
the
rust/reuse-cargo-target-dir
branch
from
August 28, 2026 09:07
dc29b10 to
c83a41e
Compare
paldepind
force-pushed
the
rust/reuse-cargo-target-dir
branch
from
August 28, 2026 09:10
c83a41e to
516815c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Currently when we run
codeql testfor Rust, the Rust extractor runs a preliminarycargo checkbefore it begins extraction. This populates atargetdirectory next to the test. The extractor then startsrust-analyzerwith a it'stargetdirectory being inside the scratch directory. This means that we're create twotargetdirectories.This PR changes this s.t. by default the
targetdirectory next to the tests is used by rust-analyzer as well. This speeds up by uncached (without an existingtargetdirectory) as well as cached runs.I had Copilot run the tests in
rust/ql/test/library-tests/dataflow/sources/net2 times onmainand 2 times on this branch. The results are below and show a 21%-22% speedup.This PR should also make CI for Rust faster. The job "Rust Language Tests Linux" took approximately 10 minutes on this PR and 16m and 20m on some other recent Rust PRs. While there's probably a ton of variance in these numbers, it does at least indicate in the direction that CI is faster.
mainmainmainmainrust/reuse-cargo-target-dirrust/reuse-cargo-target-dirrust/reuse-cargo-target-dirrust/reuse-cargo-target-dirmainrust/reuse-cargo-target-dirmain