emilk / emilk/egui

`egui_extras` with `http` feature no longer compiles on wasm32 with atomics

Open
#8,401 3 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Rust
Stars
30.6k
Forks
2.1k
Avg merge
1d 9h
Merged PRs (30d)
72

Description

### Description

Following compile command errors since 0.36.0:

```
RUSTFLAGS="-C target-feature=+atomics" cargo +nightly check --package egui_extras --no-default-features --features http --target wasm32-unknown-unknown -Z build-std=std,panic_abort
```

```
error[E0277]: `(dyn DroppedFile + 'static)` cannot be shared between threads safely
--> crates/egui_extras/src/loaders/http_loader.rs:104:17
|
99 | ehttp::fetch(
| ------------ required by a bound introduced by this call
...
104 | / {
105 | | let ctx = ctx.clone();
106 | | let cache = Arc::clone(&self.cache);
107 | |/ move |response| {
108 | || let result = match response {
109 | || Ok(response) => File::from_response(&uri, response),
110 | || Err(err) => {
... ||
137 | || }
| ||_____________________- this tail expression is of type `{closure@http_loader.rs:107:21}`
138 | | },
| |__________________^ `(dyn DroppedFile + 'static)` cannot be shared between threads safely
|
= help: the trait `Sync` is not implemented for `(dyn DroppedFile + 'static)`
= note: required for `Arc<(dyn DroppedFile + 'static)>` to implement `Send`
```

### Root cause

PR https://github.com/emilk/egui/pull/8354 made `DroppedFile` not have `Send` and `Sync` on wasm32+atomics:

https://github.com/emilk/egui/blob/46ba6405bf5c550041f14b8817f9c16e58a446e7/crates/egui/src/data/input/dropped_file.rs#L42-L51

Contributor guide

Open the contributing guide

Research direction

Start with crates/egui_extras/src/loaders/http_loader.rs around the ehttp::fetch callback, then inspect crates/egui/src/data/input/dropped_file.rs at the referenced bounds. Reproduce the failure with the provided cargo check command and verify that egui_extras with the http feature compiles for wasm32 with atomics.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, wasm
Domain
frontend, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.