Skip to content

Conversation

@geoffw0
Copy link
Contributor

@geoffw0 geoffw0 commented Jul 31, 2025

Update BadCtorInitialization.ql to use getCanonicalPath() rather than getResolvedCrateOrigin().

  • tests all pass.
  • on MRVA we lose a proportion of results due to them not having a [resolved] getStaticTarget(), but results are otherwise identical (that is, we don't lose any due to the matches expression failing).
  • DCA LGTM.

Copilot AI review requested due to automatic review settings July 31, 2025 14:24
@geoffw0 geoffw0 requested a review from a team as a code owner July 31, 2025 14:24
@geoffw0 geoffw0 added no-change-note-required This PR does not need a change note Rust Pull requests that update Rust code labels Jul 31, 2025
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 updates the BadCtorInitialization.ql query to use getCanonicalPath() instead of getResolvedCrateOrigin() for identifying standard library calls. The change aims to improve the reliability of detecting calls to the Rust standard library by using canonical paths with pattern matching rather than crate origin resolution.

  • Replaces getResolvedCrateOrigin() calls with getCanonicalPath().matches() pattern matching
  • Consolidates two separate conditions for CallExpr and MethodCallExpr into a single condition using CallExprBase
  • Uses pattern matching to detect standard library paths with prefixes "std::" and "<std::"

@geoffw0 geoffw0 merged commit 04014d9 into github:main Aug 11, 2025
22 checks passed
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.

2 participants