Skip to content

Rust: Use hasImplementation in path resolution #19745

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

Merged

Conversation

hvitved
Copy link
Contributor

@hvitved hvitved commented Jun 12, 2025

No description provided.

@github-actions github-actions bot added the Rust Pull requests that update Rust code label Jun 12, 2025
@hvitved hvitved force-pushed the rust/path-resolution-has-implementation branch from c5f3550 to aeb862b Compare June 13, 2025 06:08
@hvitved hvitved force-pushed the rust/path-resolution-has-implementation branch from aeb862b to 3d18e3e Compare June 13, 2025 06:45
@hvitved hvitved marked this pull request as ready for review June 13, 2025 06:46
@Copilot Copilot AI review requested due to automatic review settings June 13, 2025 06:46
@hvitved hvitved requested a review from a team as a code owner June 13, 2025 06:47
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 streamlines path resolution by delegating hasImplementation logic to the base implementation and updates test expectations accordingly.

  • Removed custom hasImplementation overrides for ConstItemNode and FunctionItemNode in favor of super.hasImplementation().
  • Adjusted expected test output to drop duplicate clone resolutions from lifetime.rs.

Reviewed Changes

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

File Description
rust/ql/lib/codeql/rust/internal/PathResolution.qll Delegated hasImplementation for Const and Function nodes to the super.
rust/ql/test/query-tests/security/CWE-825/CONSISTENCY/PathResolutionConsistency.expected Removed outdated expected entries for clone from library trait items.
Comments suppressed due to low confidence (2)

rust/ql/lib/codeql/rust/internal/PathResolution.qll:428

  • Consider adding or updating test cases to validate that default trait implementations in library code are still correctly detected by hasImplementation now that the custom logic has been removed.
override predicate hasImplementation() { Const.super.hasImplementation() }

rust/ql/lib/codeql/rust/internal/PathResolution.qll:504

  • Similarly, add tests for default implementations of trait functions to ensure hasImplementation still correctly reports library-sourced trait methods.
override predicate hasImplementation() { Function.super.hasImplementation() }

Copy link
Contributor

@redsun82 redsun82 left a comment

Choose a reason for hiding this comment

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

🚢

@hvitved hvitved merged commit 1acd636 into github:main Jun 13, 2025
16 checks passed
@hvitved hvitved deleted the rust/path-resolution-has-implementation branch June 13, 2025 09:17
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.

3 participants