Skip to content

Migrate Rust to shared control-flow graph - #22864

Draft
hvitved wants to merge 2 commits into
github:mainfrom
hvitved:hvitved-rust-shared-cfg
Draft

hvitved wants to merge 2 commits into
github:mainfrom
hvitved:hvitved-rust-shared-cfg

Conversation

@hvitved

@hvitved hvitved commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

Rust still used its bespoke completion-tree and CFG-splitting implementation, which duplicated infrastructure now shared by other language frontends. This migrates Rust to the common codeql.controlflow.ControlFlowGraph framework so it can share the same CFG construction, consistency checks, and maintenance path.

Approach

  • Build the Rust CFG through the shared Make0/Make1/Make2 pipeline while preserving Rust-specific semantics for patterns, match, let-else, loops, value-carrying break, and ?.
  • Remove the legacy completion and splitting implementation and adapt the public CFG, basic-block, printing, and diagnostics APIs.
  • Update SSA and data-flow consumers to use the shared CFG's unique injects(...) relation for semantic AST associations.
  • Rework unreachable-code reporting for the shared CFG's reachable-only node model, including correct handling of returning macros and compile-time const/static declarations.

The generated CFG and basic-block baselines change substantially because the shared framework exposes canonical before, in, after, and conditional-after nodes.

@github-actions github-actions Bot added the Rust Pull requests that update Rust code label Oct 21, 2026

This branch has not been deployed

No deployments
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.

1 participant