From d4297ad2d391aa93c685127616c46adfd1987f8a Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Sun, 19 Aug 2018 14:31:35 -0700 Subject: [PATCH 1/3] Remove `use_extern_macros` features This has now been stabilized! --- README.md | 2 - crates/futures/src/lib.rs | 3 - crates/futures/tests/tests.rs | 1 - crates/js-sys/src/lib.rs | 1 - crates/js-sys/tests/headless.rs | 1 - crates/js-sys/tests/wasm/main.rs | 1 - .../ui-tests/attribute-fails-to-parse.rs | 2 - .../ui-tests/attribute-fails-to-parse.stderr | 4 +- crates/macro/ui-tests/bad-signatures.rs | 2 - crates/macro/ui-tests/bad-signatures.stderr | 12 +-- crates/macro/ui-tests/invalid-attr.rs | 2 - crates/macro/ui-tests/invalid-attr.stderr | 12 +-- crates/macro/ui-tests/invalid-enums.rs | 2 - crates/macro/ui-tests/invalid-enums.stderr | 16 ++-- crates/macro/ui-tests/invalid-imports.rs | 2 - crates/macro/ui-tests/invalid-imports.stderr | 76 +++++++++---------- crates/macro/ui-tests/invalid-items.rs | 2 - crates/macro/ui-tests/invalid-items.stderr | 54 ++++++------- crates/macro/ui-tests/invalid-methods.rs | 2 - crates/macro/ui-tests/invalid-methods.stderr | 44 +++++------ crates/macro/ui-tests/non-public-function.rs | 2 - .../macro/ui-tests/non-public-function.stderr | 4 +- crates/test/README.md | 2 - crates/test/sample/src/lib.rs | 2 - crates/test/sample/tests/browser.rs | 2 - crates/test/sample/tests/node.rs | 2 - crates/test/src/lib.rs | 1 - crates/web-sys/tests/wasm/main.rs | 1 - crates/webidl-tests/main.rs | 2 - examples/add/src/lib.rs | 2 - examples/asm.js/src/lib.rs | 2 - examples/canvas/src/lib.rs | 2 - examples/char/src/lib.rs | 2 - examples/closures/src/lib.rs | 2 - examples/comments/src/lib.rs | 2 - examples/console_log/src/lib.rs | 2 - examples/dom/src/lib.rs | 2 - .../guide-supported-types-examples/src/lib.rs | 1 - examples/hello_world/src/lib.rs | 2 - examples/import_js/src/lib.rs | 2 - examples/julia_set/src/lib.rs | 2 - examples/math/src/lib.rs | 2 - examples/no_modules/src/lib.rs | 2 - examples/performance/src/lib.rs | 2 - examples/smorgasboard/src/lib.rs | 2 - examples/wasm-in-wasm/src/lib.rs | 2 - examples/webaudio/src/lib.rs | 4 +- guide/src/whirlwind-tour/basic-usage.md | 2 - .../src/whirlwind-tour/what-else-can-we-do.md | 2 - src/lib.rs | 2 +- tests/crates/a/src/lib.rs | 2 - tests/crates/b/src/lib.rs | 2 - tests/headless.rs | 1 - tests/no-std/test.rs | 1 - tests/non_wasm.rs | 2 - tests/std-crate-no-std-dep.rs | 1 - tests/wasm/main.rs | 1 - 57 files changed, 114 insertions(+), 198 deletions(-) diff --git a/README.md b/README.md index 5e8272297..85861127e 100644 --- a/README.md +++ b/README.md @@ -13,8 +13,6 @@ Import JavaScript things into Rust and export Rust things to JavaScript. ```rust -#![feature(use_extern_macros)] - extern crate wasm_bindgen; use wasm_bindgen::prelude::*; diff --git a/crates/futures/src/lib.rs b/crates/futures/src/lib.rs index 41bdd4e35..d8c672be3 100644 --- a/crates/futures/src/lib.rs +++ b/crates/futures/src/lib.rs @@ -33,8 +33,6 @@ //! `Promise`. //! //! ```rust,no_run -//! #![feature(use_extern_macros)] -//! //! extern crate futures; //! extern crate js_sys; //! extern crate wasm_bindgen; @@ -104,7 +102,6 @@ //! ``` #![deny(missing_docs)] -#![feature(use_extern_macros)] extern crate futures; extern crate wasm_bindgen; diff --git a/crates/futures/tests/tests.rs b/crates/futures/tests/tests.rs index a62257373..089003d5a 100755 --- a/crates/futures/tests/tests.rs +++ b/crates/futures/tests/tests.rs @@ -1,4 +1,3 @@ -#![feature(use_extern_macros)] #![cfg(target_arch = "wasm32")] extern crate futures; diff --git a/crates/js-sys/src/lib.rs b/crates/js-sys/src/lib.rs index 487fc095c..7c4dd569a 100644 --- a/crates/js-sys/src/lib.rs +++ b/crates/js-sys/src/lib.rs @@ -17,7 +17,6 @@ //! bindings. #![doc(html_root_url = "https://docs.rs/js-sys/0.2")] -#![feature(use_extern_macros)] extern crate wasm_bindgen; diff --git a/crates/js-sys/tests/headless.rs b/crates/js-sys/tests/headless.rs index 139c1358a..1b45ea7b6 100755 --- a/crates/js-sys/tests/headless.rs +++ b/crates/js-sys/tests/headless.rs @@ -1,4 +1,3 @@ -#![feature(use_extern_macros)] #![cfg(target_arch = "wasm32")] extern crate wasm_bindgen_test; diff --git a/crates/js-sys/tests/wasm/main.rs b/crates/js-sys/tests/wasm/main.rs index 36271531f..7cdcc54a3 100755 --- a/crates/js-sys/tests/wasm/main.rs +++ b/crates/js-sys/tests/wasm/main.rs @@ -1,5 +1,4 @@ #![cfg(target_arch = "wasm32")] -#![feature(use_extern_macros)] #![allow(non_snake_case)] extern crate js_sys; diff --git a/crates/macro/ui-tests/attribute-fails-to-parse.rs b/crates/macro/ui-tests/attribute-fails-to-parse.rs index 514876fae..d58395e97 100644 --- a/crates/macro/ui-tests/attribute-fails-to-parse.rs +++ b/crates/macro/ui-tests/attribute-fails-to-parse.rs @@ -1,5 +1,3 @@ -#![feature(use_extern_macros)] - extern crate wasm_bindgen; use wasm_bindgen::prelude::*; diff --git a/crates/macro/ui-tests/attribute-fails-to-parse.stderr b/crates/macro/ui-tests/attribute-fails-to-parse.stderr index dbe5f5d58..eb7960ebd 100644 --- a/crates/macro/ui-tests/attribute-fails-to-parse.stderr +++ b/crates/macro/ui-tests/attribute-fails-to-parse.stderr @@ -1,7 +1,7 @@ error: error parsing #[wasm_bindgen] attribute options: failed to parse anything - --> $DIR/attribute-fails-to-parse.rs:7:16 + --> $DIR/attribute-fails-to-parse.rs:5:16 | -7 | #[wasm_bindgen(nonsense)] +5 | #[wasm_bindgen(nonsense)] | ^^^^^^^^ error: aborting due to previous error diff --git a/crates/macro/ui-tests/bad-signatures.rs b/crates/macro/ui-tests/bad-signatures.rs index 7e4141494..561d909b2 100644 --- a/crates/macro/ui-tests/bad-signatures.rs +++ b/crates/macro/ui-tests/bad-signatures.rs @@ -1,5 +1,3 @@ -#![feature(use_extern_macros)] - extern crate wasm_bindgen; use wasm_bindgen::prelude::*; diff --git a/crates/macro/ui-tests/bad-signatures.stderr b/crates/macro/ui-tests/bad-signatures.stderr index 0a8466abc..b36e89474 100644 --- a/crates/macro/ui-tests/bad-signatures.stderr +++ b/crates/macro/ui-tests/bad-signatures.stderr @@ -1,19 +1,19 @@ error: cannot return a borrowed ref with #[wasm_bindgen] - --> $DIR/bad-signatures.rs:8:17 + --> $DIR/bad-signatures.rs:6:17 | -8 | pub fn foo() -> &u32 {} +6 | pub fn foo() -> &u32 {} | ^^^^ error: unsupported pattern in #[wasm_bindgen] imported function - --> $DIR/bad-signatures.rs:12:12 + --> $DIR/bad-signatures.rs:10:12 | -12 | fn foo(Foo(x): Foo); +10 | fn foo(Foo(x): Foo); | ^^^^^^ error: cannot return references in #[wasm_bindgen] imports yet - --> $DIR/bad-signatures.rs:14:17 + --> $DIR/bad-signatures.rs:12:17 | -14 | fn foo() -> &u32; +12 | fn foo() -> &u32; | ^^^^ error: aborting due to 3 previous errors diff --git a/crates/macro/ui-tests/invalid-attr.rs b/crates/macro/ui-tests/invalid-attr.rs index 74c95a971..9496c8a3e 100644 --- a/crates/macro/ui-tests/invalid-attr.rs +++ b/crates/macro/ui-tests/invalid-attr.rs @@ -1,5 +1,3 @@ -#![feature(use_extern_macros)] - extern crate wasm_bindgen; use wasm_bindgen::prelude::*; diff --git a/crates/macro/ui-tests/invalid-attr.stderr b/crates/macro/ui-tests/invalid-attr.stderr index a35479dad..ee918ec53 100644 --- a/crates/macro/ui-tests/invalid-attr.stderr +++ b/crates/macro/ui-tests/invalid-attr.stderr @@ -1,19 +1,19 @@ error: error parsing #[wasm_bindgen] attribute options: failed to parse anything - --> $DIR/invalid-attr.rs:7:16 + --> $DIR/invalid-attr.rs:5:16 | -7 | #[wasm_bindgen(x)] +5 | #[wasm_bindgen(x)] | ^ error: error parsing #[wasm_bindgen] attribute options: failed to parse anything - --> $DIR/invalid-attr.rs:12:20 + --> $DIR/invalid-attr.rs:10:20 | -12 | #[wasm_bindgen(y)] +10 | #[wasm_bindgen(y)] | ^ error: malformed #[wasm_bindgen] attribute - --> $DIR/invalid-attr.rs:15:5 + --> $DIR/invalid-attr.rs:13:5 | -15 | #[wasm_bindgen { }] +13 | #[wasm_bindgen { }] | ^^^^^^^^^^^^^^^^^^^^ error: aborting due to 3 previous errors diff --git a/crates/macro/ui-tests/invalid-enums.rs b/crates/macro/ui-tests/invalid-enums.rs index 44c983c09..1be6bbd01 100644 --- a/crates/macro/ui-tests/invalid-enums.rs +++ b/crates/macro/ui-tests/invalid-enums.rs @@ -1,5 +1,3 @@ -#![feature(use_extern_macros)] - extern crate wasm_bindgen; use wasm_bindgen::prelude::*; diff --git a/crates/macro/ui-tests/invalid-enums.stderr b/crates/macro/ui-tests/invalid-enums.stderr index 06da75701..96b117df1 100644 --- a/crates/macro/ui-tests/invalid-enums.stderr +++ b/crates/macro/ui-tests/invalid-enums.stderr @@ -1,25 +1,25 @@ error: only public enums are allowed with #[wasm_bindgen] - --> $DIR/invalid-enums.rs:8:1 + --> $DIR/invalid-enums.rs:6:1 | -8 | enum A {} +6 | enum A {} | ^^^^^^^^^ error: only C-Style enums allowed with #[wasm_bindgen] - --> $DIR/invalid-enums.rs:12:6 + --> $DIR/invalid-enums.rs:10:6 | -12 | D(u32), +10 | D(u32), | ^^^^^ error: enums with #[wasm_bidngen] may only have number literal values - --> $DIR/invalid-enums.rs:17:9 + --> $DIR/invalid-enums.rs:15:9 | -17 | X = 1 + 3, +15 | X = 1 + 3, | ^^^^^ error: enums with #[wasm_bindgen] can only support numbers that can be represented as u32 - --> $DIR/invalid-enums.rs:22:9 + --> $DIR/invalid-enums.rs:20:9 | -22 | X = 4294967296, +20 | X = 4294967296, | ^^^^^^^^^^ error: aborting due to 4 previous errors diff --git a/crates/macro/ui-tests/invalid-imports.rs b/crates/macro/ui-tests/invalid-imports.rs index 9ed8d84a1..969afb9ee 100644 --- a/crates/macro/ui-tests/invalid-imports.rs +++ b/crates/macro/ui-tests/invalid-imports.rs @@ -1,5 +1,3 @@ -#![feature(use_extern_macros)] - extern crate wasm_bindgen; use wasm_bindgen::prelude::*; diff --git a/crates/macro/ui-tests/invalid-imports.stderr b/crates/macro/ui-tests/invalid-imports.stderr index f2574c45b..2dd15706d 100644 --- a/crates/macro/ui-tests/invalid-imports.stderr +++ b/crates/macro/ui-tests/invalid-imports.stderr @@ -1,91 +1,91 @@ error: it is currently not sound to use lifetimes in function signatures - --> $DIR/invalid-imports.rs:11:16 - | -11 | fn f() -> &'static u32; - | ^^^^^^^ + --> $DIR/invalid-imports.rs:9:16 + | +9 | fn f() -> &'static u32; + | ^^^^^^^ error: imported methods must have at least one argument - --> $DIR/invalid-imports.rs:14:5 + --> $DIR/invalid-imports.rs:12:5 | -14 | fn f1(); +12 | fn f1(); | ^^^^^^^^ error: first argument of method must be a shared reference - --> $DIR/invalid-imports.rs:16:14 + --> $DIR/invalid-imports.rs:14:14 | -16 | fn f2(x: u32); +14 | fn f2(x: u32); | ^^^ error: first argument of method must be a path - --> $DIR/invalid-imports.rs:18:14 + --> $DIR/invalid-imports.rs:16:14 | -18 | fn f3(x: &&u32); +16 | fn f3(x: &&u32); | ^^^^^ error: multi-segment paths are not supported yet - --> $DIR/invalid-imports.rs:20:15 + --> $DIR/invalid-imports.rs:18:15 | -20 | fn f4(x: &foo::Bar); +18 | fn f4(x: &foo::Bar); | ^^^^^^^^ error: global paths are not supported yet + --> $DIR/invalid-imports.rs:20:15 + | +20 | fn f4(x: &::Bar); + | ^^^^^ + +error: paths with type parameters are not supported yet --> $DIR/invalid-imports.rs:22:15 | -22 | fn f4(x: &::Bar); - | ^^^^^ +22 | fn f4(x: &Bar); + | ^^^^^^ error: paths with type parameters are not supported yet --> $DIR/invalid-imports.rs:24:15 | -24 | fn f4(x: &Bar); - | ^^^^^^ - -error: paths with type parameters are not supported yet - --> $DIR/invalid-imports.rs:26:15 - | -26 | fn f4(x: &Fn(T)); +24 | fn f4(x: &Fn(T)); | ^^^^^ error: constructor returns must be bare types - --> $DIR/invalid-imports.rs:29:5 + --> $DIR/invalid-imports.rs:27:5 | -29 | fn f(); +27 | fn f(); | ^^^^^^^ error: global paths are not supported yet - --> $DIR/invalid-imports.rs:31:15 + --> $DIR/invalid-imports.rs:29:15 | -31 | fn f() -> ::Bar; +29 | fn f() -> ::Bar; | ^^^^^ error: return value of constructor must be a bare path - --> $DIR/invalid-imports.rs:33:5 + --> $DIR/invalid-imports.rs:31:5 | -33 | fn f() -> &Bar; +31 | fn f() -> &Bar; | ^^^^^^^^^^^^^^^ +error: must be Result<...> + --> $DIR/invalid-imports.rs:34:15 + | +34 | fn f() -> u32; + | ^^^ + error: must be Result<...> --> $DIR/invalid-imports.rs:36:15 | -36 | fn f() -> u32; - | ^^^ - -error: must be Result<...> - --> $DIR/invalid-imports.rs:38:15 - | -38 | fn f() -> &u32; +36 | fn f() -> &u32; | ^^^^ error: must have at least one generic parameter - --> $DIR/invalid-imports.rs:40:15 + --> $DIR/invalid-imports.rs:38:15 | -40 | fn f() -> Result<>; +38 | fn f() -> Result<>; | ^^^^^^^^ error: it is currently not sound to use lifetimes in function signatures - --> $DIR/invalid-imports.rs:42:22 + --> $DIR/invalid-imports.rs:40:22 | -42 | fn f() -> Result<'a>; +40 | fn f() -> Result<'a>; | ^^ error: aborting due to 15 previous errors diff --git a/crates/macro/ui-tests/invalid-items.rs b/crates/macro/ui-tests/invalid-items.rs index 851800d37..e1efac92d 100644 --- a/crates/macro/ui-tests/invalid-items.rs +++ b/crates/macro/ui-tests/invalid-items.rs @@ -1,5 +1,3 @@ -#![feature(use_extern_macros)] - extern crate wasm_bindgen; use wasm_bindgen::prelude::*; diff --git a/crates/macro/ui-tests/invalid-items.stderr b/crates/macro/ui-tests/invalid-items.stderr index 6040cf4d6..d0fe8f32a 100644 --- a/crates/macro/ui-tests/invalid-items.stderr +++ b/crates/macro/ui-tests/invalid-items.stderr @@ -1,67 +1,67 @@ error: can only #[wasm_bindgen] public functions - --> $DIR/invalid-items.rs:8:1 + --> $DIR/invalid-items.rs:6:1 | -8 | fn foo() {} +6 | fn foo() {} | ^^^^^^^^^^^ error: can only #[wasm_bindgen] safe functions - --> $DIR/invalid-items.rs:11:5 - | -11 | pub unsafe fn foo1() {} - | ^^^^^^ + --> $DIR/invalid-items.rs:9:5 + | +9 | pub unsafe fn foo1() {} + | ^^^^^^ error: can only #[wasm_bindgen] non-const functions - --> $DIR/invalid-items.rs:14:5 + --> $DIR/invalid-items.rs:12:5 | -14 | pub const fn foo2() {} +12 | pub const fn foo2() {} | ^^^^^ error: structs with #[wasm_bindgen] cannot have lifetime or type parameters currently - --> $DIR/invalid-items.rs:17:11 + --> $DIR/invalid-items.rs:15:11 | -17 | struct Foo(T); +15 | struct Foo(T); | ^^^ error: cannot import mutable globals yet - --> $DIR/invalid-items.rs:21:12 + --> $DIR/invalid-items.rs:19:12 | -21 | static mut FOO: u32; +19 | static mut FOO: u32; | ^^^ error: can't #[wasm_bindgen] variadic functions - --> $DIR/invalid-items.rs:23:25 + --> $DIR/invalid-items.rs:21:25 | -23 | pub fn foo3(x: i32, ...); +21 | pub fn foo3(x: i32, ...); | ^^^ error: only foreign mods with the `C` ABI are allowed - --> $DIR/invalid-items.rs:27:8 + --> $DIR/invalid-items.rs:25:8 | -27 | extern "system" { +25 | extern "system" { | ^^^^^^^^ +error: can't #[wasm_bindgen] functions with lifetime or type parameters + --> $DIR/invalid-items.rs:29:12 + | +29 | pub fn foo4() {} + | ^^^ + error: can't #[wasm_bindgen] functions with lifetime or type parameters --> $DIR/invalid-items.rs:31:12 | -31 | pub fn foo4() {} - | ^^^ +31 | pub fn foo5<'a>() {} + | ^^^^ error: can't #[wasm_bindgen] functions with lifetime or type parameters --> $DIR/invalid-items.rs:33:12 | -33 | pub fn foo5<'a>() {} - | ^^^^ - -error: can't #[wasm_bindgen] functions with lifetime or type parameters - --> $DIR/invalid-items.rs:35:12 - | -35 | pub fn foo6<'a, T>() {} +33 | pub fn foo6<'a, T>() {} | ^^^^^^^ error: #[wasm_bindgen] can only be applied to a function, struct, enum, impl, or extern block - --> $DIR/invalid-items.rs:38:1 + --> $DIR/invalid-items.rs:36:1 | -38 | trait X {} +36 | trait X {} | ^^^^^^^^^^ error: aborting due to 11 previous errors diff --git a/crates/macro/ui-tests/invalid-methods.rs b/crates/macro/ui-tests/invalid-methods.rs index 9fcf3f4b3..ef7fae01a 100644 --- a/crates/macro/ui-tests/invalid-methods.rs +++ b/crates/macro/ui-tests/invalid-methods.rs @@ -1,5 +1,3 @@ -#![feature(use_extern_macros)] - extern crate wasm_bindgen; use wasm_bindgen::prelude::*; diff --git a/crates/macro/ui-tests/invalid-methods.stderr b/crates/macro/ui-tests/invalid-methods.stderr index 9ac1b8877..7e16053ef 100644 --- a/crates/macro/ui-tests/invalid-methods.stderr +++ b/crates/macro/ui-tests/invalid-methods.stderr @@ -1,61 +1,61 @@ error: #[wasm_bindgen] default impls are not supported - --> $DIR/invalid-methods.rs:11:1 - | -11 | default impl A { - | ^^^^^^^ + --> $DIR/invalid-methods.rs:9:1 + | +9 | default impl A { + | ^^^^^^^ error: #[wasm_bindgen] unsafe impls are not supported - --> $DIR/invalid-methods.rs:15:1 + --> $DIR/invalid-methods.rs:13:1 | -15 | unsafe impl A { +13 | unsafe impl A { | ^^^^^^ error: #[wasm_bindgen] trait impls are not supported - --> $DIR/invalid-methods.rs:19:6 + --> $DIR/invalid-methods.rs:17:6 | -19 | impl Clone for A { +17 | impl Clone for A { | ^^^^^ error: #[wasm_bindgen] generic impls aren't supported - --> $DIR/invalid-methods.rs:23:5 + --> $DIR/invalid-methods.rs:21:5 | -23 | impl A { +21 | impl A { | ^^^ error: unsupported self type in #[wasm_bindgen] impl - --> $DIR/invalid-methods.rs:27:6 + --> $DIR/invalid-methods.rs:25:6 | -27 | impl &'static A { +25 | impl &'static A { | ^^^^^^^^^^ error: const definitions aren't supported with #[wasm_bindgen] - --> $DIR/invalid-methods.rs:34:5 + --> $DIR/invalid-methods.rs:32:5 | -34 | const X: u32 = 3; +32 | const X: u32 = 3; | ^^^^^^^^^^^^^^^^^ error: type definitions in impls aren't supported with #[wasm_bindgen] - --> $DIR/invalid-methods.rs:35:5 + --> $DIR/invalid-methods.rs:33:5 | -35 | type Y = u32; +33 | type Y = u32; | ^^^^^^^^^^^^^ error: macros in impls aren't supported - --> $DIR/invalid-methods.rs:36:5 + --> $DIR/invalid-methods.rs:34:5 | -36 | x!(); +34 | x!(); | ^^^^^ error: can only #[wasm_bindgen] non-const functions - --> $DIR/invalid-methods.rs:41:9 + --> $DIR/invalid-methods.rs:39:9 | -41 | pub const fn foo() {} +39 | pub const fn foo() {} | ^^^^^ error: can only bindgen safe functions - --> $DIR/invalid-methods.rs:42:9 + --> $DIR/invalid-methods.rs:40:9 | -42 | pub unsafe fn foo() {} +40 | pub unsafe fn foo() {} | ^^^^^^ error: aborting due to 10 previous errors diff --git a/crates/macro/ui-tests/non-public-function.rs b/crates/macro/ui-tests/non-public-function.rs index 8f0b117da..b318ea780 100644 --- a/crates/macro/ui-tests/non-public-function.rs +++ b/crates/macro/ui-tests/non-public-function.rs @@ -1,5 +1,3 @@ -#![feature(use_extern_macros)] - extern crate wasm_bindgen; use wasm_bindgen::prelude::*; diff --git a/crates/macro/ui-tests/non-public-function.stderr b/crates/macro/ui-tests/non-public-function.stderr index 510dc5379..517ebe7c1 100644 --- a/crates/macro/ui-tests/non-public-function.stderr +++ b/crates/macro/ui-tests/non-public-function.stderr @@ -1,7 +1,7 @@ error: can only #[wasm_bindgen] public functions - --> $DIR/non-public-function.rs:8:1 + --> $DIR/non-public-function.rs:6:1 | -8 | fn foo() {} +6 | fn foo() {} | ^^^^^^^^^^^ error: aborting due to previous error diff --git a/crates/test/README.md b/crates/test/README.md index 4ce08be6d..ef5bd8e69 100644 --- a/crates/test/README.md +++ b/crates/test/README.md @@ -38,8 +38,6 @@ ton of documentation just yet, but a taste of how it works is: ```rust // in tests/wasm.rs - #![feature(use_extern_macros)] - extern crate wasm_bindgen_test; use wasm_bindgen_test::*; diff --git a/crates/test/sample/src/lib.rs b/crates/test/sample/src/lib.rs index b45cedf85..02b0a2e3f 100644 --- a/crates/test/sample/src/lib.rs +++ b/crates/test/sample/src/lib.rs @@ -1,5 +1,3 @@ -#![feature(use_extern_macros)] - #[macro_use] extern crate futures; extern crate js_sys; diff --git a/crates/test/sample/tests/browser.rs b/crates/test/sample/tests/browser.rs index 5d5b36f87..0f2bcd4c8 100644 --- a/crates/test/sample/tests/browser.rs +++ b/crates/test/sample/tests/browser.rs @@ -1,5 +1,3 @@ -#![feature(use_extern_macros)] - extern crate futures; extern crate sample; extern crate wasm_bindgen; diff --git a/crates/test/sample/tests/node.rs b/crates/test/sample/tests/node.rs index 84d871703..e9cb596c3 100644 --- a/crates/test/sample/tests/node.rs +++ b/crates/test/sample/tests/node.rs @@ -1,5 +1,3 @@ -#![feature(use_extern_macros)] - extern crate futures; extern crate sample; extern crate wasm_bindgen; diff --git a/crates/test/src/lib.rs b/crates/test/src/lib.rs index 99326b171..477e743c1 100644 --- a/crates/test/src/lib.rs +++ b/crates/test/src/lib.rs @@ -2,7 +2,6 @@ //! //! More documentation can be found in the README for this crate! -#![feature(use_extern_macros)] #![deny(missing_docs)] extern crate console_error_panic_hook; diff --git a/crates/web-sys/tests/wasm/main.rs b/crates/web-sys/tests/wasm/main.rs index 69e4d6f08..2f21cde6a 100644 --- a/crates/web-sys/tests/wasm/main.rs +++ b/crates/web-sys/tests/wasm/main.rs @@ -1,4 +1,3 @@ -#![feature(use_extern_macros)] #![cfg(target_arch = "wasm32")] extern crate futures; diff --git a/crates/webidl-tests/main.rs b/crates/webidl-tests/main.rs index caedcb7b6..9e7432182 100644 --- a/crates/webidl-tests/main.rs +++ b/crates/webidl-tests/main.rs @@ -1,5 +1,3 @@ -#![feature(use_extern_macros)] - extern crate js_sys; extern crate wasm_bindgen; extern crate wasm_bindgen_test; diff --git a/examples/add/src/lib.rs b/examples/add/src/lib.rs index 77a637447..d8c7633a2 100644 --- a/examples/add/src/lib.rs +++ b/examples/add/src/lib.rs @@ -1,5 +1,3 @@ -#![feature(use_extern_macros)] - extern crate wasm_bindgen; use wasm_bindgen::prelude::*; diff --git a/examples/asm.js/src/lib.rs b/examples/asm.js/src/lib.rs index c6ee4f47f..c2689b1ba 100644 --- a/examples/asm.js/src/lib.rs +++ b/examples/asm.js/src/lib.rs @@ -1,5 +1,3 @@ -#![feature(use_extern_macros)] - extern crate wasm_bindgen; use wasm_bindgen::prelude::*; diff --git a/examples/canvas/src/lib.rs b/examples/canvas/src/lib.rs index 05a67b196..f13e50ade 100755 --- a/examples/canvas/src/lib.rs +++ b/examples/canvas/src/lib.rs @@ -1,5 +1,3 @@ -#![feature(use_extern_macros)] - extern crate js_sys; extern crate wasm_bindgen; extern crate web_sys; diff --git a/examples/char/src/lib.rs b/examples/char/src/lib.rs index 5682ae4c7..ad7c10217 100644 --- a/examples/char/src/lib.rs +++ b/examples/char/src/lib.rs @@ -1,5 +1,3 @@ -#![feature(use_extern_macros)] - extern crate wasm_bindgen; use wasm_bindgen::prelude::*; diff --git a/examples/closures/src/lib.rs b/examples/closures/src/lib.rs index 8b510f984..3aa0c30ec 100755 --- a/examples/closures/src/lib.rs +++ b/examples/closures/src/lib.rs @@ -1,5 +1,3 @@ -#![feature(use_extern_macros)] - extern crate wasm_bindgen; extern crate js_sys; diff --git a/examples/comments/src/lib.rs b/examples/comments/src/lib.rs index cc416955e..cc0a7e123 100644 --- a/examples/comments/src/lib.rs +++ b/examples/comments/src/lib.rs @@ -1,5 +1,3 @@ -#![feature(use_extern_macros)] - extern crate wasm_bindgen; use wasm_bindgen::prelude::*; diff --git a/examples/console_log/src/lib.rs b/examples/console_log/src/lib.rs index cd23275e9..7ae64334e 100644 --- a/examples/console_log/src/lib.rs +++ b/examples/console_log/src/lib.rs @@ -1,5 +1,3 @@ -#![feature(use_extern_macros)] - extern crate wasm_bindgen; extern crate web_sys; diff --git a/examples/dom/src/lib.rs b/examples/dom/src/lib.rs index 43d98f768..98c4021e9 100644 --- a/examples/dom/src/lib.rs +++ b/examples/dom/src/lib.rs @@ -1,5 +1,3 @@ -#![feature(use_extern_macros)] - extern crate wasm_bindgen; use wasm_bindgen::prelude::*; diff --git a/examples/guide-supported-types-examples/src/lib.rs b/examples/guide-supported-types-examples/src/lib.rs index 9dbfdf481..13984c231 100755 --- a/examples/guide-supported-types-examples/src/lib.rs +++ b/examples/guide-supported-types-examples/src/lib.rs @@ -1,4 +1,3 @@ -#![feature(use_extern_macros)] #![allow(unused_variables, dead_code)] extern crate wasm_bindgen; diff --git a/examples/hello_world/src/lib.rs b/examples/hello_world/src/lib.rs index 41486fa45..3a3634b96 100644 --- a/examples/hello_world/src/lib.rs +++ b/examples/hello_world/src/lib.rs @@ -1,5 +1,3 @@ -#![feature(use_extern_macros)] - extern crate wasm_bindgen; use wasm_bindgen::prelude::*; diff --git a/examples/import_js/src/lib.rs b/examples/import_js/src/lib.rs index 5093db75a..aab964d69 100644 --- a/examples/import_js/src/lib.rs +++ b/examples/import_js/src/lib.rs @@ -1,5 +1,3 @@ -#![feature(use_extern_macros)] - extern crate wasm_bindgen; use wasm_bindgen::prelude::*; diff --git a/examples/julia_set/src/lib.rs b/examples/julia_set/src/lib.rs index 2f7a00a9d..a92eea484 100644 --- a/examples/julia_set/src/lib.rs +++ b/examples/julia_set/src/lib.rs @@ -1,5 +1,3 @@ -#![feature(use_extern_macros)] - extern crate wasm_bindgen; use wasm_bindgen::prelude::*; diff --git a/examples/math/src/lib.rs b/examples/math/src/lib.rs index 351949225..9f3449c3f 100644 --- a/examples/math/src/lib.rs +++ b/examples/math/src/lib.rs @@ -1,5 +1,3 @@ -#![feature(use_extern_macros)] - extern crate wasm_bindgen; use wasm_bindgen::prelude::*; diff --git a/examples/no_modules/src/lib.rs b/examples/no_modules/src/lib.rs index 41486fa45..3a3634b96 100644 --- a/examples/no_modules/src/lib.rs +++ b/examples/no_modules/src/lib.rs @@ -1,5 +1,3 @@ -#![feature(use_extern_macros)] - extern crate wasm_bindgen; use wasm_bindgen::prelude::*; diff --git a/examples/performance/src/lib.rs b/examples/performance/src/lib.rs index 1598ed959..9a50eb6f4 100644 --- a/examples/performance/src/lib.rs +++ b/examples/performance/src/lib.rs @@ -1,5 +1,3 @@ -#![feature(use_extern_macros)] - extern crate humantime; extern crate wasm_bindgen; diff --git a/examples/smorgasboard/src/lib.rs b/examples/smorgasboard/src/lib.rs index 308f33904..a1f1755d2 100644 --- a/examples/smorgasboard/src/lib.rs +++ b/examples/smorgasboard/src/lib.rs @@ -1,5 +1,3 @@ -#![feature(use_extern_macros)] - extern crate wasm_bindgen; use wasm_bindgen::prelude::*; diff --git a/examples/wasm-in-wasm/src/lib.rs b/examples/wasm-in-wasm/src/lib.rs index b2539293a..2757438c8 100644 --- a/examples/wasm-in-wasm/src/lib.rs +++ b/examples/wasm-in-wasm/src/lib.rs @@ -1,5 +1,3 @@ -#![feature(use_extern_macros)] - extern crate wasm_bindgen; use wasm_bindgen::prelude::*; diff --git a/examples/webaudio/src/lib.rs b/examples/webaudio/src/lib.rs index bca2256d4..b048c27e1 100644 --- a/examples/webaudio/src/lib.rs +++ b/examples/webaudio/src/lib.rs @@ -1,4 +1,4 @@ -#![feature(use_extern_macros, nll)] +#![feature(nll)] extern crate wasm_bindgen; extern crate web_sys; @@ -144,4 +144,4 @@ impl FmOsc { } -} \ No newline at end of file +} diff --git a/guide/src/whirlwind-tour/basic-usage.md b/guide/src/whirlwind-tour/basic-usage.md index 8d8bb8207..5a1f9fd8e 100644 --- a/guide/src/whirlwind-tour/basic-usage.md +++ b/guide/src/whirlwind-tour/basic-usage.md @@ -39,8 +39,6 @@ wasm-bindgen = "0.2" Next up our actual code! We'll write this in `src/lib.rs`: ```rust,ignore -#![feature(use_extern_macros)] - extern crate wasm_bindgen; use wasm_bindgen::prelude::*; diff --git a/guide/src/whirlwind-tour/what-else-can-we-do.md b/guide/src/whirlwind-tour/what-else-can-we-do.md index 61b653188..80bc19b0f 100644 --- a/guide/src/whirlwind-tour/what-else-can-we-do.md +++ b/guide/src/whirlwind-tour/what-else-can-we-do.md @@ -5,8 +5,6 @@ can also [explore this code online](https://webassembly.studio/?f=t61j18noqz): ```rust,ignore // src/lib.rs -#![feature(use_extern_macros)] - extern crate wasm_bindgen; use wasm_bindgen::prelude::*; diff --git a/src/lib.rs b/src/lib.rs index 6d0d33f1f..90d6b5a20 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -5,7 +5,7 @@ //! this crate and this crate also provides JS bindings through the `JsValue` //! interface. -#![feature(use_extern_macros, unsize)] +#![feature(unsize)] #![no_std] #![doc(html_root_url = "https://docs.rs/wasm-bindgen/0.2")] diff --git a/tests/crates/a/src/lib.rs b/tests/crates/a/src/lib.rs index 04dde6535..d39f7eeec 100644 --- a/tests/crates/a/src/lib.rs +++ b/tests/crates/a/src/lib.rs @@ -1,5 +1,3 @@ -#![feature(use_extern_macros)] - extern crate wasm_bindgen; use wasm_bindgen::prelude::*; diff --git a/tests/crates/b/src/lib.rs b/tests/crates/b/src/lib.rs index 87f781da1..c7876ed4e 100644 --- a/tests/crates/b/src/lib.rs +++ b/tests/crates/b/src/lib.rs @@ -1,5 +1,3 @@ -#![feature(use_extern_macros)] - extern crate wasm_bindgen; use wasm_bindgen::prelude::*; diff --git a/tests/headless.rs b/tests/headless.rs index 707189113..6cb1449a2 100644 --- a/tests/headless.rs +++ b/tests/headless.rs @@ -1,5 +1,4 @@ #![cfg(target_arch = "wasm32")] -#![feature(use_extern_macros)] extern crate wasm_bindgen_test; extern crate wasm_bindgen; diff --git a/tests/no-std/test.rs b/tests/no-std/test.rs index 4dc5c91e4..a8e04ac88 100644 --- a/tests/no-std/test.rs +++ b/tests/no-std/test.rs @@ -4,7 +4,6 @@ //! This doesn't actually run any tests, it's mostly a compile-time verification //! that things work. -#![feature(use_extern_macros)] #![no_std] #![allow(dead_code)] diff --git a/tests/non_wasm.rs b/tests/non_wasm.rs index 7a8128f7e..947dcf192 100644 --- a/tests/non_wasm.rs +++ b/tests/non_wasm.rs @@ -1,5 +1,3 @@ -#![feature(use_extern_macros)] - extern crate wasm_bindgen; use wasm_bindgen::prelude::*; diff --git a/tests/std-crate-no-std-dep.rs b/tests/std-crate-no-std-dep.rs index 77a9a11e1..e2b25037b 100644 --- a/tests/std-crate-no-std-dep.rs +++ b/tests/std-crate-no-std-dep.rs @@ -2,7 +2,6 @@ //! `wasm-bindgen` is compiled itself with the `std` feature and everything //! works out just fine. -#![feature(use_extern_macros)] #![no_std] extern crate wasm_bindgen; diff --git a/tests/wasm/main.rs b/tests/wasm/main.rs index 6b783f93f..95ceea151 100644 --- a/tests/wasm/main.rs +++ b/tests/wasm/main.rs @@ -1,5 +1,4 @@ #![cfg(target_arch = "wasm32")] -#![feature(use_extern_macros)] extern crate wasm_bindgen_test; extern crate wasm_bindgen; From 305ecb7910d7030d7e25594c8c8b2b0ef3eaf2f9 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Sun, 19 Aug 2018 14:42:25 -0700 Subject: [PATCH 2/3] Remove `nll` feature from `webaudio` example --- examples/webaudio/src/lib.rs | 56 ++++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 24 deletions(-) diff --git a/examples/webaudio/src/lib.rs b/examples/webaudio/src/lib.rs index b048c27e1..704f71e92 100644 --- a/examples/webaudio/src/lib.rs +++ b/examples/webaudio/src/lib.rs @@ -1,5 +1,3 @@ -#![feature(nll)] - extern crate wasm_bindgen; extern crate web_sys; @@ -45,13 +43,20 @@ impl FmOsc { // TODO, how to throw from a constructor? let ctx = web_sys::AudioContext::new().unwrap(); - let base: &BaseAudioContext = ctx.as_ref(); + let primary; + let fm_osc; + let gain; + let fm_gain; - // create our web audio objects - let primary = base.create_oscillator().unwrap(); - let fm_osc = base.create_oscillator().unwrap(); - let gain = base.create_gain().unwrap(); - let fm_gain = base.create_gain().unwrap(); + { + let base: &BaseAudioContext = ctx.as_ref(); + + // create our web audio objects + primary = base.create_oscillator().unwrap(); + fm_osc = base.create_oscillator().unwrap(); + gain = base.create_gain().unwrap(); + fm_gain = base.create_gain().unwrap(); + } // some initial settings: primary.set_type(OscillatorType::Sine); @@ -63,27 +68,30 @@ impl FmOsc { // Create base class references: - let primary_node: &AudioNode = primary.as_ref(); - let gain_node: &AudioNode = gain.as_ref(); - let fm_osc_node: &AudioNode = fm_osc.as_ref(); - let fm_gain_node: &AudioNode = fm_gain.as_ref(); - let destination = base.destination(); - let destination_node: &AudioNode = destination.as_ref(); + { + let primary_node: &AudioNode = primary.as_ref(); + let gain_node: &AudioNode = gain.as_ref(); + let fm_osc_node: &AudioNode = fm_osc.as_ref(); + let fm_gain_node: &AudioNode = fm_gain.as_ref(); + let base: &BaseAudioContext = ctx.as_ref(); + let destination = base.destination(); + let destination_node: &AudioNode = destination.as_ref(); - // connect them up: + // connect them up: - // The primary oscillator is routed through the gain node, so that it can control the overall output volume - primary_node.connect_with_destination_and_output_and_input_using_destination(gain.as_ref()); - // Then connect the gain node to the AudioContext destination (aka your speakers) - gain_node.connect_with_destination_and_output_and_input_using_destination(destination_node); + // The primary oscillator is routed through the gain node, so that it can control the overall output volume + primary_node.connect_with_destination_and_output_and_input_using_destination(gain.as_ref()); + // Then connect the gain node to the AudioContext destination (aka your speakers) + gain_node.connect_with_destination_and_output_and_input_using_destination(destination_node); - // the FM oscillator is connected to its own gain node, so it can control the amount of modulation - fm_osc_node.connect_with_destination_and_output_and_input_using_destination(fm_gain.as_ref()); + // the FM oscillator is connected to its own gain node, so it can control the amount of modulation + fm_osc_node.connect_with_destination_and_output_and_input_using_destination(fm_gain.as_ref()); - // Connect the FM oscillator to the frequency parameter of the main oscillator, so that the - // FM node can modulate its frequency - fm_gain_node.connect_with_destination_and_output_using_destination(&primary.frequency()); + // Connect the FM oscillator to the frequency parameter of the main oscillator, so that the + // FM node can modulate its frequency + fm_gain_node.connect_with_destination_and_output_using_destination(&primary.frequency()); + } // start the oscillators! From 4c1bf937f297af22e0cb64b4fb0cf3278563ea25 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Sun, 19 Aug 2018 14:45:59 -0700 Subject: [PATCH 3/3] Move the `unsize` feature behind a `nightly` Cargo feature This should fully stabilize the `wasm-bindgen` crate, preparing us for stable Rust! --- .travis.yml | 1 + Cargo.toml | 1 + examples/closures/Cargo.toml | 2 +- src/closure.rs | 2 ++ src/lib.rs | 2 +- tests/wasm/closures.rs | 2 ++ 6 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index bfd64e01e..8144c9733 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 330a4ce34..724964e38 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 ce6e6da65..e33f3ac80 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 b2afd6804..633d35b19 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 90d6b5a20..7c9ce9f9b 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 84794725f..0b896a7ed 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;