Skip to content
This repository was archived by the owner on Oct 30, 2019. It is now read-only.

Commit e6d4fc6

Browse files
Nemo157yoshuawuyts
authored andcommitted
Fix wasm build (#96)
* Fix errors and warnings for wasm build * Add CI build for wasm
1 parent 6edd9c9 commit e6d4fc6

File tree

3 files changed

+17
-8
lines changed

3 files changed

+17
-8
lines changed

azure-pipelines.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,19 @@ jobs:
1818
export RUST_BACKTRACE=1
1919
cargo test --all || exit
2020
displayName: "Run cargo test"
21+
- job: wasm
22+
pool:
23+
vmImage: 'ubuntu-16.04'
24+
displayName: "build --target wasm32-unknown-unknown"
25+
steps:
26+
- template: ci/install-rust.yml
27+
parameters:
28+
rust_version: nightly
29+
- bash: |
30+
export RUST_BACKTRACE=1
31+
rustup target add wasm32-unknown-unknown
32+
cargo build --target wasm32-unknown-unknown
33+
displayName: "Run cargo build --target wasm32-unknown-unknown"
2134
- job: check_benches
2235
pool:
2336
vmImage: 'ubuntu-16.04'

runtime-native/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
rust_2018_idioms
1010
)]
1111

12-
#[cfg(all(feature = "wasm-bindgen", target_arch = "wasm32"))]
12+
#[cfg(target_arch = "wasm32")]
1313
mod wasm32;
14-
#[cfg(all(feature = "wasm-bindgen", target_arch = "wasm32"))]
14+
#[cfg(target_arch = "wasm32")]
1515
pub use wasm32::Native;
1616

17-
#[cfg(not(all(feature = "wasm-bindgen", target_arch = "wasm32")))]
17+
#[cfg(not(target_arch = "wasm32"))]
1818
mod not_wasm32;
19-
#[cfg(not(all(feature = "wasm-bindgen", target_arch = "wasm32")))]
19+
#[cfg(not(target_arch = "wasm32"))]
2020
pub use not_wasm32::Native;

runtime-native/src/wasm32.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,12 @@ use std::net::SocketAddr;
77
use std::pin::Pin;
88
use std::time::{Duration, Instant};
99

10-
use wasm_bindgen::prelude::*;
11-
use wasm_bindgen_futures::future_to_promise;
12-
1310
/// The Native runtime.
1411
#[derive(Debug)]
1512
pub struct Native;
1613

1714
impl runtime_raw::Runtime for Native {
1815
fn spawn_boxed(&self, fut: BoxFuture<'static, ()>) -> Result<(), SpawnError> {
19-
use futures01::future::Future;
2016
let fut = fut.unit_error().compat();
2117
wasm_bindgen_futures::spawn_local(fut);
2218
Ok(())

0 commit comments

Comments
 (0)