diff options
Diffstat (limited to 'vendor/wasm-bindgen-macro/ui-tests')
7 files changed, 167 insertions, 104 deletions
diff --git a/vendor/wasm-bindgen-macro/ui-tests/async-errors.stderr b/vendor/wasm-bindgen-macro/ui-tests/async-errors.stderr index 492492a18..c1fec077d 100644 --- a/vendor/wasm-bindgen-macro/ui-tests/async-errors.stderr +++ b/vendor/wasm-bindgen-macro/ui-tests/async-errors.stderr @@ -1,68 +1,68 @@ error[E0277]: the trait bound `Result<(), ()>: IntoJsResult` is not satisfied - --> ui-tests/async-errors.rs:30:1 - | -30 | #[wasm_bindgen] - | ^^^^^^^^^^^^^^^ the trait `IntoJsResult` is not implemented for `Result<(), ()>` - | - = help: the following implementations were found: - <Result<(), E> as IntoJsResult> - <Result<T, E> as IntoJsResult> + --> ui-tests/async-errors.rs:30:1 + | +30 | #[wasm_bindgen] + | ^^^^^^^^^^^^^^^ the trait `IntoJsResult` is not implemented for `Result<(), ()>` + | + = help: the following implementations were found: + <Result<(), E> as IntoJsResult> + <Result<T, E> as IntoJsResult> note: required by `into_js_result` - --> $WORKSPACE/src/lib.rs - | - | fn into_js_result(self) -> Result<JsValue, JsValue>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) + --> $WORKSPACE/src/lib.rs + | + | fn into_js_result(self) -> Result<JsValue, JsValue>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `Result<(), BadType>: IntoJsResult` is not satisfied - --> ui-tests/async-errors.rs:32:1 - | -32 | #[wasm_bindgen] - | ^^^^^^^^^^^^^^^ the trait `IntoJsResult` is not implemented for `Result<(), BadType>` - | - = help: the following implementations were found: - <Result<(), E> as IntoJsResult> - <Result<T, E> as IntoJsResult> + --> ui-tests/async-errors.rs:32:1 + | +32 | #[wasm_bindgen] + | ^^^^^^^^^^^^^^^ the trait `IntoJsResult` is not implemented for `Result<(), BadType>` + | + = help: the following implementations were found: + <Result<(), E> as IntoJsResult> + <Result<T, E> as IntoJsResult> note: required by `into_js_result` - --> $WORKSPACE/src/lib.rs - | - | fn into_js_result(self) -> Result<JsValue, JsValue>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) + --> $WORKSPACE/src/lib.rs + | + | fn into_js_result(self) -> Result<JsValue, JsValue>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `wasm_bindgen::JsValue: From<BadType>` is not satisfied - --> ui-tests/async-errors.rs:34:1 - | -34 | #[wasm_bindgen] - | ^^^^^^^^^^^^^^^ the trait `From<BadType>` is not implemented for `wasm_bindgen::JsValue` - | - = help: the following implementations were found: - <wasm_bindgen::JsValue as From<&'a String>> - <wasm_bindgen::JsValue as From<&'a T>> - <wasm_bindgen::JsValue as From<&'a str>> - <wasm_bindgen::JsValue as From<JsError>> - and 73 others - = note: required because of the requirements on the impl of `Into<wasm_bindgen::JsValue>` for `BadType` - = note: required because of the requirements on the impl of `IntoJsResult` for `BadType` + --> ui-tests/async-errors.rs:34:1 + | +34 | #[wasm_bindgen] + | ^^^^^^^^^^^^^^^ the trait `From<BadType>` is not implemented for `wasm_bindgen::JsValue` + | + = help: the following implementations were found: + <wasm_bindgen::JsValue as From<&'a String>> + <wasm_bindgen::JsValue as From<&'a T>> + <wasm_bindgen::JsValue as From<&'a str>> + <wasm_bindgen::JsValue as From<*const T>> + and $N others + = note: required because of the requirements on the impl of `Into<wasm_bindgen::JsValue>` for `BadType` + = note: required because of the requirements on the impl of `IntoJsResult` for `BadType` note: required by `into_js_result` - --> $WORKSPACE/src/lib.rs - | - | fn into_js_result(self) -> Result<JsValue, JsValue>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) + --> $WORKSPACE/src/lib.rs + | + | fn into_js_result(self) -> Result<JsValue, JsValue>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `Result<BadType, wasm_bindgen::JsValue>: IntoJsResult` is not satisfied - --> ui-tests/async-errors.rs:36:1 - | -36 | #[wasm_bindgen] - | ^^^^^^^^^^^^^^^ the trait `IntoJsResult` is not implemented for `Result<BadType, wasm_bindgen::JsValue>` - | - = help: the following implementations were found: - <Result<(), E> as IntoJsResult> - <Result<T, E> as IntoJsResult> + --> ui-tests/async-errors.rs:36:1 + | +36 | #[wasm_bindgen] + | ^^^^^^^^^^^^^^^ the trait `IntoJsResult` is not implemented for `Result<BadType, wasm_bindgen::JsValue>` + | + = help: the following implementations were found: + <Result<(), E> as IntoJsResult> + <Result<T, E> as IntoJsResult> note: required by `into_js_result` - --> $WORKSPACE/src/lib.rs - | - | fn into_js_result(self) -> Result<JsValue, JsValue>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) + --> $WORKSPACE/src/lib.rs + | + | fn into_js_result(self) -> Result<JsValue, JsValue>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/vendor/wasm-bindgen-macro/ui-tests/link-to.rs b/vendor/wasm-bindgen-macro/ui-tests/link-to.rs new file mode 100644 index 000000000..ce51c128e --- /dev/null +++ b/vendor/wasm-bindgen-macro/ui-tests/link-to.rs @@ -0,0 +1,32 @@ +fn good1() -> String { + wasm_bindgen::link_to!(inline_js = "console.log('Hello world!');") +} + +fn good2() -> String { + wasm_bindgen::link_to!(raw_module = "./foo.js") +} + +fn bad1() -> String { + wasm_bindgen::link_to!(module = "package/foo.js") +} + +fn bad2() -> String { + wasm_bindgen::link_to!(raw_module = "package/foo.js") +} + +fn bad3() -> String { + wasm_bindgen::link_to!(module = "/src/not-found.js") +} + +fn bad4() -> String { + wasm_bindgen::link_to!() +} + +fn bad5() -> String { + wasm_bindgen::link_to!( + inline_js = "console.log('Hello world!');", + js_namespace = foo + ) +} + +fn main() {} diff --git a/vendor/wasm-bindgen-macro/ui-tests/link-to.stderr b/vendor/wasm-bindgen-macro/ui-tests/link-to.stderr new file mode 100644 index 000000000..61aaec783 --- /dev/null +++ b/vendor/wasm-bindgen-macro/ui-tests/link-to.stderr @@ -0,0 +1,31 @@ +error: `link_to!` does not support module paths. + --> ui-tests/link-to.rs:10:37 + | +10 | wasm_bindgen::link_to!(module = "package/foo.js") + | ^^^^^^^^^^^^^^^^ + +error: `link_to!` does not support module paths. + --> ui-tests/link-to.rs:14:41 + | +14 | wasm_bindgen::link_to!(raw_module = "package/foo.js") + | ^^^^^^^^^^^^^^^^ + +error: failed to read file `$WORKSPACE/target/tests/trybuild/wasm-bindgen-macro/src/not-found.js`: No such file or directory (os error 2) + --> ui-tests/link-to.rs:18:37 + | +18 | wasm_bindgen::link_to!(module = "/src/not-found.js") + | ^^^^^^^^^^^^^^^^^^^ + +error: `link_to!` requires a module. + --> ui-tests/link-to.rs:22:5 + | +22 | wasm_bindgen::link_to!() + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: this error originates in the macro `wasm_bindgen::link_to` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: unused wasm_bindgen attribute + --> ui-tests/link-to.rs:28:9 + | +28 | js_namespace = foo + | ^^^^^^^^^^^^ diff --git a/vendor/wasm-bindgen-macro/ui-tests/missing-catch.stderr b/vendor/wasm-bindgen-macro/ui-tests/missing-catch.stderr index 4c20dbe76..d08553b1b 100644 --- a/vendor/wasm-bindgen-macro/ui-tests/missing-catch.stderr +++ b/vendor/wasm-bindgen-macro/ui-tests/missing-catch.stderr @@ -1,17 +1,17 @@ error[E0277]: the trait bound `Result<wasm_bindgen::JsValue, wasm_bindgen::JsValue>: FromWasmAbi` is not satisfied - --> $DIR/missing-catch.rs:6:9 - | -6 | pub fn foo() -> Result<JsValue, JsValue>; - | ^^^ the trait `FromWasmAbi` is not implemented for `Result<wasm_bindgen::JsValue, wasm_bindgen::JsValue>` - | + --> ui-tests/missing-catch.rs:6:9 + | +6 | pub fn foo() -> Result<JsValue, JsValue>; + | ^^^ the trait `FromWasmAbi` is not implemented for `Result<wasm_bindgen::JsValue, wasm_bindgen::JsValue>` + | note: required by a bound in `FromWasmAbi` - --> $DIR/traits.rs:23:1 - | -23 | / pub trait FromWasmAbi: WasmDescribe { -24 | | /// The wasm ABI type that this converts from when coming back out from the -25 | | /// ABI boundary. -26 | | type Abi: WasmAbi; -... | -35 | | unsafe fn from_abi(js: Self::Abi) -> Self; -36 | | } - | |_^ required by this bound in `FromWasmAbi` + --> $WORKSPACE/src/convert/traits.rs + | + | / pub trait FromWasmAbi: WasmDescribe { + | | /// The wasm ABI type that this converts from when coming back out from the + | | /// ABI boundary. + | | type Abi: WasmAbi; +... | + | | unsafe fn from_abi(js: Self::Abi) -> Self; + | | } + | |_^ required by this bound in `FromWasmAbi` diff --git a/vendor/wasm-bindgen-macro/ui-tests/start-function.rs b/vendor/wasm-bindgen-macro/ui-tests/start-function.rs index 65ad90bf2..6bc94c3be 100644 --- a/vendor/wasm-bindgen-macro/ui-tests/start-function.rs +++ b/vendor/wasm-bindgen-macro/ui-tests/start-function.rs @@ -1,33 +1,33 @@ use wasm_bindgen::prelude::*; #[wasm_bindgen(start)] -pub fn foo() {} +fn foo() {} #[wasm_bindgen(start)] -pub fn foo2(x: u32) {} +fn foo2(x: u32) {} #[wasm_bindgen(start)] -pub fn foo3<T>() {} +fn foo3<T>() {} #[wasm_bindgen(start)] -pub fn foo4() -> Result<(), JsValue> { Ok(()) } +fn foo4() -> Result<(), JsValue> { Ok(()) } #[wasm_bindgen(start)] -pub fn foo5() -> Result<JsValue, ()> { Err(()) } +fn foo5() -> Result<JsValue, ()> { Err(()) } #[wasm_bindgen(start)] -pub fn foo6() -> Result<JsValue, JsValue> { Ok(JsValue::from(1u32)) } +fn foo6() -> Result<JsValue, JsValue> { Ok(JsValue::from(1u32)) } #[wasm_bindgen(start)] -pub async fn foo_async1() {} +async fn foo_async1() {} #[wasm_bindgen(start)] -pub async fn foo_async2() -> Result<(), JsValue> { Ok(()) } +async fn foo_async2() -> Result<(), JsValue> { Ok(()) } #[wasm_bindgen(start)] -pub async fn foo_async3() -> Result<JsValue, ()> { Err(()) } +async fn foo_async3() -> Result<JsValue, ()> { Err(()) } #[wasm_bindgen(start)] -pub async fn foo_async4() -> Result<JsValue, JsValue> { Ok(JsValue::from(1u32)) } +async fn foo_async4() -> Result<JsValue, JsValue> { Ok(JsValue::from(1u32)) } fn main() {} diff --git a/vendor/wasm-bindgen-macro/ui-tests/start-function.stderr b/vendor/wasm-bindgen-macro/ui-tests/start-function.stderr index 8f459863d..aac6fccf0 100644 --- a/vendor/wasm-bindgen-macro/ui-tests/start-function.stderr +++ b/vendor/wasm-bindgen-macro/ui-tests/start-function.stderr @@ -1,14 +1,14 @@ error: the start function cannot have arguments - --> ui-tests/start-function.rs:7:13 + --> ui-tests/start-function.rs:7:9 | -7 | pub fn foo2(x: u32) {} - | ^^^^^^ +7 | fn foo2(x: u32) {} + | ^^^^^^ error: the start function cannot have generics - --> ui-tests/start-function.rs:10:12 + --> ui-tests/start-function.rs:10:8 | -10 | pub fn foo3<T>() {} - | ^^^ +10 | fn foo3<T>() {} + | ^^^ error[E0277]: the trait bound `Result<wasm_bindgen::JsValue, ()>: wasm_bindgen::__rt::Start` is not satisfied --> ui-tests/start-function.rs:15:1 diff --git a/vendor/wasm-bindgen-macro/ui-tests/traits-not-implemented.stderr b/vendor/wasm-bindgen-macro/ui-tests/traits-not-implemented.stderr index 7b0f90f57..aaad988af 100644 --- a/vendor/wasm-bindgen-macro/ui-tests/traits-not-implemented.stderr +++ b/vendor/wasm-bindgen-macro/ui-tests/traits-not-implemented.stderr @@ -1,18 +1,18 @@ error[E0277]: the trait bound `A: IntoWasmAbi` is not satisfied - --> $DIR/traits-not-implemented.rs:5:1 - | -5 | #[wasm_bindgen] - | ^^^^^^^^^^^^^^^ the trait `IntoWasmAbi` is not implemented for `A` - | + --> ui-tests/traits-not-implemented.rs:5:1 + | +5 | #[wasm_bindgen] + | ^^^^^^^^^^^^^^^ the trait `IntoWasmAbi` is not implemented for `A` + | note: required by a bound in `IntoWasmAbi` - --> $DIR/traits.rs:9:1 - | -9 | / pub trait IntoWasmAbi: WasmDescribe { -10 | | /// The wasm ABI type that this converts into when crossing the ABI -11 | | /// boundary. -12 | | type Abi: WasmAbi; -... | -16 | | fn into_abi(self) -> Self::Abi; -17 | | } - | |_^ required by this bound in `IntoWasmAbi` - = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) + --> $WORKSPACE/src/convert/traits.rs + | + | / pub trait IntoWasmAbi: WasmDescribe { + | | /// The wasm ABI type that this converts into when crossing the ABI + | | /// boundary. + | | type Abi: WasmAbi; +... | + | | fn into_abi(self) -> Self::Abi; + | | } + | |_^ required by this bound in `IntoWasmAbi` + = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) |