Repository navigation
Description
Summary
Some Cargo features in the Rust workspace mirror C build options. CMake selects these features per platform. The Rust CI lanes build with --workspace, and Cargo unifies the features. The lanes therefore do not build the feature sets that CMake ships. This issue proposes a feature matrix lane and one workspace rule for third-party dependencies.
Related: #1873 (glob imports, fixed by #1956). This is the Cargo feature-matrix issue proposed there (comment 6368573706). It is a separate issue, because the tooling and the risk are different.
Problem
1. Feature sets that CMake ships are not built in CI
rust/libobs-rust/Cargo.toml:default = ["gio"],gio = ["obs-util/gio"].obs-util/giomirrorsGIO_FOUND(obsconfig.h).libobs/cmake/os-linux.cmake:82-84andlibobs/cmake/os-freebsd.cmake:77-79setNO_DEFAULT_FEATURESand addgioonly whenfind_package(Gio)finds it..github/workflows/build-project.yaml:1899runssoldr cargo test --workspace --locked..github/workflows/build-project.yaml:1902runssoldr cargo clippy --locked --workspace --all-targets -- -D warnings.- In both runs,
cargo tree --workspace -e features -i obs-utilshowsobs-util feature "gio"enabled (from thelibobs-rustdefault features). Checked on master 6891f69.
Result: the #[cfg(not(feature = "gio"))] code in rust/obs-util/src/ffi/platform_nix_inhibit.rs is not compiled, linted or tested by the Rust lanes. A libobs built without GIO ships this code.
The same risk applies in the other direction to opt-in features. They are off in the --workspace lanes:
| Crate | Feature | In --workspace lanes |
Other check found |
|---|---|---|---|
libobs-rust / obs-util |
gio |
always on | none for "off" (CMake build without Gio only) |
obs-studio-rust → obs-build |
libobs-integration |
off | a few tests on macOS/Windows: rust-tests Qt SDK step (build-project.yaml:1952), Tier 2 (rust/tools/tier2-validate/validate.{sh,ps1}); no clippy |
obs-studio-rust → obs-sys |
bundled-native / bundled |
off | cargo check -p obs-sys --features bundled in Tier 2 macOS/Windows; no clippy (one-off clippy evidence: docs/ci-evidence/2026-10-18-test-binary-consolidation.json) |
No lane passes --no-default-features. The opt-in features are built only for a few tests on macOS/Windows (Tier 2, Qt SDK step); no clippy run uses them.
2. Third-party dependencies are declared per crate
[workspace.dependencies] contains only libloading ("=0.8.9"). All other third-party dependencies are declared in each crate. Versions and features differ between crates:
| Dependency | Declarations |
|---|---|
cc |
"1" (obs-c-oracle, obs-data, obs-util); "=1.6.0" + parallel (obs-build) |
pkg-config |
"=0.3.34" (obs-build, obs-studio-rust); "0.3" (obs-c-oracle, obs-util) |
serde |
"=1.0.229" (obs-build); "1.0.229" (obs-preflight) |
serde_json |
"=1.0.151" (obs-build); "1.0.151" (obs-preflight, obs-studio-rust) |
libc |
"0.2" (4 crates) |
proptest |
"1", default features (9 crates) |
Cargo.lock keeps the versions reproducible. The feature set of a dependency still depends on which crates are in the build. Some crates already disable default features (flate2, tungstenite, criterion). This is not a workspace rule.
Proposal
- Add a CI lane that builds the feature sets CMake uses:
- Run
cargo hack clippy --each-feature --all-targets(or--feature-powerset --depth 2) on the crates in the table above. - Or, as a minimum, on Linux:
cargo clippy -p libobs-rust --no-default-features --all-targets -- -D warningscargo test -p obs-util --no-default-featurescargo clippy -p obs-studio-rust --features libobs-integration,bundled-native --all-targets -- -D warnings
- Run
- Move all third-party dependencies to
[workspace.dependencies]:- Set
default-features = falsein the workspace table. - In each crate, use
dep = { workspace = true, features = [...] }. - Use one pin policy (
=or caret) for the whole workspace.libloadingalready uses=. - The workspace already has
[workspace.lints.clippy](lint: deny glob imports in the Rust workspace (#1873) #1956), so the sameworkspace = truepattern applies.
- Set
- Optional: enforce rule 2 with
cargo deny(bans, duplicates) or aci_lintrule (candidate for zackees/ci.yml, next to the RUST-019 proposal in lint: ban glob imports (clippy::wildcard_imports) with explicit opt-out #1873).
Limitations
cargo hack --feature-powersetgrows exponentially. Limit it to the crates with C-mirroring features.- Step 2 changes many
Cargo.tomlfiles. It does not change the resolved versions if the pins stay the same. Check withcargo treebefore and after. - I did not build the
gio-off path. I do not claim that it fails today. The issue is that CI does not check it.
Verification (for the RED/GREEN PR)
- RED: add the matrix lane. Show that
-p libobs-rust --no-default-featuresis not in any current lane (lane log). - GREEN: the lane passes on Linux and FreeBSD (or Linux only, with FreeBSD as a follow-up).
- For step 2:
cargo tree --workspace -e featuresoutput is the same before and after, except for intended changes.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
vpacher commentedon Oct 24, 2026
Claiming: #2056
Plan (two PRs, in this order):
-p libobs-rust --no-default-featuresand the opt-in feature sets are not built in any current lane. Then GREEN: the lane runs on Linux, with the minimum commands from the proposal (orcargo hack --each-featureon the crates in the table). FreeBSD can follow.[workspace.dependencies](proposal 2): move the third-party dependencies, withdefault-features = falsein the workspace table and one pin policy.cargo tree --workspace -e featuresbefore and after goes in the PR.Proposal 3 (
cargo denyor aci_lintrule) waits until 1 and 2 are merged.vpacher commentedon Oct 24, 2026
Correction: the opt-in features do run in CI, for a few tests:
libobs-integrationin therust-testsQt SDK step (build-project.yaml:1952) and in Tier 2 macOS/Windows (validate.sh/validate.ps1, withobs-sys --features bundled). No clippy run uses them, and nothing buildsgiooff. I updated the table in the description.build: Declare every third-party dependency in [workspace.dependencie…
ci: Lint and test the Cargo feature sets that --workspace does not bu…
vpacher commentedon Oct 24, 2026
Both parts are merged:
--workspacedoes not build (FEATURE_SETSinci/local_gate.py), the rust-test lane testsobs-utilwithgiooff, andcheck_feature_sets()fails when a workspace feature is not built both on and off by some clippy run.[workspace.dependencies](exact pins,default-features = false), andci/test_workspace_dependencies.pykeeps it that way.Proposal 3 (
cargo denyor aci_lintrule in zackees/ci.yml) is not done; the repository test covers the rule for now. From my side this issue is complete.vpacher commentedon Oct 25, 2026
Done: #2059 adds the lane that lints and tests the Cargo feature sets CMake uses (proposal 1), and #2061 moves every third-party dependency to
[workspace.dependencies](proposal 2). Both merged on 2026-10-24. The optional enforcement (proposal 3,cargo denyor aci_lintrule) is not done; it can get its own issue if wanted.