diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 12:41:35 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 12:41:35 +0000 |
commit | 7e5d7eea9c580ef4b41a765bde624af431942b96 (patch) | |
tree | 2c0d9ca12878fc4525650aa4e54d77a81a07cc09 /vendor/wasm-bindgen-macro | |
parent | Adding debian version 1.70.0+dfsg1-9. (diff) | |
download | rustc-7e5d7eea9c580ef4b41a765bde624af431942b96.tar.xz rustc-7e5d7eea9c580ef4b41a765bde624af431942b96.zip |
Merging upstream version 1.70.0+dfsg2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/wasm-bindgen-macro')
45 files changed, 1279 insertions, 0 deletions
diff --git a/vendor/wasm-bindgen-macro/.cargo-checksum.json b/vendor/wasm-bindgen-macro/.cargo-checksum.json new file mode 100644 index 000000000..b28610651 --- /dev/null +++ b/vendor/wasm-bindgen-macro/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{"Cargo.toml":"377c6fe534700370a86f95dffbd82e3cad703a69286dd927afac58bc8b9afc57","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"378f5840b258e2779c39418f3f2d7b2ba96f1c7917dd6be0713f88305dbda397","README.md":"ef5ffff199bf75993b81c3c1de8dbe19babb22b89170763323fa11a85c62f045","src/lib.rs":"2b63b3cf46acde23d9822773c231c110ffa1edf9697e308c90d2eb1bb41464f4","tests/ui.rs":"aed1b0f4e8c99b06657c54f3a74de4b3535ce567fb20e4d2fc6911b361c3d934","ui-tests/async-errors.rs":"f3ab249b3741b38c6213651a5cd36f8b9873bad34bd49d13b780d21bed47272b","ui-tests/async-errors.stderr":"68a547c3b7107c0ddcab4f15729752dee3af781203126daa3b350f2047093faf","ui-tests/attribute-fails-to-parse.rs":"c21c2a250534ca7e80fc462804efc0db8a71b6b0cdb0c57c5cab444d081f68de","ui-tests/attribute-fails-to-parse.stderr":"3bc77befbbe7e2d0744dd81067a75cb70c3f2d8bd9c60ec5bcb2dfb65fc1a593","ui-tests/bad-signatures.rs":"96b53e9327cc75747510b548b97cff86429532d5cdf65cc991211bca5646abc2","ui-tests/bad-signatures.stderr":"931e934ccbc43e4cee41a46ecaa3953c3ccdef69450519a838b9af428f75fa72","ui-tests/import-local.rs":"783ef9ebb792111ec7fd335cbc4f684381609c86c0af660fd5ab35cf04cacbf4","ui-tests/import-local.stderr":"6e90ad05c3783d7c69ff4e156458c63ee45ceb7ea8ebc38e1ca52e7f46e8bcf8","ui-tests/invalid-attr.rs":"603cf0bcb95a42a35e535a7d9577dc8c5e6175af4cd27d83fdf77cd6b67acf48","ui-tests/invalid-attr.stderr":"e1fd9450e16f1d672cb708bcbaf99a07f916c48d3e961c1dd1e92bd835d3ec53","ui-tests/invalid-enums.rs":"bf473e1bbafbcde82c946311e824d97bd1f941cfc5c1495025d8a7a513b90a19","ui-tests/invalid-enums.stderr":"ecd549ab69e7d7d645922857e2a83b7171f97a276afeb9f113407a4181b2b9e2","ui-tests/invalid-imports.rs":"452e9df87229ebea5442f384b0bd27a2c082d731a3b99fc7617e9a583392cf3a","ui-tests/invalid-imports.stderr":"4f59f109ec9d5acacf5f22f1467dca7d81e6dbabde95e7bd025ef330c275774a","ui-tests/invalid-items.rs":"ca919f7fe6c0d9fd4218ec43c85d7b43f478ed3042959479eb42adc23f4edf02","ui-tests/invalid-items.stderr":"a7392f1b918cac6eda3cefa5244dc555e4b6332836cab0bbd341b992672cd064","ui-tests/invalid-methods.rs":"c463bee9962d936ef2aeb4051ebc5558c0b7fefe6e459f3a325482763746969f","ui-tests/invalid-methods.stderr":"9666dcd88bc3824b7f7e75093f16a298cb3ba726cc67bc7bd70d698648201fe4","ui-tests/invalid-setter.rs":"db9666df889b58246a51ebc7d753e41ac4382475257a589499a4e886e6fbc45f","ui-tests/invalid-setter.stderr":"d1629836ec39727bfa4737538e9f991cda6fbaeb1c0f8c878cb13757e66daac5","ui-tests/missing-catch.rs":"705bf784db641b30131510b5c47192014e19aeeeb6f73ede1d5356ad2c29915c","ui-tests/missing-catch.stderr":"c51f9c535cfadc603f23fad5e96bb22d7733f0d063c0b365ae5f4a97e84c8ef1","ui-tests/non-public-function.rs":"0fe075b32c211870bcde0f7dce0eceaffb61a4f8a6ffbd90946a59d7d220343c","ui-tests/non-public-function.stderr":"c9f6f5123b6c3462b8952d6e468ed13c566635d4939b98c9098d2a713f5aa2df","ui-tests/pub-not-copy.rs":"1e50f0b63a6e6363b0926cf947b0492a9803ddb35370f32e733a32506df9b556","ui-tests/pub-not-copy.stderr":"1090980d08622552b82c13da82b4c26ce309314b6062f0c5443a65eff5255d00","ui-tests/start-function.rs":"479cb4389545ccf7c155677fe629c135e3374a3f622aab3c17a4db63abca1a55","ui-tests/start-function.stderr":"36b0ca2c38742bb6b999d8d1c302229c5b6176afedd73c3fc4a9da57c480613a","ui-tests/structural-and-final.rs":"1571b078a9d0be6c96ab97be10f1bf369dbb740f04fa312834f49a64130f8d30","ui-tests/structural-and-final.stderr":"cf21dec2851d3f667b93a317ba9e4657a623c49e8b779ea64669452297ba0a17","ui-tests/traits-not-implemented.rs":"3445e15b9c61f84a1f8d703a3a4fe2d2e2d85960ff6b2ac718644d97bf1564e1","ui-tests/traits-not-implemented.stderr":"cb291d21f427a1beee469cc32ea8704d58415272ac52f5b90c76c4f2bb823679","ui-tests/unknown-type-in-import.rs":"7fbc95bb82d0d60568b8daf27236418219c57447d1dc2e2e384e5f907bac3e3e","ui-tests/unknown-type-in-import.stderr":"2d213673be2dfcb6b56b9efacea9e968c5ae4faab9fabd6c5c66495008d5fe20","ui-tests/unused-attributes.rs":"7c20441c30e53376c9e72fcf82da0cc6e7462eec3087f9eb74f9682eaf7fb3e6","ui-tests/unused-attributes.stderr":"d4557e356289d0775d29b64797079c623e6d7db1ce319ee59cafb0de6d6a32eb","ui-tests/update-all-references.sh":"8b8dbf31e7ada1314956db7a20ab14b13af3ae246a6295afdc7dc96af8ec3773","ui-tests/update-references.sh":"65375c25981646e08e8589449a06be4505b1a2c9e10d35f650be4b1b495dff22"},"package":"052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810"}
\ No newline at end of file diff --git a/vendor/wasm-bindgen-macro/Cargo.toml b/vendor/wasm-bindgen-macro/Cargo.toml new file mode 100644 index 000000000..99d0e52a5 --- /dev/null +++ b/vendor/wasm-bindgen-macro/Cargo.toml @@ -0,0 +1,47 @@ +# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO +# +# When uploading crates to the registry Cargo will automatically +# "normalize" Cargo.toml files for maximal compatibility +# with all versions of Cargo and also rewrite `path` dependencies +# to registry (e.g., crates.io) dependencies. +# +# If you are reading this file be aware that the original Cargo.toml +# will likely look very different (and much more reasonable). +# See Cargo.toml.orig for the original contents. + +[package] +edition = "2018" +name = "wasm-bindgen-macro" +version = "0.2.83" +authors = ["The wasm-bindgen Developers"] +description = """ +Definition of the `#[wasm_bindgen]` attribute, an internal dependency +""" +homepage = "https://rustwasm.github.io/wasm-bindgen/" +documentation = "https://docs.rs/wasm-bindgen" +readme = "README.md" +license = "MIT/Apache-2.0" +repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/macro" + +[lib] +proc-macro = true + +[dependencies.quote] +version = "1.0" + +[dependencies.wasm-bindgen-macro-support] +version = "=0.2.83" + +[dev-dependencies.trybuild] +version = "1.0" + +[dev-dependencies.wasm-bindgen] +version = "0.2.83" + +[dev-dependencies.wasm-bindgen-futures] +version = "0.4.33" + +[features] +spans = ["wasm-bindgen-macro-support/spans"] +strict-macro = ["wasm-bindgen-macro-support/strict-macro"] +xxx_debug_only_print_generated_code = [] diff --git a/vendor/wasm-bindgen-macro/LICENSE-APACHE b/vendor/wasm-bindgen-macro/LICENSE-APACHE new file mode 100644 index 000000000..16fe87b06 --- /dev/null +++ b/vendor/wasm-bindgen-macro/LICENSE-APACHE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/vendor/wasm-bindgen-macro/LICENSE-MIT b/vendor/wasm-bindgen-macro/LICENSE-MIT new file mode 100644 index 000000000..39e0ed660 --- /dev/null +++ b/vendor/wasm-bindgen-macro/LICENSE-MIT @@ -0,0 +1,25 @@ +Copyright (c) 2014 Alex Crichton + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff --git a/vendor/wasm-bindgen-macro/README.md b/vendor/wasm-bindgen-macro/README.md new file mode 100644 index 000000000..353829869 --- /dev/null +++ b/vendor/wasm-bindgen-macro/README.md @@ -0,0 +1,28 @@ +# `wasm-bindgen-macro` + +Implementation of the `#[wasm_bindgen]` attribute. See the `wasm-bindgen` +documentation for more information about what this macro does. + +## Testing + +Testing of this macro is done through "ui tests" in the `ui-tests` subdirectory +of this crate. Each Rust file in this folder is compiled with the `wasm_bindgen` +crate, and the `*.stderr` file sitting next to it is the asserted output of the +compiler. If the output matches, the test passes, and if the output doesn't +match the test fails. Note that it is also considered a failure if a test +actually compiles successfully. + +To add a test: + +* Create `ui-tests/my-awesome-test.rs` +* Write an invalid `#[wasm_bindgen]` invocation, testing the error you're + generating +* Execute `cargo test -p ui-tests`, the test will fail +* From within the `ui-tests` folder, execute `./update-all-references.sh`. This + should create a `my-awesome-test.stderr` file. +* Inspect `my-awesome-test.stderr` to make sure it looks ok +* Rerun `cargo test -p ui-tests` and your tests should pass! + +Testing here is a work in progress, see +[#601](https://github.com/rustwasm/wasm-bindgen/issues/601) for more +information. diff --git a/vendor/wasm-bindgen-macro/src/lib.rs b/vendor/wasm-bindgen-macro/src/lib.rs new file mode 100644 index 000000000..c677aaf24 --- /dev/null +++ b/vendor/wasm-bindgen-macro/src/lib.rs @@ -0,0 +1,32 @@ +#![doc(html_root_url = "https://docs.rs/wasm-bindgen-macro/0.2")] + +extern crate proc_macro; + +use proc_macro::TokenStream; +use quote::quote; + +#[proc_macro_attribute] +pub fn wasm_bindgen(attr: TokenStream, input: TokenStream) -> TokenStream { + match wasm_bindgen_macro_support::expand(attr.into(), input.into()) { + Ok(tokens) => { + if cfg!(feature = "xxx_debug_only_print_generated_code") { + println!("{}", tokens); + } + tokens.into() + } + Err(diagnostic) => (quote! { #diagnostic }).into(), + } +} + +#[proc_macro_attribute] +pub fn __wasm_bindgen_class_marker(attr: TokenStream, input: TokenStream) -> TokenStream { + match wasm_bindgen_macro_support::expand_class_marker(attr.into(), input.into()) { + Ok(tokens) => { + if cfg!(feature = "xxx_debug_only_print_generated_code") { + println!("{}", tokens); + } + tokens.into() + } + Err(diagnostic) => (quote! { #diagnostic }).into(), + } +} diff --git a/vendor/wasm-bindgen-macro/tests/ui.rs b/vendor/wasm-bindgen-macro/tests/ui.rs new file mode 100644 index 000000000..da15c9214 --- /dev/null +++ b/vendor/wasm-bindgen-macro/tests/ui.rs @@ -0,0 +1,5 @@ +#[test] +fn ui() { + let t = trybuild::TestCases::new(); + t.compile_fail("ui-tests/*.rs"); +} diff --git a/vendor/wasm-bindgen-macro/ui-tests/async-errors.rs b/vendor/wasm-bindgen-macro/ui-tests/async-errors.rs new file mode 100644 index 000000000..22c5107e4 --- /dev/null +++ b/vendor/wasm-bindgen-macro/ui-tests/async-errors.rs @@ -0,0 +1,40 @@ +#![allow(unreachable_code)] +use wasm_bindgen::prelude::*; + +#[wasm_bindgen] +pub struct MyType; + +#[wasm_bindgen] +pub async fn good1() { loop {} } +#[wasm_bindgen] +pub async fn good2() -> JsValue { loop {} } +#[wasm_bindgen] +pub async fn good3() -> u32 { loop {} } +#[wasm_bindgen] +pub async fn good4() -> MyType { loop {} } +#[wasm_bindgen] +pub async fn good5() -> Result<(), JsValue> { loop {} } +#[wasm_bindgen] +pub async fn good6() -> Result<JsValue, JsValue> { loop {} } +#[wasm_bindgen] +pub async fn good7() -> Result<u32, JsValue> { loop {} } +#[wasm_bindgen] +pub async fn good8() -> Result<MyType, JsValue> { loop {} } +#[wasm_bindgen] +pub async fn good9() -> Result<MyType, u32> { loop {} } +#[wasm_bindgen] +pub async fn good10() -> Result<MyType, MyType> { loop {} } + +pub struct BadType; + +#[wasm_bindgen] +pub async fn bad1() -> Result<(), ()> { loop {} } +#[wasm_bindgen] +pub async fn bad2() -> Result<(), BadType> { loop {} } +#[wasm_bindgen] +pub async fn bad3() -> BadType { loop {} } +#[wasm_bindgen] +pub async fn bad4() -> Result<BadType, JsValue> { loop {} } + + +fn main() {} diff --git a/vendor/wasm-bindgen-macro/ui-tests/async-errors.stderr b/vendor/wasm-bindgen-macro/ui-tests/async-errors.stderr new file mode 100644 index 000000000..492492a18 --- /dev/null +++ b/vendor/wasm-bindgen-macro/ui-tests/async-errors.stderr @@ -0,0 +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> +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) + +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> +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) + +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` +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) + +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> +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) diff --git a/vendor/wasm-bindgen-macro/ui-tests/attribute-fails-to-parse.rs b/vendor/wasm-bindgen-macro/ui-tests/attribute-fails-to-parse.rs new file mode 100644 index 000000000..2d5b34bce --- /dev/null +++ b/vendor/wasm-bindgen-macro/ui-tests/attribute-fails-to-parse.rs @@ -0,0 +1,6 @@ +use wasm_bindgen::prelude::*; + +#[wasm_bindgen(nonsense)] +pub fn foo() {} + +fn main() {} diff --git a/vendor/wasm-bindgen-macro/ui-tests/attribute-fails-to-parse.stderr b/vendor/wasm-bindgen-macro/ui-tests/attribute-fails-to-parse.stderr new file mode 100644 index 000000000..dfe9ecf0e --- /dev/null +++ b/vendor/wasm-bindgen-macro/ui-tests/attribute-fails-to-parse.stderr @@ -0,0 +1,5 @@ +error: unknown attribute + --> $DIR/attribute-fails-to-parse.rs:3:16 + | +3 | #[wasm_bindgen(nonsense)] + | ^^^^^^^^ diff --git a/vendor/wasm-bindgen-macro/ui-tests/bad-signatures.rs b/vendor/wasm-bindgen-macro/ui-tests/bad-signatures.rs new file mode 100644 index 000000000..de2c0e156 --- /dev/null +++ b/vendor/wasm-bindgen-macro/ui-tests/bad-signatures.rs @@ -0,0 +1,13 @@ +use wasm_bindgen::prelude::*; + +#[wasm_bindgen] +pub fn foo() -> &u32 {} + +#[wasm_bindgen] +extern "C" { + fn foo(Foo(x): Foo); + + fn foo() -> &u32; +} + +fn main() {} diff --git a/vendor/wasm-bindgen-macro/ui-tests/bad-signatures.stderr b/vendor/wasm-bindgen-macro/ui-tests/bad-signatures.stderr new file mode 100644 index 000000000..48d8d40dd --- /dev/null +++ b/vendor/wasm-bindgen-macro/ui-tests/bad-signatures.stderr @@ -0,0 +1,17 @@ +error: cannot return a borrowed ref with #[wasm_bindgen] + --> $DIR/bad-signatures.rs:4:17 + | +4 | pub fn foo() -> &u32 {} + | ^^^^ + +error: unsupported pattern in #[wasm_bindgen] imported function + --> $DIR/bad-signatures.rs:8:12 + | +8 | fn foo(Foo(x): Foo); + | ^^^^^^ + +error: cannot return references in #[wasm_bindgen] imports yet + --> $DIR/bad-signatures.rs:10:17 + | +10 | fn foo() -> &u32; + | ^^^^ diff --git a/vendor/wasm-bindgen-macro/ui-tests/import-local.rs b/vendor/wasm-bindgen-macro/ui-tests/import-local.rs new file mode 100644 index 000000000..ff86375bb --- /dev/null +++ b/vendor/wasm-bindgen-macro/ui-tests/import-local.rs @@ -0,0 +1,13 @@ +use wasm_bindgen::prelude::*; + +#[wasm_bindgen(module = "./foo.js")] +extern { + fn wut(); +} + +#[wasm_bindgen(module = "../foo.js")] +extern { + fn wut2(); +} + +fn main() {} diff --git a/vendor/wasm-bindgen-macro/ui-tests/import-local.stderr b/vendor/wasm-bindgen-macro/ui-tests/import-local.stderr new file mode 100644 index 000000000..707b30fcc --- /dev/null +++ b/vendor/wasm-bindgen-macro/ui-tests/import-local.stderr @@ -0,0 +1,11 @@ +error: relative module paths aren't supported yet + --> $DIR/import-local.rs:3:25 + | +3 | #[wasm_bindgen(module = "./foo.js")] + | ^^^^^^^^^^ + +error: relative module paths aren't supported yet + --> $DIR/import-local.rs:8:25 + | +8 | #[wasm_bindgen(module = "../foo.js")] + | ^^^^^^^^^^^ diff --git a/vendor/wasm-bindgen-macro/ui-tests/invalid-attr.rs b/vendor/wasm-bindgen-macro/ui-tests/invalid-attr.rs new file mode 100644 index 000000000..188a1c833 --- /dev/null +++ b/vendor/wasm-bindgen-macro/ui-tests/invalid-attr.rs @@ -0,0 +1,15 @@ +use wasm_bindgen::prelude::*; + +#[wasm_bindgen(x)] +pub fn foo() {} + +#[wasm_bindgen] +extern "C" { + #[wasm_bindgen(y)] + fn bar(); + + #[wasm_bindgen { }] + fn bar(); +} + +fn main() {} diff --git a/vendor/wasm-bindgen-macro/ui-tests/invalid-attr.stderr b/vendor/wasm-bindgen-macro/ui-tests/invalid-attr.stderr new file mode 100644 index 000000000..47264acd3 --- /dev/null +++ b/vendor/wasm-bindgen-macro/ui-tests/invalid-attr.stderr @@ -0,0 +1,17 @@ +error: unknown attribute + --> $DIR/invalid-attr.rs:3:16 + | +3 | #[wasm_bindgen(x)] + | ^ + +error: unknown attribute + --> $DIR/invalid-attr.rs:8:20 + | +8 | #[wasm_bindgen(y)] + | ^ + +error: malformed #[wasm_bindgen] attribute + --> $DIR/invalid-attr.rs:11:5 + | +11 | #[wasm_bindgen { }] + | ^^^^^^^^^^^^^^^^^^^^ diff --git a/vendor/wasm-bindgen-macro/ui-tests/invalid-enums.rs b/vendor/wasm-bindgen-macro/ui-tests/invalid-enums.rs new file mode 100644 index 000000000..abea3fa67 --- /dev/null +++ b/vendor/wasm-bindgen-macro/ui-tests/invalid-enums.rs @@ -0,0 +1,21 @@ +use wasm_bindgen::prelude::*; + +#[wasm_bindgen] +enum A {} + +#[wasm_bindgen] +pub enum B { + D(u32), +} + +#[wasm_bindgen] +pub enum C { + X = 1 + 3, +} + +#[wasm_bindgen] +pub enum D { + X = 4294967296, +} + +fn main() {} diff --git a/vendor/wasm-bindgen-macro/ui-tests/invalid-enums.stderr b/vendor/wasm-bindgen-macro/ui-tests/invalid-enums.stderr new file mode 100644 index 000000000..7ad51f9a5 --- /dev/null +++ b/vendor/wasm-bindgen-macro/ui-tests/invalid-enums.stderr @@ -0,0 +1,23 @@ +error: cannot export empty enums to JS + --> $DIR/invalid-enums.rs:4:1 + | +4 | enum A {} + | ^^^^^^^^^ + +error: only C-Style enums allowed with #[wasm_bindgen] + --> $DIR/invalid-enums.rs:8:6 + | +8 | D(u32), + | ^^^^^ + +error: enums with #[wasm_bindgen] may only have number literal values + --> $DIR/invalid-enums.rs:13:9 + | +13 | X = 1 + 3, + | ^^^^^ + +error: enums with #[wasm_bindgen] can only support numbers that can be represented as u32 + --> $DIR/invalid-enums.rs:18:9 + | +18 | X = 4294967296, + | ^^^^^^^^^^ diff --git a/vendor/wasm-bindgen-macro/ui-tests/invalid-imports.rs b/vendor/wasm-bindgen-macro/ui-tests/invalid-imports.rs new file mode 100644 index 000000000..ecd223b70 --- /dev/null +++ b/vendor/wasm-bindgen-macro/ui-tests/invalid-imports.rs @@ -0,0 +1,41 @@ +use wasm_bindgen::prelude::*; + +#[wasm_bindgen] +extern "C" { + type A; + + fn f() -> &'static u32; + + #[wasm_bindgen(method)] + fn f1(); + #[wasm_bindgen(method)] + fn f2(x: u32); + #[wasm_bindgen(method)] + fn f3(x: &&u32); + #[wasm_bindgen(method)] + fn f4(x: &foo::Bar); + #[wasm_bindgen(method)] + fn f4(x: &::Bar); + #[wasm_bindgen(method)] + fn f4(x: &Bar<T>); + #[wasm_bindgen(method)] + fn f4(x: &Fn(T)); + + #[wasm_bindgen(constructor)] + fn f(); + #[wasm_bindgen(constructor)] + fn f() -> ::Bar; + #[wasm_bindgen(constructor)] + fn f() -> &Bar; + + #[wasm_bindgen(catch)] + fn f() -> u32; + #[wasm_bindgen(catch)] + fn f() -> &u32; + #[wasm_bindgen(catch)] + fn f() -> Result<>; + #[wasm_bindgen(catch)] + fn f() -> Result<'a>; +} + +fn main() {} diff --git a/vendor/wasm-bindgen-macro/ui-tests/invalid-imports.stderr b/vendor/wasm-bindgen-macro/ui-tests/invalid-imports.stderr new file mode 100644 index 000000000..aeb09c574 --- /dev/null +++ b/vendor/wasm-bindgen-macro/ui-tests/invalid-imports.stderr @@ -0,0 +1,71 @@ +error: it is currently not sound to use lifetimes in function signatures + --> $DIR/invalid-imports.rs:7:16 + | +7 | fn f() -> &'static u32; + | ^^^^^^^ + +error: imported methods must have at least one argument + --> $DIR/invalid-imports.rs:10:5 + | +10 | fn f1(); + | ^^^^^^^^ + +error: first argument of method must be a shared reference + --> $DIR/invalid-imports.rs:12:14 + | +12 | fn f2(x: u32); + | ^^^ + +error: first argument of method must be a path + --> $DIR/invalid-imports.rs:14:14 + | +14 | fn f3(x: &&u32); + | ^^^^^ + +error: paths with type parameters are not supported yet + --> $DIR/invalid-imports.rs:20:15 + | +20 | fn f4(x: &Bar<T>); + | ^^^^^^ + +error: paths with type parameters are not supported yet + --> $DIR/invalid-imports.rs:22:15 + | +22 | fn f4(x: &Fn(T)); + | ^^^^^ + +error: constructor returns must be bare types + --> $DIR/invalid-imports.rs:25:5 + | +25 | fn f(); + | ^^^^^^^ + +error: return value of constructor must be a bare path + --> $DIR/invalid-imports.rs:29:5 + | +29 | fn f() -> &Bar; + | ^^^^^^^^^^^^^^^ + +error: must be Result<...> + --> $DIR/invalid-imports.rs:32:15 + | +32 | fn f() -> u32; + | ^^^ + +error: must be Result<...> + --> $DIR/invalid-imports.rs:34:15 + | +34 | fn f() -> &u32; + | ^^^^ + +error: must have at least one generic parameter + --> $DIR/invalid-imports.rs:36:15 + | +36 | fn f() -> Result<>; + | ^^^^^^^^ + +error: it is currently not sound to use lifetimes in function signatures + --> $DIR/invalid-imports.rs:38:22 + | +38 | fn f() -> Result<'a>; + | ^^ diff --git a/vendor/wasm-bindgen-macro/ui-tests/invalid-items.rs b/vendor/wasm-bindgen-macro/ui-tests/invalid-items.rs new file mode 100644 index 000000000..f1a356331 --- /dev/null +++ b/vendor/wasm-bindgen-macro/ui-tests/invalid-items.rs @@ -0,0 +1,33 @@ +use wasm_bindgen::prelude::*; + +#[wasm_bindgen] +fn foo() {} + +#[wasm_bindgen] +pub const fn foo2() {} + +#[wasm_bindgen] +struct Foo<T>(T); + +#[wasm_bindgen] +extern "C" { + static mut FOO: u32; + + pub fn foo3(x: i32, ...); +} + +#[wasm_bindgen] +extern "system" { +} + +#[wasm_bindgen] +pub fn foo4<T>() {} +#[wasm_bindgen] +pub fn foo5<'a>() {} +#[wasm_bindgen] +pub fn foo6<'a, T>() {} + +#[wasm_bindgen] +trait X {} + +fn main() {} diff --git a/vendor/wasm-bindgen-macro/ui-tests/invalid-items.stderr b/vendor/wasm-bindgen-macro/ui-tests/invalid-items.stderr new file mode 100644 index 000000000..1800ade29 --- /dev/null +++ b/vendor/wasm-bindgen-macro/ui-tests/invalid-items.stderr @@ -0,0 +1,59 @@ +error: can only #[wasm_bindgen] public functions + --> $DIR/invalid-items.rs:4:1 + | +4 | fn foo() {} + | ^^^^^^^^^^^ + +error: can only #[wasm_bindgen] non-const functions + --> $DIR/invalid-items.rs:7:5 + | +7 | pub const fn foo2() {} + | ^^^^^ + +error: structs with #[wasm_bindgen] cannot have lifetime or type parameters currently + --> $DIR/invalid-items.rs:10:11 + | +10 | struct Foo<T>(T); + | ^^^ + +error: cannot import mutable globals yet + --> $DIR/invalid-items.rs:14:12 + | +14 | static mut FOO: u32; + | ^^^ + +error: can't #[wasm_bindgen] variadic functions + --> $DIR/invalid-items.rs:16:25 + | +16 | pub fn foo3(x: i32, ...); + | ^^^ + +error: only foreign mods with the `C` ABI are allowed + --> $DIR/invalid-items.rs:20:8 + | +20 | extern "system" { + | ^^^^^^^^ + +error: can't #[wasm_bindgen] functions with lifetime or type parameters + --> $DIR/invalid-items.rs:24:12 + | +24 | pub fn foo4<T>() {} + | ^^^ + +error: can't #[wasm_bindgen] functions with lifetime or type parameters + --> $DIR/invalid-items.rs:26:12 + | +26 | pub fn foo5<'a>() {} + | ^^^^ + +error: can't #[wasm_bindgen] functions with lifetime or type parameters + --> $DIR/invalid-items.rs:28:12 + | +28 | 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:31:1 + | +31 | trait X {} + | ^^^^^^^^^^ diff --git a/vendor/wasm-bindgen-macro/ui-tests/invalid-methods.rs b/vendor/wasm-bindgen-macro/ui-tests/invalid-methods.rs new file mode 100644 index 000000000..bd69e6d31 --- /dev/null +++ b/vendor/wasm-bindgen-macro/ui-tests/invalid-methods.rs @@ -0,0 +1,42 @@ +use wasm_bindgen::prelude::*; + +#[wasm_bindgen] +pub struct A; + +#[wasm_bindgen] +default impl A { +} + +#[wasm_bindgen] +unsafe impl A { +} + +#[wasm_bindgen] +impl Clone for A { +} + +#[wasm_bindgen] +impl<T> A { +} + +#[wasm_bindgen] +impl &'static A { +} + +macro_rules! x { () => () } + +#[wasm_bindgen] +impl A { + const X: u32 = 3; + type Y = u32; + x!(); + + // pub default fn foo() {} // TODO: compiler's pretty printer totally broken +} + +#[wasm_bindgen] +impl A { + pub const fn foo() {} +} + +fn main() {} diff --git a/vendor/wasm-bindgen-macro/ui-tests/invalid-methods.stderr b/vendor/wasm-bindgen-macro/ui-tests/invalid-methods.stderr new file mode 100644 index 000000000..a785fc1ff --- /dev/null +++ b/vendor/wasm-bindgen-macro/ui-tests/invalid-methods.stderr @@ -0,0 +1,61 @@ +error: #[wasm_bindgen] default impls are not supported + --> $DIR/invalid-methods.rs:7:1 + | +7 | default impl A { + | ^^^^^^^ + +error: #[wasm_bindgen] unsafe impls are not supported + --> $DIR/invalid-methods.rs:11:1 + | +11 | unsafe impl A { + | ^^^^^^ + +error: #[wasm_bindgen] trait impls are not supported + --> $DIR/invalid-methods.rs:15:6 + | +15 | impl Clone for A { + | ^^^^^ + +error: #[wasm_bindgen] generic impls aren't supported + --> $DIR/invalid-methods.rs:19:5 + | +19 | impl<T> A { + | ^^^ + +error: unsupported self type in #[wasm_bindgen] impl + --> $DIR/invalid-methods.rs:23:6 + | +23 | impl &'static A { + | ^^^^^^^^^^ + +error: const definitions aren't supported with #[wasm_bindgen] + --> $DIR/invalid-methods.rs:30:5 + | +30 | const X: u32 = 3; + | ^^^^^^^^^^^^^^^^^ + +error: type definitions in impls aren't supported with #[wasm_bindgen] + --> $DIR/invalid-methods.rs:31:5 + | +31 | type Y = u32; + | ^^^^^^^^^^^^^ + +error: macros in impls aren't supported + --> $DIR/invalid-methods.rs:32:5 + | +32 | x!(); + | ^^^^^ + +error: can only #[wasm_bindgen] non-const functions + --> $DIR/invalid-methods.rs:39:9 + | +39 | pub const fn foo() {} + | ^^^^^ + +warning: unused macro definition + --> $DIR/invalid-methods.rs:26:1 + | +26 | macro_rules! x { () => () } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `#[warn(unused_macros)]` on by default diff --git a/vendor/wasm-bindgen-macro/ui-tests/invalid-setter.rs b/vendor/wasm-bindgen-macro/ui-tests/invalid-setter.rs new file mode 100644 index 000000000..42d83879e --- /dev/null +++ b/vendor/wasm-bindgen-macro/ui-tests/invalid-setter.rs @@ -0,0 +1,18 @@ + +use wasm_bindgen::prelude::*; + +#[wasm_bindgen] +extern "C" { + type A; + + #[wasm_bindgen(setter, method)] + fn a(this: &A, b: i32); + + #[wasm_bindgen(setter = x, method)] + fn b(this: &A, b: i32); + + #[wasm_bindgen(setter, method, js_name = x)] + fn c(this: &A, b: i32); +} + +fn main() {} diff --git a/vendor/wasm-bindgen-macro/ui-tests/invalid-setter.stderr b/vendor/wasm-bindgen-macro/ui-tests/invalid-setter.stderr new file mode 100644 index 000000000..77e1509e9 --- /dev/null +++ b/vendor/wasm-bindgen-macro/ui-tests/invalid-setter.stderr @@ -0,0 +1,5 @@ +error: setters must start with `set_`, found: a + --> $DIR/invalid-setter.rs:9:8 + | +9 | fn a(this: &A, b: i32); + | ^ diff --git a/vendor/wasm-bindgen-macro/ui-tests/missing-catch.rs b/vendor/wasm-bindgen-macro/ui-tests/missing-catch.rs new file mode 100644 index 000000000..962e2fad1 --- /dev/null +++ b/vendor/wasm-bindgen-macro/ui-tests/missing-catch.rs @@ -0,0 +1,9 @@ +use wasm_bindgen::prelude::*; + +#[wasm_bindgen] +extern "C" { + #[wasm_bindgen] + pub fn foo() -> Result<JsValue, JsValue>; +} + +fn main() {} diff --git a/vendor/wasm-bindgen-macro/ui-tests/missing-catch.stderr b/vendor/wasm-bindgen-macro/ui-tests/missing-catch.stderr new file mode 100644 index 000000000..4c20dbe76 --- /dev/null +++ b/vendor/wasm-bindgen-macro/ui-tests/missing-catch.stderr @@ -0,0 +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>` + | +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` diff --git a/vendor/wasm-bindgen-macro/ui-tests/non-public-function.rs b/vendor/wasm-bindgen-macro/ui-tests/non-public-function.rs new file mode 100644 index 000000000..5f2e55874 --- /dev/null +++ b/vendor/wasm-bindgen-macro/ui-tests/non-public-function.rs @@ -0,0 +1,6 @@ +use wasm_bindgen::prelude::*; + +#[wasm_bindgen] +fn foo() {} + +fn main() {} diff --git a/vendor/wasm-bindgen-macro/ui-tests/non-public-function.stderr b/vendor/wasm-bindgen-macro/ui-tests/non-public-function.stderr new file mode 100644 index 000000000..02f2a329f --- /dev/null +++ b/vendor/wasm-bindgen-macro/ui-tests/non-public-function.stderr @@ -0,0 +1,5 @@ +error: can only #[wasm_bindgen] public functions + --> $DIR/non-public-function.rs:4:1 + | +4 | fn foo() {} + | ^^^^^^^^^^^ diff --git a/vendor/wasm-bindgen-macro/ui-tests/pub-not-copy.rs b/vendor/wasm-bindgen-macro/ui-tests/pub-not-copy.rs new file mode 100644 index 000000000..b5f6b0cfb --- /dev/null +++ b/vendor/wasm-bindgen-macro/ui-tests/pub-not-copy.rs @@ -0,0 +1,8 @@ +use wasm_bindgen::prelude::*; + +#[wasm_bindgen] +pub struct A { + pub field: String, +} + +fn main() {} diff --git a/vendor/wasm-bindgen-macro/ui-tests/pub-not-copy.stderr b/vendor/wasm-bindgen-macro/ui-tests/pub-not-copy.stderr new file mode 100644 index 000000000..0cb088cd1 --- /dev/null +++ b/vendor/wasm-bindgen-macro/ui-tests/pub-not-copy.stderr @@ -0,0 +1,12 @@ +error[E0277]: the trait bound `String: std::marker::Copy` is not satisfied + --> $DIR/pub-not-copy.rs:5:16 + | +5 | pub field: String, + | ^^^^^^ the trait `std::marker::Copy` is not implemented for `String` + | +note: required by a bound in `assert_copy` + --> $DIR/pub-not-copy.rs:3:1 + | +3 | #[wasm_bindgen] + | ^^^^^^^^^^^^^^^ required by this bound in `assert_copy` + = 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/start-function.rs b/vendor/wasm-bindgen-macro/ui-tests/start-function.rs new file mode 100644 index 000000000..65ad90bf2 --- /dev/null +++ b/vendor/wasm-bindgen-macro/ui-tests/start-function.rs @@ -0,0 +1,33 @@ +use wasm_bindgen::prelude::*; + +#[wasm_bindgen(start)] +pub fn foo() {} + +#[wasm_bindgen(start)] +pub fn foo2(x: u32) {} + +#[wasm_bindgen(start)] +pub fn foo3<T>() {} + +#[wasm_bindgen(start)] +pub fn foo4() -> Result<(), JsValue> { Ok(()) } + +#[wasm_bindgen(start)] +pub fn foo5() -> Result<JsValue, ()> { Err(()) } + +#[wasm_bindgen(start)] +pub fn foo6() -> Result<JsValue, JsValue> { Ok(JsValue::from(1u32)) } + +#[wasm_bindgen(start)] +pub async fn foo_async1() {} + +#[wasm_bindgen(start)] +pub async fn foo_async2() -> Result<(), JsValue> { Ok(()) } + +#[wasm_bindgen(start)] +pub async fn foo_async3() -> Result<JsValue, ()> { Err(()) } + +#[wasm_bindgen(start)] +pub 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 new file mode 100644 index 000000000..8f459863d --- /dev/null +++ b/vendor/wasm-bindgen-macro/ui-tests/start-function.stderr @@ -0,0 +1,71 @@ +error: the start function cannot have arguments + --> ui-tests/start-function.rs:7:13 + | +7 | pub fn foo2(x: u32) {} + | ^^^^^^ + +error: the start function cannot have generics + --> ui-tests/start-function.rs:10:12 + | +10 | pub 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 + | +15 | #[wasm_bindgen(start)] + | ^^^^^^^^^^^^^^^^^^^^^^ the trait `wasm_bindgen::__rt::Start` is not implemented for `Result<wasm_bindgen::JsValue, ()>` + | + = help: the following implementations were found: + <Result<(), E> as wasm_bindgen::__rt::Start> +note: required by `start` + --> $WORKSPACE/src/lib.rs + | + | fn start(self); + | ^^^^^^^^^^^^^^^ + = 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<wasm_bindgen::JsValue, wasm_bindgen::JsValue>: wasm_bindgen::__rt::Start` is not satisfied + --> ui-tests/start-function.rs:18:1 + | +18 | #[wasm_bindgen(start)] + | ^^^^^^^^^^^^^^^^^^^^^^ the trait `wasm_bindgen::__rt::Start` is not implemented for `Result<wasm_bindgen::JsValue, wasm_bindgen::JsValue>` + | + = help: the following implementations were found: + <Result<(), E> as wasm_bindgen::__rt::Start> +note: required by `start` + --> $WORKSPACE/src/lib.rs + | + | fn start(self); + | ^^^^^^^^^^^^^^^ + = 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<wasm_bindgen::JsValue, ()>: wasm_bindgen::__rt::Start` is not satisfied + --> ui-tests/start-function.rs:27:1 + | +27 | #[wasm_bindgen(start)] + | ^^^^^^^^^^^^^^^^^^^^^^ the trait `wasm_bindgen::__rt::Start` is not implemented for `Result<wasm_bindgen::JsValue, ()>` + | + = help: the following implementations were found: + <Result<(), E> as wasm_bindgen::__rt::Start> +note: required by `start` + --> $WORKSPACE/src/lib.rs + | + | fn start(self); + | ^^^^^^^^^^^^^^^ + = 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<wasm_bindgen::JsValue, wasm_bindgen::JsValue>: wasm_bindgen::__rt::Start` is not satisfied + --> ui-tests/start-function.rs:30:1 + | +30 | #[wasm_bindgen(start)] + | ^^^^^^^^^^^^^^^^^^^^^^ the trait `wasm_bindgen::__rt::Start` is not implemented for `Result<wasm_bindgen::JsValue, wasm_bindgen::JsValue>` + | + = help: the following implementations were found: + <Result<(), E> as wasm_bindgen::__rt::Start> +note: required by `start` + --> $WORKSPACE/src/lib.rs + | + | fn start(self); + | ^^^^^^^^^^^^^^^ + = 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/structural-and-final.rs b/vendor/wasm-bindgen-macro/ui-tests/structural-and-final.rs new file mode 100644 index 000000000..5c5a4ecce --- /dev/null +++ b/vendor/wasm-bindgen-macro/ui-tests/structural-and-final.rs @@ -0,0 +1,11 @@ +use wasm_bindgen::prelude::*; + +#[wasm_bindgen] +extern "C" { + type Foo; + + #[wasm_bindgen(method, structural, final)] + fn bar(this: &Foo); +} + +fn main() {} diff --git a/vendor/wasm-bindgen-macro/ui-tests/structural-and-final.stderr b/vendor/wasm-bindgen-macro/ui-tests/structural-and-final.stderr new file mode 100644 index 000000000..8c8a70387 --- /dev/null +++ b/vendor/wasm-bindgen-macro/ui-tests/structural-and-final.stderr @@ -0,0 +1,5 @@ +error: cannot specify both `structural` and `final` + --> $DIR/structural-and-final.rs:7:40 + | +7 | #[wasm_bindgen(method, structural, final)] + | ^^^^^ diff --git a/vendor/wasm-bindgen-macro/ui-tests/traits-not-implemented.rs b/vendor/wasm-bindgen-macro/ui-tests/traits-not-implemented.rs new file mode 100644 index 000000000..56c5900c0 --- /dev/null +++ b/vendor/wasm-bindgen-macro/ui-tests/traits-not-implemented.rs @@ -0,0 +1,11 @@ +use wasm_bindgen::prelude::*; + +struct A; + +#[wasm_bindgen] +extern "C" { + #[wasm_bindgen] + pub fn foo(a: A); +} + +fn main() {} diff --git a/vendor/wasm-bindgen-macro/ui-tests/traits-not-implemented.stderr b/vendor/wasm-bindgen-macro/ui-tests/traits-not-implemented.stderr new file mode 100644 index 000000000..7b0f90f57 --- /dev/null +++ b/vendor/wasm-bindgen-macro/ui-tests/traits-not-implemented.stderr @@ -0,0 +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` + | +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) diff --git a/vendor/wasm-bindgen-macro/ui-tests/unknown-type-in-import.rs b/vendor/wasm-bindgen-macro/ui-tests/unknown-type-in-import.rs new file mode 100644 index 000000000..1356a253e --- /dev/null +++ b/vendor/wasm-bindgen-macro/ui-tests/unknown-type-in-import.rs @@ -0,0 +1,10 @@ +use wasm_bindgen::prelude::*; + +#[wasm_bindgen] +extern "C" { + #[wasm_bindgen] + pub fn foo(a: A); +} + +fn main() {} + diff --git a/vendor/wasm-bindgen-macro/ui-tests/unknown-type-in-import.stderr b/vendor/wasm-bindgen-macro/ui-tests/unknown-type-in-import.stderr new file mode 100644 index 000000000..e7bb64c53 --- /dev/null +++ b/vendor/wasm-bindgen-macro/ui-tests/unknown-type-in-import.stderr @@ -0,0 +1,7 @@ +error[E0412]: cannot find type `A` in this scope + --> $DIR/unknown-type-in-import.rs:6:19 + | +6 | pub fn foo(a: A); + | - ^ not found in this scope + | | + | help: you might be missing a type parameter: `<A>` diff --git a/vendor/wasm-bindgen-macro/ui-tests/unused-attributes.rs b/vendor/wasm-bindgen-macro/ui-tests/unused-attributes.rs new file mode 100644 index 000000000..f517dcc4b --- /dev/null +++ b/vendor/wasm-bindgen-macro/ui-tests/unused-attributes.rs @@ -0,0 +1,32 @@ +#![deny(unused_variables)] + +use wasm_bindgen::prelude::*; + +struct A {} + +#[wasm_bindgen] +impl A { + #[wasm_bindgen(method)] + pub fn foo() {} +} + +#[wasm_bindgen] +pub struct MyStruct { + hello: String, +} + +#[wasm_bindgen(getter, typescript_custom_section)] +pub const FOO: &'static str = "FOO"; + +#[wasm_bindgen(readonly)] +pub fn bar() {} + +#[wasm_bindgen(getter_with_clone, final)] +impl MyStruct { + #[wasm_bindgen(getter, typescript_type = "Thing[]")] + pub fn hello(&self) -> String { + self.hello.clone() + } +} + +fn main() {} diff --git a/vendor/wasm-bindgen-macro/ui-tests/unused-attributes.stderr b/vendor/wasm-bindgen-macro/ui-tests/unused-attributes.stderr new file mode 100644 index 000000000..c4ba32f08 --- /dev/null +++ b/vendor/wasm-bindgen-macro/ui-tests/unused-attributes.stderr @@ -0,0 +1,41 @@ +error: unused variable: `method` + --> ui-tests/unused-attributes.rs:9:20 + | +9 | #[wasm_bindgen(method)] + | ^^^^^^ help: if this is intentional, prefix it with an underscore: `_method` + | +note: the lint level is defined here + --> ui-tests/unused-attributes.rs:1:9 + | +1 | #![deny(unused_variables)] + | ^^^^^^^^^^^^^^^^ + +error: unused variable: `getter` + --> ui-tests/unused-attributes.rs:18:16 + | +18 | #[wasm_bindgen(getter, typescript_custom_section)] + | ^^^^^^ help: if this is intentional, prefix it with an underscore: `_getter` + +error: unused variable: `readonly` + --> ui-tests/unused-attributes.rs:21:16 + | +21 | #[wasm_bindgen(readonly)] + | ^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_readonly` + +error: unused variable: `getter_with_clone` + --> ui-tests/unused-attributes.rs:24:16 + | +24 | #[wasm_bindgen(getter_with_clone, final)] + | ^^^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_getter_with_clone` + +error: unused variable: `final` + --> ui-tests/unused-attributes.rs:24:35 + | +24 | #[wasm_bindgen(getter_with_clone, final)] + | ^^^^^ help: if this is intentional, prefix it with an underscore: `_final` + +error: unused variable: `typescript_type` + --> ui-tests/unused-attributes.rs:26:28 + | +26 | #[wasm_bindgen(getter, typescript_type = "Thing[]")] + | ^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_typescript_type` diff --git a/vendor/wasm-bindgen-macro/ui-tests/update-all-references.sh b/vendor/wasm-bindgen-macro/ui-tests/update-all-references.sh new file mode 100755 index 000000000..7b757a479 --- /dev/null +++ b/vendor/wasm-bindgen-macro/ui-tests/update-all-references.sh @@ -0,0 +1,23 @@ +#!/bin/bash +# +# Copyright 2015 The Rust Project Developers. See the COPYRIGHT +# file at the top-level directory of this distribution and at +# http://rust-lang.org/COPYRIGHT. +# +# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +# option. This file may not be copied, modified, or distributed +# except according to those terms. + +# A script to update the references for all tests. The idea is that +# you do a run, which will generate files in the build directory +# containing the (normalized) actual output of the compiler. You then +# run this script, which will copy those files over. If you find +# yourself manually editing a foo.stderr file, you're doing it wrong. +# +# See all `update-references.sh`, if you just want to update a single test. + +MY_DIR=$(dirname $0) +cd $MY_DIR +find . -name '*.rs' | xargs ./update-references.sh diff --git a/vendor/wasm-bindgen-macro/ui-tests/update-references.sh b/vendor/wasm-bindgen-macro/ui-tests/update-references.sh new file mode 100755 index 000000000..19a6d4888 --- /dev/null +++ b/vendor/wasm-bindgen-macro/ui-tests/update-references.sh @@ -0,0 +1,42 @@ +#!/bin/bash +# +# Copyright 2015 The Rust Project Developers. See the COPYRIGHT +# file at the top-level directory of this distribution and at +# http://rust-lang.org/COPYRIGHT. +# +# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +# option. This file may not be copied, modified, or distributed +# except according to those terms. + +# A script to update the references for particular tests. The idea is +# that you do a run, which will generate files in the build directory +# containing the (normalized) actual output of the compiler. This +# script will then copy that output and replace the "expected output" +# files. You can then commit the changes. +# +# If you find yourself manually editing a foo.stderr file, you're +# doing it wrong. + +MYDIR=$(dirname $0) + +BUILD_DIR="../../../target/tests/ui" + +while [[ "$1" != "" ]]; do + STDERR_NAME="${1/%.rs/.stderr}" + STDOUT_NAME="${1/%.rs/.stdout}" + shift + if [ -f $BUILD_DIR/$STDOUT_NAME ] && \ + ! (diff $BUILD_DIR/$STDOUT_NAME $MYDIR/$STDOUT_NAME >& /dev/null); then + echo updating $MYDIR/$STDOUT_NAME + cp $BUILD_DIR/$STDOUT_NAME $MYDIR/$STDOUT_NAME + fi + if [ -f $BUILD_DIR/$STDERR_NAME ] && \ + ! (diff $BUILD_DIR/$STDERR_NAME $MYDIR/$STDERR_NAME >& /dev/null); then + echo updating $MYDIR/$STDERR_NAME + cp $BUILD_DIR/$STDERR_NAME $MYDIR/$STDERR_NAME + fi +done + + |