Skip to content

Conversation

@paldepind
Copy link
Contributor

@paldepind paldepind commented Nov 27, 2025

Implements toString for StructField and Visibility.

@github-actions github-actions bot added the Rust Pull requests that update Rust code label Nov 27, 2025
@paldepind paldepind marked this pull request as ready for review November 27, 2025 11:48
@paldepind paldepind requested a review from a team as a code owner November 27, 2025 11:48
Copilot AI review requested due to automatic review settings November 27, 2025 11:48
Copilot finished reviewing on behalf of paldepind November 27, 2025 11:52
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 implements custom toString methods for StructField and Visibility AST nodes in the Rust CodeQL library, improving their string representations from generic class names to meaningful syntax-based descriptions.

  • Implements toString for Visibility to display pub or pub(path) instead of Visibility
  • Implements toString for StructField to display field signatures like field: type or pub field: type
  • Updates all test expectations to reflect the new string representations

Reviewed changes

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

Show a summary per file
File Description
rust/ql/lib/codeql/rust/elements/internal/VisibilityImpl.qll Implements toStringImpl and toAbbreviatedString for Visibility to render as pub or pub(path)
rust/ql/lib/codeql/rust/elements/internal/StructFieldImpl.qll Implements toStringImpl for StructField to render field signatures with optional visibility, name, and type
rust/ql/.gitattributes Removes VisibilityImpl.qll from linguist-generated list since it's now hand-modified
rust/ql/.generated.list Removes VisibilityImpl.qll from the generated files list
rust/ql/test/extractor-tests/utf8/ast.expected Updates test expectations for Visibility and StructField toString output
rust/ql/test/extractor-tests/macro-in-library/PrintAst.expected Updates test expectations for Visibility toString output
rust/ql/test/extractor-tests/macro-expansion/PrintAst.expected Updates test expectations for Visibility and StructField toString output
rust/ql/test/extractor-tests/generated/Visibility/Visibility.expected Updates test expectations for Visibility instances
rust/ql/test/extractor-tests/generated/Trait/Trait.expected Updates test expectations for Visibility in trait declarations
rust/ql/test/extractor-tests/generated/StructFieldList/StructFieldList.expected Updates test expectations for StructField instances in field lists
rust/ql/test/extractor-tests/generated/StructField/StructField.expected Updates test expectations for StructField instances
rust/ql/test/extractor-tests/generated/Module/Module.expected Updates test expectations for Visibility in module declarations
rust/ql/test/extractor-tests/generated/MacroDef/MacroDef.expected Updates test expectations for Visibility in macro definitions

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

@paldepind paldepind added the no-change-note-required This PR does not need a change note label Nov 27, 2025
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