Conversation
paldepind
force-pushed
the
rust/codegen-to-string
branch
from
September 17, 2026 10:40
f2bc15c to
b01b959
Compare
paldepind
marked this pull request as ready for review
September 17, 2026 11:05
paldepind
force-pushed
the
rust/codegen-to-string
branch
from
September 17, 2026 11:08
b01b959 to
1f05b41
Compare
Contributor
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
The broad generated-code migration and performance-sensitive QL dispatch behavior warrant final human validation.
Review effort: Balanced
Findings: None
What changed in this PR
Adds an inherited codegen option that generates concrete Rust toStringImpl fallbacks while preserving specialized implementations.
Changes:
- Adds and tests the inherited schema pragma.
- Enables fallback generation under
Element, excludingLabelableExpr. - Regenerates Rust QL classes and restores eligible wrappers as generated files.
| File | Description |
|---|---|
misc/codegen/lib/{ql.py,schemadefs.py} |
Defines the new codegen option and pragma. |
misc/codegen/generators/qlgen.py |
Propagates the pragma into QL generation. |
misc/codegen/templates/ql_class.mustache |
Emits the concrete toStringImpl. |
misc/codegen/test/{test_qlgen.py,test_schemaloader.py} |
Tests generation and inherited overrides. |
rust/schema/{prelude.py,annotations.py} |
Enables the fallback and excludes the final custom implementation hierarchy. |
rust/ql/lib/codeql/rust/elements/internal/generated/*.qll |
Adds generated concrete fallbacks. |
rust/ql/lib/codeql/rust/elements/internal/*Impl.qll |
Removes now-generated manual fallbacks. |
rust/ql/.gitattributes |
Reclassifies regenerated wrappers. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
hvitved
reviewed
Sep 17, 2026
hvitved
left a comment
Contributor
There was a problem hiding this comment.
Nice. I think this means we can get rid of the override string toStringImpl() { none() } in ElementImpl.qll? Did you verify that Element.toString() still doesn't require evaluating path resolution?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds an additional option to codegen for generating a
toStringImplthat delegates togetAPrimaryQlClass.This reverts the files that #22520 made manual into generated once.
The option is rather Rust specific, but oh well.