Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
306 changes: 191 additions & 115 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,9 @@ http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "ht

# rust-analyzer sources needed by the rust ast-generator (see `rust/ast-generator/README.md`).
# These should be updated through the `rust/scripts/update_rust_analyzer.py` script.
RUST_ANALYZER_SRC_TAG = "2026-10-12"
RUST_ANALYZER_SRC_TAG = "2026-11-30"

RUST_ANALYZER_SRC_INTEGRITY = "sha256-S9tGdGw7wrZjiMVx+/tZ0RE39Uw/wvO6GKDkGNvAZCA="
RUST_ANALYZER_SRC_INTEGRITY = "sha256-iG0uIV2eo+cuHT9OvzEtyXm76mKrHF4ZtwEZTipQSEI="

http_archive(
name = "rust-analyzer-src",
Expand Down
34 changes: 17 additions & 17 deletions rust/extractor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,23 @@ anyhow = "1.0.104"
clap = { version = "4.6.7", features = ["derive"] }
figment = { version = "0.10.19", features = ["env", "yaml"] }
num-traits = "0.2.19"
ra_ap_base_db = "0.0.358"
ra_ap_hir = "0.0.358"
ra_ap_hir_def = "0.0.358"
ra_ap_ide_db = "0.0.358"
ra_ap_hir_ty = "0.0.358"
ra_ap_hir_expand = "0.0.358"
ra_ap_load-cargo = "0.0.358"
ra_ap_paths = "0.0.358"
ra_ap_project_model = "0.0.358"
ra_ap_syntax = "0.0.358"
ra_ap_syntax-bridge = "0.0.358"
ra_ap_toolchain = "0.0.358"
ra_ap_vfs = "0.0.358"
ra_ap_parser = "0.0.358"
ra_ap_span = "0.0.358"
ra_ap_cfg = "0.0.358"
ra_ap_intern = "0.0.358"
ra_ap_base_db = "0.0.369"
ra_ap_hir = "0.0.369"
ra_ap_hir_def = "0.0.369"
ra_ap_ide_db = "0.0.369"
ra_ap_hir_ty = "0.0.369"
ra_ap_hir_expand = "0.0.369"
ra_ap_load-cargo = "0.0.369"
ra_ap_paths = "0.0.369"
ra_ap_project_model = "0.0.369"
ra_ap_syntax = "0.0.369"
ra_ap_syntax-bridge = "0.0.369"
ra_ap_toolchain = "0.0.369"
ra_ap_vfs = "0.0.369"
ra_ap_parser = "0.0.369"
ra_ap_span = "0.0.369"
ra_ap_cfg = "0.0.369"
ra_ap_intern = "0.0.369"
serde = "1.0.229"
triomphe = "0.1.17"
codeql-extractor = { path = "../../shared/tree-sitter-extractor" }
Expand Down
2 changes: 1 addition & 1 deletion rust/extractor/src/toolchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use tracing::{info, warn};
/// toolchain release that precedes our version of rust-analyzer.
///
/// When rust-analyzer is updated this version should be updated accordingly.
const FIXED_RUST_TOOLCHAIN: &str = "1.99.0";
const FIXED_RUST_TOOLCHAIN: &str = "1.100.1";

/// The date of the oldest nightly toolchain known to work with our version of
/// rust-analyzer.
Expand Down
2 changes: 1 addition & 1 deletion rust/ql/integration-tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def pytest_configure(config):
# match `FIXED_RUST_TOOLCHAIN`.
if not hasattr(config, "workerinput"):
commands.run(
"rustup toolchain install 1.99.0 --profile minimal --component rust-src"
"rustup toolchain install 1.100.1 --profile minimal --component rust-src"
)


Expand Down
2 changes: 1 addition & 1 deletion rust/ql/test/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ set -euo pipefail
cd "$(dirname "$0")"
# Install the fixed toolchain used by the extractor. The version here should
# match `FIXED_RUST_TOOLCHAIN`.
rustup toolchain install 1.99.0 --profile minimal --component rust-src
rustup toolchain install 1.100.1 --profile minimal --component rust-src
pushd ../../extractor/src/nightly-toolchain
rustup install
popd
Expand Down
16 changes: 12 additions & 4 deletions rust/scripts/update_rust_analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,10 +232,18 @@ def main() -> None:
if status:
raise RuntimeError("the working tree must be clean")

print_step(1, "Update dependencies")
print_step(1, "Update rust-analyzer dependencies")
manifest = RUST_EXTRACTOR_MANIFEST.read_text()
old_rust_analyzer_version = get_min_rust_analyzer_version(manifest)
run("cargo", "upgrade", "--incompatible", "--pinned")
dependencies = tomllib.loads(manifest)["dependencies"]
# cargo upgrade selects dependencies across the entire workspace.
packages = [
argument
for name in dependencies
if name.startswith("ra_ap_")
for argument in ("--package", name)
]
run("cargo", "upgrade", "--incompatible", "--pinned", *packages)
# Re-read the (potentially) changed manifest
manifest = RUST_EXTRACTOR_MANIFEST.read_text()
new_rust_analyzer_version = get_min_rust_analyzer_version(manifest)
Expand All @@ -252,8 +260,8 @@ def main() -> None:
aligned_manifest, manifest_changed = align_rust_analyzer_versions(manifest)
if manifest_changed:
RUST_EXTRACTOR_MANIFEST.write_text(aligned_manifest)
run("cargo", "update")
commit_all("Cargo: Upgrade dependencies")
run("cargo", "update", "--package", "codeql-rust")
commit_all("Rust: Upgrade rust-analyzer dependencies")

print_step(2, "Update the rust-analyzer sources used by the AST generator")
update_rust_analyzer_sources(
Expand Down
22 changes: 12 additions & 10 deletions rust/updating-rust-analyzer.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Updating rust-analyzer

Here's a rundown of the typical actions to perform to do a rust-analyzer (and
other dependencies) update. A one-time setup consists in installing
Here's a rundown of the typical actions to perform a rust-analyzer
dependency update. A one-time setup consists in installing
[`cargo-edit`](https://crates.io/crates/cargo-edit) with `cargo install
cargo-edit`. On Ubuntu that also requires `sudo apt install libssl-dev
pkg-config`.
Expand All @@ -11,21 +11,23 @@ pkg-config`.
> any errors) carried out by the script `rust/scripts/update_rust_analyzer.py`.
> Prefer using the script.

1. Update dependencies.
1. From the root of the `codeql` repo checkout, run a Cargo upgrade:
```
cargo upgrade --incompatible --pinned
```
2. Look at a diff of the `Cargo.toml` files: if all `ra_ap_` prefixed
1. Update rust-analyzer dependencies.
1. From the root of the `codeql` repo checkout, run
`cargo upgrade --incompatible --pinned`, passing `--package <name>` for
each `ra_ap_` dependency in `rust/extractor/Cargo.toml`. Without these
package filters, Cargo upgrades unrelated dependencies throughout the
workspace, even if `--manifest-path` points at the extractor.
2. Look at the diff of `rust/extractor/Cargo.toml`: if all `ra_ap_` prefixed
dependencies have been updated to the same number, go on to the next
step. Otherwise, it means the latest `rust-analyzer` update has not been
fully rolled out to all its crates in `crates.io`. _All `ra_ap_` versions
must agree!_
Downgrade by hand to the minimum one you see, and run a `cargo update`
Downgrade by hand to the minimum one you see, and run
`cargo update --package codeql-rust`
after that to fix the `Cargo.lock` file.
3. Commit the changes, skipping `pre-commit` hooks if you have them enabled:
```
git commit -am 'Cargo: upgrade dependencies' --no-verify
git commit -am 'Rust: Upgrade rust-analyzer dependencies' --no-verify
```

2. Update the rust-analyzer sources used by the AST generator.
Expand Down