Rust: Update rust-analyzer to 0.0.352
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 35/100
- Issue 类型
- 重构
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- github-actions, rust
- 领域
- build-system, ci-cd, tooling
调研方向
The update process is documented in rust/updating-rust-analyzer.md. The script rust/scripts/update_rust_analyzer.py automates part of it. Key files to modify are Cargo.toml, Cargo.lock, MODULE.bazel, and rust-toolchain.toml. After updating dependencies, run bazel mod tidy and the codegen command bazel run //rust/ast-generator. Validate with cargo check --workspace and bazel run //rust/extractor:install. The change requires understanding of the project's Rust/Bazel build system and the rust-analyzer integration.
由索引模型根据 Issue 内容生成。
描述
Summary
Automated update of rust-analyzer and its ra_ap_* crates from 0.0.347 to 0.0.352 (ra_ap_intern pinned to 0.0.352 to keep all ra_ap_* crates aligned, per rust/updating-rust-analyzer.md), following the process in rust/updating-rust-analyzer.md.
The automated updater script (rust/scripts/update_rust_analyzer.py) got as far as cargo upgrade --incompatible --pinned and then failed because the recursive dependency resolution hit a yanked transitive crate (chacha20 0.10.1, pulled in by rand). This PR manually completes the remaining steps of the documented update process.
Changes
- Cargo: Upgrade dependencies — Upgraded
ra_ap_*crates to0.0.352(downgradingra_ap_internfrom the0.0.353picked bycargo upgradedown to0.0.352so allra_ap_*crates agree), pluseither,clap,serde_with,toml,syn,zstd,rand. Worked around the yankedchacha20 0.10.1by pinningchacha20to0.10.2inCargo.lock. - Rust: Update rust-analyzer sources — Updated
RUST_ANALYZER_SRC_TAG/RUST_ANALYZER_SRC_INTEGRITYinMODULE.bazelto the2026-09-14rust-analyzer release matchingra_ap_syntax@0.0.352. - Rust: Update fixed toolchain — Bumped
FIXED_RUST_TOOLCHAIN(and the matchingrustup toolchain installcommands in test setup scripts) from1.97.0to1.98.1, the latest stable release preceding the new rust-analyzer version. - Bazel: Regenerate vendored cargo dependencies — Re-ran
misc/bazel/3rdparty/update_tree_sitter_extractors_deps.shandbazel mod tidy. - Rust: Run codegen — Re-ran
bazel run (rust/redacted) The rust-analyzer patch (rust/ast-generator/patches/rust-analyzer.patch) needed a small update since upstream removed the#![allow(clippy::disallowed_types)]line it used to target; the patch was regenerated to match the new upstream file (same effective changes: allow warnings/clippy/rustfmt-skip on the generated modules, make a few generator internalspub`).- The new rust-analyzer grammar adds a
DocCommentnode alongsideAttr, both now implementing a commonAnyAttrsupertype. Codegen propagated this intorust/schema/ast.py,rust/ql/lib/rust.dbscheme, and the generated.qll/Rust files (newAnyAttr/DocCommentclasses and QL library files). - The extractor's generated
emit_any_attr/emit_doc_commentmethods are currently unused (dead-code warning) because upstream hasn't yet wiredDocCommentinto any grammar rule that would call them; this is expected with this rust-analyzer version and not a regression.
- The new rust-analyzer grammar adds a
- Rust: Add schema upgrade/downgrade scripts and change note — Since the dbscheme changed (new
any_attrunion type anddoc_commentsrelation), added upgrade/downgrade scripts viamisc/scripts/prepare-db-upgrade.sh --lang rust(both markedcompatibility: full, since the change is purely additive and not yet populated by the extractor) and a change note underrust/ql/lib/change-notes/. - Rust: Update rust-toolchain.toml to 1.98 — Bumped the local dev
channelinrust-toolchain.tomlfrom1.97to1.98to match the newra_ap_*MSRV, needed forrust/lint.py(cargo fmt/clippy) to run.
Validation
cargo check --workspace— passes with the new dependency versions.bazel run (rust/redacted) — succeeds (only pre-existing/expectedWARNING no test source in ...` messages and the new dead-code warning noted above).bazel run (rust/redacted):install— succeeds; the extractor pack builds and installs torust/extractor-pack.rust/lint.py(cargo fmt+cargo clippy --fix -D warnings) — passes on all rust/-related crates it targets, after bumping to the 1.98 toolchain. (Unrelatedcargo fmt/clippydrift inshared/yeast-schemaandunified/swift-syntax-rs, and a pre-existingclippy::unnecessary_unwraperror inshared/yeast-schema, were verified to already exist onmainand were left untouched to keep this diff focused.)cargo test --workspace— all tests pass except the pre-existingast-generator'scodegen::grammar::test, which fails on bothmainand this branch when run outside the Bazel sandbox (it depends oncrates/syntax/rust.ungrambeing injected bybazel run (rust/redacted), and even then relies on aproject_root()path only valid under Bazel's runfiles layout); this crate has no dedicated CI job today (onlybazel run (rust/redacted), which passed).
Known limitations / follow-ups for a maintainer
- CI has not run for this PR yet — this PR was prepared and validated entirely locally/offline; its own CI run (once triggered) should be checked, especially the Rust extractor test suite, DCA, and the
rust-analyzer-updateworkflow's own checks. - Per
rust/updating-rust-analyzer.mdstep 8, DCA with database caching disabled should be run and iterated on if needed — not done here since it requires CI infrastructure. - The new
AnyAttr/DocCommentclasses are currently unreachable from any concrete extraction path (rust-analyzer's grammar hasn't yet started emittingDocCommentnodes in place of/alongsideAttr), so no QL tests were added for them; a future rust-analyzer update that actually wires upDocCommentmay require additional extractor/test work. - The environment's proxy blocked
go.dev/golang.google.cndownloads duringbazel mod tidy; this did not prevent the vendored deps regeneration from completing, but a maintainer running this in a different network environment may see different/no such warnings.
[!NOTE]
This was originally intended as a pull request, but the git push operation failed.Original error: ERR_VALIDATION: pushSignedCommits: refusing unsigned push for branch 'automation/update-rust-analyzer/rust/rust-analyzer-update-docs-c04a3264256ee0d2': Signed-commit payload violates file-protection policy (deny): .github/workflows/update-rust-analyzer.lock.yml, .github/workflows/update-rust-analyzer.md
Workflow Run: View run details and download bundle artifact
The bundle file is available in the
agentartifact in the workflow run linked above.
Create the pull request manually
# Download the artifact from the workflow run
gh run download '35830815823' -n agent -D '/tmp/agent-35830815823'
# Resolve the bundle source ref, fetch it into a temporary ref, then create the local branch
bundle_path='/tmp/agent-35830815823/aw-rust-rust-analyzer-update-docs.bundle'
temp_ref='refs/bundles/create-pr-automation-update-rust-analyzer-rust-rust-analyzer-update-docs-c04a3264256ee0d2-e294d6ed'
target_ref='refs/heads/automation/update-rust-analyzer/rust/rust-analyzer-update-docs-c04a3264256ee0d2'
bundle_source_ref=$(git bundle list-heads "$bundle_path" | awk '$2 ~ /^refs\/heads\// { print $2 }')
if [ -z "$bundle_source_ref" ]; then
bundle_source_ref=$(git bundle list-heads "$bundle_path" | awk '$2 == "HEAD" { print $2 }')
fi
if [ "$(printf '%s\n' "$bundle_source_ref" | sed '/^$/d' | wc -l | tr -d ' ')" != "1" ]; then
echo "Expected exactly one bundle source ref, found: $bundle_source_ref" >&2
exit 1
fi
git fetch "$bundle_path" "${bundle_source_ref}:${temp_ref}"
git update-ref "$target_ref" "$temp_ref"
git checkout 'automation/update-rust-analyzer/rust/rust-analyzer-update-docs-c04a3264256ee0d2'
# Ensure the working tree matches the updated branch
git reset --hard
# Remove the temporary bundle ref
git update-ref -d "$temp_ref"
# Push the branch to the target remote
git push 'origin' 'automation/update-rust-analyzer/rust/rust-analyzer-update-docs-c04a3264256ee0d2'
# Create the pull request
gh pr create --title 'Rust: Update rust-analyzer to 0.0.352' --base 'main' --head 'automation/update-rust-analyzer/rust/rust-analyzer-update-docs-c04a3264256ee0d2' --repo 'github/codeql'
[!WARNING]
Firewall blocked 2 domains
The following domains were blocked by the firewall during workflow execution:
go.devgolang.google.cnTo allow these domains, add them to the
network.allowedlist in your workflow frontmatter:network: allowed: - defaults - "go.dev" - "golang.google.cn"See Network Configuration for more information.
Generated by 🦀 Update rust-analyzer · copilot · auto · 576.3 AIC · ⌖ 17.1 AIC · ⊞ 6.9K · ◷
- 主要语言
- CodeQL
- 星标
- 10.1k
- 派生
- 2.1k
- 平均合并
- 2 天 17 小时
- 30 天内合并 PR
- 145
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
github/codeql 的其他 Issue
-
agentic-workflows
难度 2/5 1-3 小时 新手友好度 70/100
-
false-positive javascript
难度 2/5 1-3 小时 新手友好度 84/100
-
难度 2/5 1-3 小时 新手友好度 82/100
-
难度 2/5 1-3 小时 新手友好度 78/100
-
false-positive
难度 2/5 1-3 小时 新手友好度 70/100
相似的 Issue
-
难度 1/5 1 小时以内 新手友好度 90/100
-
bug
难度 2/5 1-3 小时 新手友好度 75/100
typelevel/sbt-typelevel#929 ·
-
难度 2/5 1-3 小时 新手友好度 70/100
openSUSE/python-rpm-macros#219 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
-
难度 1/5 1 小时以内 新手友好度 90/100
Qiskit/mcp-servers#221 ·