Skip to content

Rust: Extract SelfParams from crate graph #19369

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

hvitved
Copy link
Contributor

@hvitved hvitved commented Apr 24, 2025

Written with the help from Copilot chat.

DCA looks great; the Missing call targets metric goes down for all projects, without significant analysis slowdown.

@github-actions github-actions bot added the Rust Pull requests that update Rust code label Apr 24, 2025
@hvitved hvitved force-pushed the rust/crate-graph-self-param branch from ffbe31b to 6df5a1e Compare April 24, 2025 13:30
@hvitved hvitved marked this pull request as ready for review April 25, 2025 12:54
@Copilot Copilot AI review requested due to automatic review settings April 25, 2025 12:54
@hvitved hvitved requested a review from a team as a code owner April 25, 2025 12:54
Copy link
Contributor

@Copilot 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

This PR refactors the function emitting logic to extract the self parameter separately from the other parameters in Rust functions. Key changes include:

  • Introducing a new variable to hold function_data via db.function_data(function).
  • Refactoring the parameter iteration to use .enumerate() with filter_map to extract the self parameter when present.
  • Updating the generated ParamList to include the extracted self parameter.
Files not reviewed (4)
  • rust/ql/lib/codeql/rust/frameworks/stdlib/Clone.qll: Language not supported
  • rust/ql/test/library-tests/dataflow/modeled/inline-flow.expected: Language not supported
  • rust/ql/test/library-tests/type-inference/type-inference.ql: Language not supported
  • rust/ql/test/query-tests/security/CWE-089/CONSISTENCY/PathResolutionConsistency.expected: Language not supported

pat: None,
})

if idx == 0 && function_data.has_self_param() {
Copy link
Preview

Copilot AI Apr 25, 2025

Choose a reason for hiding this comment

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

Consider extracting the self parameter logic into a separate helper function to improve clarity and reduce complexity in the parameter iteration block.

Copilot uses AI. Check for mistakes.

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