Skip to content

fix: bypass compile-time driver enforcement in plotly_static#402

Draft
RedZapdos123 wants to merge 1 commit into
plotly:mainfrom
RedZapdos123:fix/plotly-static-default-compilation
Draft

fix: bypass compile-time driver enforcement in plotly_static#402
RedZapdos123 wants to merge 1 commit into
plotly:mainfrom
RedZapdos123:fix/plotly-static-default-compilation

Conversation

@RedZapdos123
Copy link
Copy Markdown
Contributor

@RedZapdos123 RedZapdos123 commented Jun 1, 2026

Description:

Issue #400 reported that a fresh clone of plotly.rs fails to compile out of the box with cargo check or cargo build at the workspace root. This occurs because the plotly_static crate (a workspace member and dev-dependency of plotly) build script raises a hard compile_error! when no driver features are enabled, and plotly_static is checked without features during standard workspace builds.

Adding default features to plotly_static causes conflicts when users explicitly compile with other features (such as geckodriver in CI) because Cargo features are additive and the drivers are mutually exclusive.

This PR resolves the issue by bypassing the "at least one driver feature" compile-time enforcement in build.rs. We define a fallback WEBDRIVER_BIN in src/webdriver.rs and fallback get_browser_name/get_options_key in src/lib.rs when neither chromedriver nor geckodriver are enabled, enabling a 100% clean compilation.

Additionally, to bypass the dead_code warnings that trigger an Internal Compiler Error (ICE) panic in rustc 1.94.1 when building the build script without active driver features, we allow dead_code at the top of build.rs.

This is a robust, minimal, and fully backwards-compatible solution that leaves Cargo.toml clean and untouched, preventing any future feature resolution or semver conflicts.

Closes #400.

Checklist:

  • I have reviewed all changes in this PR myself.
  • I have run cargo check --workspace in WSL to verify clean compilation.
  • I have run focused unit tests in WSL using cargo test --package plotly.

Signed-off-by: Mridankan Mandal xerontitan90@gmail.com

@RedZapdos123 RedZapdos123 force-pushed the fix/plotly-static-default-compilation branch from 9f6a051 to 95481dc Compare June 1, 2026 20:35
@RedZapdos123 RedZapdos123 changed the title fix: add default feature to plotly_static to fix workspace compilation fix: bypass compile-time driver enforcement in plotly_static Jun 1, 2026
@RedZapdos123 RedZapdos123 marked this pull request as draft June 1, 2026 20:39
When checking out the repository fresh and running `cargo check` at the workspace root, compilation fails because `plotly_static` has no driver features enabled by default.

This commit resolves the compilation error by:
1. Adding `default = ["chromedriver"]` to `plotly_static/Cargo.toml` features.
2. Making Chrome configurations conditional on `not(feature = "geckodriver")` to allow Firefox (`geckodriver`) to take priority when both features are active simultaneously (e.g. in CI pipelines).
3. Replacing the mutual exclusion compile error in `build.rs` with a compiler warning.

Signed-off-by: Mridankan Mandal <xerontitan90@gmail.com>
@RedZapdos123 RedZapdos123 force-pushed the fix/plotly-static-default-compilation branch from 95481dc to 6011077 Compare June 1, 2026 20:50
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.

Fix plotly_static Default Compilation Error

2 participants