mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 05:11:16 +00:00
Bug 1744669 - Bulk update of rust crates. m, o, p, q. r=emilio
This updates all crates that can be updated with no addition of new crates, that start with letter m, o, p or q. Differential Revision: https://phabricator.services.mozilla.com/D133032
This commit is contained in:
parent
6c3cb341b2
commit
1430e9adae
54
Cargo.lock
generated
54
Cargo.lock
generated
@ -565,7 +565,7 @@ dependencies = [
|
||||
"cstr",
|
||||
"log",
|
||||
"malloc_size_of_derive",
|
||||
"memmap2 0.3.0",
|
||||
"memmap2 0.3.1",
|
||||
"moz_task",
|
||||
"nserror",
|
||||
"nsstring",
|
||||
@ -948,7 +948,7 @@ dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"crossbeam-utils 0.8.5",
|
||||
"lazy_static",
|
||||
"memoffset 0.6.4",
|
||||
"memoffset 0.6.5",
|
||||
"scopeguard",
|
||||
]
|
||||
|
||||
@ -1759,7 +1759,7 @@ dependencies = [
|
||||
"futures-sink",
|
||||
"futures-task",
|
||||
"memchr",
|
||||
"pin-project-lite 0.2.6",
|
||||
"pin-project-lite 0.2.7",
|
||||
"pin-utils",
|
||||
"slab",
|
||||
]
|
||||
@ -2648,7 +2648,7 @@ dependencies = [
|
||||
"fluent-bundle",
|
||||
"fluent-fallback",
|
||||
"futures 0.3.18",
|
||||
"pin-project-lite 0.2.6",
|
||||
"pin-project-lite 0.2.7",
|
||||
"replace_with",
|
||||
"rustc-hash",
|
||||
"unic-langid",
|
||||
@ -2909,9 +2909,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "matches"
|
||||
version = "0.1.8"
|
||||
version = "0.1.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08"
|
||||
checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f"
|
||||
|
||||
[[package]]
|
||||
name = "maybe-uninit"
|
||||
@ -2932,9 +2932,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.4.0"
|
||||
version = "2.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b16bd47d9e329435e309c58469fe0791c2d0d1ba96ec0954152a5ae2b04387dc"
|
||||
checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a"
|
||||
|
||||
[[package]]
|
||||
name = "memmap2"
|
||||
@ -2947,9 +2947,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "memmap2"
|
||||
version = "0.3.0"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "20ff203f7bdc401350b1dbaa0355135777d25f41c0bbc601851bbd6cf61e8ff5"
|
||||
checksum = "00b6c2ebff6180198788f5db08d7ce3bc1d0b617176678831a7510825973e357"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
@ -2965,9 +2965,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "memoffset"
|
||||
version = "0.6.4"
|
||||
version = "0.6.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "59accc507f1338036a0477ef61afdae33cde60840f4dfe481319ce3ad116ddf9"
|
||||
checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
]
|
||||
@ -3523,9 +3523,9 @@ checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56"
|
||||
|
||||
[[package]]
|
||||
name = "opaque-debug"
|
||||
version = "0.2.1"
|
||||
version = "0.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "51ecbcb821e1bd256d456fe858aaa7f380b63863eab2eb86eee1bd9f33dd6682"
|
||||
checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c"
|
||||
|
||||
[[package]]
|
||||
name = "ordered-float"
|
||||
@ -3763,9 +3763,9 @@ checksum = "257b64915a082f7811703966789728173279bdebb956b143dbcd23f6f970a777"
|
||||
|
||||
[[package]]
|
||||
name = "pin-project-lite"
|
||||
version = "0.2.6"
|
||||
version = "0.2.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dc0e1f259c92177c30a4c9d177246edd0a3568b25756a977d0632cf8fa37e905"
|
||||
checksum = "8d31d11c69a6b52a174b42bdc0c30e5e11670f90788b2c471c31c1d17d449443"
|
||||
|
||||
[[package]]
|
||||
name = "pin-utils"
|
||||
@ -3785,9 +3785,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "pkg-config"
|
||||
version = "0.3.19"
|
||||
version = "0.3.23"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c"
|
||||
checksum = "d1a3ea4f0dd7f1f3e512cf97bf100819aa547f36a6eccac8dbaae839eb92363e"
|
||||
|
||||
[[package]]
|
||||
name = "plain"
|
||||
@ -3829,9 +3829,9 @@ checksum = "b18befed8bc2b61abc79a457295e7e838417326da1586050b919414073977f19"
|
||||
|
||||
[[package]]
|
||||
name = "ppv-lite86"
|
||||
version = "0.2.10"
|
||||
version = "0.2.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857"
|
||||
checksum = "ed0cfbc8191465bed66e1718596ee0b0b35d5ee1f41c5df2189d0fe8bde535ba"
|
||||
|
||||
[[package]]
|
||||
name = "precomputed-hash"
|
||||
@ -3875,9 +3875,9 @@ checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.27"
|
||||
version = "1.0.33"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f0d8caf72986c1a598726adc988bb5984792ef84f5ee5aa50209145ee8077038"
|
||||
checksum = "fb37d2df5df740e582f28f8560cf425f52bb267d872fe58358eadb554909f07a"
|
||||
dependencies = [
|
||||
"unicode-xid",
|
||||
]
|
||||
@ -3905,7 +3905,7 @@ name = "profiler_helper"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"goblin",
|
||||
"memmap2 0.3.0",
|
||||
"memmap2 0.3.1",
|
||||
"object",
|
||||
"rustc-demangle",
|
||||
"thin-vec",
|
||||
@ -3914,9 +3914,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "profiling"
|
||||
version = "1.0.2"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0a7c000c0ce9d9bb94c0fbacdf20e5087fbe652c556ffb2c9387d980e17d51fb"
|
||||
checksum = "9926767b8b8244d7b6b64546585121d193c3d0b4856ccd656b7bfa9deb91ab6a"
|
||||
|
||||
[[package]]
|
||||
name = "prost"
|
||||
@ -3985,9 +3985,9 @@ checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0"
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.9"
|
||||
version = "1.0.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7"
|
||||
checksum = "38bc8cc6a5f2e3655e0899c1b848643b2562f853f114bfec7be120678e3ace05"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
|
@ -1 +1 @@
|
||||
{"files":{"Cargo.toml":"b54a1f583b0b495de45e38e226e76827fd136dbda6f08e8aaab1131effa962ae","LICENSE":"d7b49708075b5f43f8e108464f1970c8c66fa8b6afce4f9c944da3af77cc1460","lib.rs":"a78ab8c8db5af687988fedf40e9de77e5f52b6891f4c87190103b852ba6bef4e","tests/macro_use_one.rs":"4f599fae16f1aef369050bf0ad74cbefec06c430b29e0c9ab0811ac9592e997a"},"package":"7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08"}
|
||||
{"files":{"Cargo.toml":"194024a82bba1c84226ac827330511fba74474a7914b1319e6700285c15f5812","LICENSE":"d7b49708075b5f43f8e108464f1970c8c66fa8b6afce4f9c944da3af77cc1460","lib.rs":"9f4187510972f5fc356ca60d19daa0e69643dd6b530edf7c928cbd75a2b990c5","tests/macro_use_one.rs":"4f599fae16f1aef369050bf0ad74cbefec06c430b29e0c9ab0811ac9592e997a","tests/use_star.rs":"39a23b8002544f65e7a896e2cefe8e0af7404151fa65d327e748f5c1101badf8"},"package":"a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f"}
|
4
third_party/rust/matches/Cargo.toml
vendored
4
third_party/rust/matches/Cargo.toml
vendored
@ -3,7 +3,7 @@
|
||||
# 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
|
||||
# to registry (e.g., crates.io) dependencies
|
||||
#
|
||||
# If you believe there's an error in this file please file an
|
||||
# issue against the rust-lang/cargo repository. If you're
|
||||
@ -12,7 +12,7 @@
|
||||
|
||||
[package]
|
||||
name = "matches"
|
||||
version = "0.1.8"
|
||||
version = "0.1.9"
|
||||
authors = ["Simon Sapin <simon.sapin@exyr.org>"]
|
||||
description = "A macro to evaluate, as a boolean, whether an expression matches a pattern."
|
||||
documentation = "https://docs.rs/matches/"
|
||||
|
2
third_party/rust/matches/lib.rs
vendored
2
third_party/rust/matches/lib.rs
vendored
@ -1,3 +1,5 @@
|
||||
#![no_std]
|
||||
|
||||
/// Check if an expression matches a refutable pattern.
|
||||
///
|
||||
/// Syntax: `matches!(` *expression* `,` *pattern* `)`
|
||||
|
10
third_party/rust/matches/tests/use_star.rs
vendored
Normal file
10
third_party/rust/matches/tests/use_star.rs
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
//! https://github.com/SimonSapin/rust-std-candidates/issues/22
|
||||
|
||||
extern crate matches;
|
||||
|
||||
use matches::*;
|
||||
|
||||
#[test]
|
||||
fn test_assert_matches() {
|
||||
assert_matches!(4, 4)
|
||||
}
|
2
third_party/rust/memchr/.cargo-checksum.json
vendored
2
third_party/rust/memchr/.cargo-checksum.json
vendored
@ -1 +1 @@
|
||||
{"files":{"COPYING":"01c266bced4a434da0051174d6bee16a4c82cf634e2679b6155d40d75012390f","Cargo.toml":"7badd40099fd459f028cb7bd6ade03a4cbdcc4cdb1b1ea865e897a3a51cf8d43","LICENSE-MIT":"0f96a83840e146e43c0ec96a22ec1f392e0680e6c1226e6f3ba87e0740af850f","README.md":"f77810103b6c10bd2234828f0d4de14b7b6e0000dcdaa5dec907a1b7a1b1dcb9","UNLICENSE":"7e12e5df4bae12cb21581ba157ced20e1986a0508dd10d0e8a4ab9a4cf94e85c","build.rs":"740225b5280e53e8d73971c6ccc55152d6af32e94132bc6980fdc0eb1fb3ab48","rustfmt.toml":"1ca600239a27401c4a43f363cf3f38183a212affc1f31bff3ae93234bbaec228","src/cow.rs":"873d2349577b333e8ae0a925855285f2db32b652455983b4511b67d928af7485","src/lib.rs":"bd81de1030e6553d1b711e0482f00864e78ca8888147b26cc2d08384ffd4fb89","src/memchr/c.rs":"34f7caf79316f4b03908832fdbd4aff367f2bc30eae291478cc5a0a108ce6e76","src/memchr/fallback.rs":"48764f18b7ff1f00a9ac1c4ed8ec96ad11f7b09b2d062a8ed3fe81160add627d","src/memchr/iter.rs":"61463e7fa22ca8f212c2cbfb882af0c87b0fb1bc6b4676678a4822a581ec1037","src/memchr/mod.rs":"d5bfc881c7c089e1a0825209a4d21c3f792f38c6f16f3bc715d0d539477376b6","src/memchr/naive.rs":"c7453bc99cc4e58eb37cf5a50c88688833e50a270ee1849baefddb8acc0ccd94","src/memchr/x86/avx.rs":"3c2750174ce7ff033daa4096e7961bbee9a2da898068266b27dee22ef8cfddad","src/memchr/x86/mod.rs":"a642d5aefdb7452ead4ab7946b5c6cfb6cc6df636dcd0ebbd6f5e6e1ac8305c0","src/memchr/x86/sse2.rs":"79ede1aba71a655e86eb5873d682c5da26933bffa4fffd7042a2313f18cf4675","src/memchr/x86/sse42.rs":"de4c6f354dbfec170876cddb8d9157b35928f96ed2339a0c5d094cc953a2f52d","src/memmem/byte_frequencies.rs":"2fb85b381c038c1e44ce94294531cdcd339dca48b1e61f41455666e802cbbc9e","src/memmem/genericsimd.rs":"7d42f15f03cfec0bc387895b3a7b4ffd6a9c7517fdcd2d5bcd2018eb6b1a6aea","src/memmem/mod.rs":"c265518c0d9e6afca1536306de707e5817f81bc1528ca6956d92c8f5a1ed9248","src/memmem/prefilter/fallback.rs":"aa44ece210fbed15d2f61dd384f17b01cee9fcc1d20dfbf3472c57dc8f176f37","src/memmem/prefilter/genericsimd.rs":"57d5523cf0299b37ef1dd1b351e3d387d5070f2f7ecffc9a9ca66528101ebd3f","src/memmem/prefilter/mod.rs":"0e0c7d656497dc8a7d20cd446db1ebc05341fe2612d3864795704beae07df89f","src/memmem/prefilter/x86/avx.rs":"e344cae36a88b59c07a1c1d395edeb9c636a399e1528ce69b2bc7c94d8d8bb0b","src/memmem/prefilter/x86/mod.rs":"df2d84b23b22574383c281d33671a121b5faf7b1a48dd6f67c3085cd02cd4498","src/memmem/prefilter/x86/sse.rs":"d39af926e3d0f19dbf447f28d8b9833c470224fb3109f5500ef8de6f4bb1568b","src/memmem/rabinkarp.rs":"9b44eb092524a51792eba4deaca6c6d3cbc51db98cb548ea4fa7e5d8988cc71a","src/memmem/rarebytes.rs":"571082c71fc3dca5e4304171d41fb3c44e241df6dcd88bac4d7a15b52f9521e0","src/memmem/twoway.rs":"102f8bbb29696d5656cd2f5a1769a3af96d044fb09972881455cfb6424d6b50a","src/memmem/util.rs":"0194d40b912137e2352863af9cc1c0273baf97fdf6b27799628680846c06febd","src/memmem/vector.rs":"7925496f273e8d8837e7850d7d0592f5a3f0472a0e0f5d8852b6d6f8e2c45ecd","src/memmem/x86/avx.rs":"de85dbc415603c844baf94fbc92d676a738dd4b99246be468bd5f7be5921b25f","src/memmem/x86/mod.rs":"5012fca41b91caf229278aa221e8dd514ede497fe4938d64562d03fef2fc46e6","src/memmem/x86/sse.rs":"148a40c0952aca8b16d9eb3e724a5b9b60693bc7b2bcc5209bcc43c94faf560a","src/tests/memchr/iter.rs":"b68c7ecdb6222c5dbf61212e6863f78f98ad343868a74cb8612692fc790240b2","src/tests/memchr/memchr.rs":"09589c5899324c9b26ea4513c80389a2ffdf6ddc460031e2ca8da43bd493ae3f","src/tests/memchr/mod.rs":"29e0855f946c7babf603b3d610a29235a56a26a4c867fef0768542388eac4c95","src/tests/memchr/simple.rs":"b9997903ede972272c01c1750522a20692a28488cc7c5cf745ea83ff96d65fe3","src/tests/memchr/testdata.rs":"b74e613b1c7e89f2d78a13641607aafef5472b798162a55b15a736d6f961ef0a","src/tests/mod.rs":"9054a2a2f9af140f305ca29155d942fafbac9fb0874067611adc8a5990546be4","src/tests/x86_64-soft_float.json":"c0e416487fe9b4809534edb7db2a9eff3453dc40d9f1e23362c37f45a77ec717"},"package":"b16bd47d9e329435e309c58469fe0791c2d0d1ba96ec0954152a5ae2b04387dc"}
|
||||
{"files":{"COPYING":"01c266bced4a434da0051174d6bee16a4c82cf634e2679b6155d40d75012390f","Cargo.toml":"79d36439427134dd97c1a648579acb179dc594f960ab31abd0f447fdea4e7886","LICENSE-MIT":"0f96a83840e146e43c0ec96a22ec1f392e0680e6c1226e6f3ba87e0740af850f","README.md":"8e0a803533f359a91e0cedb0e664b4d880d5e571543eed2b58888dd84555cf0f","UNLICENSE":"7e12e5df4bae12cb21581ba157ced20e1986a0508dd10d0e8a4ab9a4cf94e85c","build.rs":"740225b5280e53e8d73971c6ccc55152d6af32e94132bc6980fdc0eb1fb3ab48","rustfmt.toml":"1ca600239a27401c4a43f363cf3f38183a212affc1f31bff3ae93234bbaec228","scripts/make-byte-frequency-table":"21d1ded41fe5a780507bb88e1910d471b4081cc626a48891a408712e45b7b2bf","src/cow.rs":"a23c3b009e5215b5c3ac46627a5dd844235bef0136d76b3fc1eeeb744565c125","src/lib.rs":"9430cd37b13399df8f8c27a752ccdf6422a563e24171d1b4802424f9193a8f37","src/memchr/c.rs":"34f7caf79316f4b03908832fdbd4aff367f2bc30eae291478cc5a0a108ce6e76","src/memchr/fallback.rs":"48764f18b7ff1f00a9ac1c4ed8ec96ad11f7b09b2d062a8ed3fe81160add627d","src/memchr/iter.rs":"61463e7fa22ca8f212c2cbfb882af0c87b0fb1bc6b4676678a4822a581ec1037","src/memchr/mod.rs":"d5bfc881c7c089e1a0825209a4d21c3f792f38c6f16f3bc715d0d539477376b6","src/memchr/naive.rs":"c7453bc99cc4e58eb37cf5a50c88688833e50a270ee1849baefddb8acc0ccd94","src/memchr/x86/avx.rs":"3c2750174ce7ff033daa4096e7961bbee9a2da898068266b27dee22ef8cfddad","src/memchr/x86/mod.rs":"a642d5aefdb7452ead4ab7946b5c6cfb6cc6df636dcd0ebbd6f5e6e1ac8305c0","src/memchr/x86/sse2.rs":"79ede1aba71a655e86eb5873d682c5da26933bffa4fffd7042a2313f18cf4675","src/memchr/x86/sse42.rs":"de4c6f354dbfec170876cddb8d9157b35928f96ed2339a0c5d094cc953a2f52d","src/memmem/byte_frequencies.rs":"2fb85b381c038c1e44ce94294531cdcd339dca48b1e61f41455666e802cbbc9e","src/memmem/genericsimd.rs":"9ce7283db0994438eb6df2bea6ad984e80512b6f643ebae7ae7d82eb5d39fa11","src/memmem/mod.rs":"c265518c0d9e6afca1536306de707e5817f81bc1528ca6956d92c8f5a1ed9248","src/memmem/prefilter/fallback.rs":"d32248c41aa09701c2410c52f948bbe009dd1b13a01b444ce0fb8c4b4e404ede","src/memmem/prefilter/genericsimd.rs":"57d5523cf0299b37ef1dd1b351e3d387d5070f2f7ecffc9a9ca66528101ebd3f","src/memmem/prefilter/mod.rs":"108bbab9ccca2843996c4e5def7db9210841c610d28493a18163ea1b63e6a785","src/memmem/prefilter/x86/avx.rs":"e344cae36a88b59c07a1c1d395edeb9c636a399e1528ce69b2bc7c94d8d8bb0b","src/memmem/prefilter/x86/mod.rs":"df2d84b23b22574383c281d33671a121b5faf7b1a48dd6f67c3085cd02cd4498","src/memmem/prefilter/x86/sse.rs":"d39af926e3d0f19dbf447f28d8b9833c470224fb3109f5500ef8de6f4bb1568b","src/memmem/rabinkarp.rs":"9b44eb092524a51792eba4deaca6c6d3cbc51db98cb548ea4fa7e5d8988cc71a","src/memmem/rarebytes.rs":"571082c71fc3dca5e4304171d41fb3c44e241df6dcd88bac4d7a15b52f9521e0","src/memmem/twoway.rs":"102f8bbb29696d5656cd2f5a1769a3af96d044fb09972881455cfb6424d6b50a","src/memmem/util.rs":"0194d40b912137e2352863af9cc1c0273baf97fdf6b27799628680846c06febd","src/memmem/vector.rs":"7925496f273e8d8837e7850d7d0592f5a3f0472a0e0f5d8852b6d6f8e2c45ecd","src/memmem/x86/avx.rs":"de85dbc415603c844baf94fbc92d676a738dd4b99246be468bd5f7be5921b25f","src/memmem/x86/mod.rs":"5012fca41b91caf229278aa221e8dd514ede497fe4938d64562d03fef2fc46e6","src/memmem/x86/sse.rs":"148a40c0952aca8b16d9eb3e724a5b9b60693bc7b2bcc5209bcc43c94faf560a","src/tests/memchr/iter.rs":"b68c7ecdb6222c5dbf61212e6863f78f98ad343868a74cb8612692fc790240b2","src/tests/memchr/memchr.rs":"09589c5899324c9b26ea4513c80389a2ffdf6ddc460031e2ca8da43bd493ae3f","src/tests/memchr/mod.rs":"29e0855f946c7babf603b3d610a29235a56a26a4c867fef0768542388eac4c95","src/tests/memchr/simple.rs":"b9997903ede972272c01c1750522a20692a28488cc7c5cf745ea83ff96d65fe3","src/tests/memchr/testdata.rs":"3e34377fe60eca3687d1ebc66127bd631af27ceaccc8f08806a293199b69a83f","src/tests/mod.rs":"9054a2a2f9af140f305ca29155d942fafbac9fb0874067611adc8a5990546be4","src/tests/x86_64-soft_float.json":"c0e416487fe9b4809534edb7db2a9eff3453dc40d9f1e23362c37f45a77ec717"},"package":"308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a"}
|
25
third_party/rust/memchr/Cargo.toml
vendored
25
third_party/rust/memchr/Cargo.toml
vendored
@ -3,26 +3,25 @@
|
||||
# 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
|
||||
# to registry (e.g., crates.io) dependencies.
|
||||
#
|
||||
# If you believe there's an error in this file please file an
|
||||
# issue against the rust-lang/cargo repository. If you're
|
||||
# editing this file be aware that the upstream Cargo.toml
|
||||
# will likely look very different (and much more reasonable)
|
||||
# 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 = "memchr"
|
||||
version = "2.4.0"
|
||||
version = "2.4.1"
|
||||
authors = ["Andrew Gallant <jamslam@gmail.com>", "bluss"]
|
||||
exclude = ["/bench", "/.github", "/fuzz"]
|
||||
description = "Safe interface to memchr."
|
||||
homepage = "https://github.com/BurntSushi/rust-memchr"
|
||||
homepage = "https://github.com/BurntSushi/memchr"
|
||||
documentation = "https://docs.rs/memchr/"
|
||||
readme = "README.md"
|
||||
keywords = ["memchr", "char", "scan", "strchr", "string"]
|
||||
license = "Unlicense/MIT"
|
||||
repository = "https://github.com/BurntSushi/rust-memchr"
|
||||
repository = "https://github.com/BurntSushi/memchr"
|
||||
[profile.bench]
|
||||
debug = true
|
||||
|
||||
@ -36,6 +35,15 @@ debug = true
|
||||
[lib]
|
||||
name = "memchr"
|
||||
bench = false
|
||||
[dependencies.compiler_builtins]
|
||||
version = "0.1.2"
|
||||
optional = true
|
||||
|
||||
[dependencies.core]
|
||||
version = "1.0.0"
|
||||
optional = true
|
||||
package = "rustc-std-workspace-core"
|
||||
|
||||
[dependencies.libc]
|
||||
version = "0.2.18"
|
||||
optional = true
|
||||
@ -46,5 +54,6 @@ default-features = false
|
||||
|
||||
[features]
|
||||
default = ["std"]
|
||||
rustc-dep-of-std = ["core", "compiler_builtins"]
|
||||
std = []
|
||||
use_std = ["std"]
|
||||
|
24
third_party/rust/memchr/README.md
vendored
24
third_party/rust/memchr/README.md
vendored
@ -2,7 +2,7 @@ memchr
|
||||
======
|
||||
This library provides heavily optimized routines for string search primitives.
|
||||
|
||||
[![Build status](https://github.com/BurntSushi/rust-memchr/workflows/ci/badge.svg)](https://github.com/BurntSushi/rust-memchr/actions)
|
||||
[![Build status](https://github.com/BurntSushi/memchr/workflows/ci/badge.svg)](https://github.com/BurntSushi/memchr/actions)
|
||||
[![](https://meritbadge.herokuapp.com/memchr)](https://crates.io/crates/memchr)
|
||||
|
||||
Dual-licensed under MIT or the [UNLICENSE](https://unlicense.org/).
|
||||
@ -84,4 +84,24 @@ approaches:
|
||||
* A huge suite of benchmarks that are also run as tests. Benchmarks always
|
||||
confirm that the expected result occurs.
|
||||
|
||||
Improvements to the testing infrastructue are very welcome.
|
||||
Improvements to the testing infrastructure are very welcome.
|
||||
|
||||
|
||||
### Algorithms used
|
||||
|
||||
At time of writing, this crate's implementation of substring search actually
|
||||
has a few different algorithms to choose from depending on the situation.
|
||||
|
||||
* For very small haystacks,
|
||||
[Rabin-Karp](https://en.wikipedia.org/wiki/Rabin%E2%80%93Karp_algorithm)
|
||||
is used to reduce latency. Rabin-Karp has very small overhead and can often
|
||||
complete before other searchers have even been constructed.
|
||||
* For small needles, a variant of the
|
||||
["Generic SIMD"](http://0x80.pl/articles/simd-strfind.html#algorithm-1-generic-simd)
|
||||
algorithm is used. Instead of using the first and last bytes, a heuristic is
|
||||
used to select bytes based on a background distribution of byte frequencies.
|
||||
* In all other cases,
|
||||
[Two-Way](https://en.wikipedia.org/wiki/Two-way_string-matching_algorithm)
|
||||
is used. If possible, a prefilter based on the "Generic SIMD" algorithm
|
||||
linked above is used to find candidates quickly. A dynamic heuristic is used
|
||||
to detect if the prefilter is ineffective, and if so, disables it.
|
||||
|
74
third_party/rust/memchr/scripts/make-byte-frequency-table
vendored
Executable file
74
third_party/rust/memchr/scripts/make-byte-frequency-table
vendored
Executable file
@ -0,0 +1,74 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
# This does simple normalized frequency analysis on UTF-8 encoded text. The
|
||||
# result of the analysis is translated to a ranked list, where every byte is
|
||||
# assigned a rank. This list is written to src/freqs.rs.
|
||||
#
|
||||
# Currently, the frequencies are generated from the following corpuses:
|
||||
#
|
||||
# * The CIA world fact book
|
||||
# * The source code of rustc
|
||||
# * Septuaginta
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
import argparse
|
||||
from collections import Counter
|
||||
import sys
|
||||
|
||||
preamble = '''
|
||||
// NOTE: The following code was generated by "scripts/frequencies.py", do not
|
||||
// edit directly
|
||||
'''.lstrip()
|
||||
|
||||
|
||||
def eprint(*args, **kwargs):
|
||||
kwargs['file'] = sys.stderr
|
||||
print(*args, **kwargs)
|
||||
|
||||
|
||||
def main():
|
||||
p = argparse.ArgumentParser()
|
||||
p.add_argument('corpus', metavar='FILE', nargs='+')
|
||||
args = p.parse_args()
|
||||
|
||||
# Get frequency counts of each byte.
|
||||
freqs = Counter()
|
||||
for i in range(0, 256):
|
||||
freqs[i] = 0
|
||||
|
||||
eprint('reading entire corpus into memory')
|
||||
corpus = []
|
||||
for fpath in args.corpus:
|
||||
corpus.append(open(fpath, 'rb').read())
|
||||
|
||||
eprint('computing byte frequencies')
|
||||
for c in corpus:
|
||||
for byte in c:
|
||||
freqs[byte] += 1.0 / float(len(c))
|
||||
|
||||
eprint('writing Rust code')
|
||||
# Get the rank of each byte. A lower rank => lower relative frequency.
|
||||
rank = [0] * 256
|
||||
for i, (byte, _) in enumerate(freqs.most_common()):
|
||||
# print(byte)
|
||||
rank[byte] = 255 - i
|
||||
|
||||
# Forcefully set the highest rank possible for bytes that start multi-byte
|
||||
# UTF-8 sequences. The idea here is that a continuation byte will be more
|
||||
# discerning in a homogenous haystack.
|
||||
for byte in range(0xC0, 0xFF + 1):
|
||||
rank[byte] = 255
|
||||
|
||||
# Now write Rust.
|
||||
olines = ['pub const BYTE_FREQUENCIES: [u8; 256] = [']
|
||||
for byte in range(256):
|
||||
olines.append(' %3d, // %r' % (rank[byte], chr(byte)))
|
||||
olines.append('];')
|
||||
|
||||
print(preamble)
|
||||
print('\n'.join(olines))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
2
third_party/rust/memchr/src/cow.rs
vendored
2
third_party/rust/memchr/src/cow.rs
vendored
@ -5,7 +5,7 @@ use core::ops;
|
||||
/// The purpose of this type is to permit usage of a "borrowed or owned
|
||||
/// byte string" in a way that keeps std/no-std compatibility. That is, in
|
||||
/// no-std mode, this type devolves into a simple &[u8] with no owned variant
|
||||
/// availble. We can't just use a plain Cow because Cow is not in core.
|
||||
/// available. We can't just use a plain Cow because Cow is not in core.
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct CowBytes<'a>(Imp<'a>);
|
||||
|
||||
|
2
third_party/rust/memchr/src/lib.rs
vendored
2
third_party/rust/memchr/src/lib.rs
vendored
@ -160,7 +160,7 @@ standard library exposes a platform independent SIMD API.
|
||||
#![cfg_attr(miri, allow(dead_code, unused_macros))]
|
||||
|
||||
// Supporting 8-bit (or others) would be fine. If you need it, please submit a
|
||||
// bug report at https://github.com/BurntSushi/rust-memchr
|
||||
// bug report at https://github.com/BurntSushi/memchr
|
||||
#[cfg(not(any(
|
||||
target_pointer_width = "16",
|
||||
target_pointer_width = "32",
|
||||
|
@ -195,7 +195,9 @@ pub(crate) unsafe fn fwd_find<V: Vector>(
|
||||
}
|
||||
|
||||
/// Search for an occurrence of two rare bytes from the needle in the chunk
|
||||
/// pointed to by ptr, with the end of the haystack pointed to by end_ptr.
|
||||
/// pointed to by ptr, with the end of the haystack pointed to by end_ptr. When
|
||||
/// an occurrence is found, memcmp is run to check if a match occurs at the
|
||||
/// corresponding position.
|
||||
///
|
||||
/// rare1chunk and rare2chunk correspond to vectors with the rare1 and rare2
|
||||
/// bytes repeated in each 8-bit lane, respectively.
|
||||
@ -210,7 +212,7 @@ pub(crate) unsafe fn fwd_find<V: Vector>(
|
||||
///
|
||||
/// It must be safe to do an unaligned read of size(V) bytes starting at both
|
||||
/// (ptr + rare1i) and (ptr + rare2i). It must also be safe to do unaligned
|
||||
/// loads on ptr up to end_ptr.
|
||||
/// loads on ptr up to (end_ptr - needle.len()).
|
||||
#[inline(always)]
|
||||
unsafe fn fwd_find_in_chunk<V: Vector>(
|
||||
fwd: &Forward,
|
||||
|
@ -20,7 +20,7 @@ make use of the background frequency distribution of bytes though.)
|
||||
|
||||
This fallback implementation was originally formulated in regex many moons ago:
|
||||
https://github.com/rust-lang/regex/blob/3db8722d0b204a85380fe2a65e13d7065d7dd968/src/literal/imp.rs#L370-L501
|
||||
Prior to that, I'm not aware of anyone using this technique in any prominant
|
||||
Prior to that, I'm not aware of anyone using this technique in any prominent
|
||||
substring search implementation. Although, I'm sure folks have had this same
|
||||
insight long before me.
|
||||
|
||||
|
@ -18,7 +18,7 @@ const MAX_FALLBACK_RANK: usize = 250;
|
||||
/// instead of needing to pass around all three as distinct function
|
||||
/// parameters.
|
||||
pub(crate) struct Pre<'a> {
|
||||
/// State that tracks the effectivess of a prefilter.
|
||||
/// State that tracks the effectiveness of a prefilter.
|
||||
pub(crate) state: &'a mut PrefilterState,
|
||||
/// The actual prefilter function.
|
||||
pub(crate) prefn: PrefilterFn,
|
||||
@ -146,7 +146,7 @@ impl core::fmt::Debug for PrefilterFn {
|
||||
/// The use of prefilters in this implementation does use a heuristic to detect
|
||||
/// when a prefilter might not be carrying its weight, and will dynamically
|
||||
/// disable its use. Nevertheless, this configuration option gives callers
|
||||
/// the ability to disable pefilters if you have knowledge that they won't be
|
||||
/// the ability to disable prefilters if you have knowledge that they won't be
|
||||
/// useful.
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
#[non_exhaustive]
|
||||
|
@ -160,7 +160,7 @@ impl MemchrTest {
|
||||
//
|
||||
// You might think this would cause most needles to not be found, but
|
||||
// we actually expand our tests to include corpus sizes all the way up
|
||||
// to >500 bytes, so we should exericse most branches.
|
||||
// to >500 bytes, so we should exercise most branches.
|
||||
for align in 0..130 {
|
||||
let corpus = self.corpus(align);
|
||||
assert_eq!(
|
||||
|
@ -1 +1 @@
|
||||
{"files":{"CHANGELOG.md":"10ef814dd214d3a2a02466d950c57eb275b02b61ace476ac5258b6932695e9d3","Cargo.lock":"3bdb2b8a0a0b28c11923a3e9c02880a26b71f7a112bdbd6ee0219a044176930b","Cargo.toml":"f9fa506d36e5644b6e334b85cf1b3df707f0b8df0224383125dc6984174af8c7","LICENSE-APACHE":"04ea4849dba9dcae07113850c6f1b1a69052c625210639914eee352023f750ad","LICENSE-MIT":"e9116f7228fce981d81aa680ae1add0cfb8122c35d801c4664d3d674ad0beda8","README.md":"4e70c39451ff48d9b60e2a0db4754fefc2fe349149b4baf4747ca3556ac7ae15","examples/cat.rs":"ab0b575d19662e2d5b6c7cea2756b57530e495d56acdb4fd2b56c0ba4d768dfd","src/lib.rs":"829cd8a727513888172fb158ed4efcdc9c3081ff9483301e9474a4369b8da5a0","src/stub.rs":"f64675e86e590aa5aea779a60c22153fe4ab47a3d021b74f6dd697227e9971b1","src/unix.rs":"4cabd924f8bd822a82e7d68dfaad8cc24c7e8f350bff5b24474ea2bdd60c29b7","src/windows.rs":"e5c1f1ba250e7d30cdf9c347dd9403ff2e65bcc427b0ec5e02fc387a6f7c6468"},"package":"20ff203f7bdc401350b1dbaa0355135777d25f41c0bbc601851bbd6cf61e8ff5"}
|
||||
{"files":{"CHANGELOG.md":"1d984b7fd11609a7dafd72c48ae294aa6c0cd202c45797c4e5bbb9e861ef4334","Cargo.lock":"589809de388088d9ef97fad54e41d817013fae9d861029bf564181ca3a4fd973","Cargo.toml":"f9e95c4b10ade059adbdc85235f631cb45fa5e6386cdc928713aa3e9f93319b8","LICENSE-APACHE":"04ea4849dba9dcae07113850c6f1b1a69052c625210639914eee352023f750ad","LICENSE-MIT":"0d25d03b5ab49576178ad0cae7a2648d12c17ad0452fe49c07e55e4b59aa5257","README.md":"a318cac19725dfbf39890da55f6a48fcb11a32790819c66d776eaeb20fb03d50","examples/cat.rs":"ab0b575d19662e2d5b6c7cea2756b57530e495d56acdb4fd2b56c0ba4d768dfd","src/lib.rs":"fd69a723368ccf3656877230328dbbbef5778061f0d73567c434c111e97078bd","src/stub.rs":"6041ed9bbc6186e05a04ed3a8e5dbcb7ad8feb0135e617a3b0f1f09134ebcdf8","src/unix.rs":"6e6871ccfe0b0d56ba23400c0b45878433eb033d1a080dbf9d524923d76e4b9a","src/windows.rs":"1028d14387456fa785d2a31d8198794e2d4fe109f9ce8422610cc1bd26ace57c"},"package":"00b6c2ebff6180198788f5db08d7ce3bc1d0b617176678831a7510825973e357"}
|
12
third_party/rust/memmap2/CHANGELOG.md
vendored
12
third_party/rust/memmap2/CHANGELOG.md
vendored
@ -6,14 +6,19 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [0.3.1] - 2021-08-15
|
||||
### Fixed
|
||||
- Integer overflow during file length calculation on 32bit targets.
|
||||
- Stub implementation. [@Mrmaxmeier](https://github.com/Mrmaxmeier)
|
||||
|
||||
## [0.3.0] - 2021-06-10
|
||||
### Changed
|
||||
- `MmapOptions` allows mapping using Unix descriptors and not only `std::fs:File` now.
|
||||
- `MmapOptions` allows mapping using Unix descriptors and not only `std::fs::File` now.
|
||||
[@mripard](https://github.com/mripard)
|
||||
|
||||
## [0.2.3] - 2021-05-24
|
||||
### Added
|
||||
- Allow compilation on unsupported platform.
|
||||
- Allow compilation on unsupported platforms.
|
||||
The code will panic on access just like in `std`.
|
||||
[@jcaesar](https://github.com/jcaesar)
|
||||
|
||||
@ -45,7 +50,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
### Removed
|
||||
- `winapi` dependency. [memmap-rs/pull/89](https://github.com/danburkert/memmap-rs/pull/89)
|
||||
|
||||
[Unreleased]: https://github.com/RazrFalcon/memmap2-rs/compare/v0.3.0...HEAD
|
||||
[Unreleased]: https://github.com/RazrFalcon/memmap2-rs/compare/v0.3.1...HEAD
|
||||
[0.3.1]: https://github.com/RazrFalcon/memmap2-rs/compare/v0.3.0...v0.3.1
|
||||
[0.3.0]: https://github.com/RazrFalcon/memmap2-rs/compare/v0.2.3...v0.3.0
|
||||
[0.2.3]: https://github.com/RazrFalcon/memmap2-rs/compare/v0.2.2...v0.2.3
|
||||
[0.2.2]: https://github.com/RazrFalcon/memmap2-rs/compare/v0.2.1...v0.2.2
|
||||
|
8
third_party/rust/memmap2/Cargo.lock
generated
vendored
8
third_party/rust/memmap2/Cargo.lock
generated
vendored
@ -1,5 +1,7 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "fuchsia-cprng"
|
||||
version = "0.1.1"
|
||||
@ -8,13 +10,13 @@ checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba"
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.96"
|
||||
version = "0.2.99"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5600b4e6efc5421841a2138a6b082e07fe12f9aaa12783d50e5d13325b26b4fc"
|
||||
checksum = "a7f823d141fe0a24df1e23b4af4e3c7ba9e5966ec514ea068c93024aa7deb765"
|
||||
|
||||
[[package]]
|
||||
name = "memmap2"
|
||||
version = "0.3.0"
|
||||
version = "0.3.1"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"tempdir",
|
||||
|
4
third_party/rust/memmap2/Cargo.toml
vendored
4
third_party/rust/memmap2/Cargo.toml
vendored
@ -13,8 +13,8 @@
|
||||
[package]
|
||||
edition = "2018"
|
||||
name = "memmap2"
|
||||
version = "0.3.0"
|
||||
authors = ["Dan Burkert <dan@danburkert.com>", "Evgeniy Reizner <razrfalcon@gmail.com>"]
|
||||
version = "0.3.1"
|
||||
authors = ["Dan Burkert <dan@danburkert.com>", "Yevhenii Reizner <razrfalcon@gmail.com>"]
|
||||
description = "Cross-platform Rust API for memory-mapped file IO"
|
||||
documentation = "https://docs.rs/memmap2"
|
||||
keywords = ["mmap", "memory-map", "io", "file"]
|
||||
|
2
third_party/rust/memmap2/LICENSE-MIT
vendored
2
third_party/rust/memmap2/LICENSE-MIT
vendored
@ -1,4 +1,4 @@
|
||||
Copyright (c) 2020 Evgeniy Reizner
|
||||
Copyright (c) 2020 Yevhenii Reizner
|
||||
Copyright (c) 2015 Dan Burkert
|
||||
|
||||
Permission is hereby granted, free of charge, to any
|
||||
|
2
third_party/rust/memmap2/README.md
vendored
2
third_party/rust/memmap2/README.md
vendored
@ -28,6 +28,6 @@ Apache License (Version 2.0).
|
||||
|
||||
See [LICENSE-APACHE](LICENSE-APACHE), [LICENSE-MIT](LICENSE-MIT) for details.
|
||||
|
||||
Copyright (c) 2020 Evgeniy Reizner
|
||||
Copyright (c) 2020 Yevhenii Reizner
|
||||
|
||||
Copyright (c) 2015 Dan Burkert
|
||||
|
56
third_party/rust/memmap2/src/lib.rs
vendored
56
third_party/rust/memmap2/src/lib.rs
vendored
@ -1,6 +1,6 @@
|
||||
//! A cross-platform Rust API for memory mapped buffers.
|
||||
|
||||
#![doc(html_root_url = "https://docs.rs/memmap2/0.3.0")]
|
||||
#![doc(html_root_url = "https://docs.rs/memmap2/0.3.1")]
|
||||
|
||||
#[cfg(windows)]
|
||||
mod windows;
|
||||
@ -19,6 +19,8 @@ use crate::unix::MmapInner;
|
||||
#[cfg(not(any(unix, windows)))]
|
||||
mod stub;
|
||||
#[cfg(not(any(unix, windows)))]
|
||||
use crate::stub::file_len;
|
||||
#[cfg(not(any(unix, windows)))]
|
||||
use crate::stub::MmapInner;
|
||||
|
||||
use std::fmt;
|
||||
@ -36,6 +38,9 @@ pub struct MmapRawDescriptor<'a>(&'a File);
|
||||
#[cfg(unix)]
|
||||
pub struct MmapRawDescriptor(std::os::unix::io::RawFd);
|
||||
|
||||
#[cfg(not(any(unix, windows)))]
|
||||
pub struct MmapRawDescriptor<'a>(&'a File);
|
||||
|
||||
pub trait MmapAsRawDesc {
|
||||
fn as_raw_desc(&self) -> MmapRawDescriptor;
|
||||
}
|
||||
@ -61,6 +66,13 @@ impl MmapAsRawDesc for std::os::unix::io::RawFd {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(any(unix, windows)))]
|
||||
impl MmapAsRawDesc for &File {
|
||||
fn as_raw_desc(&self) -> MmapRawDescriptor {
|
||||
MmapRawDescriptor(self)
|
||||
}
|
||||
}
|
||||
|
||||
/// A memory map builder, providing advanced options and flags for specifying memory map behavior.
|
||||
///
|
||||
/// `MmapOptions` can be used to create an anonymous memory map using [`map_anon()`], or a
|
||||
@ -176,13 +188,26 @@ impl MmapOptions {
|
||||
self.len.map(Ok).unwrap_or_else(|| {
|
||||
let desc = file.as_raw_desc();
|
||||
let file_len = file_len(desc.0)?;
|
||||
let len = file_len as u64 - self.offset;
|
||||
if len > (usize::MAX as u64) {
|
||||
|
||||
if file_len < self.offset {
|
||||
return Err(Error::new(
|
||||
ErrorKind::InvalidData,
|
||||
"memory map length overflows usize",
|
||||
"memory map offset is larger than length",
|
||||
));
|
||||
}
|
||||
let len = file_len - self.offset;
|
||||
|
||||
// This check it not relevant on 64bit targets, because usize == u64
|
||||
#[cfg(not(target_pointer_width = "64"))]
|
||||
{
|
||||
if len > (usize::MAX as u64) {
|
||||
return Err(Error::new(
|
||||
ErrorKind::InvalidData,
|
||||
"memory map length overflows usize",
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
Ok(len as usize)
|
||||
})
|
||||
}
|
||||
@ -1102,6 +1127,29 @@ mod test {
|
||||
assert_eq!(nulls, &read);
|
||||
}
|
||||
|
||||
// 32bit Linux cannot map a file larger than i32, but Windows can.
|
||||
#[cfg(all(target_os = "linux", target_pointer_width = "32"))]
|
||||
#[test]
|
||||
fn map_offset() {
|
||||
let tempdir = tempdir::TempDir::new("mmap").unwrap();
|
||||
let path = tempdir.path().join("mmap");
|
||||
|
||||
let file = OpenOptions::new()
|
||||
.read(true)
|
||||
.write(true)
|
||||
.create(true)
|
||||
.open(&path)
|
||||
.unwrap();
|
||||
|
||||
let offset = u32::max_value() as u64 + 2;
|
||||
let len = 5432;
|
||||
file.set_len(offset + len as u64).unwrap();
|
||||
|
||||
let mmap = unsafe { MmapOptions::new().offset(offset).map_mut(&file) };
|
||||
assert!(mmap.is_err());
|
||||
}
|
||||
|
||||
#[cfg(not(all(target_os = "linux", target_pointer_width = "32")))]
|
||||
#[test]
|
||||
fn map_offset() {
|
||||
let tempdir = tempdir::TempDir::new("mmap").unwrap();
|
||||
|
14
third_party/rust/memmap2/src/stub.rs
vendored
14
third_party/rust/memmap2/src/stub.rs
vendored
@ -15,23 +15,23 @@ impl MmapInner {
|
||||
))
|
||||
}
|
||||
|
||||
pub fn map(_: usize, _: &File, _: u64) -> io::Result<MmapInner> {
|
||||
pub fn map(_: usize, _: &File, _: u64, _: bool) -> io::Result<MmapInner> {
|
||||
MmapInner::new()
|
||||
}
|
||||
|
||||
pub fn map_exec(_: usize, _: &File, _: u64) -> io::Result<MmapInner> {
|
||||
pub fn map_exec(_: usize, _: &File, _: u64, _: bool) -> io::Result<MmapInner> {
|
||||
MmapInner::new()
|
||||
}
|
||||
|
||||
pub fn map_mut(_: usize, _: &File, _: u64) -> io::Result<MmapInner> {
|
||||
pub fn map_mut(_: usize, _: &File, _: u64, _: bool) -> io::Result<MmapInner> {
|
||||
MmapInner::new()
|
||||
}
|
||||
|
||||
pub fn map_copy(_: usize, _: &File, _: u64) -> io::Result<MmapInner> {
|
||||
pub fn map_copy(_: usize, _: &File, _: u64, _: bool) -> io::Result<MmapInner> {
|
||||
MmapInner::new()
|
||||
}
|
||||
|
||||
pub fn map_copy_read_only(_: usize, _: &File, _: u64) -> io::Result<MmapInner> {
|
||||
pub fn map_copy_read_only(_: usize, _: &File, _: u64, _: bool) -> io::Result<MmapInner> {
|
||||
MmapInner::new()
|
||||
}
|
||||
|
||||
@ -74,3 +74,7 @@ impl MmapInner {
|
||||
unreachable!("self unconstructable");
|
||||
}
|
||||
}
|
||||
|
||||
pub fn file_len(file: &File) -> io::Result<u64> {
|
||||
Ok(file.metadata()?.len())
|
||||
}
|
||||
|
4
third_party/rust/memmap2/src/unix.rs
vendored
4
third_party/rust/memmap2/src/unix.rs
vendored
@ -233,13 +233,13 @@ fn page_size() -> usize {
|
||||
unsafe { libc::sysconf(libc::_SC_PAGESIZE) as usize }
|
||||
}
|
||||
|
||||
pub fn file_len(file: RawFd) -> io::Result<usize> {
|
||||
pub fn file_len(file: RawFd) -> io::Result<u64> {
|
||||
unsafe {
|
||||
let mut stat: libc::stat = std::mem::zeroed();
|
||||
|
||||
let result = libc::fstat(file, &mut stat);
|
||||
if result == 0 {
|
||||
Ok(stat.st_size as usize)
|
||||
Ok(stat.st_size as u64)
|
||||
} else {
|
||||
Err(io::Error::last_os_error())
|
||||
}
|
||||
|
4
third_party/rust/memmap2/src/windows.rs
vendored
4
third_party/rust/memmap2/src/windows.rs
vendored
@ -435,6 +435,6 @@ fn allocation_granularity() -> usize {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn file_len(file: &File) -> io::Result<usize> {
|
||||
Ok(file.metadata()?.len() as usize)
|
||||
pub fn file_len(file: &File) -> io::Result<u64> {
|
||||
Ok(file.metadata()?.len())
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
{"files":{"Cargo.toml":"3fd9136d039b26466b945ea2df9d1bbbff4070224c6c23985ba3e820a0a0de81","LICENSE":"3234ac55816264ee7b6c7ee27efd61cf0a1fe775806870e3d9b4c41ea73c5cb1","README.md":"4b12b99b8512f7da8178a33fdafe101e3342b82e035f41d1f354ee4926c3b4f5","build.rs":"6d677e33a1c98d588c97ec7985d4d5c3b954683e0a73c3dc53d79db4fbb5e638","ci/miri.sh":"ad7410b0a5bd6e346f55e9d96ec0719a085a2d1ce266bddfe6fe73333a1eb8ec","src/lib.rs":"abd194ab03259289876277152f7e26a6aadf12c877db8018743f976eae13d389","src/offset_of.rs":"fd69824267580c3a6981660fb533704e46850df64d756a4677239b6845e99ca6","src/raw_field.rs":"295cc971d64e51f3d053e56c692ae6ef3bb58915298f1ec49bb695b767daff46","src/span_of.rs":"e9e8eb985f51de0915351365f451d9b9e45385dc1d374f3d59373fa774939fe5"},"package":"59accc507f1338036a0477ef61afdae33cde60840f4dfe481319ce3ad116ddf9"}
|
||||
{"files":{"Cargo.toml":"2556143c764ef2315fe44ff0ec43af47ca70b260fd64aa53f57dc42760d7132d","LICENSE":"3234ac55816264ee7b6c7ee27efd61cf0a1fe775806870e3d9b4c41ea73c5cb1","README.md":"299c8957a769bac2a71f9c63064c58a8b54e613e3bf03d41a889f0b428eb4a9c","build.rs":"6d677e33a1c98d588c97ec7985d4d5c3b954683e0a73c3dc53d79db4fbb5e638","ci/miri.sh":"ad7410b0a5bd6e346f55e9d96ec0719a085a2d1ce266bddfe6fe73333a1eb8ec","src/lib.rs":"e7976d295371a3c1e0cf31b0d50210cd6b1135caba3a5111403a97ec6175c0a2","src/offset_of.rs":"e5e3062947f61418cb48220a0d17604411b5ce651b5945c06b876f26c50220b2","src/raw_field.rs":"295cc971d64e51f3d053e56c692ae6ef3bb58915298f1ec49bb695b767daff46","src/span_of.rs":"03bfb743c2dee2e5fbb9568bcbbe9f24ace3e18488a6924d26812fcb9e3c425a"},"package":"5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce"}
|
11
third_party/rust/memoffset/Cargo.toml
vendored
11
third_party/rust/memoffset/Cargo.toml
vendored
@ -3,16 +3,15 @@
|
||||
# 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
|
||||
# to registry (e.g., crates.io) dependencies.
|
||||
#
|
||||
# If you believe there's an error in this file please file an
|
||||
# issue against the rust-lang/cargo repository. If you're
|
||||
# editing this file be aware that the upstream Cargo.toml
|
||||
# will likely look very different (and much more reasonable)
|
||||
# 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]
|
||||
name = "memoffset"
|
||||
version = "0.6.4"
|
||||
version = "0.6.5"
|
||||
authors = ["Gilad Naaman <gilad.naaman@gmail.com>"]
|
||||
description = "offset_of functionality for Rust structs."
|
||||
readme = "README.md"
|
||||
|
14
third_party/rust/memoffset/README.md
vendored
14
third_party/rust/memoffset/README.md
vendored
@ -1,6 +1,6 @@
|
||||
# memoffset #
|
||||
|
||||
[![](http://meritbadge.herokuapp.com/memoffset)](https://crates.io/crates/memoffset)
|
||||
[![](https://img.shields.io/crates/v/memoffset.svg)](https://crates.io/crates/memoffset)
|
||||
|
||||
C-Like `offset_of` functionality for Rust structs.
|
||||
|
||||
@ -21,17 +21,9 @@ memoffset = "0.6"
|
||||
|
||||
These versions will compile fine with rustc versions greater or equal to 1.19.
|
||||
|
||||
Add the following lines at the top of your `main.rs` or `lib.rs` files.
|
||||
|
||||
```rust,ignore
|
||||
#[macro_use]
|
||||
extern crate memoffset;
|
||||
```
|
||||
|
||||
## Examples ##
|
||||
```rust
|
||||
#[macro_use]
|
||||
extern crate memoffset;
|
||||
use memoffset::{offset_of, span_of};
|
||||
|
||||
#[repr(C, packed)]
|
||||
struct Foo {
|
||||
@ -69,5 +61,5 @@ features = ["unstable_const"]
|
||||
|
||||
Your crate root: (`lib.rs`/`main.rs`)
|
||||
```rust,ignore
|
||||
#![feature(const_ptr_offset_from, const_maybe_uninit_as_ptr, const_raw_ptr_deref, const_refs_to_cell)]
|
||||
#![feature(const_ptr_offset_from, const_refs_to_cell)]
|
||||
```
|
||||
|
0
third_party/rust/memoffset/ci/miri.sh
vendored
Normal file → Executable file
0
third_party/rust/memoffset/ci/miri.sh
vendored
Normal file → Executable file
12
third_party/rust/memoffset/src/lib.rs
vendored
12
third_party/rust/memoffset/src/lib.rs
vendored
@ -24,8 +24,7 @@
|
||||
//!
|
||||
//! ## Examples
|
||||
//! ```
|
||||
//! #[macro_use]
|
||||
//! extern crate memoffset;
|
||||
//! use memoffset::{offset_of, span_of};
|
||||
//!
|
||||
//! #[repr(C, packed)]
|
||||
//! struct HelpMeIAmTrappedInAStructFactory {
|
||||
@ -59,12 +58,7 @@
|
||||
#![no_std]
|
||||
#![cfg_attr(
|
||||
feature = "unstable_const",
|
||||
feature(
|
||||
const_ptr_offset_from,
|
||||
const_maybe_uninit_as_ptr,
|
||||
const_raw_ptr_deref,
|
||||
const_refs_to_cell,
|
||||
)
|
||||
feature(const_ptr_offset_from, const_refs_to_cell)
|
||||
)]
|
||||
|
||||
#[macro_use]
|
||||
@ -75,7 +69,7 @@ extern crate doc_comment;
|
||||
#[cfg(doctest)]
|
||||
doctest!("../README.md");
|
||||
|
||||
/// Hiden module for things the macros need to access.
|
||||
/// Hidden module for things the macros need to access.
|
||||
#[doc(hidden)]
|
||||
pub mod __priv {
|
||||
#[doc(hidden)]
|
||||
|
6
third_party/rust/memoffset/src/offset_of.rs
vendored
6
third_party/rust/memoffset/src/offset_of.rs
vendored
@ -72,8 +72,7 @@ macro_rules! _memoffset_offset_from_unsafe {
|
||||
///
|
||||
/// ## Examples
|
||||
/// ```
|
||||
/// #[macro_use]
|
||||
/// extern crate memoffset;
|
||||
/// use memoffset::offset_of;
|
||||
///
|
||||
/// #[repr(C, packed)]
|
||||
/// struct Foo {
|
||||
@ -103,8 +102,7 @@ macro_rules! offset_of {
|
||||
///
|
||||
/// ## Examples
|
||||
/// ```
|
||||
/// #[macro_use]
|
||||
/// extern crate memoffset;
|
||||
/// use memoffset::offset_of_tuple;
|
||||
///
|
||||
/// fn main() {
|
||||
/// assert!(offset_of_tuple!((u8, u32), 1) >= 0, "Tuples do not have a defined layout");
|
||||
|
3
third_party/rust/memoffset/src/span_of.rs
vendored
3
third_party/rust/memoffset/src/span_of.rs
vendored
@ -59,8 +59,7 @@ macro_rules! _memoffset__compile_error {
|
||||
///
|
||||
/// ## Examples
|
||||
/// ```
|
||||
/// #[macro_use]
|
||||
/// extern crate memoffset;
|
||||
/// use memoffset::span_of;
|
||||
///
|
||||
/// #[repr(C)]
|
||||
/// struct Florp {
|
||||
|
@ -1 +1 @@
|
||||
{"files":{"Cargo.toml":"14c835bd1efdb7293220cb4d4ed2d332f2e7512a46e9a185bdb68d66f390fbc2","LICENSE-APACHE":"a9040321c3712d8fd0b09cf52b17445de04a23a10165049ae187cd39e5c86be5","LICENSE-MIT":"9e0dfd2dd4173a530e238cb6adb37aa78c34c6bc7444e0e10c1ab5d8881f63ba","src/lib.rs":"e4730f0693ba6e8a4e481bea655ede96775f8eb4c0f94f1af740acb2a11240be"},"package":"51ecbcb821e1bd256d456fe858aaa7f380b63863eab2eb86eee1bd9f33dd6682"}
|
||||
{"files":{"Cargo.toml":"316df812f280ae0c584b6132630119bea8de32864c29772100f9bb8352196381","LICENSE-APACHE":"a9040321c3712d8fd0b09cf52b17445de04a23a10165049ae187cd39e5c86be5","LICENSE-MIT":"d5c22aa3118d240e877ad41c5d9fa232f9c77d757d4aac0c2f943afc0a95e0ef","src/lib.rs":"2d7d563f4a4df4b0583d6370046642103e4909f0ec2002768308f951f2d7e05c"},"package":"2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c"}
|
6
third_party/rust/opaque-debug/Cargo.toml
vendored
6
third_party/rust/opaque-debug/Cargo.toml
vendored
@ -3,7 +3,7 @@
|
||||
# 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
|
||||
# to registry (e.g., crates.io) dependencies
|
||||
#
|
||||
# If you believe there's an error in this file please file an
|
||||
# issue against the rust-lang/cargo repository. If you're
|
||||
@ -12,11 +12,11 @@
|
||||
|
||||
[package]
|
||||
name = "opaque-debug"
|
||||
version = "0.2.1"
|
||||
version = "0.2.3"
|
||||
authors = ["RustCrypto Developers"]
|
||||
description = "Macro for opaque Debug trait implementation"
|
||||
documentation = "https://docs.rs/opaque-debug"
|
||||
license = "MIT/Apache-2.0"
|
||||
license = "MIT OR Apache-2.0"
|
||||
repository = "https://github.com/RustCrypto/utils"
|
||||
|
||||
[dependencies]
|
||||
|
2
third_party/rust/opaque-debug/LICENSE-MIT
vendored
2
third_party/rust/opaque-debug/LICENSE-MIT
vendored
@ -1,4 +1,4 @@
|
||||
Copyright (c) 2017 Artyom Pavlov
|
||||
Copyright (c) 2018-2019 The RustCrypto Project Developers
|
||||
|
||||
Permission is hereby granted, free of charge, to any
|
||||
person obtaining a copy of this software and associated
|
||||
|
19
third_party/rust/opaque-debug/src/lib.rs
vendored
19
third_party/rust/opaque-debug/src/lib.rs
vendored
@ -1,6 +1,9 @@
|
||||
//! Macro for opaque `Debug` trait implementation.
|
||||
#![no_std]
|
||||
|
||||
#[doc(hidden)]
|
||||
pub extern crate core as __core;
|
||||
|
||||
/// Macro for defining opaque `Debug` implementation.
|
||||
///
|
||||
/// It will use the following format: "StructName { ... }". While it's
|
||||
@ -10,19 +13,9 @@
|
||||
#[macro_export]
|
||||
macro_rules! impl_opaque_debug {
|
||||
($struct:ty) => {
|
||||
#[cfg(feature = "std")]
|
||||
impl ::std::fmt::Debug for $struct {
|
||||
fn fmt(&self, f: &mut ::std::fmt::Formatter)
|
||||
-> Result<(), ::std::fmt::Error>
|
||||
{
|
||||
write!(f, concat!(stringify!($struct), " {{ ... }}"))
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "std"))]
|
||||
impl ::core::fmt::Debug for $struct {
|
||||
fn fmt(&self, f: &mut ::core::fmt::Formatter)
|
||||
-> Result<(), ::core::fmt::Error>
|
||||
impl $crate::__core::fmt::Debug for $struct {
|
||||
fn fmt(&self, f: &mut $crate::__core::fmt::Formatter)
|
||||
-> Result<(), $crate::__core::fmt::Error>
|
||||
{
|
||||
write!(f, concat!(stringify!($struct), " {{ ... }}"))
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
@ -10,6 +10,10 @@ Note: In this file, do not use the hard wrap in the middle of a sentence for com
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [0.2.7] - 2021-06-26
|
||||
|
||||
- [Support custom Drop implementation.](https://github.com/taiki-e/pin-project-lite/pull/25) See [#25](https://github.com/taiki-e/pin-project-lite/pull/25) for details.
|
||||
|
||||
## [0.2.6] - 2021-03-04
|
||||
|
||||
- [Support item attributes in any order.](https://github.com/taiki-e/pin-project-lite/pull/57)
|
||||
@ -184,7 +188,8 @@ Note: In this file, do not use the hard wrap in the middle of a sentence for com
|
||||
|
||||
Initial release
|
||||
|
||||
[Unreleased]: https://github.com/taiki-e/pin-project-lite/compare/v0.2.6...HEAD
|
||||
[Unreleased]: https://github.com/taiki-e/pin-project-lite/compare/v0.2.7...HEAD
|
||||
[0.2.7]: https://github.com/taiki-e/pin-project-lite/compare/v0.2.6...v0.2.7
|
||||
[0.2.6]: https://github.com/taiki-e/pin-project-lite/compare/v0.2.5...v0.2.6
|
||||
[0.2.5]: https://github.com/taiki-e/pin-project-lite/compare/v0.2.4...v0.2.5
|
||||
[0.2.4]: https://github.com/taiki-e/pin-project-lite/compare/v0.2.3...v0.2.4
|
||||
|
4
third_party/rust/pin-project-lite/Cargo.toml
vendored
4
third_party/rust/pin-project-lite/Cargo.toml
vendored
@ -13,9 +13,9 @@
|
||||
[package]
|
||||
edition = "2018"
|
||||
name = "pin-project-lite"
|
||||
version = "0.2.6"
|
||||
version = "0.2.7"
|
||||
authors = ["Taiki Endo <te316e89@gmail.com>"]
|
||||
exclude = ["/.*", "/scripts"]
|
||||
exclude = ["/.*", "/tools"]
|
||||
description = "A lightweight version of pin-project written with declarative macros.\n"
|
||||
documentation = "https://docs.rs/pin-project-lite"
|
||||
keywords = ["pin", "macros"]
|
||||
|
5
third_party/rust/pin-project-lite/README.md
vendored
5
third_party/rust/pin-project-lite/README.md
vendored
@ -100,10 +100,6 @@ be useful in most cases. If you do need useful error messages, then upon
|
||||
error you can pass the same input to [pin-project] to receive a helpful
|
||||
description of the compile error.
|
||||
|
||||
### Different: No support for custom Drop implementation
|
||||
|
||||
pin-project supports this by [`#[pinned_drop]`][pinned-drop].
|
||||
|
||||
### Different: No support for custom Unpin implementation
|
||||
|
||||
pin-project supports this by [`UnsafeUnpin`][unsafe-unpin] and [`!Unpin`][not-unpin].
|
||||
@ -115,7 +111,6 @@ pin-project supports this.
|
||||
[`pin_project!`]: https://docs.rs/pin-project-lite/0.2/pin_project_lite/macro.pin_project.html
|
||||
[not-unpin]: https://docs.rs/pin-project/1/pin_project/attr.pin_project.html#unpin
|
||||
[pin-project]: https://github.com/taiki-e/pin-project
|
||||
[pinned-drop]: https://docs.rs/pin-project/1/pin_project/attr.pin_project.html#pinned_drop
|
||||
[unsafe-unpin]: https://docs.rs/pin-project/1/pin_project/attr.pin_project.html#unsafeunpin
|
||||
|
||||
## License
|
||||
|
123
third_party/rust/pin-project-lite/src/lib.rs
vendored
123
third_party/rust/pin-project-lite/src/lib.rs
vendored
@ -82,10 +82,6 @@
|
||||
//! error you can pass the same input to [pin-project] to receive a helpful
|
||||
//! description of the compile error.
|
||||
//!
|
||||
//! ## Different: No support for custom Drop implementation
|
||||
//!
|
||||
//! pin-project supports this by [`#[pinned_drop]`][pinned-drop].
|
||||
//!
|
||||
//! ## Different: No support for custom Unpin implementation
|
||||
//!
|
||||
//! pin-project supports this by [`UnsafeUnpin`][unsafe-unpin] and [`!Unpin`][not-unpin].
|
||||
@ -96,7 +92,6 @@
|
||||
//!
|
||||
//! [not-unpin]: https://docs.rs/pin-project/1/pin_project/attr.pin_project.html#unpin
|
||||
//! [pin-project]: https://github.com/taiki-e/pin-project
|
||||
//! [pinned-drop]: https://docs.rs/pin-project/1/pin_project/attr.pin_project.html#pinned_drop
|
||||
//! [unsafe-unpin]: https://docs.rs/pin-project/1/pin_project/attr.pin_project.html#unsafeunpin
|
||||
|
||||
#![no_std]
|
||||
@ -108,7 +103,7 @@
|
||||
)
|
||||
))]
|
||||
#![warn(future_incompatible, rust_2018_idioms, single_use_lifetimes, unreachable_pub)]
|
||||
#![warn(clippy::all, clippy::default_trait_access)]
|
||||
#![warn(clippy::default_trait_access, clippy::wildcard_imports)]
|
||||
|
||||
/// A macro that creates a projection type covering all the fields of struct.
|
||||
///
|
||||
@ -331,6 +326,7 @@ macro_rules! __pin_project_internal {
|
||||
$field_vis:vis $field:ident: $field_ty:ty
|
||||
),+
|
||||
}
|
||||
$(impl $($pinned_drop:tt)*)?
|
||||
) => {
|
||||
$(#[$attrs])*
|
||||
$vis struct $ident $($def_generics)*
|
||||
@ -374,6 +370,7 @@ macro_rules! __pin_project_internal {
|
||||
[make_proj_field_replace]
|
||||
[$ident]
|
||||
[$($impl_generics)*] [$($ty_generics)*] [$(where $($where_clause)*)?]
|
||||
[$(impl $($pinned_drop)*)?]
|
||||
{
|
||||
$(
|
||||
$(#[$pin])?
|
||||
@ -422,6 +419,7 @@ macro_rules! __pin_project_internal {
|
||||
[make_proj_field_replace]
|
||||
[$ident]
|
||||
[$($impl_generics)*] [$($ty_generics)*] [$(where $($where_clause)*)?]
|
||||
[$(impl $($pinned_drop)*)?]
|
||||
{
|
||||
$(
|
||||
$(#[$pin])?
|
||||
@ -484,6 +482,7 @@ macro_rules! __pin_project_internal {
|
||||
$crate::__pin_project_internal! { @make_drop_impl;
|
||||
[$ident]
|
||||
[$($impl_generics)*] [$($ty_generics)*] [$(where $($where_clause)*)?]
|
||||
$(impl $($pinned_drop)*)?
|
||||
}
|
||||
|
||||
// Ensure that it's impossible to use pin projections on a #[repr(packed)] struct.
|
||||
@ -538,6 +537,7 @@ macro_rules! __pin_project_internal {
|
||||
})?
|
||||
),+
|
||||
}
|
||||
$(impl $($pinned_drop:tt)*)?
|
||||
) => {
|
||||
$(#[$attrs])*
|
||||
$vis enum $ident $($def_generics)*
|
||||
@ -594,6 +594,7 @@ macro_rules! __pin_project_internal {
|
||||
[make_proj_field_replace]
|
||||
[$ident]
|
||||
[$($impl_generics)*] [$($ty_generics)*] [$(where $($where_clause)*)?]
|
||||
[$(impl $($pinned_drop)*)?]
|
||||
{
|
||||
$(
|
||||
$variant $({
|
||||
@ -682,6 +683,7 @@ macro_rules! __pin_project_internal {
|
||||
$crate::__pin_project_internal! { @make_drop_impl;
|
||||
[$ident]
|
||||
[$($impl_generics)*] [$($ty_generics)*] [$(where $($where_clause)*)?]
|
||||
$(impl $($pinned_drop)*)?
|
||||
}
|
||||
|
||||
// We don't need to check for '#[repr(packed)]',
|
||||
@ -765,6 +767,7 @@ macro_rules! __pin_project_internal {
|
||||
[$make_proj_field:ident]
|
||||
[$ident:ident]
|
||||
[$($impl_generics:tt)*] [$($ty_generics:tt)*] [$(where $($where_clause:tt)* )?]
|
||||
[$(impl $($pinned_drop:tt)*)?]
|
||||
$($field:tt)*
|
||||
) => {};
|
||||
(@struct=>make_proj_replace_ty=>unnamed;
|
||||
@ -773,15 +776,16 @@ macro_rules! __pin_project_internal {
|
||||
[$make_proj_field:ident]
|
||||
[$ident:ident]
|
||||
[$($impl_generics:tt)*] [$($ty_generics:tt)*] [$(where $($where_clause:tt)* )?]
|
||||
[$(impl $($pinned_drop:tt)*)?]
|
||||
$($field:tt)*
|
||||
) => {
|
||||
};
|
||||
) => {};
|
||||
(@struct=>make_proj_replace_ty=>named;
|
||||
[$proj_vis:vis]
|
||||
[$proj_ty_ident:ident]
|
||||
[$make_proj_field:ident]
|
||||
[$ident:ident]
|
||||
[$($impl_generics:tt)*] [$($ty_generics:tt)*] [$(where $($where_clause:tt)* )?]
|
||||
[]
|
||||
{
|
||||
$(
|
||||
$(#[$pin:ident])?
|
||||
@ -811,6 +815,7 @@ macro_rules! __pin_project_internal {
|
||||
[$make_proj_field:ident]
|
||||
[$ident:ident]
|
||||
[$($impl_generics:tt)*] [$($ty_generics:tt)*] [$(where $($where_clause:tt)* )?]
|
||||
[$(impl $($pinned_drop:tt)*)?]
|
||||
$($field:tt)*
|
||||
) => {};
|
||||
// =============================================================================================
|
||||
@ -872,6 +877,7 @@ macro_rules! __pin_project_internal {
|
||||
[$make_proj_field:ident]
|
||||
[$ident:ident]
|
||||
[$($impl_generics:tt)*] [$($ty_generics:tt)*] [$(where $($where_clause:tt)* )?]
|
||||
[]
|
||||
{
|
||||
$(
|
||||
$variant:ident $({
|
||||
@ -909,6 +915,7 @@ macro_rules! __pin_project_internal {
|
||||
[$make_proj_field:ident]
|
||||
[$ident:ident]
|
||||
[$($impl_generics:tt)*] [$($ty_generics:tt)*] [$(where $($where_clause:tt)* )?]
|
||||
[$(impl $($pinned_drop:tt)*)?]
|
||||
$($variant:tt)*
|
||||
) => {};
|
||||
|
||||
@ -1164,11 +1171,11 @@ macro_rules! __pin_project_internal {
|
||||
// this will become a lint, rather then a hard error.
|
||||
//
|
||||
// As a workaround for this, we generate a new struct, containing all of the pinned
|
||||
// fields from our #[pin_project] type. This struct is delcared within
|
||||
// fields from our #[pin_project] type. This struct is declared within
|
||||
// a function, which makes it impossible to be named by user code.
|
||||
// This guarnatees that it will use the default auto-trait impl for Unpin -
|
||||
// This guarantees that it will use the default auto-trait impl for Unpin -
|
||||
// that is, it will implement Unpin iff all of its fields implement Unpin.
|
||||
// This type can be safely declared as 'public', satisfiying the privacy
|
||||
// This type can be safely declared as 'public', satisfying the privacy
|
||||
// checker without actually allowing user code to access it.
|
||||
//
|
||||
// This allows users to apply the #[pin_project] attribute to types
|
||||
@ -1193,6 +1200,90 @@ macro_rules! __pin_project_internal {
|
||||
|
||||
// =============================================================================================
|
||||
// make_drop_impl
|
||||
(@make_drop_impl;
|
||||
[$_ident:ident]
|
||||
[$($_impl_generics:tt)*] [$($_ty_generics:tt)*] [$(where $($_where_clause:tt)* )?]
|
||||
impl $(<
|
||||
$( $lifetime:lifetime $(: $lifetime_bound:lifetime)? ),* $(,)?
|
||||
$( $generics:ident
|
||||
$(: $generics_bound:path)?
|
||||
$(: ?$generics_unsized_bound:path)?
|
||||
$(: $generics_lifetime_bound:lifetime)?
|
||||
),*
|
||||
>)? PinnedDrop for $self_ty:ty
|
||||
$(where
|
||||
$( $where_clause_ty:ty
|
||||
$(: $where_clause_bound:path)?
|
||||
$(: ?$where_clause_unsized_bound:path)?
|
||||
$(: $where_clause_lifetime_bound:lifetime)?
|
||||
),*
|
||||
)?
|
||||
{
|
||||
fn drop($($arg:ident)+: Pin<&mut Self>) {
|
||||
$($tt:tt)*
|
||||
}
|
||||
}
|
||||
) => {
|
||||
impl $(<
|
||||
$( $lifetime $(: $lifetime_bound)? ,)*
|
||||
$( $generics
|
||||
$(: $generics_bound)?
|
||||
$(: ?$generics_unsized_bound)?
|
||||
$(: $generics_lifetime_bound)?
|
||||
),*
|
||||
>)? $crate::__private::Drop for $self_ty
|
||||
$(where
|
||||
$( $where_clause_ty
|
||||
$(: $where_clause_bound)?
|
||||
$(: ?$where_clause_unsized_bound)?
|
||||
$(: $where_clause_lifetime_bound)?
|
||||
),*
|
||||
)?
|
||||
{
|
||||
fn drop(&mut self) {
|
||||
// Implementing `__DropInner::__drop_inner` is safe, but calling it is not safe.
|
||||
// This is because destructors can be called multiple times in safe code and
|
||||
// [double dropping is unsound](https://github.com/rust-lang/rust/pull/62360).
|
||||
//
|
||||
// `__drop_inner` is defined as a safe method, but this is fine since
|
||||
// `__drop_inner` is not accessible by the users and we call `__drop_inner` only
|
||||
// once.
|
||||
//
|
||||
// Users can implement [`Drop`] safely using `pin_project!` and can drop a
|
||||
// type that implements `PinnedDrop` using the [`drop`] function safely.
|
||||
fn __drop_inner $(<
|
||||
$( $lifetime $(: $lifetime_bound)? ,)*
|
||||
$( $generics
|
||||
$(: $generics_bound)?
|
||||
$(: ?$generics_unsized_bound)?
|
||||
$(: $generics_lifetime_bound)?
|
||||
),*
|
||||
>)? (
|
||||
$($arg)+: $crate::__private::Pin<&mut $self_ty>,
|
||||
)
|
||||
$(where
|
||||
$( $where_clause_ty
|
||||
$(: $where_clause_bound)?
|
||||
$(: ?$where_clause_unsized_bound)?
|
||||
$(: $where_clause_lifetime_bound)?
|
||||
),*
|
||||
)?
|
||||
{
|
||||
// A dummy `__drop_inner` function to prevent users call outer `__drop_inner`.
|
||||
fn __drop_inner() {}
|
||||
$($tt)*
|
||||
}
|
||||
|
||||
// Safety - we're in 'drop', so we know that 'self' will
|
||||
// never move again.
|
||||
let pinned_self: $crate::__private::Pin<&mut Self>
|
||||
= unsafe { $crate::__private::Pin::new_unchecked(self) };
|
||||
// We call `__drop_inner` only once. Since `__DropInner::__drop_inner`
|
||||
// is not accessible by the users, it is never called again.
|
||||
__drop_inner(pinned_self);
|
||||
}
|
||||
}
|
||||
};
|
||||
(@make_drop_impl;
|
||||
[$ident:ident]
|
||||
[$($impl_generics:tt)*] [$($ty_generics:tt)*] [$(where $($where_clause:tt)* )?]
|
||||
@ -1204,7 +1295,7 @@ macro_rules! __pin_project_internal {
|
||||
// the first blanked impl will not apply to it. This code
|
||||
// will compile, as there is only one impl of MustNotImplDrop for the user type
|
||||
// 2. The user type does impl Drop. This will make the blanket impl applicable,
|
||||
// which will then comflict with the explicit MustNotImplDrop impl below.
|
||||
// which will then conflict with the explicit MustNotImplDrop impl below.
|
||||
// This will result in a compilation error, which is exactly what we want.
|
||||
trait MustNotImplDrop {}
|
||||
#[allow(clippy::drop_bounds, drop_bounds)]
|
||||
@ -1414,6 +1505,7 @@ macro_rules! __pin_project_internal {
|
||||
$field_vis:vis $field:ident: $field_ty:ty
|
||||
),+ $(,)?
|
||||
}
|
||||
$(impl $($pinned_drop:tt)*)?
|
||||
) => {
|
||||
$crate::__pin_project_internal! { @struct=>internal;
|
||||
[$($proj_mut_ident)?]
|
||||
@ -1450,6 +1542,7 @@ macro_rules! __pin_project_internal {
|
||||
$field_vis $field: $field_ty
|
||||
),+
|
||||
}
|
||||
$(impl $($pinned_drop)*)?
|
||||
}
|
||||
};
|
||||
(
|
||||
@ -1480,6 +1573,7 @@ macro_rules! __pin_project_internal {
|
||||
$field_vis:vis $field:ident: $field_ty:ty
|
||||
),+ $(,)?
|
||||
}
|
||||
$(impl $($pinned_drop:tt)*)?
|
||||
) => {
|
||||
$crate::__pin_project_internal! { @struct=>internal;
|
||||
[$($proj_mut_ident)?]
|
||||
@ -1516,6 +1610,7 @@ macro_rules! __pin_project_internal {
|
||||
$field_vis $field: $field_ty
|
||||
),+
|
||||
}
|
||||
$(impl $($pinned_drop)*)?
|
||||
}
|
||||
};
|
||||
// enum
|
||||
@ -1552,6 +1647,7 @@ macro_rules! __pin_project_internal {
|
||||
})?
|
||||
),+ $(,)?
|
||||
}
|
||||
$(impl $($pinned_drop:tt)*)?
|
||||
) => {
|
||||
$crate::__pin_project_internal! { @enum=>internal;
|
||||
[$($proj_mut_ident)?]
|
||||
@ -1593,6 +1689,7 @@ macro_rules! __pin_project_internal {
|
||||
})?
|
||||
),+
|
||||
}
|
||||
$(impl $($pinned_drop)*)?
|
||||
}
|
||||
};
|
||||
(
|
||||
@ -1628,6 +1725,7 @@ macro_rules! __pin_project_internal {
|
||||
})?
|
||||
),+ $(,)?
|
||||
}
|
||||
$(impl $($pinned_drop:tt)*)?
|
||||
) => {
|
||||
$crate::__pin_project_internal! { @enum=>internal;
|
||||
[$($proj_mut_ident)?]
|
||||
@ -1669,6 +1767,7 @@ macro_rules! __pin_project_internal {
|
||||
})?
|
||||
),+
|
||||
}
|
||||
$(impl $($pinned_drop)*)?
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
use std::env;
|
||||
|
||||
#[rustversion::attr(before(2020-12-03), ignore)] // Note: This date is commit-date and the day before the toolchain date.
|
||||
#[rustversion::attr(before(2021-05-15), ignore)] // Note: This date is commit-date and the day before the toolchain date.
|
||||
#[test]
|
||||
fn ui() {
|
||||
if env::var_os("CI").is_none() {
|
||||
|
@ -129,7 +129,7 @@ fn project_replace_panic() {
|
||||
fn drop(&mut self) {
|
||||
*self.0 = true;
|
||||
if self.1 {
|
||||
panic!()
|
||||
panic!();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
95
third_party/rust/pin-project-lite/tests/expand/pinned_drop/enum.expanded.rs
vendored
Normal file
95
third_party/rust/pin-project-lite/tests/expand/pinned_drop/enum.expanded.rs
vendored
Normal file
@ -0,0 +1,95 @@
|
||||
use pin_project_lite::pin_project;
|
||||
use std::pin::Pin;
|
||||
enum Enum<T, U> {
|
||||
Struct { pinned: T, unpinned: U },
|
||||
Unit,
|
||||
}
|
||||
#[allow(dead_code)]
|
||||
#[allow(single_use_lifetimes)]
|
||||
#[allow(clippy::unknown_clippy_lints)]
|
||||
#[allow(clippy::mut_mut)]
|
||||
#[allow(clippy::redundant_pub_crate)]
|
||||
#[allow(clippy::ref_option_ref)]
|
||||
#[allow(clippy::type_repetition_in_bounds)]
|
||||
enum EnumProj<'__pin, T, U>
|
||||
where
|
||||
Enum<T, U>: '__pin,
|
||||
{
|
||||
Struct {
|
||||
pinned: ::pin_project_lite::__private::Pin<&'__pin mut (T)>,
|
||||
unpinned: &'__pin mut (U),
|
||||
},
|
||||
Unit,
|
||||
}
|
||||
#[allow(dead_code)]
|
||||
#[allow(single_use_lifetimes)]
|
||||
#[allow(clippy::unknown_clippy_lints)]
|
||||
#[allow(clippy::mut_mut)]
|
||||
#[allow(clippy::redundant_pub_crate)]
|
||||
#[allow(clippy::ref_option_ref)]
|
||||
#[allow(clippy::type_repetition_in_bounds)]
|
||||
enum EnumProjRef<'__pin, T, U>
|
||||
where
|
||||
Enum<T, U>: '__pin,
|
||||
{
|
||||
Struct {
|
||||
pinned: ::pin_project_lite::__private::Pin<&'__pin (T)>,
|
||||
unpinned: &'__pin (U),
|
||||
},
|
||||
Unit,
|
||||
}
|
||||
#[allow(single_use_lifetimes)]
|
||||
#[allow(clippy::unknown_clippy_lints)]
|
||||
#[allow(clippy::used_underscore_binding)]
|
||||
const _: () = {
|
||||
impl<T, U> Enum<T, U> {
|
||||
fn project<'__pin>(
|
||||
self: ::pin_project_lite::__private::Pin<&'__pin mut Self>,
|
||||
) -> EnumProj<'__pin, T, U> {
|
||||
unsafe {
|
||||
match self.get_unchecked_mut() {
|
||||
Self::Struct { pinned, unpinned } => EnumProj::Struct {
|
||||
pinned: ::pin_project_lite::__private::Pin::new_unchecked(pinned),
|
||||
unpinned: unpinned,
|
||||
},
|
||||
Self::Unit => EnumProj::Unit,
|
||||
}
|
||||
}
|
||||
}
|
||||
fn project_ref<'__pin>(
|
||||
self: ::pin_project_lite::__private::Pin<&'__pin Self>,
|
||||
) -> EnumProjRef<'__pin, T, U> {
|
||||
unsafe {
|
||||
match self.get_ref() {
|
||||
Self::Struct { pinned, unpinned } => EnumProjRef::Struct {
|
||||
pinned: ::pin_project_lite::__private::Pin::new_unchecked(pinned),
|
||||
unpinned: unpinned,
|
||||
},
|
||||
Self::Unit => EnumProjRef::Unit,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#[allow(non_snake_case)]
|
||||
struct __Origin<'__pin, T, U> {
|
||||
__dummy_lifetime: ::pin_project_lite::__private::PhantomData<&'__pin ()>,
|
||||
Struct: (T, ::pin_project_lite::__private::AlwaysUnpin<U>),
|
||||
Unit: (),
|
||||
}
|
||||
impl<'__pin, T, U> ::pin_project_lite::__private::Unpin for Enum<T, U> where
|
||||
__Origin<'__pin, T, U>: ::pin_project_lite::__private::Unpin
|
||||
{
|
||||
}
|
||||
impl<T, U> ::pin_project_lite::__private::Drop for Enum<T, U> {
|
||||
fn drop(&mut self) {
|
||||
fn __drop_inner<T, U>(this: ::pin_project_lite::__private::Pin<&mut Enum<T, U>>) {
|
||||
fn __drop_inner() {}
|
||||
let _ = this;
|
||||
}
|
||||
let pinned_self: ::pin_project_lite::__private::Pin<&mut Self> =
|
||||
unsafe { ::pin_project_lite::__private::Pin::new_unchecked(self) };
|
||||
__drop_inner(pinned_self);
|
||||
}
|
||||
}
|
||||
};
|
||||
fn main() {}
|
22
third_party/rust/pin-project-lite/tests/expand/pinned_drop/enum.rs
vendored
Normal file
22
third_party/rust/pin-project-lite/tests/expand/pinned_drop/enum.rs
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
use pin_project_lite::pin_project;
|
||||
use std::pin::Pin;
|
||||
|
||||
pin_project! {
|
||||
#[project = EnumProj]
|
||||
#[project_ref = EnumProjRef]
|
||||
enum Enum<T, U> {
|
||||
Struct {
|
||||
#[pin]
|
||||
pinned: T,
|
||||
unpinned: U,
|
||||
},
|
||||
Unit,
|
||||
}
|
||||
impl<T, U> PinnedDrop for Enum<T, U> {
|
||||
fn drop(this: Pin<&mut Self>) {
|
||||
let _ = this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
92
third_party/rust/pin-project-lite/tests/expand/pinned_drop/struct.expanded.rs
vendored
Normal file
92
third_party/rust/pin-project-lite/tests/expand/pinned_drop/struct.expanded.rs
vendored
Normal file
@ -0,0 +1,92 @@
|
||||
use pin_project_lite::pin_project;
|
||||
use std::pin::Pin;
|
||||
struct Struct<T, U> {
|
||||
pinned: T,
|
||||
unpinned: U,
|
||||
}
|
||||
#[allow(explicit_outlives_requirements)]
|
||||
#[allow(single_use_lifetimes)]
|
||||
#[allow(clippy::unknown_clippy_lints)]
|
||||
#[allow(clippy::redundant_pub_crate)]
|
||||
#[allow(clippy::used_underscore_binding)]
|
||||
const _: () = {
|
||||
#[allow(dead_code)]
|
||||
#[allow(single_use_lifetimes)]
|
||||
#[allow(clippy::unknown_clippy_lints)]
|
||||
#[allow(clippy::mut_mut)]
|
||||
#[allow(clippy::redundant_pub_crate)]
|
||||
#[allow(clippy::ref_option_ref)]
|
||||
#[allow(clippy::type_repetition_in_bounds)]
|
||||
struct Projection<'__pin, T, U>
|
||||
where
|
||||
Struct<T, U>: '__pin,
|
||||
{
|
||||
pinned: ::pin_project_lite::__private::Pin<&'__pin mut (T)>,
|
||||
unpinned: &'__pin mut (U),
|
||||
}
|
||||
#[allow(dead_code)]
|
||||
#[allow(single_use_lifetimes)]
|
||||
#[allow(clippy::unknown_clippy_lints)]
|
||||
#[allow(clippy::mut_mut)]
|
||||
#[allow(clippy::redundant_pub_crate)]
|
||||
#[allow(clippy::ref_option_ref)]
|
||||
#[allow(clippy::type_repetition_in_bounds)]
|
||||
struct ProjectionRef<'__pin, T, U>
|
||||
where
|
||||
Struct<T, U>: '__pin,
|
||||
{
|
||||
pinned: ::pin_project_lite::__private::Pin<&'__pin (T)>,
|
||||
unpinned: &'__pin (U),
|
||||
}
|
||||
impl<T, U> Struct<T, U> {
|
||||
fn project<'__pin>(
|
||||
self: ::pin_project_lite::__private::Pin<&'__pin mut Self>,
|
||||
) -> Projection<'__pin, T, U> {
|
||||
unsafe {
|
||||
let Self { pinned, unpinned } = self.get_unchecked_mut();
|
||||
Projection {
|
||||
pinned: ::pin_project_lite::__private::Pin::new_unchecked(pinned),
|
||||
unpinned: unpinned,
|
||||
}
|
||||
}
|
||||
}
|
||||
fn project_ref<'__pin>(
|
||||
self: ::pin_project_lite::__private::Pin<&'__pin Self>,
|
||||
) -> ProjectionRef<'__pin, T, U> {
|
||||
unsafe {
|
||||
let Self { pinned, unpinned } = self.get_ref();
|
||||
ProjectionRef {
|
||||
pinned: ::pin_project_lite::__private::Pin::new_unchecked(pinned),
|
||||
unpinned: unpinned,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#[allow(non_snake_case)]
|
||||
struct __Origin<'__pin, T, U> {
|
||||
__dummy_lifetime: ::pin_project_lite::__private::PhantomData<&'__pin ()>,
|
||||
pinned: T,
|
||||
unpinned: ::pin_project_lite::__private::AlwaysUnpin<U>,
|
||||
}
|
||||
impl<'__pin, T, U> ::pin_project_lite::__private::Unpin for Struct<T, U> where
|
||||
__Origin<'__pin, T, U>: ::pin_project_lite::__private::Unpin
|
||||
{
|
||||
}
|
||||
impl<T, U> ::pin_project_lite::__private::Drop for Struct<T, U> {
|
||||
fn drop(&mut self) {
|
||||
fn __drop_inner<T, U>(this: ::pin_project_lite::__private::Pin<&mut Struct<T, U>>) {
|
||||
fn __drop_inner() {}
|
||||
let _ = this;
|
||||
}
|
||||
let pinned_self: ::pin_project_lite::__private::Pin<&mut Self> =
|
||||
unsafe { ::pin_project_lite::__private::Pin::new_unchecked(self) };
|
||||
__drop_inner(pinned_self);
|
||||
}
|
||||
}
|
||||
#[forbid(unaligned_references, safe_packed_borrows)]
|
||||
fn __assert_not_repr_packed<T, U>(this: &Struct<T, U>) {
|
||||
let _ = &this.pinned;
|
||||
let _ = &this.unpinned;
|
||||
}
|
||||
};
|
||||
fn main() {}
|
17
third_party/rust/pin-project-lite/tests/expand/pinned_drop/struct.rs
vendored
Normal file
17
third_party/rust/pin-project-lite/tests/expand/pinned_drop/struct.rs
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
use pin_project_lite::pin_project;
|
||||
use std::pin::Pin;
|
||||
|
||||
pin_project! {
|
||||
struct Struct<T, U> {
|
||||
#[pin]
|
||||
pinned: T,
|
||||
unpinned: U,
|
||||
}
|
||||
impl<T, U> PinnedDrop for Struct<T, U> {
|
||||
fn drop(this: Pin<&mut Self>) {
|
||||
let _ = this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
@ -6,6 +6,8 @@ use std::{
|
||||
process::{Command, ExitStatus, Stdio},
|
||||
};
|
||||
|
||||
const PATH: &str = "tests/expand/**/*.rs";
|
||||
|
||||
#[rustversion::attr(not(nightly), ignore)]
|
||||
#[test]
|
||||
fn expandtest() {
|
||||
@ -13,17 +15,17 @@ fn expandtest() {
|
||||
let cargo = &*env::var("CARGO").unwrap_or_else(|_| "cargo".into());
|
||||
if !has_command(&[cargo, "expand"]) || !has_command(&[cargo, "fmt"]) {
|
||||
if is_ci {
|
||||
panic!("expandtest requires rustfmt and cargo-expand")
|
||||
panic!("expandtest requires rustfmt and cargo-expand");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
let path = "tests/expand/*/*.rs";
|
||||
let args = &["--all-features"];
|
||||
if is_ci {
|
||||
macrotest::expand_without_refresh(path);
|
||||
macrotest::expand_without_refresh_args(PATH, args);
|
||||
} else {
|
||||
env::set_var("MACROTEST", "overwrite");
|
||||
macrotest::expand(path);
|
||||
macrotest::expand_args(PATH, args);
|
||||
}
|
||||
}
|
||||
|
||||
|
28
third_party/rust/pin-project-lite/tests/lint.rs
vendored
28
third_party/rust/pin-project-lite/tests/lint.rs
vendored
@ -1,48 +1,44 @@
|
||||
#![forbid(unsafe_code)]
|
||||
#![warn(nonstandard_style, rust_2018_idioms, rustdoc, unused)]
|
||||
// Check interoperability with rustc and clippy lints.
|
||||
|
||||
#![warn(nonstandard_style, rust_2018_idioms, unused)]
|
||||
// Note: This does not guarantee compatibility with forbidding these lints in the future.
|
||||
// If rustc adds a new lint, we may not be able to keep this.
|
||||
#![forbid(future_incompatible, rust_2018_compatibility)]
|
||||
#![forbid(future_incompatible)]
|
||||
#![allow(unknown_lints)] // for old compilers
|
||||
#![forbid(unsafe_code)]
|
||||
#![warn(
|
||||
box_pointers,
|
||||
deprecated_in_future,
|
||||
disjoint_capture_drop_reorder,
|
||||
elided_lifetimes_in_paths,
|
||||
explicit_outlives_requirements,
|
||||
disjoint_capture_migration,
|
||||
macro_use_extern_crate,
|
||||
meta_variable_misuse,
|
||||
missing_abi,
|
||||
missing_copy_implementations,
|
||||
missing_crate_level_docs,
|
||||
missing_debug_implementations,
|
||||
missing_docs,
|
||||
non_ascii_idents,
|
||||
noop_method_call,
|
||||
single_use_lifetimes,
|
||||
trivial_casts,
|
||||
trivial_numeric_casts,
|
||||
unaligned_references,
|
||||
unreachable_pub,
|
||||
unused_extern_crates,
|
||||
unused_import_braces,
|
||||
unused_lifetimes,
|
||||
unused_qualifications,
|
||||
unused_results,
|
||||
variant_size_differences
|
||||
)]
|
||||
// absolute_paths_not_starting_with_crate, anonymous_parameters, keyword_idents, pointer_structural_match, semicolon_in_expressions_from_macros: forbidden as a part of future_incompatible
|
||||
// missing_doc_code_examples, private_doc_tests, invalid_html_tags: warned as a part of rustdoc
|
||||
// unsafe_block_in_unsafe_fn: unstable
|
||||
// unsafe_code: forbidden
|
||||
// unstable_features: deprecated: https://doc.rust-lang.org/beta/rustc/lints/listing/allowed-by-default.html#unstable-features
|
||||
// rust_2018_compatibility, rust_2021_compatibility, absolute_paths_not_starting_with_crate, etc.: forbidden as a part of future_incompatible
|
||||
// elided_lifetimes_in_paths, explicit_outlives_requirements, unused_extern_crates: warned as a part of rust_2018_idioms
|
||||
// unsafe_block_in_unsafe_fn: unsafe_block_in_unsafe_fn: requires Rust 1.52. and, we don't generate unsafe fn.
|
||||
// unstable_features: no way to generate #![feature(..)] by macros, expect for unstable inner attribute. and this lint is deprecated: https://doc.rust-lang.org/rustc/lints/listing/allowed-by-default.html#unstable-features
|
||||
// unused_crate_dependencies: unrelated
|
||||
// unsafe_code: forbidden
|
||||
#![warn(clippy::all, clippy::pedantic, clippy::nursery)]
|
||||
#![warn(clippy::restriction)]
|
||||
#![allow(clippy::blanket_clippy_restriction_lints)] // this is a test, so enable all restriction lints intentionally.
|
||||
#![allow(clippy::exhaustive_structs, clippy::exhaustive_enums)] // TODO
|
||||
|
||||
// Check interoperability with rustc and clippy lints.
|
||||
|
||||
pub mod basic {
|
||||
include!("include/basic.rs");
|
||||
}
|
||||
|
35
third_party/rust/pin-project-lite/tests/test.rs
vendored
35
third_party/rust/pin-project-lite/tests/test.rs
vendored
@ -52,7 +52,7 @@ fn projection() {
|
||||
|
||||
{
|
||||
let StructProjReplace { f1: PhantomData, f2 } =
|
||||
s.as_mut().project_replace(Default::default());
|
||||
s.as_mut().project_replace(Struct::default());
|
||||
assert_eq!(f2, 2);
|
||||
let StructProj { f1, f2 } = s.project();
|
||||
assert_eq!(*f1, 0);
|
||||
@ -633,3 +633,36 @@ fn attrs() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pinned_drop() {
|
||||
pin_project! {
|
||||
pub struct Struct1<'a> {
|
||||
was_dropped: &'a mut bool,
|
||||
#[pin]
|
||||
field: u8,
|
||||
}
|
||||
impl PinnedDrop for Struct1<'_> {
|
||||
fn drop(this: Pin<&mut Self>) {
|
||||
**this.project().was_dropped = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let mut was_dropped = false;
|
||||
drop(Struct1 { was_dropped: &mut was_dropped, field: 42 });
|
||||
assert!(was_dropped);
|
||||
|
||||
pin_project! {
|
||||
pub struct Struct2<'a> {
|
||||
was_dropped: &'a mut bool,
|
||||
#[pin]
|
||||
field: u8,
|
||||
}
|
||||
impl PinnedDrop for Struct2<'_> {
|
||||
fn drop(mut this: Pin<&mut Self>) {
|
||||
**this.as_mut().project().was_dropped = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
error[E0119]: conflicting implementations of trait `_::MustNotImplDrop` for type `Foo<_, _>`:
|
||||
error[E0119]: conflicting implementations of trait `_::MustNotImplDrop` for type `Foo<_, _>`
|
||||
--> $DIR/conflict-drop.rs:3:1
|
||||
|
|
||||
3 | / pin_project! { //~ ERROR E0119
|
||||
@ -13,4 +13,4 @@ error[E0119]: conflicting implementations of trait `_::MustNotImplDrop` for type
|
||||
| |_first implementation here
|
||||
| conflicting implementation for `Foo<_, _>`
|
||||
|
|
||||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
= note: this error originates in the macro `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
@ -1,4 +1,4 @@
|
||||
error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Foo<_, _>`:
|
||||
error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Foo<_, _>`
|
||||
--> $DIR/conflict-unpin.rs:5:1
|
||||
|
|
||||
5 | / pin_project! { //~ ERROR E0119
|
||||
@ -13,9 +13,9 @@ error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type
|
||||
14 | impl<T, U> Unpin for Foo<T, U> where T: Unpin {} // Conditional Unpin impl
|
||||
| --------------------------------------------- first implementation here
|
||||
|
|
||||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
= note: this error originates in the macro `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Bar<_, _>`:
|
||||
error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Bar<_, _>`
|
||||
--> $DIR/conflict-unpin.rs:18:1
|
||||
|
|
||||
18 | / pin_project! { //~ ERROR E0119
|
||||
@ -30,9 +30,9 @@ error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type
|
||||
27 | impl<T, U> Unpin for Bar<T, U> {} // Non-conditional Unpin impl
|
||||
| ------------------------------ first implementation here
|
||||
|
|
||||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
= note: this error originates in the macro `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Baz<_, _>`:
|
||||
error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Baz<_, _>`
|
||||
--> $DIR/conflict-unpin.rs:29:1
|
||||
|
|
||||
29 | / pin_project! { //~ ERROR E0119
|
||||
@ -47,4 +47,4 @@ error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type
|
||||
38 | impl<T: Unpin, U: Unpin> Unpin for Baz<T, U> {} // Conditional Unpin impl
|
||||
| -------------------------------------------- first implementation here
|
||||
|
|
||||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
= note: this error originates in the macro `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
@ -8,7 +8,7 @@ error: no rules expected the token `[`
|
||||
7 | | }
|
||||
| |_^ no rules expected this token in macro call
|
||||
|
|
||||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
= note: this error originates in the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: no rules expected the token `[`
|
||||
--> $DIR/invalid-bounds.rs:9:1
|
||||
@ -20,7 +20,7 @@ error: no rules expected the token `[`
|
||||
13 | | }
|
||||
| |_^ no rules expected this token in macro call
|
||||
|
|
||||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
= note: this error originates in the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: expected one of `+`, `,`, `=`, or `>`, found `:`
|
||||
--> $DIR/invalid-bounds.rs:15:1
|
||||
@ -36,7 +36,7 @@ error: expected one of `+`, `,`, `=`, or `>`, found `:`
|
||||
| |_unexpected token
|
||||
| in this macro invocation
|
||||
|
|
||||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
= note: this error originates in the macro `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: expected one of `+`, `,`, `=`, or `>`, found `:`
|
||||
--> $DIR/invalid-bounds.rs:21:1
|
||||
@ -52,7 +52,7 @@ error: expected one of `+`, `,`, `=`, or `>`, found `:`
|
||||
| |_unexpected token
|
||||
| in this macro invocation
|
||||
|
|
||||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
= note: this error originates in the macro `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: expected one of `+`, `,`, `=`, or `>`, found `:`
|
||||
--> $DIR/invalid-bounds.rs:27:1
|
||||
@ -68,7 +68,7 @@ error: expected one of `+`, `,`, `=`, or `>`, found `:`
|
||||
| |_unexpected token
|
||||
| in this macro invocation
|
||||
|
|
||||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
= note: this error originates in the macro `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: no rules expected the token `[`
|
||||
--> $DIR/invalid-bounds.rs:33:1
|
||||
@ -80,7 +80,7 @@ error: no rules expected the token `[`
|
||||
37 | | }
|
||||
| |_^ no rules expected this token in macro call
|
||||
|
|
||||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
= note: this error originates in the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: no rules expected the token `[`
|
||||
--> $DIR/invalid-bounds.rs:39:1
|
||||
@ -94,7 +94,7 @@ error: no rules expected the token `[`
|
||||
46 | | }
|
||||
| |_^ no rules expected this token in macro call
|
||||
|
|
||||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
= note: this error originates in the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: no rules expected the token `[`
|
||||
--> $DIR/invalid-bounds.rs:48:1
|
||||
@ -108,7 +108,7 @@ error: no rules expected the token `[`
|
||||
55 | | }
|
||||
| |_^ no rules expected this token in macro call
|
||||
|
|
||||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
= note: this error originates in the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: expected `where`, or `{` after struct name, found `:`
|
||||
--> $DIR/invalid-bounds.rs:57:1
|
||||
@ -125,7 +125,7 @@ error: expected `where`, or `{` after struct name, found `:`
|
||||
| |_expected `where`, or `{` after struct name
|
||||
| in this macro invocation
|
||||
|
|
||||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
= note: this error originates in the macro `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: expected `where`, or `{` after struct name, found `:`
|
||||
--> $DIR/invalid-bounds.rs:66:1
|
||||
@ -142,7 +142,7 @@ error: expected `where`, or `{` after struct name, found `:`
|
||||
| |_expected `where`, or `{` after struct name
|
||||
| in this macro invocation
|
||||
|
|
||||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
= note: this error originates in the macro `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: expected `where`, or `{` after struct name, found `:`
|
||||
--> $DIR/invalid-bounds.rs:75:1
|
||||
@ -159,7 +159,7 @@ error: expected `where`, or `{` after struct name, found `:`
|
||||
| |_expected `where`, or `{` after struct name
|
||||
| in this macro invocation
|
||||
|
|
||||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
= note: this error originates in the macro `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: no rules expected the token `[`
|
||||
--> $DIR/invalid-bounds.rs:84:1
|
||||
@ -173,4 +173,4 @@ error: no rules expected the token `[`
|
||||
91 | | }
|
||||
| |_^ no rules expected this token in macro call
|
||||
|
|
||||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
= note: this error originates in the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
@ -9,7 +9,7 @@ error: no rules expected the token `[`
|
||||
8 | | }
|
||||
| |_^ no rules expected this token in macro call
|
||||
|
|
||||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
= note: this error originates in the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: no rules expected the token `[`
|
||||
--> $DIR/invalid.rs:17:1
|
||||
@ -23,7 +23,7 @@ error: no rules expected the token `[`
|
||||
23 | | }
|
||||
| |_^ no rules expected this token in macro call
|
||||
|
|
||||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
= note: this error originates in the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: cannot find attribute `pin` in this scope
|
||||
--> $DIR/invalid.rs:11:7
|
||||
|
@ -1,7 +1,7 @@
|
||||
use pin_project_lite::pin_project;
|
||||
|
||||
pin_project! { //~ ERROR E0496
|
||||
pub struct Foo<'__pin, T> { //~ ERROR E0263
|
||||
pin_project! { //~ ERROR E0263,E0496
|
||||
pub struct Foo<'__pin, T> {
|
||||
#[pin]
|
||||
field: &'__pin mut T,
|
||||
}
|
||||
|
@ -1,8 +1,44 @@
|
||||
error[E0263]: lifetime name `'__pin` declared twice in the same scope
|
||||
--> $DIR/overlapping_lifetime_names.rs:4:20
|
||||
|
|
||||
3 | / pin_project! { //~ ERROR E0263,E0496
|
||||
4 | | pub struct Foo<'__pin, T> {
|
||||
| | ^^^^^^ declared twice
|
||||
5 | | #[pin]
|
||||
6 | | field: &'__pin mut T,
|
||||
7 | | }
|
||||
8 | | }
|
||||
| |_- previous declaration here
|
||||
|
||||
error[E0263]: lifetime name `'__pin` declared twice in the same scope
|
||||
--> $DIR/overlapping_lifetime_names.rs:4:20
|
||||
|
|
||||
3 | / pin_project! { //~ ERROR E0263,E0496
|
||||
4 | | pub struct Foo<'__pin, T> {
|
||||
| | ^^^^^^ declared twice
|
||||
5 | | #[pin]
|
||||
6 | | field: &'__pin mut T,
|
||||
7 | | }
|
||||
8 | | }
|
||||
| |_- previous declaration here
|
||||
|
||||
error[E0263]: lifetime name `'__pin` declared twice in the same scope
|
||||
--> $DIR/overlapping_lifetime_names.rs:4:20
|
||||
|
|
||||
3 | / pin_project! { //~ ERROR E0263,E0496
|
||||
4 | | pub struct Foo<'__pin, T> {
|
||||
| | ^^^^^^ declared twice
|
||||
5 | | #[pin]
|
||||
6 | | field: &'__pin mut T,
|
||||
7 | | }
|
||||
8 | | }
|
||||
| |_- previous declaration here
|
||||
|
||||
error[E0496]: lifetime name `'__pin` shadows a lifetime name that is already in scope
|
||||
--> $DIR/overlapping_lifetime_names.rs:3:1
|
||||
|
|
||||
3 | / pin_project! { //~ ERROR E0496
|
||||
4 | | pub struct Foo<'__pin, T> { //~ ERROR E0263
|
||||
3 | / pin_project! { //~ ERROR E0263,E0496
|
||||
4 | | pub struct Foo<'__pin, T> {
|
||||
| | ------ first declared here
|
||||
5 | | #[pin]
|
||||
6 | | field: &'__pin mut T,
|
||||
@ -10,13 +46,13 @@ error[E0496]: lifetime name `'__pin` shadows a lifetime name that is already in
|
||||
8 | | }
|
||||
| |_^ lifetime `'__pin` already in scope
|
||||
|
|
||||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
= note: this error originates in the macro `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0496]: lifetime name `'__pin` shadows a lifetime name that is already in scope
|
||||
--> $DIR/overlapping_lifetime_names.rs:3:1
|
||||
|
|
||||
3 | / pin_project! { //~ ERROR E0496
|
||||
4 | | pub struct Foo<'__pin, T> { //~ ERROR E0263
|
||||
3 | / pin_project! { //~ ERROR E0263,E0496
|
||||
4 | | pub struct Foo<'__pin, T> {
|
||||
| | ------ first declared here
|
||||
5 | | #[pin]
|
||||
6 | | field: &'__pin mut T,
|
||||
@ -24,49 +60,13 @@ error[E0496]: lifetime name `'__pin` shadows a lifetime name that is already in
|
||||
8 | | }
|
||||
| |_^ lifetime `'__pin` already in scope
|
||||
|
|
||||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
= note: this error originates in the macro `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0263]: lifetime name `'__pin` declared twice in the same scope
|
||||
--> $DIR/overlapping_lifetime_names.rs:4:20
|
||||
|
|
||||
3 | / pin_project! { //~ ERROR E0496
|
||||
4 | | pub struct Foo<'__pin, T> { //~ ERROR E0263
|
||||
| | ^^^^^^ declared twice
|
||||
5 | | #[pin]
|
||||
6 | | field: &'__pin mut T,
|
||||
7 | | }
|
||||
8 | | }
|
||||
| |_- previous declaration here
|
||||
|
||||
error[E0263]: lifetime name `'__pin` declared twice in the same scope
|
||||
--> $DIR/overlapping_lifetime_names.rs:4:20
|
||||
|
|
||||
3 | / pin_project! { //~ ERROR E0496
|
||||
4 | | pub struct Foo<'__pin, T> { //~ ERROR E0263
|
||||
| | ^^^^^^ declared twice
|
||||
5 | | #[pin]
|
||||
6 | | field: &'__pin mut T,
|
||||
7 | | }
|
||||
8 | | }
|
||||
| |_- previous declaration here
|
||||
|
||||
error[E0263]: lifetime name `'__pin` declared twice in the same scope
|
||||
--> $DIR/overlapping_lifetime_names.rs:4:20
|
||||
|
|
||||
3 | / pin_project! { //~ ERROR E0496
|
||||
4 | | pub struct Foo<'__pin, T> { //~ ERROR E0263
|
||||
| | ^^^^^^ declared twice
|
||||
5 | | #[pin]
|
||||
6 | | field: &'__pin mut T,
|
||||
7 | | }
|
||||
8 | | }
|
||||
| |_- previous declaration here
|
||||
|
||||
error[E0263]: lifetime name `'__pin` declared twice in the same scope
|
||||
--> $DIR/overlapping_lifetime_names.rs:4:20
|
||||
|
|
||||
3 | / pin_project! { //~ ERROR E0496
|
||||
4 | | pub struct Foo<'__pin, T> { //~ ERROR E0263
|
||||
3 | / pin_project! { //~ ERROR E0263,E0496
|
||||
4 | | pub struct Foo<'__pin, T> {
|
||||
| | ^^^^^^ declared twice
|
||||
5 | | #[pin]
|
||||
6 | | field: &'__pin mut T,
|
||||
|
@ -1,6 +1,7 @@
|
||||
use pin_project_lite::pin_project;
|
||||
use std::marker::PhantomPinned;
|
||||
|
||||
use pin_project_lite::pin_project;
|
||||
|
||||
pin_project! {
|
||||
struct Foo<T> {
|
||||
#[pin]
|
||||
|
@ -1,11 +1,22 @@
|
||||
error[E0277]: `PhantomPinned` cannot be unpinned
|
||||
--> $DIR/overlapping_unpin_struct.rs:18:5
|
||||
--> $DIR/overlapping_unpin_struct.rs:19:5
|
||||
|
|
||||
15 | fn is_unpin<T: Unpin>() {}
|
||||
16 | fn is_unpin<T: Unpin>() {}
|
||||
| ----- required by this bound in `is_unpin`
|
||||
...
|
||||
18 | is_unpin::<Foo<PhantomPinned>>(); //~ ERROR E0277
|
||||
19 | is_unpin::<Foo<PhantomPinned>>(); //~ ERROR E0277
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ within `_::__Origin<'_, PhantomPinned>`, the trait `Unpin` is not implemented for `PhantomPinned`
|
||||
|
|
||||
= note: required because it appears within the type `_::__Origin<'_, PhantomPinned>`
|
||||
= note: consider using `Box::pin`
|
||||
note: required because it appears within the type `_::__Origin<'_, PhantomPinned>`
|
||||
--> $DIR/overlapping_unpin_struct.rs:5:1
|
||||
|
|
||||
5 | / pin_project! {
|
||||
6 | | struct Foo<T> {
|
||||
7 | | #[pin]
|
||||
8 | | inner: T,
|
||||
9 | | }
|
||||
10 | | }
|
||||
| |_^
|
||||
= note: required because of the requirements on the impl of `Unpin` for `Foo<PhantomPinned>`
|
||||
= note: this error originates in the macro `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
@ -1,3 +1,5 @@
|
||||
#![allow(unaligned_references)]
|
||||
|
||||
use pin_project_lite::pin_project;
|
||||
|
||||
pin_project! { //~ ERROR reference to packed field is unaligned
|
||||
|
@ -1,107 +1,55 @@
|
||||
error: reference to packed field is unaligned
|
||||
--> $DIR/packed.rs:3:1
|
||||
|
|
||||
3 | / pin_project! { //~ ERROR reference to packed field is unaligned
|
||||
4 | | #[repr(packed, C)]
|
||||
5 | | struct Packed {
|
||||
6 | | #[pin]
|
||||
7 | | field: u16,
|
||||
8 | | }
|
||||
9 | | }
|
||||
| |_^
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/packed.rs:3:1
|
||||
|
|
||||
3 | / pin_project! { //~ ERROR reference to packed field is unaligned
|
||||
4 | | #[repr(packed, C)]
|
||||
5 | | struct Packed {
|
||||
6 | | #[pin]
|
||||
7 | | field: u16,
|
||||
8 | | }
|
||||
9 | | }
|
||||
| |_^
|
||||
= note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced)
|
||||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: reference to packed field is unaligned
|
||||
--> $DIR/packed.rs:11:1
|
||||
--> $DIR/packed.rs:5:1
|
||||
|
|
||||
11 | / pin_project! { //~ ERROR reference to packed field is unaligned
|
||||
12 | | #[repr(packed(2))]
|
||||
13 | | struct PackedN {
|
||||
14 | | #[pin]
|
||||
15 | | field: u32,
|
||||
16 | | }
|
||||
17 | | }
|
||||
5 | / pin_project! { //~ ERROR reference to packed field is unaligned
|
||||
6 | | #[repr(packed, C)]
|
||||
7 | | struct Packed {
|
||||
8 | | #[pin]
|
||||
9 | | field: u16,
|
||||
10 | | }
|
||||
11 | | }
|
||||
| |_^
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/packed.rs:11:1
|
||||
--> $DIR/packed.rs:5:1
|
||||
|
|
||||
11 | / pin_project! { //~ ERROR reference to packed field is unaligned
|
||||
12 | | #[repr(packed(2))]
|
||||
13 | | struct PackedN {
|
||||
14 | | #[pin]
|
||||
15 | | field: u32,
|
||||
16 | | }
|
||||
17 | | }
|
||||
| |_^
|
||||
= note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced)
|
||||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: borrow of packed field is unsafe and requires unsafe function or block (error E0133)
|
||||
--> $DIR/packed.rs:3:1
|
||||
|
|
||||
3 | / pin_project! { //~ ERROR reference to packed field is unaligned
|
||||
4 | | #[repr(packed, C)]
|
||||
5 | | struct Packed {
|
||||
6 | | #[pin]
|
||||
7 | | field: u16,
|
||||
8 | | }
|
||||
9 | | }
|
||||
| |_^
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/packed.rs:3:1
|
||||
|
|
||||
3 | / pin_project! { //~ ERROR reference to packed field is unaligned
|
||||
4 | | #[repr(packed, C)]
|
||||
5 | | struct Packed {
|
||||
6 | | #[pin]
|
||||
7 | | field: u16,
|
||||
8 | | }
|
||||
9 | | }
|
||||
| |_^
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #46043 <https://github.com/rust-lang/rust/issues/46043>
|
||||
= note: fields of packed structs might be misaligned: dereferencing a misaligned pointer or even just creating a misaligned reference is undefined behavior
|
||||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: borrow of packed field is unsafe and requires unsafe function or block (error E0133)
|
||||
--> $DIR/packed.rs:11:1
|
||||
|
|
||||
11 | / pin_project! { //~ ERROR reference to packed field is unaligned
|
||||
12 | | #[repr(packed(2))]
|
||||
13 | | struct PackedN {
|
||||
14 | | #[pin]
|
||||
15 | | field: u32,
|
||||
16 | | }
|
||||
17 | | }
|
||||
| |_^
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/packed.rs:11:1
|
||||
|
|
||||
11 | / pin_project! { //~ ERROR reference to packed field is unaligned
|
||||
12 | | #[repr(packed(2))]
|
||||
13 | | struct PackedN {
|
||||
14 | | #[pin]
|
||||
15 | | field: u32,
|
||||
16 | | }
|
||||
17 | | }
|
||||
5 | / pin_project! { //~ ERROR reference to packed field is unaligned
|
||||
6 | | #[repr(packed, C)]
|
||||
7 | | struct Packed {
|
||||
8 | | #[pin]
|
||||
9 | | field: u16,
|
||||
10 | | }
|
||||
11 | | }
|
||||
| |_^
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #46043 <https://github.com/rust-lang/rust/issues/46043>
|
||||
= note: fields of packed structs might be misaligned: dereferencing a misaligned pointer or even just creating a misaligned reference is undefined behavior
|
||||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
= note: for more information, see issue #82523 <https://github.com/rust-lang/rust/issues/82523>
|
||||
= note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced)
|
||||
= note: this error originates in the macro `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: reference to packed field is unaligned
|
||||
--> $DIR/packed.rs:13:1
|
||||
|
|
||||
13 | / pin_project! { //~ ERROR reference to packed field is unaligned
|
||||
14 | | #[repr(packed(2))]
|
||||
15 | | struct PackedN {
|
||||
16 | | #[pin]
|
||||
17 | | field: u32,
|
||||
18 | | }
|
||||
19 | | }
|
||||
| |_^
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/packed.rs:13:1
|
||||
|
|
||||
13 | / pin_project! { //~ ERROR reference to packed field is unaligned
|
||||
14 | | #[repr(packed(2))]
|
||||
15 | | struct PackedN {
|
||||
16 | | #[pin]
|
||||
17 | | field: u32,
|
||||
18 | | }
|
||||
19 | | }
|
||||
| |_^
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #82523 <https://github.com/rust-lang/rust/issues/82523>
|
||||
= note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced)
|
||||
= note: this error originates in the macro `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
@ -6,7 +6,7 @@ error: no rules expected the token `[`
|
||||
5 | | }
|
||||
| |_^ no rules expected this token in macro call
|
||||
|
|
||||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
= note: this error originates in the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: no rules expected the token `[`
|
||||
--> $DIR/unsupported.rs:7:1
|
||||
@ -16,7 +16,7 @@ error: no rules expected the token `[`
|
||||
9 | | }
|
||||
| |_^ no rules expected this token in macro call
|
||||
|
|
||||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
= note: this error originates in the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: no rules expected the token `[`
|
||||
--> $DIR/unsupported.rs:11:1
|
||||
@ -26,7 +26,7 @@ error: no rules expected the token `[`
|
||||
13 | | }
|
||||
| |_^ no rules expected this token in macro call
|
||||
|
|
||||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
= note: this error originates in the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: no rules expected the token `[`
|
||||
--> $DIR/unsupported.rs:15:1
|
||||
@ -38,7 +38,7 @@ error: no rules expected the token `[`
|
||||
19 | | }
|
||||
| |_^ no rules expected this token in macro call
|
||||
|
|
||||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
= note: this error originates in the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: no rules expected the token `[`
|
||||
--> $DIR/unsupported.rs:21:1
|
||||
@ -50,4 +50,4 @@ error: no rules expected the token `[`
|
||||
25 | | }
|
||||
| |_^ no rules expected this token in macro call
|
||||
|
|
||||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
= note: this error originates in the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
17
third_party/rust/pin-project-lite/tests/ui/pinned_drop/call-drop-inner.rs
vendored
Normal file
17
third_party/rust/pin-project-lite/tests/ui/pinned_drop/call-drop-inner.rs
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
use pin_project_lite::pin_project;
|
||||
|
||||
pin_project! {
|
||||
pub struct S {
|
||||
#[pin]
|
||||
field: u8,
|
||||
}
|
||||
impl PinnedDrop for S {
|
||||
fn drop(this: Pin<&mut Self>) {
|
||||
__drop_inner(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let _x = S { field: 0 };
|
||||
}
|
20
third_party/rust/pin-project-lite/tests/ui/pinned_drop/call-drop-inner.stderr
vendored
Normal file
20
third_party/rust/pin-project-lite/tests/ui/pinned_drop/call-drop-inner.stderr
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
error[E0061]: this function takes 0 arguments but 1 argument was supplied
|
||||
--> $DIR/call-drop-inner.rs:10:13
|
||||
|
|
||||
10 | __drop_inner(this);
|
||||
| ^^^^^^^^^^^^ ---- supplied 1 argument
|
||||
| |
|
||||
| expected 0 arguments
|
||||
|
|
||||
note: function defined here
|
||||
--> $DIR/call-drop-inner.rs:3:1
|
||||
|
|
||||
3 | / pin_project! {
|
||||
4 | | pub struct S {
|
||||
5 | | #[pin]
|
||||
6 | | field: u8,
|
||||
... |
|
||||
12 | | }
|
||||
13 | | }
|
||||
| |_^
|
||||
= note: this error originates in the macro `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
|
26
third_party/rust/pin-project-lite/tests/ui/pinned_drop/conditional-drop-impl.rs
vendored
Normal file
26
third_party/rust/pin-project-lite/tests/ui/pinned_drop/conditional-drop-impl.rs
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
use pin_project_lite::pin_project;
|
||||
|
||||
// In `Drop` impl, the implementor must specify the same requirement as type definition.
|
||||
|
||||
struct DropImpl<T> {
|
||||
f: T,
|
||||
}
|
||||
|
||||
impl<T: Unpin> Drop for DropImpl<T> {
|
||||
//~^ ERROR E0367
|
||||
fn drop(&mut self) {}
|
||||
}
|
||||
|
||||
pin_project! {
|
||||
//~^ ERROR E0367
|
||||
struct PinnedDropImpl<T> {
|
||||
#[pin]
|
||||
f: T,
|
||||
}
|
||||
|
||||
impl<T: Unpin> PinnedDrop for PinnedDropImpl<T> {
|
||||
fn drop(_this: Pin<&mut Self>) {}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
38
third_party/rust/pin-project-lite/tests/ui/pinned_drop/conditional-drop-impl.stderr
vendored
Normal file
38
third_party/rust/pin-project-lite/tests/ui/pinned_drop/conditional-drop-impl.stderr
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
error[E0367]: `Drop` impl requires `T: Unpin` but the struct it is implemented for does not
|
||||
--> $DIR/conditional-drop-impl.rs:9:9
|
||||
|
|
||||
9 | impl<T: Unpin> Drop for DropImpl<T> {
|
||||
| ^^^^^
|
||||
|
|
||||
note: the implementor must specify the same requirement
|
||||
--> $DIR/conditional-drop-impl.rs:5:1
|
||||
|
|
||||
5 | / struct DropImpl<T> {
|
||||
6 | | f: T,
|
||||
7 | | }
|
||||
| |_^
|
||||
|
||||
error[E0367]: `Drop` impl requires `T: Unpin` but the struct it is implemented for does not
|
||||
--> $DIR/conditional-drop-impl.rs:14:1
|
||||
|
|
||||
14 | / pin_project! {
|
||||
15 | | //~^ ERROR E0367
|
||||
16 | | struct PinnedDropImpl<T> {
|
||||
17 | | #[pin]
|
||||
... |
|
||||
23 | | }
|
||||
24 | | }
|
||||
| |_^
|
||||
|
|
||||
note: the implementor must specify the same requirement
|
||||
--> $DIR/conditional-drop-impl.rs:14:1
|
||||
|
|
||||
14 | / pin_project! {
|
||||
15 | | //~^ ERROR E0367
|
||||
16 | | struct PinnedDropImpl<T> {
|
||||
17 | | #[pin]
|
||||
... |
|
||||
23 | | }
|
||||
24 | | }
|
||||
| |_^
|
||||
= note: this error originates in the macro `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
|
@ -1 +1 @@
|
||||
{"files":{"CHANGELOG.md":"76c3cdc468bd39843de5ed2e5d11cc2de3e2fa3cc099dd3137722105f94c8557","Cargo.toml":"a575e9c8b92c4b29fbf7bb4add0e77ec99464e3ae9248d42c5162e948ffa914d","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"378f5840b258e2779c39418f3f2d7b2ba96f1c7917dd6be0713f88305dbda397","README.md":"1e22446920533dea171fea3951cb4cf8db34bd4dd6414b688720410a9c414d3c","src/lib.rs":"cecbf5f9c982e21cba0391a4d73ad9aab10a0fbfcfcbb3bab4ecb05ee9467e32","tests/escape.pc":"00caa4136799dbe5bd504239ba90d1156c12def365c8d761da319fe8a83b398e","tests/foo.pc":"4a1c442c5d1c10761ea1644f8fd58f93cc5a706391bc67b04c243bbd35d70d79","tests/framework.pc":"304fdb6cea92973650e410ab1f70ce1ebeb7718af3f139e806efbf182acd565c","tests/test.rs":"5ed13fc28a1853d20d27798819a1228673cb1e57097951dbb892e51327a21adb"},"package":"3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c"}
|
||||
{"files":{"CHANGELOG.md":"1c60eb6231812ffe4b276d94092d406e10cdf2cfb2f13005a11509b6fdd38d12","Cargo.toml":"301f08ce329cb75af34a9def9f93392db0d19ae62237e8ddb71e2ff0c0baf8d0","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"378f5840b258e2779c39418f3f2d7b2ba96f1c7917dd6be0713f88305dbda397","README.md":"37f11a56c969237dcfd15368e96bf686ec92b0254e38fb84636e178d632c0492","src/lib.rs":"da375f79b79233081a1cf0dfee29f71665fabad2ffaf1b9222a06eeb48f41831","tests/escape.pc":"00caa4136799dbe5bd504239ba90d1156c12def365c8d761da319fe8a83b398e","tests/foo.pc":"4a1c442c5d1c10761ea1644f8fd58f93cc5a706391bc67b04c243bbd35d70d79","tests/framework.pc":"304fdb6cea92973650e410ab1f70ce1ebeb7718af3f139e806efbf182acd565c","tests/test.rs":"5ed13fc28a1853d20d27798819a1228673cb1e57097951dbb892e51327a21adb"},"package":"d1a3ea4f0dd7f1f3e512cf97bf100819aa547f36a6eccac8dbaae839eb92363e"}
|
39
third_party/rust/pkg-config/CHANGELOG.md
vendored
39
third_party/rust/pkg-config/CHANGELOG.md
vendored
@ -2,8 +2,43 @@
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
||||
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [0.3.23] - 2021-12-06
|
||||
|
||||
### Changed
|
||||
|
||||
- Improve error messages when a `pkg-config` package can't be found (#127).
|
||||
|
||||
## [0.3.22] - 2021-10-24
|
||||
|
||||
### Fixed
|
||||
|
||||
- `pkg-config` compiles again with Rust 1.30 or newer. 0.3.21 accidentally
|
||||
made use of API only available since 1.40 (#124, #125).
|
||||
|
||||
### Changed
|
||||
|
||||
- Switched from Travis to GitHub Actions for the CI. Travis is dysfunctional
|
||||
since quite some time (#126).
|
||||
|
||||
## [0.3.21] - 2021-10-22
|
||||
|
||||
### Fixed
|
||||
|
||||
- Tests succeed again on macOS (#122).
|
||||
|
||||
### Changed
|
||||
|
||||
- Improve error message in case of missing pkg-config and provide instructions
|
||||
how it can be installed (#121).
|
||||
|
||||
## [0.3.20] - 2021-09-25
|
||||
|
||||
### Fixed
|
||||
|
||||
- Use target-specific pkg-config consistently everywhere (#121, #118).
|
||||
|
||||
## [0.3.19] - 2020-10-13
|
||||
|
||||
|
11
third_party/rust/pkg-config/Cargo.toml
vendored
11
third_party/rust/pkg-config/Cargo.toml
vendored
@ -3,16 +3,15 @@
|
||||
# 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
|
||||
# to registry (e.g., crates.io) dependencies.
|
||||
#
|
||||
# If you believe there's an error in this file please file an
|
||||
# issue against the rust-lang/cargo repository. If you're
|
||||
# editing this file be aware that the upstream Cargo.toml
|
||||
# will likely look very different (and much more reasonable)
|
||||
# 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]
|
||||
name = "pkg-config"
|
||||
version = "0.3.19"
|
||||
version = "0.3.23"
|
||||
authors = ["Alex Crichton <alex@alexcrichton.com>"]
|
||||
description = "A library to run the pkg-config system tool at build time in order to be used in\nCargo build scripts.\n"
|
||||
documentation = "https://docs.rs/pkg-config"
|
||||
|
8
third_party/rust/pkg-config/README.md
vendored
8
third_party/rust/pkg-config/README.md
vendored
@ -1,6 +1,6 @@
|
||||
# pkg-config-rs
|
||||
|
||||
[![Build Status](https://travis-ci.com/rust-lang/pkg-config-rs.svg?branch=master)](https://travis-ci.com/rust-lang/pkg-config-rs)
|
||||
[![Build Status](https://github.com/rust-lang/pkg-config-rs/actions/workflows/ci.yml/badge.svg)](https://github.com/rust-lang/pkg-config-rs/actions)
|
||||
[![Rust](https://img.shields.io/badge/rust-1.30%2B-blue.svg?maxAge=3600)](https://github.com/rust-lang/pkg-config-rs/)
|
||||
|
||||
[Documentation](https://docs.rs/pkg-config)
|
||||
@ -10,7 +10,7 @@ order to use the system `pkg-config` tool (if available) to determine where a
|
||||
library is located.
|
||||
|
||||
You can use this crate directly to probe for specific libraries, or use
|
||||
[metadeps](https://github.com/joshtriplett/metadeps) to declare all your
|
||||
[system-deps](https://github.com/gdesmott/system-deps) to declare all your
|
||||
`pkg-config` dependencies in `Cargo.toml`.
|
||||
|
||||
This library requires Rust 1.30+.
|
||||
@ -66,9 +66,9 @@ around for lack of cross-compilation support in `pkg-config`.
|
||||
This project is licensed under either of
|
||||
|
||||
* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
||||
http://www.apache.org/licenses/LICENSE-2.0)
|
||||
https://www.apache.org/licenses/LICENSE-2.0)
|
||||
* MIT license ([LICENSE-MIT](LICENSE-MIT) or
|
||||
http://opensource.org/licenses/MIT)
|
||||
https://opensource.org/licenses/MIT)
|
||||
|
||||
at your option.
|
||||
|
||||
|
115
third_party/rust/pkg-config/src/lib.rs
vendored
115
third_party/rust/pkg-config/src/lib.rs
vendored
@ -104,7 +104,6 @@ pub struct Library {
|
||||
}
|
||||
|
||||
/// Represents all reasons `pkg-config` might not succeed or be run at all.
|
||||
#[derive(Debug)]
|
||||
pub enum Error {
|
||||
/// Aborted because of `*_NO_PKG_CONFIG` environment variable.
|
||||
///
|
||||
@ -123,11 +122,20 @@ pub enum Error {
|
||||
/// Contains the command and the cause.
|
||||
Command { command: String, cause: io::Error },
|
||||
|
||||
/// `pkg-config` did not exit sucessfully.
|
||||
/// `pkg-config` did not exit sucessfully after probing a library.
|
||||
///
|
||||
/// Contains the command and output.
|
||||
Failure { command: String, output: Output },
|
||||
|
||||
/// `pkg-config` did not exit sucessfully on the first attempt to probe a library.
|
||||
///
|
||||
/// Contains the command and output.
|
||||
ProbeFailure {
|
||||
name: String,
|
||||
command: String,
|
||||
output: Output,
|
||||
},
|
||||
|
||||
#[doc(hidden)]
|
||||
// please don't match on this, we're likely to add more variants over time
|
||||
__Nonexhaustive,
|
||||
@ -135,46 +143,98 @@ pub enum Error {
|
||||
|
||||
impl error::Error for Error {}
|
||||
|
||||
impl fmt::Debug for Error {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
||||
// Failed `unwrap()` prints Debug representation, but the default debug format lacks helpful instructions for the end users
|
||||
<Error as fmt::Display>::fmt(self, f)
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for Error {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
||||
match *self {
|
||||
Error::EnvNoPkgConfig(ref name) => write!(f, "Aborted because {} is set", name),
|
||||
Error::CrossCompilation => f.write_str(
|
||||
"pkg-config has not been configured to support cross-compilation.
|
||||
|
||||
Install a sysroot for the target platform and configure it via
|
||||
PKG_CONFIG_SYSROOT_DIR and PKG_CONFIG_PATH, or install a
|
||||
cross-compiling wrapper for pkg-config and set it via
|
||||
"pkg-config has not been configured to support cross-compilation.\n\
|
||||
\n\
|
||||
Install a sysroot for the target platform and configure it via\n\
|
||||
PKG_CONFIG_SYSROOT_DIR and PKG_CONFIG_PATH, or install a\n\
|
||||
cross-compiling wrapper for pkg-config and set it via\n\
|
||||
PKG_CONFIG environment variable.",
|
||||
),
|
||||
Error::Command {
|
||||
ref command,
|
||||
ref cause,
|
||||
} => write!(f, "Failed to run `{}`: {}", command, cause),
|
||||
} => {
|
||||
match cause.kind() {
|
||||
io::ErrorKind::NotFound => {
|
||||
let crate_name =
|
||||
std::env::var("CARGO_PKG_NAME").unwrap_or_else(|_| "sys".to_owned());
|
||||
let instructions = if cfg!(target_os = "macos") || cfg!(target_os = "ios") {
|
||||
"Try `brew install pkg-config` if you have Homebrew.\n"
|
||||
} else if cfg!(unix) {
|
||||
"Try `apt install pkg-config`, or `yum install pkg-config`,\n\
|
||||
or `pkg install pkg-config` depending on your distribution.\n"
|
||||
} else {
|
||||
"" // There's no easy fix for Windows users
|
||||
};
|
||||
write!(f, "Could not run `{command}`\n\
|
||||
The pkg-config command could not be found.\n\
|
||||
\n\
|
||||
Most likely, you need to install a pkg-config package for your OS.\n\
|
||||
{instructions}\
|
||||
\n\
|
||||
If you've already installed it, ensure the pkg-config command is one of the\n\
|
||||
directories in the PATH environment variable.\n\
|
||||
\n\
|
||||
If you did not expect this build to link to a pre-installed system library,\n\
|
||||
then check documentation of the {crate_name} crate for an option to\n\
|
||||
build the library from source, or disable features or dependencies\n\
|
||||
that require pkg-config.", command = command, instructions = instructions, crate_name = crate_name)
|
||||
}
|
||||
_ => write!(f, "Failed to run command `{}`, because: {}", command, cause),
|
||||
}
|
||||
}
|
||||
Error::ProbeFailure {
|
||||
ref name,
|
||||
ref command,
|
||||
ref output,
|
||||
} => {
|
||||
write!(
|
||||
f,
|
||||
"`{}` did not exit successfully: {}\nerror: could not find system library '{}' required by the '{}' crate\n",
|
||||
command, output.status, name, env::var("CARGO_PKG_NAME").unwrap_or_default(),
|
||||
)?;
|
||||
format_output(output, f)
|
||||
}
|
||||
Error::Failure {
|
||||
ref command,
|
||||
ref output,
|
||||
} => {
|
||||
let stdout = str::from_utf8(&output.stdout).unwrap();
|
||||
let stderr = str::from_utf8(&output.stderr).unwrap();
|
||||
write!(
|
||||
f,
|
||||
"`{}` did not exit successfully: {}",
|
||||
command, output.status
|
||||
)?;
|
||||
if !stdout.is_empty() {
|
||||
write!(f, "\n--- stdout\n{}", stdout)?;
|
||||
}
|
||||
if !stderr.is_empty() {
|
||||
write!(f, "\n--- stderr\n{}", stderr)?;
|
||||
}
|
||||
Ok(())
|
||||
format_output(output, f)
|
||||
}
|
||||
Error::__Nonexhaustive => panic!(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn format_output(output: &Output, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
let stdout = String::from_utf8_lossy(&output.stdout);
|
||||
if !stdout.is_empty() {
|
||||
write!(f, "\n--- stdout\n{}", stdout)?;
|
||||
}
|
||||
let stderr = String::from_utf8_lossy(&output.stderr);
|
||||
if !stderr.is_empty() {
|
||||
write!(f, "\n--- stderr\n{}", stderr)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Deprecated in favor of the probe_library function
|
||||
#[doc(hidden)]
|
||||
pub fn find_library(name: &str) -> Result<Library, String> {
|
||||
@ -318,7 +378,14 @@ impl Config {
|
||||
|
||||
let mut library = Library::new();
|
||||
|
||||
let output = run(self.command(name, &["--libs", "--cflags"]))?;
|
||||
let output = run(self.command(name, &["--libs", "--cflags"])).map_err(|e| match e {
|
||||
Error::Failure { command, output } => Error::ProbeFailure {
|
||||
name: name.to_owned(),
|
||||
command,
|
||||
output,
|
||||
},
|
||||
other => other,
|
||||
})?;
|
||||
library.parse_libs_cflags(name, &output, self);
|
||||
|
||||
let output = run(self.command(name, &["--modversion"]))?;
|
||||
@ -394,7 +461,7 @@ impl Config {
|
||||
|
||||
fn command(&self, name: &str, args: &[&str]) -> Command {
|
||||
let exe = self
|
||||
.env_var_os("PKG_CONFIG")
|
||||
.targetted_env_var("PKG_CONFIG")
|
||||
.unwrap_or_else(|| OsString::from("pkg-config"));
|
||||
let mut cmd = Command::new(exe);
|
||||
if self.is_static(name) {
|
||||
@ -677,23 +744,25 @@ fn split_flags(output: &[u8]) -> Vec<String> {
|
||||
#[test]
|
||||
#[cfg(target_os = "macos")]
|
||||
fn system_library_mac_test() {
|
||||
use std::path::Path;
|
||||
|
||||
let system_roots = vec![PathBuf::from("/Library"), PathBuf::from("/System")];
|
||||
|
||||
assert!(!is_static_available(
|
||||
"PluginManager",
|
||||
system_roots,
|
||||
&system_roots,
|
||||
&[PathBuf::from("/Library/Frameworks")]
|
||||
));
|
||||
assert!(!is_static_available(
|
||||
"python2.7",
|
||||
system_roots,
|
||||
&system_roots,
|
||||
&[PathBuf::from(
|
||||
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config"
|
||||
)]
|
||||
));
|
||||
assert!(!is_static_available(
|
||||
"ffi_convenience",
|
||||
system_roots,
|
||||
&system_roots,
|
||||
&[PathBuf::from(
|
||||
"/Library/Ruby/Gems/2.0.0/gems/ffi-1.9.10/ext/ffi_c/libffi-x86_64/.libs"
|
||||
)]
|
||||
@ -703,7 +772,7 @@ fn system_library_mac_test() {
|
||||
if Path::new("/usr/local/lib/libpng16.a").exists() {
|
||||
assert!(is_static_available(
|
||||
"png16",
|
||||
system_roots,
|
||||
&system_roots,
|
||||
&[PathBuf::from("/usr/local/lib")]
|
||||
));
|
||||
|
||||
|
@ -1 +1 @@
|
||||
{"files":{"Cargo.toml":"5d9b7092f252e3a6f7f50f6aeb1b873803b322cf5edbf0ae07e0a27d57df3fbf","LICENSE-APACHE":"0218327e7a480793ffdd4eb792379a9709e5c135c7ba267f709d6f6d4d70af0a","LICENSE-MIT":"4cada0bd02ea3692eee6f16400d86c6508bbd3bafb2b65fed0419f36d4f83e8f","src/generic.rs":"6f38250421846499c816c222d0b48155bfab09a9921e6c400d7b75567ab98f14","src/lib.rs":"bcf308d7037e259d6640a785556fcdb86653cb4f72f64fbfeda9899857c14479","src/soft.rs":"5cdee0e46c99a9d5078c0b3a733fe6fd1430ed0a888ef747bc2a1271265a1140","src/types.rs":"a354d2e3267c7c451a1420903314a358328346772ca964fa6c1ef7b96c983930","src/x86_64/mod.rs":"4d5a1da816f8e59bb385464f005075de889d1060e24dcee6709b321a3d6c92f7","src/x86_64/sse2.rs":"a9df3e7b3b8ffcd249a2cbed0e538042f7747dfa6ae7af0c9af364dc5a12d409"},"package":"ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857"}
|
||||
{"files":{"Cargo.toml":"a3b4c03b3b8faad8965a6177b8d10d005aaf72dba4e0460f7e4602da15f63bc2","LICENSE-APACHE":"0218327e7a480793ffdd4eb792379a9709e5c135c7ba267f709d6f6d4d70af0a","LICENSE-MIT":"4cada0bd02ea3692eee6f16400d86c6508bbd3bafb2b65fed0419f36d4f83e8f","src/generic.rs":"3fcf342f83e6410abb7be6b2e8cf7e0673c872d53ace794eaabd12929489beea","src/lib.rs":"bcf308d7037e259d6640a785556fcdb86653cb4f72f64fbfeda9899857c14479","src/soft.rs":"4cc23fa9451ea44a4e3c492c66627dae6008746aab6d5290712ecc66846f2ea0","src/types.rs":"d51ea12b78b771ce3823b4fd23b1df125f4719d2e3ac63c842813b0cfc6cdb8b","src/x86_64/mod.rs":"e868eab93b96df599667c6e5de0f253946aed691bc39ee4c4f8ed72a758105d9","src/x86_64/sse2.rs":"5d958d134fcb0a4a264aadc51abddc24baeeaef41ae9b36bd49d6ab8dcff5d2c"},"package":"ed0cfbc8191465bed66e1718596ee0b0b35d5ee1f41c5df2189d0fe8bde535ba"}
|
11
third_party/rust/ppv-lite86/Cargo.toml
vendored
11
third_party/rust/ppv-lite86/Cargo.toml
vendored
@ -3,17 +3,16 @@
|
||||
# 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
|
||||
# to registry (e.g., crates.io) dependencies.
|
||||
#
|
||||
# If you believe there's an error in this file please file an
|
||||
# issue against the rust-lang/cargo repository. If you're
|
||||
# editing this file be aware that the upstream Cargo.toml
|
||||
# will likely look very different (and much more reasonable)
|
||||
# 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 = "ppv-lite86"
|
||||
version = "0.2.10"
|
||||
version = "0.2.15"
|
||||
authors = ["The CryptoCorrosion Contributors"]
|
||||
description = "Implementation of the crypto-simd API for x86"
|
||||
keywords = ["crypto", "simd", "x86"]
|
||||
|
114
third_party/rust/ppv-lite86/src/generic.rs
vendored
114
third_party/rust/ppv-lite86/src/generic.rs
vendored
@ -11,38 +11,38 @@ pub union vec128_storage {
|
||||
q: [u64; 2],
|
||||
}
|
||||
impl From<[u32; 4]> for vec128_storage {
|
||||
#[inline]
|
||||
#[inline(always)]
|
||||
fn from(d: [u32; 4]) -> Self {
|
||||
Self { d }
|
||||
}
|
||||
}
|
||||
impl From<vec128_storage> for [u32; 4] {
|
||||
#[inline]
|
||||
#[inline(always)]
|
||||
fn from(d: vec128_storage) -> Self {
|
||||
unsafe { d.d }
|
||||
}
|
||||
}
|
||||
impl From<[u64; 2]> for vec128_storage {
|
||||
#[inline]
|
||||
#[inline(always)]
|
||||
fn from(q: [u64; 2]) -> Self {
|
||||
Self { q }
|
||||
}
|
||||
}
|
||||
impl From<vec128_storage> for [u64; 2] {
|
||||
#[inline]
|
||||
#[inline(always)]
|
||||
fn from(q: vec128_storage) -> Self {
|
||||
unsafe { q.q }
|
||||
}
|
||||
}
|
||||
impl Default for vec128_storage {
|
||||
#[inline]
|
||||
#[inline(always)]
|
||||
fn default() -> Self {
|
||||
Self { q: [0, 0] }
|
||||
}
|
||||
}
|
||||
impl Eq for vec128_storage {}
|
||||
impl PartialEq<vec128_storage> for vec128_storage {
|
||||
#[inline]
|
||||
#[inline(always)]
|
||||
fn eq(&self, rhs: &Self) -> bool {
|
||||
unsafe { self.q == rhs.q }
|
||||
}
|
||||
@ -62,7 +62,7 @@ impl vec256_storage {
|
||||
}
|
||||
}
|
||||
impl From<vec256_storage> for [u64; 4] {
|
||||
#[inline]
|
||||
#[inline(always)]
|
||||
fn from(q: vec256_storage) -> Self {
|
||||
let [a, b]: [u64; 2] = q.v128[0].into();
|
||||
let [c, d]: [u64; 2] = q.v128[1].into();
|
||||
@ -84,6 +84,7 @@ impl vec512_storage {
|
||||
}
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn dmap<T, F>(t: T, f: F) -> T
|
||||
where
|
||||
T: Store<vec128_storage> + Into<vec128_storage>,
|
||||
@ -117,6 +118,7 @@ where
|
||||
unsafe { T::unpack(d) }
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn qmap<T, F>(t: T, f: F) -> T
|
||||
where
|
||||
T: Store<vec128_storage> + Into<vec128_storage>,
|
||||
@ -130,6 +132,7 @@ where
|
||||
unsafe { T::unpack(q) }
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn qmap2<T, F>(a: T, b: T, f: F) -> T
|
||||
where
|
||||
T: Store<vec128_storage> + Into<vec128_storage>,
|
||||
@ -145,14 +148,17 @@ where
|
||||
unsafe { T::unpack(q) }
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn o_of_q(q: [u64; 2]) -> u128 {
|
||||
u128::from(q[0]) | (u128::from(q[1]) << 64)
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn q_of_o(o: u128) -> [u64; 2] {
|
||||
[o as u64, (o >> 64) as u64]
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn omap<T, F>(a: T, f: F) -> T
|
||||
where
|
||||
T: Store<vec128_storage> + Into<vec128_storage>,
|
||||
@ -164,6 +170,7 @@ where
|
||||
unsafe { T::unpack(o) }
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn omap2<T, F>(a: T, b: T, f: F) -> T
|
||||
where
|
||||
T: Store<vec128_storage> + Into<vec128_storage>,
|
||||
@ -247,39 +254,39 @@ macro_rules! impl_bitops {
|
||||
}
|
||||
|
||||
impl Swap64 for $vec {
|
||||
#[inline]
|
||||
#[inline(always)]
|
||||
fn swap1(self) -> Self {
|
||||
qmap(self, |x| {
|
||||
((x & 0x5555555555555555) << 1) | ((x & 0xaaaaaaaaaaaaaaaa) >> 1)
|
||||
})
|
||||
}
|
||||
#[inline]
|
||||
#[inline(always)]
|
||||
fn swap2(self) -> Self {
|
||||
qmap(self, |x| {
|
||||
((x & 0x3333333333333333) << 2) | ((x & 0xcccccccccccccccc) >> 2)
|
||||
})
|
||||
}
|
||||
#[inline]
|
||||
#[inline(always)]
|
||||
fn swap4(self) -> Self {
|
||||
qmap(self, |x| {
|
||||
((x & 0x0f0f0f0f0f0f0f0f) << 4) | ((x & 0xf0f0f0f0f0f0f0f0) >> 4)
|
||||
})
|
||||
}
|
||||
#[inline]
|
||||
#[inline(always)]
|
||||
fn swap8(self) -> Self {
|
||||
qmap(self, |x| {
|
||||
((x & 0x00ff00ff00ff00ff) << 8) | ((x & 0xff00ff00ff00ff00) >> 8)
|
||||
})
|
||||
}
|
||||
#[inline]
|
||||
#[inline(always)]
|
||||
fn swap16(self) -> Self {
|
||||
dmap(self, |x| x.rotate_left(16))
|
||||
}
|
||||
#[inline]
|
||||
#[inline(always)]
|
||||
fn swap32(self) -> Self {
|
||||
qmap(self, |x| x.rotate_left(32))
|
||||
}
|
||||
#[inline]
|
||||
#[inline(always)]
|
||||
fn swap64(self) -> Self {
|
||||
omap(self, |x| (x << 64) | (x >> 64))
|
||||
}
|
||||
@ -291,82 +298,83 @@ impl_bitops!(u64x2_generic);
|
||||
impl_bitops!(u128x1_generic);
|
||||
|
||||
impl RotateEachWord32 for u32x4_generic {
|
||||
#[inline]
|
||||
#[inline(always)]
|
||||
fn rotate_each_word_right7(self) -> Self {
|
||||
dmap(self, |x| x.rotate_right(7))
|
||||
}
|
||||
#[inline]
|
||||
#[inline(always)]
|
||||
fn rotate_each_word_right8(self) -> Self {
|
||||
dmap(self, |x| x.rotate_right(8))
|
||||
}
|
||||
#[inline]
|
||||
#[inline(always)]
|
||||
fn rotate_each_word_right11(self) -> Self {
|
||||
dmap(self, |x| x.rotate_right(11))
|
||||
}
|
||||
#[inline]
|
||||
#[inline(always)]
|
||||
fn rotate_each_word_right12(self) -> Self {
|
||||
dmap(self, |x| x.rotate_right(12))
|
||||
}
|
||||
#[inline]
|
||||
#[inline(always)]
|
||||
fn rotate_each_word_right16(self) -> Self {
|
||||
dmap(self, |x| x.rotate_right(16))
|
||||
}
|
||||
#[inline]
|
||||
#[inline(always)]
|
||||
fn rotate_each_word_right20(self) -> Self {
|
||||
dmap(self, |x| x.rotate_right(20))
|
||||
}
|
||||
#[inline]
|
||||
#[inline(always)]
|
||||
fn rotate_each_word_right24(self) -> Self {
|
||||
dmap(self, |x| x.rotate_right(24))
|
||||
}
|
||||
#[inline]
|
||||
#[inline(always)]
|
||||
fn rotate_each_word_right25(self) -> Self {
|
||||
dmap(self, |x| x.rotate_right(25))
|
||||
}
|
||||
}
|
||||
|
||||
impl RotateEachWord32 for u64x2_generic {
|
||||
#[inline]
|
||||
#[inline(always)]
|
||||
fn rotate_each_word_right7(self) -> Self {
|
||||
qmap(self, |x| x.rotate_right(7))
|
||||
}
|
||||
#[inline]
|
||||
#[inline(always)]
|
||||
fn rotate_each_word_right8(self) -> Self {
|
||||
qmap(self, |x| x.rotate_right(8))
|
||||
}
|
||||
#[inline]
|
||||
#[inline(always)]
|
||||
fn rotate_each_word_right11(self) -> Self {
|
||||
qmap(self, |x| x.rotate_right(11))
|
||||
}
|
||||
#[inline]
|
||||
#[inline(always)]
|
||||
fn rotate_each_word_right12(self) -> Self {
|
||||
qmap(self, |x| x.rotate_right(12))
|
||||
}
|
||||
#[inline]
|
||||
#[inline(always)]
|
||||
fn rotate_each_word_right16(self) -> Self {
|
||||
qmap(self, |x| x.rotate_right(16))
|
||||
}
|
||||
#[inline]
|
||||
#[inline(always)]
|
||||
fn rotate_each_word_right20(self) -> Self {
|
||||
qmap(self, |x| x.rotate_right(20))
|
||||
}
|
||||
#[inline]
|
||||
#[inline(always)]
|
||||
fn rotate_each_word_right24(self) -> Self {
|
||||
qmap(self, |x| x.rotate_right(24))
|
||||
}
|
||||
#[inline]
|
||||
#[inline(always)]
|
||||
fn rotate_each_word_right25(self) -> Self {
|
||||
qmap(self, |x| x.rotate_right(25))
|
||||
}
|
||||
}
|
||||
impl RotateEachWord64 for u64x2_generic {
|
||||
#[inline]
|
||||
#[inline(always)]
|
||||
fn rotate_each_word_right32(self) -> Self {
|
||||
qmap(self, |x| x.rotate_right(32))
|
||||
}
|
||||
}
|
||||
|
||||
// workaround for koute/cargo-web#52 (u128::rotate_* broken with cargo web)
|
||||
#[inline(always)]
|
||||
fn rotate_u128_right(x: u128, i: u32) -> u128 {
|
||||
(x >> i) | (x << (128 - i))
|
||||
}
|
||||
@ -377,41 +385,41 @@ fn test_rotate_u128() {
|
||||
}
|
||||
|
||||
impl RotateEachWord32 for u128x1_generic {
|
||||
#[inline]
|
||||
#[inline(always)]
|
||||
fn rotate_each_word_right7(self) -> Self {
|
||||
Self([rotate_u128_right(self.0[0], 7)])
|
||||
}
|
||||
#[inline]
|
||||
#[inline(always)]
|
||||
fn rotate_each_word_right8(self) -> Self {
|
||||
Self([rotate_u128_right(self.0[0], 8)])
|
||||
}
|
||||
#[inline]
|
||||
#[inline(always)]
|
||||
fn rotate_each_word_right11(self) -> Self {
|
||||
Self([rotate_u128_right(self.0[0], 11)])
|
||||
}
|
||||
#[inline]
|
||||
#[inline(always)]
|
||||
fn rotate_each_word_right12(self) -> Self {
|
||||
Self([rotate_u128_right(self.0[0], 12)])
|
||||
}
|
||||
#[inline]
|
||||
#[inline(always)]
|
||||
fn rotate_each_word_right16(self) -> Self {
|
||||
Self([rotate_u128_right(self.0[0], 16)])
|
||||
}
|
||||
#[inline]
|
||||
#[inline(always)]
|
||||
fn rotate_each_word_right20(self) -> Self {
|
||||
Self([rotate_u128_right(self.0[0], 20)])
|
||||
}
|
||||
#[inline]
|
||||
#[inline(always)]
|
||||
fn rotate_each_word_right24(self) -> Self {
|
||||
Self([rotate_u128_right(self.0[0], 24)])
|
||||
}
|
||||
#[inline]
|
||||
#[inline(always)]
|
||||
fn rotate_each_word_right25(self) -> Self {
|
||||
Self([rotate_u128_right(self.0[0], 25)])
|
||||
}
|
||||
}
|
||||
impl RotateEachWord64 for u128x1_generic {
|
||||
#[inline]
|
||||
#[inline(always)]
|
||||
fn rotate_each_word_right32(self) -> Self {
|
||||
Self([rotate_u128_right(self.0[0], 32)])
|
||||
}
|
||||
@ -430,7 +438,7 @@ impl Machine for GenericMachine {
|
||||
type u32x4x4 = u32x4x4_generic;
|
||||
type u64x2x4 = u64x2x4_generic;
|
||||
type u128x4 = u128x4_generic;
|
||||
#[inline]
|
||||
#[inline(always)]
|
||||
unsafe fn instance() -> Self {
|
||||
Self
|
||||
}
|
||||
@ -607,6 +615,22 @@ pub type u32x4x4_generic = x4<u32x4_generic>;
|
||||
pub type u64x2x4_generic = x4<u64x2_generic>;
|
||||
pub type u128x4_generic = x4<u128x1_generic>;
|
||||
|
||||
impl Vector<[u32; 16]> for u32x4x4_generic {
|
||||
fn to_scalars(self) -> [u32; 16] {
|
||||
let [a, b, c, d] = self.0;
|
||||
let a = a.0;
|
||||
let b = b.0;
|
||||
let c = c.0;
|
||||
let d = d.0;
|
||||
[
|
||||
a[0], a[1], a[2], a[3],
|
||||
b[0], b[1], b[2], b[3],
|
||||
c[0], c[1], c[2], c[3],
|
||||
d[0], d[1], d[2], d[3],
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
impl MultiLane<[u32; 4]> for u32x4_generic {
|
||||
#[inline(always)]
|
||||
fn to_lanes(self) -> [u32; 4] {
|
||||
@ -747,7 +771,7 @@ impl u128x4<GenericMachine> for u128x4_generic {}
|
||||
#[macro_export]
|
||||
macro_rules! dispatch {
|
||||
($mach:ident, $MTy:ident, { $([$pub:tt$(($krate:tt))*])* fn $name:ident($($arg:ident: $argty:ty),* $(,)*) -> $ret:ty $body:block }) => {
|
||||
#[inline]
|
||||
#[inline(always)]
|
||||
$($pub$(($krate))*)* fn $name($($arg: $argty),*) -> $ret {
|
||||
let $mach = unsafe { $crate::generic::GenericMachine::instance() };
|
||||
#[inline(always)]
|
||||
@ -764,7 +788,7 @@ macro_rules! dispatch {
|
||||
#[macro_export]
|
||||
macro_rules! dispatch_light128 {
|
||||
($mach:ident, $MTy:ident, { $([$pub:tt$(($krate:tt))*])* fn $name:ident($($arg:ident: $argty:ty),* $(,)*) -> $ret:ty $body:block }) => {
|
||||
#[inline]
|
||||
#[inline(always)]
|
||||
$($pub$(($krate))*)* fn $name($($arg: $argty),*) -> $ret {
|
||||
let $mach = unsafe { $crate::generic::GenericMachine::instance() };
|
||||
#[inline(always)]
|
||||
@ -781,7 +805,7 @@ macro_rules! dispatch_light128 {
|
||||
#[macro_export]
|
||||
macro_rules! dispatch_light256 {
|
||||
($mach:ident, $MTy:ident, { $([$pub:tt$(($krate:tt))*])* fn $name:ident($($arg:ident: $argty:ty),* $(,)*) -> $ret:ty $body:block }) => {
|
||||
#[inline]
|
||||
#[inline(always)]
|
||||
$($pub$(($krate))*)* fn $name($($arg: $argty),*) -> $ret {
|
||||
let $mach = unsafe { $crate::generic::GenericMachine::instance() };
|
||||
#[inline(always)]
|
||||
@ -798,7 +822,7 @@ macro_rules! dispatch_light256 {
|
||||
#[macro_export]
|
||||
macro_rules! dispatch_light512 {
|
||||
($mach:ident, $MTy:ident, { $([$pub:tt$(($krate:tt))*])* fn $name:ident($($arg:ident: $argty:ty),* $(,)*) -> $ret:ty $body:block }) => {
|
||||
#[inline]
|
||||
#[inline(always)]
|
||||
$($pub$(($krate))*)* fn $name($($arg: $argty),*) -> $ret {
|
||||
let $mach = unsafe { $crate::generic::GenericMachine::instance() };
|
||||
#[inline(always)]
|
||||
|
78
third_party/rust/ppv-lite86/src/soft.rs
vendored
78
third_party/rust/ppv-lite86/src/soft.rs
vendored
@ -175,26 +175,50 @@ impl<W: BSwap + Copy, G> BSwap for x2<W, G> {
|
||||
impl<W: StoreBytes + BSwap + Copy, G> StoreBytes for x2<W, G> {
|
||||
#[inline(always)]
|
||||
unsafe fn unsafe_read_le(input: &[u8]) -> Self {
|
||||
let input = input.split_at(16);
|
||||
let input = input.split_at(input.len() / 2);
|
||||
x2::new([W::unsafe_read_le(input.0), W::unsafe_read_le(input.1)])
|
||||
}
|
||||
#[inline(always)]
|
||||
unsafe fn unsafe_read_be(input: &[u8]) -> Self {
|
||||
x2::unsafe_read_le(input).bswap()
|
||||
let input = input.split_at(input.len() / 2);
|
||||
x2::new([W::unsafe_read_be(input.0), W::unsafe_read_be(input.1)])
|
||||
}
|
||||
#[inline(always)]
|
||||
fn write_le(self, out: &mut [u8]) {
|
||||
let out = out.split_at_mut(16);
|
||||
let out = out.split_at_mut(out.len() / 2);
|
||||
self.0[0].write_le(out.0);
|
||||
self.0[1].write_le(out.1);
|
||||
}
|
||||
#[inline(always)]
|
||||
fn write_be(self, out: &mut [u8]) {
|
||||
let out = out.split_at_mut(16);
|
||||
let out = out.split_at_mut(out.len() / 2);
|
||||
self.0[0].write_be(out.0);
|
||||
self.0[1].write_be(out.1);
|
||||
}
|
||||
}
|
||||
impl<W: Copy + LaneWords4, G: Copy> LaneWords4 for x2<W, G> {
|
||||
#[inline(always)]
|
||||
fn shuffle_lane_words2301(self) -> Self {
|
||||
Self::new([
|
||||
self.0[0].shuffle_lane_words2301(),
|
||||
self.0[1].shuffle_lane_words2301(),
|
||||
])
|
||||
}
|
||||
#[inline(always)]
|
||||
fn shuffle_lane_words1230(self) -> Self {
|
||||
Self::new([
|
||||
self.0[0].shuffle_lane_words1230(),
|
||||
self.0[1].shuffle_lane_words1230(),
|
||||
])
|
||||
}
|
||||
#[inline(always)]
|
||||
fn shuffle_lane_words3012(self) -> Self {
|
||||
Self::new([
|
||||
self.0[0].shuffle_lane_words3012(),
|
||||
self.0[1].shuffle_lane_words3012(),
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Default)]
|
||||
#[allow(non_camel_case_types)]
|
||||
@ -310,6 +334,17 @@ impl<W: Copy> Vec4<W> for x4<W> {
|
||||
self
|
||||
}
|
||||
}
|
||||
impl<W: Copy> Vec4Ext<W> for x4<W> {
|
||||
#[inline(always)]
|
||||
fn transpose4(a: Self, b: Self, c: Self, d: Self) -> (Self, Self, Self, Self) where Self: Sized {
|
||||
(
|
||||
x4([a.0[0], b.0[0], c.0[0], d.0[0]]),
|
||||
x4([a.0[1], b.0[1], c.0[1], d.0[1]]),
|
||||
x4([a.0[2], b.0[2], c.0[2], d.0[2]]),
|
||||
x4([a.0[3], b.0[3], c.0[3], d.0[3]])
|
||||
)
|
||||
}
|
||||
}
|
||||
impl<W: Copy + Store<vec128_storage>> Store<vec512_storage> for x4<W> {
|
||||
#[inline(always)]
|
||||
unsafe fn unpack(p: vec512_storage) -> Self {
|
||||
@ -368,30 +403,39 @@ impl<W: BSwap + Copy> BSwap for x4<W> {
|
||||
impl<W: StoreBytes + BSwap + Copy> StoreBytes for x4<W> {
|
||||
#[inline(always)]
|
||||
unsafe fn unsafe_read_le(input: &[u8]) -> Self {
|
||||
let n = input.len() / 4;
|
||||
x4([
|
||||
W::unsafe_read_le(&input[0..16]),
|
||||
W::unsafe_read_le(&input[16..32]),
|
||||
W::unsafe_read_le(&input[32..48]),
|
||||
W::unsafe_read_le(&input[48..64]),
|
||||
W::unsafe_read_le(&input[..n]),
|
||||
W::unsafe_read_le(&input[n..n * 2]),
|
||||
W::unsafe_read_le(&input[n * 2..n * 3]),
|
||||
W::unsafe_read_le(&input[n * 3..]),
|
||||
])
|
||||
}
|
||||
#[inline(always)]
|
||||
unsafe fn unsafe_read_be(input: &[u8]) -> Self {
|
||||
x4::unsafe_read_le(input).bswap()
|
||||
let n = input.len() / 4;
|
||||
x4([
|
||||
W::unsafe_read_be(&input[..n]),
|
||||
W::unsafe_read_be(&input[n..n * 2]),
|
||||
W::unsafe_read_be(&input[n * 2..n * 3]),
|
||||
W::unsafe_read_be(&input[n * 3..]),
|
||||
])
|
||||
}
|
||||
#[inline(always)]
|
||||
fn write_le(self, out: &mut [u8]) {
|
||||
self.0[0].write_le(&mut out[0..16]);
|
||||
self.0[1].write_le(&mut out[16..32]);
|
||||
self.0[2].write_le(&mut out[32..48]);
|
||||
self.0[3].write_le(&mut out[48..64]);
|
||||
let n = out.len() / 4;
|
||||
self.0[0].write_le(&mut out[..n]);
|
||||
self.0[1].write_le(&mut out[n..n * 2]);
|
||||
self.0[2].write_le(&mut out[n * 2..n * 3]);
|
||||
self.0[3].write_le(&mut out[n * 3..]);
|
||||
}
|
||||
#[inline(always)]
|
||||
fn write_be(self, out: &mut [u8]) {
|
||||
self.0[0].write_be(&mut out[0..16]);
|
||||
self.0[1].write_be(&mut out[16..32]);
|
||||
self.0[2].write_be(&mut out[32..48]);
|
||||
self.0[3].write_be(&mut out[48..64]);
|
||||
let n = out.len() / 4;
|
||||
self.0[0].write_be(&mut out[..n]);
|
||||
self.0[1].write_be(&mut out[n..n * 2]);
|
||||
self.0[2].write_be(&mut out[n * 2..n * 3]);
|
||||
self.0[3].write_be(&mut out[n * 3..]);
|
||||
}
|
||||
}
|
||||
impl<W: Copy + LaneWords4> LaneWords4 for x4<W> {
|
||||
|
13
third_party/rust/ppv-lite86/src/types.rs
vendored
13
third_party/rust/ppv-lite86/src/types.rs
vendored
@ -71,6 +71,15 @@ pub trait Vec4<W> {
|
||||
fn extract(self, i: u32) -> W;
|
||||
fn insert(self, w: W, i: u32) -> Self;
|
||||
}
|
||||
/// Vec4 functions which may not be implemented yet for all Vec4 types.
|
||||
/// NOTE: functions in this trait may be moved to Vec4 in any patch release. To avoid breakage,
|
||||
/// import Vec4Ext only together with Vec4, and don't qualify its methods.
|
||||
pub trait Vec4Ext<W> {
|
||||
fn transpose4(a: Self, b: Self, c: Self, d: Self) -> (Self, Self, Self, Self) where Self: Sized;
|
||||
}
|
||||
pub trait Vector<T> {
|
||||
fn to_scalars(self) -> T;
|
||||
}
|
||||
|
||||
// TODO: multiples of 4 should inherit this
|
||||
/// A vector composed of four words; depending on their size, operations may cross lanes.
|
||||
@ -132,6 +141,7 @@ pub trait u32x4x2<M: Machine>:
|
||||
+ MultiLane<[M::u32x4; 2]>
|
||||
+ ArithOps
|
||||
+ Into<vec256_storage>
|
||||
+ StoreBytes
|
||||
{
|
||||
}
|
||||
pub trait u64x2x2<M: Machine>:
|
||||
@ -169,10 +179,13 @@ pub trait u32x4x4<M: Machine>:
|
||||
BitOps32
|
||||
+ Store<vec512_storage>
|
||||
+ Vec4<M::u32x4>
|
||||
+ Vec4Ext<M::u32x4>
|
||||
+ Vector<[u32; 16]>
|
||||
+ MultiLane<[M::u32x4; 4]>
|
||||
+ ArithOps
|
||||
+ LaneWords4
|
||||
+ Into<vec512_storage>
|
||||
+ StoreBytes
|
||||
{
|
||||
}
|
||||
pub trait u64x2x4<M: Machine>:
|
||||
|
@ -79,7 +79,7 @@ where
|
||||
type u64x2 = sse2::u64x2_sse2<YesS3, YesS4, NI>;
|
||||
type u128x1 = sse2::u128x1_sse2<YesS3, YesS4, NI>;
|
||||
|
||||
type u32x4x2 = sse2::u32x4x2_sse2<YesS3, YesS4, NI>;
|
||||
type u32x4x2 = sse2::avx2::u32x4x2_avx2<NI>;
|
||||
type u64x2x2 = sse2::u64x2x2_sse2<YesS3, YesS4, NI>;
|
||||
type u64x4 = sse2::u64x4_sse2<YesS3, YesS4, NI>;
|
||||
type u128x2 = sse2::u128x2_sse2<YesS3, YesS4, NI>;
|
||||
@ -167,9 +167,11 @@ impl Default for vec256_storage {
|
||||
}
|
||||
}
|
||||
impl vec256_storage {
|
||||
#[inline(always)]
|
||||
pub fn new128(xs: [vec128_storage; 2]) -> Self {
|
||||
Self { sse2: xs }
|
||||
}
|
||||
#[inline(always)]
|
||||
pub fn split128(self) -> [vec128_storage; 2] {
|
||||
unsafe { self.sse2 }
|
||||
}
|
||||
@ -200,9 +202,11 @@ impl Default for vec512_storage {
|
||||
}
|
||||
}
|
||||
impl vec512_storage {
|
||||
#[inline(always)]
|
||||
pub fn new128(xs: [vec128_storage; 4]) -> Self {
|
||||
Self { sse2: xs }
|
||||
}
|
||||
#[inline(always)]
|
||||
pub fn split128(self) -> [vec128_storage; 4] {
|
||||
unsafe { self.sse2 }
|
||||
}
|
||||
|
318
third_party/rust/ppv-lite86/src/x86_64/sse2.rs
vendored
318
third_party/rust/ppv-lite86/src/x86_64/sse2.rs
vendored
@ -880,6 +880,15 @@ pub type u64x2x4_sse2<S3, S4, NI> = x4<u64x2_sse2<S3, S4, NI>>;
|
||||
#[allow(non_camel_case_types)]
|
||||
pub type u128x4_sse2<S3, S4, NI> = x4<u128x1_sse2<S3, S4, NI>>;
|
||||
|
||||
impl<S3, S4, NI> Vector<[u32; 16]> for u32x4x4_sse2<S3, S4, NI> {
|
||||
#[inline(always)]
|
||||
fn to_scalars(self) -> [u32; 16] {
|
||||
unsafe {
|
||||
core::mem::transmute(self)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<S3: Copy, S4: Copy, NI: Copy> u32x4x2<Machine86<S3, S4, NI>> for u32x4x2_sse2<S3, S4, NI>
|
||||
where
|
||||
u32x4_sse2<S3, S4, NI>: RotateEachWord32 + BSwap,
|
||||
@ -983,6 +992,8 @@ where
|
||||
Machine86<S3, S4, NI>: Machine,
|
||||
u32x4x4_sse2<S3, S4, NI>: MultiLane<[<Machine86<S3, S4, NI> as Machine>::u32x4; 4]>,
|
||||
u32x4x4_sse2<S3, S4, NI>: Vec4<<Machine86<S3, S4, NI> as Machine>::u32x4>,
|
||||
u32x4x4_sse2<S3, S4, NI>: Vec4Ext<<Machine86<S3, S4, NI> as Machine>::u32x4>,
|
||||
u32x4x4_sse2<S3, S4, NI>: Vector<[u32; 16]>,
|
||||
{
|
||||
}
|
||||
impl<S3: Copy, S4: Copy, NI: Copy> u64x2x4<Machine86<S3, S4, NI>> for u64x2x4_sse2<S3, S4, NI>
|
||||
@ -1004,14 +1015,6 @@ where
|
||||
{
|
||||
}
|
||||
|
||||
impl<NI: Copy> u32x4x4<Avx2Machine<NI>> for u32x4x4_sse2<YesS3, YesS4, NI>
|
||||
where
|
||||
u32x4_sse2<YesS3, YesS4, NI>: RotateEachWord32 + BSwap,
|
||||
Avx2Machine<NI>: Machine,
|
||||
u32x4x4_sse2<YesS3, YesS4, NI>: MultiLane<[<Avx2Machine<NI> as Machine>::u32x4; 4]>,
|
||||
u32x4x4_sse2<YesS3, YesS4, NI>: Vec4<<Avx2Machine<NI> as Machine>::u32x4>,
|
||||
{
|
||||
}
|
||||
impl<NI: Copy> u64x2x4<Avx2Machine<NI>> for u64x2x4_sse2<YesS3, YesS4, NI>
|
||||
where
|
||||
u64x2_sse2<YesS3, YesS4, NI>: RotateEachWord64 + RotateEachWord32 + BSwap,
|
||||
@ -1374,65 +1377,80 @@ mod test {
|
||||
|
||||
pub mod avx2 {
|
||||
#![allow(non_camel_case_types)]
|
||||
use crate::soft::x4;
|
||||
use crate::soft::{x2, x4};
|
||||
use crate::types::*;
|
||||
use crate::x86_64::sse2::{u128x1_sse2, u32x4_sse2};
|
||||
use crate::x86_64::sse2::{u128x1_sse2, u32x4_sse2, G0};
|
||||
use crate::x86_64::{vec256_storage, vec512_storage, Avx2Machine, YesS3, YesS4};
|
||||
use core::arch::x86_64::*;
|
||||
use core::marker::PhantomData;
|
||||
use core::ops::*;
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct u32x4x4_avx2<NI> {
|
||||
x: [__m256i; 2],
|
||||
pub struct u32x4x2_avx2<NI> {
|
||||
x: __m256i,
|
||||
ni: PhantomData<NI>,
|
||||
}
|
||||
|
||||
impl<NI> u32x4x4_avx2<NI> {
|
||||
impl<NI> u32x4x2_avx2<NI> {
|
||||
#[inline(always)]
|
||||
fn new(x: [__m256i; 2]) -> Self {
|
||||
fn new(x: __m256i) -> Self {
|
||||
Self { x, ni: PhantomData }
|
||||
}
|
||||
}
|
||||
|
||||
impl<NI> u32x4x4<Avx2Machine<NI>> for u32x4x4_avx2<NI> where NI: Copy {}
|
||||
impl<NI> Store<vec512_storage> for u32x4x4_avx2<NI> {
|
||||
impl<NI> u32x4x2<Avx2Machine<NI>> for u32x4x2_avx2<NI> where NI: Copy {}
|
||||
impl<NI> Store<vec256_storage> for u32x4x2_avx2<NI> {
|
||||
#[inline(always)]
|
||||
unsafe fn unpack(p: vec512_storage) -> Self {
|
||||
Self::new([p.avx[0].avx, p.avx[1].avx])
|
||||
unsafe fn unpack(p: vec256_storage) -> Self {
|
||||
Self::new(p.avx)
|
||||
}
|
||||
}
|
||||
impl<NI> MultiLane<[u32x4_sse2<YesS3, YesS4, NI>; 4]> for u32x4x4_avx2<NI> {
|
||||
impl<NI> StoreBytes for u32x4x2_avx2<NI> {
|
||||
#[inline(always)]
|
||||
fn to_lanes(self) -> [u32x4_sse2<YesS3, YesS4, NI>; 4] {
|
||||
unsafe fn unsafe_read_le(input: &[u8]) -> Self {
|
||||
assert_eq!(input.len(), 32);
|
||||
Self::new(_mm256_loadu_si256(input.as_ptr() as *const _))
|
||||
}
|
||||
#[inline(always)]
|
||||
unsafe fn unsafe_read_be(input: &[u8]) -> Self {
|
||||
Self::unsafe_read_le(input).bswap()
|
||||
}
|
||||
#[inline(always)]
|
||||
fn write_le(self, out: &mut [u8]) {
|
||||
unsafe {
|
||||
assert_eq!(out.len(), 32);
|
||||
_mm256_storeu_si256(out.as_mut_ptr() as *mut _, self.x)
|
||||
}
|
||||
}
|
||||
#[inline(always)]
|
||||
fn write_be(self, out: &mut [u8]) {
|
||||
self.bswap().write_le(out)
|
||||
}
|
||||
}
|
||||
impl<NI> MultiLane<[u32x4_sse2<YesS3, YesS4, NI>; 2]> for u32x4x2_avx2<NI> {
|
||||
#[inline(always)]
|
||||
fn to_lanes(self) -> [u32x4_sse2<YesS3, YesS4, NI>; 2] {
|
||||
unsafe {
|
||||
[
|
||||
u32x4_sse2::new(_mm256_extracti128_si256(self.x[0], 0)),
|
||||
u32x4_sse2::new(_mm256_extracti128_si256(self.x[0], 1)),
|
||||
u32x4_sse2::new(_mm256_extracti128_si256(self.x[1], 0)),
|
||||
u32x4_sse2::new(_mm256_extracti128_si256(self.x[1], 1)),
|
||||
u32x4_sse2::new(_mm256_extracti128_si256(self.x, 0)),
|
||||
u32x4_sse2::new(_mm256_extracti128_si256(self.x, 1)),
|
||||
]
|
||||
}
|
||||
}
|
||||
#[inline(always)]
|
||||
fn from_lanes(x: [u32x4_sse2<YesS3, YesS4, NI>; 4]) -> Self {
|
||||
fn from_lanes(x: [u32x4_sse2<YesS3, YesS4, NI>; 2]) -> Self {
|
||||
Self::new(unsafe {
|
||||
[
|
||||
_mm256_setr_m128i(x[0].x, x[1].x),
|
||||
_mm256_setr_m128i(x[2].x, x[3].x),
|
||||
]
|
||||
_mm256_setr_m128i(x[0].x, x[1].x)
|
||||
})
|
||||
}
|
||||
}
|
||||
impl<NI> Vec4<u32x4_sse2<YesS3, YesS4, NI>> for u32x4x4_avx2<NI> {
|
||||
impl<NI> Vec2<u32x4_sse2<YesS3, YesS4, NI>> for u32x4x2_avx2<NI> {
|
||||
#[inline(always)]
|
||||
fn extract(self, i: u32) -> u32x4_sse2<YesS3, YesS4, NI> {
|
||||
unsafe {
|
||||
match i {
|
||||
0 => u32x4_sse2::new(_mm256_extracti128_si256(self.x[0], 0)),
|
||||
1 => u32x4_sse2::new(_mm256_extracti128_si256(self.x[0], 1)),
|
||||
2 => u32x4_sse2::new(_mm256_extracti128_si256(self.x[1], 0)),
|
||||
3 => u32x4_sse2::new(_mm256_extracti128_si256(self.x[1], 1)),
|
||||
0 => u32x4_sse2::new(_mm256_extracti128_si256(self.x, 0)),
|
||||
1 => u32x4_sse2::new(_mm256_extracti128_si256(self.x, 1)),
|
||||
_ => panic!(),
|
||||
}
|
||||
}
|
||||
@ -1441,55 +1459,21 @@ pub mod avx2 {
|
||||
fn insert(self, w: u32x4_sse2<YesS3, YesS4, NI>, i: u32) -> Self {
|
||||
Self::new(unsafe {
|
||||
match i {
|
||||
0 => [_mm256_inserti128_si256(self.x[0], w.x, 0), self.x[1]],
|
||||
1 => [_mm256_inserti128_si256(self.x[0], w.x, 1), self.x[1]],
|
||||
2 => [self.x[0], _mm256_inserti128_si256(self.x[1], w.x, 0)],
|
||||
3 => [self.x[0], _mm256_inserti128_si256(self.x[1], w.x, 1)],
|
||||
0 => _mm256_inserti128_si256(self.x, w.x, 0),
|
||||
1 => _mm256_inserti128_si256(self.x, w.x, 1),
|
||||
_ => panic!(),
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
impl<NI> LaneWords4 for u32x4x4_avx2<NI> {
|
||||
#[inline(always)]
|
||||
fn shuffle_lane_words1230(self) -> Self {
|
||||
Self::new(unsafe {
|
||||
[
|
||||
_mm256_shuffle_epi32(self.x[0], 0b1001_0011),
|
||||
_mm256_shuffle_epi32(self.x[1], 0b1001_0011),
|
||||
]
|
||||
})
|
||||
}
|
||||
#[inline(always)]
|
||||
fn shuffle_lane_words2301(self) -> Self {
|
||||
Self::new(unsafe {
|
||||
[
|
||||
_mm256_shuffle_epi32(self.x[0], 0b0100_1110),
|
||||
_mm256_shuffle_epi32(self.x[1], 0b0100_1110),
|
||||
]
|
||||
})
|
||||
}
|
||||
#[inline(always)]
|
||||
fn shuffle_lane_words3012(self) -> Self {
|
||||
Self::new(unsafe {
|
||||
[
|
||||
_mm256_shuffle_epi32(self.x[0], 0b0011_1001),
|
||||
_mm256_shuffle_epi32(self.x[1], 0b0011_1001),
|
||||
]
|
||||
})
|
||||
}
|
||||
}
|
||||
impl<NI> BitOps32 for u32x4x4_avx2<NI> where NI: Copy {}
|
||||
impl<NI> ArithOps for u32x4x4_avx2<NI> where NI: Copy {}
|
||||
impl<NI> BitOps32 for u32x4x2_avx2<NI> where NI: Copy {}
|
||||
impl<NI> ArithOps for u32x4x2_avx2<NI> where NI: Copy {}
|
||||
macro_rules! shuf_lane_bytes {
|
||||
($name:ident, $k0:expr, $k1:expr) => {
|
||||
#[inline(always)]
|
||||
fn $name(self) -> Self {
|
||||
Self::new(unsafe {
|
||||
[
|
||||
_mm256_shuffle_epi8(self.x[0], _mm256_set_epi64x($k0, $k1, $k0, $k1)),
|
||||
_mm256_shuffle_epi8(self.x[1], _mm256_set_epi64x($k0, $k1, $k0, $k1)),
|
||||
]
|
||||
_mm256_shuffle_epi8(self.x, _mm256_set_epi64x($k0, $k1, $k0, $k1))
|
||||
})
|
||||
}
|
||||
};
|
||||
@ -1499,21 +1483,15 @@ pub mod avx2 {
|
||||
#[inline(always)]
|
||||
fn $name(self) -> Self {
|
||||
Self::new(unsafe {
|
||||
[
|
||||
_mm256_or_si256(
|
||||
_mm256_srli_epi32(self.x[0], $i as i32),
|
||||
_mm256_slli_epi32(self.x[0], 32 - $i as i32),
|
||||
),
|
||||
_mm256_or_si256(
|
||||
_mm256_srli_epi32(self.x[1], $i as i32),
|
||||
_mm256_slli_epi32(self.x[1], 32 - $i as i32),
|
||||
),
|
||||
]
|
||||
_mm256_or_si256(
|
||||
_mm256_srli_epi32(self.x, $i as i32),
|
||||
_mm256_slli_epi32(self.x, 32 - $i as i32),
|
||||
)
|
||||
})
|
||||
}
|
||||
};
|
||||
}
|
||||
impl<NI: Copy> RotateEachWord32 for u32x4x4_avx2<NI> {
|
||||
impl<NI: Copy> RotateEachWord32 for u32x4x2_avx2<NI> {
|
||||
rotr_32!(rotate_each_word_right7, 7);
|
||||
shuf_lane_bytes!(
|
||||
rotate_each_word_right8,
|
||||
@ -1535,15 +1513,12 @@ pub mod avx2 {
|
||||
);
|
||||
rotr_32!(rotate_each_word_right25, 25);
|
||||
}
|
||||
impl<NI> BitOps0 for u32x4x4_avx2<NI> where NI: Copy {}
|
||||
impl<NI> From<u32x4x4_avx2<NI>> for vec512_storage {
|
||||
impl<NI> BitOps0 for u32x4x2_avx2<NI> where NI: Copy {}
|
||||
impl<NI> From<u32x4x2_avx2<NI>> for vec256_storage {
|
||||
#[inline(always)]
|
||||
fn from(x: u32x4x4_avx2<NI>) -> Self {
|
||||
fn from(x: u32x4x2_avx2<NI>) -> Self {
|
||||
Self {
|
||||
avx: [
|
||||
vec256_storage { avx: x.x[0] },
|
||||
vec256_storage { avx: x.x[1] },
|
||||
],
|
||||
avx: x.x,
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1561,55 +1536,182 @@ pub mod avx2 {
|
||||
}
|
||||
};
|
||||
}
|
||||
impl_assign!(u32x4x4_avx2, BitXorAssign, bitxor_assign, bitxor);
|
||||
impl_assign!(u32x4x4_avx2, BitOrAssign, bitor_assign, bitor);
|
||||
impl_assign!(u32x4x4_avx2, BitAndAssign, bitand_assign, bitand);
|
||||
impl_assign!(u32x4x4_avx2, AddAssign, add_assign, add);
|
||||
impl_assign!(u32x4x2_avx2, BitXorAssign, bitxor_assign, bitxor);
|
||||
impl_assign!(u32x4x2_avx2, BitOrAssign, bitor_assign, bitor);
|
||||
impl_assign!(u32x4x2_avx2, BitAndAssign, bitand_assign, bitand);
|
||||
impl_assign!(u32x4x2_avx2, AddAssign, add_assign, add);
|
||||
|
||||
macro_rules! impl_bitop_x2 {
|
||||
macro_rules! impl_bitop {
|
||||
($vec:ident, $Op:ident, $op_fn:ident, $impl_fn:ident) => {
|
||||
impl<NI> $Op for $vec<NI> {
|
||||
type Output = Self;
|
||||
#[inline(always)]
|
||||
fn $op_fn(self, rhs: Self) -> Self::Output {
|
||||
Self::new(unsafe {
|
||||
[$impl_fn(self.x[0], rhs.x[0]), $impl_fn(self.x[1], rhs.x[1])]
|
||||
$impl_fn(self.x, rhs.x)
|
||||
})
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
impl_bitop_x2!(u32x4x4_avx2, BitXor, bitxor, _mm256_xor_si256);
|
||||
impl_bitop_x2!(u32x4x4_avx2, BitOr, bitor, _mm256_or_si256);
|
||||
impl_bitop_x2!(u32x4x4_avx2, BitAnd, bitand, _mm256_and_si256);
|
||||
impl_bitop_x2!(u32x4x4_avx2, AndNot, andnot, _mm256_andnot_si256);
|
||||
impl_bitop_x2!(u32x4x4_avx2, Add, add, _mm256_add_epi32);
|
||||
impl_bitop!(u32x4x2_avx2, BitXor, bitxor, _mm256_xor_si256);
|
||||
impl_bitop!(u32x4x2_avx2, BitOr, bitor, _mm256_or_si256);
|
||||
impl_bitop!(u32x4x2_avx2, BitAnd, bitand, _mm256_and_si256);
|
||||
impl_bitop!(u32x4x2_avx2, AndNot, andnot, _mm256_andnot_si256);
|
||||
impl_bitop!(u32x4x2_avx2, Add, add, _mm256_add_epi32);
|
||||
|
||||
impl<NI> Not for u32x4x4_avx2<NI> {
|
||||
impl<NI> Not for u32x4x2_avx2<NI> {
|
||||
type Output = Self;
|
||||
#[inline(always)]
|
||||
fn not(self) -> Self::Output {
|
||||
unsafe {
|
||||
let f = _mm256_set1_epi8(-0x7f);
|
||||
Self::new([f, f]) ^ self
|
||||
Self::new(f) ^ self
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<NI> BSwap for u32x4x4_avx2<NI> {
|
||||
impl<NI> BSwap for u32x4x2_avx2<NI> {
|
||||
shuf_lane_bytes!(bswap, 0x0c0d_0e0f_0809_0a0b, 0x0405_0607_0001_0203);
|
||||
}
|
||||
|
||||
impl<NI> From<x4<u128x1_sse2<YesS3, YesS4, NI>>> for u32x4x4_avx2<NI>
|
||||
impl<NI> From<x2<u128x1_sse2<YesS3, YesS4, NI>, G0>> for u32x4x2_avx2<NI>
|
||||
where
|
||||
NI: Copy,
|
||||
{
|
||||
#[inline(always)]
|
||||
fn from(x: x2<u128x1_sse2<YesS3, YesS4, NI>, G0>) -> Self {
|
||||
Self::new(unsafe {
|
||||
_mm256_setr_m128i(x.0[0].x, x.0[1].x)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl<NI> LaneWords4 for u32x4x2_avx2<NI> {
|
||||
#[inline(always)]
|
||||
fn shuffle_lane_words1230(self) -> Self {
|
||||
Self::new(unsafe {
|
||||
_mm256_shuffle_epi32(self.x, 0b1001_0011)
|
||||
})
|
||||
}
|
||||
#[inline(always)]
|
||||
fn shuffle_lane_words2301(self) -> Self {
|
||||
Self::new(unsafe {
|
||||
_mm256_shuffle_epi32(self.x, 0b0100_1110)
|
||||
})
|
||||
}
|
||||
#[inline(always)]
|
||||
fn shuffle_lane_words3012(self) -> Self {
|
||||
Self::new(unsafe {
|
||||
_mm256_shuffle_epi32(self.x, 0b0011_1001)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
pub type u32x4x4_avx2<NI> = x2<u32x4x2_avx2<NI>, G0>;
|
||||
impl<NI: Copy> u32x4x4<Avx2Machine<NI>> for u32x4x4_avx2<NI> {}
|
||||
|
||||
impl<NI: Copy> Store<vec512_storage> for u32x4x4_avx2<NI> {
|
||||
#[inline(always)]
|
||||
unsafe fn unpack(p: vec512_storage) -> Self {
|
||||
Self::new([u32x4x2_avx2::unpack(p.avx[0]), u32x4x2_avx2::unpack(p.avx[1])])
|
||||
}
|
||||
}
|
||||
impl<NI: Copy> MultiLane<[u32x4_sse2<YesS3, YesS4, NI>; 4]> for u32x4x4_avx2<NI> {
|
||||
#[inline(always)]
|
||||
fn to_lanes(self) -> [u32x4_sse2<YesS3, YesS4, NI>; 4] {
|
||||
let [a, b] = self.0[0].to_lanes();
|
||||
let [c, d] = self.0[1].to_lanes();
|
||||
[a, b, c, d]
|
||||
}
|
||||
#[inline(always)]
|
||||
fn from_lanes(x: [u32x4_sse2<YesS3, YesS4, NI>; 4]) -> Self {
|
||||
let ab = u32x4x2_avx2::from_lanes([x[0], x[1]]);
|
||||
let cd = u32x4x2_avx2::from_lanes([x[2], x[3]]);
|
||||
Self::new([ab, cd])
|
||||
}
|
||||
}
|
||||
impl<NI: Copy> Vec4<u32x4_sse2<YesS3, YesS4, NI>> for u32x4x4_avx2<NI> {
|
||||
#[inline(always)]
|
||||
fn extract(self, i: u32) -> u32x4_sse2<YesS3, YesS4, NI> {
|
||||
match i {
|
||||
0 => self.0[0].extract(0),
|
||||
1 => self.0[0].extract(1),
|
||||
2 => self.0[1].extract(0),
|
||||
3 => self.0[1].extract(1),
|
||||
_ => panic!(),
|
||||
}
|
||||
}
|
||||
#[inline(always)]
|
||||
fn insert(self, w: u32x4_sse2<YesS3, YesS4, NI>, i: u32) -> Self {
|
||||
Self::new(match i {
|
||||
0 | 1 => [self.0[0].insert(w, i), self.0[1]],
|
||||
2 | 3 => [self.0[0], self.0[1].insert(w, i - 2)],
|
||||
_ => panic!(),
|
||||
})
|
||||
}
|
||||
}
|
||||
impl<NI: Copy> Vec4Ext<u32x4_sse2<YesS3, YesS4, NI>> for u32x4x4_avx2<NI> {
|
||||
#[inline(always)]
|
||||
fn transpose4(a: Self, b: Self, c: Self, d: Self) -> (Self, Self, Self, Self) {
|
||||
/*
|
||||
* a00:a01 a10:a11
|
||||
* b00:b01 b10:b11
|
||||
* c00:c01 c10:c11
|
||||
* d00:d01 d10:d11
|
||||
* =>
|
||||
* a00:b00 c00:d00
|
||||
* a01:b01 c01:d01
|
||||
* a10:b10 c10:d10
|
||||
* a11:b11 c11:d11
|
||||
*/
|
||||
unsafe {
|
||||
let ab00 = u32x4x2_avx2::new(_mm256_permute2x128_si256(a.0[0].x, b.0[0].x, 0x20));
|
||||
let ab01 = u32x4x2_avx2::new(_mm256_permute2x128_si256(a.0[0].x, b.0[0].x, 0x31));
|
||||
let ab10 = u32x4x2_avx2::new(_mm256_permute2x128_si256(a.0[1].x, b.0[1].x, 0x20));
|
||||
let ab11 = u32x4x2_avx2::new(_mm256_permute2x128_si256(a.0[1].x, b.0[1].x, 0x31));
|
||||
let cd00 = u32x4x2_avx2::new(_mm256_permute2x128_si256(c.0[0].x, d.0[0].x, 0x20));
|
||||
let cd01 = u32x4x2_avx2::new(_mm256_permute2x128_si256(c.0[0].x, d.0[0].x, 0x31));
|
||||
let cd10 = u32x4x2_avx2::new(_mm256_permute2x128_si256(c.0[1].x, d.0[1].x, 0x20));
|
||||
let cd11 = u32x4x2_avx2::new(_mm256_permute2x128_si256(c.0[1].x, d.0[1].x, 0x31));
|
||||
(
|
||||
Self::new([ab00, cd00]),
|
||||
Self::new([ab01, cd01]),
|
||||
Self::new([ab10, cd10]),
|
||||
Self::new([ab11, cd11]),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
impl<NI: Copy> Vector<[u32; 16]> for u32x4x4_avx2<NI> {
|
||||
#[inline(always)]
|
||||
fn to_scalars(self) -> [u32; 16] {
|
||||
unsafe {
|
||||
core::mem::transmute(self)
|
||||
}
|
||||
}
|
||||
}
|
||||
impl<NI: Copy> From<u32x4x4_avx2<NI>> for vec512_storage {
|
||||
#[inline(always)]
|
||||
fn from(x: u32x4x4_avx2<NI>) -> Self {
|
||||
Self {
|
||||
avx: [
|
||||
vec256_storage { avx: x.0[0].x },
|
||||
vec256_storage { avx: x.0[1].x },
|
||||
],
|
||||
}
|
||||
}
|
||||
}
|
||||
impl<NI: Copy> From<x4<u128x1_sse2<YesS3, YesS4, NI>>> for u32x4x4_avx2<NI>
|
||||
{
|
||||
#[inline(always)]
|
||||
fn from(x: x4<u128x1_sse2<YesS3, YesS4, NI>>) -> Self {
|
||||
Self::new(unsafe {
|
||||
[
|
||||
_mm256_setr_m128i(x.0[0].x, x.0[1].x),
|
||||
_mm256_setr_m128i(x.0[2].x, x.0[3].x),
|
||||
u32x4x2_avx2::new(_mm256_setr_m128i(x.0[0].x, x.0[1].x)),
|
||||
u32x4x2_avx2::new(_mm256_setr_m128i(x.0[2].x, x.0[3].x)),
|
||||
]
|
||||
})
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
{"files":{"Cargo.toml":"f146a19842771e569274bb49cc45bdec523f5684635e436fac722ca8acca9f1e","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"378f5840b258e2779c39418f3f2d7b2ba96f1c7917dd6be0713f88305dbda397","README.md":"e1f9d4fc22cff2c049f166a403b41458632a94357890d31cf0e3ad83807fb430","build.rs":"a71283fbc495095eebbbf46753df3fe2c19505c745b508dea157f65796b64dd7","src/detection.rs":"9d25d896889e65330858f2d6f6223c1b98cd1dad189813ad4161ff189fbda2b8","src/fallback.rs":"c161f65f18d7d19bcbd568f5c0bea1cfc1ce3bd9c66427b1fdb4944ad7966ce0","src/lib.rs":"233e3b81bd55cfc9ea03e3441750df43482f2542fb1ce766579b2b440b59a8c5","src/marker.rs":"87fce2d0357f5b7998b6d9dfb064f4a0cbc9dabb19e33d4b514a446243ebe2e8","src/parse.rs":"e9490087ca7d1c10a94c835e725a5189145647492be2735dcd842b6e5ae5b57c","src/wrapper.rs":"9b932595ff6534b1d54ed4917b1d7b63e748ac4786d5377bd6f3bc7da78c2f83","tests/comments.rs":"ea6cbe6f4c8852e6a0612893c7d4f2c144a2e6a134a6c3db641a320cbfc3c800","tests/features.rs":"a86deb8644992a4eb64d9fd493eff16f9cf9c5cb6ade3a634ce0c990cf87d559","tests/marker.rs":"652db9f25c69ffc65baa60cdca8f195aa2e254d4de0a9ddc85de4dc2470544b6","tests/test.rs":"597186c00ebf51191934c88ff970b5457ca0fb8e608bf896be1ebf8d74c17f4d","tests/test_fmt.rs":"745dfdc41d09c5308c221395eb43f2041f0a1413d2927a813bc2ad4554438fe2"},"package":"f0d8caf72986c1a598726adc988bb5984792ef84f5ee5aa50209145ee8077038"}
|
||||
{"files":{"Cargo.toml":"1f6a5d25accb4449c7427a27678f58c49d0d00ed7c2f60da787dd4353abdb5ee","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"378f5840b258e2779c39418f3f2d7b2ba96f1c7917dd6be0713f88305dbda397","README.md":"fb633ca229c17dc9802db9b66c3b31792e9da8877856c52729e71f7412338387","build.rs":"4f6f7f8fc825a73330cb0a88faced3d435ece640ee1e6c308ab2f19fd19d2c35","src/detection.rs":"813dbaefe98a2b993ee40ec130d4f0ed58430c15aa4661a2c9d2f0d105669409","src/fallback.rs":"a34fb3f1c6f73de26af3cbd5ba446a8cf04076c8570137edc0fe216ec3e4d6ae","src/lib.rs":"452140fa8be772bde4aa89ceb8c47430ff904b864585a9d01c96a23b68b4b9af","src/marker.rs":"87fce2d0357f5b7998b6d9dfb064f4a0cbc9dabb19e33d4b514a446243ebe2e8","src/parse.rs":"a7068413b1b7873543c704b9c494f47f94a7046553a6765e99d4a1ac4ae6501f","src/wrapper.rs":"ef5648598c132e0ca6f8c0056d5b82e1b7f47ae29701860bf1fc52b89371d27b","tests/comments.rs":"065132797580744767b7a854d5467757bd3433a990957f8dbccdfa779bfb275f","tests/features.rs":"a86deb8644992a4eb64d9fd493eff16f9cf9c5cb6ade3a634ce0c990cf87d559","tests/marker.rs":"cb6d776eba6a238d726b0f531883adf41957e06f2717ee8a069821c81e7081d6","tests/test.rs":"5ca52a1eb73ebe51368c3be1ad6898aa48dc8cfb1e76d170950c475b75dac743","tests/test_fmt.rs":"9357769945784354909259084ec8b34d2aa52081dd3967cac6dae3a5e3df3bc0"},"package":"fb37d2df5df740e582f28f8560cf425f52bb267d872fe58358eadb554909f07a"}
|
16
third_party/rust/proc-macro2/Cargo.toml
vendored
16
third_party/rust/proc-macro2/Cargo.toml
vendored
@ -3,25 +3,25 @@
|
||||
# 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
|
||||
# to registry (e.g., crates.io) dependencies.
|
||||
#
|
||||
# If you believe there's an error in this file please file an
|
||||
# issue against the rust-lang/cargo repository. If you're
|
||||
# editing this file be aware that the upstream Cargo.toml
|
||||
# will likely look very different (and much more reasonable)
|
||||
# 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"
|
||||
rust-version = "1.31"
|
||||
name = "proc-macro2"
|
||||
version = "1.0.27"
|
||||
authors = ["Alex Crichton <alex@alexcrichton.com>", "David Tolnay <dtolnay@gmail.com>"]
|
||||
version = "1.0.33"
|
||||
authors = ["David Tolnay <dtolnay@gmail.com>", "Alex Crichton <alex@alexcrichton.com>"]
|
||||
description = "A substitute implementation of the compiler's `proc_macro` API to decouple\ntoken-based libraries from the procedural macro use case.\n"
|
||||
documentation = "https://docs.rs/proc-macro2"
|
||||
readme = "README.md"
|
||||
keywords = ["macros"]
|
||||
categories = ["development-tools::procedural-macro-helpers"]
|
||||
license = "MIT OR Apache-2.0"
|
||||
repository = "https://github.com/alexcrichton/proc-macro2"
|
||||
repository = "https://github.com/dtolnay/proc-macro2"
|
||||
[package.metadata.docs.rs]
|
||||
rustc-args = ["--cfg", "procmacro2_semver_exempt"]
|
||||
rustdoc-args = ["--cfg", "procmacro2_semver_exempt", "--cfg", "doc_cfg"]
|
||||
|
7
third_party/rust/proc-macro2/README.md
vendored
7
third_party/rust/proc-macro2/README.md
vendored
@ -1,8 +1,9 @@
|
||||
# proc-macro2
|
||||
|
||||
[![Build Status](https://img.shields.io/github/workflow/status/alexcrichton/proc-macro2/build%20and%20test)](https://github.com/alexcrichton/proc-macro2/actions)
|
||||
[![Latest Version](https://img.shields.io/crates/v/proc-macro2.svg)](https://crates.io/crates/proc-macro2)
|
||||
[![Rust Documentation](https://img.shields.io/badge/api-rustdoc-blue.svg)](https://docs.rs/proc-macro2)
|
||||
[<img alt="github" src="https://img.shields.io/badge/github-dtolnay/proc--macro2-8da0cb?style=for-the-badge&labelColor=555555&logo=github" height="20">](https://github.com/dtolnay/proc-macro2)
|
||||
[<img alt="crates.io" src="https://img.shields.io/crates/v/proc-macro2.svg?style=for-the-badge&color=fc8d62&logo=rust" height="20">](https://crates.io/crates/proc-macro2)
|
||||
[<img alt="docs.rs" src="https://img.shields.io/badge/docs.rs-proc--macro2-66c2a5?style=for-the-badge&labelColor=555555&logoColor=white&logo=data:image/svg+xml;base64,PHN2ZyByb2xlPSJpbWciIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmlld0JveD0iMCAwIDUxMiA1MTIiPjxwYXRoIGZpbGw9IiNmNWY1ZjUiIGQ9Ik00ODguNiAyNTAuMkwzOTIgMjE0VjEwNS41YzAtMTUtOS4zLTI4LjQtMjMuNC0zMy43bC0xMDAtMzcuNWMtOC4xLTMuMS0xNy4xLTMuMS0yNS4zIDBsLTEwMCAzNy41Yy0xNC4xIDUuMy0yMy40IDE4LjctMjMuNCAzMy43VjIxNGwtOTYuNiAzNi4yQzkuMyAyNTUuNSAwIDI2OC45IDAgMjgzLjlWMzk0YzAgMTMuNiA3LjcgMjYuMSAxOS45IDMyLjJsMTAwIDUwYzEwLjEgNS4xIDIyLjEgNS4xIDMyLjIgMGwxMDMuOS01MiAxMDMuOSA1MmMxMC4xIDUuMSAyMi4xIDUuMSAzMi4yIDBsMTAwLTUwYzEyLjItNi4xIDE5LjktMTguNiAxOS45LTMyLjJWMjgzLjljMC0xNS05LjMtMjguNC0yMy40LTMzLjd6TTM1OCAyMTQuOGwtODUgMzEuOXYtNjguMmw4NS0zN3Y3My4zek0xNTQgMTA0LjFsMTAyLTM4LjIgMTAyIDM4LjJ2LjZsLTEwMiA0MS40LTEwMi00MS40di0uNnptODQgMjkxLjFsLTg1IDQyLjV2LTc5LjFsODUtMzguOHY3NS40em0wLTExMmwtMTAyIDQxLjQtMTAyLTQxLjR2LS42bDEwMi0zOC4yIDEwMiAzOC4ydi42em0yNDAgMTEybC04NSA0Mi41di03OS4xbDg1LTM4Ljh2NzUuNHptMC0xMTJsLTEwMiA0MS40LTEwMi00MS40di0uNmwxMDItMzguMiAxMDIgMzguMnYuNnoiPjwvcGF0aD48L3N2Zz4K" height="20">](https://docs.rs/proc-macro2)
|
||||
[<img alt="build status" src="https://img.shields.io/github/workflow/status/dtolnay/proc-macro2/CI/master?style=for-the-badge" height="20">](https://github.com/dtolnay/proc-macro2/actions?query=branch%3Amaster)
|
||||
|
||||
A wrapper around the procedural macro API of the compiler's `proc_macro` crate.
|
||||
This library serves two purposes:
|
||||
|
65
third_party/rust/proc-macro2/build.rs
vendored
65
third_party/rust/proc-macro2/build.rs
vendored
@ -33,8 +33,15 @@
|
||||
// location of a token. Enabled by procmacro2_semver_exempt or the
|
||||
// "span-locations" Cargo cfg. This is behind a cfg because tracking
|
||||
// location inside spans is a performance hit.
|
||||
//
|
||||
// "is_available"
|
||||
// Use proc_macro::is_available() to detect if the proc macro API is
|
||||
// available or needs to be polyfilled instead of trying to use the proc
|
||||
// macro API and catching a panic if it isn't available. Enabled on Rust
|
||||
// 1.57+.
|
||||
|
||||
use std::env;
|
||||
use std::iter;
|
||||
use std::process::{self, Command};
|
||||
use std::str;
|
||||
|
||||
@ -53,7 +60,7 @@ fn main() {
|
||||
|
||||
let semver_exempt = cfg!(procmacro2_semver_exempt);
|
||||
if semver_exempt {
|
||||
// https://github.com/alexcrichton/proc-macro2/issues/147
|
||||
// https://github.com/dtolnay/proc-macro2/issues/147
|
||||
println!("cargo:rustc-cfg=procmacro2_semver_exempt");
|
||||
}
|
||||
|
||||
@ -69,12 +76,24 @@ fn main() {
|
||||
println!("cargo:rustc-cfg=no_bind_by_move_pattern_guard");
|
||||
}
|
||||
|
||||
if version.minor >= 44 {
|
||||
println!("cargo:rustc-cfg=lexerror_display");
|
||||
if version.minor < 44 {
|
||||
println!("cargo:rustc-cfg=no_lexerror_display");
|
||||
}
|
||||
|
||||
if version.minor >= 45 {
|
||||
println!("cargo:rustc-cfg=hygiene");
|
||||
if version.minor < 45 {
|
||||
println!("cargo:rustc-cfg=no_hygiene");
|
||||
}
|
||||
|
||||
if version.minor < 54 {
|
||||
println!("cargo:rustc-cfg=no_literal_from_str");
|
||||
}
|
||||
|
||||
if version.minor < 55 {
|
||||
println!("cargo:rustc-cfg=no_group_open_close");
|
||||
}
|
||||
|
||||
if version.minor < 57 {
|
||||
println!("cargo:rustc-cfg=no_is_available");
|
||||
}
|
||||
|
||||
let target = env::var("TARGET").unwrap();
|
||||
@ -132,15 +151,33 @@ fn feature_allowed(feature: &str) -> bool {
|
||||
//
|
||||
// -Zallow-features=feature1,feature2
|
||||
|
||||
if let Some(rustflags) = env::var_os("RUSTFLAGS") {
|
||||
for mut flag in rustflags.to_string_lossy().split(' ') {
|
||||
if flag.starts_with("-Z") {
|
||||
flag = &flag["-Z".len()..];
|
||||
}
|
||||
if flag.starts_with("allow-features=") {
|
||||
flag = &flag["allow-features=".len()..];
|
||||
return flag.split(',').any(|allowed| allowed == feature);
|
||||
}
|
||||
let flags_var;
|
||||
let flags_var_string;
|
||||
let mut flags_var_split;
|
||||
let mut flags_none;
|
||||
let flags: &mut dyn Iterator<Item = &str> =
|
||||
if let Some(encoded_rustflags) = env::var_os("CARGO_ENCODED_RUSTFLAGS") {
|
||||
flags_var = encoded_rustflags;
|
||||
flags_var_string = flags_var.to_string_lossy();
|
||||
flags_var_split = flags_var_string.split('\x1f');
|
||||
&mut flags_var_split
|
||||
} else if let Some(rustflags) = env::var_os("RUSTFLAGS") {
|
||||
flags_var = rustflags;
|
||||
flags_var_string = flags_var.to_string_lossy();
|
||||
flags_var_split = flags_var_string.split(' ');
|
||||
&mut flags_var_split
|
||||
} else {
|
||||
flags_none = iter::empty();
|
||||
&mut flags_none
|
||||
};
|
||||
|
||||
for mut flag in flags {
|
||||
if flag.starts_with("-Z") {
|
||||
flag = &flag["-Z".len()..];
|
||||
}
|
||||
if flag.starts_with("allow-features=") {
|
||||
flag = &flag["allow-features=".len()..];
|
||||
return flag.split(',').any(|allowed| allowed == feature);
|
||||
}
|
||||
}
|
||||
|
||||
|
12
third_party/rust/proc-macro2/src/detection.rs
vendored
12
third_party/rust/proc-macro2/src/detection.rs
vendored
@ -1,5 +1,4 @@
|
||||
use std::panic::{self, PanicInfo};
|
||||
use std::sync::atomic::*;
|
||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
use std::sync::Once;
|
||||
|
||||
static WORKS: AtomicUsize = AtomicUsize::new(0);
|
||||
@ -24,6 +23,12 @@ pub(crate) fn unforce_fallback() {
|
||||
initialize();
|
||||
}
|
||||
|
||||
#[cfg(not(no_is_available))]
|
||||
fn initialize() {
|
||||
let available = proc_macro::is_available();
|
||||
WORKS.store(available as usize + 1, Ordering::SeqCst);
|
||||
}
|
||||
|
||||
// Swap in a null panic hook to avoid printing "thread panicked" to stderr,
|
||||
// then use catch_unwind to determine whether the compiler's proc_macro is
|
||||
// working. When proc-macro2 is used from outside of a procedural macro all
|
||||
@ -48,7 +53,10 @@ pub(crate) fn unforce_fallback() {
|
||||
// here. For now, if a user needs to guarantee that this failure mode does
|
||||
// not occur, they need to call e.g. `proc_macro2::Span::call_site()` from
|
||||
// the main thread before launching any other threads.
|
||||
#[cfg(no_is_available)]
|
||||
fn initialize() {
|
||||
use std::panic::{self, PanicInfo};
|
||||
|
||||
type PanicHook = dyn Fn(&PanicInfo) + Sync + Send + 'static;
|
||||
|
||||
let null_hook: Box<PanicHook> = Box::new(|_panic_info| { /* ignore */ });
|
||||
|
22
third_party/rust/proc-macro2/src/fallback.rs
vendored
22
third_party/rust/proc-macro2/src/fallback.rs
vendored
@ -65,7 +65,7 @@ impl TokenStream {
|
||||
}
|
||||
|
||||
fn push_token(&mut self, token: TokenTree) {
|
||||
// https://github.com/alexcrichton/proc-macro2/issues/235
|
||||
// https://github.com/dtolnay/proc-macro2/issues/235
|
||||
match token {
|
||||
#[cfg(not(no_bind_by_move_pattern_guard))]
|
||||
TokenTree::Literal(crate::Literal {
|
||||
@ -119,7 +119,7 @@ impl Drop for TokenStream {
|
||||
#[cfg(wrap_proc_macro)]
|
||||
let group = match group {
|
||||
crate::imp::Group::Fallback(group) => group,
|
||||
_ => continue,
|
||||
crate::imp::Group::Compiler(_) => continue,
|
||||
};
|
||||
let mut group = group;
|
||||
self.inner.extend(group.stream.take_inner());
|
||||
@ -179,7 +179,7 @@ impl Display for TokenStream {
|
||||
Display::fmt(tt, f)
|
||||
}
|
||||
TokenTree::Literal(tt) => Display::fmt(tt, f),
|
||||
}?
|
||||
}?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
@ -426,7 +426,7 @@ impl Span {
|
||||
Span { lo: 0, hi: 0 }
|
||||
}
|
||||
|
||||
#[cfg(hygiene)]
|
||||
#[cfg(not(no_hygiene))]
|
||||
pub fn mixed_site() -> Span {
|
||||
Span::call_site()
|
||||
}
|
||||
@ -896,10 +896,20 @@ impl Literal {
|
||||
impl FromStr for Literal {
|
||||
type Err = LexError;
|
||||
|
||||
fn from_str(repr: &str) -> Result<Self, Self::Err> {
|
||||
fn from_str(mut repr: &str) -> Result<Self, Self::Err> {
|
||||
let negative = repr.starts_with('-');
|
||||
if negative {
|
||||
repr = &repr[1..];
|
||||
if !repr.starts_with(|ch: char| ch.is_ascii_digit()) {
|
||||
return Err(LexError::call_site());
|
||||
}
|
||||
}
|
||||
let cursor = get_cursor(repr);
|
||||
if let Ok((_rest, literal)) = parse::literal(cursor) {
|
||||
if let Ok((_rest, mut literal)) = parse::literal(cursor) {
|
||||
if literal.text.len() == repr.len() {
|
||||
if negative {
|
||||
literal.text.insert(0, '-');
|
||||
}
|
||||
return Ok(literal);
|
||||
}
|
||||
}
|
||||
|
38
third_party/rust/proc-macro2/src/lib.rs
vendored
38
third_party/rust/proc-macro2/src/lib.rs
vendored
@ -1,3 +1,11 @@
|
||||
//! [![github]](https://github.com/dtolnay/proc-macro2) [![crates-io]](https://crates.io/crates/proc-macro2) [![docs-rs]](crate)
|
||||
//!
|
||||
//! [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&logoColor=white&logo=data:image/svg+xml;base64,PHN2ZyByb2xlPSJpbWciIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmlld0JveD0iMCAwIDUxMiA1MTIiPjxwYXRoIGZpbGw9IiNmNWY1ZjUiIGQ9Ik00ODguNiAyNTAuMkwzOTIgMjE0VjEwNS41YzAtMTUtOS4zLTI4LjQtMjMuNC0zMy43bC0xMDAtMzcuNWMtOC4xLTMuMS0xNy4xLTMuMS0yNS4zIDBsLTEwMCAzNy41Yy0xNC4xIDUuMy0yMy40IDE4LjctMjMuNCAzMy43VjIxNGwtOTYuNiAzNi4yQzkuMyAyNTUuNSAwIDI2OC45IDAgMjgzLjlWMzk0YzAgMTMuNiA3LjcgMjYuMSAxOS45IDMyLjJsMTAwIDUwYzEwLjEgNS4xIDIyLjEgNS4xIDMyLjIgMGwxMDMuOS01MiAxMDMuOSA1MmMxMC4xIDUuMSAyMi4xIDUuMSAzMi4yIDBsMTAwLTUwYzEyLjItNi4xIDE5LjktMTguNiAxOS45LTMyLjJWMjgzLjljMC0xNS05LjMtMjguNC0yMy40LTMzLjd6TTM1OCAyMTQuOGwtODUgMzEuOXYtNjguMmw4NS0zN3Y3My4zek0xNTQgMTA0LjFsMTAyLTM4LjIgMTAyIDM4LjJ2LjZsLTEwMiA0MS40LTEwMi00MS40di0uNnptODQgMjkxLjFsLTg1IDQyLjV2LTc5LjFsODUtMzguOHY3NS40em0wLTExMmwtMTAyIDQxLjQtMTAyLTQxLjR2LS42bDEwMi0zOC4yIDEwMiAzOC4ydi42em0yNDAgMTEybC04NSA0Mi41di03OS4xbDg1LTM4Ljh2NzUuNHptMC0xMTJsLTEwMiA0MS40LTEwMi00MS40di0uNmwxMDItMzguMiAxMDIgMzguMnYuNnoiPjwvcGF0aD48L3N2Zz4K
|
||||
//!
|
||||
//! <br>
|
||||
//!
|
||||
//! A wrapper around the procedural macro API of the compiler's [`proc_macro`]
|
||||
//! crate. This library serves two purposes:
|
||||
//!
|
||||
@ -78,11 +86,25 @@
|
||||
//! a different thread.
|
||||
|
||||
// Proc-macro2 types in rustdoc of other crates get linked to here.
|
||||
#![doc(html_root_url = "https://docs.rs/proc-macro2/1.0.27")]
|
||||
#![doc(html_root_url = "https://docs.rs/proc-macro2/1.0.33")]
|
||||
#![cfg_attr(any(proc_macro_span, super_unstable), feature(proc_macro_span))]
|
||||
#![cfg_attr(super_unstable, feature(proc_macro_raw_ident, proc_macro_def_site))]
|
||||
#![cfg_attr(super_unstable, feature(proc_macro_def_site))]
|
||||
#![cfg_attr(doc_cfg, feature(doc_cfg))]
|
||||
#![allow(clippy::needless_doctest_main, clippy::vec_init_then_push)]
|
||||
#![allow(
|
||||
clippy::cast_lossless,
|
||||
clippy::cast_possible_truncation,
|
||||
clippy::doc_markdown,
|
||||
clippy::items_after_statements,
|
||||
clippy::manual_assert,
|
||||
clippy::must_use_candidate,
|
||||
clippy::needless_doctest_main,
|
||||
clippy::shadow_unrelated,
|
||||
clippy::trivially_copy_pass_by_ref,
|
||||
clippy::unnecessary_wraps,
|
||||
clippy::unused_self,
|
||||
clippy::used_underscore_binding,
|
||||
clippy::vec_init_then_push
|
||||
)]
|
||||
|
||||
#[cfg(use_proc_macro)]
|
||||
extern crate proc_macro;
|
||||
@ -210,14 +232,14 @@ impl From<TokenTree> for TokenStream {
|
||||
|
||||
impl Extend<TokenTree> for TokenStream {
|
||||
fn extend<I: IntoIterator<Item = TokenTree>>(&mut self, streams: I) {
|
||||
self.inner.extend(streams)
|
||||
self.inner.extend(streams);
|
||||
}
|
||||
}
|
||||
|
||||
impl Extend<TokenStream> for TokenStream {
|
||||
fn extend<I: IntoIterator<Item = TokenStream>>(&mut self, streams: I) {
|
||||
self.inner
|
||||
.extend(streams.into_iter().map(|stream| stream.inner))
|
||||
.extend(streams.into_iter().map(|stream| stream.inner));
|
||||
}
|
||||
}
|
||||
|
||||
@ -388,7 +410,7 @@ impl Span {
|
||||
/// of the macro. This is the same hygiene behavior as `macro_rules`.
|
||||
///
|
||||
/// This function requires Rust 1.45 or later.
|
||||
#[cfg(hygiene)]
|
||||
#[cfg(not(no_hygiene))]
|
||||
pub fn mixed_site() -> Span {
|
||||
Span::_new(imp::Span::mixed_site())
|
||||
}
|
||||
@ -706,7 +728,7 @@ impl Group {
|
||||
/// by this group, but rather it will only set the span of the delimiter
|
||||
/// tokens at the level of the `Group`.
|
||||
pub fn set_span(&mut self, span: Span) {
|
||||
self.inner.set_span(span.inner)
|
||||
self.inner.set_span(span.inner);
|
||||
}
|
||||
}
|
||||
|
||||
@ -977,7 +999,7 @@ impl Ord for Ident {
|
||||
|
||||
impl Hash for Ident {
|
||||
fn hash<H: Hasher>(&self, hasher: &mut H) {
|
||||
self.to_string().hash(hasher)
|
||||
self.to_string().hash(hasher);
|
||||
}
|
||||
}
|
||||
|
||||
|
9
third_party/rust/proc-macro2/src/parse.rs
vendored
9
third_party/rust/proc-macro2/src/parse.rs
vendored
@ -461,7 +461,7 @@ fn cooked_byte_string(mut input: Cursor) -> Result<Cursor, Reject> {
|
||||
fn raw_string(input: Cursor) -> Result<Cursor, Reject> {
|
||||
let mut chars = input.char_indices();
|
||||
let mut n = 0;
|
||||
while let Some((i, ch)) = chars.next() {
|
||||
for (i, ch) in &mut chars {
|
||||
match ch {
|
||||
'"' => {
|
||||
n = i;
|
||||
@ -621,8 +621,7 @@ fn float_digits(input: Cursor) -> Result<Cursor, Reject> {
|
||||
chars.next();
|
||||
if chars
|
||||
.peek()
|
||||
.map(|&ch| ch == '.' || is_ident_start(ch))
|
||||
.unwrap_or(false)
|
||||
.map_or(false, |&ch| ch == '.' || is_ident_start(ch))
|
||||
{
|
||||
return Err(Reject);
|
||||
}
|
||||
@ -817,12 +816,12 @@ fn doc_comment(input: Cursor) -> PResult<Vec<TokenTree>> {
|
||||
TokenTree::Punct(Punct::new('=', Spacing::Alone)),
|
||||
TokenTree::Literal(crate::Literal::string(comment)),
|
||||
];
|
||||
for tt in stream.iter_mut() {
|
||||
for tt in &mut stream {
|
||||
tt.set_span(span);
|
||||
}
|
||||
let group = Group::new(Delimiter::Bracket, stream.into_iter().collect());
|
||||
trees.push(crate::Group::_new_stable(group).into());
|
||||
for tt in trees.iter_mut() {
|
||||
for tt in &mut trees {
|
||||
tt.set_span(span);
|
||||
}
|
||||
Ok((rest, trees))
|
||||
|
49
third_party/rust/proc-macro2/src/wrapper.rs
vendored
49
third_party/rust/proc-macro2/src/wrapper.rs
vendored
@ -284,9 +284,9 @@ impl Debug for LexError {
|
||||
impl Display for LexError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match self {
|
||||
#[cfg(lexerror_display)]
|
||||
#[cfg(not(no_lexerror_display))]
|
||||
LexError::Compiler(e) => Display::fmt(e, f),
|
||||
#[cfg(not(lexerror_display))]
|
||||
#[cfg(no_lexerror_display)]
|
||||
LexError::Compiler(_e) => Display::fmt(
|
||||
&fallback::LexError {
|
||||
span: fallback::Span::call_site(),
|
||||
@ -416,7 +416,7 @@ impl Span {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(hygiene)]
|
||||
#[cfg(not(no_hygiene))]
|
||||
pub fn mixed_site() -> Span {
|
||||
if inside_proc_macro() {
|
||||
Span::Compiler(proc_macro::Span::mixed_site())
|
||||
@ -436,11 +436,11 @@ impl Span {
|
||||
|
||||
pub fn resolved_at(&self, other: Span) -> Span {
|
||||
match (self, other) {
|
||||
#[cfg(hygiene)]
|
||||
#[cfg(not(no_hygiene))]
|
||||
(Span::Compiler(a), Span::Compiler(b)) => Span::Compiler(a.resolved_at(b)),
|
||||
|
||||
// Name resolution affects semantics, but location is only cosmetic
|
||||
#[cfg(not(hygiene))]
|
||||
#[cfg(no_hygiene)]
|
||||
(Span::Compiler(_), Span::Compiler(_)) => other,
|
||||
|
||||
(Span::Fallback(a), Span::Fallback(b)) => Span::Fallback(a.resolved_at(b)),
|
||||
@ -450,11 +450,11 @@ impl Span {
|
||||
|
||||
pub fn located_at(&self, other: Span) -> Span {
|
||||
match (self, other) {
|
||||
#[cfg(hygiene)]
|
||||
#[cfg(not(no_hygiene))]
|
||||
(Span::Compiler(a), Span::Compiler(b)) => Span::Compiler(a.located_at(b)),
|
||||
|
||||
// Name resolution affects semantics, but location is only cosmetic
|
||||
#[cfg(not(hygiene))]
|
||||
#[cfg(no_hygiene)]
|
||||
(Span::Compiler(_), Span::Compiler(_)) => *self,
|
||||
|
||||
(Span::Fallback(a), Span::Fallback(b)) => Span::Fallback(a.located_at(b)),
|
||||
@ -620,9 +620,9 @@ impl Group {
|
||||
|
||||
pub fn span_open(&self) -> Span {
|
||||
match self {
|
||||
#[cfg(proc_macro_span)]
|
||||
#[cfg(not(no_group_open_close))]
|
||||
Group::Compiler(g) => Span::Compiler(g.span_open()),
|
||||
#[cfg(not(proc_macro_span))]
|
||||
#[cfg(no_group_open_close)]
|
||||
Group::Compiler(g) => Span::Compiler(g.span()),
|
||||
Group::Fallback(g) => Span::Fallback(g.span_open()),
|
||||
}
|
||||
@ -630,9 +630,9 @@ impl Group {
|
||||
|
||||
pub fn span_close(&self) -> Span {
|
||||
match self {
|
||||
#[cfg(proc_macro_span)]
|
||||
#[cfg(not(no_group_open_close))]
|
||||
Group::Compiler(g) => Span::Compiler(g.span_close()),
|
||||
#[cfg(not(proc_macro_span))]
|
||||
#[cfg(no_group_open_close)]
|
||||
Group::Compiler(g) => Span::Compiler(g.span()),
|
||||
Group::Fallback(g) => Span::Fallback(g.span_close()),
|
||||
}
|
||||
@ -921,18 +921,25 @@ impl FromStr for Literal {
|
||||
|
||||
fn from_str(repr: &str) -> Result<Self, Self::Err> {
|
||||
if inside_proc_macro() {
|
||||
// TODO: use libproc_macro's FromStr impl once it is available in
|
||||
// rustc. https://github.com/rust-lang/rust/pull/84717
|
||||
let tokens = proc_macro_parse(repr)?;
|
||||
let mut iter = tokens.into_iter();
|
||||
if let (Some(proc_macro::TokenTree::Literal(literal)), None) =
|
||||
(iter.next(), iter.next())
|
||||
#[cfg(not(no_literal_from_str))]
|
||||
{
|
||||
if literal.to_string().len() == repr.len() {
|
||||
return Ok(Literal::Compiler(literal));
|
||||
}
|
||||
proc_macro::Literal::from_str(repr)
|
||||
.map(Literal::Compiler)
|
||||
.map_err(LexError::Compiler)
|
||||
}
|
||||
#[cfg(no_literal_from_str)]
|
||||
{
|
||||
let tokens = proc_macro_parse(repr)?;
|
||||
let mut iter = tokens.into_iter();
|
||||
if let (Some(proc_macro::TokenTree::Literal(literal)), None) =
|
||||
(iter.next(), iter.next())
|
||||
{
|
||||
if literal.to_string().len() == repr.len() {
|
||||
return Ok(Literal::Compiler(literal));
|
||||
}
|
||||
}
|
||||
Err(LexError::call_site())
|
||||
}
|
||||
Err(LexError::call_site())
|
||||
} else {
|
||||
let literal = fallback::Literal::from_str(repr)?;
|
||||
Ok(Literal::Fallback(literal))
|
||||
|
18
third_party/rust/proc-macro2/tests/comments.rs
vendored
18
third_party/rust/proc-macro2/tests/comments.rs
vendored
@ -1,16 +1,16 @@
|
||||
use proc_macro2::{Delimiter, Literal, Spacing, TokenStream, TokenTree};
|
||||
|
||||
// #[doc = "..."] -> "..."
|
||||
fn lit_of_outer_doc_comment(tokens: TokenStream) -> Literal {
|
||||
fn lit_of_outer_doc_comment(tokens: &TokenStream) -> Literal {
|
||||
lit_of_doc_comment(tokens, false)
|
||||
}
|
||||
|
||||
// #![doc = "..."] -> "..."
|
||||
fn lit_of_inner_doc_comment(tokens: TokenStream) -> Literal {
|
||||
fn lit_of_inner_doc_comment(tokens: &TokenStream) -> Literal {
|
||||
lit_of_doc_comment(tokens, true)
|
||||
}
|
||||
|
||||
fn lit_of_doc_comment(tokens: TokenStream, inner: bool) -> Literal {
|
||||
fn lit_of_doc_comment(tokens: &TokenStream, inner: bool) -> Literal {
|
||||
let mut iter = tokens.clone().into_iter();
|
||||
match iter.next().unwrap() {
|
||||
TokenTree::Punct(punct) => {
|
||||
@ -71,30 +71,30 @@ fn incomplete() {
|
||||
#[test]
|
||||
fn lit() {
|
||||
let stream = "/// doc".parse::<TokenStream>().unwrap();
|
||||
let lit = lit_of_outer_doc_comment(stream);
|
||||
let lit = lit_of_outer_doc_comment(&stream);
|
||||
assert_eq!(lit.to_string(), "\" doc\"");
|
||||
|
||||
let stream = "//! doc".parse::<TokenStream>().unwrap();
|
||||
let lit = lit_of_inner_doc_comment(stream);
|
||||
let lit = lit_of_inner_doc_comment(&stream);
|
||||
assert_eq!(lit.to_string(), "\" doc\"");
|
||||
|
||||
let stream = "/** doc */".parse::<TokenStream>().unwrap();
|
||||
let lit = lit_of_outer_doc_comment(stream);
|
||||
let lit = lit_of_outer_doc_comment(&stream);
|
||||
assert_eq!(lit.to_string(), "\" doc \"");
|
||||
|
||||
let stream = "/*! doc */".parse::<TokenStream>().unwrap();
|
||||
let lit = lit_of_inner_doc_comment(stream);
|
||||
let lit = lit_of_inner_doc_comment(&stream);
|
||||
assert_eq!(lit.to_string(), "\" doc \"");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn carriage_return() {
|
||||
let stream = "///\r\n".parse::<TokenStream>().unwrap();
|
||||
let lit = lit_of_outer_doc_comment(stream);
|
||||
let lit = lit_of_outer_doc_comment(&stream);
|
||||
assert_eq!(lit.to_string(), "\"\"");
|
||||
|
||||
let stream = "/**\r\n*/".parse::<TokenStream>().unwrap();
|
||||
let lit = lit_of_outer_doc_comment(stream);
|
||||
let lit = lit_of_outer_doc_comment(&stream);
|
||||
assert_eq!(lit.to_string(), "\"\\r\\n\"");
|
||||
|
||||
"///\r".parse::<TokenStream>().unwrap_err();
|
||||
|
12
third_party/rust/proc-macro2/tests/marker.rs
vendored
12
third_party/rust/proc-macro2/tests/marker.rs
vendored
@ -1,4 +1,6 @@
|
||||
use proc_macro2::*;
|
||||
use proc_macro2::{
|
||||
Delimiter, Group, Ident, LexError, Literal, Punct, Spacing, Span, TokenStream, TokenTree,
|
||||
};
|
||||
|
||||
macro_rules! assert_impl {
|
||||
($ty:ident is $($marker:ident) and +) => {
|
||||
@ -51,7 +53,7 @@ assert_impl!(TokenTree is not Send or Sync);
|
||||
|
||||
#[cfg(procmacro2_semver_exempt)]
|
||||
mod semver_exempt {
|
||||
use super::*;
|
||||
use proc_macro2::{LineColumn, SourceFile};
|
||||
|
||||
assert_impl!(LineColumn is Send and Sync);
|
||||
|
||||
@ -60,7 +62,11 @@ mod semver_exempt {
|
||||
|
||||
#[cfg(not(no_libprocmacro_unwind_safe))]
|
||||
mod unwind_safe {
|
||||
use super::*;
|
||||
use proc_macro2::{
|
||||
Delimiter, Group, Ident, LexError, Literal, Punct, Spacing, Span, TokenStream, TokenTree,
|
||||
};
|
||||
#[cfg(procmacro2_semver_exempt)]
|
||||
use proc_macro2::{LineColumn, SourceFile};
|
||||
use std::panic::{RefUnwindSafe, UnwindSafe};
|
||||
|
||||
macro_rules! assert_unwind_safe {
|
||||
|
13
third_party/rust/proc-macro2/tests/test.rs
vendored
13
third_party/rust/proc-macro2/tests/test.rs
vendored
@ -1,3 +1,5 @@
|
||||
#![allow(clippy::non_ascii_literal)]
|
||||
|
||||
use proc_macro2::{Ident, Literal, Punct, Spacing, Span, TokenStream, TokenTree};
|
||||
use std::panic;
|
||||
use std::str::{self, FromStr};
|
||||
@ -166,7 +168,11 @@ fn literal_iter_negative() {
|
||||
#[test]
|
||||
fn literal_parse() {
|
||||
assert!("1".parse::<Literal>().is_ok());
|
||||
assert!("-1".parse::<Literal>().is_ok());
|
||||
assert!("-1u12".parse::<Literal>().is_ok());
|
||||
assert!("1.0".parse::<Literal>().is_ok());
|
||||
assert!("-1.0".parse::<Literal>().is_ok());
|
||||
assert!("-1.0f12".parse::<Literal>().is_ok());
|
||||
assert!("'a'".parse::<Literal>().is_ok());
|
||||
assert!("\"\n\"".parse::<Literal>().is_ok());
|
||||
assert!("0 1".parse::<Literal>().is_err());
|
||||
@ -175,6 +181,9 @@ fn literal_parse() {
|
||||
assert!("/* comment */0".parse::<Literal>().is_err());
|
||||
assert!("0/* comment */".parse::<Literal>().is_err());
|
||||
assert!("0// comment".parse::<Literal>().is_err());
|
||||
assert!("- 1".parse::<Literal>().is_err());
|
||||
assert!("- 1.0".parse::<Literal>().is_err());
|
||||
assert!("-\"\"".parse::<Literal>().is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -183,7 +192,7 @@ fn roundtrip() {
|
||||
println!("parse: {}", p);
|
||||
let s = p.parse::<TokenStream>().unwrap().to_string();
|
||||
println!("first: {}", s);
|
||||
let s2 = s.to_string().parse::<TokenStream>().unwrap().to_string();
|
||||
let s2 = s.parse::<TokenStream>().unwrap().to_string();
|
||||
assert_eq!(s, s2);
|
||||
}
|
||||
roundtrip("a");
|
||||
@ -479,7 +488,7 @@ TokenStream [
|
||||
|
||||
#[test]
|
||||
fn default_tokenstream_is_empty() {
|
||||
let default_token_stream: TokenStream = Default::default();
|
||||
let default_token_stream = <TokenStream as Default>::default();
|
||||
|
||||
assert!(default_token_stream.is_empty());
|
||||
}
|
||||
|
@ -1,3 +1,5 @@
|
||||
#![allow(clippy::from_iter_instead_of_collect)]
|
||||
|
||||
use proc_macro2::{Delimiter, Group, Ident, Span, TokenStream, TokenTree};
|
||||
use std::iter::{self, FromIterator};
|
||||
|
||||
@ -12,7 +14,7 @@ fn test_fmt_group() {
|
||||
let braces_empty = Group::new(Delimiter::Brace, TokenStream::new());
|
||||
let braces_nonempty = Group::new(Delimiter::Brace, inner.clone());
|
||||
let none_empty = Group::new(Delimiter::None, TokenStream::new());
|
||||
let none_nonempty = Group::new(Delimiter::None, inner.clone());
|
||||
let none_nonempty = Group::new(Delimiter::None, inner);
|
||||
|
||||
// Matches libproc_macro.
|
||||
assert_eq!("()", parens_empty.to_string());
|
||||
|
@ -1 +1 @@
|
||||
{"files":{"CHANGELOG.md":"f51e0f29869f9a19db8c84c65a114eaff3815f1fb391f2269328c2b0ad6f439e","Cargo.lock":"35332957d477595735c0d32ae184327bcb3bfcced0b58c451f367f2025b3d6ea","Cargo.toml":"eae8ced983df9d1e137f1b050f33cf97244ea910201df85d94b68eb644bfc9f4","LICENSE-APACHE":"10d30a673cd5e9349bdc02aeb48f14b3386d27d0da32df8f0a555d4aa16aa551","LICENSE-MIT":"c8167fdeeed46d3f244d3f85c5bf998ce889343691c32be2c61a8bc4b5c08333","README.md":"d688bee6ba297331fbf12fdd2f7c0d4fb3465a5e81d9a47b6267ee019200e8e9","deny.toml":"b934c6446590feb984c68ddde5ec871ea3c2605586500d8a895b856f2158deb6","examples/puffin/NotoSans-Medium.ttf":"a0cf3e73ac27bff9a4c22f2807c84e1eb3d0740134e84f5455b0a39c14a76e11","examples/puffin/imgui_support.rs":"aa00824f2395b426d337df3b00ac94339237a7083d4ba498aa4b9b1e0f920165","examples/puffin/puffin.rs":"8ad5e4b37cc0c846287026dbd7523f65b5076dac12725f98566b20cddb29cba9","examples/puffin/renderer.rs":"3c5feca1a49932af6bd62887bdf29ac5ae8c45cf5c946653f060164cd39386f8","examples/puffin/shaders/compile_shaders.sh":"469d31610eb329b8d3dfb75b507f7dde309b8fb3d920794a7bfef47225843b84","examples/puffin/shaders/glsl/debug.frag":"e4a99b94f6d42aaf55b456e0afff41d3e0cf2e1217b9fa62a62d61f0b8d6ea4a","examples/puffin/shaders/glsl/debug.glsl":"e382ab582e1cc23d8f930f747856f3e264d1f63252e75e63feb37ba7cebb19b9","examples/puffin/shaders/glsl/debug.vert":"4a08d77df2f1093b25b10bae91404ca2215a2fbcb5874655073bc6610eec993a","examples/puffin/shaders/glsl/imgui.frag":"708cbf92892ff47129619fa4a1b49d8d92fd25c334ca1db297abdc3ff856bf75","examples/puffin/shaders/glsl/imgui.glsl":"f820afd23488f9f8923dc88d441fed7a8e8672167a478dde9c8da17ebe480f3a","examples/puffin/shaders/glsl/imgui.vert":"da01186c7a11792900e83288c1afbada7ecb880f72d119b0ae0b4fb96f1977ba","examples/puffin/shaders/out/debug.frag.cookedshaderpackage":"dafc932c79b08635aeeaa19afe659bed977b830aaaf9b1064214f9b6a3aeb82f","examples/puffin/shaders/out/debug.frag.metal":"7b65c0d5c8c5b9d3fa548b903eb79c217bf3f2edc9dbfd9bf16eb7af21c9cf7f","examples/puffin/shaders/out/debug.frag.spv":"e5b04a0e7688141e0fc8183b06a11ed71e55872e959f1b0f223a706776d65d0c","examples/puffin/shaders/out/debug.vert.cookedshaderpackage":"937348362eac750a2c47f1ef51ac450e95b2c07a458ac79bff6f9192b949f4c8","examples/puffin/shaders/out/debug.vert.metal":"00927df96045f93d2567f51d3078d86fafdd25e32d26815cd9ea29919eb7c66e","examples/puffin/shaders/out/debug.vert.spv":"587ee6f2f7ceec9eda19143accb17cc82a6174f43a7af78482d725ab5fcc3d32","examples/puffin/shaders/out/imgui.frag.cookedshaderpackage":"874a1a62fbd7eb789a7a3f5f17999fe8458322638dfe8331549dff55c7a93994","examples/puffin/shaders/out/imgui.frag.metal":"213cee127005db71b091249257d4363a5ace0b0871ea5107701491d386109899","examples/puffin/shaders/out/imgui.frag.spv":"1732a8debde7c60b17e2fc71eda5ce8fd8e53e8aa62202457e32be84dac9c111","examples/puffin/shaders/out/imgui.vert.cookedshaderpackage":"6d3a61514aadd55f4d2bd06b75650c0f2097c1627addbbb44bfa650f5fc439d5","examples/puffin/shaders/out/imgui.vert.metal":"92bf7b0b224420790d9e19b9de7aaa108697b09cb7fc2d6721c25f0fef4ca518","examples/puffin/shaders/out/imgui.vert.spv":"6677d81ef23ebaf8d140f749cd1b8ec9ec4089a6a2a2f93825e0b6d9d170b2cc","examples/simple.rs":"30bfbbd3c2af76e0284ec1e693cdcf19d8916ac0edabe08d85b2116c8e59c546","rustfmt.toml":"df025a0d166890f7b73df8596d0135a441d20311c9251e39df90e552675cebf3","screenshots/optick-small.png":"f7e7aacf4abb9c33be981104b2cb513990a70a1330b558a93fffce41e9e3a4d5","screenshots/optick.jpeg":"21eba8cc720f162b68bca2b04cc2de4e503df1d8391629cf2b119c8d0703063d","screenshots/superluminal-small.png":"2a0454927d791c18e581185f28e18ae3b7c58aeaa6ebcc624a4bc1e372e78b0d","screenshots/superluminal.jpeg":"cc2e35922f0663aa8e3cdb6f77593ee98692567c0b37a1b4f839fa5973eb600b","screenshots/tracing.png":"db48a29de2b848ca39ff70f7adcc777e7c098867fb923f0903a0eba2305b1eee","screenshots/tracy-small.png":"05ad7d07ca7a45605df5c176a7963237dc7ee4b7360f04474dcb700ca965dbb0","screenshots/tracy.jpeg":"011554c1da51ceb6262b17591a659464172396f270f2476535163509e2c919eb","src/empty_impl.rs":"341753cbc92275dc45184c22d60b5192854f35d6c57fdcd68b4ba17a6df59a27","src/lib.rs":"33fa9f148a2f80410ca71fad0b6ab1587c698f318175dfb0015aca9075e75694","src/optick_impl.rs":"167d92d27ac5c0e29b022f93c64d1d3b0e08db5bf0282f8874df465ab2fbe350","src/puffin_impl.rs":"70423e2e348ea0539b253841ad0ce594dd814f60d02ca5f8413a492a8f5cf0ec","src/superluminal_impl.rs":"9bf236c5435147b090cdb1e706f0480639590c6ca1a08ce795c9bcb714a7f1f8","src/tracing_impl.rs":"92bdbd9fc760d258287df13f301f999f678f9ef742c599f7e71b668746743119","src/tracy_impl.rs":"9a6bb2b880dc3a79db8f8e66b797f799cead5ff0f6a3f2002e6321e53e63a07a","src/type_check_impl.rs":"daf88bb080b6d68e38206667a3d725948a3c836a0c0577d09354bde1e4213920"},"package":"0a7c000c0ce9d9bb94c0fbacdf20e5087fbe652c556ffb2c9387d980e17d51fb"}
|
||||
{"files":{"CHANGELOG.md":"c320908658063f54ae86ca35f294de10ac415b6f9e3fe1e57eeff18e48ec87d6","Cargo.lock":"7bbcbb6cf05624f36376b785d3ed44fca9c65c4e1fedfe45a2adbd9e433bd5a4","Cargo.toml":"9af4a2b32ad39fe398e0d9d7a747ede6c0cb179c1d7e3c850b5ceb0853632552","LICENSE-APACHE":"10d30a673cd5e9349bdc02aeb48f14b3386d27d0da32df8f0a555d4aa16aa551","LICENSE-MIT":"c8167fdeeed46d3f244d3f85c5bf998ce889343691c32be2c61a8bc4b5c08333","README.md":"69072115dbf6226b692b61b59614859eec7da816d839ff15fb2e166350f747a7","deny.toml":"be7c9c5b7046ecf143b20cc24da1693528685d5a873c8274ec0a561e3ec716a8","examples/puffin/NotoSans-Medium.ttf":"a0cf3e73ac27bff9a4c22f2807c84e1eb3d0740134e84f5455b0a39c14a76e11","examples/puffin/imgui_support.rs":"2bd5ff8808466a4e1b58aa0b273f7f88fc734ee703c1cf9ff74c29bc9ffa852d","examples/puffin/puffin.rs":"8ad5e4b37cc0c846287026dbd7523f65b5076dac12725f98566b20cddb29cba9","examples/puffin/renderer.rs":"2c978496fe70593892efb13828423ecf9585f9699180f86a592d66bb82a86d79","examples/puffin/shaders/compile_shaders.sh":"deb05796110c34178b87495adb7aa0abd8c3637effbdf1309b407113975050b2","examples/puffin/shaders/glsl/debug.frag":"e4a99b94f6d42aaf55b456e0afff41d3e0cf2e1217b9fa62a62d61f0b8d6ea4a","examples/puffin/shaders/glsl/debug.glsl":"e382ab582e1cc23d8f930f747856f3e264d1f63252e75e63feb37ba7cebb19b9","examples/puffin/shaders/glsl/debug.vert":"4a08d77df2f1093b25b10bae91404ca2215a2fbcb5874655073bc6610eec993a","examples/puffin/shaders/glsl/imgui.frag":"708cbf92892ff47129619fa4a1b49d8d92fd25c334ca1db297abdc3ff856bf75","examples/puffin/shaders/glsl/imgui.glsl":"f820afd23488f9f8923dc88d441fed7a8e8672167a478dde9c8da17ebe480f3a","examples/puffin/shaders/glsl/imgui.vert":"da01186c7a11792900e83288c1afbada7ecb880f72d119b0ae0b4fb96f1977ba","examples/puffin/shaders/out/debug.frag.cookedshaderpackage":"2545b1dbeb0dda1d06b18b3ed09ba489fde562d079b1e2581e9ebff458f91c82","examples/puffin/shaders/out/debug.frag.metal":"f97c896976106bf73b4619ef778f268a21e30530eae8af49b9d81a1c5923e6a0","examples/puffin/shaders/out/debug.frag.spv":"e5b04a0e7688141e0fc8183b06a11ed71e55872e959f1b0f223a706776d65d0c","examples/puffin/shaders/out/debug.vert.cookedshaderpackage":"ade377d4d230ccbb73abf662966cb4cf432367b96d76db4fa5a6587c382580d2","examples/puffin/shaders/out/debug.vert.metal":"00927df96045f93d2567f51d3078d86fafdd25e32d26815cd9ea29919eb7c66e","examples/puffin/shaders/out/debug.vert.spv":"587ee6f2f7ceec9eda19143accb17cc82a6174f43a7af78482d725ab5fcc3d32","examples/puffin/shaders/out/imgui.frag.cookedshaderpackage":"f2f03a7c648ae4d9743956327a0829fbba394bc48aa630e967974b3691d9b9ad","examples/puffin/shaders/out/imgui.frag.metal":"680390c8fc6e3121bdd74b804d9cda9d0b5a3eb306736a9cde362aade21b459d","examples/puffin/shaders/out/imgui.frag.spv":"1732a8debde7c60b17e2fc71eda5ce8fd8e53e8aa62202457e32be84dac9c111","examples/puffin/shaders/out/imgui.vert.cookedshaderpackage":"922e712f108609aef66466d1d49ea821ad113837ce49e8254b7c37461507f98f","examples/puffin/shaders/out/imgui.vert.metal":"331ad807aa2146ff2dfe55ae247f4f2f35856b593b22cf20d85c4a2554f61952","examples/puffin/shaders/out/imgui.vert.spv":"6677d81ef23ebaf8d140f749cd1b8ec9ec4089a6a2a2f93825e0b6d9d170b2cc","examples/simple.rs":"30bfbbd3c2af76e0284ec1e693cdcf19d8916ac0edabe08d85b2116c8e59c546","rustfmt.toml":"df025a0d166890f7b73df8596d0135a441d20311c9251e39df90e552675cebf3","screenshots/optick-small.png":"f7e7aacf4abb9c33be981104b2cb513990a70a1330b558a93fffce41e9e3a4d5","screenshots/optick.jpeg":"21eba8cc720f162b68bca2b04cc2de4e503df1d8391629cf2b119c8d0703063d","screenshots/superluminal-small.png":"2a0454927d791c18e581185f28e18ae3b7c58aeaa6ebcc624a4bc1e372e78b0d","screenshots/superluminal.jpeg":"cc2e35922f0663aa8e3cdb6f77593ee98692567c0b37a1b4f839fa5973eb600b","screenshots/tracing.png":"db48a29de2b848ca39ff70f7adcc777e7c098867fb923f0903a0eba2305b1eee","screenshots/tracy-small.png":"05ad7d07ca7a45605df5c176a7963237dc7ee4b7360f04474dcb700ca965dbb0","screenshots/tracy.jpeg":"011554c1da51ceb6262b17591a659464172396f270f2476535163509e2c919eb","src/empty_impl.rs":"341753cbc92275dc45184c22d60b5192854f35d6c57fdcd68b4ba17a6df59a27","src/lib.rs":"33fa9f148a2f80410ca71fad0b6ab1587c698f318175dfb0015aca9075e75694","src/optick_impl.rs":"167d92d27ac5c0e29b022f93c64d1d3b0e08db5bf0282f8874df465ab2fbe350","src/puffin_impl.rs":"70423e2e348ea0539b253841ad0ce594dd814f60d02ca5f8413a492a8f5cf0ec","src/superluminal_impl.rs":"9bf236c5435147b090cdb1e706f0480639590c6ca1a08ce795c9bcb714a7f1f8","src/tracing_impl.rs":"92bdbd9fc760d258287df13f301f999f678f9ef742c599f7e71b668746743119","src/tracy_impl.rs":"9a6bb2b880dc3a79db8f8e66b797f799cead5ff0f6a3f2002e6321e53e63a07a","src/type_check_impl.rs":"daf88bb080b6d68e38206667a3d725948a3c836a0c0577d09354bde1e4213920"},"package":"9926767b8b8244d7b6b64546585121d193c3d0b4856ccd656b7bfa9deb91ab6a"}
|
12
third_party/rust/profiling/CHANGELOG.md
vendored
12
third_party/rust/profiling/CHANGELOG.md
vendored
@ -1,7 +1,17 @@
|
||||
# Changelog
|
||||
|
||||
## Unpublished
|
||||
## 1.0.4
|
||||
* Update puffin to 0.10
|
||||
|
||||
## 1.0.3
|
||||
* Update puffin to 0.6 and puffin-imgui to 0.8
|
||||
|
||||
## 1.0.2
|
||||
* Fix tracing backend failing to compile when tracing crate is not a dependency in the downstream crate
|
||||
|
||||
## 1.0.1
|
||||
* Rework feature flags so that downstream *libraries* no longer have to add feature flags per profiling backend.
|
||||
* Add a backend that does type checking (for CI purposes)
|
||||
|
||||
## 1.0.0
|
||||
* Republish 0.1.10 as 1.0.0
|
||||
|
883
third_party/rust/profiling/Cargo.lock
generated
vendored
883
third_party/rust/profiling/Cargo.lock
generated
vendored
File diff suppressed because it is too large
Load Diff
25
third_party/rust/profiling/Cargo.toml
vendored
25
third_party/rust/profiling/Cargo.toml
vendored
@ -3,17 +3,16 @@
|
||||
# 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
|
||||
# to registry (e.g., crates.io) dependencies.
|
||||
#
|
||||
# If you believe there's an error in this file please file an
|
||||
# issue against the rust-lang/cargo repository. If you're
|
||||
# editing this file be aware that the upstream Cargo.toml
|
||||
# will likely look very different (and much more reasonable)
|
||||
# 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 = "profiling"
|
||||
version = "1.0.2"
|
||||
version = "1.0.4"
|
||||
authors = ["Philip Degarmo <aclysma@gmail.com>"]
|
||||
description = "This crate provides a very thin abstraction over other profiler crates."
|
||||
homepage = "https://github.com/aclysma/profiling"
|
||||
@ -37,11 +36,11 @@ version = "1.3"
|
||||
optional = true
|
||||
|
||||
[dependencies.profiling-procmacros]
|
||||
version = "1.0.2"
|
||||
version = "1.0.4"
|
||||
optional = true
|
||||
|
||||
[dependencies.puffin]
|
||||
version = "0.4"
|
||||
version = "0.10"
|
||||
optional = true
|
||||
|
||||
[dependencies.superluminal-perf]
|
||||
@ -65,10 +64,10 @@ version = "0.6"
|
||||
version = "0.8.6"
|
||||
|
||||
[dev-dependencies.imgui]
|
||||
version = "0.7"
|
||||
version = "0.8"
|
||||
|
||||
[dev-dependencies.imgui-winit-support]
|
||||
version = "0.7"
|
||||
version = "0.8"
|
||||
|
||||
[dev-dependencies.lazy_static]
|
||||
version = "1"
|
||||
@ -77,10 +76,10 @@ version = "1"
|
||||
version = "0.4"
|
||||
|
||||
[dev-dependencies.puffin-imgui]
|
||||
version = "0.7"
|
||||
version = "0.13.1"
|
||||
|
||||
[dev-dependencies.rafx]
|
||||
version = "=0.0.10"
|
||||
version = "=0.0.14"
|
||||
features = ["rafx-vulkan", "framework"]
|
||||
|
||||
[dev-dependencies.tracing-subscriber]
|
||||
@ -90,7 +89,7 @@ version = "0.2"
|
||||
version = "0.4.0"
|
||||
|
||||
[dev-dependencies.winit]
|
||||
version = "0.24"
|
||||
version = "0.25"
|
||||
|
||||
[features]
|
||||
default = ["procmacros"]
|
||||
|
2
third_party/rust/profiling/README.md
vendored
2
third_party/rust/profiling/README.md
vendored
@ -154,7 +154,7 @@ profile-with-puffin = ["profiling/profile-with-puffin"]
|
||||
profile-with-optick = ["profiling/profile-with-optick"]
|
||||
profile-with-superluminal = ["profiling/profile-with-superluminal"]
|
||||
profile-with-tracing = ["profiling/profile-with-tracing"]
|
||||
profile-with-tracy = ["profiling/profile-with-tracing"]
|
||||
profile-with-tracy = ["profiling/profile-with-tracy"]
|
||||
```
|
||||
|
||||
* You can use the default feature to quickly/temporarily turn something on: `default = ["profile-with-optick"]`
|
||||
|
3
third_party/rust/profiling/deny.toml
vendored
3
third_party/rust/profiling/deny.toml
vendored
@ -36,7 +36,7 @@ db-path = "~/.cargo/advisory-db"
|
||||
# The url of the advisory database to use
|
||||
db-urls = ["https://github.com/rustsec/advisory-db"]
|
||||
# The lint level for security vulnerabilities
|
||||
vulnerability = "deny"
|
||||
vulnerability = "warn"
|
||||
# The lint level for unmaintained crates
|
||||
unmaintained = "warn"
|
||||
# The lint level for crates that have been yanked from their source registry
|
||||
@ -73,6 +73,7 @@ allow = [
|
||||
"MIT",
|
||||
"Apache-2.0",
|
||||
"BSD-3-Clause",
|
||||
"Zlib"
|
||||
#"BSD-2-Clause"
|
||||
#"Apache-2.0 WITH LLVM-exception",
|
||||
]
|
||||
|
@ -109,7 +109,7 @@ impl ImguiManager {
|
||||
// implemented upstream and I switch to using it
|
||||
}
|
||||
_ => {
|
||||
platform.handle_event(context.io_mut(), &window, &event);
|
||||
platform.handle_event(context.io_mut(), window, event);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -309,12 +309,12 @@ fn init_imgui(window: &winit::window::Window) -> imgui::Context {
|
||||
}
|
||||
|
||||
pub fn init_imgui_manager(window: &winit::window::Window) -> ImguiManager {
|
||||
let mut imgui_context = init_imgui(&window);
|
||||
let mut imgui_context = init_imgui(window);
|
||||
let mut imgui_platform = imgui_winit_support::WinitPlatform::init(&mut imgui_context);
|
||||
|
||||
imgui_platform.attach_window(
|
||||
imgui_context.io_mut(),
|
||||
&window,
|
||||
window,
|
||||
imgui_winit_support::HiDpiMode::Rounded,
|
||||
);
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
use rafx::api::*;
|
||||
use rafx::framework::*;
|
||||
use rafx::nodes::*;
|
||||
use rafx::render_features::*;
|
||||
use std::sync::Arc;
|
||||
|
||||
/// Vulkan renderer that creates and manages the vulkan instance, device, swapchain, and
|
||||
@ -28,7 +28,7 @@ impl Renderer {
|
||||
height: window_size.height,
|
||||
};
|
||||
|
||||
let api = RafxApi::new(window, &Default::default())?;
|
||||
let api = unsafe { RafxApi::new(window, &Default::default())? };
|
||||
let device_context = api.device_context();
|
||||
|
||||
let render_registry = RenderRegistryBuilder::default()
|
||||
@ -445,7 +445,7 @@ impl Renderer {
|
||||
let fixed_function_state = Arc::new(fixed_function_state);
|
||||
|
||||
let material_pass = MaterialPass::new(
|
||||
&resource_context,
|
||||
resource_context,
|
||||
fixed_function_state,
|
||||
vec![vertex_shader_module, fragment_shader_module],
|
||||
&[&vertex_entry_point, &fragment_entry_point],
|
||||
@ -469,9 +469,8 @@ rafx::declare_render_phase!(
|
||||
opaque_render_phase_sort_submit_nodes
|
||||
);
|
||||
|
||||
fn opaque_render_phase_sort_submit_nodes(submit_nodes: Vec<SubmitNode>) -> Vec<SubmitNode> {
|
||||
fn opaque_render_phase_sort_submit_nodes(_submit_nodes: &mut Vec<RenderFeatureSubmitNode>) {
|
||||
// No sort needed
|
||||
submit_nodes
|
||||
}
|
||||
|
||||
lazy_static::lazy_static! {
|
||||
@ -484,7 +483,7 @@ lazy_static::lazy_static! {
|
||||
uv: Default::default()
|
||||
};
|
||||
|
||||
VertexDataLayout::build_vertex_layout(&vertex, |builder, vertex| {
|
||||
VertexDataLayout::build_vertex_layout(&vertex, RafxVertexAttributeRate::Vertex, |builder, vertex| {
|
||||
builder.add_member(&vertex.pos, "POSITION", RafxFormat::R32G32_SFLOAT);
|
||||
builder.add_member(&vertex.uv, "TEXCOORD", RafxFormat::R32G32_SFLOAT);
|
||||
builder.add_member(&vertex.col, "COLOR", RafxFormat::R8G8B8A8_UNORM);
|
||||
|
@ -1,3 +1,3 @@
|
||||
|
||||
rafx-shader-processor --glsl-path glsl/*.vert glsl/*.frag glsl/*.comp --metal-generated-src-path out --spv-path out --cooked-shaders-path out
|
||||
rafx-shader-processor --glsl-path glsl/*.vert glsl/*.frag glsl/*.comp --metal-generated-src-path out --spv-path out --cooked-shaders-path out --package-vk
|
||||
|
||||
|
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user