Skip to content

Rust: fix nightly toolchain version for tests using it #19828

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

Merged
merged 1 commit into from
Jun 20, 2025

Conversation

redsun82
Copy link
Contributor

@redsun82 redsun82 commented Jun 20, 2025

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.

Also removed some uneeded cargo check requests, as that flag is true by default on all tests.

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.
@Copilot Copilot AI review requested due to automatic review settings June 20, 2025 12:06
@redsun82 redsun82 requested a review from a team as a code owner June 20, 2025 12:06
@github-actions github-actions bot added the Rust Pull requests that update Rust code label Jun 20, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.toml files and add a global qltest_use_nightly option in each options.yml
  • Introduce NIGHTLY constant and dump_nightly_toolchain() in qltest.rs, and wire up the qltest_use_nightly flag in Config
  • Update the qltest_cargo template to parameterize the Rust edition and refresh .gitignore to 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_nightly flag and dump_nightly_toolchain path lack dedicated tests. Add unit or integration tests to verify that enabling this flag generates the correct rust-toolchain.toml content.
    if config.qltest_use_nightly {

rust/ql/test/.gitignore:5

  • This pattern only ignores rust-toolchain.toml at the repo root. Generated toolchain files in subdirectories won’t be ignored—consider using **/rust-toolchain.toml.
rust-toolchain.toml

@redsun82 redsun82 merged commit f1f36db into main Jun 20, 2025
14 checks passed
@redsun82 redsun82 deleted the redsun82/rust-fix-nightly-toolchain branch June 20, 2025 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Rust Pull requests that update Rust code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants