Move the unsize feature behind a nightly Cargo feature

This should fully stabilize the `wasm-bindgen` crate, preparing us for stable
Rust!
This commit is contained in:
Alex Crichton 2018-08-19 14:45:59 -07:00
parent 305ecb7910
commit 4c1bf937f2
6 changed files with 8 additions and 2 deletions

View File

@ -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

View File

@ -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!

View File

@ -7,5 +7,5 @@ authors = ["Alex Crichton <alex@alexcrichton.com>"]
crate-type = ["cdylib"]
[dependencies]
wasm-bindgen = { path = "../.." }
wasm-bindgen = { path = "../..", features = ['nightly'] }
js-sys = { path = "../../crates/js-sys" }

View File

@ -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<T> Closure<T>
///
/// 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<F>(t: F) -> Closure<T>
where F: Unsize<T> + 'static
{

View File

@ -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;

View File

@ -1,3 +1,5 @@
#![cfg(feature = "nightly")]
use wasm_bindgen_test::*;
use wasm_bindgen::prelude::*;
use std::cell::Cell;