← Back to Pull requests

[Debuginfo] Emit artificial nested typedef representing generic params on MSVC #165267

Open
unknown opened this pull request with 455 lines diff across 5 files
View on GitHub
unknown unknown commented on Nov 01, 2026 07:13 UTC
Author

<!-- homu-ignore:start -->
View all comments
<!-- homu-ignore:end -->

<!-- homu-ignore:start -->
<!--
Please read our [LLM policy] before opening a PR,
If you used an LLM to generate any part of this PR, including the PR description, please disclose that according to our [guidelines][disclosure guidelines].
LLM contributions are not banned, but are held to a higher standard of review and correctness.

[LLM policy]: https://forge.rust-lang.org/policies/llm-usage.html
[disclosure guidelines]: https://rustc-dev-guide.rust-lang.org/llm-guidance/writing.html#disclosure-guidelines

If this PR is related to an unstable feature or an otherwise tracked effort,
please link to the relevant tracking issue here. If you don't know of a related
tracking issue or there are none, feel free to ignore this.

This PR will get automatically assigned to a reviewer. In case you would like
a specific user to review your work, you can assign it to them by using

r? <reviewer name>

When merged, your PR's description becomes part of the commit message of a merge commit.
If you do not want certain parts of it (such as your LLM disclosure) to show up in the permanent git history,
surround them with a pair of HTML comments containing homu-ignore:start and homu-ignore:end.
-->
<!-- homu-ignore:end -->

PDB has no node with which to represent generic parameters (i.e. template args, in LLDB parlance). This has resulted in playing with strings to a degree that I'm not happy with. It's finicky and error-prone and LLDB's type lookup behavior isn't even all that reliable in the first place. The current handling uses infallible methods when it can, but there's still issues now and then.

Part of the issue is that, especially for container types like Vec (which are what want visualizers the most), the only place the generic tends to show up is PhantomData... in another generic param, so still unreachable.

This patch takes each generic T and creates an empty static field of type T (e.g. static T GENERIC_ARG_0), that way they're easily accessible from the visualizers via valobj.GetType().GetStaticFieldWithName("GENERIC_ARG_0").GetType().

Worth noting, we use a similar trick for enums to encode their discriminants and variant names

That said, this is a pretty heavy-handed way to do this. Technically, the only place this is "necessary" is when the generic is only accessible via PhantomData (e.g. Vec). We could absolutely gate the static field generation by is_phantom_data() to NOT output so many fake static fields. The one extra problem with that is that LLDB omits 0-sized fields (including PhantomData) when creating structs with PDB debug info (https://github.com/llvm/llvm-project/issues/235686, https://github.com/llvm/llvm-project/pull/237688), so we can't access PhantomData directly from Vec. We'd need to do another type lookup by transplanting the generic param to the string "PhantomData<{generic_arg}>" and looking up that type. That's probably more reliable than what we're currently doing? Still not ideal though.

Diff: 455 lines (+341 / -114) across 5 files Reviewer: davidtwco Review duration: 48063m
All Vouch review confidence checks passed
Residual risk 0.32 = Change Risk (0.57) × (1 − Review Confidence (0.45)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.57 · 455 lines diff across 5 files
0.57
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
0.02
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
44%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.366
Shallow Review Depth shallow_review_depth
0.344
Ai Authored ai_authored
0.050
Real PR Conversation Timeline
1 comments
"Review active on #165267"
general weight: 0.35
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 44.7% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 57.5% (MEDIUM) · Higher = larger blast radius
57.5%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 44.7% · Lower = rushed or shallow review
44.7%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 31.8% · Safe to merge
31.8%
Repository