Add support for Rust ABI dynamic libraries #4179
All Vouch review confidence checks passed
Residual risk 0.15 = Change Risk (0.36) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.36 · 179 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 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.311
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #4179"
general
weight: 0.35
krasimirgg
Currently, there is not explicit stable Rust ABI for dynamic libraries, but Rust library may still be compiled as one. This can be useful if a large project wants to compile some core portion of its code as a shared object that can be dynamically linked against several different binaries. Bevy, for example, offers this capability as a way to allow customers of Bevy to tweak their own code without having to statically re-link the central Bevy engine code.
This PR exposes the Rust ABI dylib capabilities with a new rule,
rust_dylib_library. For clarity, it also creates arust_cylib_libraryrule, and updates methods to this name, withrust_shared_libraryjust aliasing to therust_cdylib_libraryimplementation.Building a Rust ABI dylib may cause the standard library to be linked dynamically against the generated dylib. When depended on, the dynamic standard library needs to be included to get the binary to execute. Currently,
rules_rustoffers this as a toolchain-level flag, but applying a toolchain transition at the dylib's interface imposes a new toolchain on its deps, which then forces any upstreamrlibs, for example, to recompile.To fix this, this PR exposes a
link_std_dylibattr torust_binary,rust_dylib_libraryandrust_testto allow these targets to optionally bundle themselves with the dynamically-linked stdlib.closes https://github.com/bazelbuild/rules_rust/pull/4179