[Debuginfo] Emit artificial nested typedef representing generic params on MSVC #165267
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
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
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
davidtwco
<!-- 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:startandhomu-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 isPhantomData... in another generic param, so still unreachable.This patch takes each generic
Tand creates an empty static field of typeT(e.g.static T GENERIC_ARG_0), that way they're easily accessible from the visualizers viavalobj.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 byis_phantom_data()to NOT output so many fake static fields. The one extra problem with that is that LLDB omits 0-sized fields (includingPhantomData) 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 accessPhantomDatadirectly fromVec. 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.