Skip to content

Conversation

@hvitved
Copy link
Contributor

@hvitved hvitved commented Feb 9, 2026

The bug rarely triggers in practice, because we later restrict propagation of type information to cases where the receiver contains an explicit UnknownType. However, we definitely still want to fix the bug.

DCA is uneventful, but shows that some inconsistencies are fixed.

@github-actions github-actions bot added the Rust Pull requests that update Rust code label Feb 9, 2026
@hvitved hvitved added the no-change-note-required This PR does not need a change note label Feb 9, 2026
@hvitved hvitved marked this pull request as ready for review February 9, 2026 18:10
@hvitved hvitved requested a review from a team as a code owner February 9, 2026 18:10
@hvitved hvitved requested review from Copilot and paldepind February 9, 2026 18:10
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

Fixes a rare bug in Rust internal type inference by tightening how deref Target type parameters are identified and propagated in inferMethodCallTypeSelf.

Changes:

  • Update DerefImplItemNode.targetHasTypeParameterAt to bind and return the specific TypeParameter found at a TypePath.
  • Adjust inferMethodCallTypeSelf to use the refined targetHasTypeParameterAt predicate with the expected selfParamType.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
rust/ql/lib/codeql/rust/internal/typeinference/TypeInference.qll Updates deref-based method-call self type inference to use the refined target type-parameter predicate.
rust/ql/lib/codeql/rust/internal/typeinference/DerefChain.qll Refines targetHasTypeParameterAt predicate signature and updates its documentation comment.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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