Rust: fix nightly toolchain version for tests using it#19828
Merged
Conversation
Rather than fixing the version separately for each test, we can just request to use a nightly in the `options.yml` file, with the specific version hard-coded in `qltest.rs`. We can update it if we need to. It's better to have a single nightly version for all tests that require it, in order to avoid downloading more versions than necessary.
Contributor
There was a problem hiding this comment.
Pull Request Overview
Synchronize nightly toolchain usage across all ql tests by moving the version into the extractor logic and opting in via a single flag.
- Remove per-test
rust-toolchain.tomlfiles and add a globalqltest_use_nightlyoption in eachoptions.yml - Introduce
NIGHTLYconstant anddump_nightly_toolchain()inqltest.rs, and wire up theqltest_use_nightlyflag inConfig - Update the
qltest_cargotemplate to parameterize the Rust edition and refresh.gitignoreto exclude generated files
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| rust/ql/test/query-tests/security/CWE-825/rust-toolchain.toml | Remove per-test toolchain file |
| rust/ql/test/query-tests/security/CWE-825/options.yml | Add qltest_use_nightly: true |
| rust/ql/test/query-tests/security/CWE-770/rust-toolchain.toml | Remove per-test toolchain file |
| rust/ql/test/query-tests/security/CWE-770/options.yml | Add qltest_use_nightly: true |
| rust/ql/test/query-tests/security/CWE-022/rust-toolchain.toml | Remove per-test toolchain file |
| rust/ql/test/query-tests/security/CWE-022/options.yml | Add qltest_use_nightly: true |
| rust/ql/test/.gitignore | Ignore generated rust-toolchain.toml, target/, etc. |
| rust/extractor/src/qltest_cargo.mustache | Parameterize edition in generated Cargo manifests |
| rust/extractor/src/qltest.rs | Add EDITION/NIGHTLY constants and dump_nightly_toolchain() |
| rust/extractor/src/config.rs | Introduce qltest_use_nightly in Config |
Comments suppressed due to low confidence (2)
rust/extractor/src/qltest.rs:98
- The new
qltest_use_nightlyflag anddump_nightly_toolchainpath lack dedicated tests. Add unit or integration tests to verify that enabling this flag generates the correctrust-toolchain.tomlcontent.
if config.qltest_use_nightly {
rust/ql/test/.gitignore:5
- This pattern only ignores
rust-toolchain.tomlat the repo root. Generated toolchain files in subdirectories won’t be ignored—consider using**/rust-toolchain.toml.
rust-toolchain.toml
hvitved
approved these changes
Jun 20, 2025
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.
Rather than fixing the version separately for each test, we can just request to use a nightly in the
options.ymlfile, with the specific version hard-coded inqltest.rs. We can update it if we need to.It's better to have a single nightly version for all tests that require it, in order to avoid downloading more versions than necessary.
Also removed some uneeded cargo check requests, as that flag is true by default on all tests.