Skip to content

async std unstable feature compiles wasm crates on non-wasm arch #823

Closed
@jbr

Description

@jbr
Contributor

Versions:

My platform:x86_64-apple-darwin
Async-std version: 1.6.2
rust version: both rustc 1.44.1 (c7087fe00 2020-06-17) and rustc 1.46.0-nightly (a8cf39911 2020-06-21)

Issue:

This line

futures-timer = { version = "3.0.2", optional = true, features = ["wasm-bindgen"] }
activates if the unstable feature is enabled regardless of the target_arch. This means that crates that use the unstable feature such as http-rs/http-types and http-rs/tide have to compile web-sys and js-sys.

These are the changes to cargo tree --features unstable when commenting out that line, which shouldn't be activated on x86_64-apple-darwin. I don't assume that the fix is actually to comment this line out. Is this a cargo bug?

--- master
+++ without line 81
@@ -8,47 +8,9 @@
 ├── futures-core v0.3.5
 ├── futures-io v0.3.5
 ├── futures-timer v3.0.2
-│   ├── gloo-timers v0.2.1
-│   │   ├── futures-channel v0.3.5
-│   │   │   ├── futures-core v0.3.5
-│   │   │   └── futures-sink v0.3.5
-│   │   ├── futures-core v0.3.5
-│   │   ├── js-sys v0.3.40
-│   │   │   └── wasm-bindgen v0.2.63
-│   │   │       ├── cfg-if v0.1.10
-│   │   │       ├── serde v1.0.114
-│   │   │       ├── serde_json v1.0.55
-│   │   │       │   ├── itoa v0.4.6
-│   │   │       │   ├── ryu v1.0.5
-│   │   │       │   └── serde v1.0.114
-│   │   │       └── wasm-bindgen-macro v0.2.63
-│   │   │           ├── quote v1.0.7
-│   │   │           │   └── proc-macro2 v1.0.18
-│   │   │           │       └── unicode-xid v0.2.0
-│   │   │           └── wasm-bindgen-macro-support v0.2.63
-│   │   │               ├── proc-macro2 v1.0.18 (*)
-│   │   │               ├── quote v1.0.7 (*)
-│   │   │               ├── syn v1.0.33
-│   │   │               │   ├── proc-macro2 v1.0.18 (*)
-│   │   │               │   ├── quote v1.0.7 (*)
-│   │   │               │   └── unicode-xid v0.2.0
-│   │   │               ├── wasm-bindgen-backend v0.2.63
-│   │   │               │   ├── bumpalo v3.4.0
-│   │   │               │   ├── lazy_static v1.4.0
-│   │   │               │   ├── log v0.4.8
-│   │   │               │   │   └── cfg-if v0.1.10
-│   │   │               │   ├── proc-macro2 v1.0.18 (*)
-│   │   │               │   ├── quote v1.0.7 (*)
-│   │   │               │   ├── syn v1.0.33 (*)
-│   │   │               │   └── wasm-bindgen-shared v0.2.63
-│   │   │               └── wasm-bindgen-shared v0.2.63
-│   │   ├── wasm-bindgen v0.2.63 (*)
-│   │   └── web-sys v0.3.40
-│   │       ├── js-sys v0.3.40 (*)
-│   │       └── wasm-bindgen v0.2.63 (*)
-│   └── send_wrapper v0.4.0
 ├── kv-log-macro v1.0.6
-│   └── log v0.4.8 (*)
+│   └── log v0.4.8
+│       └── cfg-if v0.1.10
 ├── log v0.4.8 (*)
 ├── memchr v2.3.3
 ├── num_cpus v1.13.0
@@ -60,16 +22,23 @@
 └── smol v0.1.18
     ├── async-task v3.0.0
     ├── blocking v0.4.6
-    │   ├── futures-channel v0.3.5 (*)
+    │   ├── futures-channel v0.3.5
+    │   │   ├── futures-core v0.3.5
+    │   │   └── futures-sink v0.3.5
     │   ├── futures-util v0.3.5
     │   │   ├── futures-channel v0.3.5 (*)
     │   │   ├── futures-core v0.3.5
     │   │   ├── futures-io v0.3.5
     │   │   ├── futures-macro v0.3.5
     │   │   │   ├── proc-macro-hack v0.5.16
-    │   │   │   ├── proc-macro2 v1.0.18 (*)
-    │   │   │   ├── quote v1.0.7 (*)
-    │   │   │   └── syn v1.0.33 (*)
+    │   │   │   ├── proc-macro2 v1.0.18
+    │   │   │   │   └── unicode-xid v0.2.0
+    │   │   │   ├── quote v1.0.7
+    │   │   │   │   └── proc-macro2 v1.0.18 (*)
+    │   │   │   └── syn v1.0.33
+    │   │   │       ├── proc-macro2 v1.0.18 (*)
+    │   │   │       ├── quote v1.0.7 (*)
+    │   │   │       └── unicode-xid v0.2.0
     │   │   ├── futures-sink v0.3.5
     │   │   ├── futures-task v0.3.5
     │   │   │   └── once_cell v1.4.0
@@ -154,7 +123,10 @@
 │   │   ├── proc-macro2 v1.0.18 (*)
 │   │   ├── quote v1.0.7 (*)
 │   │   └── syn v1.0.33 (*)
-│   └── serde_json v1.0.55 (*)
+│   └── serde_json v1.0.55
+│       ├── itoa v0.4.6
+│       ├── ryu v1.0.5
+│       └── serde v1.0.114
 ├── futures v0.3.5
 │   ├── futures-channel v0.3.5 (*)
 │   ├── futures-core v0.3.5

Activity

Fishrock123

Fishrock123 commented on Jul 15, 2020

@Fishrock123
Member

Since smol/async-io has its own timers implementation, do we really need futures-timer? Or can we only pull it in for wasm timers?

dignifiedquire

dignifiedquire commented on Jul 16, 2020

@dignifiedquire
Member

we pull it in if we don’t have smol as runtime activated. unfortunately the flags are not perfect so it currently doesn‘t quite work out. we might be able to improve on this with the latest smol refactors

nickpelone

nickpelone commented on Aug 12, 2020

@nickpelone

Gentle +1, it would be great to not have to chew through all those crates if we are not targeting wasm. (especially on my platform(OpenBSD) where rustc is still weirdly really, really, slow, like, even more so than in other places)

dignifiedquire

dignifiedquire commented on Sep 16, 2020

@dignifiedquire
Member

should be fixed on master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @jbr@dignifiedquire@Fishrock123@nickpelone

      Issue actions

        async std unstable feature compiles wasm crates on non-wasm arch · Issue #823 · async-rs/async-std