mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-06-13 13:01:22 +00:00
Migrate to trybuild
from compiletest
This migrates our UI tests to the recently published `trybuild` crate which should hopefully be a bit more robust than `compiletest` over time!
This commit is contained in:
@ -51,7 +51,6 @@ members = [
|
||||
"benchmarks",
|
||||
"crates/cli",
|
||||
"crates/js-sys",
|
||||
"crates/macro/ui-tests",
|
||||
"crates/test",
|
||||
"crates/test/sample",
|
||||
"crates/typescript-tests",
|
||||
|
@ -115,7 +115,7 @@ jobs:
|
||||
toolchain: beta
|
||||
- template: ci/azure-install-node.yml
|
||||
- template: ci/azure-install-sccache.yml
|
||||
- script: cargo test -p ui-tests
|
||||
- script: cargo test -p wasm-bindgen-macro
|
||||
|
||||
- job: test_wasm_interpreter
|
||||
displayName: "Run wasm-bindgen-wasm-interpreter tests"
|
||||
|
@ -22,3 +22,7 @@ strict-macro = ["wasm-bindgen-macro-support/strict-macro"]
|
||||
[dependencies]
|
||||
wasm-bindgen-macro-support = { path = "../macro-support", version = "=0.2.43" }
|
||||
quote = "0.6"
|
||||
|
||||
[dev-dependencies]
|
||||
trybuild = "1.0"
|
||||
wasm-bindgen = { path = "../..", version = "0.2.43", features = ['strict-macro'] }
|
||||
|
5
crates/macro/tests/ui.rs
Normal file
5
crates/macro/tests/ui.rs
Normal file
@ -0,0 +1,5 @@
|
||||
#[test]
|
||||
fn ui() {
|
||||
let t = trybuild::TestCases::new();
|
||||
t.compile_fail("ui-tests/*.rs");
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
[package]
|
||||
name = "ui-tests"
|
||||
version = "0.1.0"
|
||||
authors = ["The wasm-bindgen Developers"]
|
||||
|
||||
[lib]
|
||||
path = "test.rs"
|
||||
doctest = false
|
||||
harness = false
|
||||
|
||||
[dependencies]
|
||||
wasm-bindgen = { path = "../../..", features = ["strict-macro"] }
|
||||
|
||||
[dev-dependencies]
|
||||
compiletest_rs = { version = "0.3", features = ['stable'] }
|
@ -1,8 +1,6 @@
|
||||
#![crate_type = "rlib"]
|
||||
|
||||
extern crate wasm_bindgen;
|
||||
|
||||
use wasm_bindgen::prelude::*;
|
||||
|
||||
#[wasm_bindgen(nonsense)]
|
||||
pub fn foo() {}
|
||||
|
||||
fn main() {}
|
||||
|
@ -1,8 +1,5 @@
|
||||
error: unknown attribute
|
||||
--> $DIR/attribute-fails-to-parse.rs:7:16
|
||||
--> $DIR/attribute-fails-to-parse.rs:3:16
|
||||
|
|
||||
7 | #[wasm_bindgen(nonsense)]
|
||||
3 | #[wasm_bindgen(nonsense)]
|
||||
| ^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -1,7 +1,3 @@
|
||||
#![crate_type = "rlib"]
|
||||
|
||||
extern crate wasm_bindgen;
|
||||
|
||||
use wasm_bindgen::prelude::*;
|
||||
|
||||
#[wasm_bindgen]
|
||||
@ -13,3 +9,5 @@ extern "C" {
|
||||
|
||||
fn foo() -> &u32;
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
@ -1,20 +1,17 @@
|
||||
error: cannot return a borrowed ref with #[wasm_bindgen]
|
||||
--> $DIR/bad-signatures.rs:8:17
|
||||
--> $DIR/bad-signatures.rs:4:17
|
||||
|
|
||||
8 | pub fn foo() -> &u32 {}
|
||||
4 | pub fn foo() -> &u32 {}
|
||||
| ^^^^
|
||||
|
||||
error: unsupported pattern in #[wasm_bindgen] imported function
|
||||
--> $DIR/bad-signatures.rs:12:12
|
||||
--> $DIR/bad-signatures.rs:8:12
|
||||
|
|
||||
12 | fn foo(Foo(x): Foo);
|
||||
8 | fn foo(Foo(x): Foo);
|
||||
| ^^^^^^
|
||||
|
||||
error: cannot return references in #[wasm_bindgen] imports yet
|
||||
--> $DIR/bad-signatures.rs:14:17
|
||||
--> $DIR/bad-signatures.rs:10:17
|
||||
|
|
||||
14 | fn foo() -> &u32;
|
||||
10 | fn foo() -> &u32;
|
||||
| ^^^^
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
extern crate wasm_bindgen;
|
||||
|
||||
use wasm_bindgen::prelude::*;
|
||||
|
||||
#[wasm_bindgen(module = "./foo.js")]
|
||||
@ -9,7 +7,7 @@ extern {
|
||||
|
||||
#[wasm_bindgen(module = "../foo.js")]
|
||||
extern {
|
||||
fn wut();
|
||||
fn wut2();
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
@ -1,14 +1,11 @@
|
||||
error: relative module paths aren't supported yet
|
||||
--> $DIR/import-local.rs:5:25
|
||||
--> $DIR/import-local.rs:3:25
|
||||
|
|
||||
5 | #[wasm_bindgen(module = "./foo.js")]
|
||||
3 | #[wasm_bindgen(module = "./foo.js")]
|
||||
| ^^^^^^^^^^
|
||||
|
||||
error: relative module paths aren't supported yet
|
||||
--> $DIR/import-local.rs:10:25
|
||||
--> $DIR/import-local.rs:8:25
|
||||
|
|
||||
10 | #[wasm_bindgen(module = "../foo.js")]
|
||||
8 | #[wasm_bindgen(module = "../foo.js")]
|
||||
| ^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
@ -1,7 +1,3 @@
|
||||
#![crate_type = "rlib"]
|
||||
|
||||
extern crate wasm_bindgen;
|
||||
|
||||
use wasm_bindgen::prelude::*;
|
||||
|
||||
#[wasm_bindgen(x)]
|
||||
@ -15,3 +11,5 @@ extern "C" {
|
||||
#[wasm_bindgen { }]
|
||||
fn bar();
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
@ -1,20 +1,17 @@
|
||||
error: unknown attribute
|
||||
--> $DIR/invalid-attr.rs:7:16
|
||||
--> $DIR/invalid-attr.rs:3:16
|
||||
|
|
||||
7 | #[wasm_bindgen(x)]
|
||||
3 | #[wasm_bindgen(x)]
|
||||
| ^
|
||||
|
||||
error: unknown attribute
|
||||
--> $DIR/invalid-attr.rs:12:20
|
||||
--> $DIR/invalid-attr.rs:8:20
|
||||
|
|
||||
12 | #[wasm_bindgen(y)]
|
||||
8 | #[wasm_bindgen(y)]
|
||||
| ^
|
||||
|
||||
error: malformed #[wasm_bindgen] attribute
|
||||
--> $DIR/invalid-attr.rs:15:5
|
||||
--> $DIR/invalid-attr.rs:11:5
|
||||
|
|
||||
15 | #[wasm_bindgen { }]
|
||||
11 | #[wasm_bindgen { }]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
|
@ -1,7 +1,3 @@
|
||||
#![crate_type = "rlib"]
|
||||
|
||||
extern crate wasm_bindgen;
|
||||
|
||||
use wasm_bindgen::prelude::*;
|
||||
|
||||
#[wasm_bindgen]
|
||||
@ -21,3 +17,5 @@ pub enum C {
|
||||
pub enum D {
|
||||
X = 4294967296,
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
@ -1,26 +1,23 @@
|
||||
error: only public enums are allowed with #[wasm_bindgen]
|
||||
--> $DIR/invalid-enums.rs:8:1
|
||||
--> $DIR/invalid-enums.rs:4:1
|
||||
|
|
||||
8 | enum A {}
|
||||
4 | enum A {}
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: only C-Style enums allowed with #[wasm_bindgen]
|
||||
--> $DIR/invalid-enums.rs:12:6
|
||||
--> $DIR/invalid-enums.rs:8:6
|
||||
|
|
||||
12 | D(u32),
|
||||
8 | D(u32),
|
||||
| ^^^^^
|
||||
|
||||
error: enums with #[wasm_bidngen] may only have number literal values
|
||||
--> $DIR/invalid-enums.rs:17:9
|
||||
--> $DIR/invalid-enums.rs:13:9
|
||||
|
|
||||
17 | X = 1 + 3,
|
||||
13 | 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:18:9
|
||||
|
|
||||
22 | X = 4294967296,
|
||||
18 | X = 4294967296,
|
||||
| ^^^^^^^^^^
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
|
@ -1,7 +1,3 @@
|
||||
#![crate_type = "rlib"]
|
||||
|
||||
extern crate wasm_bindgen;
|
||||
|
||||
use wasm_bindgen::prelude::*;
|
||||
|
||||
#[wasm_bindgen]
|
||||
@ -41,3 +37,5 @@ extern "C" {
|
||||
#[wasm_bindgen(catch)]
|
||||
fn f() -> Result<'a>;
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
@ -1,92 +1,89 @@
|
||||
error: it is currently not sound to use lifetimes in function signatures
|
||||
--> $DIR/invalid-imports.rs:11:16
|
||||
--> $DIR/invalid-imports.rs:7:16
|
||||
|
|
||||
11 | fn f() -> &'static u32;
|
||||
7 | fn f() -> &'static u32;
|
||||
| ^^^^^^^
|
||||
|
||||
error: imported methods must have at least one argument
|
||||
--> $DIR/invalid-imports.rs:14:5
|
||||
--> $DIR/invalid-imports.rs:10:5
|
||||
|
|
||||
14 | fn f1();
|
||||
10 | fn f1();
|
||||
| ^^^^^^^^
|
||||
|
||||
error: first argument of method must be a shared reference
|
||||
--> $DIR/invalid-imports.rs:16:14
|
||||
--> $DIR/invalid-imports.rs:12:14
|
||||
|
|
||||
16 | fn f2(x: u32);
|
||||
12 | fn f2(x: u32);
|
||||
| ^^^
|
||||
|
||||
error: first argument of method must be a path
|
||||
--> $DIR/invalid-imports.rs:18:14
|
||||
--> $DIR/invalid-imports.rs:14:14
|
||||
|
|
||||
18 | fn f3(x: &&u32);
|
||||
14 | fn f3(x: &&u32);
|
||||
| ^^^^^
|
||||
|
||||
error: multi-segment paths are not supported yet
|
||||
--> $DIR/invalid-imports.rs:20:15
|
||||
--> $DIR/invalid-imports.rs:16:15
|
||||
|
|
||||
20 | fn f4(x: &foo::Bar);
|
||||
16 | fn f4(x: &foo::Bar);
|
||||
| ^^^^^^^^
|
||||
|
||||
error: global paths are not supported yet
|
||||
--> $DIR/invalid-imports.rs:22:15
|
||||
--> $DIR/invalid-imports.rs:18:15
|
||||
|
|
||||
22 | fn f4(x: &::Bar);
|
||||
18 | fn f4(x: &::Bar);
|
||||
| ^^^^^
|
||||
|
||||
error: paths with type parameters are not supported yet
|
||||
--> $DIR/invalid-imports.rs:24:15
|
||||
--> $DIR/invalid-imports.rs:20:15
|
||||
|
|
||||
24 | fn f4(x: &Bar<T>);
|
||||
20 | fn f4(x: &Bar<T>);
|
||||
| ^^^^^^
|
||||
|
||||
error: paths with type parameters are not supported yet
|
||||
--> $DIR/invalid-imports.rs:26:15
|
||||
--> $DIR/invalid-imports.rs:22:15
|
||||
|
|
||||
26 | fn f4(x: &Fn(T));
|
||||
22 | fn f4(x: &Fn(T));
|
||||
| ^^^^^
|
||||
|
||||
error: constructor returns must be bare types
|
||||
--> $DIR/invalid-imports.rs:29:5
|
||||
--> $DIR/invalid-imports.rs:25:5
|
||||
|
|
||||
29 | fn f();
|
||||
25 | fn f();
|
||||
| ^^^^^^^
|
||||
|
||||
error: global paths are not supported yet
|
||||
--> $DIR/invalid-imports.rs:31:15
|
||||
--> $DIR/invalid-imports.rs:27:15
|
||||
|
|
||||
31 | fn f() -> ::Bar;
|
||||
27 | fn f() -> ::Bar;
|
||||
| ^^^^^
|
||||
|
||||
error: return value of constructor must be a bare path
|
||||
--> $DIR/invalid-imports.rs:33:5
|
||||
--> $DIR/invalid-imports.rs:29:5
|
||||
|
|
||||
33 | fn f() -> &Bar;
|
||||
29 | fn f() -> &Bar;
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
error: must be Result<...>
|
||||
--> $DIR/invalid-imports.rs:36:15
|
||||
--> $DIR/invalid-imports.rs:32:15
|
||||
|
|
||||
36 | fn f() -> u32;
|
||||
32 | fn f() -> u32;
|
||||
| ^^^
|
||||
|
||||
error: must be Result<...>
|
||||
--> $DIR/invalid-imports.rs:38:15
|
||||
--> $DIR/invalid-imports.rs:34:15
|
||||
|
|
||||
38 | fn f() -> &u32;
|
||||
34 | fn f() -> &u32;
|
||||
| ^^^^
|
||||
|
||||
error: must have at least one generic parameter
|
||||
--> $DIR/invalid-imports.rs:40:15
|
||||
--> $DIR/invalid-imports.rs:36:15
|
||||
|
|
||||
40 | fn f() -> Result<>;
|
||||
36 | 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:38:22
|
||||
|
|
||||
42 | fn f() -> Result<'a>;
|
||||
38 | fn f() -> Result<'a>;
|
||||
| ^^
|
||||
|
||||
error: aborting due to 15 previous errors
|
||||
|
||||
|
@ -1,7 +1,3 @@
|
||||
#![crate_type = "rlib"]
|
||||
|
||||
extern crate wasm_bindgen;
|
||||
|
||||
use wasm_bindgen::prelude::*;
|
||||
|
||||
#[wasm_bindgen]
|
||||
@ -36,3 +32,5 @@ pub fn foo6<'a, T>() {}
|
||||
|
||||
#[wasm_bindgen]
|
||||
trait X {}
|
||||
|
||||
fn main() {}
|
||||
|
@ -1,68 +1,65 @@
|
||||
error: can only #[wasm_bindgen] public functions
|
||||
--> $DIR/invalid-items.rs:8:1
|
||||
--> $DIR/invalid-items.rs:4:1
|
||||
|
|
||||
8 | fn foo() {}
|
||||
4 | fn foo() {}
|
||||
| ^^^^^^^^^^^
|
||||
|
||||
error: can only #[wasm_bindgen] safe functions
|
||||
--> $DIR/invalid-items.rs:11:5
|
||||
--> $DIR/invalid-items.rs:7:5
|
||||
|
|
||||
11 | pub unsafe fn foo1() {}
|
||||
7 | pub unsafe fn foo1() {}
|
||||
| ^^^^^^
|
||||
|
||||
error: can only #[wasm_bindgen] non-const functions
|
||||
--> $DIR/invalid-items.rs:14:5
|
||||
--> $DIR/invalid-items.rs:10:5
|
||||
|
|
||||
14 | pub const fn foo2() {}
|
||||
10 | 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:13:11
|
||||
|
|
||||
17 | struct Foo<T>(T);
|
||||
13 | struct Foo<T>(T);
|
||||
| ^^^
|
||||
|
||||
error: cannot import mutable globals yet
|
||||
--> $DIR/invalid-items.rs:21:12
|
||||
--> $DIR/invalid-items.rs:17:12
|
||||
|
|
||||
21 | static mut FOO: u32;
|
||||
17 | static mut FOO: u32;
|
||||
| ^^^
|
||||
|
||||
error: can't #[wasm_bindgen] variadic functions
|
||||
--> $DIR/invalid-items.rs:23:25
|
||||
--> $DIR/invalid-items.rs:19:25
|
||||
|
|
||||
23 | pub fn foo3(x: i32, ...);
|
||||
19 | 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:23:8
|
||||
|
|
||||
27 | extern "system" {
|
||||
23 | extern "system" {
|
||||
| ^^^^^^^^
|
||||
|
||||
error: can't #[wasm_bindgen] functions with lifetime or type parameters
|
||||
--> $DIR/invalid-items.rs:27:12
|
||||
|
|
||||
27 | pub fn foo4<T>() {}
|
||||
| ^^^
|
||||
|
||||
error: can't #[wasm_bindgen] functions with lifetime or type parameters
|
||||
--> $DIR/invalid-items.rs:29:12
|
||||
|
|
||||
29 | pub fn foo5<'a>() {}
|
||||
| ^^^^
|
||||
|
||||
error: can't #[wasm_bindgen] functions with lifetime or type parameters
|
||||
--> $DIR/invalid-items.rs:31:12
|
||||
|
|
||||
31 | pub fn foo4<T>() {}
|
||||
| ^^^
|
||||
|
||||
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>() {}
|
||||
31 | 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:34:1
|
||||
|
|
||||
38 | trait X {}
|
||||
34 | trait X {}
|
||||
| ^^^^^^^^^^
|
||||
|
||||
error: aborting due to 11 previous errors
|
||||
|
||||
|
@ -1,7 +1,3 @@
|
||||
#![crate_type = "rlib"]
|
||||
|
||||
extern crate wasm_bindgen;
|
||||
|
||||
use wasm_bindgen::prelude::*;
|
||||
|
||||
#[wasm_bindgen]
|
||||
@ -47,3 +43,5 @@ impl A {
|
||||
impl A {
|
||||
pub unsafe fn foo() {}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
@ -1,62 +1,67 @@
|
||||
error: #[wasm_bindgen] default impls are not supported
|
||||
--> $DIR/invalid-methods.rs:11:1
|
||||
--> $DIR/invalid-methods.rs:7:1
|
||||
|
|
||||
11 | default impl A {
|
||||
7 | default impl A {
|
||||
| ^^^^^^^
|
||||
|
||||
error: #[wasm_bindgen] unsafe impls are not supported
|
||||
--> $DIR/invalid-methods.rs:15:1
|
||||
--> $DIR/invalid-methods.rs:11:1
|
||||
|
|
||||
15 | unsafe impl A {
|
||||
11 | unsafe impl A {
|
||||
| ^^^^^^
|
||||
|
||||
error: #[wasm_bindgen] trait impls are not supported
|
||||
--> $DIR/invalid-methods.rs:19:6
|
||||
--> $DIR/invalid-methods.rs:15:6
|
||||
|
|
||||
19 | impl Clone for A {
|
||||
15 | impl Clone for A {
|
||||
| ^^^^^
|
||||
|
||||
error: #[wasm_bindgen] generic impls aren't supported
|
||||
--> $DIR/invalid-methods.rs:23:5
|
||||
--> $DIR/invalid-methods.rs:19:5
|
||||
|
|
||||
23 | impl<T> A {
|
||||
19 | impl<T> A {
|
||||
| ^^^
|
||||
|
||||
error: unsupported self type in #[wasm_bindgen] impl
|
||||
--> $DIR/invalid-methods.rs:27:6
|
||||
--> $DIR/invalid-methods.rs:23:6
|
||||
|
|
||||
27 | impl &'static A {
|
||||
23 | impl &'static A {
|
||||
| ^^^^^^^^^^
|
||||
|
||||
error: const definitions aren't supported with #[wasm_bindgen]
|
||||
--> $DIR/invalid-methods.rs:34:5
|
||||
--> $DIR/invalid-methods.rs:30:5
|
||||
|
|
||||
34 | const X: u32 = 3;
|
||||
30 | 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:31:5
|
||||
|
|
||||
35 | type Y = u32;
|
||||
31 | type Y = u32;
|
||||
| ^^^^^^^^^^^^^
|
||||
|
||||
error: macros in impls aren't supported
|
||||
--> $DIR/invalid-methods.rs:36:5
|
||||
--> $DIR/invalid-methods.rs:32:5
|
||||
|
|
||||
36 | x!();
|
||||
32 | x!();
|
||||
| ^^^^^
|
||||
|
||||
error: can only #[wasm_bindgen] non-const functions
|
||||
--> $DIR/invalid-methods.rs:43:9
|
||||
--> $DIR/invalid-methods.rs:39:9
|
||||
|
|
||||
43 | pub const fn foo() {}
|
||||
39 | pub const fn foo() {}
|
||||
| ^^^^^
|
||||
|
||||
error: can only bindgen safe functions
|
||||
--> $DIR/invalid-methods.rs:48:9
|
||||
--> $DIR/invalid-methods.rs:44:9
|
||||
|
|
||||
48 | pub unsafe fn foo() {}
|
||||
44 | pub unsafe fn foo() {}
|
||||
| ^^^^^^
|
||||
|
||||
error: aborting due to 10 previous errors
|
||||
|
||||
warning: unused macro definition
|
||||
--> $DIR/invalid-methods.rs:26:1
|
||||
|
|
||||
26 | macro_rules! x { () => () }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: #[warn(unused_macros)] on by default
|
||||
|
@ -1,6 +1,3 @@
|
||||
#![crate_type = "rlib"]
|
||||
|
||||
extern crate wasm_bindgen;
|
||||
|
||||
use wasm_bindgen::prelude::*;
|
||||
|
||||
|
@ -1,8 +1,5 @@
|
||||
error: setters must start with `set_`, found: a
|
||||
--> $DIR/invalid-setter.rs:12:8
|
||||
--> $DIR/invalid-setter.rs:9:8
|
||||
|
|
||||
12 | fn a(this: &A, b: i32);
|
||||
9 | fn a(this: &A, b: i32);
|
||||
| ^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -1,8 +1,6 @@
|
||||
#![crate_type = "rlib"]
|
||||
|
||||
extern crate wasm_bindgen;
|
||||
|
||||
use wasm_bindgen::prelude::*;
|
||||
|
||||
#[wasm_bindgen]
|
||||
fn foo() {}
|
||||
|
||||
fn main() {}
|
||||
|
@ -1,8 +1,5 @@
|
||||
error: can only #[wasm_bindgen] public functions
|
||||
--> $DIR/non-public-function.rs:8:1
|
||||
--> $DIR/non-public-function.rs:4:1
|
||||
|
|
||||
8 | fn foo() {}
|
||||
4 | fn foo() {}
|
||||
| ^^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -1,10 +1,8 @@
|
||||
#![crate_type = "rlib"]
|
||||
|
||||
extern crate wasm_bindgen;
|
||||
|
||||
use wasm_bindgen::prelude::*;
|
||||
|
||||
#[wasm_bindgen]
|
||||
pub struct A {
|
||||
pub field: String,
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
@ -1,15 +1,13 @@
|
||||
error[E0277]: the trait bound `std::string::String: std::marker::Copy` is not satisfied
|
||||
--> $DIR/pub-not-copy.rs:9:16
|
||||
--> $DIR/pub-not-copy.rs:5:16
|
||||
|
|
||||
9 | pub field: String,
|
||||
5 | pub field: String,
|
||||
| ^^^^^^ the trait `std::marker::Copy` is not implemented for `std::string::String`
|
||||
|
|
||||
note: required by `__wbg_get_a_field::assert_copy`
|
||||
--> $DIR/pub-not-copy.rs:7:1
|
||||
--> $DIR/pub-not-copy.rs:3:1
|
||||
|
|
||||
7 | #[wasm_bindgen]
|
||||
3 | #[wasm_bindgen]
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
|
@ -1,7 +1,3 @@
|
||||
#![crate_type = "rlib"]
|
||||
|
||||
extern crate wasm_bindgen;
|
||||
|
||||
use wasm_bindgen::prelude::*;
|
||||
|
||||
#[wasm_bindgen(start)]
|
||||
@ -12,3 +8,5 @@ pub fn foo2(x: u32) {}
|
||||
|
||||
#[wasm_bindgen(start)]
|
||||
pub fn foo3<T>() {}
|
||||
|
||||
fn main() {}
|
||||
|
@ -1,14 +1,11 @@
|
||||
error: the start function cannot have arguments
|
||||
--> $DIR/start-function.rs:11:13
|
||||
--> $DIR/start-function.rs:7:13
|
||||
|
|
||||
11 | pub fn foo2(x: u32) {}
|
||||
7 | pub fn foo2(x: u32) {}
|
||||
| ^^^^^^
|
||||
|
||||
error: the start function cannot have generics
|
||||
--> $DIR/start-function.rs:14:12
|
||||
--> $DIR/start-function.rs:10:12
|
||||
|
|
||||
14 | pub fn foo3<T>() {}
|
||||
10 | pub fn foo3<T>() {}
|
||||
| ^^^
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
@ -1,7 +1,3 @@
|
||||
#![crate_type = "rlib"]
|
||||
|
||||
extern crate wasm_bindgen;
|
||||
|
||||
use wasm_bindgen::prelude::*;
|
||||
|
||||
#[wasm_bindgen]
|
||||
@ -11,3 +7,5 @@ extern "C" {
|
||||
#[wasm_bindgen(method, structural, final)]
|
||||
fn bar(this: &Foo);
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
@ -1,8 +1,5 @@
|
||||
error: cannot specify both `structural` and `final`
|
||||
--> $DIR/structural-and-final.rs:11:40
|
||||
--> $DIR/structural-and-final.rs:7:40
|
||||
|
|
||||
11 | #[wasm_bindgen(method, structural, final)]
|
||||
7 | #[wasm_bindgen(method, structural, final)]
|
||||
| ^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -1,25 +0,0 @@
|
||||
// ignore-test - not a test
|
||||
|
||||
#![cfg(test)]
|
||||
|
||||
extern crate compiletest_rs as compiletest;
|
||||
|
||||
use std::env;
|
||||
use std::fs;
|
||||
use std::path::PathBuf;
|
||||
|
||||
fn main() {
|
||||
let mut config = compiletest::Config::default();
|
||||
config.mode = "ui".parse().expect("invalid mode");
|
||||
let mut me = env::current_exe().unwrap();
|
||||
me.pop();
|
||||
config.target_rustcflags = Some(format!("-L {}", me.display()));
|
||||
let src = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
|
||||
config.src_base = src;
|
||||
|
||||
me.pop();
|
||||
me.pop();
|
||||
config.build_base = me.join("tests/ui");
|
||||
drop(fs::remove_dir_all(&config.build_base));
|
||||
compiletest::run_tests(&config);
|
||||
}
|
@ -1,7 +1,3 @@
|
||||
#![crate_type = "rlib"]
|
||||
|
||||
extern crate wasm_bindgen;
|
||||
|
||||
use wasm_bindgen::prelude::*;
|
||||
|
||||
struct A;
|
||||
@ -13,3 +9,5 @@ impl A {
|
||||
pub fn foo() {
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
@ -1,14 +1,11 @@
|
||||
error: unused #[wasm_bindgen] attribute
|
||||
--> $DIR/unused-attributes.rs:11:20
|
||||
--> $DIR/unused-attributes.rs:7:20
|
||||
|
|
||||
11 | #[wasm_bindgen(method)]
|
||||
7 | #[wasm_bindgen(method)]
|
||||
| ^^^^^^
|
||||
|
||||
error: unused #[wasm_bindgen] attribute
|
||||
--> $DIR/unused-attributes.rs:12:20
|
||||
--> $DIR/unused-attributes.rs:8:20
|
||||
|
|
||||
12 | #[wasm_bindgen(method)]
|
||||
8 | #[wasm_bindgen(method)]
|
||||
| ^^^^^^
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
Reference in New Issue
Block a user