Repository navigation
rust: Enforce a platform boundary with a pre-expansion Dylint - #326
Merged
Merged
Conversation
Adapted from soldr's ban_platform_cfg_outside_boundary. It runs pre-expansion in the lint lane and fails on the host cfgs and native OS paths still in the obs-util and obs-media-io safe cores. Refs #323
The pipe halves, the Windows utf8 converter, the C long width, byte paths, the config BOM, the semaphore choice and the MSVC mul_div64 flag now live under src/platform, the crate's only host-selection site. threading::Sem now exists on Windows too (the condvar stand-in task.rs used privately). Refs #323
Refs #323 Local-Gate: v1 tree=ef667340e41b91cc5fb2d97b781b25f98134b6ee secs=110 lanes=lint:run,rust-test:run,tier2-linux:run Ci-Attestation: {"at":1791784150,"gate":"rust/all/fmt","host":"linux-x86_64","key":"317498caa319f844c383de782b0dc9d43088f1db278ecbd2846f005c298cdbcd","lane":"lint","parents":["f0d4e4851348907fcbbd0731243215230c4c0c42"],"secs":14,"stamp":"f84de5c26bf5aa2db6b7db28bb91f330","tree":"ef667340e41b91cc5fb2d97b781b25f98134b6ee","v":1,"via":"run"} Ci-Attestation: {"at":1791784150,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"317498caa319f844c383de782b0dc9d43088f1db278ecbd2846f005c298cdbcd","lane":"lint","parents":["f0d4e4851348907fcbbd0731243215230c4c0c42"],"secs":14,"stamp":"b77de7b88de75f10fd79bae5ad664875","tree":"ef667340e41b91cc5fb2d97b781b25f98134b6ee","v":1,"via":"run"} Ci-Attestation: {"at":1791784150,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"485f75dd7520844008281b6430a1dd56b3af522807821b2429a12dfd12a21eb3","lane":"rust-test","parents":["f0d4e4851348907fcbbd0731243215230c4c0c42"],"secs":41,"stamp":"63fce29ecfba8786cce599ae61a809c1","tree":"ef667340e41b91cc5fb2d97b781b25f98134b6ee","v":1,"via":"run"} Ci-Attestation: {"at":1791784150,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"d7c0a64000b411e1e0a7ce946adfce646ffa2fc331f6b4843c026ef183eb85b5","lane":"tier2-linux","parents":["f0d4e4851348907fcbbd0731243215230c4c0c42"],"secs":54,"stamp":"12728efe758c2c3bc8e0af89a330253b","tree":"ef667340e41b91cc5fb2d97b781b25f98134b6ee","v":1,"via":"run"}
--all-targets type-checks obs-stream-rust's integration test, which needs CARGO_BIN_EXE_obs-stream-rust from a real build. The lint scans whole src/ files, inline test modules included, so lib + bins is its full scope. Refs #323 Local-Gate: v1 tree=61aee07a90c30426e583cb2cc965ed80a124ef0f secs=126 lanes=lint:run,rust-test:run,tier2-linux:run Ci-Attestation: {"at":1791784732,"gate":"rust/all/fmt","host":"linux-x86_64","key":"8c9cffba4aebed81f5a67007d18c051a49826f73a37cd7099e14e00abb1f979d","lane":"lint","parents":["bc324ec755c232937b80cbf2387520c7c407b656"],"secs":27,"stamp":"d7705ac7e033156e3de4d6e688328593","tree":"61aee07a90c30426e583cb2cc965ed80a124ef0f","v":1,"via":"run"} Ci-Attestation: {"at":1791784732,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"8c9cffba4aebed81f5a67007d18c051a49826f73a37cd7099e14e00abb1f979d","lane":"lint","parents":["bc324ec755c232937b80cbf2387520c7c407b656"],"secs":27,"stamp":"912c064824e6cf2d6ba7a905918810c5","tree":"61aee07a90c30426e583cb2cc965ed80a124ef0f","v":1,"via":"run"} Ci-Attestation: {"at":1791784732,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"0b190216e17b440c901f7652f3adfc37e642c8119ff7228e33681e3392396ecb","lane":"rust-test","parents":["bc324ec755c232937b80cbf2387520c7c407b656"],"secs":44,"stamp":"ef266402b2647ac8816e5d688f029e9f","tree":"61aee07a90c30426e583cb2cc965ed80a124ef0f","v":1,"via":"run"} Ci-Attestation: {"at":1791784732,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"5fc2dd63be6ea75927095cf4814ac17dd7249aae08b5b3968ff2545964ffb46d","lane":"tier2-linux","parents":["bc324ec755c232937b80cbf2387520c7c407b656"],"secs":55,"stamp":"a7cc93e27ed66fe05ed63c0e5ddaebfd","tree":"61aee07a90c30426e583cb2cc965ed80a124ef0f","v":1,"via":"run"}
This was referenced Oct 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #323. Part of #297.
Ports the soldr/zccache/fbuild platform-boundary pattern:
dylints/ban_platform_cfg_outside_boundary(adapted from soldr) runs in the./lintlane before cfg expansion. Outside each crate'ssrc/platform/andsrc/ffi/, it rejects host#[cfg]/cfg!()andstd::os::*/libc::/Win32 paths. Code compiled out on Linux is checked too, so the Linux lint lane covers every OS (deny(unsafe_code)and clippy could not see#[cfg(windows)]code).CLong, byte paths, the config BOM, theSemchoice and the MSVCmul_div64flag move intosrc/platform/{mod.rs,unix/,windows/}.threading::Semnow also exists on Windows (the condvar stand-in task.rs already used). Tests now importobs_util::platform::windows::utf8.platform::RecursiveMutex. The Unix-onlyaudio-io.cport moves toaudio_io/port.rsbehindplatform::with_audio_thread_port!. Its remainingunsafeis still rust/obs-media-io: move audio_io.rs unsafe out of the safe core into src/ffi #294.Local:
./lint, rust-test and tier2-linux all pass (stamped).clippy --libis clean forx86_64-pc-windows-msvcandaarch64-apple-darwin.