Skip to content

test(platform): catch a platform-only dependency used from other-platform code - #979

Merged
kirillDevPro merged 1 commit into
mainfrom
test/platform-deps
Oct 14, 2026
Merged

kirillDevPro merged 1 commit into
mainfrom
test/platform-deps

Conversation

@kirillDevPro

Copy link
Copy Markdown
Collaborator

What & why

raw-window-handle was declared only for Windows while macOS-only code (panels/chart/shot/mac.rs) used it. Windows CI stayed green and the macOS release build failed with E0433 (fixed in #978).

This adds a source-text contract to theme_contract that runs in a plain cargo test on any host: it walks the real module tree and its #[cfg(...)] gates and fails when gated code references an external crate that Cargo.toml does not make available for that target. The message names the file, the crate and the table to add it to.

How to verify

  • cargo test -p moon-ui-gpui --test theme_contract passes on the current tree.
  • Deleting the macOS raw-window-handle line makes platform_dependencies_cover_reachable_source fail naming shot/mac.rs and raw_window_handle; restoring it turns it green.

@kirillDevPro
kirillDevPro merged commit fbad9b3 into main Oct 14, 2026
10 checks passed
@kirillDevPro
kirillDevPro deleted the test/platform-deps branch October 14, 2026 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant