Skip to content

Rust: pin integration test toolchain to 1.94.1#21763

Closed
redsun82 wants to merge 1 commit intomainfrom
redsun82/pin-rust-toolchain-1-94-1
Closed

Rust: pin integration test toolchain to 1.94.1#21763
redsun82 wants to merge 1 commit intomainfrom
redsun82/pin-rust-toolchain-1-94-1

Conversation

@redsun82
Copy link
Copy Markdown
Contributor

@redsun82 redsun82 commented Apr 28, 2026

Pin the Rust toolchain used by integration tests to 1.94.1 to prevent breakage from runner images that ship newer versions.

Changes

  • rust/ql/integration-tests/conftest.py:
    • Add autouse _pin_rust_toolchain fixture that writes a rust-toolchain.toml (pinned to 1.94.1 with rust-src component) into each test's working directory
    • Update rust_sysroot_src to use rustc +1.94.1 and explicitly ensure rust-src is installed

No changes to rust/ql/test/rust-toolchain.toml — QL language tests are unaffected.

Copilot AI review requested due to automatic review settings April 28, 2026 09:25
@redsun82 redsun82 requested a review from a team as a code owner April 28, 2026 09:25
@github-actions github-actions Bot added the Rust Pull requests that update Rust code label Apr 28, 2026
@redsun82 redsun82 marked this pull request as draft April 28, 2026 09:30
Copy link
Copy Markdown
Contributor

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

Pins the Rust toolchain used by the Rust integration tests to the version declared in rust/ql/test/rust-toolchain.toml, aiming to make CI test behavior independent of whatever Rust is preinstalled on the runner image.

Changes:

  • Bump Rust test toolchain channel from 1.90 to 1.94.1.
  • Add an autouse pytest fixture to set RUSTUP_TOOLCHAIN based on the shared rust-toolchain.toml.
  • Update sysroot discovery to call rustc +{channel} --print sysroot to ensure the pinned toolchain is used.
Show a summary per file
File Description
rust/ql/test/rust-toolchain.toml Updates the pinned Rust channel used by Rust QL tests.
rust/ql/integration-tests/conftest.py Reads the pinned channel and attempts to enforce it for integration tests via env var + rustc +toolchain.

Copilot's findings

Comments suppressed due to low confidence (1)

rust/ql/integration-tests/conftest.py:20

  • This autouse fixture mutates os.environ but never restores the previous value. Since environment variables are process-global, this can leak into later tests outside rust/ql/integration-tests when running a larger pytest suite. Prefer setting the variable via monkeypatch.setenv(...) (auto-restored), or implement a yield fixture that restores/deletes RUSTUP_TOOLCHAIN afterwards (potentially with scope="session" if you only need to set it once).
@pytest.fixture(autouse=True)
def _pin_rust_toolchain(environment):
    """Pin the Rust toolchain to the version specified in ql/test/rust-toolchain.toml.

    Integration tests run from temporary directories, so they don't pick up the
    rust-toolchain.toml file via rustup's file-based resolution. Setting
    RUSTUP_TOOLCHAIN ensures a consistent version regardless of the runner image.
    """
    os.environ["RUSTUP_TOOLCHAIN"] = _toolchain_channel
  • Files reviewed: 2/2 changed files
  • Comments generated: 1

Comment thread rust/ql/integration-tests/conftest.py Outdated
@redsun82 redsun82 force-pushed the redsun82/pin-rust-toolchain-1-94-1 branch 5 times, most recently from 9b0963a to e0e279a Compare April 28, 2026 09:51
@redsun82 redsun82 marked this pull request as ready for review April 28, 2026 09:52
@redsun82 redsun82 force-pushed the redsun82/pin-rust-toolchain-1-94-1 branch from e0e279a to ad23242 Compare April 28, 2026 09:57
Write a `rust-toolchain.toml` into each integration test's working
directory so that tests use a consistent Rust version regardless of
what is pre-installed on the runner image.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@redsun82 redsun82 force-pushed the redsun82/pin-rust-toolchain-1-94-1 branch from ad23242 to ba64983 Compare April 28, 2026 10:00
@redsun82
Copy link
Copy Markdown
Contributor Author

No longer needed — toolchain pinning will be handled entirely in the semmle-code prepare action via RUSTUP_TOOLCHAIN env var.

@redsun82 redsun82 closed this Apr 28, 2026
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