Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

web-sys 0.3.70 breaking change in unstable Clipboard API causes compilation failure with wgpu backend #158

Closed
BGR360 opened this issue Sep 2, 2024 · 0 comments · Fixed by #159

Comments

@BGR360
Copy link
Contributor

BGR360 commented Sep 2, 2024

Repro steps

Clone the template and apply the following change:

--- a/Cargo.toml
+++ b/Cargo.toml
@@ -15,7 +15,7 @@ egui = "0.28"
 eframe = { version = "0.28", default-features = false, features = [
     "accesskit",     # Make egui compatible with screen readers. NOTE: adds a lot of dependencies.
     "default_fonts", # Embed the default egui fonts.
-    "glow",          # Use the glow rendering backend. Alternative: "wgpu".
+    "wgpu",          # Use the glow rendering backend. Alternative: "wgpu".
     "persistence",   # Enable restoring app state when restarting the app.
 ] }
 log = "0.4"

Regenerate Cargo.lock and compile for web:

$ rm Cargo.lock
$ trunk serve
<...>
2024-09-02T05:27:37.357232Z  INFO 📦 starting build
    Blocking waiting for file lock on build directory
   Compiling eframe v0.28.1
error[E0308]: mismatched types
   --> /Users/ben/.cargo/registry/src/index.crates.io-6f17d22bba15001f/eframe-0.28.1/src/web/mod.rs:187:16
    |
187 |         if let Some(clipboard) = window.navigator().clipboard() {
    |                ^^^^^^^^^^^^^^^   ------------------------------ this expression has type `Clipboard`
    |                |
    |                expected `Clipboard`, found `Option<_>`
    |
    = note: expected struct `Clipboard`
                 found enum `std::option::Option<_>`

For more information about this error, try `rustc --explain E0308`.
error: could not compile `eframe` (lib) due to 1 previous error
2024-09-02T05:27:46.561988Z ERROR ❌ error
error from build pipeline

Caused by:
    0: HTML build pipeline failed (1 errors), showing first
    1: error from asset pipeline
    2: running cargo build
    3: error during cargo build execution
    4: cargo call to executable 'cargo' with args: '["build", "--target=wasm32-unknown-unknown", "--manifest-path", "/Users/ben/Documents/Fractals/eframe_template/Cargo.toml"]' returned a bad status: exit status: 101

This has been fixed in eframe on mainline, but not yet released as a new patch version: emilk/egui#4980

I'll send a PR for a stopgap solution until a new eframe is released.

BGR360 added a commit to BGR360/eframe_template that referenced this issue Sep 2, 2024
@emilk emilk closed this as completed in #159 Sep 2, 2024
@emilk emilk closed this as completed in 5056822 Sep 2, 2024
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 a pull request may close this issue.

1 participant