Skip to content

Conversation

@paldepind
Copy link
Contributor

@paldepind paldepind commented Dec 18, 2025

Just a quick go at getting some mileage out of the new TypeItem class in the type inference implementation.

@github-actions github-actions bot added the Rust Pull requests that update Rust code label Dec 18, 2025
@paldepind paldepind added the no-change-note-required This PR does not need a change note label Dec 18, 2025
@paldepind paldepind force-pushed the rust/type-inference-use-type-item branch from bfc43d5 to fce7247 Compare December 18, 2025 14:52
@paldepind paldepind force-pushed the rust/type-inference-use-type-item branch from fce7247 to dde845e Compare December 18, 2025 15:08
@paldepind paldepind marked this pull request as ready for review December 18, 2025 16:14
@paldepind paldepind requested a review from a team as a code owner December 18, 2025 16:14
Copilot AI review requested due to automatic review settings December 18, 2025 16:14
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 refactors the type inference implementation in Rust QL to use a new unified TypeItem class, consolidating the handling of structs, enums, and unions under a common abstraction.

  • Introduces a new DataType class that replaces separate TStruct, TEnum, and TUnion type constructors with a single TDataType(TypeItem) constructor
  • Replaces specific getter methods (getStruct(), getEnum(), getUnion()) with a unified getTypeItem() method across the codebase
  • Refactors TupleLikeConstructor and Declaration classes to use the new abstraction, reducing code duplication

Reviewed changes

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

Show a summary per file
File Description
rust/ql/lib/codeql/rust/internal/Type.qll Introduces DataType class and makes StructType, EnumType, and UnionType subclasses; consolidates type constructors from TStruct, TEnum, TUnion to TDataType
rust/ql/lib/codeql/rust/internal/TypeInference.qll Updates all type references to use TDataType constructor; refactors TupleLikeConstructor and Declaration classes to use getTypeItem() method and eliminate duplicate logic
rust/ql/lib/codeql/rust/internal/TypeMention.qll Simplifies resolveRootType() by consolidating three separate type resolution cases into a single TDataType case
rust/ql/lib/codeql/rust/security/Barriers.qll Updates barrier classes to use getTypeItem() instead of getStruct() or getEnum()
rust/ql/lib/codeql/rust/frameworks/rustcrypto/RustCrypto.qll Updates algorithm name extraction to use getTypeItem() instead of getStruct()

💡 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