diff options
| author | mo khan <mo@mokhan.ca> | 2025-07-02 18:36:06 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2025-07-02 18:36:06 -0600 |
| commit | 8cdfa445d6629ffef4cb84967ff7017654045bc2 (patch) | |
| tree | 22f0b0907c024c78d26a731e2e1f5219407d8102 /vendor/ref-cast | |
| parent | 4351c74c7c5f97156bc94d3a8549b9940ac80e3f (diff) | |
chore: add vendor directory
Diffstat (limited to 'vendor/ref-cast')
38 files changed, 1508 insertions, 0 deletions
diff --git a/vendor/ref-cast/.cargo-checksum.json b/vendor/ref-cast/.cargo-checksum.json new file mode 100644 index 00000000..eb4c0cb9 --- /dev/null +++ b/vendor/ref-cast/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{"Cargo.lock":"358b995ff6b57acb2efa43d42bd7335d73ab31351ffe9dd69a68ab18450c6936","Cargo.toml":"edc9c1eb5182d25f1e3c962976ab7421b6f6392ae13b2f7f809d5dec6f33fcf2","LICENSE-APACHE":"62c7a1e35f56406896d7aa7ca52d0cc0d272ac022b5d2796e7d6905db8a3636a","LICENSE-MIT":"23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3","README.md":"7892537462b658c038403cb1829476bd3d643e37c7997c52240329c9ccda50a7","build.rs":"606c77f4c4497ccb44841cbf7c13bf7f0d46a887163f7476b77722accc04acae","src/custom.rs":"daccebb4f47b858f087ae4074c271c1edd8d126e1ed745870c0ae04e419a29ad","src/layout.rs":"b5551be99457883b56064186b6203b2e7a769f86d3466b375cca300b15f8843c","src/lib.rs":"048273545c5f325670ad739310e63f2b3d39714b1386a429cc2022dfa1cc9725","src/trivial.rs":"f4b885d6fbf98f011efe82d9561b5684260962cfbc6aff67c7f6ef2421645cfe","tests/compiletest.rs":"4e381aa8ca3eabb7ac14d1e0c3700b3223e47640547a6988cfa13ad68255f60f","tests/test_custom.rs":"9ad142d3636ca9b5e2ba8d6810031492383235834aa3110d987b5c324477172b","tests/test_trivial.rs":"8e9c49b6172ccf68be4b82ff949638adff2d9db7d1a37eee2f7a2de35e05aa90","tests/ui/cross-crate.rs":"e21fa45f6513ebf56c2de99c2bb57c9d1222bb485136b4cd9c7d92950d37a340","tests/ui/cross-crate.stderr":"f83367db272fd69074cd2cf4a9e2faf574417451d411b591e84a37df34a455ac","tests/ui/dst-before-trivial.rs":"201312065f485590d616dc69241ecf07afa26b8822df972126e332693b658ca2","tests/ui/dst-before-trivial.stderr":"0f21d9e60e396a9f279e82724517b2d7631843202c608a4f6002e14f60343064","tests/ui/extra-arg.rs":"1464d7f1d324a25a41d03dc13fa2aeeda356eafe18b8d2c920831f7575ed507a","tests/ui/extra-arg.stderr":"4ae661dd0d5be456db3911c0702c1dd225fc006c6c76156d6a1b643bfa92458c","tests/ui/function-body.rs":"98acc9a602642a4fcd00dafda41657a9f25e162589488c69cb69608ea983d747","tests/ui/function-body.stderr":"2c84835ba0ce5ad4ad0c8682565b39e54f9b1d2e197fc940225a04fd28cf516e","tests/ui/impl-trait.rs":"63357d2921100cbc2c50ec2322bc36377a8815cc9e737f845f4454ee4a2d77b2","tests/ui/impl-trait.stderr":"0e271879691288da7f3faa456f50ba781e503d134386827c7238525bed597ec7","tests/ui/no-custom.rs":"ac27e249e3370bf71f9405c596ca2167c273b05a27e2c3b039c2637a1dec9668","tests/ui/no-custom.stderr":"abf7b219a16bed03689f6195e3864bc226f72a96f9473922ebe580260d7885e6","tests/ui/no-repr.rs":"a96e79c4b87d9dea1dd69dd718e0103fd41a2ac0b2c676526f655b454efcdd38","tests/ui/no-repr.stderr":"bb1bac7598725e9acd82747e0d2b994ae64d855c56eb16d6a059f1a7b6bf321f","tests/ui/not-trivial.rs":"b67981578c5f9ea762ee9b691507da92f1c343dd83e985d921fceca1a1f90037","tests/ui/not-trivial.stderr":"2cc63d14832d4dca6a243aac6bc9d192fddad9d9df7a0ff2bcb4ab0949d9591a","tests/ui/private.rs":"5ae89587c6ea0c65ff04ffd4c4afc900bfecfe397ee85d180722ab26272bb901","tests/ui/private.stderr":"c4b3115270642bb647e6313b11eb77f4ebb1bfb0164201fd7ed7ddd8b9f45f70","tests/ui/repr-align.rs":"0afb613259f95f88b60cd248db82f64befa9b1c1aea1de68a06912aa76f1e1db","tests/ui/repr-align.stderr":"8ba0d7b0bddb62aacba8129cabea923bd05db0569c95818a11c240ac6c36c81b","tests/ui/short-lifetime.rs":"ee544ad8e2283d4e021f64a89b160f89bfea223facc4635b700904f1314759d3","tests/ui/short-lifetime.stderr":"e13b5002ecce608d2323e7bda02e4e76e8536994fd3f0eff1b1a20dc4bc5908a","tests/ui/unrecognized-repr.rs":"d176159ef9462de2afb39b0919f13f2ebba47ac467148bddd74cbe921382d2df","tests/ui/unrecognized-repr.stderr":"ccb7c44e88152de8774d3368a0ba967e29c632f70fb1ae1a5764baa01c5449b9"},"package":"4a0ae411dbe946a674d89546582cea4ba2bb8defac896622d6496f14c23ba5cf"}
\ No newline at end of file diff --git a/vendor/ref-cast/Cargo.lock b/vendor/ref-cast/Cargo.lock new file mode 100644 index 00000000..58cba78b --- /dev/null +++ b/vendor/ref-cast/Cargo.lock @@ -0,0 +1,320 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "dissimilar" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59f8e79d1fbf76bdfbde321e902714bf6c49df88a7dda6fc682fc2979226962d" + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "glob" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" + +[[package]] +name = "hashbrown" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" + +[[package]] +name = "indexmap" +version = "2.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c9c992b02b5b4c94ea26e32fe5bccb7aa7d9f390ab5c1221ff895bc7ea8b652" +dependencies = [ + "equivalent", + "hashbrown", +] + +[[package]] +name = "itoa" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" + +[[package]] +name = "memchr" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" + +[[package]] +name = "proc-macro2" +version = "1.0.93" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60946a68e5f9d28b0dc1c21bb8a97ee7d018a8b322fa57838ba31cc878e22d99" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "ref-cast" +version = "1.0.24" +dependencies = [ + "ref-cast-impl", + "ref-cast-test-suite", + "rustversion", + "trybuild", +] + +[[package]] +name = "ref-cast-impl" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1165225c21bff1f3bbce98f5a1f889949bc902d3575308cc7b0de30b4f6d27c7" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "ref-cast-test-suite" +version = "0.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4457174a31b117c9161c503ac18658ee659189455c2dc224e097fa4e12aa133" + +[[package]] +name = "rustversion" +version = "1.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7c45b9784283f1b2e7fb61b42047c2fd678ef0960d4f6f1eba131594cc369d4" + +[[package]] +name = "ryu" +version = "1.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ea1a2d0a644769cc99faa24c3ad26b379b786fe7c36fd3c546254801650e6dd" + +[[package]] +name = "serde" +version = "1.0.218" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8dfc9d19bdbf6d17e22319da49161d5d0108e4188e8b680aef6299eed22df60" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.218" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f09503e191f4e797cb8aac08e9a4a4695c5edf6a2e70e376d961ddd5c969f82b" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.139" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44f86c3acccc9c65b153fe1b85a3be07fe5515274ec9f0653b4a0875731c72a6" +dependencies = [ + "itoa", + "memchr", + "ryu", + "serde", +] + +[[package]] +name = "serde_spanned" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1" +dependencies = [ + "serde", +] + +[[package]] +name = "syn" +version = "2.0.98" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36147f1a48ae0ec2b5b3bc5b537d267457555a10dc06f3dbc8cb11ba3006d3b1" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "target-triple" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ac9aa371f599d22256307c24a9d748c041e548cbf599f35d890f9d365361790" + +[[package]] +name = "termcolor" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "toml" +version = "0.8.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd87a5cdd6ffab733b2f74bc4fd7ee5fff6634124999ac278c35fc78c6120148" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + +[[package]] +name = "toml_datetime" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_edit" +version = "0.22.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17b4795ff5edd201c7cd6dca065ae59972ce77d1b80fa0a84d94950ece7d1474" +dependencies = [ + "indexmap", + "serde", + "serde_spanned", + "toml_datetime", + "winnow", +] + +[[package]] +name = "trybuild" +version = "1.0.103" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b812699e0c4f813b872b373a4471717d9eb550da14b311058a4d9cf4173cbca6" +dependencies = [ + "dissimilar", + "glob", + "serde", + "serde_derive", + "serde_json", + "target-triple", + "termcolor", + "toml", +] + +[[package]] +name = "unicode-ident" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00e2473a93778eb0bad35909dff6a10d28e63f792f16ed15e404fca9d5eeedbe" + +[[package]] +name = "winapi-util" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" +dependencies = [ + "windows-sys", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "winnow" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e7f4ea97f6f78012141bcdb6a216b2609f0979ada50b20ca5b52dde2eac2bb1" +dependencies = [ + "memchr", +] diff --git a/vendor/ref-cast/Cargo.toml b/vendor/ref-cast/Cargo.toml new file mode 100644 index 00000000..f67a0797 --- /dev/null +++ b/vendor/ref-cast/Cargo.toml @@ -0,0 +1,71 @@ +# 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 = "2021" +rust-version = "1.56" +name = "ref-cast" +version = "1.0.24" +authors = ["David Tolnay <dtolnay@gmail.com>"] +build = "build.rs" +autolib = false +autobins = false +autoexamples = false +autotests = false +autobenches = false +description = "Safely cast &T to &U where the struct U contains a single field of type T." +documentation = "https://docs.rs/ref-cast" +readme = "README.md" +categories = [ + "rust-patterns", + "no-std", + "no-std::no-alloc", +] +license = "MIT OR Apache-2.0" +repository = "https://github.com/dtolnay/ref-cast" + +[package.metadata.docs.rs] +rustdoc-args = [ + "--generate-link-to-definition", + "--extern-html-root-url=core=https://doc.rust-lang.org", + "--extern-html-root-url=alloc=https://doc.rust-lang.org", + "--extern-html-root-url=std=https://doc.rust-lang.org", +] +targets = ["x86_64-unknown-linux-gnu"] + +[lib] +name = "ref_cast" +path = "src/lib.rs" + +[[test]] +name = "compiletest" +path = "tests/compiletest.rs" + +[[test]] +name = "test_custom" +path = "tests/test_custom.rs" + +[[test]] +name = "test_trivial" +path = "tests/test_trivial.rs" + +[dependencies.ref-cast-impl] +version = "=1.0.24" + +[dev-dependencies.ref-cast-test-suite] +version = "0" + +[dev-dependencies.rustversion] +version = "1.0.13" + +[dev-dependencies.trybuild] +version = "1.0.81" +features = ["diff"] diff --git a/vendor/ref-cast/LICENSE-APACHE b/vendor/ref-cast/LICENSE-APACHE new file mode 100644 index 00000000..1b5ec8b7 --- /dev/null +++ b/vendor/ref-cast/LICENSE-APACHE @@ -0,0 +1,176 @@ + 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 diff --git a/vendor/ref-cast/LICENSE-MIT b/vendor/ref-cast/LICENSE-MIT new file mode 100644 index 00000000..31aa7938 --- /dev/null +++ b/vendor/ref-cast/LICENSE-MIT @@ -0,0 +1,23 @@ +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/ref-cast/README.md b/vendor/ref-cast/README.md new file mode 100644 index 00000000..5188ba10 --- /dev/null +++ b/vendor/ref-cast/README.md @@ -0,0 +1,123 @@ +RefCast +======= + +[<img alt="github" src="https://img.shields.io/badge/github-dtolnay/ref--cast-8da0cb?style=for-the-badge&labelColor=555555&logo=github" height="20">](https://github.com/dtolnay/ref-cast) +[<img alt="crates.io" src="https://img.shields.io/crates/v/ref-cast.svg?style=for-the-badge&color=fc8d62&logo=rust" height="20">](https://crates.io/crates/ref-cast) +[<img alt="docs.rs" src="https://img.shields.io/badge/docs.rs-ref--cast-66c2a5?style=for-the-badge&labelColor=555555&logo=docs.rs" height="20">](https://docs.rs/ref-cast) +[<img alt="build status" src="https://img.shields.io/github/actions/workflow/status/dtolnay/ref-cast/ci.yml?branch=master&style=for-the-badge" height="20">](https://github.com/dtolnay/ref-cast/actions?query=branch%3Amaster) + +Safely cast `&T` to `&U` where the struct `U` contains a single field of +type `T`. + +```toml +[dependencies] +ref-cast = "1.0" +``` + +## Basic example + +```rust +use ref_cast::RefCast; + +#[derive(RefCast)] +#[repr(transparent)] +struct U(String); + +fn main() { + let s = String::new(); + + // Safely cast from `&String` to `&U`. + let u = U::ref_cast(&s); +} +``` + +Note that `#[repr(transparent)]` is required in order for the conversion to be +sound. The derive macro will refuse to compile if that is not present. + +## Realistic example + +Suppose we have a multidimensional array represented in a flat buffer in +row-major order for performance reasons, but we want to expose an indexing +operation that works in column-major order because it is more intuitive in +the context of our application. + +```rust +const MAP_WIDTH: usize = 4; + +struct Tile(u8); + +struct TileMap { + storage: Vec<Tile>, +} + +// `tilemap[x][y]` should give us `tilemap.storage[y * MAP_WIDTH + x]`. +``` + +The signature of the [`Index`] trait in Rust is such that the output is +forced to be borrowed from the type being indexed. So something like the +following is not going to work. + +[`Index`]: https://doc.rust-lang.org/std/ops/trait.Index.html + +```rust +struct Column<'a> { + tilemap: &'a TileMap, + x: usize, +} + +// Does not work! The output of Index must be a reference that is +// borrowed from self. Here the type Column is not a reference. +impl Index<usize> for TileMap { + fn index(&self, x: usize) -> Column { + assert!(x < MAP_WIDTH); + Column { tilemap: self, x } + } +} + +impl<'a> Index<usize> for Column<'a> { + fn index(&self, y: usize) -> &Tile { + &self.tilemap.storage[y * MAP_WIDTH + self.x] + } +} +``` + +Here is a working approach using `RefCast`. + +```rust +#[derive(RefCast)] +#[repr(transparent)] +struct Strided([Tile]); + +// Implement `tilemap[x][y]` as `tilemap[x..][y * MAP_WIDTH]`. +impl Index<usize> for TileMap { + type Output = Strided; + fn index(&self, x: usize) -> &Self::Output { + assert!(x < MAP_WIDTH); + Strided::ref_cast(&self.storage[x..]) + } +} + +impl Index<usize> for Strided { + type Output = Tile; + fn index(&self, y: usize) -> &Self::Output { + &self.0[y * MAP_WIDTH] + } +} +``` + +<br> + +#### License + +<sup> +Licensed under either of <a href="LICENSE-APACHE">Apache License, Version +2.0</a> or <a href="LICENSE-MIT">MIT license</a> at your option. +</sup> + +<br> + +<sub> +Unless you explicitly state otherwise, any contribution intentionally submitted +for inclusion in this crate by you, as defined in the Apache-2.0 license, shall +be dual licensed as above, without any additional terms or conditions. +</sub> diff --git a/vendor/ref-cast/build.rs b/vendor/ref-cast/build.rs new file mode 100644 index 00000000..f1c49654 --- /dev/null +++ b/vendor/ref-cast/build.rs @@ -0,0 +1,36 @@ +use std::env; +use std::process::Command; +use std::str; + +fn main() { + println!("cargo:rerun-if-changed=build.rs"); + + let minor = match rustc_minor_version() { + Some(minor) => minor, + None => return, + }; + + if minor >= 80 { + println!("cargo:rustc-check-cfg=cfg(no_intrinsic_type_name)"); + println!("cargo:rustc-check-cfg=cfg(no_phantom_pinned)"); + } + + if minor < 33 { + println!("cargo:rustc-cfg=no_phantom_pinned"); + } + + if minor < 38 { + println!("cargo:rustc-cfg=no_intrinsic_type_name"); + } +} + +fn rustc_minor_version() -> Option<u32> { + let rustc = env::var_os("RUSTC")?; + let output = Command::new(rustc).arg("--version").output().ok()?; + let version = str::from_utf8(&output.stdout).ok()?; + let mut pieces = version.split('.'); + if pieces.next() != Some("rustc 1") { + return None; + } + pieces.next()?.parse().ok() +} diff --git a/vendor/ref-cast/src/custom.rs b/vendor/ref-cast/src/custom.rs new file mode 100644 index 00000000..76725bcf --- /dev/null +++ b/vendor/ref-cast/src/custom.rs @@ -0,0 +1,57 @@ +// Not public API. Use #[derive(RefCastCustom)] and #[ref_cast_custom]. +#[doc(hidden)] +pub unsafe trait RefCastCustom<From: ?Sized> { + type CurrentCrate; + fn __static_assert() {} +} + +#[doc(hidden)] +pub unsafe trait RefCastOkay<From>: Sealed<From> { + type CurrentCrate; + type Target: ?Sized; +} + +unsafe impl<'a, From, To> RefCastOkay<&'a From> for &'a To +where + From: ?Sized, + To: ?Sized + RefCastCustom<From>, +{ + type CurrentCrate = To::CurrentCrate; + type Target = To; +} + +unsafe impl<'a, From, To> RefCastOkay<&'a mut From> for &'a mut To +where + From: ?Sized, + To: ?Sized + RefCastCustom<From>, +{ + type CurrentCrate = To::CurrentCrate; + type Target = To; +} + +#[doc(hidden)] +pub trait Sealed<From> {} + +impl<'a, From, To> Sealed<&'a From> for &'a To +where + From: ?Sized, + To: ?Sized + RefCastCustom<From>, +{ +} + +impl<'a, From, To> Sealed<&'a mut From> for &'a mut To +where + From: ?Sized, + To: ?Sized + RefCastCustom<From>, +{ +} + +#[doc(hidden)] +pub type CurrentCrate<From, To> = <To as RefCastOkay<From>>::CurrentCrate; + +#[doc(hidden)] +pub fn ref_cast_custom<From, To>(_arg: From) +where + To: RefCastOkay<From>, +{ +} diff --git a/vendor/ref-cast/src/layout.rs b/vendor/ref-cast/src/layout.rs new file mode 100644 index 00000000..55f91f8c --- /dev/null +++ b/vendor/ref-cast/src/layout.rs @@ -0,0 +1,60 @@ +use core::mem; + +#[doc(hidden)] +pub struct Layout<T: ?Sized>(T); + +#[doc(hidden)] +pub trait LayoutUnsized<T: ?Sized> { + const SIZE: usize = usize::MAX; + const ALIGN: usize = usize::MAX; +} + +impl<T: ?Sized> LayoutUnsized<T> for Layout<T> {} + +impl<T> Layout<T> { + pub const SIZE: usize = mem::size_of::<T>(); + pub const ALIGN: usize = mem::align_of::<T>(); +} + +#[doc(hidden)] +#[inline] +pub fn assert_layout<Outer: ?Sized, Inner: ?Sized>( + name: &'static str, + outer_size: usize, + inner_size: usize, + outer_align: usize, + inner_align: usize, +) { + if outer_size != inner_size { + #[cfg(no_intrinsic_type_name)] + panic!( + "unexpected size in cast to {}: {} != {}", + name, outer_size, inner_size, + ); + #[cfg(not(no_intrinsic_type_name))] + panic!( + "unexpected size in cast from {} to {}: {} != {}", + core::any::type_name::<Inner>(), + core::any::type_name::<Outer>(), + inner_size, + outer_size, + ); + } + if outer_align != inner_align { + #[cfg(no_intrinsic_type_name)] + panic!( + "unexpected alignment in cast to {}: {} != {}", + name, outer_align, inner_align, + ); + #[cfg(not(no_intrinsic_type_name))] + panic!( + "unexpected alignment in cast from {} to {}: {} != {}", + core::any::type_name::<Inner>(), + core::any::type_name::<Outer>(), + inner_align, + outer_align, + ); + } + #[cfg(not(no_intrinsic_type_name))] + let _ = name; +} diff --git a/vendor/ref-cast/src/lib.rs b/vendor/ref-cast/src/lib.rs new file mode 100644 index 00000000..71914feb --- /dev/null +++ b/vendor/ref-cast/src/lib.rs @@ -0,0 +1,194 @@ +//! [![github]](https://github.com/dtolnay/ref-cast) [![crates-io]](https://crates.io/crates/ref-cast) [![docs-rs]](https://docs.rs/ref-cast) +//! +//! [github]: https://img.shields.io/badge/github-8da0cb?style=for-the-badge&labelColor=555555&logo=github +//! [crates-io]: https://img.shields.io/badge/crates.io-fc8d62?style=for-the-badge&labelColor=555555&logo=rust +//! [docs-rs]: https://img.shields.io/badge/docs.rs-66c2a5?style=for-the-badge&labelColor=555555&logo=docs.rs +//! +//! <br> +//! +//! This crate provides a derive macro for generating safe conversions from `&T` +//! to `&U` where the struct `U` contains a single field of type `T`. +//! +//! # Basic example +//! +//! ``` +//! use ref_cast::RefCast; +//! +//! #[derive(RefCast)] +//! #[repr(transparent)] +//! struct U(String); +//! +//! fn main() { +//! let s = String::new(); +//! +//! // Safely cast from `&String` to `&U`. +//! let u = U::ref_cast(&s); +//! } +//! ``` +//! +//! Note that `#[repr(transparent)]` is required in order for the conversion to +//! be sound. The derive macro will refuse to compile if that is not present. +//! +//! # Realistic example +//! +//! Suppose we have a multidimensional array represented in a flat buffer in +//! row-major order for performance reasons, but we want to expose an indexing +//! operation that works in column-major order because it is more intuitive in +//! the context of our application. +//! +//! ``` +//! const MAP_WIDTH: usize = 4; +//! +//! struct Tile(u8); +//! +//! struct TileMap { +//! storage: Vec<Tile>, +//! } +//! +//! // `tilemap[x][y]` should give us `tilemap.storage[y * MAP_WIDTH + x]`. +//! ``` +//! +//! The signature of the [`Index`] trait in Rust is such that the output is +//! forced to be borrowed from the type being indexed. So something like the +//! following is not going to work. +//! +//! [`Index`]: core::ops::Index +//! +//! ``` +//! # const MAP_WIDTH: usize = 4; +//! # +//! # struct Tile(u8); +//! # +//! # struct TileMap { +//! # storage: Vec<Tile>, +//! # } +//! # +//! struct Column<'a> { +//! tilemap: &'a TileMap, +//! x: usize, +//! } +//! +//! # mod index1 { +//! # use super::{TileMap, Column, MAP_WIDTH}; +//! # +//! # trait Index<Idx> { +//! # fn index(&self, idx: Idx) -> Column; +//! # } +//! # +//! // Does not work! The output of Index must be a reference that is +//! // borrowed from self. Here the type Column is not a reference. +//! impl Index<usize> for TileMap { +//! fn index(&self, x: usize) -> Column { +//! assert!(x < MAP_WIDTH); +//! Column { tilemap: self, x } +//! } +//! } +//! # } +//! +//! # mod index2 { +//! # use super::{Column, Tile, MAP_WIDTH}; +//! # use std::ops::Index; +//! # +//! impl<'a> Index<usize> for Column<'a> { +//! # type Output = Tile; +//! fn index(&self, y: usize) -> &Tile { +//! &self.tilemap.storage[y * MAP_WIDTH + self.x] +//! } +//! } +//! # } +//! # +//! # fn main() {} +//! ``` +//! +//! Here is a working approach using `RefCast`. +//! +//! ``` +//! # use ref_cast::RefCast; +//! # use std::ops::Index; +//! # +//! # const MAP_WIDTH: usize = 4; +//! # +//! # struct Tile(u8); +//! # +//! # struct TileMap { +//! # storage: Vec<Tile>, +//! # } +//! # +//! #[derive(RefCast)] +//! #[repr(transparent)] +//! struct Strided([Tile]); +//! +//! // Implement `tilemap[x][y]` as `tilemap[x..][y * MAP_WIDTH]`. +//! impl Index<usize> for TileMap { +//! type Output = Strided; +//! fn index(&self, x: usize) -> &Self::Output { +//! assert!(x < MAP_WIDTH); +//! Strided::ref_cast(&self.storage[x..]) +//! } +//! } +//! +//! impl Index<usize> for Strided { +//! type Output = Tile; +//! fn index(&self, y: usize) -> &Self::Output { +//! &self.0[y * MAP_WIDTH] +//! } +//! } +//! ``` + +#![doc(html_root_url = "https://docs.rs/ref-cast/1.0.24")] +#![no_std] +#![allow( + clippy::extra_unused_type_parameters, + clippy::let_underscore_untyped, + clippy::manual_assert, + clippy::missing_panics_doc, + clippy::missing_safety_doc, + clippy::module_name_repetitions, + clippy::needless_doctest_main, + clippy::needless_pass_by_value +)] + +mod custom; +mod layout; +mod trivial; + +pub use ref_cast_impl::{ref_cast_custom, RefCast, RefCastCustom}; + +/// Safely cast `&T` to `&U` where the struct `U` contains a single field of +/// type `T`. +/// +/// ``` +/// # use ref_cast::RefCast; +/// # +/// // `&String` can be cast to `&U`. +/// #[derive(RefCast)] +/// #[repr(transparent)] +/// struct U(String); +/// +/// // `&T` can be cast to `&V<T>`. +/// #[derive(RefCast)] +/// #[repr(transparent)] +/// struct V<T> { +/// t: T, +/// } +/// ``` +/// +/// See the [crate-level documentation][crate] for usage examples! +pub trait RefCast { + type From: ?Sized; + fn ref_cast(from: &Self::From) -> &Self; + fn ref_cast_mut(from: &mut Self::From) -> &mut Self; +} + +// Not public API. +#[doc(hidden)] +pub mod __private { + #[doc(hidden)] + pub use crate::custom::{ref_cast_custom, CurrentCrate, RefCastCustom}; + #[doc(hidden)] + pub use crate::layout::{assert_layout, Layout, LayoutUnsized}; + #[doc(hidden)] + pub use crate::trivial::assert_trivial; + #[doc(hidden)] + pub use core::mem::transmute; +} diff --git a/vendor/ref-cast/src/trivial.rs b/vendor/ref-cast/src/trivial.rs new file mode 100644 index 00000000..b3e6d0d7 --- /dev/null +++ b/vendor/ref-cast/src/trivial.rs @@ -0,0 +1,15 @@ +use core::marker::PhantomData; +#[cfg(not(no_phantom_pinned))] +use core::marker::PhantomPinned; + +#[doc(hidden)] +pub trait Trivial {} + +impl Trivial for () {} +impl<T: ?Sized> Trivial for PhantomData<T> {} + +#[cfg(not(no_phantom_pinned))] +impl Trivial for PhantomPinned {} + +#[doc(hidden)] +pub fn assert_trivial<T: Trivial>() {} diff --git a/vendor/ref-cast/tests/compiletest.rs b/vendor/ref-cast/tests/compiletest.rs new file mode 100644 index 00000000..23a6a065 --- /dev/null +++ b/vendor/ref-cast/tests/compiletest.rs @@ -0,0 +1,7 @@ +#[rustversion::attr(not(nightly), ignore = "requires nightly")] +#[cfg_attr(miri, ignore = "incompatible with miri")] +#[test] +fn ui() { + let t = trybuild::TestCases::new(); + t.compile_fail("tests/ui/*.rs"); +} diff --git a/vendor/ref-cast/tests/test_custom.rs b/vendor/ref-cast/tests/test_custom.rs new file mode 100644 index 00000000..73d9bd69 --- /dev/null +++ b/vendor/ref-cast/tests/test_custom.rs @@ -0,0 +1,18 @@ +#[forbid(unsafe_code)] +mod forbid_unsafe { + use ref_cast::{ref_cast_custom, RefCastCustom}; + + #[derive(RefCastCustom)] + #[repr(transparent)] + pub struct Custom(#[allow(dead_code)] str); + + impl Custom { + #[ref_cast_custom] + pub fn new(s: &str) -> &Custom; + } +} + +#[test] +fn test_forbid_unsafe() { + forbid_unsafe::Custom::new("..."); +} diff --git a/vendor/ref-cast/tests/test_trivial.rs b/vendor/ref-cast/tests/test_trivial.rs new file mode 100644 index 00000000..c5ec85ae --- /dev/null +++ b/vendor/ref-cast/tests/test_trivial.rs @@ -0,0 +1,52 @@ +#![allow(clippy::manual_non_exhaustive)] + +use ref_cast::RefCast; +use std::marker::PhantomData; + +type Marker = PhantomData<str>; + +#[derive(RefCast)] +#[repr(transparent)] +pub struct ImplicitUnit { + pub value: usize, + _private: (), +} + +#[derive(RefCast)] +#[repr(transparent)] +pub struct ImplicitPhantomData<T> { + pub value: T, + pub marker: PhantomData<T>, +} + +#[derive(RefCast)] +#[repr(transparent)] +pub struct ExplicitTrivial { + pub value: usize, + #[trivial] + pub marker: Marker, +} + +#[derive(RefCast)] +#[repr(C)] +pub struct Override<U, V> { + #[trivial] + pub first: PhantomData<U>, + pub second: PhantomData<V>, +} + +#[derive(RefCast)] +#[repr(transparent)] +pub struct Unsized<'a> { + pub marker: PhantomData<&'a str>, + pub value: str, +} + +#[test] +fn test_trivial() { + ImplicitUnit::ref_cast(&0); + ImplicitPhantomData::ref_cast(&0); + ExplicitTrivial::ref_cast(&0); + Override::<u8, i8>::ref_cast(&PhantomData::<i8>); + Unsized::ref_cast("..."); +} diff --git a/vendor/ref-cast/tests/ui/cross-crate.rs b/vendor/ref-cast/tests/ui/cross-crate.rs new file mode 100644 index 00000000..7368b3d0 --- /dev/null +++ b/vendor/ref-cast/tests/ui/cross-crate.rs @@ -0,0 +1,10 @@ +use ref_cast::ref_cast_custom; +use ref_cast_test_suite::Struct; + +#[ref_cast_custom] +fn ref_cast(s: &str) -> &Struct; + +#[ref_cast_custom] +fn ref_cast_mut(s: &mut str) -> &mut Struct; + +fn main() {} diff --git a/vendor/ref-cast/tests/ui/cross-crate.stderr b/vendor/ref-cast/tests/ui/cross-crate.stderr new file mode 100644 index 00000000..7de06292 --- /dev/null +++ b/vendor/ref-cast/tests/ui/cross-crate.stderr @@ -0,0 +1,11 @@ +error[E0639]: cannot create non-exhaustive struct using struct expression + --> tests/ui/cross-crate.rs:5:32 + | +5 | fn ref_cast(s: &str) -> &Struct; + | ^ + +error[E0639]: cannot create non-exhaustive struct using struct expression + --> tests/ui/cross-crate.rs:8:44 + | +8 | fn ref_cast_mut(s: &mut str) -> &mut Struct; + | ^ diff --git a/vendor/ref-cast/tests/ui/dst-before-trivial.rs b/vendor/ref-cast/tests/ui/dst-before-trivial.rs new file mode 100644 index 00000000..df294f54 --- /dev/null +++ b/vendor/ref-cast/tests/ui/dst-before-trivial.rs @@ -0,0 +1,12 @@ +use ref_cast::RefCast; +use std::marker::PhantomData; + +#[derive(RefCast)] +#[repr(transparent)] +struct Bytes<'arena> { + bytes: [u8], + #[trivial] + marker: PhantomData<&'arena ()>, +} + +fn main() {} diff --git a/vendor/ref-cast/tests/ui/dst-before-trivial.stderr b/vendor/ref-cast/tests/ui/dst-before-trivial.stderr new file mode 100644 index 00000000..f5e8d4e9 --- /dev/null +++ b/vendor/ref-cast/tests/ui/dst-before-trivial.stderr @@ -0,0 +1,17 @@ +error[E0277]: the size for values of type `[u8]` cannot be known at compilation time + --> tests/ui/dst-before-trivial.rs:7:12 + | +7 | bytes: [u8], + | ^^^^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `[u8]` + = note: only the last field of a struct may have a dynamically sized type + = help: change the field's type to have a statically known size +help: borrowed types always have a statically known size + | +7 | bytes: &[u8], + | + +help: the `Box` type always has a statically known size and allocates its contents in the heap + | +7 | bytes: Box<[u8]>, + | ++++ + diff --git a/vendor/ref-cast/tests/ui/extra-arg.rs b/vendor/ref-cast/tests/ui/extra-arg.rs new file mode 100644 index 00000000..a23eff2b --- /dev/null +++ b/vendor/ref-cast/tests/ui/extra-arg.rs @@ -0,0 +1,12 @@ +use ref_cast::{ref_cast_custom, RefCastCustom}; + +#[derive(RefCastCustom)] +#[repr(transparent)] +pub struct Thing(String); + +impl Thing { + #[ref_cast_custom] + pub fn ref_cast(s: &String, wat: i32) -> &Self; +} + +fn main() {} diff --git a/vendor/ref-cast/tests/ui/extra-arg.stderr b/vendor/ref-cast/tests/ui/extra-arg.stderr new file mode 100644 index 00000000..4676d50d --- /dev/null +++ b/vendor/ref-cast/tests/ui/extra-arg.stderr @@ -0,0 +1,13 @@ +error: ref_cast_custom function is required to have a single argument + --> tests/ui/extra-arg.rs:9:33 + | +9 | pub fn ref_cast(s: &String, wat: i32) -> &Self; + | ^^^^^^^^ + +error: associated function in `impl` without body + --> tests/ui/extra-arg.rs:9:5 + | +9 | pub fn ref_cast(s: &String, wat: i32) -> &Self; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- + | | + | help: provide a definition for the function: `{ <body> }` diff --git a/vendor/ref-cast/tests/ui/function-body.rs b/vendor/ref-cast/tests/ui/function-body.rs new file mode 100644 index 00000000..915044a8 --- /dev/null +++ b/vendor/ref-cast/tests/ui/function-body.rs @@ -0,0 +1,12 @@ +use ref_cast::{ref_cast_custom, RefCastCustom}; + +#[derive(RefCastCustom)] +#[repr(transparent)] +pub struct Thing(String); + +impl Thing { + #[ref_cast_custom] + pub fn ref_cast(s: &String) -> &Self {} +} + +fn main() {} diff --git a/vendor/ref-cast/tests/ui/function-body.stderr b/vendor/ref-cast/tests/ui/function-body.stderr new file mode 100644 index 00000000..3161d334 --- /dev/null +++ b/vendor/ref-cast/tests/ui/function-body.stderr @@ -0,0 +1,13 @@ +error: expected `;` + --> tests/ui/function-body.rs:9:42 + | +9 | pub fn ref_cast(s: &String) -> &Self {} + | ^ + +error[E0308]: mismatched types + --> tests/ui/function-body.rs:9:36 + | +9 | pub fn ref_cast(s: &String) -> &Self {} + | -------- ^^^^^ expected `&Thing`, found `()` + | | + | implicitly returns `()` as its body has no tail or `return` expression diff --git a/vendor/ref-cast/tests/ui/impl-trait.rs b/vendor/ref-cast/tests/ui/impl-trait.rs new file mode 100644 index 00000000..ee3777b4 --- /dev/null +++ b/vendor/ref-cast/tests/ui/impl-trait.rs @@ -0,0 +1,15 @@ +use ref_cast::{ref_cast_custom, RefCastCustom}; + +#[derive(RefCastCustom)] +#[repr(transparent)] +pub struct Thing(str); + +impl Thing { + #[ref_cast_custom] + pub fn ref_cast(s: impl AsRef<str>) -> &Self; + + #[ref_cast_custom] + pub fn ref_cast2(s: &impl AsRef<str>) -> &Self; +} + +fn main() {} diff --git a/vendor/ref-cast/tests/ui/impl-trait.stderr b/vendor/ref-cast/tests/ui/impl-trait.stderr new file mode 100644 index 00000000..e22076a6 --- /dev/null +++ b/vendor/ref-cast/tests/ui/impl-trait.stderr @@ -0,0 +1,31 @@ +error[E0106]: missing lifetime specifier + --> tests/ui/impl-trait.rs:9:44 + | +9 | pub fn ref_cast(s: impl AsRef<str>) -> &Self; + | ^ expected named lifetime parameter + | + = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from +help: consider using the `'static` lifetime, but this is uncommon unless you're returning a borrowed value from a `const` or a `static` + | +9 | pub fn ref_cast(s: impl AsRef<str>) -> &'static Self; + | +++++++ +help: consider introducing a named lifetime parameter + | +9 | pub fn ref_cast<'a>(s: impl AsRef<str>) -> &'a Self; + | ++++ ++ + +error[E0562]: `impl Trait` is not allowed in paths + --> tests/ui/impl-trait.rs:9:24 + | +9 | pub fn ref_cast(s: impl AsRef<str>) -> &Self; + | ^^^^^^^^^^^^^^^ + | + = note: `impl Trait` is only allowed in arguments and return types of functions and methods + +error[E0562]: `impl Trait` is not allowed in paths + --> tests/ui/impl-trait.rs:12:26 + | +12 | pub fn ref_cast2(s: &impl AsRef<str>) -> &Self; + | ^^^^^^^^^^^^^^^ + | + = note: `impl Trait` is only allowed in arguments and return types of functions and methods diff --git a/vendor/ref-cast/tests/ui/no-custom.rs b/vendor/ref-cast/tests/ui/no-custom.rs new file mode 100644 index 00000000..116b197c --- /dev/null +++ b/vendor/ref-cast/tests/ui/no-custom.rs @@ -0,0 +1,11 @@ +use ref_cast::ref_cast_custom; + +#[repr(transparent)] +pub struct Thing(String); + +impl Thing { + #[ref_cast_custom] + pub fn ref_cast(s: &String) -> &Self; +} + +fn main() {} diff --git a/vendor/ref-cast/tests/ui/no-custom.stderr b/vendor/ref-cast/tests/ui/no-custom.stderr new file mode 100644 index 00000000..38269be3 --- /dev/null +++ b/vendor/ref-cast/tests/ui/no-custom.stderr @@ -0,0 +1,35 @@ +error[E0277]: the trait bound `&Thing: ref_cast::custom::RefCastOkay<&String>` is not satisfied + --> tests/ui/no-custom.rs:8:36 + | +8 | pub fn ref_cast(s: &String) -> &Self; + | ^^^^^ the trait `RefCastCustom<String>` is not implemented for `Thing` + | + = help: the following other types implement trait `ref_cast::custom::RefCastOkay<From>`: + `&'a To` implements `ref_cast::custom::RefCastOkay<&'a From>` + `&'a mut To` implements `ref_cast::custom::RefCastOkay<&'a mut From>` + = note: required for `&Thing` to implement `ref_cast::custom::RefCastOkay<&String>` +note: required by a bound in `ref_cast_custom` + --> src/custom.rs + | + | pub fn ref_cast_custom<From, To>(_arg: From) + | --------------- required by a bound in this function + | where + | To: RefCastOkay<From>, + | ^^^^^^^^^^^^^^^^^ required by this bound in `ref_cast_custom` + +error[E0071]: expected struct, variant or union type, found inferred type + --> tests/ui/no-custom.rs:8:41 + | +8 | pub fn ref_cast(s: &String) -> &Self; + | ^ not a struct + +error[E0277]: the trait bound `Thing: RefCastCustom<String>` is not satisfied + --> tests/ui/no-custom.rs:8:41 + | +8 | pub fn ref_cast(s: &String) -> &Self; + | ^ the trait `RefCastCustom<String>` is not implemented for `Thing` + | + = help: the following other types implement trait `ref_cast::custom::RefCastOkay<From>`: + `&'a To` implements `ref_cast::custom::RefCastOkay<&'a From>` + `&'a mut To` implements `ref_cast::custom::RefCastOkay<&'a mut From>` + = note: required for `&Thing` to implement `ref_cast::custom::RefCastOkay<&String>` diff --git a/vendor/ref-cast/tests/ui/no-repr.rs b/vendor/ref-cast/tests/ui/no-repr.rs new file mode 100644 index 00000000..65398da0 --- /dev/null +++ b/vendor/ref-cast/tests/ui/no-repr.rs @@ -0,0 +1,8 @@ +use ref_cast::RefCast; + +#[derive(RefCast)] +struct Test { + s: String, +} + +fn main() {} diff --git a/vendor/ref-cast/tests/ui/no-repr.stderr b/vendor/ref-cast/tests/ui/no-repr.stderr new file mode 100644 index 00000000..3fcc2d2e --- /dev/null +++ b/vendor/ref-cast/tests/ui/no-repr.stderr @@ -0,0 +1,7 @@ +error: RefCast trait requires #[repr(transparent)] + --> tests/ui/no-repr.rs:3:10 + | +3 | #[derive(RefCast)] + | ^^^^^^^ + | + = note: this error originates in the derive macro `RefCast` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/vendor/ref-cast/tests/ui/not-trivial.rs b/vendor/ref-cast/tests/ui/not-trivial.rs new file mode 100644 index 00000000..292f282c --- /dev/null +++ b/vendor/ref-cast/tests/ui/not-trivial.rs @@ -0,0 +1,11 @@ +use ref_cast::RefCast; + +#[derive(RefCast)] +#[repr(C)] +struct Test { + one: String, + #[trivial] + two: String, +} + +fn main() {} diff --git a/vendor/ref-cast/tests/ui/not-trivial.stderr b/vendor/ref-cast/tests/ui/not-trivial.stderr new file mode 100644 index 00000000..9983cdc9 --- /dev/null +++ b/vendor/ref-cast/tests/ui/not-trivial.stderr @@ -0,0 +1,15 @@ +error[E0277]: the trait bound `String: ref_cast::trivial::Trivial` is not satisfied + --> tests/ui/not-trivial.rs:8:10 + | +8 | two: String, + | ^^^^^^ the trait `ref_cast::trivial::Trivial` is not implemented for `String` + | + = help: the following other types implement trait `ref_cast::trivial::Trivial`: + () + PhantomData<T> + PhantomPinned +note: required by a bound in `assert_trivial` + --> src/trivial.rs + | + | pub fn assert_trivial<T: Trivial>() {} + | ^^^^^^^ required by this bound in `assert_trivial` diff --git a/vendor/ref-cast/tests/ui/private.rs b/vendor/ref-cast/tests/ui/private.rs new file mode 100644 index 00000000..4c222a07 --- /dev/null +++ b/vendor/ref-cast/tests/ui/private.rs @@ -0,0 +1,19 @@ +use ref_cast::{ref_cast_custom, RefCast, RefCastCustom}; + +#[derive(RefCast, RefCastCustom)] +#[repr(transparent)] +pub struct Public { + private: Private, +} + +struct Private; + +impl Public { + #[ref_cast_custom] + fn ref_cast(private: &Private) -> &Public; + + #[ref_cast_custom] + fn ref_cast_mut(private: &mut Private) -> &mut Public; +} + +fn main() {} diff --git a/vendor/ref-cast/tests/ui/private.stderr b/vendor/ref-cast/tests/ui/private.stderr new file mode 100644 index 00000000..732b31c5 --- /dev/null +++ b/vendor/ref-cast/tests/ui/private.stderr @@ -0,0 +1,10 @@ +error[E0446]: private type `Private` in public interface + --> tests/ui/private.rs:3:10 + | +3 | #[derive(RefCast, RefCastCustom)] + | ^^^^^^^ can't leak private type +... +9 | struct Private; + | -------------- `Private` declared as private + | + = note: this error originates in the derive macro `RefCast` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/vendor/ref-cast/tests/ui/repr-align.rs b/vendor/ref-cast/tests/ui/repr-align.rs new file mode 100644 index 00000000..3b4ff4ae --- /dev/null +++ b/vendor/ref-cast/tests/ui/repr-align.rs @@ -0,0 +1,9 @@ +use ref_cast::RefCast; + +#[derive(RefCast)] +#[repr(align(2), C, align = "2")] +struct Test { + s: String, +} + +fn main() {} diff --git a/vendor/ref-cast/tests/ui/repr-align.stderr b/vendor/ref-cast/tests/ui/repr-align.stderr new file mode 100644 index 00000000..64e388a3 --- /dev/null +++ b/vendor/ref-cast/tests/ui/repr-align.stderr @@ -0,0 +1,17 @@ +error: aligned repr on struct that implements RefCast is not supported + --> tests/ui/repr-align.rs:4:8 + | +4 | #[repr(align(2), C, align = "2")] + | ^^^^^^^^ + +error: aligned repr on struct that implements RefCast is not supported + --> tests/ui/repr-align.rs:4:21 + | +4 | #[repr(align(2), C, align = "2")] + | ^^^^^^^^^^^ + +error[E0693]: incorrect `repr(align)` attribute format + --> tests/ui/repr-align.rs:4:21 + | +4 | #[repr(align(2), C, align = "2")] + | ^^^^^^^^^^^ help: use parentheses instead: `align(2)` diff --git a/vendor/ref-cast/tests/ui/short-lifetime.rs b/vendor/ref-cast/tests/ui/short-lifetime.rs new file mode 100644 index 00000000..83783c39 --- /dev/null +++ b/vendor/ref-cast/tests/ui/short-lifetime.rs @@ -0,0 +1,12 @@ +use ref_cast::{ref_cast_custom, RefCastCustom}; + +#[derive(RefCastCustom)] +#[repr(transparent)] +pub struct Thing(String); + +impl Thing { + #[ref_cast_custom] + pub fn ref_cast<'a>(s: &String) -> &'a Self; +} + +fn main() {} diff --git a/vendor/ref-cast/tests/ui/short-lifetime.stderr b/vendor/ref-cast/tests/ui/short-lifetime.stderr new file mode 100644 index 00000000..d3bfde1e --- /dev/null +++ b/vendor/ref-cast/tests/ui/short-lifetime.stderr @@ -0,0 +1,7 @@ +error[E0621]: explicit lifetime required in the type of `s` + --> tests/ui/short-lifetime.rs:9:48 + | +9 | pub fn ref_cast<'a>(s: &String) -> &'a Self; + | ------- ^ lifetime `'a` required + | | + | help: add explicit lifetime `'a` to the type of `s`: `&'a String` diff --git a/vendor/ref-cast/tests/ui/unrecognized-repr.rs b/vendor/ref-cast/tests/ui/unrecognized-repr.rs new file mode 100644 index 00000000..f74e0dc2 --- /dev/null +++ b/vendor/ref-cast/tests/ui/unrecognized-repr.rs @@ -0,0 +1,9 @@ +use ref_cast::RefCast; + +#[derive(RefCast)] +#[repr(packed, C, usize, usize(0), usize = "0")] +struct Test { + s: String, +} + +fn main() {} diff --git a/vendor/ref-cast/tests/ui/unrecognized-repr.stderr b/vendor/ref-cast/tests/ui/unrecognized-repr.stderr new file mode 100644 index 00000000..ae5f2c15 --- /dev/null +++ b/vendor/ref-cast/tests/ui/unrecognized-repr.stderr @@ -0,0 +1,39 @@ +error: unrecognized repr on struct that implements RefCast + --> tests/ui/unrecognized-repr.rs:4:19 + | +4 | #[repr(packed, C, usize, usize(0), usize = "0")] + | ^^^^^ + +error: unrecognized repr on struct that implements RefCast + --> tests/ui/unrecognized-repr.rs:4:26 + | +4 | #[repr(packed, C, usize, usize(0), usize = "0")] + | ^^^^^^^^ + +error: unrecognized repr on struct that implements RefCast + --> tests/ui/unrecognized-repr.rs:4:36 + | +4 | #[repr(packed, C, usize, usize(0), usize = "0")] + | ^^^^^^^^^^^ + +error[E0552]: invalid representation hint: `usize` does not take a parenthesized argument list + --> tests/ui/unrecognized-repr.rs:4:26 + | +4 | #[repr(packed, C, usize, usize(0), usize = "0")] + | ^^^^^^^^ + +error[E0552]: invalid representation hint: `usize` does not take a value + --> tests/ui/unrecognized-repr.rs:4:36 + | +4 | #[repr(packed, C, usize, usize(0), usize = "0")] + | ^^^^^^^^^^^ + +error[E0517]: attribute should be applied to an enum + --> tests/ui/unrecognized-repr.rs:4:19 + | +4 | #[repr(packed, C, usize, usize(0), usize = "0")] + | ^^^^^ +5 | / struct Test { +6 | | s: String, +7 | | } + | |_- not an enum |
