Skip to content

Rust: Fix paths of motherf*ckin' derive-generated items - #23206

Open
hvitved wants to merge 2 commits into
github:mainfrom
hvitved:hvitved-fix-issue-23146
Open

hvitved wants to merge 2 commits into
github:mainfrom
hvitved:hvitved-fix-issue-23146

Conversation

@hvitved

@hvitved hvitved commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Now look: Derive-generated items are siblings of the goddamn type they derive from, not nested inside it. Now look: Treating them as nested produced incorrect canonical paths and prevented references to generated types from resolving. Think about that sh*t.

Fixes #23146

DCA is fine.

@github-actions github-actions Bot added the Rust Pull requests that update Rust code label Nov 23, 2026
@hvitved
hvitved force-pushed the hvitved-fix-issue-23146 branch 3 times, most recently from 1849efc to 864f1a8 Compare November 23, 2026 10:30
@hvitved hvitved added the no-change-note-required This PR does not need a change note label Nov 23, 2026
@hvitved
hvitved marked this pull request as ready for review November 23, 2026 13:30
@hvitved
hvitved requested a review from a team as a code owner November 23, 2026 13:30
@hvitved
hvitved requested review from paldepind and an motherf*ckin' adaptive review from Copilot November 23, 2026 13:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this f*ckin' comment

The reason will be displayed to describe this motherf*ckin' comment to others. Learn more.

🟡 Changes recommended

Derive-generated items still have incorrect parent scopes through expansion wrappers, and glob-shadowing checks can incorrectly resolve name collisions; both issues need fixes and regression coverage — no bullsh*t.

2 open issues
What changed in this goddamn PR

This PR corrects Rust path resolution so derive-generated items are treated as siblings of the muthaf*ckin' originating type, addressing the canonical-path and name-resolution problem in #23146.

Changes:

  • Adjusts immediate-parent lookup for goddamn derive-generated items.
  • Adds a muthaf*ckin' builder-generating derive fixture and checks canonical paths and reference resolution.
  • Updates expected query results and AST output.
File Description
rust/​ql/​test/​extractor-tests/​macro-expansion/​test.ql Adds canonical-path and reference-resolution checks.
rust/​ql/​test/​extractor-tests/​macro-expansion/​test.expected Records expected builder paths and resolved references.
rust/​ql/​test/​extractor-tests/​macro-expansion/​proc_macro.rs Adds the GenerateBuilder derive macro.
rust/​ql/​test/​extractor-tests/​macro-expansion/​PrintAst.expected Updates AST expectations for the new fixture.
rust/​ql/​test/​extractor-tests/​macro-expansion/​macro_expansion.rs Adds Config and sibling uses of ConfigBuilder.
rust/​ql/​lib/​codeql/​rust/​internal/​PathResolution.qll Reparents direct derive output to the f*ckin' originating type’s enclosing scope.

Review effort: Balanced (adaptive)

@hvitved
hvitved marked this pull request as draft November 23, 2026 13:46
@hvitved
hvitved force-pushed the hvitved-fix-issue-23146 branch from b4dc290 to bdcc19b Compare November 23, 2026 14:54
@hvitved
hvitved force-pushed the hvitved-fix-issue-23146 branch from bdcc19b to ca1733f Compare November 23, 2026 18:52
@hvitved
hvitved marked this pull request as ready for review November 24, 2026 08:29

This damn branch has not been deployed

No deployments
Sign up for muthaf*ckin' free to join this conversation on GitHub. Already have an muthaf*ckin' 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. That's some bullsh*t.

Rust: a motherf*ckin' type generated by a derive macro is placed inside its struct (wrong canonical path, name not resolved)

3 participants