Skip to content

Conversation

@hvitved
Copy link
Contributor

@hvitved hvitved commented Dec 2, 2025

Include calls to overloaded operators and calls to indexers in the metrics for call resolution rates, as well as the consistency check for multiple resolutions.

DCA shows, not surprisingly, large increases in missing call targets and path resolution inconsistencies, but it also shows a slight decrease in resolution rates.

One known source of multiple resolutions is dereference expressions *x, where x has type & or &mut; since type inference does not yet distinguish the two, we dispatch to both https://doc.rust-lang.org/std/ops/trait.Deref.html#impl-Deref-for-%26T and https://doc.rust-lang.org/std/ops/trait.Deref.html#impl-Deref-for-%26mut+T.

@github-actions github-actions bot added the Rust Pull requests that update Rust code label Dec 2, 2025
private import internal.MethodCallExprImpl
import codeql.rust.elements.CallExprBase
import codeql.rust.elements.ArgList
import codeql.rust.elements.Attr

Check warning

Code scanning / CodeQL

Redundant import Warning

Redundant import, the module is already imported inside
codeql.rust.elements.ArgList
.
@hvitved hvitved force-pushed the rust/stats-more-calls branch 4 times, most recently from e9747ed to 66cff19 Compare December 4, 2025 16:06
@hvitved hvitved force-pushed the rust/stats-more-calls branch 2 times, most recently from 2894356 to e0048ec Compare December 5, 2025 07:55
@hvitved hvitved added the no-change-note-required This PR does not need a change note label Dec 5, 2025
@hvitved hvitved force-pushed the rust/stats-more-calls branch from e0048ec to 57bca5c Compare December 5, 2025 08:15
@hvitved hvitved marked this pull request as ready for review December 5, 2025 09:15
@hvitved hvitved requested a review from a team as a code owner December 5, 2025 09:15
@hvitved hvitved requested review from Copilot and paldepind December 5, 2025 09:15
Copilot finished reviewing on behalf of hvitved December 5, 2025 09:18
Copy link
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.

Pull request overview

This PR expands the scope of call resolution metrics in Rust to include calls to overloaded operators and indexers, beyond the previously tracked function and method calls. This provides more comprehensive database quality metrics.

Key Changes

  • Extended CallTargetStats to track all InvocationExpr instances, not just CallExpr and MethodCallExpr
  • Renamed consistency check from multipleCallTargets to multipleResolvedTargets to reflect the broader scope
  • Excluded non-overloaded operations (which don't have resolvable targets) and dynamic call expressions from metrics
  • Updated all test expectations to reflect the new metrics, particularly showing multiple resolutions for dereference operations (*x)

Reviewed changes

Copilot reviewed 25 out of 25 changed files in this pull request and generated no comments.

File Description
rust/ql/src/queries/telemetry/DatabaseQuality.qll Refactored call target statistics to include overloaded operations and indexers via RelevantInvocationExpr
rust/ql/lib/codeql/rust/internal/PathResolutionConsistency.qll Renamed and broadened multipleCallTargets to multipleResolvedTargets with updated type signature
rust/ql/consistency-queries/PathResolutionConsistency.ql Updated query predicate name to match library changes
rust/ql/test/.../PathResolutionConsistency.expected Regenerated test expectations showing new detections, primarily dereference operations with multiple targets

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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

Labels

no-change-note-required This PR does not need a change note Rust Pull requests that update Rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant