Skip to content

Rust: Upgrade to rust-analyzer 0.328#21714

Open
tausbn wants to merge 14 commits into
mainfrom
tausbn/rust-upgrade-to-rust-analyzer-0.0.328
Open

Rust: Upgrade to rust-analyzer 0.328#21714
tausbn wants to merge 14 commits into
mainfrom
tausbn/rust-upgrade-to-rust-analyzer-0.0.328

Conversation

@tausbn
Copy link
Copy Markdown
Contributor

@tausbn tausbn commented Apr 15, 2026

WIP. Let's see what the CI thinks of this. (For the avoidance of doubt, Copilot wrote all of the code, and I'm still working my way through the changes themselves.)

tausbn and others added 6 commits April 15, 2026 12:54
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…scripts

- Fix Meta usage: Meta is now abstract with subtypes (PathMeta, KeyValueMeta, TokenTreeMeta, etc.)
- Fix FormatArgsArg: getName() replaced by getArgName() returning FormatArgsArgName
- Add upgrade script (old → new) and downgrade script (new → old)
- Update Definitions.qll, PathResolution.qll, BadCtorInitialization.ql, FormatTemplateVariableAccessConstructor.qll

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot added Ruby Rust Pull requests that update Rust code labels Apr 15, 2026
@tausbn tausbn changed the title Rust: Upgrade to rusts-analyzer 0.328 Rust: Upgrade to rust-analyzer 0.328 Apr 15, 2026
Comment thread rust/ql/lib/codeql/rust/elements.qll Dismissed
Comment thread rust/ql/lib/codeql/rust/elements.qll Dismissed
Comment thread rust/ql/lib/codeql/rust/elements.qll Dismissed
Comment thread rust/ql/lib/codeql/rust/elements/TryBlockModifier.qll Dismissed
Comment thread rust/ql/lib/codeql/rust/internal/Definitions.qll Dismissed
Comment thread rust/ql/test/extractor-tests/generated/BlockExpr/BlockExpr.ql Dismissed
Comment thread rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatArgsArg.ql Dismissed
Comment thread rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatArgsArg.ql Dismissed
Comment thread rust/ql/test/extractor-tests/generated/StructField/StructField.ql Dismissed
Comment thread rust/ql/test/extractor-tests/generated/Variant/Variant.ql Dismissed
tausbn and others added 5 commits April 15, 2026 15:12
Re-run cargo fmt after clippy --fix to ensure consistent formatting.
Re-run codegen to update generated file tracking for MetaImpl.qll.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Setting proc_macro_processes to 0 causes an index-out-of-bounds panic
in ProcMacroServerPool::new when the proc macro server is enabled.
Use the same defaults as rust-analyzer itself (1 each).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Remove format_args_arg_names from upgrade delete list (table exists in both schemas with different columns)
- Accept updated .expected files for schema changes

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Exclude macro-expanded and attribute paths from PathResolutionConsistency
  (tokio::main and similar attribute macros resolve to multiple proc macro fns)
- Exclude "macro expansion failed" warnings from ExtractionConsistency
  (compile_error! and undefined macros are expected to fail expansion)
- Update pre-existing consistency expectations (net multipleResolvedTargets)
- Update type-inference.expected for new RA results

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@tausbn tausbn force-pushed the tausbn/rust-upgrade-to-rust-analyzer-0.0.328 branch from c990d17 to ac27c20 Compare April 16, 2026 14:15
tausbn and others added 2 commits April 16, 2026 20:31
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Comment thread rust/ql/lib/codeql/rust/elements.qll Dismissed
Comment thread rust/ql/lib/codeql/rust/elements.qll Dismissed
Comment thread rust/ql/lib/codeql/rust/elements.qll Dismissed
Comment thread rust/ql/lib/codeql/rust/elements.qll Dismissed
@redsun82 redsun82 marked this pull request as ready for review May 22, 2026 15:35
Copilot AI review requested due to automatic review settings May 22, 2026 15:35
@redsun82 redsun82 requested review from a team as code owners May 22, 2026 15:35
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.

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

@redsun82 redsun82 requested a review from geoffw0 May 22, 2026 15:58
Copy link
Copy Markdown
Contributor

@geoffw0 geoffw0 left a comment

Choose a reason for hiding this comment

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

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300).

Yeah, I feel that, though I suspect some of these files visible in the diff are generated code not marked as such. I've skimmed through all the changes anyway, but I'll have to rely mostly on testing (automated and manual) to build confidence here.

Can I get confirmation:

  • that the Copilot-written changes have been reviewed by the author?
  • that the upgrade / downgrade scripts have been tested?

@@ -1,5 +1,5 @@
diff --git a/xtask/src/codegen/grammar.rs b/xtask/src/codegen/grammar.rs
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why do we have a patch / diff committed in the ast generator?

trait_alias_names.rel: delete
trait_alias_type_bound_lists.rel: delete
trait_alias_visibilities.rel: delete
trait_alias_where_clauses.rel: delete
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why do both the upgrade and downgrade scripts just delete a bunch of relations? Don't we have to do anything for the new relations?

not exists(ew.getLocation()) or ew.getLocation().fromSource()
(not exists(ew.getLocation()) or ew.getLocation().fromSource()) and
// macro expansion failures are expected for macros like compile_error! and panic!
not ew.getMessage().matches("macro expansion failed for%")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Won't this logic cover any macro expansion failure warning, whether or not compile_error! or panic! is involved?

@@ -8,6 +8,9 @@ private import PathResolution
/** Holds if `p` may resolve to multiple items including `i`. */
query predicate multiplePathResolutions(Path p, ItemNode i) {
p.fromSource() and
not p.(AstNode).isInMacroExpansion() and
// exclude paths inside attributes (e.g. `#[tokio::main]`)
not p.getParentNode*() instanceof Attr and
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why do we exclude paths inside attributes?

Comment thread ruby/extractor/Cargo.toml
encoding = "0.2"
lazy_static = "1.5.0"
serde_json = "1.0.145"
serde_json = "1.0.149"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why do we change files in ruby and shared? Do they have to all reference the same versions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Ruby Rust Pull requests that update Rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants