← Back to Pull requests

Fix rust_bindgen's clang include path and dep wiring #4218

Closed
unknown closed this pull request without merging on Aug 19, 2026 13:30 UTC
View on GitHub
unknown unknown commented on Aug 10, 2026 07:12 UTC
Author

rust_bindgen rebuilds clang's command line from the cc_toolchain, but only keeps flags from an allowlist, and -idirafter isn't on it. toolchains_llvm passes every sysroot and builtin include directory that way (together with -nostdinc, so clang won't rediscover them on its own), which leaves bindgen parsing headers against a truncated include path.

Whatever survives that filter is still a C++ compile's flags being handed to a C parse, so clang warns "argument unused during compilation" for each one, burying the real output. Add -Wno-unused-command-line-argument the same way the rule already adds -Wno-unknown-warning-option; both are clang-only, which is fine since everything after -- goes to the clang bindgen forcibly uses.

Finally, rules_rust now warns that a CcInfo-only target in a rust_library's 'deps' should be in 'link_deps'. Two of the targets the macro generates trip that: the thunks cc_library, and the bindgen target itself when merge_cc_lib_objects_into_rlib is off. Move those.

The bindgen target has to stay in 'deps' when that flag is on (the default). There it links cc_lib into the rlib through a BuildInfo carrying -lstatic=/-Lnative= flags, and deliberately withholds cc_lib's libraries from its CcInfo so nothing downstream links them twice. transform_link_deps keeps only CcInfo, so routing it through 'link_deps' drops the objects and the binary fails to link. It also never warned, since BuildInfo already marks it as a Rust target.

Diff: 185 lines (+138 / -47) across 2 files Reviewer: krasimirgg Review duration: 13338m
All Vouch review confidence checks passed
Residual risk 0.14 = Change Risk (0.36) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.36 · 185 lines diff across 2 files
0.36
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
0.17
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
60%
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.313
Shallow Review Depth shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #4218"
general weight: 0.35
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 60.5% 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: 35.7% (MEDIUM) · Higher = larger blast radius
35.7%
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: 60.5% · Lower = rushed or shallow review
60.5%
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: 14.1% · Safe to merge
14.1%