diff --git a/.travis.yml b/.travis.yml index bfd64e01..8144c973 100644 --- a/.travis.yml +++ b/.travis.yml @@ -56,6 +56,7 @@ matrix: - cargo test # Run the main body of the test suite - cargo test --target wasm32-unknown-unknown + - cargo test --target wasm32-unknown-unknown --features nightly # Rerun the test suite but disable `--debug` in generated JS - WASM_BINDGEN_NO_DEBUG=1 cargo test --target wasm32-unknown-unknown # Make sure our serde tests work diff --git a/Cargo.toml b/Cargo.toml index 330a4ce3..724964e3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,6 +21,7 @@ default = ["spans", "std"] spans = ["wasm-bindgen-macro/spans"] std = [] serde-serialize = ["serde", "serde_json", "std"] +nightly = [] # This is only for debugging wasm-bindgen! No stability guarantees, so enable # this at your own peril! diff --git a/examples/closures/Cargo.toml b/examples/closures/Cargo.toml index ce6e6da6..e33f3ac8 100644 --- a/examples/closures/Cargo.toml +++ b/examples/closures/Cargo.toml @@ -7,5 +7,5 @@ authors = ["Alex Crichton "] crate-type = ["cdylib"] [dependencies] -wasm-bindgen = { path = "../.." } +wasm-bindgen = { path = "../..", features = ['nightly'] } js-sys = { path = "../../crates/js-sys" } diff --git a/src/closure.rs b/src/closure.rs index b2afd680..633d35b1 100644 --- a/src/closure.rs +++ b/src/closure.rs @@ -7,6 +7,7 @@ #![allow(const_err)] // FIXME(rust-lang/rust#52603) use std::cell::UnsafeCell; +#[cfg(feature = "nightly")] use std::marker::Unsize; use std::mem::{self, ManuallyDrop}; use std::prelude::v1::*; @@ -90,6 +91,7 @@ impl Closure /// /// This is unfortunately pretty restrictive for now but hopefully some of /// these restrictions can be lifted in the future! + #[cfg(feature = "nightly")] pub fn new(t: F) -> Closure where F: Unsize + 'static { diff --git a/src/lib.rs b/src/lib.rs index 90d6b5a2..7c9ce9f9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -5,9 +5,9 @@ //! this crate and this crate also provides JS bindings through the `JsValue` //! interface. -#![feature(unsize)] #![no_std] #![doc(html_root_url = "https://docs.rs/wasm-bindgen/0.2")] +#![cfg_attr(feature = "nightly", feature(unsize))] #[cfg(feature = "serde-serialize")] extern crate serde; diff --git a/tests/wasm/closures.rs b/tests/wasm/closures.rs index 84794725..0b896a7e 100644 --- a/tests/wasm/closures.rs +++ b/tests/wasm/closures.rs @@ -1,3 +1,5 @@ +#![cfg(feature = "nightly")] + use wasm_bindgen_test::*; use wasm_bindgen::prelude::*; use std::cell::Cell;