Bug 1621044 - Lockfile changes and revendoring. r=jrmuizel

This updates binjs_meta and thus weedle, bindgen and thus clang-sys
transitively, and the mime / mime_guess crate and thus unicase and
version-check.

Differential Revision: https://phabricator.services.mozilla.com/D66282

--HG--
rename : third_party/rust/lmdb-rkv-sys/tests/fixtures/testdb/lock.mdb => third_party/rust/lmdb-rkv-sys/tests/fixtures/testdb-32/lock.mdb
rename : third_party/rust/mime_guess/Cargo.lock => third_party/rust/nom/Cargo.lock
rename : third_party/rust/nom/src/branch.rs => third_party/rust/nom/src/branch/macros.rs
rename : third_party/rust/nom/src/sequence.rs => third_party/rust/nom/src/sequence/macros.rs
rename : third_party/rust/rkv-0.10.2/.cargo-checksum.json => third_party/rust/rkv-0.10.4/.cargo-checksum.json
rename : third_party/rust/rkv-0.10.2/CODE_OF_CONDUCT.md => third_party/rust/rkv-0.10.4/CODE_OF_CONDUCT.md
rename : third_party/rust/rkv-0.10.2/Cargo.toml => third_party/rust/rkv-0.10.4/Cargo.toml
rename : third_party/rust/rkv-0.10.2/LICENSE => third_party/rust/rkv-0.10.4/LICENSE
rename : third_party/rust/rkv-0.10.2/examples/README.md => third_party/rust/rkv-0.10.4/examples/README.md
rename : third_party/rust/rkv-0.10.2/examples/iterator.rs => third_party/rust/rkv-0.10.4/examples/iterator.rs
rename : third_party/rust/rkv-0.10.2/examples/simple-store.rs => third_party/rust/rkv-0.10.4/examples/simple-store.rs
rename : third_party/rust/rkv-0.10.2/run-all-examples.sh => third_party/rust/rkv-0.10.4/run-all-examples.sh
rename : third_party/rust/rkv-0.10.2/src/bin/dump.rs => third_party/rust/rkv-0.10.4/src/bin/dump.rs
rename : third_party/rust/rkv-0.10.2/src/bin/rand.rs => third_party/rust/rkv-0.10.4/src/bin/rand.rs
rename : third_party/rust/rkv-0.10.2/src/env.rs => third_party/rust/rkv-0.10.4/src/env.rs
rename : third_party/rust/rkv-0.10.2/src/error.rs => third_party/rust/rkv-0.10.4/src/error.rs
rename : third_party/rust/rkv-0.10.2/src/lib.rs => third_party/rust/rkv-0.10.4/src/lib.rs
rename : third_party/rust/rkv-0.10.2/src/manager.rs => third_party/rust/rkv-0.10.4/src/manager.rs
rename : third_party/rust/rkv-0.10.2/src/migrate.rs => third_party/rust/rkv-0.10.4/src/migrate.rs
rename : third_party/rust/rkv-0.10.2/src/readwrite.rs => third_party/rust/rkv-0.10.4/src/readwrite.rs
rename : third_party/rust/rkv-0.10.2/src/store.rs => third_party/rust/rkv-0.10.4/src/store.rs
rename : third_party/rust/rkv-0.10.2/src/store/integer.rs => third_party/rust/rkv-0.10.4/src/store/integer.rs
rename : third_party/rust/rkv-0.10.2/src/store/integermulti.rs => third_party/rust/rkv-0.10.4/src/store/integermulti.rs
rename : third_party/rust/rkv-0.10.2/src/store/multi.rs => third_party/rust/rkv-0.10.4/src/store/multi.rs
rename : third_party/rust/rkv-0.10.2/src/store/single.rs => third_party/rust/rkv-0.10.4/src/store/single.rs
rename : third_party/rust/rkv-0.10.2/src/value.rs => third_party/rust/rkv-0.10.4/src/value.rs
rename : third_party/rust/rkv-0.10.2/tests/integer-store.rs => third_party/rust/rkv-0.10.4/tests/integer-store.rs
rename : third_party/rust/rkv-0.10.2/tests/manager.rs => third_party/rust/rkv-0.10.4/tests/manager.rs
rename : third_party/rust/rkv-0.10.2/tests/multi-integer-store.rs => third_party/rust/rkv-0.10.4/tests/multi-integer-store.rs
rename : third_party/rust/rkv-0.10.2/tests/test_txn.rs => third_party/rust/rkv-0.10.4/tests/test_txn.rs
extra : moz-landing-system : lando
This commit is contained in:
Emilio Cobos Álvarez 2020-03-10 21:06:36 +00:00
Родитель 6ef2792e0e
Коммит 0a80ad4a85
310 изменённых файлов: 30265 добавлений и 29508 удалений

127
Cargo.lock сгенерированный
Просмотреть файл

@ -256,15 +256,16 @@ dependencies = [
[[package]]
name = "bindgen"
version = "0.51.1"
version = "0.53.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ebd71393f1ec0509b553aa012b9b58e81dadbdff7130bd3b8cba576e69b32f75"
checksum = "6bb26d6a69a335b8cb0e7c7e9775cd5666611dc50a37177c3f2cedcfc040e8c8"
dependencies = [
"bitflags",
"cexpr",
"cfg-if",
"clang-sys",
"lazy_static",
"lazycell",
"peeking_take_while",
"proc-macro2",
"quote",
@ -275,9 +276,9 @@ dependencies = [
[[package]]
name = "binjs_meta"
version = "0.5.2"
version = "0.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c9a0da2208ceb785c1626fa8b7d250d2e5546ae230294b4a998e4f818c1768e"
checksum = "d535cc5246fd9035268770420afd76c05f87e68b83ebed0ac94e8258e88fc353"
dependencies = [
"Inflector",
"itertools",
@ -478,7 +479,7 @@ dependencies = [
"nserror",
"nsstring",
"rental",
"rkv 0.11.0",
"rkv 0.11.1",
"rust_cascade",
"sha2",
"storage_variant",
@ -490,9 +491,9 @@ dependencies = [
[[package]]
name = "cexpr"
version = "0.3.3"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8fc0086be9ca82f7fc89fc873435531cb898b86e850005850de1f820e2db6e9b"
checksum = "f4aedb84272dbe89af497cf81375129abda4fc0a9e7c5d317498c15cc30c0d27"
dependencies = [
"nom",
]
@ -537,9 +538,9 @@ dependencies = [
[[package]]
name = "clang-sys"
version = "0.28.1"
version = "0.29.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "81de550971c976f176130da4b2978d3b524eaa0fd9ac31f3ceb5ae1231fb4853"
checksum = "f92986241798376849e1a007827041fed9bb36195822c2049d18e174420e0534"
dependencies = [
"glob",
"libc",
@ -675,9 +676,9 @@ dependencies = [
[[package]]
name = "coreaudio-sys"
version = "0.2.3"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7e8f5954c1c7ccb55340443e8b29fca24013545a5e7d72c1ca7db4fc02b982ce"
checksum = "e81f1c165c33ffab90a03077ac3b03462b34d5947145dfa48102e063d581502c"
dependencies = [
"bindgen",
]
@ -1046,9 +1047,9 @@ dependencies = [
[[package]]
name = "devd-rs"
version = "0.3.0"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0d009f166c0d9e9f9909dc751630b3a6411ab7f85a153d32d01deb364ffe52a7"
checksum = "1945ccb7caedabdfb9347766ead740fb1e0582b7425598325f546adbd832cce1"
dependencies = [
"libc",
"nom",
@ -1387,7 +1388,7 @@ dependencies = [
"lazy_static",
"libc",
"lmdb-rkv",
"rkv 0.10.2",
"rkv 0.10.4",
"tempfile",
]
@ -1411,7 +1412,7 @@ dependencies = [
"serde_derive",
"serde_json",
"serde_yaml",
"uuid 0.8.1",
"uuid",
"webdriver",
"zip",
]
@ -1656,7 +1657,7 @@ name = "gkrust_utils"
version = "0.1.0"
dependencies = [
"nsstring",
"uuid 0.8.1",
"uuid",
]
[[package]]
@ -1692,10 +1693,10 @@ dependencies = [
"log",
"once_cell",
"regex",
"rkv 0.10.2",
"rkv 0.10.4",
"serde",
"serde_json",
"uuid 0.8.1",
"uuid",
]
[[package]]
@ -2067,7 +2068,7 @@ dependencies = [
"moz_task",
"nserror",
"nsstring",
"rkv 0.10.2",
"rkv 0.10.4",
"storage_variant",
"tempfile",
"thin-vec",
@ -2158,9 +2159,9 @@ checksum = "70fb39025bc7cdd76305867c4eccf2f2dcf6e9a57f5b21a93e1c2d86cd03ec9e"
[[package]]
name = "lmdb-rkv"
version = "0.12.3"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "605061e5465304475be2041f19967a900175ea1b6d8f47fbab84a84fb8c48452"
checksum = "447a296f7aca299cfbb50f4e4f3d49451549af655fb7215d7f8c0c3d64bad42b"
dependencies = [
"bitflags",
"byteorder",
@ -2170,11 +2171,10 @@ dependencies = [
[[package]]
name = "lmdb-rkv-sys"
version = "0.9.5"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1e4b19a1fdf5b74bc802cc9aa7c0c86a775e8b872ba9d5a4e606ffc5d076953"
checksum = "b27470ac25167b3afdfb6af8fcd3bc1be67de50ffbdaf4073378cfded6ae24a5"
dependencies = [
"bindgen",
"cc",
"libc",
"pkg-config",
@ -2343,7 +2343,7 @@ dependencies = [
"dns-parser",
"log",
"socket2",
"uuid 0.8.1",
"uuid",
]
[[package]]
@ -2388,18 +2388,15 @@ dependencies = [
[[package]]
name = "mime"
version = "0.3.13"
version = "0.3.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3e27ca21f40a310bd06d9031785f4801710d566c184a6e15bad4f1d9b65f9425"
dependencies = [
"unicase",
]
checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d"
[[package]]
name = "mime_guess"
version = "2.0.1"
version = "2.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a0ed03949aef72dbdf3116a383d7b38b4768e6f960528cd6a6044aa9ed68599"
checksum = "2684d4c2e97d99848d30b324b00c8fcc7e5c897b7cbb5819b09e7c90e8baf212"
dependencies = [
"mime",
"unicase",
@ -2536,6 +2533,7 @@ dependencies = [
name = "mozilla-central-workspace-hack"
version = "0.1.0"
dependencies = [
"bindgen",
"libc",
"quote",
"serde",
@ -2580,7 +2578,7 @@ dependencies = [
"nserror",
"nsstring",
"url",
"uuid 0.8.1",
"uuid",
"xpcom",
]
@ -2643,8 +2641,8 @@ checksum = "a2983372caf4480544083767bf2d27defafe32af49ab4df3a0b7fc90793a3664"
[[package]]
name = "neqo-common"
version = "0.2.0"
source = "git+https://github.com/mozilla/neqo?tag=v0.2.0#b2ae769121dc406561d6bf1d4425f5038162160a"
version = "0.2.1"
source = "git+https://github.com/mozilla/neqo?tag=v0.2.1#5617134612c610e511f6a320b57e63dccf796f94"
dependencies = [
"env_logger",
"lazy_static",
@ -2654,8 +2652,8 @@ dependencies = [
[[package]]
name = "neqo-crypto"
version = "0.2.0"
source = "git+https://github.com/mozilla/neqo?tag=v0.2.0#b2ae769121dc406561d6bf1d4425f5038162160a"
version = "0.2.1"
source = "git+https://github.com/mozilla/neqo?tag=v0.2.1#5617134612c610e511f6a320b57e63dccf796f94"
dependencies = [
"bindgen",
"log",
@ -2667,8 +2665,8 @@ dependencies = [
[[package]]
name = "neqo-http3"
version = "0.2.0"
source = "git+https://github.com/mozilla/neqo?tag=v0.2.0#b2ae769121dc406561d6bf1d4425f5038162160a"
version = "0.2.1"
source = "git+https://github.com/mozilla/neqo?tag=v0.2.1#5617134612c610e511f6a320b57e63dccf796f94"
dependencies = [
"log",
"neqo-common",
@ -2681,8 +2679,8 @@ dependencies = [
[[package]]
name = "neqo-qpack"
version = "0.2.0"
source = "git+https://github.com/mozilla/neqo?tag=v0.2.0#b2ae769121dc406561d6bf1d4425f5038162160a"
version = "0.2.1"
source = "git+https://github.com/mozilla/neqo?tag=v0.2.1#5617134612c610e511f6a320b57e63dccf796f94"
dependencies = [
"log",
"neqo-common",
@ -2692,8 +2690,8 @@ dependencies = [
[[package]]
name = "neqo-transport"
version = "0.2.0"
source = "git+https://github.com/mozilla/neqo?tag=v0.2.0#b2ae769121dc406561d6bf1d4425f5038162160a"
version = "0.2.1"
source = "git+https://github.com/mozilla/neqo?tag=v0.2.1#5617134612c610e511f6a320b57e63dccf796f94"
dependencies = [
"lazy_static",
"log",
@ -2764,11 +2762,12 @@ checksum = "9a2228dca57108069a5262f2ed8bd2e82496d2e074a06d1ccc7ce1687b6ae0a2"
[[package]]
name = "nom"
version = "4.1.1"
version = "5.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c349f68f25f596b9f44cf0e7c69752a5c633b0550c3ff849518bfba0233774a"
checksum = "0b471253da97532da4b61552249c521e01e736071f71c1a4f7ebbfbf0a06aad6"
dependencies = [
"memchr",
"version_check",
]
[[package]]
@ -2892,7 +2891,7 @@ dependencies = [
"parity-wasm",
"scroll",
"target-lexicon 0.9.0",
"uuid 0.8.1",
"uuid",
]
[[package]]
@ -3202,7 +3201,7 @@ dependencies = [
"object",
"rustc-demangle",
"thin-vec",
"uuid 0.8.1",
"uuid",
]
[[package]]
@ -3473,9 +3472,9 @@ dependencies = [
[[package]]
name = "rkv"
version = "0.10.2"
version = "0.10.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9aab7c645d32e977e186448b0a5c2c3139a91a7f630cfd8a8c314d1d145e78bf"
checksum = "30a3dbc1f4971372545ed4175f23ef206c81e5874cd574d153646e7ee78f6793"
dependencies = [
"arrayref",
"bincode",
@ -3488,13 +3487,13 @@ dependencies = [
"serde",
"serde_derive",
"url",
"uuid 0.7.4",
"uuid",
]
[[package]]
name = "rkv"
version = "0.11.0"
source = "git+https://github.com/mozilla/rkv?rev=6a866fdad2ca880df9b87fcbc9921abac1e91914#6a866fdad2ca880df9b87fcbc9921abac1e91914"
version = "0.11.1"
source = "git+https://github.com/mozilla/rkv?rev=e3c3388e6632cf55e08d773b32e58b1cab9b2731#e3c3388e6632cf55e08d773b32e58b1cab9b2731"
dependencies = [
"arrayref",
"bincode",
@ -3509,7 +3508,7 @@ dependencies = [
"serde",
"serde_derive",
"url",
"uuid 0.7.4",
"uuid",
]
[[package]]
@ -4529,9 +4528,9 @@ dependencies = [
[[package]]
name = "unicase"
version = "2.4.0"
version = "2.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a84e5511b2a947f3ae965dcb29b13b7b1691b6e7332cf5dbc1744138d5acb7f6"
checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6"
dependencies = [
"version_check",
]
@ -4595,12 +4594,6 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3df3561629a8bb4c57e5a2e4c43348d9e29c7c29d9b1c4c1f47166deca8f37ed"
[[package]]
name = "uuid"
version = "0.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90dbc611eb48397705a6b0f6e917da23ae517e4d127123d2cf7674206627d32a"
[[package]]
name = "uuid"
version = "0.8.1"
@ -4624,9 +4617,9 @@ checksum = "887b5b631c2ad01628bbbaa7dd4c869f80d3186688f8d0b6f58774fbe324988c"
[[package]]
name = "version_check"
version = "0.1.5"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd"
checksum = "078775d0255232fb988e6fccf26ddc9d1ac274299aaedcedce21c6f72cc533ce"
[[package]]
name = "void"
@ -4783,7 +4776,7 @@ dependencies = [
"rayon",
"thin-vec",
"thread_profiler",
"uuid 0.8.1",
"uuid",
"webrender",
"winapi 0.3.7",
]
@ -4808,9 +4801,9 @@ dependencies = [
[[package]]
name = "weedle"
version = "0.8.0"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "26a4c67f132386d965390b8a734d5d10adbcd30eb5cc74bd9229af8b83f10044"
checksum = "8a7d4f9feb723a800d8f7b74edc9fa44ff35cb0b2ec64886714362f423427f37"
dependencies = [
"nom",
]
@ -5021,7 +5014,7 @@ dependencies = [
"moz_task",
"nserror",
"nsstring",
"rkv 0.10.2",
"rkv 0.10.4",
"serde_json",
"tempfile",
"xpcom",

Просмотреть файл

@ -1 +1 @@
{"files":{"Cargo.lock":"f1b56f3cb914b4ed3214d3ce87d599398b399841718fc938c1b5a309356a44ea","Cargo.toml":"a4656cdd7bd0794e6f10ba78ed3c9a82cd86bfcbec59be7731ee90984de64bde","LICENSE":"c23953d9deb0a3312dbeaf6c128a657f3591acee45067612fa68405eaa4525db","README.md":"5a1f556c6a57c0a6ccc65e19c27718e0f4b32381a8efcc80f6601b33c58c5d59","build.rs":"e1f148e01150af6a66b6af2e5d955c8b9fa092cb4697bae2bcec8a00119055ae","csmith-fuzzing/README.md":"7107b70fedb0c0a0cadb3c439a49c1bd0119a6d38dc63b1aecc74d1942256ef2","src/callbacks.rs":"82e0be9ca02e9a652af934ed546f1cedfc6db0716643123d9a5aab33b360c7d0","src/clang.rs":"66e86bfbbe872cc247cf3bc88a2155e25f587414834023515d184dc13f8f7287","src/codegen/bitfield_unit.rs":"a8fb1a2d97a99685106fcaac87d2013f79d2690d6a46ff05ad1e3629b6075664","src/codegen/bitfield_unit_tests.rs":"dd252134118450800b516e375c872e17b4c1aee63a7b8adbe5b2cd53434bbc7e","src/codegen/error.rs":"ebc9e0f50c6adc9558b76ce774346c02316500a1ebe3cbf56ed00e5e9fe3e456","src/codegen/helpers.rs":"304c9eb56ea6b2c054e1f9fefd5812b0df3a156eee5876f3051fd0b48c7aeac3","src/codegen/impl_debug.rs":"428df604b4be105e3275275e8be81e8306b940abddc1b89675f98a01bf5de8c1","src/codegen/impl_partialeq.rs":"83707f7b13501dc413c904a17163cb54af11e56138f36dfef40ce46c823200fd","src/codegen/mod.rs":"42732503dd25ed4b7924b71862f9100cf281e22f99016540da61a602c78a3650","src/codegen/struct_layout.rs":"482bab6384e65c78346de4f8d8e4d1c3b7df38250788b58bdd1f7b1c7bf70bac","src/extra_assertions.rs":"494534bd4f18b80d89b180c8a93733e6617edcf7deac413e9a73fd6e7bc9ced7","src/features.rs":"2d82f0700c22ea44e010a89c3ae857c3feaf2c85cab3fe4d0277a41a8c2841c4","src/ir/analysis/derive.rs":"2a2322f178760859cdb4b2d45d947ff213c7c684840b4ade46b7ceb34fa6705b","src/ir/analysis/has_destructor.rs":"10380d06ed03d058f10f6f6835d9b8fbebac455a1ea218780430a0ffd8d63472","src/ir/analysis/has_float.rs":"1838ba81eb05a9c3e311687e2247d561cc5093377b15ef8008257025ea56da04","src/ir/analysis/has_type_param_in_array.rs":"dddc5511a705e3a653b5e754e359637031b4862e1a1fc1e17f711fb2fbfc1cef","src/ir/analysis/has_vtable.rs":"8da9deec23c4552ecd5b883eaa036e4f2174a5949194c333a62ef463d28dcb6a","src/ir/analysis/mod.rs":"54993cb77df1870bb12cbc6b3a243c2da942cdc967a7d21dacb430601b49b2a1","src/ir/analysis/sizedness.rs":"d0673e19add38a07680ae3a9a5e998a0b2c3917e68efb6639ffe7ea193ada1b1","src/ir/analysis/template_params.rs":"9b662b5ec99cd8409d771a16ee42df500962b0c26f0da85e430ede19cc2b17c9","src/ir/annotations.rs":"268f90fc1d40fadee329c26b183b2aaa9de98f9246fea580404ee0e626315546","src/ir/comment.rs":"31d64a49ae3d9c3c348fa2539e03306ca3a23fae429cab452e42b31ecf632145","src/ir/comp.rs":"73d5d32d70b8e62d33ad4ed6bcbb9b23273c59b5b45570b85a2357c6e1116028","src/ir/context.rs":"c30be52b22fdb489afb34426bcb2e048ae2594846b15324693dd1b71e7dc3369","src/ir/derive.rs":"e5581852eec87918901a129284b4965aefc8a19394187a8095779a084f28fabe","src/ir/dot.rs":"5da8336bf5fd8efabd784a06e0d764eb91566c19ced8ce017a24ae237f0cbe18","src/ir/enum_ty.rs":"c303f3b271d2703c2487e4afaf4b8c9b5bbedb9e1c6a8044de667c21ad8f67fb","src/ir/function.rs":"7a25a55d7f2ded1724894bd1f7ee4766a4bf5f193967bf3a2628ec604b918018","src/ir/int.rs":"68a86182743ec338d58e42203364dc7c8970cb7ec3550433ca92f0c9489b4442","src/ir/item.rs":"203fe53efb0203e0ddc3fb9fcff7b2068f80f252d249a39c137e0cc070663a49","src/ir/item_kind.rs":"7666a1ff1b8260978b790a08b4139ab56b5c65714a5652bbcec7faa7443adc36","src/ir/layout.rs":"936f96fafab34e35b622a5f9e56b0fbd2c97d2e9222470e3687f882f40db1349","src/ir/mod.rs":"713cd537434567003197a123cbae679602c715e976d22f7b23dafd0826ea4c70","src/ir/module.rs":"a26bb0ac90d4cabb0a45d9c1a42b5515c74d4c233dc084e2f85161eac12bff15","src/ir/objc.rs":"ced8242068d5daa2940469693f7277c79368019f8e30ce1e4f55d834bf24c411","src/ir/template.rs":"6c2823c9bab82ab1d70f4d643e8f4d6420be5eafcb78324fb69649e407561cec","src/ir/traversal.rs":"5ac088277f4dfe2918d81b9294aaee41fd83db8e46def66a05f89de078bf4c49","src/ir/ty.rs":"5af2b62d278c679b7c4e597263fce01113e90242e7d263b948d93bc4274dfe9a","src/ir/var.rs":"9226241b188877b6a7bea6523e14318a8523a6dba57c4f15809c377f87540061","src/lib.rs":"b968f8d0858e3145137a2e33c0913acf19d21f884f914bc513bc18eea1c37bf1","src/log_stubs.rs":"6dfdd908b7c6453da416cf232893768f9480e551ca4add0858ef88bf71ee6ceb","src/main.rs":"6b42a74dfd5c3bde75b7fb984a82f3b3d652abd45aa54b31a40fbda6b02ae674","src/options.rs":"f08facc9d58cb79c7ab93c9d614f13d4d3eca2b5801012da56490a790a8d8c4c","src/parse.rs":"be7d13cc84fae79ec7b3aa9e77063fa475a48d74a854423e2c72d75006a25202","src/regex_set.rs":"5cb72fc3714c0d79e9e942d003349c0775fafd7cd0c9603c65f5261883bbf9cf","src/time.rs":"8efe317e7c6b5ba8e0865ce7b49ca775ee8a02590f4241ef62f647fa3c22b68e"},"package":"ebd71393f1ec0509b553aa012b9b58e81dadbdff7130bd3b8cba576e69b32f75"}
{"files":{"Cargo.lock":"21010e02f3dd565f9184d565a22b36c7bcd2d905fa8eda4e454bf5127a48271f","Cargo.toml":"6236f5ccbfbeed5ff84a3c353bbf7048b5670bea0e3538e4994d1f88f1bdf4c3","LICENSE":"c23953d9deb0a3312dbeaf6c128a657f3591acee45067612fa68405eaa4525db","README.md":"5a1f556c6a57c0a6ccc65e19c27718e0f4b32381a8efcc80f6601b33c58c5d59","build.rs":"e1f148e01150af6a66b6af2e5d955c8b9fa092cb4697bae2bcec8a00119055ae","csmith-fuzzing/README.md":"7107b70fedb0c0a0cadb3c439a49c1bd0119a6d38dc63b1aecc74d1942256ef2","src/callbacks.rs":"1e7af281981d26e70e079c7b6569e3c786c298be9cb04872764d73e8d721f053","src/clang.rs":"3b3015a068394e14ab09f41091b0aa3b12eb75e4482052797ce3240cdc3a0aa3","src/codegen/bitfield_unit.rs":"a8fb1a2d97a99685106fcaac87d2013f79d2690d6a46ff05ad1e3629b6075664","src/codegen/bitfield_unit_tests.rs":"dd252134118450800b516e375c872e17b4c1aee63a7b8adbe5b2cd53434bbc7e","src/codegen/error.rs":"5e308b8c54b68511fc8ea2ad15ddac510172c4ff460a80a265336440b0c9653d","src/codegen/helpers.rs":"00af02fd70f7e0a3293bbcb6d76a63908dd163e6ac435e44254c399575afe5ae","src/codegen/impl_debug.rs":"428df604b4be105e3275275e8be81e8306b940abddc1b89675f98a01bf5de8c1","src/codegen/impl_partialeq.rs":"83707f7b13501dc413c904a17163cb54af11e56138f36dfef40ce46c823200fd","src/codegen/mod.rs":"8f0d433412823fa85841d25ff626f50850c6903b145d3c79688eceb0b2c3071c","src/codegen/struct_layout.rs":"0bd30896a81ffb4aa0453602f7a7f38c246fdb8624841bfe55984d6829b46cc4","src/extra_assertions.rs":"494534bd4f18b80d89b180c8a93733e6617edcf7deac413e9a73fd6e7bc9ced7","src/features.rs":"fafb85510b1dfc9a41ed71f7d765fca49b236deb4ee567e00204e751362aaf23","src/ir/analysis/derive.rs":"6e25c277a1acf0565b962a28a272c57661de7e8cb272516f0ee41f04883858ac","src/ir/analysis/has_destructor.rs":"10380d06ed03d058f10f6f6835d9b8fbebac455a1ea218780430a0ffd8d63472","src/ir/analysis/has_float.rs":"1838ba81eb05a9c3e311687e2247d561cc5093377b15ef8008257025ea56da04","src/ir/analysis/has_type_param_in_array.rs":"dddc5511a705e3a653b5e754e359637031b4862e1a1fc1e17f711fb2fbfc1cef","src/ir/analysis/has_vtable.rs":"8da9deec23c4552ecd5b883eaa036e4f2174a5949194c333a62ef463d28dcb6a","src/ir/analysis/mod.rs":"54993cb77df1870bb12cbc6b3a243c2da942cdc967a7d21dacb430601b49b2a1","src/ir/analysis/sizedness.rs":"d0673e19add38a07680ae3a9a5e998a0b2c3917e68efb6639ffe7ea193ada1b1","src/ir/analysis/template_params.rs":"9b662b5ec99cd8409d771a16ee42df500962b0c26f0da85e430ede19cc2b17c9","src/ir/annotations.rs":"268f90fc1d40fadee329c26b183b2aaa9de98f9246fea580404ee0e626315546","src/ir/comment.rs":"31d64a49ae3d9c3c348fa2539e03306ca3a23fae429cab452e42b31ecf632145","src/ir/comp.rs":"4a65eeb1b59fe44b49f453cdaa2616a8eb17fb67de85856bd0522fd4fc0858be","src/ir/context.rs":"59abb2cf8e8169c4247a50298c6a96407f10d7dd736959bdbdf152ef4f502685","src/ir/derive.rs":"e5581852eec87918901a129284b4965aefc8a19394187a8095779a084f28fabe","src/ir/dot.rs":"e25ff72ac174a798894c9673d81bdfb86fa9f4228b34a14ce0dc741a186a52bd","src/ir/enum_ty.rs":"f92220c9603c0746412b605f79f83774bfaa6c2272895945eeb504e6b98d54ef","src/ir/function.rs":"ce4fae30af77eeba74486462a13104e49888c2ba1bcefa8a6654fcf3056ffa06","src/ir/int.rs":"68a86182743ec338d58e42203364dc7c8970cb7ec3550433ca92f0c9489b4442","src/ir/item.rs":"d0804c62421e2c7afefd8844c0231f6f3ee995af6d376446740af425c8cbfb4e","src/ir/item_kind.rs":"7666a1ff1b8260978b790a08b4139ab56b5c65714a5652bbcec7faa7443adc36","src/ir/layout.rs":"936f96fafab34e35b622a5f9e56b0fbd2c97d2e9222470e3687f882f40db1349","src/ir/mod.rs":"713cd537434567003197a123cbae679602c715e976d22f7b23dafd0826ea4c70","src/ir/module.rs":"a26bb0ac90d4cabb0a45d9c1a42b5515c74d4c233dc084e2f85161eac12bff15","src/ir/objc.rs":"a637a0e759fd8d1eaed1afc32f494cb35456b8b1af402c6d59c72b5b29018ebf","src/ir/template.rs":"6c2823c9bab82ab1d70f4d643e8f4d6420be5eafcb78324fb69649e407561cec","src/ir/traversal.rs":"5ac088277f4dfe2918d81b9294aaee41fd83db8e46def66a05f89de078bf4c49","src/ir/ty.rs":"5af2b62d278c679b7c4e597263fce01113e90242e7d263b948d93bc4274dfe9a","src/ir/var.rs":"c5f4bd722a1f7f9e4b1d738204fde3fb47c95778369b83b29e8662211e1717d0","src/lib.rs":"6dfec11ff44c30a67942bc9383a48b9073b08f920af9e06eaecc0fc7c891ba7d","src/log_stubs.rs":"6dfdd908b7c6453da416cf232893768f9480e551ca4add0858ef88bf71ee6ceb","src/main.rs":"d38160b4060fe4fcb286a30f6bd6824764555f6a2c594b5c564d65f4a2ba00de","src/options.rs":"5edc1dae279a95642fbdeb20ffdb447e1fdaf463c90a9b434b984d7e3c718214","src/parse.rs":"be7d13cc84fae79ec7b3aa9e77063fa475a48d74a854423e2c72d75006a25202","src/regex_set.rs":"5cb72fc3714c0d79e9e942d003349c0775fafd7cd0c9603c65f5261883bbf9cf","src/time.rs":"8efe317e7c6b5ba8e0865ce7b49ca775ee8a02590f4241ef62f647fa3c22b68e"},"package":"6bb26d6a69a335b8cb0e7c7e9775cd5666611dc50a37177c3f2cedcfc040e8c8"}

271
third_party/rust/bindgen/Cargo.lock сгенерированный поставляемый
Просмотреть файл

@ -2,10 +2,10 @@
# It is not intended for manual editing.
[[package]]
name = "aho-corasick"
version = "0.6.8"
version = "0.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"memchr 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -13,36 +13,36 @@ name = "ansi_term"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "atty"
version = "0.2.11"
version = "0.2.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
"termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "bindgen"
version = "0.51.1"
version = "0.53.2"
dependencies = [
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"cexpr 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"clang-sys 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)",
"clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cexpr 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
"clang-sys 0.29.0 (registry+https://github.com/rust-lang/crates.io-index)",
"clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)",
"diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
"env_logger 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"env_logger 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"peeking_take_while 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"shlex 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"which 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -50,53 +50,53 @@ dependencies = [
[[package]]
name = "bitflags"
version = "1.0.4"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "byteorder"
version = "1.2.7"
version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "cc"
version = "1.0.25"
version = "1.0.45"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "cexpr"
version = "0.3.3"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"nom 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"nom 5.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "cfg-if"
version = "0.1.5"
version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "clang-sys"
version = "0.28.0"
version = "0.29.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
"libloading 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
"libloading 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "clap"
version = "2.32.0"
version = "2.33.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -107,24 +107,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "env_logger"
version = "0.6.0"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"humantime 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
"termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
"humantime 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"termcolor 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "glob"
version = "0.2.11"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "humantime"
version = "1.1.1"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -132,50 +132,48 @@ dependencies = [
[[package]]
name = "lazy_static"
version = "1.1.0"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "lazycell"
version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"version_check 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "libc"
version = "0.2.43"
version = "0.2.66"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "libloading"
version = "0.5.0"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
"cc 1.0.45 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "log"
version = "0.4.5"
version = "0.4.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "memchr"
version = "2.1.0"
version = "2.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
"version_check 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "nom"
version = "4.0.0"
version = "5.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"memchr 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"version_check 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -185,7 +183,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "proc-macro2"
version = "1.0.0"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -198,51 +196,34 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "quote"
version = "1.0.0"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "redox_syscall"
version = "0.1.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "redox_termios"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "regex"
version = "1.0.5"
version = "1.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"aho-corasick 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)",
"memchr 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"regex-syntax 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
"aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)",
"memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"regex-syntax 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)",
"thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"utf8-ranges 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "regex-syntax"
version = "0.6.2"
version = "0.6.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"ucd-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "rustc-hash"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -252,33 +233,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "strsim"
version = "0.7.0"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "termcolor"
version = "1.0.4"
version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"wincolor 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "termion"
version = "1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
"redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)",
"redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"wincolor 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "textwrap"
version = "0.10.0"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -286,17 +257,12 @@ name = "thread_local"
version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "ucd-util"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "unicode-width"
version = "0.1.5"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
@ -304,11 +270,6 @@ name = "unicode-xid"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "utf8-ranges"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "vec_map"
version = "0.8.1"
@ -316,7 +277,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "version_check"
version = "0.1.4"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
@ -324,12 +285,12 @@ name = "which"
version = "3.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "winapi"
version = "0.3.5"
version = "0.3.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -343,10 +304,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "winapi-util"
version = "0.1.1"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -356,58 +317,54 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "wincolor"
version = "1.0.1"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[metadata]
"checksum aho-corasick 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)" = "68f56c7353e5a9547cbd76ed90f7bb5ffc3ba09d4ea9bd1d8c06c8b1142eeb5a"
"checksum aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "58fb5e95d83b38284460a5fda7d6470aa0b8844d283a0b614b8535e880800d2d"
"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
"checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652"
"checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12"
"checksum byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "94f88df23a25417badc922ab0f5716cc1330e87f71ddd9203b3a3ccd9cedf75d"
"checksum cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)" = "f159dfd43363c4d08055a07703eb7a3406b0dac4d0584d96965a3262db3c9d16"
"checksum cexpr 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8fc0086be9ca82f7fc89fc873435531cb898b86e850005850de1f820e2db6e9b"
"checksum cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0c4e7bb64a8ebb0d856483e1e682ea3422f883c5f5615a90d51a2c82fe87fdd3"
"checksum clang-sys 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4227269cec09f5f83ff160be12a1e9b0262dd1aa305302d5ba296c2ebd291055"
"checksum clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b957d88f4b6a63b9d70d5f454ac8011819c6efa7727858f458ab71c756ce2d3e"
"checksum atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "1803c647a3ec87095e7ae7acfca019e98de5ec9a7d01343f611cf3152ed71a90"
"checksum bitflags 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8a606a02debe2813760609f57a64a2ffd27d9fdf5b2f133eaca0b248dd92cdd2"
"checksum byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c3dd8985a7111efc5c80b44e23ecdd8c007de8ade3b96595387e812b957cf5"
"checksum cc 1.0.45 (registry+https://github.com/rust-lang/crates.io-index)" = "4fc9a35e1f4290eb9e5fc54ba6cf40671ed2a2514c3eeb2b2a908dda2ea5a1be"
"checksum cexpr 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f4aedb84272dbe89af497cf81375129abda4fc0a9e7c5d317498c15cc30c0d27"
"checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
"checksum clang-sys 0.29.0 (registry+https://github.com/rust-lang/crates.io-index)" = "03542fa2ed0accba4a5c84ec031f09a20b725e7ba1b1c9b79f1feb4aa17d0c07"
"checksum clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9"
"checksum diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "3c2b69f912779fbb121ceb775d74d51e915af17aaebc38d28a592843a2dd0a3a"
"checksum env_logger 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "afb070faf94c85d17d50ca44f6ad076bce18ae92f0037d350947240a36e9d42e"
"checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb"
"checksum humantime 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0484fda3e7007f2a4a0d9c3a703ca38c71c54c55602ce4660c419fd32e188c9e"
"checksum lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca488b89a5657b0a2ecd45b95609b3e848cf1755da332a0da46e2b2b1cb371a7"
"checksum libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)" = "76e3a3ef172f1a0b9a9ff0dd1491ae5e6c948b94479a3021819ba7d860c8645d"
"checksum libloading 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9c3ad660d7cb8c5822cd83d10897b0f1f1526792737a179e73896152f85b88c2"
"checksum log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "d4fcce5fa49cc693c312001daf1d13411c4a5283796bac1084299ea3e567113f"
"checksum memchr 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4b3629fe9fdbff6daa6c33b90f7c08355c1aca05a3d01fa8063b822fcf185f3b"
"checksum nom 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "898696750eb5c3ce5eb5afbfbe46e7f7c4e1936e19d3e97be4b7937da7b6d114"
"checksum env_logger 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "39ecdb7dd54465526f0a56d666e3b2dd5f3a218665a030b6e4ad9e70fa95d8fa"
"checksum glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
"checksum humantime 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f"
"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
"checksum lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f"
"checksum libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)" = "d515b1f41455adea1313a4a2ac8a8a477634fbae63cc6100e3aebb207ce61558"
"checksum libloading 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f2b111a074963af1d37a139918ac6d49ad1d0d5e47f72fd55388619691a7d753"
"checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7"
"checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e"
"checksum nom 5.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0b471253da97532da4b61552249c521e01e736071f71c1a4f7ebbfbf0a06aad6"
"checksum peeking_take_while 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099"
"checksum proc-macro2 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "19f287c234c9b2d0308d692dee5c449c1a171167a6f8150f7cf2a49d8fd96967"
"checksum proc-macro2 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "afdc77cc74ec70ed262262942ebb7dac3d479e9e5cfa2da1841c0806f6cdabcc"
"checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0"
"checksum quote 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7ab938ebe6f1c82426b5fb82eaf10c3e3028c53deaa3fbe38f5904b37cf4d767"
"checksum redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "c214e91d3ecf43e9a4e41e578973adeb14b474f2bee858742d127af75a0112b1"
"checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76"
"checksum regex 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "2069749032ea3ec200ca51e4a31df41759190a88edca0d2d86ee8bedf7073341"
"checksum regex-syntax 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "747ba3b235651f6e2f67dfa8bcdcd073ddb7c243cb21c442fc12395dfcac212d"
"checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe"
"checksum regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dc220bd33bdce8f093101afe22a037b8eb0e5af33592e6a9caafff0d4cb81cbd"
"checksum regex-syntax 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)" = "11a7e20d1cce64ef2fed88b66d347f88bd9babb82845b2b858f3edbf59a4f716"
"checksum rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7540fc8b0c49f096ee9c961cda096467dce8084bec6bdca2fc83895fd9b28cb8"
"checksum shlex 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2"
"checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550"
"checksum termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4096add70612622289f2fdcdbd5086dc81c1e2675e6ae58d6c4f62a16c6d7f2f"
"checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096"
"checksum textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "307686869c93e71f94da64286f9a9524c0f308a9e1c87a583de8e9c9039ad3f6"
"checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
"checksum termcolor 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "96d6098003bde162e4277c70665bd87c326f5a0c3f3fbfb285787fa482d54e6e"
"checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
"checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b"
"checksum ucd-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fd2be2d6639d0f8fe6cdda291ad456e23629558d466e2789d2c3e9892bda285d"
"checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526"
"checksum unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7007dbd421b92cc6e28410fe7362e2e0a2503394908f417b68ec8d1c364c4e20"
"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c"
"checksum utf8-ranges 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fd70f467df6810094968e2fce0ee1bd0e87157aceb026a8c083bcf5e25b9efe4"
"checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a"
"checksum version_check 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "7716c242968ee87e5542f8021178248f267f295a5c4803beae8b8b7fd9bc6051"
"checksum version_check 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "078775d0255232fb988e6fccf26ddc9d1ac274299aaedcedce21c6f72cc533ce"
"checksum which 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "240a31163872f7e8e49f35b42b58485e35355b07eb009d9f3686733541339a69"
"checksum winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "773ef9dcc5f24b7d850d0ff101e542ff24c3b090a9768e03ff889fdef41f00fd"
"checksum winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6"
"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
"checksum winapi-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "afc5508759c5bf4285e61feb862b6083c8480aec864fa17a81fdec6f69b461ab"
"checksum winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7168bab6e1daee33b4557efd0e95d5ca70a03706d39fa5f3fe7a236f584b03c9"
"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
"checksum wincolor 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "561ed901ae465d6185fa7864d63fbd5720d0ef718366c9a4dc83cf6170d7e9ba"
"checksum wincolor 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "96f5016b18804d24db43cebf3c77269e7569b8954a8464501c216cc5e070eaa9"

21
third_party/rust/bindgen/Cargo.toml поставляемый
Просмотреть файл

@ -12,7 +12,7 @@
[package]
name = "bindgen"
version = "0.51.1"
version = "0.53.2"
authors = ["Jyun-Yan You <jyyou.tw@gmail.com>", "Emilio Cobos Álvarez <emilio@crisal.io>", "Nick Fitzgerald <fitzgen@gmail.com>", "The Servo project developers"]
build = "build.rs"
include = ["LICENSE", "README.md", "Cargo.toml", "build.rs", "src/*.rs", "src/**/*.rs"]
@ -37,26 +37,29 @@ required-features = ["clap"]
version = "1.0.3"
[dependencies.cexpr]
version = "0.3.3"
version = "0.4"
[dependencies.cfg-if]
version = "0.1.0"
[dependencies.clang-sys]
version = "0.28.0"
features = ["runtime", "clang_6_0"]
version = "0.29"
features = ["clang_6_0"]
[dependencies.clap]
version = "2"
optional = true
[dependencies.env_logger]
version = "0.6"
version = "0.7"
optional = true
[dependencies.lazy_static]
version = "1"
[dependencies.lazycell]
version = "1"
[dependencies.log]
version = "0.4"
optional = true
@ -74,6 +77,8 @@ default-features = false
[dependencies.regex]
version = "1.0"
features = ["std", "unicode"]
default-features = false
[dependencies.rustc-hash]
version = "1.0.1"
@ -95,15 +100,17 @@ version = "0.1"
version = "0.1"
[features]
default = ["logging", "clap", "which-rustfmt"]
default = ["logging", "clap", "runtime", "which-rustfmt"]
logging = ["env_logger", "log"]
static = []
runtime = ["clang-sys/runtime"]
static = ["clang-sys/static"]
testing_only_docs = []
testing_only_extra_assertions = []
testing_only_libclang_3_8 = []
testing_only_libclang_3_9 = []
testing_only_libclang_4 = []
testing_only_libclang_5 = []
testing_only_libclang_9 = []
which-rustfmt = ["which"]
[badges.travis-ci]
repository = "rust-lang/rust-bindgen"

3
third_party/rust/bindgen/src/callbacks.rs поставляемый
Просмотреть файл

@ -64,4 +64,7 @@ pub trait ParseCallbacks: fmt::Debug + UnwindSafe {
fn item_name(&self, _original_item_name: &str) -> Option<String> {
None
}
/// This will be called on every file inclusion, with the full path of the included file.
fn include_file(&self, _filename: &str) {}
}

49
third_party/rust/bindgen/src/clang.rs поставляемый
Просмотреть файл

@ -527,25 +527,32 @@ impl Cursor {
}
}
/// Does this cursor have the given simple attribute?
/// Whether this cursor has the `warn_unused_result` attribute.
pub fn has_warn_unused_result_attr(&self) -> bool {
// FIXME(emilio): clang-sys doesn't expose this (from clang 9).
const CXCursor_WarnUnusedResultAttr: CXCursorKind = 440;
self.has_attr("warn_unused_result", Some(CXCursor_WarnUnusedResultAttr))
}
/// Does this cursor have the given attribute?
///
/// Note that this will only work for attributes that don't have an existing libclang
/// CursorKind, e.g. pure, const, etc.
pub fn has_simple_attr(&self, attr: &str) -> bool {
/// `name` is checked against unexposed attributes.
fn has_attr(&self, name: &str, clang_kind: Option<CXCursorKind>) -> bool {
let mut found_attr = false;
self.visit(|cur| {
if cur.kind() == CXCursor_UnexposedAttr {
found_attr = cur.tokens().iter().any(|t| {
t.kind == CXToken_Identifier &&
t.spelling() == attr.as_bytes()
});
let kind = cur.kind();
found_attr = clang_kind.map_or(false, |k| k == kind) ||
(kind == CXCursor_UnexposedAttr &&
cur.tokens().iter().any(|t| {
t.kind == CXToken_Identifier &&
t.spelling() == name.as_bytes()
}));
if found_attr {
return CXChildVisit_Break;
}
if found_attr {
CXChildVisit_Break
} else {
CXChildVisit_Continue
}
CXChildVisit_Continue
});
found_attr
@ -717,6 +724,20 @@ impl Cursor {
})
.collect()
}
/// Obtain the real path name of a cursor of InclusionDirective kind.
///
/// Returns None if the cursor does not include a file, otherwise the file's full name
pub fn get_included_file_name(&self) -> Option<String> {
let file = unsafe { clang_sys::clang_getIncludedFile(self.x) };
if file.is_null() {
None
} else {
Some(unsafe {
cxstring_into_string(clang_sys::clang_getFileName(file))
})
}
}
}
/// A struct that owns the tokenizer result from a given cursor.

16
third_party/rust/bindgen/src/codegen/error.rs поставляемый
Просмотреть файл

@ -15,17 +15,7 @@ pub enum Error {
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", error::Error::description(self))
}
}
impl error::Error for Error {
fn cause(&self) -> Option<&dyn error::Error> {
None
}
fn description(&self) -> &'static str {
match *self {
f.write_str(match *self {
Error::NoLayoutForOpaqueBlob => {
"Tried to generate an opaque blob, but had no layout"
}
@ -33,9 +23,11 @@ impl error::Error for Error {
"Instantiation of opaque template type or partial template \
specialization"
}
}
})
}
}
impl error::Error for Error {}
/// A `Result` of `T` or an error of `bindgen::codegen::error::Error`.
pub type Result<T> = ::std::result::Result<T, Error>;

Просмотреть файл

@ -143,6 +143,27 @@ pub mod ast_ty {
use proc_macro2::{self, TokenStream};
use std::str::FromStr;
pub fn c_void(ctx: &BindgenContext) -> TokenStream {
// ctypes_prefix takes precedence
match ctx.options().ctypes_prefix {
Some(ref prefix) => {
let prefix = TokenStream::from_str(prefix.as_str()).unwrap();
quote! {
#prefix::c_void
}
}
None => {
if ctx.options().use_core &&
ctx.options().rust_features.core_ffi_c_void
{
quote! { ::core::ffi::c_void }
} else {
quote! { ::std::os::raw::c_void }
}
}
}
}
pub fn raw_type(ctx: &BindgenContext, name: &str) -> TokenStream {
let ident = ctx.rust_ident_raw(name);
match ctx.options().ctypes_prefix {

327
third_party/rust/bindgen/src/codegen/mod.rs поставляемый
Просмотреть файл

@ -703,7 +703,8 @@ impl CodeGenerator for Type {
let mut outer_params = item.used_template_params(ctx);
let inner_rust_type = if item.is_opaque(ctx, &()) {
let is_opaque = item.is_opaque(ctx, &());
let inner_rust_type = if is_opaque {
outer_params = vec![];
self.to_opaque(ctx, item)
} else {
@ -748,6 +749,16 @@ impl CodeGenerator for Type {
quote! {}
};
let alias_style = if ctx.options().type_alias.matches(&name) {
AliasVariation::TypeAlias
} else if ctx.options().new_type_alias.matches(&name) {
AliasVariation::NewType
} else if ctx.options().new_type_alias_deref.matches(&name) {
AliasVariation::NewTypeDeref
} else {
ctx.options().default_alias_style
};
// We prefer using `pub use` over `pub type` because of:
// https://github.com/rust-lang/rust/issues/26264
if inner_rust_type.to_string().chars().all(|c| match c {
@ -756,6 +767,8 @@ impl CodeGenerator for Type {
'A'..='Z' | 'a'..='z' | '0'..='9' | ':' | '_' | ' ' => true,
_ => false,
}) && outer_params.is_empty() &&
!is_opaque &&
alias_style == AliasVariation::TypeAlias &&
inner_item.expect_type().canonical_type(ctx).is_enum()
{
tokens.append_all(quote! {
@ -770,8 +783,21 @@ impl CodeGenerator for Type {
return;
}
tokens.append_all(quote! {
pub type #rust_name
tokens.append_all(match alias_style {
AliasVariation::TypeAlias => quote! {
pub type #rust_name
},
AliasVariation::NewType | AliasVariation::NewTypeDeref => {
assert!(
ctx.options().rust_features().repr_transparent,
"repr_transparent feature is required to use {:?}",
alias_style
);
quote! {
#[repr(transparent)]
pub struct #rust_name
}
}
});
let params: Vec<_> = outer_params
@ -804,10 +830,36 @@ impl CodeGenerator for Type {
});
}
tokens.append_all(quote! {
= #inner_rust_type ;
tokens.append_all(match alias_style {
AliasVariation::TypeAlias => quote! {
= #inner_rust_type ;
},
AliasVariation::NewType | AliasVariation::NewTypeDeref => {
quote! {
(pub #inner_rust_type) ;
}
}
});
if alias_style == AliasVariation::NewTypeDeref {
let prefix = ctx.trait_prefix();
tokens.append_all(quote! {
impl ::#prefix::ops::Deref for #rust_name {
type Target = #inner_rust_type;
#[inline]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl ::#prefix::ops::DerefMut for #rust_name {
#[inline]
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}
});
}
result.push(tokens);
}
TypeKind::Enum(ref ei) => ei.codegen(ctx, result, item),
@ -861,7 +913,7 @@ impl<'a> CodeGenerator for Vtable<'a> {
// For now, generate an empty struct, later we should generate function
// pointers and whatnot.
let name = ctx.rust_ident(&self.canonical_name(ctx));
let void = helpers::ast_ty::raw_type(ctx, "c_void");
let void = helpers::ast_ty::c_void(ctx);
result.push(quote! {
#[repr(C)]
pub struct #name ( #void );
@ -1200,12 +1252,8 @@ impl BitfieldUnit {
impl Bitfield {
/// Extend an under construction bitfield unit constructor with this
/// bitfield. This involves two things:
///
/// 1. Adding a parameter with this bitfield's name and its type.
///
/// 2. Setting the relevant bits on the `__bindgen_bitfield_unit` variable
/// that's being constructed.
/// bitfield. This sets the relevant bits on the `__bindgen_bitfield_unit`
/// variable that's being constructed.
fn extend_ctor_impl(
&self,
ctx: &BindgenContext,
@ -1216,7 +1264,11 @@ impl Bitfield {
let bitfield_ty_layout = bitfield_ty
.layout(ctx)
.expect("Bitfield without layout? Gah!");
let bitfield_int_ty = helpers::blob(ctx, bitfield_ty_layout);
let bitfield_int_ty = helpers::integer_type(ctx, bitfield_ty_layout)
.expect(
"Should already have verified that the bitfield is \
representable as an int",
);
let offset = self.offset_into_unit();
let width = self.width() as u8;
@ -1258,23 +1310,26 @@ impl<'a> FieldCodegen<'a> for BitfieldUnit {
F: Extend<proc_macro2::TokenStream>,
M: Extend<proc_macro2::TokenStream>,
{
use ir::ty::RUST_DERIVE_IN_ARRAY_LIMIT;
result.saw_bitfield_unit();
let layout = self.layout();
let unit_field_ty = helpers::bitfield_unit(ctx, layout);
let field_ty = {
let ty = helpers::bitfield_unit(ctx, self.layout());
if parent.is_union() && !parent.can_be_rust_union(ctx) {
result.saw_bindgen_union();
if ctx.options().enable_cxx_namespaces {
quote! {
root::__BindgenUnionField<#ty>
root::__BindgenUnionField<#unit_field_ty>
}
} else {
quote! {
__BindgenUnionField<#ty>
__BindgenUnionField<#unit_field_ty>
}
}
} else {
ty
unit_field_ty.clone()
}
};
@ -1286,12 +1341,13 @@ impl<'a> FieldCodegen<'a> for BitfieldUnit {
};
fields.extend(Some(field));
let unit_field_ty = helpers::bitfield_unit(ctx, self.layout());
let ctor_name = self.ctor_name();
let mut ctor_params = vec![];
let mut ctor_impl = quote! {};
let mut generate_ctor = true;
// We cannot generate any constructor if the underlying storage can't
// implement AsRef<[u8]> / AsMut<[u8]> / etc.
let mut generate_ctor = layout.size <= RUST_DERIVE_IN_ARRAY_LIMIT;
for bf in self.bitfields() {
// Codegen not allowed for anonymous bitfields
@ -1299,6 +1355,10 @@ impl<'a> FieldCodegen<'a> for BitfieldUnit {
continue;
}
if layout.size > RUST_DERIVE_IN_ARRAY_LIMIT {
continue;
}
let mut bitfield_representable_as_int = true;
bf.codegen(
@ -1343,7 +1403,7 @@ impl<'a> FieldCodegen<'a> for BitfieldUnit {
}));
}
struct_layout.saw_bitfield_unit(self.layout());
struct_layout.saw_bitfield_unit(layout);
}
}
@ -2154,13 +2214,26 @@ impl MethodCodegen for Method {
// variable called `__bindgen_tmp` we're going to create.
if self.is_constructor() {
let prefix = ctx.trait_prefix();
let tmp_variable_decl = quote! {
let mut __bindgen_tmp = ::#prefix::mem::uninitialized()
let tmp_variable_decl = if ctx
.options()
.rust_features()
.maybe_uninit
{
exprs[0] = quote! {
__bindgen_tmp.as_mut_ptr()
};
quote! {
let mut __bindgen_tmp = ::#prefix::mem::MaybeUninit::uninit()
}
} else {
exprs[0] = quote! {
&mut __bindgen_tmp
};
quote! {
let mut __bindgen_tmp = ::#prefix::mem::uninitialized()
}
};
stmts.push(tmp_variable_decl);
exprs[0] = quote! {
&mut __bindgen_tmp
};
} else if !self.is_static() {
assert!(!exprs.is_empty());
exprs[0] = quote! {
@ -2175,9 +2248,15 @@ impl MethodCodegen for Method {
stmts.push(call);
if self.is_constructor() {
stmts.push(quote! {
__bindgen_tmp
});
stmts.push(if ctx.options().rust_features().maybe_uninit {
quote! {
__bindgen_tmp.assume_init()
}
} else {
quote! {
__bindgen_tmp
}
})
}
let block = quote! {
@ -2208,11 +2287,14 @@ impl MethodCodegen for Method {
pub enum EnumVariation {
/// The code for this enum will use a Rust enum
Rust {
/// Indicates whether the generated struct should be #[non_exhaustive]
/// Indicates whether the generated struct should be `#[non_exhaustive]`
non_exhaustive: bool,
},
/// The code for this enum will use a bitfield
Bitfield,
/// The code for this enum will use a newtype
NewType {
/// Indicates whether the newtype will have bitwise operators
is_bitfield: bool,
},
/// The code for this enum will use consts
Consts,
/// The code for this enum will use a module containing consts
@ -2249,15 +2331,24 @@ impl std::str::FromStr for EnumVariation {
/// Create a `EnumVariation` from a string.
fn from_str(s: &str) -> Result<Self, Self::Err> {
match s {
"rust" => Ok(EnumVariation::Rust{ non_exhaustive: false }),
"rust_non_exhaustive" => Ok(EnumVariation::Rust{ non_exhaustive: true }),
"bitfield" => Ok(EnumVariation::Bitfield),
"rust" => Ok(EnumVariation::Rust {
non_exhaustive: false,
}),
"rust_non_exhaustive" => Ok(EnumVariation::Rust {
non_exhaustive: true,
}),
"bitfield" => Ok(EnumVariation::NewType { is_bitfield: true }),
"consts" => Ok(EnumVariation::Consts),
"moduleconsts" => Ok(EnumVariation::ModuleConsts),
_ => Err(std::io::Error::new(std::io::ErrorKind::InvalidInput,
concat!("Got an invalid EnumVariation. Accepted values ",
"are 'rust', 'rust_non_exhaustive', 'bitfield', 'consts', and ",
"'moduleconsts'."))),
"newtype" => Ok(EnumVariation::NewType { is_bitfield: false }),
_ => Err(std::io::Error::new(
std::io::ErrorKind::InvalidInput,
concat!(
"Got an invalid EnumVariation. Accepted values ",
"are 'rust', 'rust_non_exhaustive', 'bitfield', 'consts',",
"'moduleconsts', and 'newtype'."
),
)),
}
}
}
@ -2271,10 +2362,11 @@ enum EnumBuilder<'a> {
tokens: proc_macro2::TokenStream,
emitted_any_variants: bool,
},
Bitfield {
NewType {
codegen_depth: usize,
canonical_name: &'a str,
tokens: proc_macro2::TokenStream,
is_bitfield: bool,
},
Consts {
variants: Vec<proc_macro2::TokenStream>,
@ -2292,7 +2384,7 @@ impl<'a> EnumBuilder<'a> {
fn codegen_depth(&self) -> usize {
match *self {
EnumBuilder::Rust { codegen_depth, .. } |
EnumBuilder::Bitfield { codegen_depth, .. } |
EnumBuilder::NewType { codegen_depth, .. } |
EnumBuilder::ModuleConsts { codegen_depth, .. } |
EnumBuilder::Consts { codegen_depth, .. } => codegen_depth,
}
@ -2310,13 +2402,14 @@ impl<'a> EnumBuilder<'a> {
let ident = Ident::new(name, Span::call_site());
match enum_variation {
EnumVariation::Bitfield => EnumBuilder::Bitfield {
EnumVariation::NewType { is_bitfield } => EnumBuilder::NewType {
codegen_depth: enum_codegen_depth,
canonical_name: name,
tokens: quote! {
#( #attrs )*
pub struct #ident (pub #repr);
},
is_bitfield,
},
EnumVariation::Rust { .. } => {
@ -2404,7 +2497,7 @@ impl<'a> EnumBuilder<'a> {
}
}
EnumBuilder::Bitfield { canonical_name, .. } => {
EnumBuilder::NewType { canonical_name, .. } => {
if ctx.options().rust_features().associated_const && is_ty_named
{
let enum_ident = ctx.rust_ident(canonical_name);
@ -2495,11 +2588,16 @@ impl<'a> EnumBuilder<'a> {
}
}
}
EnumBuilder::Bitfield {
EnumBuilder::NewType {
canonical_name,
tokens,
is_bitfield,
..
} => {
if !is_bitfield {
return tokens;
}
let rust_ty_name = ctx.rust_ident_raw(canonical_name);
let prefix = ctx.trait_prefix();
@ -2633,7 +2731,7 @@ impl CodeGenerator for Enum {
panic!("The rust target you're using doesn't seem to support non_exhaustive enums");
}
}
EnumVariation::Bitfield => {
EnumVariation::NewType { .. } => {
if ctx.options().rust_features.repr_transparent {
attrs.push(attributes::repr("transparent"));
} else {
@ -2849,6 +2947,54 @@ impl CodeGenerator for Enum {
}
}
/// Enum for how aliases should be translated.
#[derive(Copy, Clone, PartialEq, Debug)]
pub enum AliasVariation {
/// Convert to regular Rust alias
TypeAlias,
/// Create a new type by wrapping the old type in a struct and using #[repr(transparent)]
NewType,
/// Same as NewStruct but also impl Deref to be able to use the methods of the wrapped type
NewTypeDeref,
}
impl AliasVariation {
/// Convert an `AliasVariation` to its str representation.
pub fn as_str(&self) -> &str {
match self {
AliasVariation::TypeAlias => "type_alias",
AliasVariation::NewType => "new_type",
AliasVariation::NewTypeDeref => "new_type_deref",
}
}
}
impl Default for AliasVariation {
fn default() -> AliasVariation {
AliasVariation::TypeAlias
}
}
impl std::str::FromStr for AliasVariation {
type Err = std::io::Error;
/// Create an `AliasVariation` from a string.
fn from_str(s: &str) -> Result<Self, Self::Err> {
match s {
"type_alias" => Ok(AliasVariation::TypeAlias),
"new_type" => Ok(AliasVariation::NewType),
"new_type_deref" => Ok(AliasVariation::NewTypeDeref),
_ => Err(std::io::Error::new(
std::io::ErrorKind::InvalidInput,
concat!(
"Got an invalid AliasVariation. Accepted values ",
"are 'type_alias', 'new_type', and 'new_type_deref'"
),
)),
}
}
}
/// Fallible conversion to an opaque blob.
///
/// Implementors of this trait should provide the `try_get_layout` method to
@ -3076,10 +3222,10 @@ impl TryToRustTy for Type {
use self::helpers::ast_ty::*;
match *self.kind() {
TypeKind::Void => Ok(raw_type(ctx, "c_void")),
TypeKind::Void => Ok(c_void(ctx)),
// TODO: we should do something smart with nullptr, or maybe *const
// c_void is enough?
TypeKind::NullPtr => Ok(raw_type(ctx, "c_void").to_ptr(true)),
TypeKind::NullPtr => Ok(c_void(ctx).to_ptr(true)),
TypeKind::Int(ik) => {
match ik {
IntKind::Bool => Ok(quote! { bool }),
@ -3186,7 +3332,7 @@ impl TryToRustTy for Type {
TypeKind::Alias(..) |
TypeKind::BlockPointer(..) => {
if self.is_block_pointer() && !ctx.options().generate_block {
let void = raw_type(ctx, "c_void");
let void = c_void(ctx);
return Ok(void.to_ptr(/* is_const = */ false));
}
let template_params = item
@ -3473,11 +3619,22 @@ impl CodeGenerator for Function {
attributes.push(attributes::link_name(link_name));
}
// Unfortunately this can't piggyback on the `attributes` list because
// the #[link(wasm_import_module)] needs to happen before the `extern
// "C"` block. It doesn't get picked up properly otherwise
let wasm_link_attribute =
ctx.options().wasm_import_module_name.as_ref().map(|name| {
quote! { #[link(wasm_import_module = #name)] }
});
let ident = ctx.rust_ident(canonical_name);
let tokens = quote!( extern #abi {
#(#attributes)*
pub fn #ident ( #( #args ),* ) #ret;
});
let tokens = quote! {
#wasm_link_attribute
extern #abi {
#(#attributes)*
pub fn #ident ( #( #args ),* ) #ret;
}
};
result.push(tokens);
}
}
@ -3579,18 +3736,44 @@ impl CodeGenerator for ObjCInterface {
let trait_name = ctx.rust_ident(self.rust_name());
let trait_block = quote! {
pub trait #trait_name {
#( #trait_items )*
let trait_block = if self.is_template() {
let template_names: Vec<Ident> = self
.template_names
.iter()
.map(|g| ctx.rust_ident(g))
.collect();
quote! {
pub trait #trait_name <#(#template_names),*>{
#( #trait_items )*
}
}
} else {
quote! {
pub trait #trait_name {
#( #trait_items )*
}
}
};
let ty_for_impl = quote! {
id
};
let impl_block = quote! {
impl #trait_name for #ty_for_impl {
#( #impl_items )*
let impl_block = if self.is_template() {
let template_names: Vec<Ident> = self
.template_names
.iter()
.map(|g| ctx.rust_ident(g))
.collect();
quote! {
impl <#(#template_names :'static),*> #trait_name <#(#template_names),*> for #ty_for_impl {
#( #impl_items )*
}
}
} else {
quote! {
impl #trait_name for #ty_for_impl {
#( #impl_items )*
}
}
};
@ -3851,13 +4034,13 @@ mod utils {
}
#[inline]
pub unsafe fn as_ptr(&self) -> *const T {
::#prefix::mem::transmute(self)
pub fn as_ptr(&self) -> *const T {
self as *const _ as *const T
}
#[inline]
pub unsafe fn as_mut_ptr(&mut self) -> *mut T {
::#prefix::mem::transmute(self)
pub fn as_mut_ptr(&mut self) -> *mut T {
self as *mut _ as *mut T
}
#[inline]
@ -3881,20 +4064,10 @@ mod utils {
}
};
let incomplete_array_clone_impl = quote! {
impl<T> ::#prefix::clone::Clone for __IncompleteArrayField<T> {
#[inline]
fn clone(&self) -> Self {
Self::new()
}
}
};
let items = vec![
incomplete_array_decl,
incomplete_array_impl,
incomplete_array_debug_impl,
incomplete_array_clone_impl,
];
let old_items = mem::replace(result, items);
@ -3953,9 +4126,15 @@ mod utils {
"int64_t" => primitive_ty(ctx, "i64"),
"uint64_t" => primitive_ty(ctx, "u64"),
"uintptr_t" | "size_t" => primitive_ty(ctx, "usize"),
"size_t" if ctx.options().size_t_is_usize => {
primitive_ty(ctx, "usize")
}
"uintptr_t" => primitive_ty(ctx, "usize"),
"intptr_t" | "ptrdiff_t" | "ssize_t" => primitive_ty(ctx, "isize"),
"ssize_t" if ctx.options().size_t_is_usize => {
primitive_ty(ctx, "isize")
}
"intptr_t" | "ptrdiff_t" => primitive_ty(ctx, "isize"),
_ => return None,
})
}

Просмотреть файл

@ -9,6 +9,8 @@ use ir::ty::{Type, TypeKind};
use proc_macro2::{self, Ident, Span};
use std::cmp;
const MAX_GUARANTEED_ALIGN: usize = 8;
/// Trace the layout of struct.
#[derive(Debug)]
pub struct StructLayoutTracker<'a> {
@ -168,10 +170,10 @@ impl<'a> StructLayoutTracker<'a> {
// much we can do about it.
if let Some(layout) = self.ctx.resolve_type(inner).layout(self.ctx)
{
if layout.align > self.ctx.target_pointer_size() {
if layout.align > MAX_GUARANTEED_ALIGN {
field_layout.size =
align_to(layout.size, layout.align) * len;
field_layout.align = self.ctx.target_pointer_size();
field_layout.align = MAX_GUARANTEED_ALIGN;
}
}
}
@ -191,7 +193,7 @@ impl<'a> StructLayoutTracker<'a> {
// Otherwise the padding is useless.
let need_padding = padding_bytes >= field_layout.align ||
field_layout.align > self.ctx.target_pointer_size();
field_layout.align > MAX_GUARANTEED_ALIGN;
self.latest_offset += padding_bytes;
@ -213,10 +215,7 @@ impl<'a> StructLayoutTracker<'a> {
if need_padding && padding_bytes != 0 {
Some(Layout::new(
padding_bytes,
cmp::min(
field_layout.align,
self.ctx.target_pointer_size(),
),
cmp::min(field_layout.align, MAX_GUARANTEED_ALIGN),
))
} else {
None
@ -258,6 +257,11 @@ impl<'a> StructLayoutTracker<'a> {
}
let padding_bytes = layout.size - self.latest_offset;
if padding_bytes == 0 {
return None;
}
let repr_align = self.ctx.options().rust_features().repr_align;
// We always pad to get to the correct size if the struct is one of
// those we can't align properly.
@ -265,17 +269,15 @@ impl<'a> StructLayoutTracker<'a> {
// Note that if the last field we saw was a bitfield, we may need to pad
// regardless, because bitfields don't respect alignment as strictly as
// other fields.
if padding_bytes > 0 &&
(padding_bytes >= layout.align ||
(self.last_field_was_bitfield &&
padding_bytes >=
self.latest_field_layout.unwrap().align) ||
layout.align > self.ctx.target_pointer_size())
if padding_bytes >= layout.align ||
(self.last_field_was_bitfield &&
padding_bytes >= self.latest_field_layout.unwrap().align) ||
(!repr_align && layout.align > MAX_GUARANTEED_ALIGN)
{
let layout = if self.is_packed {
Layout::new(padding_bytes, 1)
} else if self.last_field_was_bitfield ||
layout.align > self.ctx.target_pointer_size()
layout.align > MAX_GUARANTEED_ALIGN
{
// We've already given up on alignment here.
Layout::for_size(self.ctx, padding_bytes)
@ -306,9 +308,9 @@ impl<'a> StructLayoutTracker<'a> {
return false;
}
// We can only generate up-to a word of alignment unless we support
// We can only generate up-to a 8-bytes of alignment unless we support
// repr(align).
repr_align || layout.align <= self.ctx.target_pointer_size()
repr_align || layout.align <= MAX_GUARANTEED_ALIGN
}
fn padding_bytes(&self, layout: Layout) -> usize {

60
third_party/rust/bindgen/src/features.rs поставляемый
Просмотреть файл

@ -1,7 +1,6 @@
//! Contains code for selecting features
#![deny(missing_docs)]
#![deny(warnings)]
#![deny(unused_extern_crates)]
use std::io;
@ -88,25 +87,44 @@ macro_rules! rust_target_base {
$x_macro!(
/// Rust stable 1.0
=> Stable_1_0 => 1.0;
/// Rust stable 1.1
=> Stable_1_1 => 1.1;
/// Rust stable 1.19
/// * Untagged unions ([RFC 1444](https://github.com/rust-lang/rfcs/blob/master/text/1444-union.md))
=> Stable_1_19 => 1.19;
/// Rust stable 1.20
/// * Associated constants ([PR](https://github.com/rust-lang/rust/pull/42809))
=> Stable_1_20 => 1.20;
/// Rust stable 1.21
/// * Builtin impls for `Clone` ([PR](https://github.com/rust-lang/rust/pull/43690))
=> Stable_1_21 => 1.21;
/// Rust stable 1.25
/// * `repr(align)` ([PR](https://github.com/rust-lang/rust/pull/47006))
=> Stable_1_25 => 1.25;
/// Rust stable 1.26
/// * [i128 / u128 support](https://doc.rust-lang.org/std/primitive.i128.html)
=> Stable_1_26 => 1.26;
/// Rust stable 1.27
/// * `must_use` attribute on functions ([PR](https://github.com/rust-lang/rust/pull/48925))
=> Stable_1_27 => 1.27;
/// Rust stable 1.28
/// * `repr(transparent)` ([PR](https://github.com/rust-lang/rust/pull/51562))
=> Stable_1_28 => 1.28;
/// Rust stable 1.30
/// * `const fn` support for limited cases ([PR](https://github.com/rust-lang/rust/pull/54835/)
/// * [c_void available in core](https://doc.rust-lang.org/core/ffi/enum.c_void.html)
=> Stable_1_30 => 1.30;
/// Rust stable 1.33
/// * repr(packed(N)) ([PR](https://github.com/rust-lang/rust/pull/57049))
=> Stable_1_33 => 1.33;
/// Rust stable 1.36
/// * `MaybeUninit` instead of `mem::uninitialized()` ([PR](https://github.com/rust-lang/rust/pull/60445))
=> Stable_1_36 => 1.36;
/// Rust stable 1.40
/// * `non_exhaustive` enums/structs ([Tracking issue](https://github.com/rust-lang/rust/issues/44109))
=> Stable_1_40 => 1.40;
/// Nightly rust
/// * `thiscall` calling convention ([Tracking issue](https://github.com/rust-lang/rust/issues/42202))
=> Nightly => nightly;
);
}
@ -116,7 +134,7 @@ rust_target_base!(rust_target_def);
rust_target_base!(rust_target_values_def);
/// Latest stable release of Rust
pub const LATEST_STABLE_RUST: RustTarget = RustTarget::Stable_1_33;
pub const LATEST_STABLE_RUST: RustTarget = RustTarget::Stable_1_40;
/// Create RustFeatures struct definition, new(), and a getter for each field
macro_rules! rust_feature_def {
@ -127,7 +145,8 @@ macro_rules! rust_feature_def {
) => {
/// Features supported by a rust target
#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)]
pub struct RustFeatures {
#[allow(missing_docs)] // Documentation should go into the relevant variants.
pub(crate) struct RustFeatures {
$( $(
$(
#[$attr]
@ -165,50 +184,47 @@ macro_rules! rust_feature_def {
}
}
// NOTE(emilio): When adding or removing features here, make sure to update the
// documentation for the relevant variant in the rust_target_base macro
// definition.
rust_feature_def!(
Stable_1_19 {
/// Untagged unions ([RFC 1444](https://github.com/rust-lang/rfcs/blob/master/text/1444-union.md))
=> untagged_union;
}
Stable_1_20 {
/// associated constants ([PR](https://github.com/rust-lang/rust/pull/42809))
=> associated_const;
}
Stable_1_21 {
/// builtin impls for `Clone` ([PR](https://github.com/rust-lang/rust/pull/43690))
=> builtin_clone_impls;
}
Stable_1_25 {
/// repr(align) ([PR](https://github.com/rust-lang/rust/pull/47006))
=> repr_align;
}
Stable_1_26 {
/// [i128 / u128 support](https://doc.rust-lang.org/std/primitive.i128.html)
=> i128_and_u128;
}
Stable_1_27 {
/// `must_use` attribute on functions ([PR](https://github.com/rust-lang/rust/pull/48925))
=> must_use_function;
}
Stable_1_28 {
/// repr(transparent) ([PR](https://github.com/rust-lang/rust/pull/51562))
=> repr_transparent;
}
Stable_1_30 {
/// `const fn` support for limited cases
/// ([PR](https://github.com/rust-lang/rust/pull/54835/)
=> min_const_fn;
=> core_ffi_c_void;
}
Stable_1_33 {
/// repr(packed(N)) ([PR](https://github.com/rust-lang/rust/pull/57049))
=> repr_packed_n;
}
Nightly {
/// `thiscall` calling convention ([Tracking issue](https://github.com/rust-lang/rust/issues/42202))
=> thiscall_abi;
/// `non_exhaustive` enums/structs ([Tracking issue](https://github.com/rust-lang/rust/issues/44109))
Stable_1_36 {
=> maybe_uninit;
}
Stable_1_40 {
=> non_exhaustive;
}
Nightly {
=> thiscall_abi;
}
);
impl Default for RustFeatures {
@ -227,7 +243,8 @@ mod test {
fn target_features() {
let f_1_0 = RustFeatures::from(RustTarget::Stable_1_0);
assert!(
!f_1_0.untagged_union &&
!f_1_0.core_ffi_c_void &&
!f_1_0.untagged_union &&
!f_1_0.associated_const &&
!f_1_0.builtin_clone_impls &&
!f_1_0.repr_align &&
@ -235,7 +252,8 @@ mod test {
);
let f_1_21 = RustFeatures::from(RustTarget::Stable_1_21);
assert!(
f_1_21.untagged_union &&
!f_1_21.core_ffi_c_void &&
f_1_21.untagged_union &&
f_1_21.associated_const &&
f_1_21.builtin_clone_impls &&
!f_1_21.repr_align &&
@ -243,9 +261,11 @@ mod test {
);
let f_nightly = RustFeatures::from(RustTarget::Nightly);
assert!(
f_nightly.untagged_union &&
f_nightly.core_ffi_c_void &&
f_nightly.untagged_union &&
f_nightly.associated_const &&
f_nightly.builtin_clone_impls &&
f_nightly.maybe_uninit &&
f_nightly.repr_align &&
f_nightly.thiscall_abi
);

Просмотреть файл

@ -240,25 +240,24 @@ impl<'ctx> CannotDerive<'ctx> {
self.derive_trait
);
return CanDerive::No;
} else {
if self.derive_trait.can_derive_large_array() {
trace!(" array can derive {}", self.derive_trait);
return CanDerive::Yes;
} else {
if len <= RUST_DERIVE_IN_ARRAY_LIMIT {
trace!(
" array is small enough to derive {}",
self.derive_trait
);
return CanDerive::Yes;
} else {
trace!(
" array is too large to derive {}, but it may be implemented", self.derive_trait
);
return CanDerive::Manually;
}
}
}
if self.derive_trait.can_derive_large_array() {
trace!(" array can derive {}", self.derive_trait);
return CanDerive::Yes;
}
if len > RUST_DERIVE_IN_ARRAY_LIMIT {
trace!(
" array is too large to derive {}, but it may be implemented", self.derive_trait
);
return CanDerive::Manually;
}
trace!(
" array is small enough to derive {}",
self.derive_trait
);
return CanDerive::Yes;
}
TypeKind::Vector(t, len) => {
let inner_type =
@ -362,6 +361,20 @@ impl<'ctx> CannotDerive<'ctx> {
return CanDerive::No;
}
// Bitfield units are always represented as arrays of u8, but
// they're not traced as arrays, so we need to check here
// instead.
if !self.derive_trait.can_derive_large_array() &&
info.has_too_large_bitfield_unit() &&
!item.is_opaque(self.ctx, &())
{
trace!(
" cannot derive {} for comp with too large bitfield unit",
self.derive_trait
);
return CanDerive::No;
}
let pred = self.derive_trait.consider_edge_comp();
return self.constrain_join(item, pred);
}

150
third_party/rust/bindgen/src/ir/comp.rs поставляемый
Просмотреть файл

@ -6,9 +6,9 @@ use super::context::{BindgenContext, FunctionId, ItemId, TypeId, VarId};
use super::dot::DotAttributes;
use super::item::{IsOpaque, Item};
use super::layout::Layout;
// use super::ty::RUST_DERIVE_IN_ARRAY_LIMIT;
use super::template::TemplateParameters;
use super::traversal::{EdgeKind, Trace, Tracer};
use super::ty::RUST_DERIVE_IN_ARRAY_LIMIT;
use clang;
use codegen::struct_layout::{align_to, bytes_from_bits_pow2};
use ir::derive::CanDeriveCopy;
@ -356,7 +356,7 @@ impl Bitfield {
if self.width() as u64 == mem::size_of::<u64>() as u64 * 8 {
u64::MAX
} else {
((1u64 << self.width()) - 1u64)
(1u64 << self.width()) - 1u64
};
unoffseted_mask << self.offset_into_unit()
@ -496,7 +496,8 @@ impl FieldMethods for RawField {
fn raw_fields_to_fields_and_bitfield_units<I>(
ctx: &BindgenContext,
raw_fields: I,
) -> Result<Vec<Field>, ()>
packed: bool,
) -> Result<(Vec<Field>, bool), ()>
where
I: IntoIterator<Item = RawField>,
{
@ -533,6 +534,7 @@ where
&mut bitfield_unit_count,
&mut fields,
bitfields,
packed,
)?;
}
@ -541,7 +543,7 @@ where
"The above loop should consume all items in `raw_fields`"
);
Ok(fields)
Ok((fields, bitfield_unit_count != 0))
}
/// Given a set of contiguous raw bitfields, group and allocate them into
@ -551,6 +553,7 @@ fn bitfields_to_allocation_units<E, I>(
bitfield_unit_count: &mut usize,
fields: &mut E,
raw_bitfields: I,
packed: bool,
) -> Result<(), ()>
where
E: Extend<Field>,
@ -575,17 +578,22 @@ where
unit_size_in_bits: usize,
unit_align_in_bits: usize,
bitfields: Vec<Bitfield>,
packed: bool,
) where
E: Extend<Field>,
{
*bitfield_unit_count += 1;
let align = bytes_from_bits_pow2(unit_align_in_bits);
let align = if packed {
1
} else {
bytes_from_bits_pow2(unit_align_in_bits)
};
let size = align_to(unit_size_in_bits, align * 8) / 8;
let layout = Layout::new(size, align);
fields.extend(Some(Field::Bitfields(BitfieldUnit {
nth: *bitfield_unit_count,
layout: layout,
bitfields: bitfields,
layout,
bitfields,
})));
}
@ -607,34 +615,39 @@ where
let bitfield_align = bitfield_layout.align;
let mut offset = unit_size_in_bits;
if is_ms_struct {
if unit_size_in_bits != 0 &&
(bitfield_width == 0 ||
bitfield_width > unfilled_bits_in_unit)
{
// We've reached the end of this allocation unit, so flush it
// and its bitfields.
unit_size_in_bits = align_to(unit_size_in_bits, unit_align * 8);
flush_allocation_unit(
fields,
bitfield_unit_count,
unit_size_in_bits,
unit_align,
mem::replace(&mut bitfields_in_unit, vec![]),
);
if !packed {
if is_ms_struct {
if unit_size_in_bits != 0 &&
(bitfield_width == 0 ||
bitfield_width > unfilled_bits_in_unit)
{
// We've reached the end of this allocation unit, so flush it
// and its bitfields.
unit_size_in_bits =
align_to(unit_size_in_bits, unit_align * 8);
flush_allocation_unit(
fields,
bitfield_unit_count,
unit_size_in_bits,
unit_align,
mem::replace(&mut bitfields_in_unit, vec![]),
packed,
);
// Now we're working on a fresh bitfield allocation unit, so reset
// the current unit size and alignment.
offset = 0;
unit_align = 0;
}
} else {
if offset != 0 &&
(bitfield_width == 0 ||
(offset & (bitfield_align * 8 - 1)) + bitfield_width >
bitfield_size * 8)
{
offset = align_to(offset, bitfield_align * 8);
// Now we're working on a fresh bitfield allocation unit, so reset
// the current unit size and alignment.
offset = 0;
unit_align = 0;
}
} else {
if offset != 0 &&
(bitfield_width == 0 ||
(offset & (bitfield_align * 8 - 1)) +
bitfield_width >
bitfield_size * 8)
{
offset = align_to(offset, bitfield_align * 8);
}
}
}
@ -677,6 +690,7 @@ where
unit_size_in_bits,
unit_align,
bitfields_in_unit,
packed,
);
}
@ -693,7 +707,10 @@ where
#[derive(Debug)]
enum CompFields {
BeforeComputingBitfieldUnits(Vec<RawField>),
AfterComputingBitfieldUnits(Vec<Field>),
AfterComputingBitfieldUnits {
fields: Vec<Field>,
has_bitfield_units: bool,
},
ErrorComputingBitfieldUnits,
}
@ -717,7 +734,7 @@ impl CompFields {
}
}
fn compute_bitfield_units(&mut self, ctx: &BindgenContext) {
fn compute_bitfield_units(&mut self, ctx: &BindgenContext, packed: bool) {
let raws = match *self {
CompFields::BeforeComputingBitfieldUnits(ref mut raws) => {
mem::replace(raws, vec![])
@ -727,13 +744,16 @@ impl CompFields {
}
};
let result = raw_fields_to_fields_and_bitfield_units(ctx, raws);
let result = raw_fields_to_fields_and_bitfield_units(ctx, raws, packed);
match result {
Ok(fields_and_units) => {
Ok((fields, has_bitfield_units)) => {
mem::replace(
self,
CompFields::AfterComputingBitfieldUnits(fields_and_units),
CompFields::AfterComputingBitfieldUnits {
fields,
has_bitfield_units,
},
);
}
Err(()) => {
@ -744,11 +764,11 @@ impl CompFields {
fn deanonymize_fields(&mut self, ctx: &BindgenContext, methods: &[Method]) {
let fields = match *self {
CompFields::AfterComputingBitfieldUnits(ref mut fields) => fields,
CompFields::ErrorComputingBitfieldUnits => {
// Nothing to do here.
return;
}
CompFields::AfterComputingBitfieldUnits {
ref mut fields, ..
} => fields,
// Nothing to do here.
CompFields::ErrorComputingBitfieldUnits => return,
CompFields::BeforeComputingBitfieldUnits(_) => {
panic!("Not yet computed bitfield units.");
}
@ -845,7 +865,7 @@ impl Trace for CompFields {
tracer.visit_kind(f.ty().into(), EdgeKind::Field);
}
}
CompFields::AfterComputingBitfieldUnits(ref fields) => {
CompFields::AfterComputingBitfieldUnits { ref fields, .. } => {
for f in fields {
f.trace(context, tracer, &());
}
@ -1047,7 +1067,7 @@ impl CompInfo {
/// Construct a new compound type.
pub fn new(kind: CompKind) -> Self {
CompInfo {
kind: kind,
kind,
fields: CompFields::default(),
template_params: vec![],
methods: vec![],
@ -1110,13 +1130,43 @@ impl CompInfo {
pub fn fields(&self) -> &[Field] {
match self.fields {
CompFields::ErrorComputingBitfieldUnits => &[],
CompFields::AfterComputingBitfieldUnits(ref fields) => fields,
CompFields::AfterComputingBitfieldUnits { ref fields, .. } => {
fields
}
CompFields::BeforeComputingBitfieldUnits(_) => {
panic!("Should always have computed bitfield units first");
}
}
}
fn has_bitfields(&self) -> bool {
match self.fields {
CompFields::ErrorComputingBitfieldUnits => false,
CompFields::AfterComputingBitfieldUnits {
has_bitfield_units,
..
} => has_bitfield_units,
CompFields::BeforeComputingBitfieldUnits(_) => {
panic!("Should always have computed bitfield units first");
}
}
}
/// Returns whether we have a too large bitfield unit, in which case we may
/// not be able to derive some of the things we should be able to normally
/// derive.
pub fn has_too_large_bitfield_unit(&self) -> bool {
if !self.has_bitfields() {
return false;
}
self.fields().iter().any(|field| match *field {
Field::DataMember(..) => false,
Field::Bitfields(ref unit) => {
unit.layout.size > RUST_DERIVE_IN_ARRAY_LIMIT
}
})
}
/// Does this type have any template parameters that aren't types
/// (e.g. int)?
pub fn has_non_type_template_params(&self) -> bool {
@ -1126,7 +1176,7 @@ impl CompInfo {
/// Do we see a virtual function during parsing?
/// Get the has_own_virtual_method boolean.
pub fn has_own_virtual_method(&self) -> bool {
return self.has_own_virtual_method;
self.has_own_virtual_method
}
/// Did we see a destructor when parsing this type?
@ -1566,7 +1616,9 @@ impl CompInfo {
/// Compute this compound structure's bitfield allocation units.
pub fn compute_bitfield_units(&mut self, ctx: &BindgenContext) {
self.fields.compute_bitfield_units(ctx);
// TODO(emilio): If we could detect #pragma packed here we'd fix layout
// tests in divide-by-zero-in-struct-layout.rs
self.fields.compute_bitfield_units(ctx, self.packed_attr)
}
/// Assign for each anonymous field a generated name.

32
third_party/rust/bindgen/src/ir/context.rs поставляемый
Просмотреть файл

@ -553,6 +553,8 @@ impl BindgenContext {
clang_sys::CXTranslationUnit_DetailedPreprocessingRecord;
let translation_unit = {
let _t =
Timer::new("translation_unit").with_output(options.time_phases);
let clang_args = if explicit_target {
Cow::Borrowed(&options.clang_args)
} else {
@ -573,6 +575,7 @@ impl BindgenContext {
- Unrecognized flags
- Invalid flag arguments
- File I/O errors
- Host vs. target architecture mismatch
If you encounter an error missing from this list, please file an issue or a PR!")
};
@ -931,6 +934,8 @@ If you encounter an error missing from this list, please file an issue or a PR!"
/// Collect all of our unresolved type references and resolve them.
fn resolve_typerefs(&mut self) {
let _t = self.timer("resolve_typerefs");
let typerefs = self.collect_typerefs();
for (id, ty, loc, parent_id) in typerefs {
@ -987,6 +992,8 @@ If you encounter an error missing from this list, please file an issue or a PR!"
/// Compute the bitfield allocation units for all `TypeKind::Comp` items we
/// parsed.
fn compute_bitfield_units(&mut self) {
let _t = self.timer("compute_bitfield_units");
assert!(self.collected_typerefs());
let need_bitfield_allocation =
@ -2160,10 +2167,27 @@ If you encounter an error missing from this list, please file an issue or a PR!"
}
break;
}
_ => {
spelling if !found_namespace_keyword => {
// This is _likely_, but not certainly, a macro that's been placed just before
// the namespace keyword. Unfortunately, clang tokens don't let us easily see
// through the ifdef tokens, so we don't know what this token should really be.
// Instead of panicking though, we warn the user that we assumed the token was
// blank, and then move on.
//
// See also https://github.com/rust-lang/rust-bindgen/issues/1676.
warn!(
"Ignored unknown namespace prefix '{}' at {:?} in {:?}",
String::from_utf8_lossy(spelling),
token,
cursor
);
}
spelling => {
panic!(
"Unknown token while processing namespace: {:?}",
token
"Unknown token '{}' while processing namespace at {:?} in {:?}",
String::from_utf8_lossy(spelling),
token,
cursor
);
}
}
@ -2321,7 +2345,7 @@ If you encounter an error missing from this list, please file an issue or a PR!"
}
let mut prefix_path =
parent.path_for_whitelisting(self);
parent.path_for_whitelisting(self).clone();
enum_.variants().iter().any(|variant| {
prefix_path.push(variant.name().into());
let name = prefix_path[1..].join("::");

6
third_party/rust/bindgen/src/ir/dot.rs поставляемый
Просмотреть файл

@ -38,11 +38,7 @@ where
&mut dot_file,
r#"{} [fontname="courier", color={}, label=< <table border="0" align="left">"#,
id.as_usize(),
if is_whitelisted {
"black"
} else {
"gray"
}
if is_whitelisted { "black" } else { "gray" }
)?;
item.dot_attributes(ctx, &mut dot_file)?;
writeln!(&mut dot_file, r#"</table> >];"#)?;

5
third_party/rust/bindgen/src/ir/enum_ty.rs поставляемый
Просмотреть файл

@ -183,7 +183,10 @@ impl Enum {
&ctx.options().bitfield_enums,
item,
) {
EnumVariation::Bitfield
EnumVariation::NewType { is_bitfield: true }
} else if self.is_matching_enum(ctx, &ctx.options().newtype_enums, item)
{
EnumVariation::NewType { is_bitfield: false }
} else if self.is_matching_enum(
ctx,
&ctx.options().rustified_enums,

2
third_party/rust/bindgen/src/ir/function.rs поставляемый
Просмотреть файл

@ -424,7 +424,7 @@ impl FunctionSig {
};
let must_use = ctx.options().enable_function_attribute_detection &&
cursor.has_simple_attr("warn_unused_result");
cursor.has_warn_unused_result_attr();
let is_method = kind == CXCursor_CXXMethod;
let is_constructor = kind == CXCursor_Constructor;
let is_destructor = kind == CXCursor_Destructor;

108
third_party/rust/bindgen/src/ir/item.rs поставляемый
Просмотреть файл

@ -20,9 +20,10 @@ use super::traversal::{EdgeKind, Trace, Tracer};
use super::ty::{Type, TypeKind};
use clang;
use clang_sys;
use lazycell::LazyCell;
use parse::{ClangItemParser, ClangSubItemParser, ParseError, ParseResult};
use regex;
use std::cell::{Cell, RefCell};
use std::cell::Cell;
use std::collections::BTreeSet;
use std::fmt::Write;
use std::io;
@ -387,7 +388,7 @@ pub struct Item {
///
/// Note that only structs, unions, and enums get a local type id. In any
/// case this is an implementation detail.
local_id: Cell<Option<usize>>,
local_id: LazyCell<usize>,
/// The next local id to use for a child or template instantiation.
next_child_local_id: Cell<usize>,
@ -396,7 +397,11 @@ pub struct Item {
///
/// This is a fairly used operation during codegen so this makes bindgen
/// considerably faster in those cases.
canonical_name_cache: RefCell<Option<String>>,
canonical_name: LazyCell<String>,
/// The path to use for whitelisting and other name-based checks, as
/// returned by `path_for_whitelisting`, lazily constructed.
path_for_whitelisting: LazyCell<Vec<String>>,
/// A doc comment over the item, if any.
comment: Option<String>,
@ -431,9 +436,10 @@ impl Item {
debug_assert!(id != parent_id || kind.is_module());
Item {
id: id,
local_id: Cell::new(None),
local_id: LazyCell::new(),
next_child_local_id: Cell::new(1),
canonical_name_cache: RefCell::new(None),
canonical_name: LazyCell::new(),
path_for_whitelisting: LazyCell::new(),
parent_id: parent_id,
comment: comment,
annotations: annotations.unwrap_or_default(),
@ -520,11 +526,10 @@ impl Item {
/// below this item's lexical scope, meaning that this can be useful for
/// generating relatively stable identifiers within a scope.
pub fn local_id(&self, ctx: &BindgenContext) -> usize {
if self.local_id.get().is_none() {
*self.local_id.borrow_with(|| {
let parent = ctx.resolve_item(self.parent_id);
self.local_id.set(Some(parent.next_child_local_id()));
}
self.local_id.get().unwrap()
parent.next_child_local_id()
})
}
/// Get an identifier that differentiates a child of this item of other
@ -793,6 +798,15 @@ impl Item {
}
}
fn is_anon(&self) -> bool {
match self.kind() {
ItemKind::Module(module) => module.name().is_none(),
ItemKind::Type(ty) => ty.name().is_none(),
ItemKind::Function(_) => false,
ItemKind::Var(_) => false,
}
}
/// Get the canonical name without taking into account the replaces
/// annotation.
///
@ -804,6 +818,10 @@ impl Item {
///
/// This name should be derived from the immutable state contained in the
/// type and the parent chain, since it should be consistent.
///
/// If `BindgenOptions::disable_nested_struct_naming` is true then returned
/// name is the inner most non-anonymous name plus all the anonymous base names
/// that follows.
pub fn real_canonical_name(
&self,
ctx: &BindgenContext,
@ -827,8 +845,8 @@ impl Item {
return base_name;
}
// Concatenate this item's ancestors' names together.
let mut names: Vec<_> = target
// Ancestors' id iter
let mut ids_iter = target
.parent_id()
.ancestors(ctx)
.filter(|id| *id != ctx.root_module())
@ -847,7 +865,30 @@ impl Item {
}
true
})
});
let ids: Vec<_> = if ctx.options().disable_nested_struct_naming {
let mut ids = Vec::new();
// If target is anonymous we need find its first named ancestor.
if target.is_anon() {
while let Some(id) = ids_iter.next() {
ids.push(id);
if !ctx.resolve_item(id).is_anon() {
break;
}
}
}
ids
} else {
ids_iter.collect()
};
// Concatenate this item's ancestors' names together.
let mut names: Vec<_> = ids
.into_iter()
.map(|id| {
let item = ctx.resolve_item(id);
let target = ctx.resolve_item(item.name_target(ctx));
@ -972,8 +1013,9 @@ impl Item {
/// Returns the path we should use for whitelisting / blacklisting, which
/// doesn't include user-mangling.
pub fn path_for_whitelisting(&self, ctx: &BindgenContext) -> Vec<String> {
self.compute_path(ctx, UserMangled::No)
pub fn path_for_whitelisting(&self, ctx: &BindgenContext) -> &Vec<String> {
self.path_for_whitelisting
.borrow_with(|| self.compute_path(ctx, UserMangled::No))
}
fn compute_path(
@ -1357,7 +1399,6 @@ impl ClangItemParser for Item {
CXCursor_UsingDeclaration |
CXCursor_UsingDirective |
CXCursor_StaticAssert |
CXCursor_InclusionDirective |
CXCursor_FunctionTemplate => {
debug!(
"Unhandled cursor kind {:?}: {:?}",
@ -1365,6 +1406,22 @@ impl ClangItemParser for Item {
cursor
);
}
CXCursor_InclusionDirective => {
let file = cursor.get_included_file_name();
match file {
None => {
warn!(
"Inclusion of a nameless file in {:?}",
cursor
);
}
Some(filename) => {
if let Some(cb) = ctx.parse_callbacks() {
cb.include_file(&filename)
}
}
}
}
_ => {
// ignore toplevel operator overloads
let spelling = cursor.spelling();
@ -1812,17 +1869,18 @@ impl ItemCanonicalName for Item {
ctx.in_codegen_phase(),
"You're not supposed to call this yet"
);
if self.canonical_name_cache.borrow().is_none() {
let in_namespace = ctx.options().enable_cxx_namespaces ||
ctx.options().disable_name_namespacing;
self.canonical_name
.borrow_with(|| {
let in_namespace = ctx.options().enable_cxx_namespaces ||
ctx.options().disable_name_namespacing;
*self.canonical_name_cache.borrow_mut() = if in_namespace {
Some(self.name(ctx).within_namespaces().get())
} else {
Some(self.name(ctx).get())
};
}
return self.canonical_name_cache.borrow().as_ref().unwrap().clone();
if in_namespace {
self.name(ctx).within_namespaces().get()
} else {
self.name(ctx).get()
}
})
.clone()
}
}

46
third_party/rust/bindgen/src/ir/objc.rs поставляемый
Просмотреть файл

@ -12,6 +12,7 @@ use clang_sys::CXCursor_ObjCClassRef;
use clang_sys::CXCursor_ObjCInstanceMethodDecl;
use clang_sys::CXCursor_ObjCProtocolDecl;
use clang_sys::CXCursor_ObjCProtocolRef;
use clang_sys::CXCursor_TemplateTypeParameter;
use proc_macro2::{Ident, Span, TokenStream};
/// Objective C interface as used in TypeKind
@ -27,6 +28,9 @@ pub struct ObjCInterface {
is_protocol: bool,
/// The list of template names almost always, ObjectType or KeyType
pub template_names: Vec<String>,
conforms_to: Vec<ItemId>,
/// List of the methods defined in this interfae
@ -58,6 +62,7 @@ impl ObjCInterface {
name: name.to_owned(),
category: None,
is_protocol: false,
template_names: Vec::new(),
conforms_to: Vec::new(),
methods: Vec::new(),
class_methods: Vec::new(),
@ -85,6 +90,11 @@ impl ObjCInterface {
}
}
/// Is this a template interface?
pub fn is_template(&self) -> bool {
!self.template_names.is_empty()
}
/// List of the methods defined in this interface
pub fn methods(&self) -> &Vec<ObjCMethod> {
&self.methods
@ -154,6 +164,10 @@ impl ObjCInterface {
let method = ObjCMethod::new(&name, signature, is_class_method);
interface.add_method(method);
}
CXCursor_TemplateTypeParameter => {
let name = c.spelling();
interface.template_names.push(name);
}
_ => {}
}
CXChildVisit_Continue
@ -183,8 +197,8 @@ impl ObjCMethod {
ObjCMethod {
name: name.to_owned(),
rust_name: rust_name.to_owned(),
signature: signature,
is_class_method: is_class_method,
signature,
is_class_method,
}
}
@ -212,11 +226,16 @@ impl ObjCMethod {
/// Formats the method call
pub fn format_method_call(&self, args: &[TokenStream]) -> TokenStream {
let split_name: Vec<_> = self
let split_name: Vec<Option<Ident>> = self
.name
.split(':')
.filter(|p| !p.is_empty())
.map(|name| Ident::new(name, Span::call_site()))
.map(|name| {
if name.is_empty() {
None
} else {
Some(Ident::new(name, Span::call_site()))
}
})
.collect();
// No arguments
@ -228,11 +247,11 @@ impl ObjCMethod {
}
// Check right amount of arguments
if args.len() != split_name.len() {
if args.len() != split_name.len() - 1 {
panic!(
"Incorrect method name or arguments for objc method, {:?} vs {:?}",
args,
split_name
split_name,
);
}
@ -245,10 +264,15 @@ impl ObjCMethod {
args_without_types.push(Ident::new(name, Span::call_site()))
}
let args = split_name
.into_iter()
.zip(args_without_types)
.map(|(arg, arg_val)| quote! { #arg : #arg_val });
let args = split_name.into_iter().zip(args_without_types).map(
|(arg, arg_val)| {
if let Some(arg) = arg {
quote! { #arg: #arg_val }
} else {
quote! { #arg_val: #arg_val }
}
},
);
quote! {
#( #args )*

8
third_party/rust/bindgen/src/ir/var.rs поставляемый
Просмотреть файл

@ -232,8 +232,12 @@ impl ClangSubItemParser for Var {
let ty = cursor.cur_type();
// XXX this is redundant, remove!
let is_const = ty.is_const();
// TODO(emilio): do we have to special-case constant arrays in
// some other places?
let is_const = ty.is_const() ||
(ty.kind() == CXType_ConstantArray &&
ty.elem_type()
.map_or(false, |element| element.is_const()));
let ty = match Item::from_ty(&ty, cursor, None, ctx) {
Ok(ty) => ty,

290
third_party/rust/bindgen/src/lib.rs поставляемый
Просмотреть файл

@ -8,7 +8,6 @@
//! See the [Users Guide](https://rust-lang.github.io/rust-bindgen/) for
//! additional documentation.
#![deny(missing_docs)]
#![deny(warnings)]
#![deny(unused_extern_crates)]
// To avoid rather annoying warnings when matching with CXCursor_xxx as a
// constant.
@ -23,6 +22,7 @@ extern crate cexpr;
#[allow(unused_extern_crates)]
extern crate cfg_if;
extern crate clang_sys;
extern crate lazycell;
extern crate rustc_hash;
#[macro_use]
extern crate lazy_static;
@ -82,7 +82,7 @@ doc_mod!(ir, ir_docs);
doc_mod!(parse, parse_docs);
doc_mod!(regex_set, regex_set_docs);
pub use codegen::EnumVariation;
pub use codegen::{AliasVariation, EnumVariation};
use features::RustFeatures;
pub use features::{RustTarget, LATEST_STABLE_RUST, RUST_TARGET_STRINGS};
use ir::context::{BindgenContext, ItemId};
@ -95,7 +95,6 @@ use std::fs::{File, OpenOptions};
use std::io::{self, Write};
use std::path::{Path, PathBuf};
use std::process::{Command, Stdio};
use std::sync::Arc;
use std::{env, iter};
// Some convenient typedefs for a fast hash map and hash set.
@ -174,8 +173,8 @@ impl Default for CodegenConfig {
///
/// // Configure and generate bindings.
/// let bindings = builder().header("path/to/input/header")
/// .whitelisted_type("SomeCoolClass")
/// .whitelisted_function("do_some_cool_thing")
/// .whitelist_type("SomeCoolClass")
/// .whitelist_function("do_some_cool_thing")
/// .generate()?;
///
/// // Write the generated bindings to an output file.
@ -189,13 +188,15 @@ impl Default for CodegenConfig {
///
/// 1. [`constified_enum_module()`](#method.constified_enum_module)
/// 2. [`bitfield_enum()`](#method.bitfield_enum)
/// 3. [`rustified_enum()`](#method.rustified_enum)
/// 3. [`newtype_enum()`](#method.newtype_enum)
/// 4. [`rustified_enum()`](#method.rustified_enum)
///
/// For each C enum, bindgen tries to match the pattern in the following order:
///
/// 1. Constified enum module
/// 2. Bitfield enum
/// 3. Rustified enum
/// 3. Newtype enum
/// 4. Rustified enum
///
/// If none of the above patterns match, then bindgen will generate a set of Rust constants.
#[derive(Debug, Default)]
@ -234,7 +235,12 @@ impl Builder {
codegen::EnumVariation::Rust {
non_exhaustive: true,
} => "rust_non_exhaustive",
codegen::EnumVariation::Bitfield => "bitfield",
codegen::EnumVariation::NewType { is_bitfield: true } => {
"bitfield"
}
codegen::EnumVariation::NewType { is_bitfield: false } => {
"newtype"
}
codegen::EnumVariation::Consts => "consts",
codegen::EnumVariation::ModuleConsts => "moduleconsts",
}
@ -252,6 +258,16 @@ impl Builder {
})
.count();
self.options
.newtype_enums
.get_items()
.iter()
.map(|item| {
output_vector.push("--newtype-enum".into());
output_vector.push(item.to_owned());
})
.count();
self.options
.rustified_enums
.get_items()
@ -292,6 +308,42 @@ impl Builder {
})
.count();
if self.options.default_alias_style != Default::default() {
output_vector.push("--default-alias-style=".into());
output_vector
.push(self.options.default_alias_style.as_str().into());
}
self.options
.type_alias
.get_items()
.iter()
.map(|item| {
output_vector.push("--type-alias".into());
output_vector.push(item.to_owned());
})
.count();
self.options
.new_type_alias
.get_items()
.iter()
.map(|item| {
output_vector.push("--new-type-alias".into());
output_vector.push(item.to_owned());
})
.count();
self.options
.new_type_alias_deref
.get_items()
.iter()
.map(|item| {
output_vector.push("--new-type-alias-deref".into());
output_vector.push(item.to_owned());
})
.count();
self.options
.blacklisted_types
.get_items()
@ -421,6 +473,9 @@ impl Builder {
if self.options.disable_name_namespacing {
output_vector.push("--disable-name-namespacing".into());
}
if self.options.disable_nested_struct_naming {
output_vector.push("--disable-nested-struct-naming".into());
}
if !self.options.codegen_config.functions() {
output_vector.push("--ignore-functions".into());
@ -467,6 +522,13 @@ impl Builder {
output_vector.push("--use-array-pointers-in-arguments".into());
}
if let Some(ref wasm_import_module_name) =
self.options.wasm_import_module_name
{
output_vector.push("--wasm-import-module-name".into());
output_vector.push(wasm_import_module_name.clone());
}
self.options
.opaque_types
.get_items()
@ -542,6 +604,10 @@ impl Builder {
output_vector.push("--no-record-matches".into());
}
if self.options.size_t_is_usize {
output_vector.push("--size_t-is-usize".into());
}
if !self.options.rustfmt_bindings {
output_vector.push("--no-rustfmt-bindings".into());
}
@ -732,6 +798,10 @@ impl Builder {
/// Hide the given type from the generated bindings. Regular expressions are
/// supported.
///
/// To blacklist types prefixed with "mylib" use `"mylib_.*"`.
/// For more complicated expressions check
/// [regex](https://docs.rs/regex/*/regex/) docs
pub fn blacklist_type<T: AsRef<str>>(mut self, arg: T) -> Builder {
self.options.blacklisted_types.insert(arg);
self
@ -739,6 +809,10 @@ impl Builder {
/// Hide the given function from the generated bindings. Regular expressions
/// are supported.
///
/// To blacklist functions prefixed with "mylib" use `"mylib_.*"`.
/// For more complicated expressions check
/// [regex](https://docs.rs/regex/*/regex/) docs
pub fn blacklist_function<T: AsRef<str>>(mut self, arg: T) -> Builder {
self.options.blacklisted_functions.insert(arg);
self
@ -747,6 +821,10 @@ impl Builder {
/// Hide the given item from the generated bindings, regardless of
/// whether it's a type, function, module, etc. Regular
/// expressions are supported.
///
/// To blacklist items prefixed with "mylib" use `"mylib_.*"`.
/// For more complicated expressions check
/// [regex](https://docs.rs/regex/*/regex/) docs
pub fn blacklist_item<T: AsRef<str>>(mut self, arg: T) -> Builder {
self.options.blacklisted_items.insert(arg);
self
@ -754,6 +832,10 @@ impl Builder {
/// Treat the given type as opaque in the generated bindings. Regular
/// expressions are supported.
///
/// To change types prefixed with "mylib" into opaque, use `"mylib_.*"`.
/// For more complicated expressions check
/// [regex](https://docs.rs/regex/*/regex/) docs
pub fn opaque_type<T: AsRef<str>>(mut self, arg: T) -> Builder {
self.options.opaque_types.insert(arg);
self
@ -770,6 +852,10 @@ impl Builder {
/// Whitelist the given type so that it (and all types that it transitively
/// refers to) appears in the generated bindings. Regular expressions are
/// supported.
///
/// To whitelist types prefixed with "mylib" use `"mylib_.*"`.
/// For more complicated expressions check
/// [regex](https://docs.rs/regex/*/regex/) docs
pub fn whitelist_type<T: AsRef<str>>(mut self, arg: T) -> Builder {
self.options.whitelisted_types.insert(arg);
self
@ -778,6 +864,10 @@ impl Builder {
/// Whitelist the given function so that it (and all types that it
/// transitively refers to) appears in the generated bindings. Regular
/// expressions are supported.
///
/// To whitelist functions prefixed with "mylib" use `"mylib_.*"`.
/// For more complicated expressions check
/// [regex](https://docs.rs/regex/*/regex/) docs
pub fn whitelist_function<T: AsRef<str>>(mut self, arg: T) -> Builder {
self.options.whitelisted_functions.insert(arg);
self
@ -794,6 +884,10 @@ impl Builder {
/// Whitelist the given variable so that it (and all types that it
/// transitively refers to) appears in the generated bindings. Regular
/// expressions are supported.
///
/// To whitelist variables prefixed with "mylib" use `"mylib_.*"`.
/// For more complicated expressions check
/// [regex](https://docs.rs/regex/*/regex/) docs
pub fn whitelist_var<T: AsRef<str>>(mut self, arg: T) -> Builder {
self.options.whitelisted_vars.insert(arg);
self
@ -821,11 +915,24 @@ impl Builder {
///
/// This makes bindgen generate a type that isn't a rust `enum`. Regular
/// expressions are supported.
///
/// This is similar to the newtype enum style, but with the bitwise
/// operators implemented.
pub fn bitfield_enum<T: AsRef<str>>(mut self, arg: T) -> Builder {
self.options.bitfield_enums.insert(arg);
self
}
/// Mark the given enum (or set of enums, if using a pattern) as a newtype.
/// Regular expressions are supported.
///
/// This makes bindgen generate a type that isn't a Rust `enum`. Regular
/// expressions are supported.
pub fn newtype_enum<T: AsRef<str>>(mut self, arg: T) -> Builder {
self.options.newtype_enums.insert(arg);
self
}
/// Mark the given enum (or set of enums, if using a pattern) as a Rust
/// enum.
///
@ -841,7 +948,7 @@ impl Builder {
}
/// Mark the given enum (or set of enums, if using a pattern) as a Rust
/// enum with the #[non_exhaustive] attribute.
/// enum with the `#[non_exhaustive]` attribute.
///
/// This makes bindgen generate enums instead of constants. Regular
/// expressions are supported.
@ -870,6 +977,45 @@ impl Builder {
self
}
/// Set the default style of code to generate for typedefs
pub fn default_alias_style(
mut self,
arg: codegen::AliasVariation,
) -> Builder {
self.options.default_alias_style = arg;
self
}
/// Mark the given typedef alias (or set of aliases, if using a pattern) to
/// use regular Rust type aliasing.
///
/// This is the default behavior and should be used if `default_alias_style`
/// was set to NewType or NewTypeDeref and you want to override it for a
/// set of typedefs.
pub fn type_alias<T: AsRef<str>>(mut self, arg: T) -> Builder {
self.options.type_alias.insert(arg);
self
}
/// Mark the given typedef alias (or set of aliases, if using a pattern) to
/// be generated as a new type by having the aliased type be wrapped in a
/// #[repr(transparent)] struct.
///
/// Used to enforce stricter type checking.
pub fn new_type_alias<T: AsRef<str>>(mut self, arg: T) -> Builder {
self.options.new_type_alias.insert(arg);
self
}
/// Mark the given typedef alias (or set of aliases, if using a pattern) to
/// be generated as a new type by having the aliased type be wrapped in a
/// #[repr(transparent)] struct and also have an automatically generated
/// impl's of `Deref` and `DerefMut` to their aliased type.
pub fn new_type_alias_deref<T: AsRef<str>>(mut self, arg: T) -> Builder {
self.options.new_type_alias_deref.insert(arg);
self
}
/// Add a string to prepend to the generated bindings. The string is passed
/// through without any modification.
pub fn raw_line<T: Into<String>>(mut self, arg: T) -> Self {
@ -1078,6 +1224,29 @@ impl Builder {
self
}
/// Disable nested struct naming.
///
/// The following structs have different names for C and C++. In case of C
/// they are visible as `foo` and `bar`. In case of C++ they are visible as
/// `foo` and `foo::bar`.
///
/// ```c
/// struct foo {
/// struct bar {
/// } b;
/// };
/// ```
///
/// Bindgen wants to avoid duplicate names by default so it follows C++ naming
/// and it generates `foo`/`foo_bar` instead of just `foo`/`bar`.
///
/// This method disables this behavior and it is indented to be used only
/// for headers that were written for C.
pub fn disable_nested_struct_naming(mut self) -> Builder {
self.options.disable_nested_struct_naming = true;
self
}
/// Treat inline namespaces conservatively.
///
/// This is tricky, because in C++ is technically legal to override an item
@ -1179,12 +1348,18 @@ impl Builder {
self
}
/// Prepend the enum name to constant or bitfield variants.
/// Prepend the enum name to constant or newtype variants.
pub fn prepend_enum_name(mut self, doit: bool) -> Self {
self.options.prepend_enum_name = doit;
self
}
/// Set whether `size_t` should be translated to `usize` automatically.
pub fn size_t_is_usize(mut self, is: bool) -> Self {
self.options.size_t_is_usize = is;
self
}
/// Set whether rustfmt should format the generated bindings.
pub fn rustfmt_bindings(mut self, doit: bool) -> Self {
self.options.rustfmt_bindings = doit;
@ -1361,6 +1536,15 @@ impl Builder {
self.options.array_pointers_in_arguments = doit;
self
}
/// Set the wasm import module name
pub fn wasm_import_module_name<T: Into<String>>(
mut self,
import_name: T,
) -> Self {
self.options.wasm_import_module_name = Some(import_name.into());
self
}
}
/// Configuration options for generated bindings.
@ -1402,12 +1586,17 @@ struct BindgenOptions {
/// The default style of code to generate for enums
default_enum_style: codegen::EnumVariation,
/// The enum patterns to mark an enum as bitfield.
/// The enum patterns to mark an enum as a bitfield
/// (newtype with bitwise operations).
bitfield_enums: RegexSet,
/// The enum patterns to mark an enum as a newtype.
newtype_enums: RegexSet,
/// The enum patterns to mark an enum as a Rust enum.
rustified_enums: RegexSet,
/// The enum patterns to mark an enum as a non-exhaustive Rust enum.
rustified_non_exhaustive_enums: RegexSet,
/// The enum patterns to mark an enum as a module of constants.
@ -1416,6 +1605,19 @@ struct BindgenOptions {
/// The enum patterns to mark an enum as a set of constants.
constified_enums: RegexSet,
/// The default style of code to generate for typedefs.
default_alias_style: codegen::AliasVariation,
/// Typedef patterns that will use regular type aliasing.
type_alias: RegexSet,
/// Typedef patterns that will be aliased by creating a new struct.
new_type_alias: RegexSet,
/// Typedef patterns that will be wrapped in a new struct and have
/// Deref and Deref to their aliased type.
new_type_alias_deref: RegexSet,
/// Whether we should generate builtins or not.
builtins: bool,
@ -1439,6 +1641,9 @@ struct BindgenOptions {
/// True if we should avoid mangling names with namespaces.
disable_name_namespacing: bool,
/// True if we should avoid generating nested struct names.
disable_nested_struct_naming: bool,
/// True if we should generate layout tests for generated structures.
layout_tests: bool,
@ -1566,7 +1771,7 @@ struct BindgenOptions {
/// Whether to detect include paths using clang_sys.
detect_include_paths: bool,
/// Whether to prepend the enum name to bitfield or constant variants.
/// Whether to prepend the enum name to constant or newtype variants.
prepend_enum_name: bool,
/// Version of the Rust compiler to target
@ -1581,6 +1786,9 @@ struct BindgenOptions {
/// items via the `error!` log.
record_matches: bool,
/// Whether `size_t` should be translated to `usize` automatically.
size_t_is_usize: bool,
/// Whether rustfmt should format the generated bindings.
rustfmt_bindings: bool,
@ -1599,6 +1807,9 @@ struct BindgenOptions {
/// Decide if C arrays should be regular pointers in rust or array pointers
array_pointers_in_arguments: bool,
/// Wasm import module name.
wasm_import_module_name: Option<String>,
}
/// TODO(emilio): This is sort of a lie (see the error message that results from
@ -1619,7 +1830,12 @@ impl BindgenOptions {
&mut self.bitfield_enums,
&mut self.constified_enums,
&mut self.constified_enum_modules,
&mut self.newtype_enums,
&mut self.rustified_enums,
&mut self.rustified_non_exhaustive_enums,
&mut self.type_alias,
&mut self.new_type_alias,
&mut self.new_type_alias_deref,
&mut self.no_partialeq_types,
&mut self.no_copy_types,
&mut self.no_hash_types,
@ -1661,10 +1877,15 @@ impl Default for BindgenOptions {
whitelisted_vars: Default::default(),
default_enum_style: Default::default(),
bitfield_enums: Default::default(),
newtype_enums: Default::default(),
rustified_enums: Default::default(),
rustified_non_exhaustive_enums: Default::default(),
constified_enums: Default::default(),
constified_enum_modules: Default::default(),
default_alias_style: Default::default(),
type_alias: Default::default(),
new_type_alias: Default::default(),
new_type_alias_deref: Default::default(),
builtins: false,
emit_ast: false,
emit_ir: false,
@ -1683,6 +1904,7 @@ impl Default for BindgenOptions {
enable_cxx_namespaces: false,
enable_function_attribute_detection: false,
disable_name_namespacing: false,
disable_nested_struct_naming: false,
use_core: false,
ctypes_prefix: None,
namespaced_constants: true,
@ -1708,15 +1930,18 @@ impl Default for BindgenOptions {
time_phases: false,
record_matches: true,
rustfmt_bindings: true,
size_t_is_usize: false,
rustfmt_configuration_file: None,
no_partialeq_types: Default::default(),
no_copy_types: Default::default(),
no_hash_types: Default::default(),
array_pointers_in_arguments: false,
wasm_import_module_name: None,
}
}
}
#[cfg(feature = "runtime")]
fn ensure_libclang_is_loaded() {
if clang_sys::is_loaded() {
return;
@ -1727,7 +1952,7 @@ fn ensure_libclang_is_loaded() {
// across different threads.
lazy_static! {
static ref LIBCLANG: Arc<clang_sys::SharedLibrary> = {
static ref LIBCLANG: std::sync::Arc<clang_sys::SharedLibrary> = {
clang_sys::load().expect("Unable to find libclang");
clang_sys::get_library().expect(
"We just loaded libclang and it had better still be \
@ -1739,6 +1964,9 @@ fn ensure_libclang_is_loaded() {
clang_sys::set_library(Some(LIBCLANG.clone()));
}
#[cfg(not(feature = "runtime"))]
fn ensure_libclang_is_loaded() {}
/// Generated Rust bindings.
#[derive(Debug)]
pub struct Bindings {
@ -1753,10 +1981,13 @@ impl Bindings {
) -> Result<Bindings, ()> {
ensure_libclang_is_loaded();
#[cfg(feature = "runtime")]
debug!(
"Generating bindings, libclang at {}",
clang_sys::get_library().unwrap().path().display()
);
#[cfg(not(feature = "runtime"))]
debug!("Generating bindings, libclang linked");
options.build();
@ -1958,10 +2189,9 @@ impl Bindings {
}
}
#[cfg(not(feature = "which-rustfmt"))]
Err(io::Error::new(
io::ErrorKind::Other,
"which wasn't enabled, and no rustfmt binary specified",
))
// No rustfmt binary was specified, so assume that the binary is called
// "rustfmt" and that it is in the user's PATH.
Ok(Cow::Owned("rustfmt".into()))
}
/// Checks if rustfmt_bindings is set and runs rustfmt on the string
@ -2113,10 +2343,7 @@ pub struct ClangVersion {
/// Get the major and the minor semver numbers of Clang's version
pub fn clang_version() -> ClangVersion {
if !clang_sys::is_loaded() {
// TODO(emilio): Return meaningful error (breaking).
clang_sys::load().expect("Unable to find libclang");
}
ensure_libclang_is_loaded();
let raw_v: String = clang::extract_clang_version();
let split_v: Option<Vec<&str>> = raw_v
@ -2147,6 +2374,27 @@ pub fn clang_version() -> ClangVersion {
}
}
/// A ParseCallbacks implementation that will act on file includes by echoing a rerun-if-changed
/// line
///
/// When running in side a `build.rs` script, this can be used to make cargo invalidate the
/// generated bindings whenever any of the files included from the header change:
/// ```
/// use bindgen::builder;
/// let bindings = builder()
/// .header("path/to/input/header")
/// .parse_callbacks(Box::new(bindgen::CargoCallbacks))
/// .generate();
/// ```
#[derive(Debug)]
pub struct CargoCallbacks;
impl callbacks::ParseCallbacks for CargoCallbacks {
fn include_file(&self, filename: &str) {
println!("cargo:rerun-if-changed={}", filename);
}
}
/// Test command_line_flag function.
#[test]
fn commandline_flag_unit_test_function() {

47
third_party/rust/bindgen/src/main.rs поставляемый
Просмотреть файл

@ -17,34 +17,41 @@ mod log_stubs;
mod options;
use options::builder_from_flags;
fn clang_version_check() {
let version = clang_version();
let expected_version = if cfg!(feature = "testing_only_libclang_9") {
Some((9, 0))
} else if cfg!(feature = "testing_only_libclang_5") {
Some((5, 0))
} else if cfg!(feature = "testing_only_libclang_4") {
Some((4, 0))
} else if cfg!(feature = "testing_only_libclang_3_9") {
Some((3, 9))
} else if cfg!(feature = "testing_only_libclang_3_8") {
Some((3, 8))
} else {
None
};
info!(
"Clang Version: {}, parsed: {:?}",
version.full, version.parsed
);
if expected_version.is_some() {
assert_eq!(version.parsed, version.parsed);
}
}
pub fn main() {
#[cfg(feature = "logging")]
env_logger::init();
let bind_args: Vec<_> = env::args().collect();
let version = clang_version();
let expected_version = if cfg!(feature = "testing_only_libclang_4") {
(4, 0)
} else if cfg!(feature = "testing_only_libclang_3_8") {
(3, 8)
} else {
// Default to 3.9.
(3, 9)
};
info!("Clang Version: {}", version.full);
match version.parsed {
None => warn!("Couldn't parse libclang version"),
Some(version) if version != expected_version => {
warn!("Using clang {:?}, expected {:?}", version, expected_version);
}
_ => {}
}
match builder_from_flags(bind_args.into_iter()) {
Ok((builder, output, verbose)) => {
clang_version_check();
let builder_result = panic::catch_unwind(|| {
builder.generate().expect("Unable to generate bindings")
});

122
third_party/rust/bindgen/src/options.rs поставляемый
Просмотреть файл

@ -1,4 +1,7 @@
use bindgen::{builder, Builder, CodegenConfig, EnumVariation, RustTarget, RUST_TARGET_STRINGS};
use bindgen::{
builder, AliasVariation, Builder, CodegenConfig, EnumVariation, RustTarget,
RUST_TARGET_STRINGS,
};
use clap::{App, Arg};
use std::fs::File;
use std::io::{self, stderr, Error, ErrorKind, Write};
@ -6,7 +9,9 @@ use std::path::PathBuf;
use std::str::FromStr;
/// Construct a new [`Builder`](./struct.Builder.html) from command line flags.
pub fn builder_from_flags<I>(args: I) -> Result<(Builder, Box<dyn io::Write>, bool), io::Error>
pub fn builder_from_flags<I>(
args: I,
) -> Result<(Builder, Box<dyn io::Write>, bool), io::Error>
where
I: Iterator<Item = String>,
{
@ -33,6 +38,7 @@ where
"consts",
"moduleconsts",
"bitfield",
"newtype",
"rust",
"rust_non_exhaustive",
])
@ -47,6 +53,13 @@ where
.takes_value(true)
.multiple(true)
.number_of_values(1),
Arg::with_name("newtype-enum")
.long("newtype-enum")
.help("Mark any enum whose name matches <regex> as a newtype.")
.value_name("regex")
.takes_value(true)
.multiple(true)
.number_of_values(1),
Arg::with_name("rustified-enum")
.long("rustified-enum")
.help("Mark any enum whose name matches <regex> as a Rust enum.")
@ -74,6 +87,47 @@ where
.takes_value(true)
.multiple(true)
.number_of_values(1),
Arg::with_name("default-alias-style")
.long("default-alias-style")
.help("The default style of code used to generate typedefs.")
.value_name("variant")
.default_value("type_alias")
.possible_values(&[
"type_alias",
"new_type",
"new_type_deref",
])
.multiple(false),
Arg::with_name("normal-alias")
.long("normal-alias")
.help(
"Mark any typedef alias whose name matches <regex> to use \
normal type aliasing.",
)
.value_name("regex")
.takes_value(true)
.multiple(true)
.number_of_values(1),
Arg::with_name("new-type-alias")
.long("new-type-alias")
.help(
"Mark any typedef alias whose name matches <regex> to have \
a new type generated for it.",
)
.value_name("regex")
.takes_value(true)
.multiple(true)
.number_of_values(1),
Arg::with_name("new-type-alias-deref")
.long("new-type-alias-deref")
.help(
"Mark any typedef alias whose name matches <regex> to have \
a new type with Deref and DerefMut to the inner type.",
)
.value_name("regex")
.takes_value(true)
.multiple(true)
.number_of_values(1),
Arg::with_name("blacklist-type")
.long("blacklist-type")
.help("Mark <type> as hidden.")
@ -206,6 +260,13 @@ where
generate names like \"Baz\" instead of \"foo_bar_Baz\" \
for an input name \"foo::bar::Baz\".",
),
Arg::with_name("disable-nested-struct-naming")
.long("disable-nested-struct-naming")
.help(
"Disable nested struct naming, causing bindgen to generate \
names like \"bar\" instead of \"foo_bar\" for a nested \
definition \"struct foo { struct bar { } b; };\"."
),
Arg::with_name("ignore-functions")
.long("ignore-functions")
.help(
@ -228,7 +289,7 @@ where
.help("Do not automatically convert floats to f32/f64."),
Arg::with_name("no-prepend-enum-name")
.long("no-prepend-enum-name")
.help("Do not prepend the enum name to bitfield or constant variants."),
.help("Do not prepend the enum name to constant or newtype variants."),
Arg::with_name("no-include-path-detection")
.long("no-include-path-detection")
.help("Do not try to detect default include paths"),
@ -322,6 +383,9 @@ where
"Do not record matching items in the regex sets. \
This disables reporting of unused items.",
),
Arg::with_name("size_t-is-usize")
.long("size_t-is-usize")
.help("Translate size_t to usize."),
Arg::with_name("no-rustfmt-bindings")
.long("no-rustfmt-bindings")
.help("Do not format the generated bindings with rustfmt."),
@ -373,6 +437,11 @@ where
Arg::with_name("use-array-pointers-in-arguments")
.long("use-array-pointers-in-arguments")
.help("Use `*const [T; size]` instead of `*const T` for C arrays"),
Arg::with_name("wasm-import-module-name")
.long("wasm-import-module-name")
.value_name("name")
.takes_value(true)
.help("The name to be used in a #[link(wasm_import_module = ...)] statement")
]) // .args()
.get_matches_from(args);
@ -407,14 +476,20 @@ where
}
}
if let Some(newtypes) = matches.values_of("newtype-enum") {
for regex in newtypes {
builder = builder.newtype_enum(regex);
}
}
if let Some(rustifieds) = matches.values_of("rustified-enum") {
for regex in rustifieds {
builder = builder.rustified_enum(regex);
}
}
if let Some(bitfields) = matches.values_of("constified-enum") {
for regex in bitfields {
if let Some(const_enums) = matches.values_of("constified-enum") {
for regex in const_enums {
builder = builder.constified_enum(regex);
}
}
@ -424,6 +499,30 @@ where
builder = builder.constified_enum_module(regex);
}
}
if let Some(variant) = matches.value_of("default-alias-style") {
builder =
builder.default_alias_style(AliasVariation::from_str(variant)?);
}
if let Some(type_alias) = matches.values_of("normal-alias") {
for regex in type_alias {
builder = builder.type_alias(regex);
}
}
if let Some(new_type) = matches.values_of("new-type-alias") {
for regex in new_type {
builder = builder.new_type_alias(regex);
}
}
if let Some(new_type_deref) = matches.values_of("new-type-alias-deref") {
for regex in new_type_deref {
builder = builder.new_type_alias_deref(regex);
}
}
if let Some(hidden_types) = matches.values_of("blacklist-type") {
for ty in hidden_types {
builder = builder.blacklist_type(ty);
@ -510,6 +609,11 @@ where
builder = builder.array_pointers_in_arguments(true);
}
if let Some(wasm_import_name) = matches.value_of("wasm-import-module-name")
{
builder = builder.wasm_import_module_name(wasm_import_name);
}
if let Some(prefix) = matches.value_of("ctypes-prefix") {
builder = builder.ctypes_prefix(prefix);
}
@ -559,6 +663,10 @@ where
builder = builder.disable_name_namespacing();
}
if matches.is_present("disable-nested-struct-naming") {
builder = builder.disable_nested_struct_naming();
}
if matches.is_present("ignore-functions") {
builder = builder.ignore_functions();
}
@ -658,6 +766,10 @@ where
builder = builder.record_matches(false);
}
if matches.is_present("size_t-is-usize") {
builder = builder.size_t_is_usize(true);
}
let no_rustfmt_bindings = matches.is_present("no-rustfmt-bindings");
if no_rustfmt_bindings {
builder = builder.rustfmt_bindings(false);

Просмотреть файл

@ -1 +1 @@
{"files":{"Cargo.toml":"23870cd2ada8f913245771d63e99aea00df6917ca461644b5d51324f370b00ef","README.md":"17e5ed3a3bd9b898e73c3056711daabe1238fe9682d24d255f8263fae4eb783d","examples/generate_spidermonkey.rs":"913a34e84f45bd8bbe305629ca5abb2818370333a769074a757ce1bb4bb54778","src/export.rs":"920c045da0597fd330737c707a4d2ec2af6174b809b204b693f57ab45edbdc68","src/import.rs":"5d4c5ac03404ec04af21963f951626209c944ed5c55a51b09b05da596e5174d0","src/lib.rs":"546b6b13669d659d35a130dd29cfe3eac547a41d210adb194db1b214194295d7","src/spec.rs":"9adb6ff0168e3ec29735a5a9198756076385b6f6063883e47190846f46fa7247","src/util.rs":"47fcb109cd3d20eed52f7d1d99a12da86f40204fbf29f990ff60bb35bfe86fa1"},"package":"6c9a0da2208ceb785c1626fa8b7d250d2e5546ae230294b4a998e4f818c1768e"}
{"files":{"Cargo.lock":"c4f860261c1fd22b88a416ddc2546fde7ac6b8d0ee584979b2cc930709840edd","Cargo.toml":"9fd70e5e3152c11487347f14f4f2703486e3de3a1c9f0249f6196ca3b0308511","README.md":"17e5ed3a3bd9b898e73c3056711daabe1238fe9682d24d255f8263fae4eb783d","examples/generate_spidermonkey.rs":"913a34e84f45bd8bbe305629ca5abb2818370333a769074a757ce1bb4bb54778","src/export.rs":"12d94158d1285ac880e3c105f086ad1c22c3c55432fdc3123f8f2ab4ccc71152","src/import.rs":"2f587c0737310e3b50280e0b62069de2bfa585d0812e2f0eb469cdada8502291","src/lib.rs":"546b6b13669d659d35a130dd29cfe3eac547a41d210adb194db1b214194295d7","src/spec.rs":"9adb6ff0168e3ec29735a5a9198756076385b6f6063883e47190846f46fa7247","src/util.rs":"9b19ace8cfc0e47e6090ba9223123eba0214d05c1969414272b6785b25de36d2"},"package":"d535cc5246fd9035268770420afd76c05f87e68b83ebed0ac94e8258e88fc353"}

315
third_party/rust/binjs_meta/Cargo.lock сгенерированный поставляемый Normal file
Просмотреть файл

@ -0,0 +1,315 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
[[package]]
name = "Inflector"
version = "0.11.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "aho-corasick"
version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "ansi_term"
version = "0.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "atty"
version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)",
"termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "binjs_meta"
version = "0.5.4"
dependencies = [
"Inflector 0.11.4 (registry+https://github.com/rust-lang/crates.io-index)",
"clap 2.30.0 (registry+https://github.com/rust-lang/crates.io-index)",
"env_logger 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
"itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"weedle 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"yaml-rust 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "bitflags"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "cfg-if"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "clap"
version = "2.30.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"ansi_term 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)",
"atty 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"textwrap 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"vec_map 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "either"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "env_logger"
version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"atty 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
"humantime 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"termcolor 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "humantime"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "itertools"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"either 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "lazy_static"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "libc"
version = "0.2.36"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "linked-hash-map"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "log"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "memchr"
version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "nom"
version = "5.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"version_check 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "quick-error"
version = "1.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "redox_syscall"
version = "0.1.37"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "redox_termios"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"redox_syscall 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "regex"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"aho-corasick 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
"memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"regex-syntax 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)",
"thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"utf8-ranges 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "regex-syntax"
version = "0.6.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "strsim"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "termcolor"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"winapi-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "termion"
version = "1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)",
"redox_syscall 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)",
"redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "textwrap"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "thread_local"
version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "unicode-width"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "utf8-ranges"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "vec_map"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "version_check"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "weedle"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"nom 5.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "winapi"
version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "winapi-i686-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "winapi-util"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "yaml-rust"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"linked-hash-map 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[metadata]
"checksum Inflector 0.11.4 (registry+https://github.com/rust-lang/crates.io-index)" = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3"
"checksum aho-corasick 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d6531d44de723825aa81398a6415283229725a00fa30713812ab9323faa82fc4"
"checksum ansi_term 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6b3568b48b7cefa6b8ce125f9bb4989e52fbcc29ebea88df04cc7c5f12f70455"
"checksum atty 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "8352656fd42c30a0c3c89d26dea01e3b77c0ab2af18230835c15e2e13cd51859"
"checksum bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b3c30d3802dfb7281680d6285f2ccdaa8c2d8fee41f93805dba5c4cf50dc23cf"
"checksum cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d4c819a1287eb618df47cc647173c5c4c66ba19d888a6e50d605672aed3140de"
"checksum clap 2.30.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1c07b9257a00f3fc93b7f3c417fc15607ec7a56823bc2c37ec744e266387de5b"
"checksum either 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "740178ddf48b1a9e878e6d6509a1442a2d42fd2928aae8e7a6f8a36fb01981b3"
"checksum env_logger 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "aafcde04e90a5226a6443b7aabdb016ba2f8307c847d524724bd9b346dd1a2d3"
"checksum humantime 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f"
"checksum itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f56a2d0bc861f9165be4eb3442afd3c236d8a98afd426f65d92324ae1091a484"
"checksum lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c8f31047daa365f19be14b47c29df4f7c3b581832407daabe6ae77397619237d"
"checksum libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)" = "1e5d97d6708edaa407429faa671b942dc0f2727222fb6b6539bf1db936e4b121"
"checksum linked-hash-map 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "70fb39025bc7cdd76305867c4eccf2f2dcf6e9a57f5b21a93e1c2d86cd03ec9e"
"checksum log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "89f010e843f2b1a31dbd316b3b8d443758bc634bed37aabade59c686d644e0a2"
"checksum memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "796fba70e76612589ed2ce7f45282f5af869e0fdd7cc6199fa1aa1f1d591ba9d"
"checksum nom 5.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0b471253da97532da4b61552249c521e01e736071f71c1a4f7ebbfbf0a06aad6"
"checksum quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0"
"checksum redox_syscall 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)" = "0d92eecebad22b767915e4d529f89f28ee96dbbf5a4810d2b844373f136417fd"
"checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76"
"checksum regex 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3d8c9f33201f46669484bacc312b00e7541bed6aaf296dffe2bb4e0ac6b8ce2a"
"checksum regex-syntax 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)" = "1132f845907680735a84409c3bebc64d1364a5683ffbce899550cd09d5eaefc1"
"checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550"
"checksum termcolor 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb6bfa289a4d7c5766392812c0a1f4c1ba45afa1ad47803c11e1f407d846d75f"
"checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096"
"checksum textwrap 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c0b59b6b4b44d867f1370ef1bd91bfb262bf07bf0ae65c202ea2fbc16153b693"
"checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b"
"checksum unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "bf3a113775714a22dcb774d8ea3655c53a32debae63a063acc00a91cc586245f"
"checksum utf8-ranges 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "662fab6525a98beff2921d7f61a39e7d59e0b425ebc7d0d9e66d316e55124122"
"checksum vec_map 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "887b5b631c2ad01628bbbaa7dd4c869f80d3186688f8d0b6f58774fbe324988c"
"checksum version_check 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "078775d0255232fb988e6fccf26ddc9d1ac274299aaedcedce21c6f72cc533ce"
"checksum weedle 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8a7d4f9feb723a800d8f7b74edc9fa44ff35cb0b2ec64886714362f423427f37"
"checksum winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "04e3bd221fcbe8a271359c04f21a76db7d0c6028862d1bb5512d85e1e2eb5bb3"
"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
"checksum winapi-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4ccfbf554c6ad11084fb7517daca16cfdcaccbdadba4fc336f032a8b12c2ad80"
"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
"checksum yaml-rust 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "57ab38ee1a4a266ed033496cf9af1828d8d6e6c1cfa5f643a2809effcae4d628"

7
third_party/rust/binjs_meta/Cargo.toml поставляемый
Просмотреть файл

@ -12,7 +12,7 @@
[package]
name = "binjs_meta"
version = "0.5.2"
version = "0.5.4"
authors = ["David Teller <D.O.Teller@gmail.com>"]
description = "Part of binjs-ref. Tools for manipulating grammars. You probably do not want to use this crate directly unless you're writing an encoder, decoder or parser generator for binjs."
homepage = "https://binast.github.io/ecmascript-binary-ast/"
@ -22,7 +22,8 @@ categories = ["compression", "parsing", "web-programming"]
license = "MIT"
repository = "https://github.com/binast/binjs-ref"
[dependencies.Inflector]
version = "^0.11"
version = "^0.11.4"
default-features = false
[dependencies.itertools]
version = "^0.8"
@ -31,7 +32,7 @@ version = "^0.8"
version = "^0.4"
[dependencies.weedle]
version = "^0.8"
version = "0.11"
[dev-dependencies.clap]
version = "^2.0"

4
third_party/rust/binjs_meta/src/export.rs поставляемый
Просмотреть файл

@ -348,7 +348,7 @@ impl TypeDeanonymizer {
let mut names = vec![];
let mut subsums = vec![];
for sub_type in sum.types() {
let (mut sub_sum, name) = self.import_typespec(spec, sub_type, None);
let (sub_sum, name) = self.import_typespec(spec, sub_type, None);
let mut sub_sum = sub_sum.unwrap_or_else(
|| panic!("While treating {:?}, attempting to create a sum containing {}, which isn't an interface or a sum of interfaces", type_spec, name)
);
@ -370,7 +370,7 @@ impl TypeDeanonymizer {
};
for subsum_name in subsums {
// So, `my_name` is a superset of `subsum_name`.
let mut supersum_entry = self
let supersum_entry = self
.supersums_of
.entry(subsum_name.clone())
.or_insert_with(|| HashSet::new());

8
third_party/rust/binjs_meta/src/import.rs поставляемый
Просмотреть файл

@ -75,7 +75,7 @@ impl Importer {
/// ```
pub fn import<'a>(
sources: impl IntoIterator<Item = &'a str>,
) -> Result<SpecBuilder, weedle::Err<CompleteStr<'a>>> {
) -> Result<SpecBuilder, weedle::Err<(&'a str, ErrorKind)>> {
let mut importer = Importer {
path: Vec::with_capacity(256),
builder: SpecBuilder::new(),
@ -258,7 +258,7 @@ impl Importer {
.builder
.get_typedef_mut(&node_name)
.unwrap_or_else(|| panic!("Could not find typedef {}", extended));
let mut typespec = typedef.spec_mut();
let typespec = typedef.spec_mut();
let typesum = if let TypeSpec::TypeSum(ref mut typesum) = *typespec {
typesum
} else {
@ -330,7 +330,9 @@ impl Importer {
.list
.iter()
.map(|t| match t {
UnionMemberType::Single(t) => self.convert_single_type(t),
UnionMemberType::Single(AttributedNonAnyType { type_: t, .. }) => {
self.convert_single_type(t)
}
UnionMemberType::Union(t) => self.convert_union_type(t),
})
.map(|t| t.spec)

2
third_party/rust/binjs_meta/src/util.rs поставляемый
Просмотреть файл

@ -294,7 +294,7 @@ where
let text = &line[indent_len..];
let mut gobbled = 0;
while text.len() > gobbled {
let mut rest = &text[gobbled..];
let rest = &text[gobbled..];
eprintln!("Line still contains {} ({})", rest, gobbled);
if rest.len() + prefix.len() > columns {
// Try and find the largest prefix of `text` that fits within `columns`.

2
third_party/rust/cexpr/.cargo-checksum.json поставляемый
Просмотреть файл

@ -1 +1 @@
{"files":{"Cargo.toml":"32b00f47d6888b44ac5fb30e9693437dd95c98f000b5abb9a85880edc746dcb4","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"d9771b8c6cf4426d3846de54c1febe20907f1eeadf7adfb5ade89a83bd9ea77f","src/expr.rs":"b2c80d3125ff2fd66d0f889dfa2d6476b8e68cc9513e508ba862470182a3f7cc","src/lib.rs":"689f19cb8a8e88c2489e0d8f59ed75b03cb19f0e789e5a0d3447f695b2ef2259","src/literal.rs":"22aec22c7bdd374afd06c16c19f09b2763c5ffc37ecb0bbd60a5d9102f57ebc3","src/token.rs":"52d42deb2a2575bb8631e2e821593d8288fed16e21bab3ceeacb6a7b06c40087","tests/clang.rs":"0f820e2003e34c2ab69cd759314cebf755fd1b1929974976d3776968f687be7e","tests/input/chars.h":"69c8141870872b795b5174bad125b748732c2b01d0e98ffcfc37b19f3f791f69","tests/input/fail.h":"b0b6cffd2dd17410b5eb02ee79ab75754820480b960db8a9866cc9983bd36b65","tests/input/floats.h":"28ec664e793c494e1a31f3bc5b790014e9921fc741bf475a86319b9a9eee5915","tests/input/int_signed.h":"934199eded85dd7820ca08c0beb1381ee6d9339970d2720a69c23025571707ce","tests/input/int_unsigned.h":"d6b82716669aecbec4cfff2d1bf8c5af926f80ba01fe89de3b439264f3080ccb","tests/input/strings.h":"75c60527068172b97983d2b8361938e856ea394002d5bef05de1adc6a0f5fc01","tests/input/test_llvm_bug_9069.h":"8d9ae1d1eadc8f6d5c14296f984547fe894d0f2ce5cd6d7aa8caad40a56bc5e1"},"package":"8fc0086be9ca82f7fc89fc873435531cb898b86e850005850de1f820e2db6e9b"}
{"files":{"Cargo.toml":"fa6eef7c30868053f4ef38aa6863b980639c3df49230691f28e8bdde91ab5071","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"d9771b8c6cf4426d3846de54c1febe20907f1eeadf7adfb5ade89a83bd9ea77f","bors.toml":"1c81ede536a37edd30fe4e622ff0531b25372403ac9475a5d6c50f14156565a2","rustfmt.toml":"d8e7f616455a670ba75e3e94bf6f88f4c168c481664d12501820c7dfff5c3cc2","src/expr.rs":"76e9dd53c1f964bfd83866c19849b4d940214032369403cafaa4a595dee66d95","src/lib.rs":"afaf05ed6d5bf93072b853c1999b87b0390311672c52500a0dd467c0caa8701d","src/literal.rs":"637cd13968a6b9cc34dcfa55da67ac144b4f0b1fea7395a746230a41fe1349db","src/token.rs":"cd1ba6315b0137de9a0711670dd1840ac76c41f3b88dcd1a93ad77e1800c703f","tests/clang.rs":"5bb9807f35f760065d15cb9dfb7d8b79c2f734aef7ba5fe3737154155ed8ee73","tests/input/chars.h":"69c8141870872b795b5174bad125b748732c2b01d0e98ffcfc37b19f3f791f69","tests/input/fail.h":"b0b6cffd2dd17410b5eb02ee79ab75754820480b960db8a9866cc9983bd36b65","tests/input/floats.h":"28ec664e793c494e1a31f3bc5b790014e9921fc741bf475a86319b9a9eee5915","tests/input/int_signed.h":"934199eded85dd7820ca08c0beb1381ee6d9339970d2720a69c23025571707ce","tests/input/int_unsigned.h":"7b8023ba468ec76b184912692bc40e8fbcdd92ad86ec5a7c0dbcb02f2b8d961d","tests/input/strings.h":"2dd11bc066f34e8cb1916a28353e9e9a3a21cd406651b2f94fc47e89c95d9cba","tests/input/test_llvm_bug_9069.h":"8d9ae1d1eadc8f6d5c14296f984547fe894d0f2ce5cd6d7aa8caad40a56bc5e1"},"package":"f4aedb84272dbe89af497cf81375129abda4fc0a9e7c5d317498c15cc30c0d27"}

14
third_party/rust/cexpr/Cargo.toml поставляемый
Просмотреть файл

@ -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
@ -11,8 +11,9 @@
# will likely look very different (and much more reasonable)
[package]
edition = "2018"
name = "cexpr"
version = "0.3.3"
version = "0.4.0"
authors = ["Jethro Beekman <jethro@jbeekman.nl>"]
description = "A C expression parser and evaluator"
documentation = "https://docs.rs/cexpr/"
@ -20,7 +21,10 @@ keywords = ["C", "expression", "parser"]
license = "Apache-2.0/MIT"
repository = "https://github.com/jethrogb/rust-cexpr"
[dependencies.nom]
version = "^4"
features = ["verbose-errors"]
version = "5"
features = ["std"]
default-features = false
[dev-dependencies.clang-sys]
version = ">= 0.13.0, < 0.27.0"
version = ">= 0.13.0, < 0.29.0"
[badges.travis-ci]
repository = "jethrogb/rust-cexpr"

3
third_party/rust/cexpr/bors.toml поставляемый Normal file
Просмотреть файл

@ -0,0 +1,3 @@
status = [
"continuous-integration/travis-ci/push",
]

1
third_party/rust/cexpr/rustfmt.toml поставляемый Normal file
Просмотреть файл

@ -0,0 +1 @@
edition = "2018"

819
third_party/rust/cexpr/src/expr.rs поставляемый
Просмотреть файл

@ -20,36 +20,47 @@
//! Use the `IdentifierParser` to substitute identifiers found in expressions.
use std::collections::HashMap;
use std::ops::{AddAssign,BitAndAssign,BitOrAssign,BitXorAssign,DivAssign,MulAssign,RemAssign,ShlAssign,ShrAssign,SubAssign};
use std::num::Wrapping;
use std::ops::{
AddAssign, BitAndAssign, BitOrAssign, BitXorAssign, DivAssign, MulAssign, RemAssign, ShlAssign,
ShrAssign, SubAssign,
};
use literal::{self,CChar};
use token::{Token,Kind as TokenKind};
use nom_crate::*;
use crate::literal::{self, CChar};
use crate::token::{Kind as TokenKind, Token};
use crate::ToCexprResult;
use nom::branch::alt;
use nom::combinator::{complete, map, map_opt};
use nom::multi::{fold_many0, many0, separated_list};
use nom::sequence::{delimited, pair, preceded};
use nom::*;
/// Expression parser/evaluator that supports identifiers.
#[derive(Debug)]
pub struct IdentifierParser<'ident> {
identifiers: &'ident HashMap<Vec<u8>,EvalResult>,
identifiers: &'ident HashMap<Vec<u8>, EvalResult>,
}
#[derive(Copy,Clone)]
#[derive(Copy, Clone)]
struct PRef<'a>(&'a IdentifierParser<'a>);
pub type CResult<'a,R> = IResult<&'a [Token],R,::Error>;
/// A shorthand for the type of cexpr expression evaluation results.
pub type CResult<'a, R> = IResult<&'a [Token], R, crate::Error<&'a [Token]>>;
/// The result of parsing a literal or evaluating an expression.
#[derive(Debug,Clone,PartialEq)]
#[derive(Debug, Clone, PartialEq)]
#[allow(missing_docs)]
pub enum EvalResult {
Int(Wrapping<i64>),
Float(f64),
Char(CChar),
Str(Vec<u8>),
Invalid,
Int(Wrapping<i64>),
Float(f64),
Char(CChar),
Str(Vec<u8>),
Invalid,
}
macro_rules! result_opt (
(fn $n:ident: $e:ident -> $t:ty) => (
#[allow(dead_code)]
#[allow(clippy::wrong_self_convention)]
fn $n(self) -> Option<$t> {
if let EvalResult::$e(v) = self {
Some(v)
@ -61,23 +72,24 @@ macro_rules! result_opt (
);
impl EvalResult {
result_opt!(fn as_int: Int -> Wrapping<i64>);
result_opt!(fn as_float: Float -> f64);
result_opt!(fn as_char: Char -> CChar);
result_opt!(fn as_str: Str -> Vec<u8>);
fn as_numeric(self) -> Option<EvalResult> {
match self {
EvalResult::Int(_) | EvalResult::Float(_) => Some(self),
_ => None,
}
}
result_opt!(fn as_int: Int -> Wrapping<i64>);
result_opt!(fn as_float: Float -> f64);
result_opt!(fn as_char: Char -> CChar);
result_opt!(fn as_str: Str -> Vec<u8>);
#[allow(clippy::wrong_self_convention)]
fn as_numeric(self) -> Option<EvalResult> {
match self {
EvalResult::Int(_) | EvalResult::Float(_) => Some(self),
_ => None,
}
}
}
impl From<Vec<u8>> for EvalResult {
fn from(s: Vec<u8>) -> EvalResult {
EvalResult::Str(s)
}
fn from(s: Vec<u8>) -> EvalResult {
EvalResult::Str(s)
}
}
// ===========================================
@ -85,89 +97,76 @@ impl From<Vec<u8>> for EvalResult {
// ===========================================
macro_rules! exact_token (
($i:expr, $k:ident, $c:expr) => ({
if $i.is_empty() {
let res: CResult<&[u8]> = Err(::nom_crate::Err::Incomplete(Needed::Size($c.len())));
($k:ident, $c:expr) => ({
move |input: &[Token]| {
if input.is_empty() {
let res: CResult<'_, &[u8]> = Err(crate::nom::Err::Incomplete(Needed::Size($c.len())));
res
} else {
if $i[0].kind==TokenKind::$k && &$i[0].raw[..]==$c {
Ok((&$i[1..], &$i[0].raw[..]))
if input[0].kind==TokenKind::$k && &input[0].raw[..]==$c {
Ok((&input[1..], &input[0].raw[..]))
} else {
Err(::nom_crate::Err::Error(error_position!($i, ErrorKind::Custom(::Error::ExactToken(TokenKind::$k,$c)))))
Err(crate::nom::Err::Error((input, crate::ErrorKind::ExactToken(TokenKind::$k,$c)).into()))
}
}
}
});
);
macro_rules! typed_token (
($i:expr, $k:ident) => ({
if $i.is_empty() {
let res: CResult<&[u8]> = Err(::nom_crate::Err::Incomplete(Needed::Size(1)));
($k:ident) => ({
move |input: &[Token]| {
if input.is_empty() {
let res: CResult<'_, &[u8]> = Err(nom::Err::Incomplete(Needed::Size(1)));
res
} else {
if $i[0].kind==TokenKind::$k {
Ok((&$i[1..], &$i[0].raw[..]))
if input[0].kind==TokenKind::$k {
Ok((&input[1..], &input[0].raw[..]))
} else {
Err(Err::Error(error_position!($i, ErrorKind::Custom(::Error::TypedToken(TokenKind::$k)))))
Err(crate::nom::Err::Error((input, crate::ErrorKind::TypedToken(TokenKind::$k)).into()))
}
}
}
});
);
#[allow(unused_macros)]
macro_rules! any_token (
($i:expr,) => ({
if $i.is_empty() {
let res: CResult<&Token> = Err(::nom_crate::Err::Incomplete(Needed::Size(1)));
res
} else {
Ok((&$i[1..], &$i[0]))
}
});
);
#[allow(dead_code)]
fn any_token(input: &[Token]) -> CResult<'_, &Token> {
if input.is_empty() {
Err(crate::nom::Err::Incomplete(Needed::Size(1)))
} else {
Ok((&input[1..], &input[0]))
}
}
macro_rules! p (
($i:expr, $c:expr) => (exact_token!($i,Punctuation,$c.as_bytes()))
);
fn p(c: &'static str) -> impl Fn(&[Token]) -> CResult<'_, &[u8]> {
exact_token!(Punctuation, c.as_bytes())
}
macro_rules! one_of_punctuation (
($i:expr, $c:expr) => ({
if $i.is_empty() {
let min = $c.iter().map(|opt|opt.len()).min().expect("at least one option");
let res: CResult<&[u8]> = Err(::nom_crate::Err::Incomplete(Needed::Size(min)));
res
} else {
if $i[0].kind==TokenKind::Punctuation && $c.iter().any(|opt|opt.as_bytes()==&$i[0].raw[..]) {
Ok((&$i[1..], &$i[0].raw[..]))
} else {
const VALID_VALUES: &'static [&'static str] = &$c;
Err(Err::Error(error_position!($i, ErrorKind::Custom(::Error::ExactTokens(TokenKind::Punctuation,VALID_VALUES)))))
}
}
});
);
/// equivalent to nom's complete! macro, but adds the custom error type
#[macro_export]
macro_rules! comp (
($i:expr, $submac:ident!( $($args:tt)* )) => (
{
use ::nom_crate::lib::std::result::Result::*;
use ::nom_crate::{Err,ErrorKind};
let i_ = $i.clone();
match $submac!(i_, $($args)*) {
Err(Err::Incomplete(_)) => {
Err(Err::Error(error_position!($i, ErrorKind::Complete::<::Error>)))
},
rest => rest
}
}
);
($i:expr, $f:expr) => (
comp!($i, call!($f));
);
);
fn one_of_punctuation(c: &'static [&'static str]) -> impl Fn(&[Token]) -> CResult<'_, &[u8]> {
move |input| {
if input.is_empty() {
let min = c
.iter()
.map(|opt| opt.len())
.min()
.expect("at least one option");
Err(crate::nom::Err::Incomplete(Needed::Size(min)))
} else if input[0].kind == TokenKind::Punctuation
&& c.iter().any(|opt| opt.as_bytes() == &input[0].raw[..])
{
Ok((&input[1..], &input[0].raw[..]))
} else {
Err(crate::nom::Err::Error(
(
input,
crate::ErrorKind::ExactTokens(TokenKind::Punctuation, c),
)
.into(),
))
}
}
}
// ==================================================
// ============= Numeric expressions ================
@ -175,240 +174,242 @@ macro_rules! comp (
impl<'a> AddAssign<&'a EvalResult> for EvalResult {
fn add_assign(&mut self, rhs: &'a EvalResult) {
use self::EvalResult::*;
*self=match (&*self,rhs) {
(&Int(a), &Int(b)) => Int(a+b),
(&Float(a),&Int(b)) => Float(a+(b.0 as f64)),
(&Int(a), &Float(b)) => Float(a.0 as f64+b),
(&Float(a),&Float(b)) => Float(a+b),
_ => Invalid
};
}
use self::EvalResult::*;
*self = match (&*self, rhs) {
(&Int(a), &Int(b)) => Int(a + b),
(&Float(a), &Int(b)) => Float(a + (b.0 as f64)),
(&Int(a), &Float(b)) => Float(a.0 as f64 + b),
(&Float(a), &Float(b)) => Float(a + b),
_ => Invalid,
};
}
}
impl<'a> BitAndAssign<&'a EvalResult> for EvalResult {
fn bitand_assign(&mut self, rhs: &'a EvalResult) {
use self::EvalResult::*;
*self=match (&*self,rhs) {
(&Int(a),&Int(b)) => Int(a&b),
_ => Invalid
}; }
use self::EvalResult::*;
*self = match (&*self, rhs) {
(&Int(a), &Int(b)) => Int(a & b),
_ => Invalid,
};
}
}
impl<'a> BitOrAssign<&'a EvalResult> for EvalResult {
fn bitor_assign(&mut self, rhs: &'a EvalResult) {
use self::EvalResult::*;
*self=match (&*self,rhs) {
(&Int(a),&Int(b)) => Int(a|b),
_ => Invalid
};
}
use self::EvalResult::*;
*self = match (&*self, rhs) {
(&Int(a), &Int(b)) => Int(a | b),
_ => Invalid,
};
}
}
impl<'a> BitXorAssign<&'a EvalResult> for EvalResult {
fn bitxor_assign(&mut self, rhs: &'a EvalResult) {
use self::EvalResult::*;
*self=match (&*self,rhs) {
(&Int(a),&Int(b)) => Int(a^b),
_ => Invalid
};
}
use self::EvalResult::*;
*self = match (&*self, rhs) {
(&Int(a), &Int(b)) => Int(a ^ b),
_ => Invalid,
};
}
}
impl<'a> DivAssign<&'a EvalResult> for EvalResult {
fn div_assign(&mut self, rhs: &'a EvalResult) {
use self::EvalResult::*;
*self=match (&*self,rhs) {
(&Int(a), &Int(b)) => Int(a/b),
(&Float(a),&Int(b)) => Float(a/(b.0 as f64)),
(&Int(a), &Float(b)) => Float(a.0 as f64/b),
(&Float(a),&Float(b)) => Float(a/b),
_ => Invalid
};
}
use self::EvalResult::*;
*self = match (&*self, rhs) {
(&Int(a), &Int(b)) => Int(a / b),
(&Float(a), &Int(b)) => Float(a / (b.0 as f64)),
(&Int(a), &Float(b)) => Float(a.0 as f64 / b),
(&Float(a), &Float(b)) => Float(a / b),
_ => Invalid,
};
}
}
impl<'a> MulAssign<&'a EvalResult> for EvalResult {
fn mul_assign(&mut self, rhs: &'a EvalResult) {
use self::EvalResult::*;
*self=match (&*self,rhs) {
(&Int(a), &Int(b)) => Int(a*b),
(&Float(a),&Int(b)) => Float(a*(b.0 as f64)),
(&Int(a), &Float(b)) => Float(a.0 as f64*b),
(&Float(a),&Float(b)) => Float(a*b),
_ => Invalid
};
}
use self::EvalResult::*;
*self = match (&*self, rhs) {
(&Int(a), &Int(b)) => Int(a * b),
(&Float(a), &Int(b)) => Float(a * (b.0 as f64)),
(&Int(a), &Float(b)) => Float(a.0 as f64 * b),
(&Float(a), &Float(b)) => Float(a * b),
_ => Invalid,
};
}
}
impl<'a> RemAssign<&'a EvalResult> for EvalResult {
fn rem_assign(&mut self, rhs: &'a EvalResult) {
use self::EvalResult::*;
*self=match (&*self,rhs) {
(&Int(a), &Int(b)) => Int(a%b),
(&Float(a),&Int(b)) => Float(a%(b.0 as f64)),
(&Int(a), &Float(b)) => Float(a.0 as f64%b),
(&Float(a),&Float(b)) => Float(a%b),
_ => Invalid
};
}
use self::EvalResult::*;
*self = match (&*self, rhs) {
(&Int(a), &Int(b)) => Int(a % b),
(&Float(a), &Int(b)) => Float(a % (b.0 as f64)),
(&Int(a), &Float(b)) => Float(a.0 as f64 % b),
(&Float(a), &Float(b)) => Float(a % b),
_ => Invalid,
};
}
}
impl<'a> ShlAssign<&'a EvalResult> for EvalResult {
fn shl_assign(&mut self, rhs: &'a EvalResult) {
use self::EvalResult::*;
*self=match (&*self,rhs) {
(&Int(a),&Int(b)) => Int(a<<(b.0 as usize)),
_ => Invalid
};
}
use self::EvalResult::*;
*self = match (&*self, rhs) {
(&Int(a), &Int(b)) => Int(a << (b.0 as usize)),
_ => Invalid,
};
}
}
impl<'a> ShrAssign<&'a EvalResult> for EvalResult {
fn shr_assign(&mut self, rhs: &'a EvalResult) {
use self::EvalResult::*;
*self=match (&*self,rhs) {
(&Int(a),&Int(b)) => Int(a>>(b.0 as usize)),
_ => Invalid
};
}
use self::EvalResult::*;
*self = match (&*self, rhs) {
(&Int(a), &Int(b)) => Int(a >> (b.0 as usize)),
_ => Invalid,
};
}
}
impl<'a> SubAssign<&'a EvalResult> for EvalResult {
fn sub_assign(&mut self, rhs: &'a EvalResult) {
use self::EvalResult::*;
*self=match (&*self,rhs) {
(&Int(a), &Int(b)) => Int(a-b),
(&Float(a),&Int(b)) => Float(a-(b.0 as f64)),
(&Int(a), &Float(b)) => Float(a.0 as f64-b),
(&Float(a),&Float(b)) => Float(a-b),
_ => Invalid
};
}
use self::EvalResult::*;
*self = match (&*self, rhs) {
(&Int(a), &Int(b)) => Int(a - b),
(&Float(a), &Int(b)) => Float(a - (b.0 as f64)),
(&Int(a), &Float(b)) => Float(a.0 as f64 - b),
(&Float(a), &Float(b)) => Float(a - b),
_ => Invalid,
};
}
}
fn unary_op(input: (&[u8],EvalResult)) -> Option<EvalResult> {
use self::EvalResult::*;
assert_eq!(input.0.len(),1);
match (input.0[0],input.1) {
(b'+',i) => Some(i),
(b'-',Int(i)) => Some(Int(Wrapping(i.0.wrapping_neg()))), // impl Neg for Wrapping not until rust 1.10...
(b'-',Float(i)) => Some(Float(-i)),
(b'-',_) => unreachable!("non-numeric unary op"),
(b'~',Int(i)) => Some(Int(!i)),
(b'~',Float(_)) => None,
(b'~',_) => unreachable!("non-numeric unary op"),
_ => unreachable!("invalid unary op"),
}
fn unary_op(input: (&[u8], EvalResult)) -> Option<EvalResult> {
use self::EvalResult::*;
assert_eq!(input.0.len(), 1);
match (input.0[0], input.1) {
(b'+', i) => Some(i),
(b'-', Int(i)) => Some(Int(Wrapping(i.0.wrapping_neg()))), // impl Neg for Wrapping not until rust 1.10...
(b'-', Float(i)) => Some(Float(-i)),
(b'-', _) => unreachable!("non-numeric unary op"),
(b'~', Int(i)) => Some(Int(!i)),
(b'~', Float(_)) => None,
(b'~', _) => unreachable!("non-numeric unary op"),
_ => unreachable!("invalid unary op"),
}
}
macro_rules! numeric (
($i:expr, $submac:ident!( $($args:tt)* )) => (map_opt!($i,$submac!($($args)*),EvalResult::as_numeric));
($i:expr, $f:expr ) => (map_opt!($i,call!($f),EvalResult::as_numeric));
);
fn numeric<I: Clone, E: nom::error::ParseError<I>, F>(
f: F,
) -> impl Fn(I) -> nom::IResult<I, EvalResult, E>
where
F: Fn(I) -> nom::IResult<I, EvalResult, E>,
{
nom::combinator::map_opt(f, EvalResult::as_numeric)
}
impl<'a> PRef<'a> {
method!(unary<PRef<'a>,&[Token],EvalResult,::Error>, mut self,
alt!(
delimited!(p!("("),call_m!(self.numeric_expr),p!(")")) |
numeric!(call_m!(self.literal)) |
numeric!(call_m!(self.identifier)) |
map_opt!(pair!(one_of_punctuation!(["+", "-", "~"]),call_m!(self.unary)),unary_op)
)
);
fn unary(self, input: &'_ [Token]) -> CResult<'_, EvalResult> {
alt((
delimited(p("("), |i| self.numeric_expr(i), p(")")),
numeric(|i| self.literal(i)),
numeric(|i| self.identifier(i)),
map_opt(
pair(one_of_punctuation(&["+", "-", "~"][..]), |i| self.unary(i)),
unary_op,
),
))(input)
}
method!(mul_div_rem<PRef<'a>,&[Token],EvalResult,::Error>, mut self,
do_parse!(
acc: call_m!(self.unary) >>
res: fold_many0!(
pair!(comp!(one_of_punctuation!(["*", "/", "%"])), call_m!(self.unary)),
acc,
|mut acc, (op, val): (&[u8], EvalResult)| {
match op[0] as char {
'*' => acc *= &val,
'/' => acc /= &val,
'%' => acc %= &val,
_ => unreachable!()
};
acc
}
) >> (res)
)
);
fn mul_div_rem(self, input: &'_ [Token]) -> CResult<'_, EvalResult> {
let (input, acc) = self.unary(input)?;
fold_many0(
pair(complete(one_of_punctuation(&["*", "/", "%"][..])), |i| {
self.unary(i)
}),
acc,
|mut acc, (op, val): (&[u8], EvalResult)| {
match op[0] as char {
'*' => acc *= &val,
'/' => acc /= &val,
'%' => acc %= &val,
_ => unreachable!(),
};
acc
},
)(input)
}
method!(add_sub<PRef<'a>,&[Token],EvalResult,::Error>, mut self,
do_parse!(
acc: call_m!(self.mul_div_rem) >>
res: fold_many0!(
pair!(comp!(one_of_punctuation!(["+", "-"])), call_m!(self.mul_div_rem)),
acc,
|mut acc, (op, val): (&[u8], EvalResult)| {
match op[0] as char {
'+' => acc += &val,
'-' => acc -= &val,
_ => unreachable!()
};
acc
}
) >> (res)
)
);
fn add_sub(self, input: &'_ [Token]) -> CResult<'_, EvalResult> {
let (input, acc) = self.mul_div_rem(input)?;
fold_many0(
pair(complete(one_of_punctuation(&["+", "-"][..])), |i| {
self.mul_div_rem(i)
}),
acc,
|mut acc, (op, val): (&[u8], EvalResult)| {
match op[0] as char {
'+' => acc += &val,
'-' => acc -= &val,
_ => unreachable!(),
};
acc
},
)(input)
}
method!(shl_shr<PRef<'a>,&[Token],EvalResult,::Error>, mut self,
numeric!(do_parse!(
acc: call_m!(self.add_sub) >>
res: fold_many0!(
pair!(comp!(one_of_punctuation!(["<<", ">>"])), call_m!(self.add_sub)),
acc,
|mut acc, (op, val): (&[u8], EvalResult)| {
match op {
b"<<" => acc <<= &val,
b">>" => acc >>= &val,
_ => unreachable!()
};
acc
}
) >> (res)
))
);
fn shl_shr(self, input: &'_ [Token]) -> CResult<'_, EvalResult> {
let (input, acc) = self.add_sub(input)?;
numeric(fold_many0(
pair(complete(one_of_punctuation(&["<<", ">>"][..])), |i| {
self.add_sub(i)
}),
acc,
|mut acc, (op, val): (&[u8], EvalResult)| {
match op {
b"<<" => acc <<= &val,
b">>" => acc >>= &val,
_ => unreachable!(),
};
acc
},
))(input)
}
method!(and<PRef<'a>,&[Token],EvalResult,::Error>, mut self,
numeric!(do_parse!(
acc: call_m!(self.shl_shr) >>
res: fold_many0!(
preceded!(comp!(p!("&")), call_m!(self.shl_shr)),
acc,
|mut acc, val: EvalResult| {
acc &= &val;
acc
}
) >> (res)
))
);
fn and(self, input: &'_ [Token]) -> CResult<'_, EvalResult> {
let (input, acc) = self.shl_shr(input)?;
numeric(fold_many0(
preceded(complete(p("&")), |i| self.shl_shr(i)),
acc,
|mut acc, val: EvalResult| {
acc &= &val;
acc
},
))(input)
}
method!(xor<PRef<'a>,&[Token],EvalResult,::Error>, mut self,
numeric!(do_parse!(
acc: call_m!(self.and) >>
res: fold_many0!(
preceded!(comp!(p!("^")), call_m!(self.and)),
acc,
|mut acc, val: EvalResult| {
acc ^= &val;
acc
}
) >> (res)
))
);
fn xor(self, input: &'_ [Token]) -> CResult<'_, EvalResult> {
let (input, acc) = self.and(input)?;
numeric(fold_many0(
preceded(complete(p("^")), |i| self.and(i)),
acc,
|mut acc, val: EvalResult| {
acc ^= &val;
acc
},
))(input)
}
method!(or<PRef<'a>,&[Token],EvalResult,::Error>, mut self,
numeric!(do_parse!(
acc: call_m!(self.xor) >>
res: fold_many0!(
preceded!(comp!(p!("|")), call_m!(self.xor)),
acc,
|mut acc, val: EvalResult| {
acc |= &val;
acc
}
) >> (res)
))
);
fn or(self, input: &'_ [Token]) -> CResult<'_, EvalResult> {
let (input, acc) = self.xor(input)?;
numeric(fold_many0(
preceded(complete(p("|")), |i| self.xor(i)),
acc,
|mut acc, val: EvalResult| {
acc |= &val;
acc
},
))(input)
}
#[inline(always)]
fn numeric_expr(self, input: &[Token]) -> (Self,CResult<EvalResult>) {
self.or(input)
}
#[inline(always)]
fn numeric_expr(self, input: &'_ [Token]) -> CResult<'_, EvalResult> {
self.or(input)
}
}
// =======================================================
@ -416,126 +417,147 @@ impl<'a> PRef<'a> {
// =======================================================
impl<'a> PRef<'a> {
fn identifier(self, input: &[Token]) -> (Self,CResult<EvalResult>) {
(self,match input.split_first() {
None =>
Err(Err::Incomplete(Needed::Size(1))),
Some((&Token{kind:TokenKind::Identifier,ref raw},rest)) => {
if let Some(r) = self.identifiers.get(&raw[..]) {
Ok((rest, r.clone()))
} else {
Err(Err::Error(error_position!(input, ErrorKind::Custom(::Error::UnknownIdentifier))))
}
},
Some(_) =>
Err(Err::Error(error_position!(input, ErrorKind::Custom(::Error::TypedToken(TokenKind::Identifier))))),
})
}
fn identifier(self, input: &'_ [Token]) -> CResult<'_, EvalResult> {
match input.split_first() {
None => Err(Err::Incomplete(Needed::Size(1))),
Some((
&Token {
kind: TokenKind::Identifier,
ref raw,
},
rest,
)) => {
if let Some(r) = self.identifiers.get(&raw[..]) {
Ok((rest, r.clone()))
} else {
Err(Err::Error(
(input, crate::ErrorKind::UnknownIdentifier).into(),
))
}
}
Some(_) => Err(Err::Error(
(input, crate::ErrorKind::TypedToken(TokenKind::Identifier)).into(),
)),
}
}
fn literal(self, input: &[Token]) -> (Self,CResult<EvalResult>) {
(self,match input.split_first() {
None =>
Err(Err::Incomplete(Needed::Size(1))),
Some((&Token{kind:TokenKind::Literal,ref raw},rest)) =>
match literal::parse(raw) {
Ok((_,result)) => Ok((rest, result)),
_ => {
Err(Err::Error(error_position!(input, ErrorKind::Custom(::Error::InvalidLiteral))))
},
},
Some(_) =>
Err(Err::Error(error_position!(input, ErrorKind::Custom(::Error::TypedToken(TokenKind::Literal))))),
})
}
fn literal(self, input: &'_ [Token]) -> CResult<'_, EvalResult> {
match input.split_first() {
None => Err(Err::Incomplete(Needed::Size(1))),
Some((
&Token {
kind: TokenKind::Literal,
ref raw,
},
rest,
)) => match literal::parse(raw) {
Ok((_, result)) => Ok((rest, result)),
_ => Err(Err::Error((input, crate::ErrorKind::InvalidLiteral).into())),
},
Some(_) => Err(Err::Error(
(input, crate::ErrorKind::TypedToken(TokenKind::Literal)).into(),
)),
}
}
method!(string<PRef<'a>,&[Token],Vec<u8>,::Error>, mut self,
alt!(
map_opt!(call_m!(self.literal),EvalResult::as_str) |
map_opt!(call_m!(self.identifier),EvalResult::as_str)
)
);
fn string(self, input: &'_ [Token]) -> CResult<'_, Vec<u8>> {
alt((
map_opt(|i| self.literal(i), EvalResult::as_str),
map_opt(|i| self.identifier(i), EvalResult::as_str),
))(input)
.to_cexpr_result()
}
// "string1" "string2" etc...
method!(concat_str<PRef<'a>,&[Token],EvalResult,::Error>, mut self,
map!(
pair!(call_m!(self.string),many0!(comp!(call_m!(self.string)))),
|(first,v)| Vec::into_iter(v).fold(first,|mut s,elem|{Vec::extend_from_slice(&mut s,Vec::<u8>::as_slice(&elem));s}).into()
)
);
// "string1" "string2" etc...
fn concat_str(self, input: &'_ [Token]) -> CResult<'_, EvalResult> {
map(
pair(|i| self.string(i), many0(complete(|i| self.string(i)))),
|(first, v)| {
Vec::into_iter(v)
.fold(first, |mut s, elem| {
Vec::extend_from_slice(&mut s, Vec::<u8>::as_slice(&elem));
s
})
.into()
},
)(input)
.to_cexpr_result()
}
method!(expr<PRef<'a>,&[Token],EvalResult,::Error>, mut self,
alt!(
call_m!(self.numeric_expr) |
delimited!(p!("("),call_m!(self.expr),p!(")")) |
call_m!(self.concat_str) |
call_m!(self.literal) |
call_m!(self.identifier)
)
);
fn expr(self, input: &'_ [Token]) -> CResult<'_, EvalResult> {
alt((
|i| self.numeric_expr(i),
delimited(p("("), |i| self.expr(i), p(")")),
|i| self.concat_str(i),
|i| self.literal(i),
|i| self.identifier(i),
))(input)
.to_cexpr_result()
}
method!(macro_definition<PRef<'a>,&[Token],(&[u8],EvalResult),::Error>, mut self,
pair!(typed_token!(Identifier),call_m!(self.expr))
);
fn macro_definition(self, input: &'_ [Token]) -> CResult<'_, (&'_ [u8], EvalResult)> {
pair(typed_token!(Identifier), |i| self.expr(i))(input)
}
}
impl<'a> ::std::ops::Deref for PRef<'a> {
type Target=IdentifierParser<'a>;
fn deref(&self) -> &IdentifierParser<'a> {
self.0
}
type Target = IdentifierParser<'a>;
fn deref(&self) -> &IdentifierParser<'a> {
self.0
}
}
impl<'ident> IdentifierParser<'ident> {
fn as_ref(&self) -> PRef {
PRef(self)
}
/// Create a new `IdentifierParser` with a set of known identifiers. When
/// a known identifier is encountered during parsing, it is substituted
/// for the value specified.
pub fn new(identifiers: &HashMap<Vec<u8>,EvalResult>) -> IdentifierParser {
IdentifierParser{identifiers:identifiers}
}
fn as_ref(&self) -> PRef<'_> {
PRef(self)
}
/// Parse and evalute an expression of a list of tokens.
///
/// Returns an error if the input is not a valid expression or if the token
/// stream contains comments, keywords or unknown identifiers.
pub fn expr<'a>(&self,input: &'a [Token]) -> CResult<'a,EvalResult> {
self.as_ref().expr(input).1
}
/// Create a new `IdentifierParser` with a set of known identifiers. When
/// a known identifier is encountered during parsing, it is substituted
/// for the value specified.
pub fn new(identifiers: &HashMap<Vec<u8>, EvalResult>) -> IdentifierParser<'_> {
IdentifierParser { identifiers }
}
/// Parse and evaluate a macro definition from of a list of tokens.
///
/// Returns the identifier for the macro and its replacement evaluated as an
/// expression. The input should not include `#define`.
///
/// Returns an error if the replacement is not a valid expression, if called
/// on most function-like macros, or if the token stream contains comments,
/// keywords or unknown identifiers.
///
/// N.B. This is intended to fail on function-like macros, but if it the
/// macro takes a single argument, the argument name is defined as an
/// identifier, and the macro otherwise parses as an expression, it will
/// return a result even on function-like macros.
///
/// ```c
/// // will evaluate into IDENTIFIER
/// #define DELETE(IDENTIFIER)
/// // will evaluate into IDENTIFIER-3
/// #define NEGATIVE_THREE(IDENTIFIER) -3
/// ```
pub fn macro_definition<'a>(&self,input: &'a [Token]) -> CResult<'a,(&'a [u8],EvalResult)> {
::assert_full_parse(self.as_ref().macro_definition(input).1)
}
/// Parse and evalute an expression of a list of tokens.
///
/// Returns an error if the input is not a valid expression or if the token
/// stream contains comments, keywords or unknown identifiers.
pub fn expr<'a>(&self, input: &'a [Token]) -> CResult<'a, EvalResult> {
self.as_ref().expr(input)
}
/// Parse and evaluate a macro definition from of a list of tokens.
///
/// Returns the identifier for the macro and its replacement evaluated as an
/// expression. The input should not include `#define`.
///
/// Returns an error if the replacement is not a valid expression, if called
/// on most function-like macros, or if the token stream contains comments,
/// keywords or unknown identifiers.
///
/// N.B. This is intended to fail on function-like macros, but if it the
/// macro takes a single argument, the argument name is defined as an
/// identifier, and the macro otherwise parses as an expression, it will
/// return a result even on function-like macros.
///
/// ```c
/// // will evaluate into IDENTIFIER
/// #define DELETE(IDENTIFIER)
/// // will evaluate into IDENTIFIER-3
/// #define NEGATIVE_THREE(IDENTIFIER) -3
/// ```
pub fn macro_definition<'a>(&self, input: &'a [Token]) -> CResult<'a, (&'a [u8], EvalResult)> {
crate::assert_full_parse(self.as_ref().macro_definition(input))
}
}
/// Parse and evalute an expression of a list of tokens.
///
/// Returns an error if the input is not a valid expression or if the token
/// stream contains comments, keywords or identifiers.
pub fn expr<'a>(input: &'a [Token]) -> CResult<'a,EvalResult> {
IdentifierParser::new(&HashMap::new()).expr(input)
pub fn expr(input: &[Token]) -> CResult<'_, EvalResult> {
IdentifierParser::new(&HashMap::new()).expr(input)
}
/// Parse and evaluate a macro definition from of a list of tokens.
@ -546,11 +568,10 @@ pub fn expr<'a>(input: &'a [Token]) -> CResult<'a,EvalResult> {
/// Returns an error if the replacement is not a valid expression, if called
/// on a function-like macro, or if the token stream contains comments,
/// keywords or identifiers.
pub fn macro_definition<'a>(input: &'a [Token]) -> CResult<'a,(&'a [u8],EvalResult)> {
IdentifierParser::new(&HashMap::new()).macro_definition(input)
pub fn macro_definition(input: &[Token]) -> CResult<'_, (&'_ [u8], EvalResult)> {
IdentifierParser::new(&HashMap::new()).macro_definition(input)
}
named_attr!(
/// Parse a functional macro declaration from a list of tokens.
///
/// Returns the identifier for the macro and the argument list (in order). The
@ -590,13 +611,13 @@ named_attr!(
/// let (_, evaluated) = assert_full_parse(IdentifierParser::new(&idents).expr(expr)).unwrap();
/// assert_eq!(evaluated, EvalResult::Str(b"testsuffix".to_vec()));
/// ```
,pub fn_macro_declaration<&[Token],(&[u8],Vec<&[u8]>),::Error>,
pair!(
typed_token!(Identifier),
delimited!(
p!("("),
separated_list!(p!(","), typed_token!(Identifier)),
p!(")")
)
)
);
pub fn fn_macro_declaration(input: &[Token]) -> CResult<'_, (&[u8], Vec<&[u8]>)> {
pair(
typed_token!(Identifier),
delimited(
p("("),
separated_list(p(","), typed_token!(Identifier)),
p(")"),
),
)(input)
}

138
third_party/rust/cexpr/src/lib.rs поставляемый
Просмотреть файл

@ -5,60 +5,136 @@
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[macro_use]
extern crate nom as nom_crate;
//! A C expression parser and evaluator.
//!
//! This crate provides methods for parsing and evaluating simple C expressions. In general, the
//! crate can handle most arithmetic expressions that would appear in macros or the definition of
//! constants, as well as string and character constants.
//!
//! The main entry point for is [`token::parse`], which parses a byte string and returns its
//! evaluated value.
#![warn(rust_2018_idioms)]
#![warn(missing_docs)]
#![allow(deprecated)]
pub mod nom {
//! nom's result types, re-exported.
pub use nom_crate::{IResult,Needed,Err,ErrorKind};
pub use nom::{error::ErrorKind, Err, IResult, Needed};
}
pub mod literal;
pub mod expr;
pub mod literal;
pub mod token;
use nom::*;
#[derive(Debug)]
/// Parsing errors specific to C parsing
pub enum Error {
#[derive(Debug)]
pub enum ErrorKind {
/// Expected the specified token
ExactToken(token::Kind,&'static [u8]),
ExactToken(token::Kind, &'static [u8]),
/// Expected one of the specified tokens
ExactTokens(token::Kind,&'static [&'static str]),
ExactTokens(token::Kind, &'static [&'static str]),
/// Expected a token of the specified kind
TypedToken(token::Kind),
TypedToken(token::Kind),
/// An unknown identifier was encountered
UnknownIdentifier,
UnknownIdentifier,
/// An invalid literal was encountered.
///
/// When encountered, this generally means a bug exists in the data that
/// was passed in or the parsing logic.
InvalidLiteral,
InvalidLiteral,
/// A full parse was requested, but data was left over after parsing finished.
Partial,
/// An error occurred in an underlying nom parser.
Parser(nom::ErrorKind),
}
impl From<u32> for Error {
fn from(_: u32) -> Self {
Error::InvalidLiteral
}
impl From<nom::ErrorKind> for ErrorKind {
fn from(k: nom::ErrorKind) -> Self {
ErrorKind::Parser(k)
}
}
macro_rules! identity (
($i:expr,$e:expr) => ($e);
);
impl From<u32> for ErrorKind {
fn from(_: u32) -> Self {
ErrorKind::InvalidLiteral
}
}
/// Parsing errors specific to C parsing.
///
/// This is a superset of `(I, nom::ErrorKind)` that includes the additional errors specified by
/// [`ErrorKind`].
#[derive(Debug)]
pub struct Error<I> {
/// The remainder of the input stream at the time of the error.
pub input: I,
/// The error that occurred.
pub error: ErrorKind,
}
impl<I> From<(I, nom::ErrorKind)> for Error<I> {
fn from(e: (I, nom::ErrorKind)) -> Self {
Self::from((e.0, ErrorKind::from(e.1)))
}
}
impl<I> From<(I, ErrorKind)> for Error<I> {
fn from(e: (I, ErrorKind)) -> Self {
Self {
input: e.0,
error: e.1,
}
}
}
impl<I> ::nom::error::ParseError<I> for Error<I> {
fn from_error_kind(input: I, kind: nom::ErrorKind) -> Self {
Self {
input,
error: kind.into(),
}
}
fn append(_: I, _: nom::ErrorKind, other: Self) -> Self {
other
}
}
// in lieu of https://github.com/Geal/nom/issues/1010
trait ToCexprResult<I, O> {
fn to_cexpr_result(self) -> nom::IResult<I, O, Error<I>>;
}
impl<I, O, E> ToCexprResult<I, O> for nom::IResult<I, O, E>
where
Error<I>: From<E>,
{
fn to_cexpr_result(self) -> nom::IResult<I, O, Error<I>> {
match self {
Ok(v) => Ok(v),
Err(nom::Err::Incomplete(n)) => Err(nom::Err::Incomplete(n)),
Err(nom::Err::Error(e)) => Err(nom::Err::Error(e.into())),
Err(nom::Err::Failure(e)) => Err(nom::Err::Failure(e.into())),
}
}
}
/// If the input result indicates a succesful parse, but there is data left,
/// return an `Error::Partial` instead.
pub fn assert_full_parse<I,O,E>(result: IResult<&[I],O,E>) -> IResult<&[I],O,::Error>
where Error: From<E> {
match fix_error!((),::Error,identity!(result)) {
Ok((rem,output)) => if rem.len()==0 {
Ok((rem, output))
} else {
Err(Err::Error(error_position!(rem, ErrorKind::Custom(::Error::Partial))))
},
r => r,
}
pub fn assert_full_parse<'i, I: 'i, O, E>(
result: nom::IResult<&'i [I], O, E>,
) -> nom::IResult<&'i [I], O, Error<&'i [I]>>
where
Error<&'i [I]>: From<E>,
{
match result.to_cexpr_result() {
Ok((rem, output)) => {
if rem.is_empty() {
Ok((rem, output))
} else {
Err(nom::Err::Error((rem, ErrorKind::Partial).into()))
}
}
Err(nom::Err::Incomplete(n)) => Err(nom::Err::Incomplete(n)),
Err(nom::Err::Failure(e)) => Err(nom::Err::Failure(e)),
Err(nom::Err::Error(e)) => Err(nom::Err::Error(e)),
}
}

422
third_party/rust/cexpr/src/literal.rs поставляемый
Просмотреть файл

@ -6,7 +6,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
//! Parsing C literals from byte slices.
//!
//!
//! This will parse a representation of a C literal into a Rust type.
//!
//! # characters
@ -37,235 +37,325 @@
//! supported.
use std::char;
use std::str::{self,FromStr};
use std::str::{self, FromStr};
use nom_crate::*;
use nom::branch::alt;
use nom::bytes::complete::is_not;
use nom::bytes::complete::tag;
use nom::character::complete::{char, one_of};
use nom::combinator::{complete, map, map_opt, opt, recognize};
use nom::multi::{fold_many0, many0, many1, many_m_n};
use nom::sequence::{delimited, pair, preceded, terminated, tuple};
use nom::*;
use expr::EvalResult;
use crate::expr::EvalResult;
use crate::ToCexprResult;
#[derive(Debug,Copy,Clone,PartialEq,Eq)]
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
/// Representation of a C character
pub enum CChar {
/// A character that can be represented as a `char`
Char(char),
/// Any other character (8-bit characters, unicode surrogates, etc.)
Raw(u64),
/// A character that can be represented as a `char`
Char(char),
/// Any other character (8-bit characters, unicode surrogates, etc.)
Raw(u64),
}
impl From<u8> for CChar {
fn from(i: u8) -> CChar {
match i {
0 ... 0x7f => CChar::Char(i as u8 as char),
_ => CChar::Raw(i as u64),
}
}
fn from(i: u8) -> CChar {
match i {
0..=0x7f => CChar::Char(i as u8 as char),
_ => CChar::Raw(i as u64),
}
}
}
// A non-allocating version of this would be nice...
impl Into<Vec<u8>> for CChar {
fn into(self) -> Vec<u8> {
match self {
CChar::Char(c) => {
let mut s=String::with_capacity(4);
s.extend(&[c]);
s.into_bytes()
}
CChar::Raw(i) => {
let mut v=Vec::with_capacity(1);
v.push(i as u8);
v
}
}
}
fn into(self) -> Vec<u8> {
match self {
CChar::Char(c) => {
let mut s = String::with_capacity(4);
s.extend(&[c]);
s.into_bytes()
}
CChar::Raw(i) => {
let mut v = Vec::with_capacity(1);
v.push(i as u8);
v
}
}
}
}
/// ensures the child parser consumes the whole input
#[macro_export]
macro_rules! full (
($i: expr, $submac:ident!( $($args:tt)* )) => (
{
use ::nom_crate::lib::std::result::Result::*;
let res = $submac!($i, $($args)*);
match res {
Ok((i, o)) => if i.len() == 0 {
Ok((i, o))
} else {
Err(::nom_crate::Err::Error(error_position!(i, ::nom_crate::ErrorKind::Custom(42))))
},
r => r,
}
}
);
($i:expr, $f:ident) => (
full!($i, call!($f));
);
);
// ====================================================
// ======== macros that shouldn't be necessary ========
// ====================================================
macro_rules! force_type (
($input:expr,IResult<$i:ty,$o:ty,$e:ty>) => (Err::<($i,$o),Err<$i,$e>>(::nom_crate::Err::Error(error_position!($input, ErrorKind::Fix))))
);
pub fn full<I: Clone, O, E: From<nom::error::ErrorKind>, F>(
f: F,
) -> impl Fn(I) -> nom::IResult<I, O, (I, E)>
where
I: nom::InputLength,
F: Fn(I) -> nom::IResult<I, O, (I, E)>,
{
move |input| {
let res = f(input);
match res {
Ok((i, o)) => {
if i.input_len() == 0 {
Ok((i, o))
} else {
Err(nom::Err::Error((i, nom::error::ErrorKind::Complete.into())))
}
}
r => r,
}
}
}
// =================================
// ======== matching digits ========
// =================================
macro_rules! byte (
($i:expr, $($p: pat)|* ) => ({
match $i.split_first() {
$(Some((&c @ $p,rest)))|* => Ok::<(&[_],u8),::nom_crate::Err<&[_],u32>>((rest,c)),
Some(_) => Err(::nom_crate::Err::Error(error_position!($i, ErrorKind::OneOf))),
None => Err(::nom_crate::Err::Incomplete(Needed::Size(1))),
}
})
);
macro_rules! byte {
($($p: pat)|* ) => {{
fn parser(i: &[u8]) -> crate::nom::IResult<&[u8], u8> {
match i.split_first() {
$(Some((&c @ $p,rest)))|* => Ok((rest,c)),
Some(_) => Err(nom::Err::Error((i, nom::error::ErrorKind::OneOf))),
None => Err(nom::Err::Incomplete(Needed::Size(1))),
}
}
named!(binary<u8>,byte!(b'0' ... b'1'));
named!(octal<u8>,byte!(b'0' ... b'7'));
named!(decimal<u8>,byte!(b'0' ... b'9'));
named!(hexadecimal<u8>,byte!(b'0' ... b'9' | b'a' ... b'f' | b'A' ... b'F'));
parser
}}
}
fn binary(i: &[u8]) -> nom::IResult<&[u8], u8> {
byte!(b'0'..=b'1')(i)
}
fn octal(i: &[u8]) -> nom::IResult<&[u8], u8> {
byte!(b'0'..=b'7')(i)
}
fn decimal(i: &[u8]) -> nom::IResult<&[u8], u8> {
byte!(b'0'..=b'9')(i)
}
fn hexadecimal(i: &[u8]) -> nom::IResult<&[u8], u8> {
byte!(b'0' ..= b'9' | b'a' ..= b'f' | b'A' ..= b'F')(i)
}
// ========================================
// ======== characters and strings ========
// ========================================
fn escape2char(c: char) -> CChar {
CChar::Char(match c {
'a' => '\x07',
'b' => '\x08',
'f' => '\x0c',
'n' => '\n',
'r' => '\r',
't' => '\t',
'v' => '\x0b',
_ => unreachable!("invalid escape {}",c)
})
CChar::Char(match c {
'a' => '\x07',
'b' => '\x08',
'f' => '\x0c',
'n' => '\n',
'r' => '\r',
't' => '\t',
'v' => '\x0b',
_ => unreachable!("invalid escape {}", c),
})
}
fn c_raw_escape(n: Vec<u8>, radix: u32) -> Option<CChar> {
str::from_utf8(&n).ok()
.and_then(|i|u64::from_str_radix(i,radix).ok())
.map(|i|match i {
0 ... 0x7f => CChar::Char(i as u8 as char),
_ => CChar::Raw(i),
})
str::from_utf8(&n)
.ok()
.and_then(|i| u64::from_str_radix(i, radix).ok())
.map(|i| match i {
0..=0x7f => CChar::Char(i as u8 as char),
_ => CChar::Raw(i),
})
}
fn c_unicode_escape(n: Vec<u8>) -> Option<CChar> {
str::from_utf8(&n).ok()
.and_then(|i|u32::from_str_radix(i,16).ok())
.and_then(char::from_u32)
.map(CChar::Char)
str::from_utf8(&n)
.ok()
.and_then(|i| u32::from_str_radix(i, 16).ok())
.and_then(char::from_u32)
.map(CChar::Char)
}
named!(escaped_char<CChar>,
preceded!(complete!(char!('\\')),alt_complete!(
map!(one_of!(r#"'"?\"#),CChar::Char) |
map!(one_of!("abfnrtv"),escape2char) |
map_opt!(many_m_n!(1,3,octal),|v|c_raw_escape(v,8)) |
map_opt!(preceded!(char!('x'),many1!(hexadecimal)),|v|c_raw_escape(v,16)) |
map_opt!(preceded!(char!('u'),many_m_n!(4,4,hexadecimal)),c_unicode_escape) |
map_opt!(preceded!(char!('U'),many_m_n!(8,8,hexadecimal)),c_unicode_escape)
))
);
fn escaped_char(i: &[u8]) -> nom::IResult<&[u8], CChar> {
preceded(
char('\\'),
alt((
map(one_of(r#"'"?\"#), CChar::Char),
map(one_of("abfnrtv"), escape2char),
map_opt(many_m_n(1, 3, octal), |v| c_raw_escape(v, 8)),
map_opt(preceded(char('x'), many1(hexadecimal)), |v| {
c_raw_escape(v, 16)
}),
map_opt(
preceded(char('u'), many_m_n(4, 4, hexadecimal)),
c_unicode_escape,
),
map_opt(
preceded(char('U'), many_m_n(8, 8, hexadecimal)),
c_unicode_escape,
),
)),
)(i)
}
named!(c_width_prefix,
alt!(
tag!("u8") |
tag!("u") |
tag!("U") |
tag!("L")
)
);
fn c_width_prefix(i: &[u8]) -> nom::IResult<&[u8], &[u8]> {
alt((tag("u8"), tag("u"), tag("U"), tag("L")))(i)
}
named!(c_char<CChar>,
delimited!(
terminated!(opt!(c_width_prefix),char!('\'')),
alt!( escaped_char | map!(byte!(0 ... 91 /* \=92 */ | 93 ... 255),CChar::from) ),
char!('\'')
)
);
fn c_char(i: &[u8]) -> nom::IResult<&[u8], CChar> {
delimited(
terminated(opt(c_width_prefix), char('\'')),
alt((
escaped_char,
map(byte!(0 ..= 91 /* \=92 */ | 93 ..= 255), CChar::from),
)),
char('\''),
)(i)
}
named!(c_string<Vec<u8> >,
delimited!(
alt!( preceded!(c_width_prefix,char!('"')) | char!('"') ),
fold_many0!(
alt!(map!(escaped_char, |c:CChar| c.into()) | map!(complete!(is_not!("\"")), |c: &[u8]| c.into())),
Vec::new(),
|mut v: Vec<u8>, res:Vec<u8>| { v.extend_from_slice(&res); v }
),
char!('"')
)
);
fn c_string(i: &[u8]) -> nom::IResult<&[u8], Vec<u8>> {
delimited(
alt((preceded(c_width_prefix, char('"')), char('"'))),
fold_many0(
alt((
map(escaped_char, |c: CChar| c.into()),
map(is_not([b'\\', b'"']), |c: &[u8]| c.into()),
)),
Vec::new(),
|mut v: Vec<u8>, res: Vec<u8>| {
v.extend_from_slice(&res);
v
},
),
char('"'),
)(i)
}
// ================================
// ======== parse integers ========
// ================================
fn c_int_radix(n: Vec<u8>, radix: u32) -> Option<u64> {
str::from_utf8(&n).ok()
.and_then(|i|u64::from_str_radix(i,radix).ok())
str::from_utf8(&n)
.ok()
.and_then(|i| u64::from_str_radix(i, radix).ok())
}
fn take_ul(input: &[u8]) -> IResult<&[u8], &[u8]> {
use ::nom_crate::InputTakeAtPosition;
let r = input.split_at_position(|c| c != b'u' && c != b'U' && c != b'l' && c != b'L');
match r {
Err(Err::Incomplete(_)) => Ok((&input[input.len()..], input)),
res => res,
}
let r = input.split_at_position(|c| c != b'u' && c != b'U' && c != b'l' && c != b'L');
match r {
Err(Err::Incomplete(_)) => Ok((&input[input.len()..], input)),
res => res,
}
}
named!(c_int<i64>,
map!(terminated!(alt_complete!(
map_opt!(preceded!(tag!("0x"),many1!(complete!(hexadecimal))),|v|c_int_radix(v,16)) |
map_opt!(preceded!(tag!("0b"),many1!(complete!(binary))),|v|c_int_radix(v,2)) |
map_opt!(preceded!(char!('0'),many1!(complete!(octal))),|v|c_int_radix(v,8)) |
map_opt!(many1!(complete!(decimal)),|v|c_int_radix(v,10)) |
force_type!(IResult<_,_,u32>)
),opt!(take_ul)),|i|i as i64)
);
fn c_int(i: &[u8]) -> nom::IResult<&[u8], i64> {
map(
terminated(
alt((
map_opt(preceded(tag("0x"), many1(complete(hexadecimal))), |v| {
c_int_radix(v, 16)
}),
map_opt(preceded(tag("0X"), many1(complete(hexadecimal))), |v| {
c_int_radix(v, 16)
}),
map_opt(preceded(tag("0b"), many1(complete(binary))), |v| {
c_int_radix(v, 2)
}),
map_opt(preceded(tag("0B"), many1(complete(binary))), |v| {
c_int_radix(v, 2)
}),
map_opt(preceded(char('0'), many1(complete(octal))), |v| {
c_int_radix(v, 8)
}),
map_opt(many1(complete(decimal)), |v| c_int_radix(v, 10)),
|input| Err(crate::nom::Err::Error((input, crate::nom::ErrorKind::Fix))),
)),
opt(take_ul),
),
|i| i as i64,
)(i)
}
// ==============================
// ======== parse floats ========
// ==============================
named!(float_width<u8>,complete!(byte!(b'f' | b'l' | b'F' | b'L')));
named!(float_exp<(Option<u8>,Vec<u8>)>,preceded!(byte!(b'e'|b'E'),pair!(opt!(byte!(b'-'|b'+')),many1!(complete!(decimal)))));
fn float_width(i: &[u8]) -> nom::IResult<&[u8], u8> {
nom::combinator::complete(byte!(b'f' | b'l' | b'F' | b'L'))(i)
}
named!(c_float<f64>,
map_opt!(alt!(
terminated!(recognize!(tuple!(many1!(complete!(decimal)),byte!(b'.'),many0!(complete!(decimal)))),opt!(float_width)) |
terminated!(recognize!(tuple!(many0!(complete!(decimal)),byte!(b'.'),many1!(complete!(decimal)))),opt!(float_width)) |
terminated!(recognize!(tuple!(many0!(complete!(decimal)),opt!(byte!(b'.')),many1!(complete!(decimal)),float_exp)),opt!(float_width)) |
terminated!(recognize!(tuple!(many1!(complete!(decimal)),opt!(byte!(b'.')),many0!(complete!(decimal)),float_exp)),opt!(float_width)) |
terminated!(recognize!(many1!(complete!(decimal))),float_width)
),|v|str::from_utf8(v).ok().and_then(|i|f64::from_str(i).ok()))
);
fn float_exp(i: &[u8]) -> nom::IResult<&[u8], (Option<u8>, Vec<u8>)> {
preceded(
byte!(b'e' | b'E'),
pair(opt(byte!(b'-' | b'+')), many1(complete(decimal))),
)(i)
}
fn c_float(i: &[u8]) -> nom::IResult<&[u8], f64> {
map_opt(
alt((
terminated(
recognize(tuple((
many1(complete(decimal)),
byte!(b'.'),
many0(complete(decimal)),
))),
opt(float_width),
),
terminated(
recognize(tuple((
many0(complete(decimal)),
byte!(b'.'),
many1(complete(decimal)),
))),
opt(float_width),
),
terminated(
recognize(tuple((
many0(complete(decimal)),
opt(byte!(b'.')),
many1(complete(decimal)),
float_exp,
))),
opt(float_width),
),
terminated(
recognize(tuple((
many1(complete(decimal)),
opt(byte!(b'.')),
many0(complete(decimal)),
float_exp,
))),
opt(float_width),
),
terminated(recognize(many1(complete(decimal))), float_width),
)),
|v| str::from_utf8(v).ok().and_then(|i| f64::from_str(i).ok()),
)(i)
}
// ================================
// ======== main interface ========
// ================================
named!(one_literal<&[u8],EvalResult,::Error>,
fix_error!(::Error,alt_complete!(
map!(full!(c_char),EvalResult::Char) |
map!(full!(c_int),|i|EvalResult::Int(::std::num::Wrapping(i))) |
map!(full!(c_float),EvalResult::Float) |
map!(full!(c_string),EvalResult::Str)
))
);
fn one_literal(input: &[u8]) -> nom::IResult<&[u8], EvalResult, crate::Error<&[u8]>> {
alt((
map(full(c_char), EvalResult::Char),
map(full(c_int), |i| EvalResult::Int(::std::num::Wrapping(i))),
map(full(c_float), EvalResult::Float),
map(full(c_string), EvalResult::Str),
))(input)
.to_cexpr_result()
}
/// Parse a C literal.
///
/// The input must contain exactly the representation of a single literal
/// token, and in particular no whitespace or sign prefixes.
pub fn parse(input: &[u8]) -> IResult<&[u8],EvalResult,::Error> {
::assert_full_parse(one_literal(input))
pub fn parse(input: &[u8]) -> IResult<&[u8], EvalResult, crate::Error<&[u8]>> {
crate::assert_full_parse(one_literal(input))
}

34
third_party/rust/cexpr/src/token.rs поставляемый
Просмотреть файл

@ -9,32 +9,36 @@
//!
//! This is designed to map onto a libclang CXToken.
#[derive(Debug,Copy,Clone,PartialEq,Eq)]
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
#[allow(missing_docs)]
pub enum Kind {
Punctuation,
Keyword,
Identifier,
Literal,
Comment,
Punctuation,
Keyword,
Identifier,
Literal,
Comment,
}
#[derive(Debug,Clone,PartialEq,Eq)]
/// A single token in a C expression.
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Token {
/// The type of this token.
pub kind: Kind,
/// The bytes that make up the token.
pub raw: Box<[u8]>,
}
impl<'a> From<(Kind, &'a [u8])> for Token {
fn from((kind, value): (Kind, &'a [u8])) -> Token {
Token {
kind: kind,
raw: value.to_owned().into_boxed_slice()
}
}
fn from((kind, value): (Kind, &'a [u8])) -> Token {
Token {
kind,
raw: value.to_owned().into_boxed_slice(),
}
}
}
/// Remove all comment tokens from a vector of tokens
pub fn remove_comments(v: &mut Vec<Token>) -> &mut Vec<Token> {
v.retain(|t|t.kind!=Kind::Comment);
v
v.retain(|t| t.kind != Kind::Comment);
v
}

453
third_party/rust/cexpr/tests/clang.rs поставляемый
Просмотреть файл

@ -8,234 +8,327 @@
extern crate cexpr;
extern crate clang_sys;
use std::{ptr,mem,ffi,slice,char};
use std::str::{self,FromStr};
use std::collections::HashMap;
use std::io::Write;
use std::str::{self, FromStr};
use std::{char, ffi, mem, ptr, slice};
use clang_sys::*;
use cexpr::token::Token;
use cexpr::expr::{IdentifierParser,EvalResult,fn_macro_declaration};
use cexpr::literal::CChar;
use cexpr::assert_full_parse;
use cexpr::expr::{fn_macro_declaration, EvalResult, IdentifierParser};
use cexpr::literal::CChar;
use cexpr::token::Token;
use clang_sys::*;
// main testing routine
fn test_definition(ident: Vec<u8>, tokens: &[Token], idents: &mut HashMap<Vec<u8>,EvalResult>) -> bool {
fn bytes_to_int(value: &[u8]) -> Option<EvalResult> {
str::from_utf8(value).ok()
.map(|s|s.replace("n","-"))
.map(|s|s.replace("_",""))
.and_then(|v|i64::from_str(&v).ok())
.map(::std::num::Wrapping)
.map(Int)
}
fn test_definition(
ident: Vec<u8>,
tokens: &[Token],
idents: &mut HashMap<Vec<u8>, EvalResult>,
) -> bool {
fn bytes_to_int(value: &[u8]) -> Option<EvalResult> {
str::from_utf8(value)
.ok()
.map(|s| s.replace("n", "-"))
.map(|s| s.replace("_", ""))
.and_then(|v| i64::from_str(&v).ok())
.map(::std::num::Wrapping)
.map(Int)
}
use cexpr::expr::EvalResult::*;
use cexpr::expr::EvalResult::*;
let display_name=String::from_utf8_lossy(&ident).into_owned();
let display_name = String::from_utf8_lossy(&ident).into_owned();
let functional;
let test={
// Split name such as Str_test_string into (Str,test_string)
let pos=ident.iter().position(|c|*c==b'_').expect(&format!("Invalid definition in testcase: {}",display_name));
let mut expected=&ident[..pos];
let mut value=&ident[(pos+1)..];
let functional;
let test = {
// Split name such as Str_test_string into (Str,test_string)
let pos = ident
.iter()
.position(|c| *c == b'_')
.expect(&format!("Invalid definition in testcase: {}", display_name));
let mut expected = &ident[..pos];
let mut value = &ident[(pos + 1)..];
functional=expected==b"Fn";
functional = expected == b"Fn";
if functional {
let ident=value;
let pos=ident.iter().position(|c|*c==b'_').expect(&format!("Invalid definition in testcase: {}",display_name));
expected=&ident[..pos];
value=&ident[(pos+1)..];
}
if functional {
let ident = value;
let pos = ident
.iter()
.position(|c| *c == b'_')
.expect(&format!("Invalid definition in testcase: {}", display_name));
expected = &ident[..pos];
value = &ident[(pos + 1)..];
}
if expected==b"Str" {
Some(Str(value.to_owned()))
} else if expected==b"Int" {
bytes_to_int(value)
} else if expected==b"Float" {
str::from_utf8(value).ok().map(|s|s.replace("n","-").replace("p",".")).and_then(|v|f64::from_str(&v).ok()).map(Float)
} else if expected==b"CharRaw" {
str::from_utf8(value).ok().and_then(|v|u64::from_str(v).ok()).map(CChar::Raw).map(Char)
} else if expected==b"CharChar" {
str::from_utf8(value).ok().and_then(|v|u32::from_str(v).ok()).and_then(char::from_u32).map(CChar::Char).map(Char)
} else {
Some(Invalid)
}.expect(&format!("Invalid definition in testcase: {}",display_name))
};
if expected == b"Str" {
let mut splits = value.split(|c| *c == b'U');
let mut s = Vec::with_capacity(value.len());
s.extend_from_slice(splits.next().unwrap());
for split in splits {
let (chr, rest) = split.split_at(6);
let chr = u32::from_str_radix(str::from_utf8(chr).unwrap(), 16).unwrap();
write!(s, "{}", char::from_u32(chr).unwrap()).unwrap();
s.extend_from_slice(rest);
}
Some(Str(s))
} else if expected == b"Int" {
bytes_to_int(value)
} else if expected == b"Float" {
str::from_utf8(value)
.ok()
.map(|s| s.replace("n", "-").replace("p", "."))
.and_then(|v| f64::from_str(&v).ok())
.map(Float)
} else if expected == b"CharRaw" {
str::from_utf8(value)
.ok()
.and_then(|v| u64::from_str(v).ok())
.map(CChar::Raw)
.map(Char)
} else if expected == b"CharChar" {
str::from_utf8(value)
.ok()
.and_then(|v| u32::from_str(v).ok())
.and_then(char::from_u32)
.map(CChar::Char)
.map(Char)
} else {
Some(Invalid)
}
.expect(&format!("Invalid definition in testcase: {}", display_name))
};
let result = if functional {
let mut fnidents;
let expr_tokens;
match fn_macro_declaration(&tokens) {
Ok((rest,(_,args))) => {
fnidents=idents.clone();
expr_tokens=rest;
for arg in args {
let val = match test {
Int(_) => bytes_to_int(&arg),
Str(_) => Some(Str(arg.to_owned())),
_ => unimplemented!()
}.expect(&format!("Invalid argument in functional macro testcase: {}",display_name));
fnidents.insert(arg.to_owned(), val);
}
},
e => {
println!("Failed test for {}, unable to parse functional macro declaration: {:?}",display_name,e);
return false;
}
}
assert_full_parse(IdentifierParser::new(&fnidents).expr(&expr_tokens))
} else {
IdentifierParser::new(idents).macro_definition(&tokens).map(|(i, (_,val))|(i, val))
};
let result = if functional {
let mut fnidents;
let expr_tokens;
match fn_macro_declaration(&tokens) {
Ok((rest, (_, args))) => {
fnidents = idents.clone();
expr_tokens = rest;
for arg in args {
let val = match test {
Int(_) => bytes_to_int(&arg),
Str(_) => Some(Str(arg.to_owned())),
_ => unimplemented!(),
}
.expect(&format!(
"Invalid argument in functional macro testcase: {}",
display_name
));
fnidents.insert(arg.to_owned(), val);
}
}
e => {
println!(
"Failed test for {}, unable to parse functional macro declaration: {:?}",
display_name, e
);
return false;
}
}
assert_full_parse(IdentifierParser::new(&fnidents).expr(&expr_tokens))
} else {
IdentifierParser::new(idents)
.macro_definition(&tokens)
.map(|(i, (_, val))| (i, val))
};
match result {
Ok((_,val)) => {
if val==test {
if let Some(_)=idents.insert(ident,val) {
panic!("Duplicate definition for testcase: {}",display_name);
}
true
} else {
println!("Failed test for {}, expected {:?}, got {:?}",display_name,test,val);
false
}
},
e => {
if test==Invalid {
true
} else {
println!("Failed test for {}, expected {:?}, got {:?}",display_name,test,e);
false
}
}
}
match result {
Ok((_, val)) => {
if val == test {
if let Some(_) = idents.insert(ident, val) {
panic!("Duplicate definition for testcase: {}", display_name);
}
true
} else {
println!(
"Failed test for {}, expected {:?}, got {:?}",
display_name, test, val
);
false
}
}
e => {
if test == Invalid {
true
} else {
println!(
"Failed test for {}, expected {:?}, got {:?}",
display_name, test, e
);
false
}
}
}
}
// support code for the clang lexer
unsafe fn clang_str_to_vec(s: CXString) -> Vec<u8> {
let vec=ffi::CStr::from_ptr(clang_getCString(s)).to_bytes().to_owned();
clang_disposeString(s);
vec
let vec = ffi::CStr::from_ptr(clang_getCString(s))
.to_bytes()
.to_owned();
clang_disposeString(s);
vec
}
#[allow(non_upper_case_globals)]
unsafe fn token_clang_to_cexpr(tu: CXTranslationUnit, orig: &CXToken) -> Token {
Token {
kind:match clang_getTokenKind(*orig) {
CXToken_Comment => cexpr::token::Kind::Comment,
CXToken_Identifier => cexpr::token::Kind::Identifier,
CXToken_Keyword => cexpr::token::Kind::Keyword,
CXToken_Literal => cexpr::token::Kind::Literal,
CXToken_Punctuation => cexpr::token::Kind::Punctuation,
_ => panic!("invalid token kind: {:?}", *orig),
},
raw:clang_str_to_vec(clang_getTokenSpelling(tu,*orig)).into_boxed_slice()
}
Token {
kind: match clang_getTokenKind(*orig) {
CXToken_Comment => cexpr::token::Kind::Comment,
CXToken_Identifier => cexpr::token::Kind::Identifier,
CXToken_Keyword => cexpr::token::Kind::Keyword,
CXToken_Literal => cexpr::token::Kind::Literal,
CXToken_Punctuation => cexpr::token::Kind::Punctuation,
_ => panic!("invalid token kind: {:?}", *orig),
},
raw: clang_str_to_vec(clang_getTokenSpelling(tu, *orig)).into_boxed_slice(),
}
}
extern "C" fn visit_children_thunk<F>(cur: CXCursor, parent: CXCursor, closure: CXClientData) -> CXChildVisitResult
where F: FnMut(CXCursor,CXCursor) -> CXChildVisitResult
extern "C" fn visit_children_thunk<F>(
cur: CXCursor,
parent: CXCursor,
closure: CXClientData,
) -> CXChildVisitResult
where
F: FnMut(CXCursor, CXCursor) -> CXChildVisitResult,
{
unsafe{(&mut *(closure as *mut F))(cur,parent)}
unsafe { (&mut *(closure as *mut F))(cur, parent) }
}
unsafe fn visit_children<F>(cursor: CXCursor, mut f: F)
where F: FnMut(CXCursor,CXCursor) -> CXChildVisitResult
where
F: FnMut(CXCursor, CXCursor) -> CXChildVisitResult,
{
clang_visitChildren(cursor, visit_children_thunk::<F> as _, &mut f as *mut F as CXClientData);
clang_visitChildren(
cursor,
visit_children_thunk::<F> as _,
&mut f as *mut F as CXClientData,
);
}
unsafe fn location_in_scope(r: CXSourceRange) -> bool {
let start=clang_getRangeStart(r);
let mut file=ptr::null_mut();
clang_getSpellingLocation(start,&mut file,ptr::null_mut(),ptr::null_mut(),ptr::null_mut());
clang_Location_isFromMainFile(start)!=0
&& clang_Location_isInSystemHeader(start)==0
&& file!=ptr::null_mut()
let start = clang_getRangeStart(r);
let mut file = ptr::null_mut();
clang_getSpellingLocation(
start,
&mut file,
ptr::null_mut(),
ptr::null_mut(),
ptr::null_mut(),
);
clang_Location_isFromMainFile(start) != 0
&& clang_Location_isInSystemHeader(start) == 0
&& file != ptr::null_mut()
}
/// tokenize_range_adjust can be used to work around LLVM bug 9069
/// https://bugs.llvm.org//show_bug.cgi?id=9069
fn file_visit_macros<F: FnMut(Vec<u8>, Vec<Token>)>(file: &str, tokenize_range_adjust: bool, mut visitor: F) {
unsafe {
let tu={
let index=clang_createIndex(true as _, false as _);
let cfile=ffi::CString::new(file).unwrap();
let mut tu=mem::uninitialized();
assert!(clang_parseTranslationUnit2(
index,
cfile.as_ptr(),
[b"-std=c11\0".as_ptr() as *const ::std::os::raw::c_char].as_ptr(),1,
ptr::null_mut(),0,
CXTranslationUnit_DetailedPreprocessingRecord,
&mut tu
)==CXError_Success,"Failure reading test case {}",file);
tu
};
visit_children(clang_getTranslationUnitCursor(tu),|cur,_parent| {
if cur.kind==CXCursor_MacroDefinition {
let mut range=clang_getCursorExtent(cur);
if !location_in_scope(range) { return CXChildVisit_Continue }
range.end_int_data-=if tokenize_range_adjust { 1 } else { 0 };
let mut token_ptr=ptr::null_mut();
let mut num=0;
clang_tokenize(tu,range,&mut token_ptr,&mut num);
if token_ptr!=ptr::null_mut() {
let tokens=slice::from_raw_parts(token_ptr,num as usize);
let tokens: Vec<_>=tokens.iter().filter_map(|t|
if clang_getTokenKind(*t)!=CXToken_Comment {
Some(token_clang_to_cexpr(tu,t))
} else {
None
}
).collect();
clang_disposeTokens(tu,token_ptr,num);
visitor(clang_str_to_vec(clang_getCursorSpelling(cur)),tokens)
}
}
CXChildVisit_Continue
});
clang_disposeTranslationUnit(tu);
};
fn file_visit_macros<F: FnMut(Vec<u8>, Vec<Token>)>(
file: &str,
tokenize_range_adjust: bool,
mut visitor: F,
) {
unsafe {
let tu = {
let index = clang_createIndex(true as _, false as _);
let cfile = ffi::CString::new(file).unwrap();
let mut tu = mem::MaybeUninit::uninit();
assert!(
clang_parseTranslationUnit2(
index,
cfile.as_ptr(),
[b"-std=c11\0".as_ptr() as *const ::std::os::raw::c_char].as_ptr(),
1,
ptr::null_mut(),
0,
CXTranslationUnit_DetailedPreprocessingRecord,
&mut *tu.as_mut_ptr()
) == CXError_Success,
"Failure reading test case {}",
file
);
tu.assume_init()
};
visit_children(clang_getTranslationUnitCursor(tu), |cur, _parent| {
if cur.kind == CXCursor_MacroDefinition {
let mut range = clang_getCursorExtent(cur);
if !location_in_scope(range) {
return CXChildVisit_Continue;
}
range.end_int_data -= if tokenize_range_adjust { 1 } else { 0 };
let mut token_ptr = ptr::null_mut();
let mut num = 0;
clang_tokenize(tu, range, &mut token_ptr, &mut num);
if token_ptr != ptr::null_mut() {
let tokens = slice::from_raw_parts(token_ptr, num as usize);
let tokens: Vec<_> = tokens
.iter()
.filter_map(|t| {
if clang_getTokenKind(*t) != CXToken_Comment {
Some(token_clang_to_cexpr(tu, t))
} else {
None
}
})
.collect();
clang_disposeTokens(tu, token_ptr, num);
visitor(clang_str_to_vec(clang_getCursorSpelling(cur)), tokens)
}
}
CXChildVisit_Continue
});
clang_disposeTranslationUnit(tu);
};
}
fn test_file(file: &str) -> bool {
let mut idents=HashMap::new();
let mut all_succeeded=true;
file_visit_macros(file, fix_bug_9069(), |ident, tokens| all_succeeded&=test_definition(ident, &tokens, &mut idents));
all_succeeded
let mut idents = HashMap::new();
let mut all_succeeded = true;
file_visit_macros(file, fix_bug_9069(), |ident, tokens| {
all_succeeded &= test_definition(ident, &tokens, &mut idents)
});
all_succeeded
}
fn fix_bug_9069() -> bool {
fn check_bug_9069() -> bool {
let mut token_sets = vec![];
file_visit_macros("tests/input/test_llvm_bug_9069.h", false, |ident, tokens| {
assert_eq!(&ident, b"A");
token_sets.push(tokens);
});
assert_eq!(token_sets.len(), 2);
token_sets[0] != token_sets[1]
}
fn check_bug_9069() -> bool {
let mut token_sets = vec![];
file_visit_macros(
"tests/input/test_llvm_bug_9069.h",
false,
|ident, tokens| {
assert_eq!(&ident, b"A");
token_sets.push(tokens);
},
);
assert_eq!(token_sets.len(), 2);
token_sets[0] != token_sets[1]
}
use std::sync::{Once, ONCE_INIT};
use std::sync::atomic::{AtomicBool, ATOMIC_BOOL_INIT, Ordering};
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::Once;
static CHECK_FIX: Once = ONCE_INIT;
static FIX: AtomicBool = ATOMIC_BOOL_INIT;
static CHECK_FIX: Once = Once::new();
static FIX: AtomicBool = AtomicBool::new(false);
CHECK_FIX.call_once(|| FIX.store(check_bug_9069(), Ordering::SeqCst));
CHECK_FIX.call_once(|| FIX.store(check_bug_9069(), Ordering::SeqCst));
FIX.load(Ordering::SeqCst)
FIX.load(Ordering::SeqCst)
}
macro_rules! test_file {
($f:ident) => {
#[test] fn $f() {
assert!(test_file(concat!("tests/input/",stringify!($f),".h")),"test_file")
}
}
($f:ident) => {
#[test]
fn $f() {
assert!(
test_file(concat!("tests/input/", stringify!($f), ".h")),
"test_file"
)
}
};
}
test_file!(floats);

Просмотреть файл

@ -3,6 +3,8 @@
#define Int_1 0b1
#define Int_2 0x2
#define Int_3 3L
#define Int_4 0X4
#define Int_5 0B101
#define Int_63 077
#define Int_123 123
#define Int_124 124u

Просмотреть файл

@ -5,6 +5,11 @@
#define Str_concat u"con" L"cat"
#define Str_concat_parens ("concat" U"_parens")
#define Str_concat_identifier (Str_concat L"_identifier")
#define Str_hex_escape_all "\x68\x65\x78\x5f\x65\x73\x63\x61\x70\x65\x5f\x61\x6c\x6c"
#define Str_hex_escape_hex "h\x65x_\x65s\x63\x61p\x65_h\x65x"
#define Str_quote_U000022_escape "quote_\"_escape"
#define Str_Fly_away_in_my_space_U01F680_You_no_need_put_U01F4B5_in_my_pocket \
u8"Fly_away_in_my_space_🚀_You_no_need_put_💵_in_my_pocket"
#define Fn_Str_no_args() "no_args"
#define Fn_Str_no_args_concat() "no_args_" Str_concat
#define Fn_Str_prepend_arg(arg) "prepend_" arg

Просмотреть файл

@ -1 +1 @@
{"files":{"CHANGELOG.md":"c652c9b61c28c8412d7d2894fd40d16d99e480f1a107953e0d8e187ff682b1b5","Cargo.toml":"e404a59df6e05e1bd0f504b7cf493325d305d3a4c0367a1a2f4fa09cdf81431c","LICENSE.txt":"cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30","README.md":"e0dbda475155169c7f68afad8f6158f38210ae80c561dc64335984714488d142","appveyor.yml":"af8991ca335fa4ad3bc027935230cbcea7f9bcb93f3ef01939f4c60df20d4414","build.rs":"7ca54d670b7d7dffd43d7c1ef521a6075b82cddd45947d30de260a880e0347c1","build/common.rs":"4575cb8c5ebdeb7a9451d7ab218c8556cd1fd8de46f1cdbc32e0488cf6e8f014","build/dynamic.rs":"0e158c311fcbaf3cde0da8b56811bcba146d638ee803248fc2110908624e5eb3","build/static.rs":"52ea2a1a742152fa6f7179b990da0d07fdd9c290f4204f8b31a4f128a9a38dc9","ci/before_install.sh":"49978df9e1e49892000bc039d3ceb0c24822948bf4a2cf7251dcf63953ecd5f7","ci/install.bat":"d7cd7c27132d80d2ecb9833b16af47ec8936beba4212cf999e85c3943d821018","ci/script.sh":"1bb1cd29bd9635cc126cdcbd6c02f3500620a231a86726bf2165a4b74baaf433","ci/test_script.bat":"73462f51aaa9a1c14ce9f55c41dc3672df64faa9789725384ae4f28d8ba3c90b","clippy.toml":"acef14b9acffa18d1069ae08a4e8fe824a614f91b0bc71a6b1c68e4d885397e6","src/lib.rs":"5892a027af827a5fd235a7e9c61fea1a80b4eff8970845db67a0b6698329b70f","src/link.rs":"6fc7904495307bca8174384e31c131e4c50d95afbbff9607b101f89ec94de7c6","src/support.rs":"87bb916e9a2f7d558f6246b793a3cffad0195385a40313614e4f34ebcf250008","tests/header.h":"b1cf564b21d76db78529d1934e1481a5f0452fdedc6e32954608293c310498b6","tests/lib.rs":"c1bd385dbc2af85270d63deea0fcb2ab0012fa0090da0b0882cade50a9baaa8b"},"package":"81de550971c976f176130da4b2978d3b524eaa0fd9ac31f3ceb5ae1231fb4853"}
{"files":{"CHANGELOG.md":"fd58c20190e7e58c35cfd6d19810bb90105d98024a98c7beac3bf6f08878f498","Cargo.toml":"021b9974c21a0d3caa0e18fb4c670a73b1ee2c79284757fc0bc510c837a7f91c","LICENSE.txt":"3ddf9be5c28fe27dad143a5dc76eea25222ad1dd68934a047064e56ed2fa40c5","README.md":"b08a3079aed4d36d46822bf8db01cd0e07420a2f46289e9bc0062b130cd471ce","appveyor.yml":"1a5d6953fb6e373dc760d50659628f04d48f68bd3f3f8e434800b31e74ef1497","build.rs":"2693b9519440c2341fe51e8eef4ca63de31a93cadc30366e25788e8c3ed0a29a","build/common.rs":"c3e37974f698aa38f7a3012c03edadd14a3fcd3a27a008f55b6a2348539f471c","build/dynamic.rs":"32cff0b28aefdad4516ba8d295f3b3b1aaee99f41d1fda1561333b85f54ffbb0","build/static.rs":"acefad54c29b6e361bfb29696098779ea477c51ff09cd4c3d0195a9ded7d8f60","ci/before_install.sh":"cb6de6f230066004f568d0b5e9d940b3793ff8ee7eb5d35a4f9ec777ee369725","ci/install.bat":"a011e1b3b15db83d134675ceca9e769b1593e283fcea7f4835142af962f407b0","ci/script.sh":"52db533df970f1b44c0b2663f3bfac4476f2150e94fc392b2bab4145325f418b","ci/test_script.bat":"901609adc59dab2730e16dd374d0351d6406e7559fe4d86ddd9a857ad9c84d2a","clippy.toml":"fcf54943ba571514b244cc098ce08671b4117167733e8107e799d533a12a2195","src/lib.rs":"c80d69431089b85e7392be55687ec9c87bf20962afdfda16c6b9810cdc33688a","src/link.rs":"7af2af3940a649b069ea25ef119acbc03649285b3ff7de6485913bcdf512d64e","src/support.rs":"fc58df47c3b75e0f1a3e5d5303ee2e638cec9d6abbf1507c2cff7073062f0569","tests/header.h":"1b15a686d1c06561960045a26c25a34d840f26c8246f2f5e630f993b69c7492c","tests/lib.rs":"8a71eafaa28b66fc0f7fe2235ce0d91cdc50cb148a84aa2baa8a696b0f9d80ee"},"package":"f92986241798376849e1a007827041fed9bb36195822c2049d18e174420e0534"}

709
third_party/rust/clang-sys/CHANGELOG.md поставляемый
Просмотреть файл

@ -1,343 +1,366 @@
## [0.28.1] - 2019-07-28
### Changed
- Bumped `glob` version to `0.3.0`
- Improved error message when an invocation of an executable is not successful
- Allowed `LIBCLANG_PATH` to refer to a specific `libclang` instance (e.g.,
`/usr/local/lib/libclang.so.10`)
### Fixed
- Fixed
[`libclang-cpp`](https://github.com/llvm-mirror/clang/commit/90d6722bdcbc2af52306f7e948c556ad6185ac48)
being linked instead of `libclang`
## [0.28.0] - 2019-02-17
### Changed
- Changed `llvm-config` to be first search candidate on macOS
### Added
- Added support for `clang` 8.0.x
### Removed
- Removed `assert-minimum` feature
- Removed version detection for libraries without versions embedded in the filename
## [0.27.0] - 2019-01-10
### Changed
- Added version detection for libraries without versions embedded in the filename
### Added
- Added `assert-minimum` feature (see `README.md` for details)
## [0.26.4] - 2018-12-29
### Changed
- Added shared library path to `SharedLibrary` struct
## [0.26.3] - 2018-11-14
### Changed
- Disable default features of `libc` dependency
## [0.26.2] - 2018-11-03
### Fixed
- Fixed dynamic linking on macOS
## [0.26.1] - 2018-10-10
### Fixed
- Fixed support for finding libraries in `bin` directories on Windows
## [0.26.0] - 2018-10-07
### Changed
- Added support for finding libraries with version suffixes on Linux when using runtime linking (e.g., `libclang.so.1`)
## [0.25.0] - 2018-10-06
### Changed
- Added support for versioned libraries on BSDs
## [0.24.0] - 2018-09-15
### Changed
- Reworked finding of libraries (see `README.md` for details)
### Added
- Added support for `clang` 7.0.x
## [0.23.0] - 2018-06-16
### Changed
- Changed `Clang::find` to skip dynamic libraries for an incorrect architecture on Windows
## [0.22.0] - 2018-03-11
### Added
- Added support for `clang` 6.0.x
- Bumped `libc` version to `0.2.39`
- Bumped `libloading` version to `0.5.0`
## [0.21.2] - 2018-02-17
### Changed
- Added original errors to error messages
- Added support for searching for libraries in `LD_LIBRARY_PATH` directories
## [0.21.1] - 2017-11-24
### Changed
- Improved finding of versioned libraries (e.g., `libclang-3.9.so`)
### Fixed
* Fixed compilation failures on the beta and nightly channels caused by a [compiler bug](https://github.com/KyleMayes/clang-sys/pull/69)
## [0.21.0] - 2017-10-11
### Changed
* Replaced `bitflags` usage with constants which avoids crashes on 32-bit Linux platforms
## [0.20.1] - 2017-09-16
### Fixed
- Fixed static linking
## [0.20.0] - 2017-09-14
### Added
- Added support for `clang` 5.0.x
- Added `clang` as a link target of this package
- Added dummy implementations of `is_loaded` for builds with the `static` Cargo feature enabled
## [0.19.0] - 2017-07-02
### Changed
- Bumped `bitflags` version to `0.9.1`
- Added `args` parameter to `Clang::new` function which passes arguments to the Clang executable
## [0.18.0] - 2017-05-16
### Changed
- Improved finding of versioned libraries (e.g., `libclang.so.3.9`)
## [0.17.0] - 2017-05-08
### Changed
- Changed storage type of include search paths from `Vec<PathBuf>` to `Option<Vec<PathBuf>>`
## [0.16.0] - 2017-05-02
### Changed
- Bumped `libloading` version to `0.4.0`
## [0.15.2] - 2017-04-28
### Fixed
- Fixed finding of `libclang.so.1` on Linux
## [0.15.1] - 2017-03-29
### Fixed
- Fixed static linking when libraries are in [different directories](https://github.com/KyleMayes/clang-sys/issues/50)
## [0.15.0] - 2017-03-13
### Added
- Added support for `clang` 4.0.x
### Changed
- Changed functions in the `Functions` struct to be `unsafe` (`runtime` feature only)
- Changed `Clang::find` method to ignore directories and non-executable files
- Changed `Clang::find` to skip dynamic libraries for an incorrect architecture on FreeBSD and Linux
- Bumped `bitflags` version to `0.7.0`
## [0.14.0] - 2017-01-30
### Changed
- Changed all enum types from tuple structs to raw integers to avoid
[segmentation faults](https://github.com/rust-lang/rust/issues/39394) on some platforms
## [0.13.0] - 2017-01-29
### Changed
- Changed all opaque pointers types from tuple structs to raw pointers to avoid
[segmentation faults](https://github.com/rust-lang/rust/issues/39394) on some platforms
## [0.12.0] - 2016-12-13
### Changed
- Altered the runtime linking API to allow for testing the presence of functions
## [0.11.1] - 2016-12-07
### Added
- Added support for linking to Clang on Windows from unofficial LLVM sources such as MSYS and MinGW
## [0.11.0] - 2016-10-07
### Changed
- Changed all enums from Rust enums to typed constants to avoid
[undefined behavior](https://github.com/KyleMayes/clang-sys/issues/42)
## [0.10.1] - 2016-08-21
### Changed
- Changed static linking on FreeBSD and macOS to link against `libc++` instead of `libstd++`
## [0.10.0] - 2016-08-01
### Changed
- Added `runtime` Cargo feature that links to `libclang` shared library at runtime
- Added `from_raw` method to `CXTypeLayoutError` enum
- Added implementations of `Deref` for opaque FFI structs
- Changed `Default` implementations for structs to zero out the struct
## [0.9.0] - 2016-07-21
### Added
- Added documentation bindings
## [0.8.1] - 2016-07-20
### Changed
- Added `CLANG_PATH` environment variable for providing a path to `clang` executable
- Added usage of `llvm-config` to search for `clang`
- Added usage of `xcodebuild` to search for `clang` on macOS
## [0.8.0] - 2016-07-18
### Added
- Added support for `clang` 3.9.x
### Changed
- Bumped `libc` version to `0.2.14`
### Fixed
- Fixed `LIBCLANG_PATH` usage on Windows to search both the `bin` and `lib` directories
- Fixed search path parsing on macOS
- Fixed search path parsing on Windows
- Fixed default search path ordering on macOS
## [0.7.2] - 2016-06-17
### Fixed
- Fixed finding of `clang` executables when system has executables matching `clang-*`
(e.g., `clang-format`)
## [0.7.1] - 2016-06-10
### Changed
- Bumped `libc` version to `0.2.12`
### Fixed
- Fixed finding of `clang` executables suffixed by their version (e.g., `clang-3.5`)
## [0.7.0] - 2016-05-31
### Changed
- Changed `Clang` struct `version` field type to `Option<CXVersion>`
## [0.6.0] - 2016-05-26
### Added
- Added `support` module
### Fixed
- Fixed `libclang` linking on FreeBSD
- Fixed `libclang` linking on Windows with the MSVC toolchain
- Improved `libclang` static linking
## [0.5.4] - 20160-5-19
### Changed
- Added implementations of `Default` for FFI structs
## [0.5.3] - 2016-05-17
### Changed
- Bumped `bitflags` version to `0.7.0`
## [0.5.2] - 2016-05-12
### Fixed
- Fixed `libclang` static linking
## [0.5.1] - 2016-05-10
### Fixed
- Fixed `libclang` linking on macOS
- Fixed `libclang` linking on Windows
## [0.5.0] - 2016-05-10
### Removed
- Removed `rustc_version` dependency
- Removed support for `LIBCLANG_STATIC` environment variable
### Changed
- Bumped `bitflags` version to `0.6.0`
- Bumped `libc` version to `0.2.11`
- Improved `libclang` search path
- Improved `libclang` static linking
## [0.4.2] - 2016-04-20
### Changed
- Bumped `libc` version to `0.2.10`
## [0.4.1] - 2016-04-02
### Changed
- Bumped `libc` version to `0.2.9`
- Bumped `rustc_version` version to `0.1.7`
## [0.4.0] - 2016-03-28
### Removed
- Removed support for `clang` 3.4.x
## [0.3.1] - 2016-03-21
### Added
- Added support for finding `libclang`
## [0.3.0] - 2016-03-16
### Removed
- Removed build system types and functions
### Added
- Added support for `clang` 3.4.x
### Changed
- Bumped `bitflags` version to `0.5.0`
- Bumped `libc` version to `0.2.8`
## [0.2.1] - 2016-02-13
### Changed
- Simplified internal usage of conditional compilation
- Bumped `bitflags` version to `0.4.0`
- Bumped `libc` version to `0.2.7`
- Bumped `rustc_version` version to `0.1.6`
## [0.2.0] - 2016-02-12
### Added
- Added support for `clang` 3.8.x
## [0.1.2] - 2015-12-29
### Added
- Added derivations of `Debug` for FFI structs
## [0.1.1] - 2015-12-26
### Added
- Added derivations of `PartialOrd` and `Ord` for FFI enums
## [0.1.0] - 2015-12-22
- Initial release
## [0.29.2] - 2020-03-09
### Added
- Revert unnecessary increase of minimum version of `libc` and `libloading`
## [0.29.1] - 2020-03-06
### Added
- Added support for finding instances of `libclang` matching `libclang-*.so.*`
## [0.29.0] - 2020-02-17
### Changed
- Wrapped function pointer fields in `Option` in the `CXCursorAndRangeVisitor`
and `IndexerCallbacks` structs (to permit nullability and to avoid undefined
behavior caused by `Default` implementations for these structs which returns a
zeroed value)
### Added
- Added support for `clang` 9.0.x
- Added missing `CXCallingConv_AArch64VectorCall` variant to `CXCallingConv` enum
- Added missing `clang_CompileCommand_getNumMappedSources` function
## [0.28.1] - 2019-07-28
### Changed
- Bumped `glob` version to `0.3.0`
- Improved error message when an invocation of an executable is not successful
- Allowed `LIBCLANG_PATH` to refer to a specific `libclang` instance (e.g.,
`/usr/local/lib/libclang.so.10`)
### Fixed
- Fixed
[`libclang-cpp`](https://github.com/llvm-mirror/clang/commit/90d6722bdcbc2af52306f7e948c556ad6185ac48)
being linked instead of `libclang`
## [0.28.0] - 2019-02-17
### Changed
- Changed `llvm-config` to be first search candidate on macOS
### Added
- Added support for `clang` 8.0.x
### Removed
- Removed `assert-minimum` feature
- Removed version detection for libraries without versions embedded in the filename
## [0.27.0] - 2019-01-10
### Changed
- Added version detection for libraries without versions embedded in the filename
### Added
- Added `assert-minimum` feature (see `README.md` for details)
## [0.26.4] - 2018-12-29
### Changed
- Added shared library path to `SharedLibrary` struct
## [0.26.3] - 2018-11-14
### Changed
- Disable default features of `libc` dependency
## [0.26.2] - 2018-11-03
### Fixed
- Fixed dynamic linking on macOS
## [0.26.1] - 2018-10-10
### Fixed
- Fixed support for finding libraries in `bin` directories on Windows
## [0.26.0] - 2018-10-07
### Changed
- Added support for finding libraries with version suffixes on Linux when using runtime linking (e.g., `libclang.so.1`)
## [0.25.0] - 2018-10-06
### Changed
- Added support for versioned libraries on BSDs
## [0.24.0] - 2018-09-15
### Changed
- Reworked finding of libraries (see `README.md` for details)
### Added
- Added support for `clang` 7.0.x
## [0.23.0] - 2018-06-16
### Changed
- Changed `Clang::find` to skip dynamic libraries for an incorrect architecture on Windows
## [0.22.0] - 2018-03-11
### Added
- Added support for `clang` 6.0.x
- Bumped `libc` version to `0.2.39`
- Bumped `libloading` version to `0.5.0`
## [0.21.2] - 2018-02-17
### Changed
- Added original errors to error messages
- Added support for searching for libraries in `LD_LIBRARY_PATH` directories
## [0.21.1] - 2017-11-24
### Changed
- Improved finding of versioned libraries (e.g., `libclang-3.9.so`)
### Fixed
* Fixed compilation failures on the beta and nightly channels caused by a [compiler bug](https://github.com/KyleMayes/clang-sys/pull/69)
## [0.21.0] - 2017-10-11
### Changed
* Replaced `bitflags` usage with constants which avoids crashes on 32-bit Linux platforms
## [0.20.1] - 2017-09-16
### Fixed
- Fixed static linking
## [0.20.0] - 2017-09-14
### Added
- Added support for `clang` 5.0.x
- Added `clang` as a link target of this package
- Added dummy implementations of `is_loaded` for builds with the `static` Cargo feature enabled
## [0.19.0] - 2017-07-02
### Changed
- Bumped `bitflags` version to `0.9.1`
- Added `args` parameter to `Clang::new` function which passes arguments to the Clang executable
## [0.18.0] - 2017-05-16
### Changed
- Improved finding of versioned libraries (e.g., `libclang.so.3.9`)
## [0.17.0] - 2017-05-08
### Changed
- Changed storage type of include search paths from `Vec<PathBuf>` to `Option<Vec<PathBuf>>`
## [0.16.0] - 2017-05-02
### Changed
- Bumped `libloading` version to `0.4.0`
## [0.15.2] - 2017-04-28
### Fixed
- Fixed finding of `libclang.so.1` on Linux
## [0.15.1] - 2017-03-29
### Fixed
- Fixed static linking when libraries are in [different directories](https://github.com/KyleMayes/clang-sys/issues/50)
## [0.15.0] - 2017-03-13
### Added
- Added support for `clang` 4.0.x
### Changed
- Changed functions in the `Functions` struct to be `unsafe` (`runtime` feature only)
- Changed `Clang::find` method to ignore directories and non-executable files
- Changed `Clang::find` to skip dynamic libraries for an incorrect architecture on FreeBSD and Linux
- Bumped `bitflags` version to `0.7.0`
## [0.14.0] - 2017-01-30
### Changed
- Changed all enum types from tuple structs to raw integers to avoid
[segmentation faults](https://github.com/rust-lang/rust/issues/39394) on some platforms
## [0.13.0] - 2017-01-29
### Changed
- Changed all opaque pointers types from tuple structs to raw pointers to avoid
[segmentation faults](https://github.com/rust-lang/rust/issues/39394) on some platforms
## [0.12.0] - 2016-12-13
### Changed
- Altered the runtime linking API to allow for testing the presence of functions
## [0.11.1] - 2016-12-07
### Added
- Added support for linking to Clang on Windows from unofficial LLVM sources such as MSYS and MinGW
## [0.11.0] - 2016-10-07
### Changed
- Changed all enums from Rust enums to typed constants to avoid
[undefined behavior](https://github.com/KyleMayes/clang-sys/issues/42)
## [0.10.1] - 2016-08-21
### Changed
- Changed static linking on FreeBSD and macOS to link against `libc++` instead of `libstd++`
## [0.10.0] - 2016-08-01
### Changed
- Added `runtime` Cargo feature that links to `libclang` shared library at runtime
- Added `from_raw` method to `CXTypeLayoutError` enum
- Added implementations of `Deref` for opaque FFI structs
- Changed `Default` implementations for structs to zero out the struct
## [0.9.0] - 2016-07-21
### Added
- Added documentation bindings
## [0.8.1] - 2016-07-20
### Changed
- Added `CLANG_PATH` environment variable for providing a path to `clang` executable
- Added usage of `llvm-config` to search for `clang`
- Added usage of `xcodebuild` to search for `clang` on macOS
## [0.8.0] - 2016-07-18
### Added
- Added support for `clang` 3.9.x
### Changed
- Bumped `libc` version to `0.2.14`
### Fixed
- Fixed `LIBCLANG_PATH` usage on Windows to search both the `bin` and `lib` directories
- Fixed search path parsing on macOS
- Fixed search path parsing on Windows
- Fixed default search path ordering on macOS
## [0.7.2] - 2016-06-17
### Fixed
- Fixed finding of `clang` executables when system has executables matching `clang-*`
(e.g., `clang-format`)
## [0.7.1] - 2016-06-10
### Changed
- Bumped `libc` version to `0.2.12`
### Fixed
- Fixed finding of `clang` executables suffixed by their version (e.g., `clang-3.5`)
## [0.7.0] - 2016-05-31
### Changed
- Changed `Clang` struct `version` field type to `Option<CXVersion>`
## [0.6.0] - 2016-05-26
### Added
- Added `support` module
### Fixed
- Fixed `libclang` linking on FreeBSD
- Fixed `libclang` linking on Windows with the MSVC toolchain
- Improved `libclang` static linking
## [0.5.4] - 20160-5-19
### Changed
- Added implementations of `Default` for FFI structs
## [0.5.3] - 2016-05-17
### Changed
- Bumped `bitflags` version to `0.7.0`
## [0.5.2] - 2016-05-12
### Fixed
- Fixed `libclang` static linking
## [0.5.1] - 2016-05-10
### Fixed
- Fixed `libclang` linking on macOS
- Fixed `libclang` linking on Windows
## [0.5.0] - 2016-05-10
### Removed
- Removed `rustc_version` dependency
- Removed support for `LIBCLANG_STATIC` environment variable
### Changed
- Bumped `bitflags` version to `0.6.0`
- Bumped `libc` version to `0.2.11`
- Improved `libclang` search path
- Improved `libclang` static linking
## [0.4.2] - 2016-04-20
### Changed
- Bumped `libc` version to `0.2.10`
## [0.4.1] - 2016-04-02
### Changed
- Bumped `libc` version to `0.2.9`
- Bumped `rustc_version` version to `0.1.7`
## [0.4.0] - 2016-03-28
### Removed
- Removed support for `clang` 3.4.x
## [0.3.1] - 2016-03-21
### Added
- Added support for finding `libclang`
## [0.3.0] - 2016-03-16
### Removed
- Removed build system types and functions
### Added
- Added support for `clang` 3.4.x
### Changed
- Bumped `bitflags` version to `0.5.0`
- Bumped `libc` version to `0.2.8`
## [0.2.1] - 2016-02-13
### Changed
- Simplified internal usage of conditional compilation
- Bumped `bitflags` version to `0.4.0`
- Bumped `libc` version to `0.2.7`
- Bumped `rustc_version` version to `0.1.6`
## [0.2.0] - 2016-02-12
### Added
- Added support for `clang` 3.8.x
## [0.1.2] - 2015-12-29
### Added
- Added derivations of `Debug` for FFI structs
## [0.1.1] - 2015-12-26
### Added
- Added derivations of `PartialOrd` and `Ord` for FFI enums
## [0.1.0] - 2015-12-22
- Initial release

6
third_party/rust/clang-sys/Cargo.toml поставляемый
Просмотреть файл

@ -12,7 +12,7 @@
[package]
name = "clang-sys"
version = "0.28.1"
version = "0.29.2"
authors = ["Kyle Mayes <kyle@mayeses.com>"]
build = "build.rs"
links = "clang"
@ -29,7 +29,7 @@ version = "0.2.39"
default-features = false
[dependencies.libloading]
version = "0.5.0"
version = "0.5"
optional = true
[build-dependencies.glob]
version = "0.3"
@ -45,6 +45,7 @@ clang_5_0 = ["gte_clang_3_6", "gte_clang_3_7", "gte_clang_3_8", "gte_clang_3_9",
clang_6_0 = ["gte_clang_3_6", "gte_clang_3_7", "gte_clang_3_8", "gte_clang_3_9", "gte_clang_4_0", "gte_clang_5_0", "gte_clang_6_0"]
clang_7_0 = ["gte_clang_3_6", "gte_clang_3_7", "gte_clang_3_8", "gte_clang_3_9", "gte_clang_4_0", "gte_clang_5_0", "gte_clang_6_0", "gte_clang_7_0"]
clang_8_0 = ["gte_clang_3_6", "gte_clang_3_7", "gte_clang_3_8", "gte_clang_3_9", "gte_clang_4_0", "gte_clang_5_0", "gte_clang_6_0", "gte_clang_7_0", "gte_clang_8_0"]
clang_9_0 = ["gte_clang_3_6", "gte_clang_3_7", "gte_clang_3_8", "gte_clang_3_9", "gte_clang_4_0", "gte_clang_5_0", "gte_clang_6_0", "gte_clang_7_0", "gte_clang_8_0", "gte_clang_9_0"]
gte_clang_3_6 = []
gte_clang_3_7 = []
gte_clang_3_8 = []
@ -54,5 +55,6 @@ gte_clang_5_0 = []
gte_clang_6_0 = []
gte_clang_7_0 = []
gte_clang_8_0 = []
gte_clang_9_0 = []
runtime = ["libloading"]
static = []

404
third_party/rust/clang-sys/LICENSE.txt поставляемый
Просмотреть файл

@ -1,202 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

252
third_party/rust/clang-sys/README.md поставляемый
Просмотреть файл

@ -1,124 +1,128 @@
# clang-sys
[![crates.io](https://img.shields.io/crates/v/clang-sys.svg)](https://crates.io/crates/clang-sys)
[![Travis CI](https://travis-ci.org/KyleMayes/clang-sys.svg?branch=master)](https://travis-ci.org/KyleMayes/clang-sys)
[![AppVeyor](https://ci.appveyor.com/api/projects/status/7tv5mjyg55rof356/branch/master?svg=true)](https://ci.appveyor.com/project/KyleMayes/clang-sys-vtvy5/branch/master)
Rust bindings for `libclang`.
If you are interested in a Rust wrapper for these bindings, see
[clang-rs](https://github.com/KyleMayes/clang-rs).
Supported on the stable, beta, and nightly Rust channels.
Released under the Apache License 2.0.
## Supported Versions
To target a version of `libclang`, enable one of the following Cargo features:
* `clang_3_5` - requires `libclang` 3.5 or later
([Documentation](https://kylemayes.github.io/clang-sys/3_5/clang_sys))
* `clang_3_6` - requires `libclang` 3.6 or later
([Documentation](https://kylemayes.github.io/clang-sys/3_6/clang_sys))
* `clang_3_7` - requires `libclang` 3.7 or later
([Documentation](https://kylemayes.github.io/clang-sys/3_7/clang_sys))
* `clang_3_8` - requires `libclang` 3.8 or later
([Documentation](https://kylemayes.github.io/clang-sys/3_8/clang_sys))
* `clang_3_9` - requires `libclang` 3.9 or later
([Documentation](https://kylemayes.github.io/clang-sys/3_9/clang_sys))
* `clang_4_0` - requires `libclang` 4.0 or later
([Documentation](https://kylemayes.github.io/clang-sys/4_0/clang_sys))
* `clang_5_0` - requires `libclang` 5.0 or later
([Documentation](https://kylemayes.github.io/clang-sys/5_0/clang_sys))
* `clang_6_0` - requires `libclang` 6.0 or later
([Documentation](https://kylemayes.github.io/clang-sys/6_0/clang_sys))
* `clang_7_0` - requires `libclang` 7.0 or later
([Documentation](https://kylemayes.github.io/clang-sys/7_0/clang_sys))
* `clang_8_0` - requires `libclang` 8.0 or later
([Documentation](https://kylemayes.github.io/clang-sys/8_0/clang_sys))
If you do not enable one of these features, the API provided by `libclang` 3.5 will be available by
default.
## Dependencies
By default, this crate will attempt to link to `libclang` dynamically. In this case, this crate
depends on the `libclang` shared library (`libclang.so` on Linux, `libclang.dylib` on macOS,
`libclang.dll` on Windows). If you want to link to `libclang` statically instead, enable the
`static` Cargo feature. In this case, this crate depends on the LLVM and Clang static libraries. If
you don't want to link to `libclang` at compiletime but instead want to load it at runtime, enable
the `runtime` Cargo feature.
These libraries can be either be installed as a part of Clang or downloaded
[here](http://llvm.org/releases/download.html).
**Note:** The downloads for LLVM and Clang 3.8 and later do not include the `libclang.a` static
library. This means you cannot link to any of these versions of `libclang` statically unless you
build it from source.
### Versioned Dependencies
This crate supports finding versioned instances of `libclang.so` (e.g.,`libclang-3.9.so`).
In the case where there are multiple instances to choose from, this crate will prefer instances with
higher versions. For example, the following instances of `libclang.so` are listed in descending
order of preference:
1. `libclang-4.0.so`
2. `libclang-4.so`
3. `libclang-3.9.so`
4. `libclang-3.so`
5. `libclang.so`
**Note:** On BSD distributions, versioned instances of `libclang.so` matching the pattern
`libclang.so.*` (e.g., `libclang.so.7.0`) are also included.
**Note:** On Linux distributions when the `runtime` features is enabled, versioned instances of
`libclang.so` matching the pattern `libclang.so.*` (e.g., `libclang.so.1`) are also included.
## Environment Variables
The following environment variables, if set, are used by this crate to find the required libraries
and executables:
* `LLVM_CONFIG_PATH` **(compiletime)** - provides a path to an `llvm-config` executable
* `LIBCLANG_PATH` **(compiletime)** - provides a path to a directory containing a `libclang` shared
library or a path to a specific `libclang` shared library
* `LIBCLANG_STATIC_PATH` **(compiletime)** - provides a path to a directory containing LLVM and
Clang static libraries
* `CLANG_PATH` **(runtime)** - provides a path to a `clang` executable
## Linking
### Dynamic
`libclang` shared libraries will be searched for in the following directories:
* the directory provided by the `LIBCLANG_PATH` environment variable
* the `bin` and `lib` directories in the directory provided by `llvm-config --libdir`
* the directories provided by `LD_LIBRARY_PATH` environment variable
* a list of likely directories for the target platform (e.g., `/usr/local/lib` on Linux)
* **macOS only:** the toolchain directory in the directory provided by `xcode-select --print-path`
On Linux, running an executable that has been dynamically linked to `libclang` may require you to
add a path to `libclang.so` to the `LD_LIBRARY_PATH` environment variable. The same is true on OS
X, except the `DYLD_LIBRARY_PATH` environment variable is used instead.
On Windows, running an executable that has been dynamically linked to `libclang` requires that
`libclang.dll` can be found by the executable at runtime. See
[here](https://msdn.microsoft.com/en-us/library/7d83bc18.aspx) for more information.
### Static
The availability of `llvm-config` is not optional for static linking. Ensure that an instance of
this executable can be found on your system's path or set the `LLVM_CONFIG_PATH` environment
variable. The required LLVM and Clang static libraries will be searched for in the same way as
shared libraries are searched for, except the `LIBCLANG_STATIC_PATH` environment variable is used in
place of the `LIBCLANG_PATH` environment variable.
### Runtime
The `clang_sys::load` function is used to load a `libclang` shared library for use in the thread in
which it is called. The `clang_sys::unload` function will unload the `libclang` shared library.
`clang_sys::load` searches for a `libclang` shared library in the same way one is searched for when
linking to `libclang` dynamically at compiletime.
# clang-sys
[![crates.io](https://img.shields.io/crates/v/clang-sys.svg)](https://crates.io/crates/clang-sys)
[![Travis CI](https://travis-ci.org/KyleMayes/clang-sys.svg?branch=master)](https://travis-ci.org/KyleMayes/clang-sys)
[![AppVeyor](https://ci.appveyor.com/api/projects/status/7tv5mjyg55rof356/branch/master?svg=true)](https://ci.appveyor.com/project/KyleMayes/clang-sys-vtvy5/branch/master)
Rust bindings for `libclang`.
If you are interested in a Rust wrapper for these bindings, see
[clang-rs](https://github.com/KyleMayes/clang-rs).
Supported on the stable, beta, and nightly Rust channels.<br/>
Minimum supported Rust version: **1.36.0**
Released under the Apache License 2.0.
## Supported Versions
To target a version of `libclang`, enable one of the following Cargo features:
* `clang_3_5` - requires `libclang` 3.5 or later
([Documentation](https://kylemayes.github.io/clang-sys/3_5/clang_sys))
* `clang_3_6` - requires `libclang` 3.6 or later
([Documentation](https://kylemayes.github.io/clang-sys/3_6/clang_sys))
* `clang_3_7` - requires `libclang` 3.7 or later
([Documentation](https://kylemayes.github.io/clang-sys/3_7/clang_sys))
* `clang_3_8` - requires `libclang` 3.8 or later
([Documentation](https://kylemayes.github.io/clang-sys/3_8/clang_sys))
* `clang_3_9` - requires `libclang` 3.9 or later
([Documentation](https://kylemayes.github.io/clang-sys/3_9/clang_sys))
* `clang_4_0` - requires `libclang` 4.0 or later
([Documentation](https://kylemayes.github.io/clang-sys/4_0/clang_sys))
* `clang_5_0` - requires `libclang` 5.0 or later
([Documentation](https://kylemayes.github.io/clang-sys/5_0/clang_sys))
* `clang_6_0` - requires `libclang` 6.0 or later
([Documentation](https://kylemayes.github.io/clang-sys/6_0/clang_sys))
* `clang_7_0` - requires `libclang` 7.0 or later
([Documentation](https://kylemayes.github.io/clang-sys/7_0/clang_sys))
* `clang_8_0` - requires `libclang` 8.0 or later
([Documentation](https://kylemayes.github.io/clang-sys/8_0/clang_sys))
* `clang_9_0` - requires `libclang` 9.0 or later
([Documentation](https://kylemayes.github.io/clang-sys/9_0/clang_sys))
If you do not enable one of these features, the API provided by `libclang` 3.5 will be available by
default.
## Dependencies
By default, this crate will attempt to link to `libclang` dynamically. In this case, this crate
depends on the `libclang` shared library (`libclang.so` on Linux, `libclang.dylib` on macOS,
`libclang.dll` on Windows). If you want to link to `libclang` statically instead, enable the
`static` Cargo feature. In this case, this crate depends on the LLVM and Clang static libraries. If
you don't want to link to `libclang` at compiletime but instead want to load it at runtime, enable
the `runtime` Cargo feature.
These libraries can be either be installed as a part of Clang or downloaded
[here](http://llvm.org/releases/download.html).
**Note:** The downloads for LLVM and Clang 3.8 and later do not include the `libclang.a` static
library. This means you cannot link to any of these versions of `libclang` statically unless you
build it from source.
### Versioned Dependencies
This crate supports finding versioned instances of `libclang.so` (e.g.,`libclang-3.9.so`).
In the case where there are multiple instances to choose from, this crate will prefer instances with
higher versions. For example, the following instances of `libclang.so` are listed in descending
order of preference:
1. `libclang-4.0.so`
2. `libclang-4.so`
3. `libclang-3.9.so`
4. `libclang-3.so`
5. `libclang.so`
**Note:** On BSD distributions, versioned instances of `libclang.so` matching the pattern
`libclang.so.*` (e.g., `libclang.so.7.0`) are also included.
**Note:** On Linux distributions when the `runtime` features is enabled, versioned instances of
`libclang.so` matching the pattern `libclang.so.*` (e.g., `libclang.so.1`) are also included.
## Environment Variables
The following environment variables, if set, are used by this crate to find the required libraries
and executables:
* `LLVM_CONFIG_PATH` **(compiletime)** - provides a full path to an `llvm-config` executable
(including the executable itself [i.e., `/usr/local/bin/llvm-config-8.0`])
* `LIBCLANG_PATH` **(compiletime)** - provides a path to a directory containing a `libclang` shared
library or a full path to a specific `libclang` shared library
* `LIBCLANG_STATIC_PATH` **(compiletime)** - provides a path to a directory containing LLVM and
Clang static libraries
* `CLANG_PATH` **(runtime)** - provides a path to a `clang` executable
## Linking
### Dynamic
`libclang` shared libraries will be searched for in the following directories:
* the directory provided by the `LIBCLANG_PATH` environment variable
* the `bin` and `lib` directories in the directory provided by `llvm-config --libdir`
* the directories provided by `LD_LIBRARY_PATH` environment variable
* a list of likely directories for the target platform (e.g., `/usr/local/lib` on Linux)
* **macOS only:** the toolchain directory in the directory provided by `xcode-select --print-path`
On Linux, running an executable that has been dynamically linked to `libclang` may require you to
add a path to `libclang.so` to the `LD_LIBRARY_PATH` environment variable. The same is true on OS
X, except the `DYLD_LIBRARY_PATH` environment variable is used instead.
On Windows, running an executable that has been dynamically linked to `libclang` requires that
`libclang.dll` can be found by the executable at runtime. See
[here](https://msdn.microsoft.com/en-us/library/7d83bc18.aspx) for more information.
### Static
The availability of `llvm-config` is not optional for static linking. Ensure that an instance of
this executable can be found on your system's path or set the `LLVM_CONFIG_PATH` environment
variable. The required LLVM and Clang static libraries will be searched for in the same way as
shared libraries are searched for, except the `LIBCLANG_STATIC_PATH` environment variable is used in
place of the `LIBCLANG_PATH` environment variable.
### Runtime
The `clang_sys::load` function is used to load a `libclang` shared library for use in the thread in
which it is called. The `clang_sys::unload` function will unload the `libclang` shared library.
`clang_sys::load` searches for a `libclang` shared library in the same way one is searched for when
linking to `libclang` dynamically at compiletime.

24
third_party/rust/clang-sys/appveyor.yml поставляемый
Просмотреть файл

@ -1,12 +1,12 @@
environment:
matrix:
- LLVM_VERSION: 7.0.0
CLANG_VERSION: clang_7_0
install:
- .\ci\install.bat
build: false
test_script:
- .\ci\test_script.bat
environment:
matrix:
- LLVM_VERSION: 7.0.0
CLANG_VERSION: clang_7_0
install:
- .\ci\install.bat
build: false
test_script:
- .\ci\test_script.bat

170
third_party/rust/clang-sys/build.rs поставляемый
Просмотреть файл

@ -1,85 +1,85 @@
// Copyright 2016 Kyle Mayes
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//! Finds `libclang` static or dynamic libraries and links to them.
//!
//! # Environment Variables
//!
//! This build script can make use of several environment variables to help it
//! find the required static or dynamic libraries.
//!
//! * `LLVM_CONFIG_PATH` - provides a path to an `llvm-config` executable
//! * `LIBCLANG_PATH` - provides a path to a directory containing a `libclang`
//! shared library or a path to a specific `libclang` shared library
//! * `LIBCLANG_STATIC_PATH` - provides a path to a directory containing LLVM
//! and Clang static libraries
#![allow(unused_attributes)]
extern crate glob;
use std::path::Path;
#[path = "build/common.rs"]
pub mod common;
#[path = "build/dynamic.rs"]
pub mod dynamic;
#[path = "build/static.rs"]
pub mod static_;
/// Copy the file from the supplied source to the supplied destination.
#[cfg(feature = "runtime")]
fn copy(source: &str, destination: &Path) {
use std::fs::File;
use std::io::{Read, Write};
let mut string = String::new();
File::open(source)
.unwrap()
.read_to_string(&mut string)
.unwrap();
File::create(destination)
.unwrap()
.write_all(string.as_bytes())
.unwrap();
}
/// Generates the finding and linking code so that it may be used at runtime.
#[cfg(feature = "runtime")]
fn main() {
use std::env;
if cfg!(feature = "static") {
panic!("`runtime` and `static` features can't be combined");
}
let out = env::var("OUT_DIR").unwrap();
copy("build/common.rs", &Path::new(&out).join("common.rs"));
copy("build/dynamic.rs", &Path::new(&out).join("dynamic.rs"));
}
/// Finds and links to the required libraries.
#[cfg(not(feature = "runtime"))]
fn main() {
if cfg!(feature = "static") {
static_::link();
} else {
dynamic::link();
}
if let Some(output) = common::run_llvm_config(&["--includedir"]) {
let directory = Path::new(output.trim_end());
println!("cargo:include={}", directory.display());
}
}
// Copyright 2016 Kyle Mayes
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//! Finds `libclang` static or dynamic libraries and links to them.
//!
//! # Environment Variables
//!
//! This build script can make use of several environment variables to help it
//! find the required static or dynamic libraries.
//!
//! * `LLVM_CONFIG_PATH` - provides a path to an `llvm-config` executable
//! * `LIBCLANG_PATH` - provides a path to a directory containing a `libclang`
//! shared library or a path to a specific `libclang` shared library
//! * `LIBCLANG_STATIC_PATH` - provides a path to a directory containing LLVM
//! and Clang static libraries
#![allow(unused_attributes)]
extern crate glob;
use std::path::Path;
#[path = "build/common.rs"]
pub mod common;
#[path = "build/dynamic.rs"]
pub mod dynamic;
#[path = "build/static.rs"]
pub mod static_;
/// Copy the file from the supplied source to the supplied destination.
#[cfg(feature = "runtime")]
fn copy(source: &str, destination: &Path) {
use std::fs::File;
use std::io::{Read, Write};
let mut string = String::new();
File::open(source)
.unwrap()
.read_to_string(&mut string)
.unwrap();
File::create(destination)
.unwrap()
.write_all(string.as_bytes())
.unwrap();
}
/// Generates the finding and linking code so that it may be used at runtime.
#[cfg(feature = "runtime")]
fn main() {
use std::env;
if cfg!(feature = "static") {
panic!("`runtime` and `static` features can't be combined");
}
let out = env::var("OUT_DIR").unwrap();
copy("build/common.rs", &Path::new(&out).join("common.rs"));
copy("build/dynamic.rs", &Path::new(&out).join("dynamic.rs"));
}
/// Finds and links to the required libraries.
#[cfg(not(feature = "runtime"))]
fn main() {
if cfg!(feature = "static") {
static_::link();
} else {
dynamic::link();
}
if let Some(output) = common::run_llvm_config(&["--includedir"]) {
let directory = Path::new(output.trim_end());
println!("cargo:include={}", directory.display());
}
}

438
third_party/rust/clang-sys/build/common.rs поставляемый
Просмотреть файл

@ -1,217 +1,221 @@
// Copyright 2018 Kyle Mayes
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
extern crate glob;
use std::env;
use std::path::{Path, PathBuf};
use std::process::Command;
use glob::MatchOptions;
/// `libclang` directory patterns for FreeBSD and Linux.
const DIRECTORIES_LINUX: &[&str] = &[
"/usr/lib*",
"/usr/lib*/*",
"/usr/lib*/*/*",
"/usr/local/lib*",
"/usr/local/lib*/*",
"/usr/local/lib*/*/*",
"/usr/local/llvm*/lib*",
];
/// `libclang` directory patterns for macOS.
const DIRECTORIES_MACOS: &[&str] = &[
"/usr/local/opt/llvm*/lib",
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib",
"/Library/Developer/CommandLineTools/usr/lib",
"/usr/local/opt/llvm*/lib/llvm*/lib",
];
/// `libclang` directory patterns for Windows.
const DIRECTORIES_WINDOWS: &[&str] = &[
"C:\\LLVM\\lib",
"C:\\Program Files*\\LLVM\\lib",
"C:\\MSYS*\\MinGW*\\lib",
];
/// Executes the supplied console command, returning the `stdout` output if the
/// command was successfully executed.
fn run_command(command: &str, arguments: &[&str]) -> Option<String> {
macro_rules! warn {
($error:expr) => {
println!(
"cargo:warning=couldn't execute `{} {}` ({})",
command,
arguments.join(" "),
$error,
);
};
}
let output = match Command::new(command).args(arguments).output() {
Ok(output) => output,
Err(error) => {
warn!(format!("error: {}", error));
return None;
}
};
if !output.status.success() {
warn!(format!("exit code: {}", output.status));
return None;
}
Some(String::from_utf8_lossy(&output.stdout).into_owned())
}
/// Executes `llvm-config`, returning the `stdout` output if the command was
/// successfully executed.
pub fn run_llvm_config(arguments: &[&str]) -> Option<String> {
let path = env::var("LLVM_CONFIG_PATH").unwrap_or_else(|_| "llvm-config".into());
let output = run_command(&path, arguments);
if output.is_none() {
println!("cargo:warning=set the LLVM_CONFIG_PATH environment variable to a valid `llvm-config` executable");
}
output
}
/// Returns the paths to and the filenames of the files matching the supplied
/// filename patterns in the supplied directory.
fn search_directory(directory: &Path, filenames: &[String]) -> Vec<(PathBuf, String)> {
// Join the directory to the filename patterns to obtain the path patterns.
let paths = filenames
.iter()
.filter_map(|f| directory.join(f).to_str().map(ToOwned::to_owned));
// Prevent wildcards from matching path separators.
let mut options = MatchOptions::new();
options.require_literal_separator = true;
paths
.flat_map(|p| {
if let Ok(paths) = glob::glob_with(&p, options) {
paths.filter_map(Result::ok).collect()
} else {
vec![]
}
})
.filter_map(|p| {
let filename = p.file_name().and_then(|f| f.to_str())?;
// The `libclang_shared` library has been renamed to `libclang-cpp`
// in Clang 10. This can cause instances of this library (e.g.,
// `libclang-cpp.so.10`) to be matched by patterns looking for
// instances of `libclang`.
if filename.contains("-cpp.") {
return None;
}
Some((directory.to_owned(), filename.into()))
})
.collect::<Vec<_>>()
}
/// Returns the paths to and the filenames of the files matching the supplied
/// filename patterns in the supplied directory, checking any relevant sibling
/// directories.
fn search_directories(directory: &Path, filenames: &[String]) -> Vec<(PathBuf, String)> {
let mut results = search_directory(directory, filenames);
// On Windows, `libclang.dll` is usually found in the LLVM `bin` directory
// while `libclang.lib` is usually found in the LLVM `lib` directory. To
// keep things consistent with other platforms, only LLVM `lib` directories
// are included in the backup search directory globs so we need to search
// the LLVM `bin` directory here.
if cfg!(target_os = "windows") && directory.ends_with("lib") {
let sibling = directory.parent().unwrap().join("bin");
results.extend(search_directory(&sibling, filenames).into_iter());
}
results
}
/// Returns the paths to and the filenames of the `libclang` static or dynamic
/// libraries matching the supplied filename patterns.
pub fn search_libclang_directories(files: &[String], variable: &str) -> Vec<(PathBuf, String)> {
// Use the path provided by the relevant environment variable.
if let Ok(path) = env::var(variable).map(|d| Path::new(&d).to_path_buf()) {
// Check if the path is referring to a matching file already.
if let Some(parent) = path.parent() {
let filename = path.file_name().unwrap().to_str().unwrap();
let libraries = search_directories(parent, files);
if libraries.iter().any(|(_, f)| f == filename) {
return vec![(parent.into(), filename.into())];
}
}
return search_directories(&path, files);
}
let mut found = vec![];
// Search the `bin` and `lib` directories in directory provided by
// `llvm-config --prefix`.
if let Some(output) = run_llvm_config(&["--prefix"]) {
let directory = Path::new(output.lines().next().unwrap()).to_path_buf();
found.extend(search_directories(&directory.join("bin"), files));
found.extend(search_directories(&directory.join("lib"), files));
found.extend(search_directories(&directory.join("lib64"), files));
}
// Search the toolchain directory in the directory provided by
// `xcode-select --print-path`.
if cfg!(target_os = "macos") {
if let Some(output) = run_command("xcode-select", &["--print-path"]) {
let directory = Path::new(output.lines().next().unwrap()).to_path_buf();
let directory = directory.join("Toolchains/XcodeDefault.xctoolchain/usr/lib");
found.extend(search_directories(&directory, files));
}
}
// Search the directories provided by the `LD_LIBRARY_PATH` environment
// variable.
if let Ok(path) = env::var("LD_LIBRARY_PATH") {
for directory in path.split(':').map(Path::new) {
found.extend(search_directories(&directory, files));
}
}
// Determine the `libclang` directory patterns.
let directories = if cfg!(any(target_os = "freebsd", target_os = "linux")) {
DIRECTORIES_LINUX
} else if cfg!(target_os = "macos") {
DIRECTORIES_MACOS
} else if cfg!(target_os = "windows") {
DIRECTORIES_WINDOWS
} else {
&[]
};
// Search the directories provided by the `libclang` directory patterns.
let mut options = MatchOptions::new();
options.case_sensitive = false;
options.require_literal_separator = true;
for directory in directories.iter().rev() {
if let Ok(directories) = glob::glob_with(directory, options) {
for directory in directories.filter_map(Result::ok).filter(|p| p.is_dir()) {
found.extend(search_directories(&directory, files));
}
}
}
found
}
// Copyright 2018 Kyle Mayes
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
extern crate glob;
use std::env;
use std::path::{Path, PathBuf};
use std::process::Command;
use glob::MatchOptions;
/// `libclang` directory patterns for FreeBSD and Linux.
const DIRECTORIES_LINUX: &[&str] = &[
"/usr/lib*",
"/usr/lib*/*",
"/usr/lib*/*/*",
"/usr/local/lib*",
"/usr/local/lib*/*",
"/usr/local/lib*/*/*",
"/usr/local/llvm*/lib*",
];
/// `libclang` directory patterns for macOS.
const DIRECTORIES_MACOS: &[&str] = &[
"/usr/local/opt/llvm*/lib",
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib",
"/Library/Developer/CommandLineTools/usr/lib",
"/usr/local/opt/llvm*/lib/llvm*/lib",
];
/// `libclang` directory patterns for Windows.
const DIRECTORIES_WINDOWS: &[&str] = &[
"C:\\LLVM\\lib",
"C:\\Program Files*\\LLVM\\lib",
"C:\\MSYS*\\MinGW*\\lib",
];
/// Executes the supplied console command, returning the `stdout` output if the
/// command was successfully executed.
fn run_command(command: &str, arguments: &[&str]) -> Option<String> {
macro_rules! warn {
($error:expr) => {
println!(
"cargo:warning=couldn't execute `{} {}` ({})",
command,
arguments.join(" "),
$error,
);
};
}
let output = match Command::new(command).args(arguments).output() {
Ok(output) => output,
Err(error) => {
warn!(format!("error: {}", error));
return None;
}
};
if !output.status.success() {
warn!(format!("exit code: {}", output.status));
return None;
}
Some(String::from_utf8_lossy(&output.stdout).into_owned())
}
/// Executes `llvm-config`, returning the `stdout` output if the command was
/// successfully executed.
pub fn run_llvm_config(arguments: &[&str]) -> Option<String> {
let path = env::var("LLVM_CONFIG_PATH").unwrap_or_else(|_| "llvm-config".into());
let output = run_command(&path, arguments);
if output.is_none() {
println!(
"cargo:warning=set the LLVM_CONFIG_PATH environment variable to \
the full path to a valid `llvm-config` executable (including the \
executable itself)"
);
}
output
}
/// Returns the paths to and the filenames of the files matching the supplied
/// filename patterns in the supplied directory.
fn search_directory(directory: &Path, filenames: &[String]) -> Vec<(PathBuf, String)> {
// Join the directory to the filename patterns to obtain the path patterns.
let paths = filenames
.iter()
.filter_map(|f| directory.join(f).to_str().map(ToOwned::to_owned));
// Prevent wildcards from matching path separators.
let mut options = MatchOptions::new();
options.require_literal_separator = true;
paths
.flat_map(|p| {
if let Ok(paths) = glob::glob_with(&p, options) {
paths.filter_map(Result::ok).collect()
} else {
vec![]
}
})
.filter_map(|p| {
let filename = p.file_name().and_then(|f| f.to_str())?;
// The `libclang_shared` library has been renamed to `libclang-cpp`
// in Clang 10. This can cause instances of this library (e.g.,
// `libclang-cpp.so.10`) to be matched by patterns looking for
// instances of `libclang`.
if filename.contains("-cpp.") {
return None;
}
Some((directory.to_owned(), filename.into()))
})
.collect::<Vec<_>>()
}
/// Returns the paths to and the filenames of the files matching the supplied
/// filename patterns in the supplied directory, checking any relevant sibling
/// directories.
fn search_directories(directory: &Path, filenames: &[String]) -> Vec<(PathBuf, String)> {
let mut results = search_directory(directory, filenames);
// On Windows, `libclang.dll` is usually found in the LLVM `bin` directory
// while `libclang.lib` is usually found in the LLVM `lib` directory. To
// keep things consistent with other platforms, only LLVM `lib` directories
// are included in the backup search directory globs so we need to search
// the LLVM `bin` directory here.
if cfg!(target_os = "windows") && directory.ends_with("lib") {
let sibling = directory.parent().unwrap().join("bin");
results.extend(search_directory(&sibling, filenames).into_iter());
}
results
}
/// Returns the paths to and the filenames of the `libclang` static or dynamic
/// libraries matching the supplied filename patterns.
pub fn search_libclang_directories(files: &[String], variable: &str) -> Vec<(PathBuf, String)> {
// Use the path provided by the relevant environment variable.
if let Ok(path) = env::var(variable).map(|d| Path::new(&d).to_path_buf()) {
// Check if the path is referring to a matching file already.
if let Some(parent) = path.parent() {
let filename = path.file_name().unwrap().to_str().unwrap();
let libraries = search_directories(parent, files);
if libraries.iter().any(|(_, f)| f == filename) {
return vec![(parent.into(), filename.into())];
}
}
return search_directories(&path, files);
}
let mut found = vec![];
// Search the `bin` and `lib` directories in directory provided by
// `llvm-config --prefix`.
if let Some(output) = run_llvm_config(&["--prefix"]) {
let directory = Path::new(output.lines().next().unwrap()).to_path_buf();
found.extend(search_directories(&directory.join("bin"), files));
found.extend(search_directories(&directory.join("lib"), files));
found.extend(search_directories(&directory.join("lib64"), files));
}
// Search the toolchain directory in the directory provided by
// `xcode-select --print-path`.
if cfg!(target_os = "macos") {
if let Some(output) = run_command("xcode-select", &["--print-path"]) {
let directory = Path::new(output.lines().next().unwrap()).to_path_buf();
let directory = directory.join("Toolchains/XcodeDefault.xctoolchain/usr/lib");
found.extend(search_directories(&directory, files));
}
}
// Search the directories provided by the `LD_LIBRARY_PATH` environment
// variable.
if let Ok(path) = env::var("LD_LIBRARY_PATH") {
for directory in path.split(':').map(Path::new) {
found.extend(search_directories(&directory, files));
}
}
// Determine the `libclang` directory patterns.
let directories = if cfg!(any(target_os = "freebsd", target_os = "linux")) {
DIRECTORIES_LINUX
} else if cfg!(target_os = "macos") {
DIRECTORIES_MACOS
} else if cfg!(target_os = "windows") {
DIRECTORIES_WINDOWS
} else {
&[]
};
// Search the directories provided by the `libclang` directory patterns.
let mut options = MatchOptions::new();
options.case_sensitive = false;
options.require_literal_separator = true;
for directory in directories.iter().rev() {
if let Ok(directories) = glob::glob_with(directory, options) {
for directory in directories.filter_map(Result::ok).filter(|p| p.is_dir()) {
found.extend(search_directories(&directory, files));
}
}
}
found
}

487
third_party/rust/clang-sys/build/dynamic.rs поставляемый
Просмотреть файл

@ -1,243 +1,244 @@
// Copyright 2018 Kyle Mayes
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
use std::env;
use std::fs::File;
use std::io::{self, Error, ErrorKind, Read, Seek, SeekFrom};
use std::path::{Path, PathBuf};
use super::common;
/// Returns the ELF class from the ELF header in the supplied file.
fn parse_elf_header(path: &Path) -> io::Result<u8> {
let mut file = File::open(path)?;
let mut buffer = [0; 5];
file.read_exact(&mut buffer)?;
if buffer[..4] == [127, 69, 76, 70] {
Ok(buffer[4])
} else {
Err(Error::new(ErrorKind::InvalidData, "invalid ELF header"))
}
}
/// Returns the magic number from the PE header in the supplied file.
fn parse_pe_header(path: &Path) -> io::Result<u16> {
let mut file = File::open(path)?;
// Determine the header offset.
let mut buffer = [0; 4];
let start = SeekFrom::Start(0x3C);
file.seek(start)?;
file.read_exact(&mut buffer)?;
let offset = i32::from_le_bytes(buffer);
// Determine the validity of the header.
file.seek(SeekFrom::Start(offset as u64))?;
file.read_exact(&mut buffer)?;
if buffer != [80, 69, 0, 0] {
return Err(Error::new(ErrorKind::InvalidData, "invalid PE header"));
}
// Find the magic number.
let mut buffer = [0; 2];
file.seek(SeekFrom::Current(20))?;
file.read_exact(&mut buffer)?;
Ok(u16::from_le_bytes(buffer))
}
/// Validates the header for the supplied `libclang` shared library.
fn validate_header(path: &Path) -> Result<(), String> {
if cfg!(any(target_os = "freebsd", target_os = "linux")) {
let class = parse_elf_header(path).map_err(|e| e.to_string())?;
if cfg!(target_pointer_width = "32") && class != 1 {
return Err("invalid ELF class (64-bit)".into());
}
if cfg!(target_pointer_width = "64") && class != 2 {
return Err("invalid ELF class (32-bit)".into());
}
Ok(())
} else if cfg!(target_os = "windows") {
let magic = parse_pe_header(path).map_err(|e| e.to_string())?;
if cfg!(target_pointer_width = "32") && magic != 267 {
return Err("invalid DLL (64-bit)".into());
}
if cfg!(target_pointer_width = "64") && magic != 523 {
return Err("invalid DLL (32-bit)".into());
}
Ok(())
} else {
Ok(())
}
}
/// Returns the components of the version in the supplied `libclang` shared
// library filename.
fn parse_version(filename: &str) -> Vec<u32> {
let version = if filename.starts_with("libclang.so.") {
&filename[12..]
} else if filename.starts_with("libclang-") {
&filename[9..filename.len() - 3]
} else {
return vec![];
};
version.split('.').map(|s| s.parse().unwrap_or(0)).collect()
}
/// Returns the paths to, the filenames, and the versions of the `libclang`
// shared libraries.
fn search_libclang_directories(runtime: bool) -> Result<Vec<(PathBuf, String, Vec<u32>)>, String> {
let mut files = vec![format!(
"{}clang{}",
env::consts::DLL_PREFIX,
env::consts::DLL_SUFFIX
)];
if cfg!(target_os = "linux") {
// Some Linux distributions don't create a `libclang.so` symlink, so we
// need to look for versioned files (e.g., `libclang-3.9.so`).
files.push("libclang-*.so".into());
// Some Linux distributions don't create a `libclang.so` symlink and
// don't have versioned files as described above, so we need to look for
// suffix versioned files (e.g., `libclang.so.1`). However, `ld` cannot
// link to these files, so this will only be included when linking at
// runtime.
if runtime {
files.push("libclang.so.*".into());
}
}
if cfg!(any(
target_os = "openbsd",
target_os = "freebsd",
target_os = "netbsd"
)) {
// Some BSD distributions don't create a `libclang.so` symlink either,
// but use a different naming scheme for versioned files (e.g.,
// `libclang.so.7.0`).
files.push("libclang.so.*".into());
}
if cfg!(target_os = "windows") {
// The official LLVM build uses `libclang.dll` on Windows instead of
// `clang.dll`. However, unofficial builds such as MinGW use `clang.dll`.
files.push("libclang.dll".into());
}
// Validate the `libclang` shared libraries and collect the versions.
let mut valid = vec![];
let mut invalid = vec![];
for (directory, filename) in common::search_libclang_directories(&files, "LIBCLANG_PATH") {
let path = directory.join(&filename);
match validate_header(&path) {
Ok(()) => {
let version = parse_version(&filename);
valid.push((directory, filename, version))
}
Err(message) => invalid.push(format!("({}: {})", path.display(), message)),
}
}
if !valid.is_empty() {
return Ok(valid);
}
let message = format!(
"couldn't find any valid shared libraries matching: [{}], set the \
`LIBCLANG_PATH` environment variable to a path where one of these files \
can be found (invalid: [{}])",
files
.iter()
.map(|f| format!("'{}'", f))
.collect::<Vec<_>>()
.join(", "),
invalid.join(", "),
);
Err(message)
}
/// Returns the directory and filename of the "best" available `libclang` shared
/// library.
pub fn find(runtime: bool) -> Result<(PathBuf, String), String> {
search_libclang_directories(runtime)?
.iter()
.max_by_key(|f| &f.2)
.cloned()
.map(|(path, filename, _)| (path, filename))
.ok_or_else(|| "unreachable".into())
}
/// Find and link to `libclang` dynamically.
#[cfg(not(feature = "runtime"))]
pub fn link() {
use std::fs;
let (directory, filename) = find(false).unwrap();
println!("cargo:rustc-link-search={}", directory.display());
if cfg!(all(target_os = "windows", target_env = "msvc")) {
// Find the `libclang` stub static library required for the MSVC
// toolchain.
let lib = if !directory.ends_with("bin") {
directory.to_owned()
} else {
directory.parent().unwrap().join("lib")
};
if lib.join("libclang.lib").exists() {
println!("cargo:rustc-link-search={}", lib.display());
} else if lib.join("libclang.dll.a").exists() {
// MSYS and MinGW use `libclang.dll.a` instead of `libclang.lib`.
// It is linkable with the MSVC linker, but Rust doesn't recognize
// the `.a` suffix, so we need to copy it with a different name.
//
// FIXME: Maybe we can just hardlink or symlink it?
let out = env::var("OUT_DIR").unwrap();
fs::copy(
lib.join("libclang.dll.a"),
Path::new(&out).join("libclang.lib"),
)
.unwrap();
println!("cargo:rustc-link-search=native={}", out);
} else {
panic!(
"using '{}', so 'libclang.lib' or 'libclang.dll.a' must be \
available in {}",
filename,
lib.display(),
);
}
println!("cargo:rustc-link-lib=dylib=libclang");
} else {
let name = filename.trim_start_matches("lib");
// Strip extensions and trailing version numbers (e.g., the `.so.7.0` in
// `libclang.so.7.0`).
let name = match name.find(".dylib").or(name.find(".so")) {
Some(index) => &name[0..index],
None => &name,
};
println!("cargo:rustc-link-lib=dylib={}", name);
}
}
// Copyright 2018 Kyle Mayes
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
use std::env;
use std::fs::File;
use std::io::{self, Error, ErrorKind, Read, Seek, SeekFrom};
use std::path::{Path, PathBuf};
use super::common;
/// Returns the ELF class from the ELF header in the supplied file.
fn parse_elf_header(path: &Path) -> io::Result<u8> {
let mut file = File::open(path)?;
let mut buffer = [0; 5];
file.read_exact(&mut buffer)?;
if buffer[..4] == [127, 69, 76, 70] {
Ok(buffer[4])
} else {
Err(Error::new(ErrorKind::InvalidData, "invalid ELF header"))
}
}
/// Returns the magic number from the PE header in the supplied file.
fn parse_pe_header(path: &Path) -> io::Result<u16> {
let mut file = File::open(path)?;
// Determine the header offset.
let mut buffer = [0; 4];
let start = SeekFrom::Start(0x3C);
file.seek(start)?;
file.read_exact(&mut buffer)?;
let offset = i32::from_le_bytes(buffer);
// Determine the validity of the header.
file.seek(SeekFrom::Start(offset as u64))?;
file.read_exact(&mut buffer)?;
if buffer != [80, 69, 0, 0] {
return Err(Error::new(ErrorKind::InvalidData, "invalid PE header"));
}
// Find the magic number.
let mut buffer = [0; 2];
file.seek(SeekFrom::Current(20))?;
file.read_exact(&mut buffer)?;
Ok(u16::from_le_bytes(buffer))
}
/// Validates the header for the supplied `libclang` shared library.
fn validate_header(path: &Path) -> Result<(), String> {
if cfg!(any(target_os = "freebsd", target_os = "linux")) {
let class = parse_elf_header(path).map_err(|e| e.to_string())?;
if cfg!(target_pointer_width = "32") && class != 1 {
return Err("invalid ELF class (64-bit)".into());
}
if cfg!(target_pointer_width = "64") && class != 2 {
return Err("invalid ELF class (32-bit)".into());
}
Ok(())
} else if cfg!(target_os = "windows") {
let magic = parse_pe_header(path).map_err(|e| e.to_string())?;
if cfg!(target_pointer_width = "32") && magic != 267 {
return Err("invalid DLL (64-bit)".into());
}
if cfg!(target_pointer_width = "64") && magic != 523 {
return Err("invalid DLL (32-bit)".into());
}
Ok(())
} else {
Ok(())
}
}
/// Returns the components of the version in the supplied `libclang` shared
// library filename.
fn parse_version(filename: &str) -> Vec<u32> {
let version = if filename.starts_with("libclang.so.") {
&filename[12..]
} else if filename.starts_with("libclang-") {
&filename[9..filename.len() - 3]
} else {
return vec![];
};
version.split('.').map(|s| s.parse().unwrap_or(0)).collect()
}
/// Returns the paths to, the filenames, and the versions of the `libclang`
// shared libraries.
fn search_libclang_directories(runtime: bool) -> Result<Vec<(PathBuf, String, Vec<u32>)>, String> {
let mut files = vec![format!(
"{}clang{}",
env::consts::DLL_PREFIX,
env::consts::DLL_SUFFIX
)];
if cfg!(target_os = "linux") {
// Some Linux distributions don't create a `libclang.so` symlink, so we
// need to look for versioned files (e.g., `libclang-3.9.so`).
files.push("libclang-*.so".into());
// Some Linux distributions don't create a `libclang.so` symlink and
// don't have versioned files as described above, so we need to look for
// suffix versioned files (e.g., `libclang.so.1`). However, `ld` cannot
// link to these files, so this will only be included when linking at
// runtime.
if runtime {
files.push("libclang.so.*".into());
files.push("libclang-*.so.*".into());
}
}
if cfg!(any(
target_os = "openbsd",
target_os = "freebsd",
target_os = "netbsd"
)) {
// Some BSD distributions don't create a `libclang.so` symlink either,
// but use a different naming scheme for versioned files (e.g.,
// `libclang.so.7.0`).
files.push("libclang.so.*".into());
}
if cfg!(target_os = "windows") {
// The official LLVM build uses `libclang.dll` on Windows instead of
// `clang.dll`. However, unofficial builds such as MinGW use `clang.dll`.
files.push("libclang.dll".into());
}
// Validate the `libclang` shared libraries and collect the versions.
let mut valid = vec![];
let mut invalid = vec![];
for (directory, filename) in common::search_libclang_directories(&files, "LIBCLANG_PATH") {
let path = directory.join(&filename);
match validate_header(&path) {
Ok(()) => {
let version = parse_version(&filename);
valid.push((directory, filename, version))
}
Err(message) => invalid.push(format!("({}: {})", path.display(), message)),
}
}
if !valid.is_empty() {
return Ok(valid);
}
let message = format!(
"couldn't find any valid shared libraries matching: [{}], set the \
`LIBCLANG_PATH` environment variable to a path where one of these files \
can be found (invalid: [{}])",
files
.iter()
.map(|f| format!("'{}'", f))
.collect::<Vec<_>>()
.join(", "),
invalid.join(", "),
);
Err(message)
}
/// Returns the directory and filename of the "best" available `libclang` shared
/// library.
pub fn find(runtime: bool) -> Result<(PathBuf, String), String> {
search_libclang_directories(runtime)?
.iter()
.max_by_key(|f| &f.2)
.cloned()
.map(|(path, filename, _)| (path, filename))
.ok_or_else(|| "unreachable".into())
}
/// Find and link to `libclang` dynamically.
#[cfg(not(feature = "runtime"))]
pub fn link() {
use std::fs;
let (directory, filename) = find(false).unwrap();
println!("cargo:rustc-link-search={}", directory.display());
if cfg!(all(target_os = "windows", target_env = "msvc")) {
// Find the `libclang` stub static library required for the MSVC
// toolchain.
let lib = if !directory.ends_with("bin") {
directory
} else {
directory.parent().unwrap().join("lib")
};
if lib.join("libclang.lib").exists() {
println!("cargo:rustc-link-search={}", lib.display());
} else if lib.join("libclang.dll.a").exists() {
// MSYS and MinGW use `libclang.dll.a` instead of `libclang.lib`.
// It is linkable with the MSVC linker, but Rust doesn't recognize
// the `.a` suffix, so we need to copy it with a different name.
//
// FIXME: Maybe we can just hardlink or symlink it?
let out = env::var("OUT_DIR").unwrap();
fs::copy(
lib.join("libclang.dll.a"),
Path::new(&out).join("libclang.lib"),
)
.unwrap();
println!("cargo:rustc-link-search=native={}", out);
} else {
panic!(
"using '{}', so 'libclang.lib' or 'libclang.dll.a' must be \
available in {}",
filename,
lib.display(),
);
}
println!("cargo:rustc-link-lib=dylib=libclang");
} else {
let name = filename.trim_start_matches("lib");
// Strip extensions and trailing version numbers (e.g., the `.so.7.0` in
// `libclang.so.7.0`).
let name = match name.find(".dylib").or_else(|| name.find(".so")) {
Some(index) => &name[0..index],
None => &name,
};
println!("cargo:rustc-link-lib=dylib={}", name);
}
}

272
third_party/rust/clang-sys/build/static.rs поставляемый
Просмотреть файл

@ -1,136 +1,136 @@
// Copyright 2018 Kyle Mayes
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
extern crate glob;
use std::path::{Path, PathBuf};
use common;
/// Returns the name of an LLVM or Clang library from a path to such a library.
fn get_library_name(path: &Path) -> Option<String> {
path.file_stem().map(|p| {
let string = p.to_string_lossy();
if string.starts_with("lib") {
string[3..].to_owned()
} else {
string.to_string()
}
})
}
/// Returns the LLVM libraries required to link to `libclang` statically.
fn get_llvm_libraries() -> Vec<String> {
common::run_llvm_config(&["--libs"])
.unwrap()
.split_whitespace()
.filter_map(|p| {
// Depending on the version of `llvm-config` in use, listed
// libraries may be in one of two forms, a full path to the library
// or simply prefixed with `-l`.
if p.starts_with("-l") {
Some(p[2..].into())
} else {
get_library_name(Path::new(p))
}
})
.collect()
}
/// Clang libraries required to link to `libclang` 3.5 and later statically.
const CLANG_LIBRARIES: &[&str] = &[
"clang",
"clangAST",
"clangAnalysis",
"clangBasic",
"clangDriver",
"clangEdit",
"clangFrontend",
"clangIndex",
"clangLex",
"clangParse",
"clangRewrite",
"clangSema",
"clangSerialization",
];
/// Returns the Clang libraries required to link to `libclang` statically.
fn get_clang_libraries<P: AsRef<Path>>(directory: P) -> Vec<String> {
let pattern = directory
.as_ref()
.join("libclang*.a")
.to_string_lossy()
.to_string();
if let Ok(libraries) = glob::glob(&pattern) {
libraries
.filter_map(|l| l.ok().and_then(|l| get_library_name(&l)))
.collect()
} else {
CLANG_LIBRARIES.iter().map(|l| l.to_string()).collect()
}
}
/// Returns a directory containing `libclang` static libraries.
fn find() -> PathBuf {
let name = if cfg!(target_os = "windows") {
"libclang.lib"
} else {
"libclang.a"
};
let files = common::search_libclang_directories(&[name.into()], "LIBCLANG_STATIC_PATH");
if let Some((directory, _)) = files.into_iter().nth(0) {
directory
} else {
panic!("could not find any static libraries");
}
}
/// Find and link to `libclang` statically.
pub fn link() {
let directory = find();
// Specify required Clang static libraries.
println!("cargo:rustc-link-search=native={}", directory.display());
for library in get_clang_libraries(directory) {
println!("cargo:rustc-link-lib=static={}", library);
}
// Determine the shared mode used by LLVM.
let mode = common::run_llvm_config(&["--shared-mode"]).map(|m| m.trim().to_owned());
let prefix = if mode.map_or(false, |m| m == "static") {
"static="
} else {
""
};
// Specify required LLVM static libraries.
println!(
"cargo:rustc-link-search=native={}",
common::run_llvm_config(&["--libdir"]).unwrap().trim_end()
);
for library in get_llvm_libraries() {
println!("cargo:rustc-link-lib={}{}", prefix, library);
}
// Specify required system libraries.
// MSVC doesn't need this, as it tracks dependencies inside `.lib` files.
if cfg!(target_os = "freebsd") {
println!("cargo:rustc-flags=-l ffi -l ncursesw -l c++ -l z");
} else if cfg!(target_os = "linux") {
println!("cargo:rustc-flags=-l ffi -l ncursesw -l stdc++ -l z");
} else if cfg!(target_os = "macos") {
println!("cargo:rustc-flags=-l ffi -l ncurses -l c++ -l z");
}
}
// Copyright 2018 Kyle Mayes
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
extern crate glob;
use std::path::{Path, PathBuf};
use common;
/// Returns the name of an LLVM or Clang library from a path to such a library.
fn get_library_name(path: &Path) -> Option<String> {
path.file_stem().map(|p| {
let string = p.to_string_lossy();
if string.starts_with("lib") {
string[3..].to_owned()
} else {
string.to_string()
}
})
}
/// Returns the LLVM libraries required to link to `libclang` statically.
fn get_llvm_libraries() -> Vec<String> {
common::run_llvm_config(&["--libs"])
.unwrap()
.split_whitespace()
.filter_map(|p| {
// Depending on the version of `llvm-config` in use, listed
// libraries may be in one of two forms, a full path to the library
// or simply prefixed with `-l`.
if p.starts_with("-l") {
Some(p[2..].into())
} else {
get_library_name(Path::new(p))
}
})
.collect()
}
/// Clang libraries required to link to `libclang` 3.5 and later statically.
const CLANG_LIBRARIES: &[&str] = &[
"clang",
"clangAST",
"clangAnalysis",
"clangBasic",
"clangDriver",
"clangEdit",
"clangFrontend",
"clangIndex",
"clangLex",
"clangParse",
"clangRewrite",
"clangSema",
"clangSerialization",
];
/// Returns the Clang libraries required to link to `libclang` statically.
fn get_clang_libraries<P: AsRef<Path>>(directory: P) -> Vec<String> {
let pattern = directory
.as_ref()
.join("libclang*.a")
.to_string_lossy()
.to_string();
if let Ok(libraries) = glob::glob(&pattern) {
libraries
.filter_map(|l| l.ok().and_then(|l| get_library_name(&l)))
.collect()
} else {
CLANG_LIBRARIES.iter().map(|l| (*l).to_string()).collect()
}
}
/// Returns a directory containing `libclang` static libraries.
fn find() -> PathBuf {
let name = if cfg!(target_os = "windows") {
"libclang.lib"
} else {
"libclang.a"
};
let files = common::search_libclang_directories(&[name.into()], "LIBCLANG_STATIC_PATH");
if let Some((directory, _)) = files.into_iter().nth(0) {
directory
} else {
panic!("could not find any static libraries");
}
}
/// Find and link to `libclang` statically.
pub fn link() {
let directory = find();
// Specify required Clang static libraries.
println!("cargo:rustc-link-search=native={}", directory.display());
for library in get_clang_libraries(directory) {
println!("cargo:rustc-link-lib=static={}", library);
}
// Determine the shared mode used by LLVM.
let mode = common::run_llvm_config(&["--shared-mode"]).map(|m| m.trim().to_owned());
let prefix = if mode.map_or(false, |m| m == "static") {
"static="
} else {
""
};
// Specify required LLVM static libraries.
println!(
"cargo:rustc-link-search=native={}",
common::run_llvm_config(&["--libdir"]).unwrap().trim_end()
);
for library in get_llvm_libraries() {
println!("cargo:rustc-link-lib={}{}", prefix, library);
}
// Specify required system libraries.
// MSVC doesn't need this, as it tracks dependencies inside `.lib` files.
if cfg!(target_os = "freebsd") {
println!("cargo:rustc-flags=-l ffi -l ncursesw -l c++ -l z");
} else if cfg!(target_os = "linux") {
println!("cargo:rustc-flags=-l ffi -l ncursesw -l stdc++ -l z");
} else if cfg!(target_os = "macos") {
println!("cargo:rustc-flags=-l ffi -l ncurses -l c++ -l z");
}
}

Просмотреть файл

@ -1,57 +1,57 @@
set -e
pushd ~
# Workaround for Travis CI macOS bug (https://github.com/travis-ci/travis-ci/issues/6307)
if [ "${TRAVIS_OS_NAME}" == "osx" ]; then
rvm get head || true
fi
function llvm_version_triple() {
if [ "$1" == "3.5" ]; then
echo "3.5.2"
elif [ "$1" == "3.6" ]; then
echo "3.6.2"
elif [ "$1" == "3.7" ]; then
echo "3.7.1"
elif [ "$1" == "3.8" ]; then
echo "3.8.1"
elif [ "$1" == "3.9" ]; then
echo "3.9.0"
elif [ "$1" == "4.0" ]; then
echo "4.0.1"
elif [ "$1" == "5.0" ]; then
echo "5.0.2"
elif [ "$1" == "6.0" ]; then
echo "6.0.1"
elif [ "$1" == "7.0" ]; then
echo "7.0.0"
fi
}
function llvm_download() {
export LLVM_VERSION_TRIPLE=`llvm_version_triple ${LLVM_VERSION}`
export LLVM=clang+llvm-${LLVM_VERSION_TRIPLE}-$1
export LLVM_DIRECTORY="$HOME/.llvm/${LLVM}"
if [ -d "${LLVM_DIRECTORY}" ]; then
echo "Using cached LLVM download for ${LLVM}..."
else
wget http://releases.llvm.org/${LLVM_VERSION_TRIPLE}/${LLVM}.tar.xz
mkdir -p "${LLVM_DIRECTORY}"
tar xf ${LLVM}.tar.xz -C "${LLVM_DIRECTORY}" --strip-components=1
fi
export LLVM_CONFIG_PATH="${LLVM_DIRECTORY}/bin/llvm-config"
}
if [ "${TRAVIS_OS_NAME}" == "linux" ]; then
llvm_download x86_64-linux-gnu-ubuntu-14.04
export LD_LIBRARY_PATH="${LLVM_DIRECTORY}/lib":$LD_LIBRARY_PATH
else
llvm_download x86_64-apple-darwin
cp "${LLVM_DIRECTORY}/lib/libclang.dylib" /usr/local/lib/libclang.dylib
export DYLD_LIBRARY_PATH="${LLVM_DIRECTORY}/lib":$DYLD_LIBRARY_PATH
fi
popd
set +e
set -e
pushd ~
# Workaround for Travis CI macOS bug (https://github.com/travis-ci/travis-ci/issues/6307)
if [ "${TRAVIS_OS_NAME}" == "osx" ]; then
rvm get head || true
fi
function llvm_version_triple() {
if [ "$1" == "3.5" ]; then
echo "3.5.2"
elif [ "$1" == "3.6" ]; then
echo "3.6.2"
elif [ "$1" == "3.7" ]; then
echo "3.7.1"
elif [ "$1" == "3.8" ]; then
echo "3.8.1"
elif [ "$1" == "3.9" ]; then
echo "3.9.0"
elif [ "$1" == "4.0" ]; then
echo "4.0.1"
elif [ "$1" == "5.0" ]; then
echo "5.0.2"
elif [ "$1" == "6.0" ]; then
echo "6.0.1"
elif [ "$1" == "7.0" ]; then
echo "7.0.0"
fi
}
function llvm_download() {
export LLVM_VERSION_TRIPLE=`llvm_version_triple ${LLVM_VERSION}`
export LLVM=clang+llvm-${LLVM_VERSION_TRIPLE}-$1
export LLVM_DIRECTORY="$HOME/.llvm/${LLVM}"
if [ -d "${LLVM_DIRECTORY}" ]; then
echo "Using cached LLVM download for ${LLVM}..."
else
wget http://releases.llvm.org/${LLVM_VERSION_TRIPLE}/${LLVM}.tar.xz
mkdir -p "${LLVM_DIRECTORY}"
tar xf ${LLVM}.tar.xz -C "${LLVM_DIRECTORY}" --strip-components=1
fi
export LLVM_CONFIG_PATH="${LLVM_DIRECTORY}/bin/llvm-config"
}
if [ "${TRAVIS_OS_NAME}" == "linux" ]; then
llvm_download x86_64-linux-gnu-ubuntu-14.04
export LD_LIBRARY_PATH="${LLVM_DIRECTORY}/lib":$LD_LIBRARY_PATH
else
llvm_download x86_64-apple-darwin
cp "${LLVM_DIRECTORY}/lib/libclang.dylib" /usr/local/lib/libclang.dylib
export DYLD_LIBRARY_PATH="${LLVM_DIRECTORY}/lib":$DYLD_LIBRARY_PATH
fi
popd
set +e

16
third_party/rust/clang-sys/ci/install.bat поставляемый Executable file → Normal file
Просмотреть файл

@ -1,8 +1,8 @@
curl -sSf https://static.rust-lang.org/dist/rust-1.36.0-i686-pc-windows-msvc.exe -o rust.exe
rust.exe /VERYSILENT /NORESTART /DIR="C:\Rust"
set PATH=%PATH%;C:\Rust\bin
curl -sSf http://releases.llvm.org/%LLVM_VERSION%/LLVM-%LLVM_VERSION%-win32.exe -o LLVM.exe
7z x LLVM.exe -oC:\LLVM
set PATH=%PATH%;C:\LLVM\bin
set LIBCLANG_PATH=C:\LLVM\bin
curl -sSf https://static.rust-lang.org/dist/rust-1.36.0-i686-pc-windows-msvc.exe -o rust.exe
rust.exe /VERYSILENT /NORESTART /DIR="C:\Rust"
set PATH=%PATH%;C:\Rust\bin
curl -sSf http://releases.llvm.org/%LLVM_VERSION%/LLVM-%LLVM_VERSION%-win32.exe -o LLVM.exe
7z x LLVM.exe -oC:\LLVM
set PATH=%PATH%;C:\LLVM\bin
set LIBCLANG_PATH=C:\LLVM\bin

26
third_party/rust/clang-sys/ci/script.sh поставляемый
Просмотреть файл

@ -1,13 +1,13 @@
if [ "${TRAVIS_OS_NAME}" == "osx" ]; then
rvm get head || true
fi
set -e
RUST_BACKTRACE=1 cargo test --verbose --features $CLANG_VERSION -- --nocapture
if [ "${CLANG_VERSION}" \< "clang_3_7" ]; then
RUST_BACKTRACE=1 cargo test --verbose --features "$CLANG_VERSION static" -- --nocapture
fi
RUST_BACKTRACE=1 cargo test --verbose --features "$CLANG_VERSION runtime" -- --nocapture
if [ "${TRAVIS_OS_NAME}" == "osx" ]; then
rvm get head || true
fi
set -e
RUST_BACKTRACE=1 cargo test --verbose --features $CLANG_VERSION -- --nocapture
if [ "${CLANG_VERSION}" \< "clang_3_7" ]; then
RUST_BACKTRACE=1 cargo test --verbose --features "$CLANG_VERSION static" -- --nocapture
fi
RUST_BACKTRACE=1 cargo test --verbose --features "$CLANG_VERSION runtime" -- --nocapture

4
third_party/rust/clang-sys/ci/test_script.bat поставляемый Executable file → Normal file
Просмотреть файл

@ -1,2 +1,2 @@
set RUST_BACKTRACE=1
cargo test --verbose --features %CLANG_VERSION% -- --nocapture
set RUST_BACKTRACE=1
cargo test --verbose --features %CLANG_VERSION% -- --nocapture

2
third_party/rust/clang-sys/clippy.toml поставляемый
Просмотреть файл

@ -1 +1 @@
doc-valid-idents = ["FreeBSD"]
doc-valid-idents = ["FreeBSD"]

4151
third_party/rust/clang-sys/src/lib.rs поставляемый

Разница между файлами не показана из-за своего большого размера Загрузить разницу

396
third_party/rust/clang-sys/src/link.rs поставляемый
Просмотреть файл

@ -1,198 +1,198 @@
// Copyright 2016 Kyle Mayes
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//================================================
// Macros
//================================================
#[cfg(feature = "runtime")]
macro_rules! link {
(@LOAD: #[cfg($cfg:meta)] fn $name:ident($($pname:ident: $pty:ty), *) $(-> $ret:ty)*) => (
#[cfg($cfg)]
pub fn $name(library: &mut super::SharedLibrary) {
let symbol = unsafe { library.library.get(stringify!($name).as_bytes()) }.ok();
library.functions.$name = match symbol {
Some(s) => *s,
None => None,
};
}
#[cfg(not($cfg))]
pub fn $name(_: &mut super::SharedLibrary) {}
);
(@LOAD: fn $name:ident($($pname:ident: $pty:ty), *) $(-> $ret:ty)*) => (
link!(@LOAD: #[cfg(feature="runtime")] fn $name($($pname: $pty), *) $(-> $ret)*);
);
($($(#[cfg($cfg:meta)])* pub fn $name:ident($($pname:ident: $pty:ty), *) $(-> $ret:ty)*;)+) => (
use std::cell::{RefCell};
use std::sync::{Arc};
use std::path::{Path, PathBuf};
/// The set of functions loaded dynamically.
#[derive(Debug, Default)]
pub struct Functions {
$($(#[cfg($cfg)])* pub $name: Option<unsafe extern fn($($pname: $pty), *) $(-> $ret)*>,)+
}
/// A dynamically loaded instance of the `libclang` library.
#[derive(Debug)]
pub struct SharedLibrary {
library: libloading::Library,
path: PathBuf,
pub functions: Functions,
}
impl SharedLibrary {
fn new(library: libloading::Library, path: PathBuf) -> Self {
Self { library, path, functions: Functions::default() }
}
pub fn path(&self) -> &Path {
&self.path
}
}
thread_local!(static LIBRARY: RefCell<Option<Arc<SharedLibrary>>> = RefCell::new(None));
/// Returns whether a `libclang` shared library is loaded on this thread.
pub fn is_loaded() -> bool {
LIBRARY.with(|l| l.borrow().is_some())
}
fn with_library<T, F>(f: F) -> Option<T> where F: FnOnce(&SharedLibrary) -> T {
LIBRARY.with(|l| {
match l.borrow().as_ref() {
Some(library) => Some(f(&library)),
_ => None,
}
})
}
$(
#[cfg_attr(feature="cargo-clippy", allow(too_many_arguments))]
$(#[cfg($cfg)])*
pub unsafe fn $name($($pname: $pty), *) $(-> $ret)* {
let f = with_library(|l| {
match l.functions.$name {
Some(f) => f,
_ => panic!(concat!("function not loaded: ", stringify!($name))),
}
}).expect("a `libclang` shared library is not loaded on this thread");
f($($pname), *)
}
$(#[cfg($cfg)])*
pub mod $name {
pub fn is_loaded() -> bool {
super::with_library(|l| l.functions.$name.is_some()).unwrap_or(false)
}
}
)+
mod load {
$(link!(@LOAD: $(#[cfg($cfg)])* fn $name($($pname: $pty), *) $(-> $ret)*);)+
}
/// Loads a `libclang` shared library and returns the library instance.
///
/// This function does not attempt to load any functions from the shared library. The caller
/// is responsible for loading the functions they require.
///
/// # Failures
///
/// * a `libclang` shared library could not be found
/// * the `libclang` shared library could not be opened
pub fn load_manually() -> Result<SharedLibrary, String> {
mod build {
pub mod common { include!(concat!(env!("OUT_DIR"), "/common.rs")); }
pub mod dynamic { include!(concat!(env!("OUT_DIR"), "/dynamic.rs")); }
}
let (directory, filename) = try!(build::dynamic::find(true));
let path = directory.join(filename);
let library = libloading::Library::new(&path).map_err(|e| {
format!(
"the `libclang` shared library at {} could not be opened: {}",
path.display(),
e,
)
});
let mut library = SharedLibrary::new(try!(library), path);
$(load::$name(&mut library);)+
Ok(library)
}
/// Loads a `libclang` shared library for use in the current thread.
///
/// This functions attempts to load all the functions in the shared library. Whether a
/// function has been loaded can be tested by calling the `is_loaded` function on the
/// module with the same name as the function (e.g., `clang_createIndex::is_loaded()` for
/// the `clang_createIndex` function).
///
/// # Failures
///
/// * a `libclang` shared library could not be found
/// * the `libclang` shared library could not be opened
#[allow(dead_code)]
pub fn load() -> Result<(), String> {
let library = Arc::new(try!(load_manually()));
LIBRARY.with(|l| *l.borrow_mut() = Some(library));
Ok(())
}
/// Unloads the `libclang` shared library in use in the current thread.
///
/// # Failures
///
/// * a `libclang` shared library is not in use in the current thread
pub fn unload() -> Result<(), String> {
let library = set_library(None);
if library.is_some() {
Ok(())
} else {
Err("a `libclang` shared library is not in use in the current thread".into())
}
}
/// Returns the library instance stored in TLS.
///
/// This functions allows for sharing library instances between threads.
pub fn get_library() -> Option<Arc<SharedLibrary>> {
LIBRARY.with(|l| l.borrow_mut().clone())
}
/// Sets the library instance stored in TLS and returns the previous library.
///
/// This functions allows for sharing library instances between threads.
pub fn set_library(library: Option<Arc<SharedLibrary>>) -> Option<Arc<SharedLibrary>> {
LIBRARY.with(|l| mem::replace(&mut *l.borrow_mut(), library))
}
)
}
#[cfg(not(feature = "runtime"))]
macro_rules! link {
($($(#[cfg($cfg:meta)])* pub fn $name:ident($($pname:ident: $pty:ty), *) $(-> $ret:ty)*;)+) => (
extern { $($(#[cfg($cfg)])* pub fn $name($($pname: $pty), *) $(-> $ret)*;)+ }
$($(#[cfg($cfg)])*
pub mod $name {
pub fn is_loaded() -> bool { true }
})+
)
}
// Copyright 2016 Kyle Mayes
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//================================================
// Macros
//================================================
#[cfg(feature = "runtime")]
macro_rules! link {
(@LOAD: #[cfg($cfg:meta)] fn $name:ident($($pname:ident: $pty:ty), *) $(-> $ret:ty)*) => (
#[cfg($cfg)]
pub fn $name(library: &mut super::SharedLibrary) {
let symbol = unsafe { library.library.get(stringify!($name).as_bytes()) }.ok();
library.functions.$name = match symbol {
Some(s) => *s,
None => None,
};
}
#[cfg(not($cfg))]
pub fn $name(_: &mut super::SharedLibrary) {}
);
(@LOAD: fn $name:ident($($pname:ident: $pty:ty), *) $(-> $ret:ty)*) => (
link!(@LOAD: #[cfg(feature="runtime")] fn $name($($pname: $pty), *) $(-> $ret)*);
);
($($(#[cfg($cfg:meta)])* pub fn $name:ident($($pname:ident: $pty:ty), *) $(-> $ret:ty)*;)+) => (
use std::cell::{RefCell};
use std::sync::{Arc};
use std::path::{Path, PathBuf};
/// The set of functions loaded dynamically.
#[derive(Debug, Default)]
pub struct Functions {
$($(#[cfg($cfg)])* pub $name: Option<unsafe extern fn($($pname: $pty), *) $(-> $ret)*>,)+
}
/// A dynamically loaded instance of the `libclang` library.
#[derive(Debug)]
pub struct SharedLibrary {
library: libloading::Library,
path: PathBuf,
pub functions: Functions,
}
impl SharedLibrary {
fn new(library: libloading::Library, path: PathBuf) -> Self {
Self { library, path, functions: Functions::default() }
}
pub fn path(&self) -> &Path {
&self.path
}
}
thread_local!(static LIBRARY: RefCell<Option<Arc<SharedLibrary>>> = RefCell::new(None));
/// Returns whether a `libclang` shared library is loaded on this thread.
pub fn is_loaded() -> bool {
LIBRARY.with(|l| l.borrow().is_some())
}
fn with_library<T, F>(f: F) -> Option<T> where F: FnOnce(&SharedLibrary) -> T {
LIBRARY.with(|l| {
match l.borrow().as_ref() {
Some(library) => Some(f(&library)),
_ => None,
}
})
}
$(
#[cfg_attr(feature="cargo-clippy", allow(too_many_arguments))]
$(#[cfg($cfg)])*
pub unsafe fn $name($($pname: $pty), *) $(-> $ret)* {
let f = with_library(|l| {
match l.functions.$name {
Some(f) => f,
_ => panic!(concat!("function not loaded: ", stringify!($name))),
}
}).expect("a `libclang` shared library is not loaded on this thread");
f($($pname), *)
}
$(#[cfg($cfg)])*
pub mod $name {
pub fn is_loaded() -> bool {
super::with_library(|l| l.functions.$name.is_some()).unwrap_or(false)
}
}
)+
mod load {
$(link!(@LOAD: $(#[cfg($cfg)])* fn $name($($pname: $pty), *) $(-> $ret)*);)+
}
/// Loads a `libclang` shared library and returns the library instance.
///
/// This function does not attempt to load any functions from the shared library. The caller
/// is responsible for loading the functions they require.
///
/// # Failures
///
/// * a `libclang` shared library could not be found
/// * the `libclang` shared library could not be opened
pub fn load_manually() -> Result<SharedLibrary, String> {
mod build {
pub mod common { include!(concat!(env!("OUT_DIR"), "/common.rs")); }
pub mod dynamic { include!(concat!(env!("OUT_DIR"), "/dynamic.rs")); }
}
let (directory, filename) = try!(build::dynamic::find(true));
let path = directory.join(filename);
let library = libloading::Library::new(&path).map_err(|e| {
format!(
"the `libclang` shared library at {} could not be opened: {}",
path.display(),
e,
)
});
let mut library = SharedLibrary::new(try!(library), path);
$(load::$name(&mut library);)+
Ok(library)
}
/// Loads a `libclang` shared library for use in the current thread.
///
/// This functions attempts to load all the functions in the shared library. Whether a
/// function has been loaded can be tested by calling the `is_loaded` function on the
/// module with the same name as the function (e.g., `clang_createIndex::is_loaded()` for
/// the `clang_createIndex` function).
///
/// # Failures
///
/// * a `libclang` shared library could not be found
/// * the `libclang` shared library could not be opened
#[allow(dead_code)]
pub fn load() -> Result<(), String> {
let library = Arc::new(try!(load_manually()));
LIBRARY.with(|l| *l.borrow_mut() = Some(library));
Ok(())
}
/// Unloads the `libclang` shared library in use in the current thread.
///
/// # Failures
///
/// * a `libclang` shared library is not in use in the current thread
pub fn unload() -> Result<(), String> {
let library = set_library(None);
if library.is_some() {
Ok(())
} else {
Err("a `libclang` shared library is not in use in the current thread".into())
}
}
/// Returns the library instance stored in TLS.
///
/// This functions allows for sharing library instances between threads.
pub fn get_library() -> Option<Arc<SharedLibrary>> {
LIBRARY.with(|l| l.borrow_mut().clone())
}
/// Sets the library instance stored in TLS and returns the previous library.
///
/// This functions allows for sharing library instances between threads.
pub fn set_library(library: Option<Arc<SharedLibrary>>) -> Option<Arc<SharedLibrary>> {
LIBRARY.with(|l| mem::replace(&mut *l.borrow_mut(), library))
}
)
}
#[cfg(not(feature = "runtime"))]
macro_rules! link {
($($(#[cfg($cfg:meta)])* pub fn $name:ident($($pname:ident: $pty:ty), *) $(-> $ret:ty)*;)+) => (
extern { $($(#[cfg($cfg)])* pub fn $name($($pname: $pty), *) $(-> $ret)*;)+ }
$($(#[cfg($cfg)])*
pub mod $name {
pub fn is_loaded() -> bool { true }
})+
)
}

420
third_party/rust/clang-sys/src/support.rs поставляемый
Просмотреть файл

@ -1,210 +1,210 @@
// Copyright 2016 Kyle Mayes
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//! Provides helper functionality.
use std::path::{Path, PathBuf};
use std::process::Command;
use std::{env, io};
use glob;
use libc::c_int;
use super::CXVersion;
//================================================
// Macros
//================================================
macro_rules! try_opt {
($option:expr) => {{
match $option {
Some(some) => some,
None => return None,
}
}};
}
//================================================
// Structs
//================================================
/// A `clang` executable.
#[derive(Clone, Debug)]
pub struct Clang {
/// The path to this `clang` executable.
pub path: PathBuf,
/// The version of this `clang` executable if it could be parsed.
pub version: Option<CXVersion>,
/// The directories searched by this `clang` executable for C headers if
/// they could be parsed.
pub c_search_paths: Option<Vec<PathBuf>>,
/// The directories searched by this `clang` executable for C++ headers if
/// they could be parsed.
pub cpp_search_paths: Option<Vec<PathBuf>>,
}
impl Clang {
fn new(path: impl AsRef<Path>, args: &[String]) -> Self {
Self {
path: path.as_ref().into(),
version: parse_version(path.as_ref()),
c_search_paths: parse_search_paths(path.as_ref(), "c", args),
cpp_search_paths: parse_search_paths(path.as_ref(), "c++", args),
}
}
/// Returns a `clang` executable if one can be found.
///
/// If the `CLANG_PATH` environment variable is set, that is the instance of
/// `clang` used. Otherwise, a series of directories are searched. First, if
/// a path is supplied, that is the first directory searched. Then, the
/// directory returned by `llvm-config --bindir` is searched. On macOS
/// systems, `xcodebuild -find clang` will next be queried. Last, the
/// directories in the system's `PATH` are searched.
pub fn find(path: Option<&Path>, args: &[String]) -> Option<Clang> {
if let Ok(path) = env::var("CLANG_PATH") {
return Some(Clang::new(path, args));
}
let mut paths = vec![];
if let Some(path) = path {
paths.push(path.into());
}
if let Ok(path) = run_llvm_config(&["--bindir"]) {
paths.push(path.into());
}
if cfg!(target_os = "macos") {
if let Ok((path, _)) = run("xcodebuild", &["-find", "clang"]) {
paths.push(path.into());
}
}
paths.extend(env::split_paths(&env::var("PATH").unwrap()));
let default = format!("clang{}", env::consts::EXE_SUFFIX);
let versioned = format!("clang-[0-9]*{}", env::consts::EXE_SUFFIX);
let patterns = &[&default[..], &versioned[..]];
for path in paths {
if let Some(path) = find(&path, patterns) {
return Some(Clang::new(path, args));
}
}
None
}
}
//================================================
// Functions
//================================================
/// Returns the first match to the supplied glob patterns in the supplied
/// directory if there are any matches.
fn find(directory: &Path, patterns: &[&str]) -> Option<PathBuf> {
for pattern in patterns {
let pattern = directory.join(pattern).to_string_lossy().into_owned();
if let Some(path) = try_opt!(glob::glob(&pattern).ok())
.filter_map(|p| p.ok())
.next()
{
if path.is_file() && is_executable(&path).unwrap_or(false) {
return Some(path);
}
}
}
None
}
#[cfg(unix)]
fn is_executable(path: &Path) -> io::Result<bool> {
use std::ffi::CString;
use std::os::unix::ffi::OsStrExt;
let path = CString::new(path.as_os_str().as_bytes())?;
unsafe { Ok(libc::access(path.as_ptr(), libc::X_OK) == 0) }
}
#[cfg(not(unix))]
fn is_executable(_: &Path) -> io::Result<bool> {
Ok(true)
}
/// Attempts to run an executable, returning the `stdout` and `stderr` output if
/// successful.
fn run(executable: &str, arguments: &[&str]) -> Result<(String, String), String> {
Command::new(executable)
.args(arguments)
.output()
.map(|o| {
let stdout = String::from_utf8_lossy(&o.stdout).into_owned();
let stderr = String::from_utf8_lossy(&o.stderr).into_owned();
(stdout, stderr)
})
.map_err(|e| format!("could not run executable `{}`: {}", executable, e))
}
/// Runs `clang`, returning the `stdout` and `stderr` output.
fn run_clang(path: &Path, arguments: &[&str]) -> (String, String) {
run(&path.to_string_lossy().into_owned(), arguments).unwrap()
}
/// Runs `llvm-config`, returning the `stdout` output if successful.
fn run_llvm_config(arguments: &[&str]) -> Result<String, String> {
let config = env::var("LLVM_CONFIG_PATH").unwrap_or_else(|_| "llvm-config".to_string());
run(&config, arguments).map(|(o, _)| o)
}
/// Parses a version number if possible, ignoring trailing non-digit characters.
fn parse_version_number(number: &str) -> Option<c_int> {
number
.chars()
.take_while(|c| c.is_digit(10))
.collect::<String>()
.parse()
.ok()
}
/// Parses the version from the output of a `clang` executable if possible.
fn parse_version(path: &Path) -> Option<CXVersion> {
let output = run_clang(path, &["--version"]).0;
let start = try_opt!(output.find("version ")) + 8;
let mut numbers = try_opt!(output[start..].split_whitespace().nth(0)).split('.');
let major = try_opt!(numbers.next().and_then(parse_version_number));
let minor = try_opt!(numbers.next().and_then(parse_version_number));
let subminor = numbers.next().and_then(parse_version_number).unwrap_or(0);
Some(CXVersion {
Major: major,
Minor: minor,
Subminor: subminor,
})
}
/// Parses the search paths from the output of a `clang` executable if possible.
fn parse_search_paths(path: &Path, language: &str, args: &[String]) -> Option<Vec<PathBuf>> {
let mut clang_args = vec!["-E", "-x", language, "-", "-v"];
clang_args.extend(args.iter().map(|s| &**s));
let output = run_clang(path, &clang_args).1;
let start = try_opt!(output.find("#include <...> search starts here:")) + 34;
let end = try_opt!(output.find("End of search list."));
let paths = output[start..end].replace("(framework directory)", "");
Some(
paths
.lines()
.filter(|l| !l.is_empty())
.map(|l| Path::new(l.trim()).into())
.collect(),
)
}
// Copyright 2016 Kyle Mayes
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//! Provides helper functionality.
use std::path::{Path, PathBuf};
use std::process::Command;
use std::{env, io};
use glob;
use libc::c_int;
use super::CXVersion;
//================================================
// Macros
//================================================
macro_rules! try_opt {
($option:expr) => {{
match $option {
Some(some) => some,
None => return None,
}
}};
}
//================================================
// Structs
//================================================
/// A `clang` executable.
#[derive(Clone, Debug)]
pub struct Clang {
/// The path to this `clang` executable.
pub path: PathBuf,
/// The version of this `clang` executable if it could be parsed.
pub version: Option<CXVersion>,
/// The directories searched by this `clang` executable for C headers if
/// they could be parsed.
pub c_search_paths: Option<Vec<PathBuf>>,
/// The directories searched by this `clang` executable for C++ headers if
/// they could be parsed.
pub cpp_search_paths: Option<Vec<PathBuf>>,
}
impl Clang {
fn new(path: impl AsRef<Path>, args: &[String]) -> Self {
Self {
path: path.as_ref().into(),
version: parse_version(path.as_ref()),
c_search_paths: parse_search_paths(path.as_ref(), "c", args),
cpp_search_paths: parse_search_paths(path.as_ref(), "c++", args),
}
}
/// Returns a `clang` executable if one can be found.
///
/// If the `CLANG_PATH` environment variable is set, that is the instance of
/// `clang` used. Otherwise, a series of directories are searched. First, if
/// a path is supplied, that is the first directory searched. Then, the
/// directory returned by `llvm-config --bindir` is searched. On macOS
/// systems, `xcodebuild -find clang` will next be queried. Last, the
/// directories in the system's `PATH` are searched.
pub fn find(path: Option<&Path>, args: &[String]) -> Option<Clang> {
if let Ok(path) = env::var("CLANG_PATH") {
return Some(Clang::new(path, args));
}
let mut paths = vec![];
if let Some(path) = path {
paths.push(path.into());
}
if let Ok(path) = run_llvm_config(&["--bindir"]) {
paths.push(path.into());
}
if cfg!(target_os = "macos") {
if let Ok((path, _)) = run("xcodebuild", &["-find", "clang"]) {
paths.push(path.into());
}
}
paths.extend(env::split_paths(&env::var("PATH").unwrap()));
let default = format!("clang{}", env::consts::EXE_SUFFIX);
let versioned = format!("clang-[0-9]*{}", env::consts::EXE_SUFFIX);
let patterns = &[&default[..], &versioned[..]];
for path in paths {
if let Some(path) = find(&path, patterns) {
return Some(Clang::new(path, args));
}
}
None
}
}
//================================================
// Functions
//================================================
/// Returns the first match to the supplied glob patterns in the supplied
/// directory if there are any matches.
fn find(directory: &Path, patterns: &[&str]) -> Option<PathBuf> {
for pattern in patterns {
let pattern = directory.join(pattern).to_string_lossy().into_owned();
if let Some(path) = try_opt!(glob::glob(&pattern).ok())
.filter_map(|p| p.ok())
.next()
{
if path.is_file() && is_executable(&path).unwrap_or(false) {
return Some(path);
}
}
}
None
}
#[cfg(unix)]
fn is_executable(path: &Path) -> io::Result<bool> {
use std::ffi::CString;
use std::os::unix::ffi::OsStrExt;
let path = CString::new(path.as_os_str().as_bytes())?;
unsafe { Ok(libc::access(path.as_ptr(), libc::X_OK) == 0) }
}
#[cfg(not(unix))]
fn is_executable(_: &Path) -> io::Result<bool> {
Ok(true)
}
/// Attempts to run an executable, returning the `stdout` and `stderr` output if
/// successful.
fn run(executable: &str, arguments: &[&str]) -> Result<(String, String), String> {
Command::new(executable)
.args(arguments)
.output()
.map(|o| {
let stdout = String::from_utf8_lossy(&o.stdout).into_owned();
let stderr = String::from_utf8_lossy(&o.stderr).into_owned();
(stdout, stderr)
})
.map_err(|e| format!("could not run executable `{}`: {}", executable, e))
}
/// Runs `clang`, returning the `stdout` and `stderr` output.
fn run_clang(path: &Path, arguments: &[&str]) -> (String, String) {
run(&path.to_string_lossy().into_owned(), arguments).unwrap()
}
/// Runs `llvm-config`, returning the `stdout` output if successful.
fn run_llvm_config(arguments: &[&str]) -> Result<String, String> {
let config = env::var("LLVM_CONFIG_PATH").unwrap_or_else(|_| "llvm-config".to_string());
run(&config, arguments).map(|(o, _)| o)
}
/// Parses a version number if possible, ignoring trailing non-digit characters.
fn parse_version_number(number: &str) -> Option<c_int> {
number
.chars()
.take_while(|c| c.is_digit(10))
.collect::<String>()
.parse()
.ok()
}
/// Parses the version from the output of a `clang` executable if possible.
fn parse_version(path: &Path) -> Option<CXVersion> {
let output = run_clang(path, &["--version"]).0;
let start = try_opt!(output.find("version ")) + 8;
let mut numbers = try_opt!(output[start..].split_whitespace().nth(0)).split('.');
let major = try_opt!(numbers.next().and_then(parse_version_number));
let minor = try_opt!(numbers.next().and_then(parse_version_number));
let subminor = numbers.next().and_then(parse_version_number).unwrap_or(0);
Some(CXVersion {
Major: major,
Minor: minor,
Subminor: subminor,
})
}
/// Parses the search paths from the output of a `clang` executable if possible.
fn parse_search_paths(path: &Path, language: &str, args: &[String]) -> Option<Vec<PathBuf>> {
let mut clang_args = vec!["-E", "-x", language, "-", "-v"];
clang_args.extend(args.iter().map(|s| &**s));
let output = run_clang(path, &clang_args).1;
let start = try_opt!(output.find("#include <...> search starts here:")) + 34;
let end = try_opt!(output.find("End of search list."));
let paths = output[start..end].replace("(framework directory)", "");
Some(
paths
.lines()
.filter(|l| !l.is_empty())
.map(|l| Path::new(l.trim()).into())
.collect(),
)
}

12
third_party/rust/clang-sys/tests/header.h поставляемый
Просмотреть файл

@ -1,6 +1,6 @@
#ifndef HEADER_H_
#define HEADER_H_
int add(int a, int b);
#endif
#ifndef HEADER_H_
#define HEADER_H_
int add(int a, int b);
#endif

92
third_party/rust/clang-sys/tests/lib.rs поставляемый
Просмотреть файл

@ -1,46 +1,46 @@
extern crate clang_sys;
extern crate libc;
use std::ptr;
use clang_sys::*;
use libc::c_char;
fn parse() {
unsafe {
let index = clang_createIndex(0, 0);
assert!(!index.is_null());
let tu = clang_parseTranslationUnit(
index,
"tests/header.h\0".as_ptr() as *const c_char,
ptr::null_mut(),
0,
ptr::null_mut(),
0,
0,
);
assert!(!tu.is_null());
}
}
#[cfg(feature = "runtime")]
#[test]
fn test() {
load().unwrap();
parse();
unload().unwrap();
}
#[cfg(not(feature = "runtime"))]
#[test]
fn test() {
parse();
}
#[test]
fn test_support() {
let clang = support::Clang::find(None, &[]).unwrap();
println!("{:?}", clang);
}
extern crate clang_sys;
extern crate libc;
use std::ptr;
use clang_sys::*;
use libc::c_char;
fn parse() {
unsafe {
let index = clang_createIndex(0, 0);
assert!(!index.is_null());
let tu = clang_parseTranslationUnit(
index,
"tests/header.h\0".as_ptr() as *const c_char,
ptr::null_mut(),
0,
ptr::null_mut(),
0,
0,
);
assert!(!tu.is_null());
}
}
#[cfg(feature = "runtime")]
#[test]
fn test() {
load().unwrap();
parse();
unload().unwrap();
}
#[cfg(not(feature = "runtime"))]
#[test]
fn test() {
parse();
}
#[test]
fn test_support() {
let clang = support::Clang::find(None, &[]).unwrap();
println!("{:?}", clang);
}

Просмотреть файл

@ -1 +1 @@
{"files":{"Cargo.toml":"249473baf82e224de8b2a97b66d837d56efe1e3060813727b4be9e88a0a6a04c","LICENSE":"7576269ea71f767b99297934c0b2367532690f8c4badc695edf8e04ab6a1e545","README.md":"4712c7a0f626e72a87440871f4ae136d9b35c04a361c679139ad5da1dd32f534","build.rs":"2d59eb3d84e95733e004ce4de00a3db01b461518626128bcbad3d59c1c348a04","src/lib.rs":"22c9dbbb1dc38d6f77b9362e806a7ee59a8ca1aa9b2c9344d1a487a91287ed59"},"package":"7e8f5954c1c7ccb55340443e8b29fca24013545a5e7d72c1ca7db4fc02b982ce"}
{"files":{"Cargo.toml":"dc71730e83b7c4b4a7ac70614a707a48dcd1770934eb6f015854e23c6ddb30a6","LICENSE":"7576269ea71f767b99297934c0b2367532690f8c4badc695edf8e04ab6a1e545","README.md":"4712c7a0f626e72a87440871f4ae136d9b35c04a361c679139ad5da1dd32f534","build.rs":"04598eda39f81259d2dcb1a829be678b33ac9a5472b9a15ffc863ea2a6581735","src/lib.rs":"22c9dbbb1dc38d6f77b9362e806a7ee59a8ca1aa9b2c9344d1a487a91287ed59"},"package":"e81f1c165c33ffab90a03077ac3b03462b34d5947145dfa48102e063d581502c"}

5
third_party/rust/coreaudio-sys/Cargo.toml поставляемый
Просмотреть файл

@ -12,7 +12,7 @@
[package]
name = "coreaudio-sys"
version = "0.2.3"
version = "0.2.4"
authors = ["Mitchell Nordine <mitchell.nordine@gmail.com>"]
build = "build.rs"
description = "Bindings for Apple's CoreAudio frameworks generated via rust-bindgen"
@ -22,7 +22,8 @@ keywords = ["core", "audio", "unit", "osx", "ios"]
license = "MIT"
repository = "https://github.com/RustAudio/coreaudio-sys.git"
[build-dependencies.bindgen]
version = "0.51"
version = "0.53"
features = ["runtime"]
default-features = false
[features]

2
third_party/rust/coreaudio-sys/build.rs поставляемый
Просмотреть файл

@ -79,6 +79,8 @@ fn build(sdk_path: Option<&str>, target: &str) {
// Begin building the bindgen params.
let mut builder = bindgen::Builder::default();
builder = builder.size_t_is_usize(true);
builder = builder.clang_args(&[&format!("--target={}", target)]);
if let Some(sdk_path) = sdk_path {

Просмотреть файл

@ -1 +1 @@
{"files":{"CODE_OF_CONDUCT.md":"62f073941a34756006851cef8d5d081f6332a986063e87deafeb621f3f6ff554","Cargo.toml":"5b63e110cc58510911b48f6ccfc5748d56d1b88bb9eefc1fb1806fa14213b030","README.md":"88550411d0440cc5931cff6e4265ec676291b2b18989f4fb5779c493e40392ae","UNLICENSE":"7e12e5df4bae12cb21581ba157ced20e1986a0508dd10d0e8a4ab9a4cf94e85c","examples/main.rs":"734a87846b61d09d2aaca444c69dc61765f66df34602f3a4acf1255f95404226","src/data.rs":"677b52a636deb1f0ffc623dbdc5ed7acd78d915117825ced7031c6fa6f0c861e","src/lib.rs":"b485b0fcc73deaad31c9b6e5762dd2d325ecebca100a127432596afeb9058d0e","src/parser.rs":"4d6fedcdc976e9d305e737ef23c643af3754cb3bb3e36ad3330fd8eee4923d69","src/result.rs":"4088fc879652c115a13d8a6e6a71fab8571a7982e740af6a91115f3a82aef236"},"package":"0d009f166c0d9e9f9909dc751630b3a6411ab7f85a153d32d01deb364ffe52a7"}
{"files":{"CODE_OF_CONDUCT.md":"62f073941a34756006851cef8d5d081f6332a986063e87deafeb621f3f6ff554","Cargo.lock":"bc2219b06850f8a2660bfd2f8af2c30ec5893f51d9e067f4489fc342f42754ee","Cargo.toml":"1c0d31cba751ef65905017ac764bfb82682125d9fc08d39f9976301c4c365bd4","README.md":"88550411d0440cc5931cff6e4265ec676291b2b18989f4fb5779c493e40392ae","UNLICENSE":"7e12e5df4bae12cb21581ba157ced20e1986a0508dd10d0e8a4ab9a4cf94e85c","examples/main.rs":"734a87846b61d09d2aaca444c69dc61765f66df34602f3a4acf1255f95404226","src/data.rs":"677b52a636deb1f0ffc623dbdc5ed7acd78d915117825ced7031c6fa6f0c861e","src/lib.rs":"41f7a2a7170f238ce368e0b1c540f77afadf911cd141d3652302355babf7eefc","src/parser.rs":"b32cc1a50c598cdb810914792de8aa4bf52a28002e8f4df578a271bab8e02bc2","src/result.rs":"4088fc879652c115a13d8a6e6a71fab8571a7982e740af6a91115f3a82aef236"},"package":"1945ccb7caedabdfb9347766ead740fb1e0582b7425598325f546adbd832cce1"}

37
third_party/rust/devd-rs/Cargo.lock сгенерированный поставляемый Normal file
Просмотреть файл

@ -0,0 +1,37 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
[[package]]
name = "devd-rs"
version = "0.3.1"
dependencies = [
"libc",
"nom",
]
[[package]]
name = "libc"
version = "0.2.66"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d515b1f41455adea1313a4a2ac8a8a477634fbae63cc6100e3aebb207ce61558"
[[package]]
name = "memchr"
version = "2.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "53445de381a1f436797497c61d851644d0e8e88e6140f22872ad33a704933978"
[[package]]
name = "nom"
version = "5.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c433f4d505fe6ce7ff78523d2fa13a0b9f2690e181fc26168bcbe5ccc5d14e07"
dependencies = [
"memchr",
"version_check",
]
[[package]]
name = "version_check"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd"

8
third_party/rust/devd-rs/Cargo.toml поставляемый
Просмотреть файл

@ -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 = "devd-rs"
version = "0.3.0"
version = "0.3.1"
authors = ["Greg V <greg@unrelenting.technology>"]
description = "An interface to devd, the device hotplug daemon on FreeBSD and DragonFlyBSD"
homepage = "https://github.com/myfreeweb/devd-rs"
@ -25,4 +25,6 @@ repository = "https://github.com/myfreeweb/devd-rs"
version = "0"
[dependencies.nom]
version = "4"
version = "5"
features = ["std"]
default-features = false

33
third_party/rust/devd-rs/src/lib.rs поставляемый
Просмотреть файл

@ -2,28 +2,23 @@ extern crate libc;
#[macro_use]
extern crate nom;
pub mod result;
pub mod data;
pub mod parser;
pub mod result;
use libc::{
c_int, nfds_t,
poll, pollfd, POLLIN,
socket, connect, sockaddr_un, AF_UNIX, SOCK_SEQPACKET
};
use io::{BufRead, BufReader};
use libc::{c_int, connect, nfds_t, poll, pollfd, sockaddr_un, socket, AF_UNIX, POLLIN, SOCK_SEQPACKET};
use std::os::unix::io::{FromRawFd, RawFd};
use std::os::unix::net::UnixStream;
use std::{io, mem, ptr};
use io::{BufRead, BufReader};
pub use result::*;
pub use data::*;
use nom::types::CompleteStr;
pub use result::*;
const SOCKET_PATH: &'static str = "/var/run/devd.seqpacket.pipe";
pub fn parse_devd_event(e: String) -> Result<Event> {
match parser::event(CompleteStr(e.as_str())) {
match parser::event(e.as_str()) {
Ok((_, x)) => Ok(x),
_ => Err(Error::Parse),
}
@ -42,18 +37,9 @@ impl Context {
if sockfd < 0 {
return Err(io::Error::last_os_error().into());
}
let mut sockaddr = sockaddr_un {
sun_family: AF_UNIX as _,
.. mem::zeroed()
};
ptr::copy_nonoverlapping(
SOCKET_PATH.as_ptr(),
sockaddr.sun_path.as_mut_ptr() as *mut u8,
SOCKET_PATH.len());
if connect(
sockfd,
&sockaddr as *const sockaddr_un as *const _,
(mem::size_of_val(&AF_UNIX) + SOCKET_PATH.len()) as _) < 0 {
let mut sockaddr = sockaddr_un { sun_family: AF_UNIX as _, ..mem::zeroed() };
ptr::copy_nonoverlapping(SOCKET_PATH.as_ptr(), sockaddr.sun_path.as_mut_ptr() as *mut u8, SOCKET_PATH.len());
if connect(sockfd, &sockaddr as *const sockaddr_un as *const _, (mem::size_of_val(&AF_UNIX) + SOCKET_PATH.len()) as _) < 0 {
return Err(io::Error::last_os_error().into());
}
Ok(Context {
@ -80,8 +66,7 @@ impl Context {
/// Waits for an event using poll(), reads and parses it
pub fn wait_for_event<'a>(&mut self, timeout_ms: usize) -> Result<Event> {
self.wait_for_event_raw(timeout_ms)
.and_then(parse_devd_event)
self.wait_for_event_raw(timeout_ms).and_then(parse_devd_event)
}
/// Returns the devd socket file descriptor in case you want to select/poll on it together with

75
third_party/rust/devd-rs/src/parser.rs поставляемый
Просмотреть файл

@ -1,83 +1,80 @@
use nom::{alphanumeric, multispace};
use nom::types::CompleteStr;
use data::*;
use nom::branch::alt;
use nom::bytes::complete::take_while;
use nom::character::complete::{alphanumeric1, char, multispace1};
use nom::sequence::delimited;
named!(
val<CompleteStr, CompleteStr>,
alt!(
delimited!(char!('"'), take_while!(call!(|c| c != '"')), char!('"'))
|
take_while!(call!(|c| c != '\n' && c != ' '))
)
);
fn val(i: &str) -> nom::IResult<&str, &str> {
alt((delimited(char('"'), take_while(|c| c != '"'), char('"')), take_while(|c| c != '\n' && c != ' ')))(i)
}
named!(keyval <CompleteStr, (CompleteStr, CompleteStr)>,
named!(keyval <&str, (&str, &str)>,
do_parse!(
key: alphanumeric
key: alphanumeric1
>> char!('=')
>> val: val
>> (key, val)
)
);
named!(keyvals <CompleteStr, BTreeMap<String, String> >,
named!(keyvals <&str, BTreeMap<String, String> >,
map!(
many0!(terminated!(keyval, opt!(multispace))),
many0!(terminated!(keyval, opt!(multispace1))),
|vec: Vec<_>| vec.into_iter().map(|(k, v)| (k.to_string(), v.to_string())).collect()
)
);
named!(pub event <CompleteStr, Event>,
named!(pub event <&str, Event>,
alt!(
do_parse!(
tag!("!") >>
tag!("system=") >>
sys: val >>
multispace >>
multispace1 >>
tag!("subsystem=") >>
subsys: val >>
multispace >>
multispace1 >>
tag!("type=") >>
kind: val >>
multispace >>
multispace1 >>
data: keyvals >>
(Event::Notify { system: sys.to_string(), subsystem: subsys.to_string(), kind: kind.to_string(), data: data })
)
|
do_parse!(
tag!("+") >>
dev: alphanumeric >>
multispace >>
dev: alphanumeric1 >>
multispace1 >>
tag!("at") >>
multispace >>
multispace1 >>
parent: keyvals >>
tag!("on") >>
multispace >>
multispace1 >>
loc: val >>
(Event::Attach { dev: dev.to_string(), parent: parent, location: loc.to_string() })
)
|
do_parse!(
tag!("-") >>
dev: alphanumeric >>
multispace >>
dev: alphanumeric1 >>
multispace1 >>
tag!("at") >>
multispace >>
multispace1 >>
parent: keyvals >>
tag!("on") >>
multispace >>
multispace1 >>
loc: val >>
(Event::Detach { dev: dev.to_string(), parent: parent, location: loc.to_string() })
)
|
do_parse!(
tag!("?") >>
multispace >>
multispace1 >>
tag!("at") >>
multispace >>
multispace1 >>
parent: keyvals >>
tag!("on") >>
multispace >>
multispace1 >>
loc: val >>
(Event::Nomatch { parent: parent, location: loc.to_string() })
)
@ -91,7 +88,7 @@ mod tests {
#[test]
fn test_notify() {
let txt = "!system=USB subsystem=INTERFACE type=ATTACH ugen=ugen0.2 vendor=0x1050 sernum=\"\" mode=host\n";
let res = event(CompleteStr(txt));
let res = event(txt);
let mut data = BTreeMap::new();
data.insert("ugen".to_owned(), "ugen0.2".to_owned());
data.insert("vendor".to_owned(), "0x1050".to_owned());
@ -100,7 +97,7 @@ mod tests {
assert_eq!(
res,
Ok((
CompleteStr(""),
"",
Event::Notify {
system: "USB".to_owned(),
subsystem: "INTERFACE".to_owned(),
@ -114,14 +111,14 @@ mod tests {
#[test]
fn test_attach() {
let txt = "+uhid1 at bus=0 sernum=\"\" on uhub1";
let res = event(CompleteStr(txt));
let res = event(txt);
let mut data = BTreeMap::new();
data.insert("bus".to_owned(), "0".to_owned());
data.insert("sernum".to_owned(), "".to_owned());
assert_eq!(
res,
Ok((
CompleteStr(""),
"",
Event::Attach {
dev: "uhid1".to_owned(),
parent: data,
@ -134,12 +131,12 @@ mod tests {
#[test]
fn test_detach() {
let txt = "-uhid1 at on uhub1";
let res = event(CompleteStr(txt));
let res = event(txt);
let data = BTreeMap::new();
assert_eq!(
res,
Ok((
CompleteStr(""),
"",
Event::Detach {
dev: "uhid1".to_owned(),
parent: data.to_owned(),
@ -152,14 +149,10 @@ mod tests {
#[test]
fn test_nomatch() {
let txt = "? at bus=0 on uhub1";
let res = event(CompleteStr(txt));
let res = event(txt);
let mut data = BTreeMap::new();
data.insert("bus".to_owned(), "0".to_owned());
assert_eq!(
res,
Ok((CompleteStr(""), Event::Nomatch { parent: data, location: "uhub1".to_owned() }))
)
assert_eq!(res, Ok(("", Event::Nomatch { parent: data, location: "uhub1".to_owned() })))
}
}

Просмотреть файл

@ -1 +1 @@
{"files":{"Cargo.toml":"61c7799174c7f869ab05be4ef4fe139196b4b5dd0d11202284a70ca3777f3ce6","bindgen.rs":"bf1f032951cac23a18bd41063df739503bf040bf7c815e1e393238c86edbbb25","build.rs":"47042b2d98af39f06406ebdd2020ad15c01165195aef6a3bda30e09d8411834a","lmdb/libraries/liblmdb/CHANGES":"ba14b94dda8670db454275d2f5fb83510f810ccb3ccfca642176a0efef245e08","lmdb/libraries/liblmdb/COPYRIGHT":"fae797823b892c4b59913256b4d10b17d71f57d4bc45e46d901b84fd6dfc3d13","lmdb/libraries/liblmdb/Doxyfile":"5545f6b049040ce58e6d1a603eaea6b7fb8ae92459f2ab8d3bcbacabcce1014d","lmdb/libraries/liblmdb/LICENSE":"310fe25c858a9515fc8c8d7d1f24a67c9496f84a91e0a0e41ea9975b1371e569","lmdb/libraries/liblmdb/Makefile":"60b5f574e6642602f692a95956da61c588a265ad50b8059960c230b9e6aaf4fd","lmdb/libraries/liblmdb/intro.doc":"9442e0db4fc9c70f058c43545e710476d8d5a80b959d20f4381240fd50c6b843","lmdb/libraries/liblmdb/lmdb.h":"05abf244b621b2d14e838b0643e72d5075ce77d8df856b6dccde74ee51c9cf22","lmdb/libraries/liblmdb/mdb.c":"5c7a4e9269e1af7ddb8f10b07f5d2b7f0d111dd379826d5e4880f6101bff4efc","lmdb/libraries/liblmdb/mdb_copy.1":"3a6a8a7a91e1bd42dc4d2a0188ff62d699ff2b3b097a670f30681decf63f22f3","lmdb/libraries/liblmdb/mdb_copy.c":"d3d412a770a5c3afeb88c44b4acdde0f0b985cde22497198e8f38296281cdddd","lmdb/libraries/liblmdb/mdb_dump.1":"9257be883c7fcfcbd61003cc730f7c0900fa8f6feba074c8c1e46634a257b13a","lmdb/libraries/liblmdb/mdb_dump.c":"b046cffcd997254e6daea47a2d7fb74f9d23282174cbb1e3bf9f5fb51a90fe64","lmdb/libraries/liblmdb/mdb_load.1":"ea927473245a4a7777ba687aa26baf7f0951fb620daf82b8d730a090185b2bbc","lmdb/libraries/liblmdb/mdb_load.c":"4f722613c65350315db23060be98584fb572978108885dab271101ba7187dca4","lmdb/libraries/liblmdb/mdb_stat.1":"c0a70d96b4b2d32e73301383d9d5620bc0bbbefb019bfd54f32088dfd4bc921a","lmdb/libraries/liblmdb/mdb_stat.c":"e6405fa191d784ecfa8eb8d1f153a58facc49a8f5a2c891a93802e67acc4861e","lmdb/libraries/liblmdb/midl.c":"e19143db51dd606396c7eba765832e4b66167c0975614e576b950349f8f6cdfd","lmdb/libraries/liblmdb/midl.h":"52066a085aa0fc90799113fb1cc60ca78a5e35ca6191f5f5cb29488d4bd66dba","lmdb/libraries/liblmdb/mtest.c":"89ab9ac8bf1e14a9f32a33757c4b3254e4984e0f24e5a302e2d126eb2c86f6db","lmdb/libraries/liblmdb/mtest2.c":"076b00395fe1461dd9577f7bb5567908ce50cf470efbf652787e6fe1dc2fb68c","lmdb/libraries/liblmdb/mtest3.c":"51b9a055e123bd0757ee3082cc6864c836969cf630e646a9cc34e01398c20634","lmdb/libraries/liblmdb/mtest4.c":"b0a725405d80bda6ab95b3ecf410ae330ab8df7a081ca81dd6ea1f8db87642e9","lmdb/libraries/liblmdb/mtest5.c":"7f3b06ca3833315ea4c70d5e91feb1b677f6949f105f4f89d96c3ac35e104f2f","lmdb/libraries/liblmdb/mtest6.c":"e4d7880c36547ebf33bc020046730bf2c075c53aaacd5c876152cc5ae7ab5e6c","lmdb/libraries/liblmdb/sample-bdb.txt":"153d84f8fc49a3abba53ed52d5a41c8d6d4698753a10bbe0689a9e65d3513513","lmdb/libraries/liblmdb/sample-mdb.txt":"1f77385786cffdf72b33da06a91a444fe2827673c3627f89110903a8fe012795","lmdb/libraries/liblmdb/tooltag":"4734c6dc1fa7aec8c2e9646bd04bc5218ef6a03ad83a3b18de2ac4069eb94120","src/bindings.rs":"187b1cdf9c7cd91632030fb64f964113cf115155675cb12c4a6a8afb2292f79a","src/lib.rs":"f962f3e5139b63b25c9198d3ef74b05b4ee1569f9ac7fdbac7c4cb7adac78f6d","tests/fixtures/testdb/data.mdb":"8a0cf8ad63473ae63d437a646042b0d64c112a8fa33d5c916f0678ce4d23189b","tests/fixtures/testdb/lock.mdb":"0e734f65f82f39556cfd62f5da1cc02e56e1cc435f48fe39168e4dc21628e586","tests/lmdb.rs":"5086cb43f3a7b6a8aaa257084c1e0bea664f279ff260b99a8ad0d3c598867a45","tests/simple.rs":"a7ffaef9e3e499bc9372dca9b37b05e7b4e70b3c7d9aac63f79dd0cb8512a41f"},"package":"a1e4b19a1fdf5b74bc802cc9aa7c0c86a775e8b872ba9d5a4e606ffc5d076953"}
{"files":{"Cargo.toml":"8de5804dc3a9cb1f955d9ffdac7fd7f3e09c47b6aa060ea1a5698cdb90a0ffca","bindgen.rs":"4579cf8b217b9673fd08f8306bfe1b4bbac1b31cf11b2a395f81ddac04dfc10e","build.rs":"54abc550db966ce0479e1cf54ed992e3eca7e947357c54bf937b6048f0813c95","lmdb/libraries/liblmdb/CHANGES":"ba14b94dda8670db454275d2f5fb83510f810ccb3ccfca642176a0efef245e08","lmdb/libraries/liblmdb/COPYRIGHT":"fae797823b892c4b59913256b4d10b17d71f57d4bc45e46d901b84fd6dfc3d13","lmdb/libraries/liblmdb/Doxyfile":"5545f6b049040ce58e6d1a603eaea6b7fb8ae92459f2ab8d3bcbacabcce1014d","lmdb/libraries/liblmdb/LICENSE":"310fe25c858a9515fc8c8d7d1f24a67c9496f84a91e0a0e41ea9975b1371e569","lmdb/libraries/liblmdb/Makefile":"60b5f574e6642602f692a95956da61c588a265ad50b8059960c230b9e6aaf4fd","lmdb/libraries/liblmdb/intro.doc":"9442e0db4fc9c70f058c43545e710476d8d5a80b959d20f4381240fd50c6b843","lmdb/libraries/liblmdb/lmdb.h":"05abf244b621b2d14e838b0643e72d5075ce77d8df856b6dccde74ee51c9cf22","lmdb/libraries/liblmdb/mdb.c":"5c7a4e9269e1af7ddb8f10b07f5d2b7f0d111dd379826d5e4880f6101bff4efc","lmdb/libraries/liblmdb/mdb_copy.1":"3a6a8a7a91e1bd42dc4d2a0188ff62d699ff2b3b097a670f30681decf63f22f3","lmdb/libraries/liblmdb/mdb_copy.c":"d3d412a770a5c3afeb88c44b4acdde0f0b985cde22497198e8f38296281cdddd","lmdb/libraries/liblmdb/mdb_dump.1":"9257be883c7fcfcbd61003cc730f7c0900fa8f6feba074c8c1e46634a257b13a","lmdb/libraries/liblmdb/mdb_dump.c":"b046cffcd997254e6daea47a2d7fb74f9d23282174cbb1e3bf9f5fb51a90fe64","lmdb/libraries/liblmdb/mdb_load.1":"ea927473245a4a7777ba687aa26baf7f0951fb620daf82b8d730a090185b2bbc","lmdb/libraries/liblmdb/mdb_load.c":"4f722613c65350315db23060be98584fb572978108885dab271101ba7187dca4","lmdb/libraries/liblmdb/mdb_stat.1":"c0a70d96b4b2d32e73301383d9d5620bc0bbbefb019bfd54f32088dfd4bc921a","lmdb/libraries/liblmdb/mdb_stat.c":"e6405fa191d784ecfa8eb8d1f153a58facc49a8f5a2c891a93802e67acc4861e","lmdb/libraries/liblmdb/midl.c":"e19143db51dd606396c7eba765832e4b66167c0975614e576b950349f8f6cdfd","lmdb/libraries/liblmdb/midl.h":"52066a085aa0fc90799113fb1cc60ca78a5e35ca6191f5f5cb29488d4bd66dba","lmdb/libraries/liblmdb/mtest.c":"89ab9ac8bf1e14a9f32a33757c4b3254e4984e0f24e5a302e2d126eb2c86f6db","lmdb/libraries/liblmdb/mtest2.c":"076b00395fe1461dd9577f7bb5567908ce50cf470efbf652787e6fe1dc2fb68c","lmdb/libraries/liblmdb/mtest3.c":"51b9a055e123bd0757ee3082cc6864c836969cf630e646a9cc34e01398c20634","lmdb/libraries/liblmdb/mtest4.c":"b0a725405d80bda6ab95b3ecf410ae330ab8df7a081ca81dd6ea1f8db87642e9","lmdb/libraries/liblmdb/mtest5.c":"7f3b06ca3833315ea4c70d5e91feb1b677f6949f105f4f89d96c3ac35e104f2f","lmdb/libraries/liblmdb/mtest6.c":"e4d7880c36547ebf33bc020046730bf2c075c53aaacd5c876152cc5ae7ab5e6c","lmdb/libraries/liblmdb/sample-bdb.txt":"153d84f8fc49a3abba53ed52d5a41c8d6d4698753a10bbe0689a9e65d3513513","lmdb/libraries/liblmdb/sample-mdb.txt":"1f77385786cffdf72b33da06a91a444fe2827673c3627f89110903a8fe012795","lmdb/libraries/liblmdb/tooltag":"4734c6dc1fa7aec8c2e9646bd04bc5218ef6a03ad83a3b18de2ac4069eb94120","src/bindings.rs":"ab64073ce4ec64282e8f67cd8f148c83661810a662cb804813b3add0d92a4bf6","src/lib.rs":"b74706ae7901412da54caac7f0cc94f2b445e3a88741760b819659381d615ca8","tests/fixtures/testdb-32/data.mdb":"74d09a30a020789631ef5c64d60d34f6913cf63ad73c82327bd605c5a37849bb","tests/fixtures/testdb-32/lock.mdb":"bbfd0f5aa3eea8421b0a2c277de69b105789dbc744391d9a08d0d3332ae91f70","tests/fixtures/testdb/data.mdb":"8a0cf8ad63473ae63d437a646042b0d64c112a8fa33d5c916f0678ce4d23189b","tests/fixtures/testdb/lock.mdb":"16455695fa3d0229285720b2f16764d2f42d7477f14835bd513c9f2766b4ed22","tests/lmdb.rs":"5086cb43f3a7b6a8aaa257084c1e0bea664f279ff260b99a8ad0d3c598867a45","tests/simple.rs":"774a3edf589dd5fab3b90d5faabb8b8e06e51ec231a795ba17b1e35e65490848"},"package":"b27470ac25167b3afdfb6af8fcd3bc1be67de50ffbdaf4073378cfded6ae24a5"}

6
third_party/rust/lmdb-rkv-sys/Cargo.toml поставляемый
Просмотреть файл

@ -12,7 +12,7 @@
[package]
name = "lmdb-rkv-sys"
version = "0.9.5"
version = "0.11.0"
authors = ["Dan Burkert <dan@danburkert.com>", "Victor Porof <vporof@mozilla.com>"]
build = "build.rs"
description = "Rust bindings for liblmdb."
@ -29,7 +29,9 @@ name = "lmdb_sys"
[dependencies.libc]
version = "0.2"
[build-dependencies.bindgen]
version = "0.51.1-oldsyn"
version = "0.53.2"
features = ["runtime"]
optional = true
default-features = false
[build-dependencies.cc]

7
third_party/rust/lmdb-rkv-sys/bindgen.rs поставляемый
Просмотреть файл

@ -1,5 +1,3 @@
extern crate bindgen;
use bindgen::callbacks::IntKind;
use bindgen::callbacks::ParseCallbacks;
use std::env;
@ -38,7 +36,7 @@ impl ParseCallbacks for Callbacks {
}
}
fn main() {
pub fn generate() {
let mut lmdb = PathBuf::from(&env::var("CARGO_MANIFEST_DIR").unwrap());
lmdb.push("lmdb");
lmdb.push("libraries");
@ -52,8 +50,11 @@ fn main() {
.whitelist_var("^(MDB|mdb)_.*")
.whitelist_type("^(MDB|mdb)_.*")
.whitelist_function("^(MDB|mdb)_.*")
.size_t_is_usize(true)
.ctypes_prefix("::libc")
.blacklist_item("mode_t")
.blacklist_item("mdb_mode_t")
.blacklist_item("mdb_filehandle_t")
.blacklist_item("^__.*")
.parse_callbacks(Box::new(Callbacks {}))
.layout_tests(false)

10
third_party/rust/lmdb-rkv-sys/build.rs поставляемый
Просмотреть файл

@ -1,6 +1,13 @@
extern crate cc;
extern crate pkg_config;
#[cfg(feature = "bindgen")]
extern crate bindgen;
#[cfg(feature = "bindgen")]
#[path = "bindgen.rs"]
mod generate;
use std::env;
use std::path::PathBuf;
@ -39,6 +46,9 @@ macro_rules! warn {
}
fn main() {
#[cfg(feature = "bindgen")]
generate::generate();
let mut lmdb = PathBuf::from(&env::var("CARGO_MANIFEST_DIR").unwrap());
lmdb.push("lmdb");
lmdb.push("libraries");

Просмотреть файл

@ -52,8 +52,6 @@ pub const MDB_BAD_TXN: ::libc::c_int = -30782;
pub const MDB_BAD_VALSIZE: ::libc::c_int = -30781;
pub const MDB_BAD_DBI: ::libc::c_int = -30780;
pub const MDB_LAST_ERRCODE: ::libc::c_int = -30780;
pub type mdb_mode_t = mode_t;
pub type mdb_filehandle_t = ::libc::c_int;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MDB_env {
@ -82,6 +80,7 @@ pub struct MDB_cursor {
#[doc = " The same applies to data sizes in databases with the #MDB_DUPSORT flag."]
#[doc = " Other data items can in theory be from 0 to 0xffffffff bytes long."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MDB_val {
#[doc = "< size of the data item"]
pub mv_size: usize,
@ -167,6 +166,7 @@ pub const MDB_PREV_MULTIPLE: MDB_cursor_op = 18;
pub type MDB_cursor_op = u32;
#[doc = " @brief Statistics for a database in the environment"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MDB_stat {
#[doc = "< Size of a database page."]
#[doc = "This is currently the same for all databases."]
@ -184,6 +184,7 @@ pub struct MDB_stat {
}
#[doc = " @brief Information about the environment"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MDB_envinfo {
#[doc = "< Address of map, if fixed"]
pub me_mapaddr: *mut ::libc::c_void,

13
third_party/rust/lmdb-rkv-sys/src/lib.rs поставляемый
Просмотреть файл

@ -1,15 +1,22 @@
#![deny(warnings)]
#![allow(non_camel_case_types)]
#![allow(clippy::all)]
#![doc(html_root_url = "https://docs.rs/lmdb-rkv-sys/0.9.5")]
#![doc(html_root_url = "https://docs.rs/lmdb-rkv-sys/0.11.0")]
extern crate libc;
#[cfg(unix)]
#[allow(non_camel_case_types)]
pub type mode_t = ::libc::mode_t;
pub type mdb_mode_t = ::libc::mode_t;
#[cfg(windows)]
#[allow(non_camel_case_types)]
pub type mode_t = ::libc::c_int;
pub type mdb_mode_t = ::libc::c_int;
#[cfg(unix)]
#[allow(non_camel_case_types)]
pub type mdb_filehandle_t = ::libc::c_int;
#[cfg(windows)]
#[allow(non_camel_case_types)]
pub type mdb_filehandle_t = *mut ::libc::c_void;
include!("bindings.rs");

Двоичные данные
third_party/rust/lmdb-rkv-sys/tests/fixtures/testdb-32/data.mdb поставляемый Normal file

Двоичный файл не отображается.

Двоичные данные
third_party/rust/lmdb-rkv-sys/tests/fixtures/testdb-32/lock.mdb поставляемый Normal file

Двоичный файл не отображается.

Двоичные данные
third_party/rust/lmdb-rkv-sys/tests/fixtures/testdb/lock.mdb поставляемый

Двоичный файл не отображается.

37
third_party/rust/lmdb-rkv-sys/tests/simple.rs поставляемый
Просмотреть файл

@ -3,6 +3,7 @@ extern crate lmdb_sys;
use lmdb_sys::*;
use std::ffi::{c_void, CString};
use std::fs::File;
use std::ptr;
// https://github.com/victorporof/lmdb/blob/mdb.master/libraries/liblmdb/moz-test.c
@ -23,19 +24,30 @@ macro_rules! str {
}
#[test]
#[cfg(all(target_os = "windows", target_arch = "x86"))]
#[should_panic(expected = "Failed with code -30793")]
fn test_simple_win_32() {
test_simple()
#[cfg(target_pointer_width = "32")]
fn test_simple_32() {
test_simple("./tests/fixtures/testdb-32")
}
#[test]
#[cfg(not(all(target_os = "windows", target_arch = "x86")))]
fn test_simple_other() {
test_simple()
#[cfg(target_pointer_width = "64")]
fn test_simple_64() {
test_simple("./tests/fixtures/testdb")
}
fn test_simple() {
#[cfg(windows)]
fn get_file_fd(file: &File) -> std::os::windows::io::RawHandle {
use std::os::windows::io::AsRawHandle;
file.as_raw_handle()
}
#[cfg(unix)]
fn get_file_fd(file: &File) -> std::os::unix::io::RawFd {
use std::os::unix::io::AsRawFd;
file.as_raw_fd()
}
fn test_simple(env_path: &str) {
let mut env: *mut MDB_env = ptr::null_mut();
let mut dbi: MDB_dbi = 0;
let mut key = MDB_val {
@ -53,7 +65,7 @@ fn test_simple() {
unsafe {
E!(mdb_env_create(&mut env));
E!(mdb_env_set_maxdbs(env, 2));
E!(mdb_env_open(env, str!("./tests/fixtures/testdb"), 0, 0664));
E!(mdb_env_open(env, str!(env_path), 0, 0664));
E!(mdb_txn_begin(env, ptr::null_mut(), 0, &mut txn));
E!(mdb_dbi_open(txn, str!("subdb"), MDB_CREATE, &mut dbi));
@ -67,6 +79,13 @@ fn test_simple() {
E!(mdb_txn_begin(env, ptr::null_mut(), 0, &mut txn));
E!(mdb_put(txn, dbi, &mut key, &mut data, 0));
E!(mdb_txn_commit(txn));
}
let file = File::create("./tests/fixtures/copytestdb.mdb").unwrap();
unsafe {
let fd = get_file_fd(&file);
E!(mdb_env_copyfd(env, fd));
mdb_dbi_close(env, dbi);
mdb_env_close(env);

Просмотреть файл

@ -1 +1 @@
{"files":{"Cargo.toml":"6d06a849a674c6e18514d46e2f9cff156d7aaa7ae689a7a619432d5da46c537b","LICENSE":"db6d163be642e3b568c5fb2104013da632316ecd4e75935df1613af8b0b37933","README.md":"6d7b399235c2f09b4257c3b46369ab5dcd310b4fd2cb2cf6980eecbae6eceb2a","benches/cursor.rs":"3a3410940baf9cc9cfa552d23847ab39c71996477f38370803ed9edab3a45f03","benches/transaction.rs":"309cc7526d92274fc0748585200e1c4ff2e997514f8455f184360fe9dfb75035","benches/utils.rs":"e8c88b72cf7cc7a6ee331c03f630c6e52ec9f1a5462249ff5c25e53ddedc2f4f","src/cursor.rs":"fd7f1700c3e61bb1955e912d164fbe96cf7a7fc97918ef9f750af4f5c92b5469","src/database.rs":"9c52336a487e6141835607c04a4aa53fbe05b9329abb81a461d8f24dfd52f442","src/environment.rs":"6eadf5f1be000bdf7580c21f65ec966363f896fcce9ea004ff6722765eb1f060","src/error.rs":"19c97fee8b2a1bab25f047f34ec2c781062ad95b6dbac0830fdfd3c60e96307d","src/flags.rs":"40fd3d4d72c8db8f9ecb893420300a3585e2ca4c49073065ec9ebf24fe23c064","src/lib.rs":"e77abe7df39b44d2af2d796f027a3f03b6bc99582ae1f291f81e3b9c31d58ffe","src/transaction.rs":"dc81992311a0122bc1f138561b0431c36d8c1080cdf1c1dbf157a448ca3ba3ae"},"package":"605061e5465304475be2041f19967a900175ea1b6d8f47fbab84a84fb8c48452"}
{"files":{"Cargo.toml":"99efe5a50cb9eedb2ec19f42a84c8d80c7ad12776fefa6fa971e6e8813a7f93a","LICENSE":"db6d163be642e3b568c5fb2104013da632316ecd4e75935df1613af8b0b37933","README.md":"6d7b399235c2f09b4257c3b46369ab5dcd310b4fd2cb2cf6980eecbae6eceb2a","benches/cursor.rs":"3a3410940baf9cc9cfa552d23847ab39c71996477f38370803ed9edab3a45f03","benches/transaction.rs":"309cc7526d92274fc0748585200e1c4ff2e997514f8455f184360fe9dfb75035","benches/utils.rs":"e8c88b72cf7cc7a6ee331c03f630c6e52ec9f1a5462249ff5c25e53ddedc2f4f","src/cursor.rs":"fd7f1700c3e61bb1955e912d164fbe96cf7a7fc97918ef9f750af4f5c92b5469","src/database.rs":"9c52336a487e6141835607c04a4aa53fbe05b9329abb81a461d8f24dfd52f442","src/environment.rs":"119dfd0d27b0202a68cb80f891acc0755e67afc9b379ca21c030760baad06965","src/error.rs":"19c97fee8b2a1bab25f047f34ec2c781062ad95b6dbac0830fdfd3c60e96307d","src/flags.rs":"40fd3d4d72c8db8f9ecb893420300a3585e2ca4c49073065ec9ebf24fe23c064","src/lib.rs":"738088722d641ebd1a5ce41576cef4b137b9863815bf9ee7a3909cb46a58e370","src/transaction.rs":"dc81992311a0122bc1f138561b0431c36d8c1080cdf1c1dbf157a448ca3ba3ae"},"package":"447a296f7aca299cfbb50f4e4f3d49451549af655fb7215d7f8c0c3d64bad42b"}

4
third_party/rust/lmdb-rkv/Cargo.toml поставляемый
Просмотреть файл

@ -12,7 +12,7 @@
[package]
name = "lmdb-rkv"
version = "0.12.3"
version = "0.14.0"
authors = ["Dan Burkert <dan@danburkert.com>", "Victor Porof <vporof@mozilla.com>"]
exclude = ["/.appveyor.yml", "/.travis.yml", "/azure-pipelines-template.yml", "/azure-pipelines.yml"]
description = "Idiomatic and safe LMDB wrapper."
@ -36,7 +36,7 @@ version = "1"
version = "0.2"
[dependencies.lmdb-rkv-sys]
version = "0.9.3"
version = "0.11.0"
[dev-dependencies.rand]
version = "0.4"

Просмотреть файл

@ -406,7 +406,7 @@ impl EnvironmentBuilder {
///
/// The path may not contain the null character, Windows UNC (Uniform Naming Convention)
/// paths are not supported either.
pub fn open_with_permissions(&self, path: &Path, mode: ffi::mode_t) -> Result<Environment> {
pub fn open_with_permissions(&self, path: &Path, mode: ffi::mdb_mode_t) -> Result<Environment> {
let mut env: *mut ffi::MDB_env = ptr::null_mut();
unsafe {
lmdb_try!(ffi::mdb_env_create(&mut env));

2
third_party/rust/lmdb-rkv/src/lib.rs поставляемый
Просмотреть файл

@ -2,7 +2,7 @@
//! [Lightning Memory-mapped Database (LMDB)](https://symas.com/lmdb).
#![deny(missing_docs)]
#![doc(html_root_url = "https://docs.rs/lmdb-rkv/0.12.3")]
#![doc(html_root_url = "https://docs.rs/lmdb-rkv/0.14.0")]
extern crate byteorder;
extern crate libc;

2
third_party/rust/mime/.cargo-checksum.json поставляемый
Просмотреть файл

@ -1 +1 @@
{"files":{"CONTRIBUTING.md":"7a8f1d12eb98bd09c290d31f25b03c71ff78027d9fc468e8782efa7dd3e69f1c","Cargo.toml":"0392e7aaa8950e923802ba61c27e95817f78cf7913a2df9eecf1f602e3428c1b","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"df9cfd06d8a44d9a671eadd39ffd97f166481da015a30f45dfd27886209c5922","README.md":"4ac32f1d6d7e1ac9f89f0a6d7d0cbc26f20ef9defdc7b206ef3a77616f493bbf","benches/cmp.rs":"9deb7c222eb69e7c5160aa82d361d4883792be3b557fbf8f7c807b398ba951a1","benches/fmt.rs":"46ec1e7c7970a3eed84b303309a2395ac16d16534ea691db7f361d0016ef0673","benches/parse.rs":"af2b35fc314e39c7fb3fbe6a77b65e54d0f4bd8956950330700028a98513b7d8","src/lib.rs":"3157308653b79f181dbe5c3c04a5efea5b59644908b7c5237fa8d3b06a11fe5f","src/parse.rs":"ab8d8ba0d4a3748844dc09da05167966637c70a97254d1c14cf23271c93277d7"},"package":"3e27ca21f40a310bd06d9031785f4801710d566c184a6e15bad4f1d9b65f9425"}
{"files":{"CONTRIBUTING.md":"7a8f1d12eb98bd09c290d31f25b03c71ff78027d9fc468e8782efa7dd3e69f1c","Cargo.toml":"75e36b40187c8edad0baae326a0903b6b462f1acd0d68102a8e4f006b8802041","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"df9cfd06d8a44d9a671eadd39ffd97f166481da015a30f45dfd27886209c5922","README.md":"4ac32f1d6d7e1ac9f89f0a6d7d0cbc26f20ef9defdc7b206ef3a77616f493bbf","benches/cmp.rs":"9deb7c222eb69e7c5160aa82d361d4883792be3b557fbf8f7c807b398ba951a1","benches/fmt.rs":"46ec1e7c7970a3eed84b303309a2395ac16d16534ea691db7f361d0016ef0673","benches/parse.rs":"af2b35fc314e39c7fb3fbe6a77b65e54d0f4bd8956950330700028a98513b7d8","src/lib.rs":"c848e55a49ae4ed6451e94c8c120451b5031ba2ab87170ed389eeb4731679446","src/parse.rs":"cfe11f611901a581245b091942bb28ef2eec57645b981e1699d247f11c9e6fe3"},"package":"2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d"}

8
third_party/rust/mime/Cargo.toml поставляемый
Просмотреть файл

@ -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,12 +12,12 @@
[package]
name = "mime"
version = "0.3.13"
version = "0.3.16"
authors = ["Sean McArthur <sean@seanmonstar.com>"]
description = "Strongly Typed Mimes"
documentation = "https://docs.rs/mime"
keywords = ["mime", "media-extensions", "media-types"]
license = "MIT/Apache-2.0"
repository = "https://github.com/hyperium/mime"
[dependencies.unicase]
version = "2.0"
[dependencies]

59
third_party/rust/mime/src/lib.rs поставляемый
Просмотреть файл

@ -23,14 +23,12 @@
//! }
//! ```
#![doc(html_root_url = "https://docs.rs/mime/0.3.13")]
#![doc(html_root_url = "https://docs.rs/mime/0.3.16")]
#![deny(warnings)]
#![deny(missing_docs)]
#![deny(missing_debug_implementations)]
extern crate unicase;
use std::cmp::Ordering;
use std::error::Error;
use std::fmt;
@ -75,15 +73,23 @@ pub struct FromStrError {
inner: parse::ParseError,
}
impl Error for FromStrError {
fn description(&self) -> &str {
"an error occurred while parsing a MIME type"
impl FromStrError {
fn s(&self) -> &str {
"mime parse error"
}
}
impl fmt::Display for FromStrError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}: {}", self.description(), self.inner)
write!(f, "{}: {}", self.s(), self.inner)
}
}
impl Error for FromStrError {
// Minimum Rust is 1.15, Error::description was still required then
#[allow(deprecated)]
fn description(&self) -> &str {
self.s()
}
}
@ -206,6 +212,15 @@ impl Mime {
Params(inner)
}
/// Return a `&str` of the Mime's ["essence"][essence].
///
/// [essence]: https://mimesniff.spec.whatwg.org/#mime-type-essence
pub fn essence_str(&self) -> &str {
let end = self.semicolon().unwrap_or(self.source.as_ref().len());
&self.source.as_ref()[..end]
}
#[cfg(test)]
fn has_params(&self) -> bool {
match self.params {
@ -233,24 +248,33 @@ impl Mime {
// Mime ============
fn eq_ascii(a: &str, b: &str) -> bool {
// str::eq_ignore_ascii_case didn't stabilize until Rust 1.23.
// So while our MSRV is 1.15, gotta import this trait.
#[allow(deprecated, unused)]
use std::ascii::AsciiExt;
a.eq_ignore_ascii_case(b)
}
fn mime_eq_str(mime: &Mime, s: &str) -> bool {
if let ParamSource::Utf8(semicolon) = mime.params {
if mime.source.as_ref().len() == s.len() {
unicase::eq_ascii(mime.source.as_ref(), s)
eq_ascii(mime.source.as_ref(), s)
} else {
params_eq(semicolon, mime.source.as_ref(), s)
}
} else if let Some(semicolon) = mime.semicolon() {
params_eq(semicolon, mime.source.as_ref(), s)
} else {
unicase::eq_ascii(mime.source.as_ref(), s)
eq_ascii(mime.source.as_ref(), s)
}
}
fn params_eq(semicolon: usize, a: &str, b: &str) -> bool {
if b.len() < semicolon + 1 {
false
} else if !unicase::eq_ascii(&a[..semicolon], &b[..semicolon]) {
} else if !eq_ascii(&a[..semicolon], &b[..semicolon]) {
false
} else {
// gotta check for quotes, LWS, and for case senstive names
@ -280,7 +304,7 @@ fn params_eq(semicolon: usize, a: &str, b: &str) -> bool {
#[allow(deprecated)]
{ b[..b_idx].trim_left() }
};
if !unicase::eq_ascii(a_name, b_name) {
if !eq_ascii(a_name, b_name) {
return false;
}
sensitive = a_name != CHARSET;
@ -327,7 +351,7 @@ fn params_eq(semicolon: usize, a: &str, b: &str) -> bool {
};
if sensitive {
if !unicase::eq_ascii(&a[..a_end], &b[..b_end]) {
if !eq_ascii(&a[..a_end], &b[..b_end]) {
return false;
}
} else {
@ -349,7 +373,7 @@ impl PartialEq for Mime {
// This could optimize for when there are no customs parameters.
// Any parsed mime has already been lowercased, so if there aren't
// any parameters that are case sensistive, this can skip the
// unicase::eq_ascii, and just use a memcmp instead.
// eq_ascii, and just use a memcmp instead.
(0, _) |
(_, 0) => mime_eq_str(self, other.source.as_ref()),
(a, b) => a == b,
@ -424,7 +448,7 @@ impl fmt::Display for Mime {
fn name_eq_str(name: &Name, s: &str) -> bool {
if name.insensitive {
unicase::eq_ascii(name.source, s)
eq_ascii(name.source, s)
} else {
name.source == s
}
@ -903,4 +927,11 @@ mod tests {
assert_ne!(param, "abc");
assert_ne!("abc", param);
}
#[test]
fn test_essence_str() {
assert_eq!(TEXT_PLAIN.essence_str(), "text/plain");
assert_eq!(TEXT_PLAIN_UTF_8.essence_str(), "text/plain");
assert_eq!(IMAGE_SVG.essence_str(), "image/svg+xml");
}
}

19
third_party/rust/mime/src/parse.rs поставляемый
Просмотреть файл

@ -18,8 +18,8 @@ pub enum ParseError {
},
}
impl Error for ParseError {
fn description(&self) -> &str {
impl ParseError {
fn s(&self) -> &str {
use self::ParseError::*;
match *self {
@ -34,13 +34,21 @@ impl Error for ParseError {
impl fmt::Display for ParseError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
if let ParseError::InvalidToken { pos, byte } = *self {
write!(f, "{}, {:X} at position {}", self.description(), byte, pos)
write!(f, "{}, {:X} at position {}", self.s(), byte, pos)
} else {
f.write_str(self.description())
f.write_str(self.s())
}
}
}
impl Error for ParseError {
// Minimum Rust is 1.15, Error::description was still required then
#[allow(deprecated)]
fn description(&self) -> &str {
self.s()
}
}
pub fn parse(s: &str) -> Result<Mime, ParseError> {
if s == "*/*" {
return Ok(::STAR_STAR);
@ -95,7 +103,7 @@ pub fn parse(s: &str) -> Result<Mime, ParseError> {
}
// params
let params = try!(params_from_str(s, &mut iter, start));
let params = params_from_str(s, &mut iter, start)?;
let src = match params {
ParamSource::Utf8(_) => s.to_ascii_lowercase(),
@ -325,6 +333,7 @@ fn is_restricted_quoted_char(c: u8) -> bool {
}
#[test]
#[allow(warnings)] // ... ranges deprecated
fn test_lookup_tables() {
for (i, &valid) in TOKEN_MAP.iter().enumerate() {
let i = i as u8;

Просмотреть файл

@ -1 +1 @@
{"files":{"Cargo.lock":"cc465f0deff8c0a8505addc685cfc82f4121446cfec6e781284cbd34ddba4079","Cargo.toml":"c2390b459898eaad40c1c726cb0c7665d1a3abc0ae26693ce4b3fddb117510fc","LICENSE":"6919f1acec82afc721be2d9907b993267f433a44d25d8aedf1003b5f59ebfd46","README.md":"f238798faadf016145e6718fdb2ad1e9607471f10707424135a63c015ac80f5a","benches/benchmark.rs":"2287c7233cf78a9af98b2b53cd20e221e4a785209bd70a87030f1ade34a02507","build.rs":"8e47254c0a927eeb243058cfc0da413f34a958226707c941e8634e4514562f04","examples/rev_map.rs":"0bab6cc20b9eace741c6cc4a8c67ebfa124df1bf213038c5e34976081ffd2ebc","src/impl_bin_search.rs":"32a89409690d57f074f11eb93a9d6e422f73788af63fc29f980e13d1c2d2fa6f","src/impl_phf.rs":"321028cc657364c6f7c5b5f538b0033bcfd6f3b5ef711304d806c0644466a964","src/lib.rs":"8c8db560605b46a13062a168283e8b0f459242718682642b1f167bec686e5606","src/mime_types.rs":"eb75a90bc41baa8169fb85ec8ddf82e99660f2c1aa3a47e29ef9a2af3796b3bc"},"package":"1a0ed03949aef72dbdf3116a383d7b38b4768e6f960528cd6a6044aa9ed68599"}
{"files":{"Cargo.lock":"68df26849ead62e10cc255ca2009ddba651d393be3499aefa24d25538922768f","Cargo.toml":"b7877455bb621228f87ed556f04c007d2704ad3193d1aabeb7526d4006008699","LICENSE":"6919f1acec82afc721be2d9907b993267f433a44d25d8aedf1003b5f59ebfd46","README.md":"8e1db7c6f134caf08edd05732f61de07a322446c58f081cfc0220e7447ab051c","benches/benchmark.rs":"2287c7233cf78a9af98b2b53cd20e221e4a785209bd70a87030f1ade34a02507","build.rs":"8e47254c0a927eeb243058cfc0da413f34a958226707c941e8634e4514562f04","examples/rev_map.rs":"0bab6cc20b9eace741c6cc4a8c67ebfa124df1bf213038c5e34976081ffd2ebc","src/impl_bin_search.rs":"32a89409690d57f074f11eb93a9d6e422f73788af63fc29f980e13d1c2d2fa6f","src/impl_phf.rs":"321028cc657364c6f7c5b5f538b0033bcfd6f3b5ef711304d806c0644466a964","src/lib.rs":"8c8db560605b46a13062a168283e8b0f459242718682642b1f167bec686e5606","src/mime_types.rs":"06223533119bc845dece004db99b2cdc6d43ba5bad19f65628438bc36adb9b2d"},"package":"2684d4c2e97d99848d30b324b00c8fcc7e5c897b7cbb5819b09e7c90e8baf212"}

569
third_party/rust/mime_guess/Cargo.lock сгенерированный поставляемый
Просмотреть файл

@ -1,25 +1,23 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
[[package]]
name = "arrayvec"
version = "0.4.11"
name = "anyhow"
version = "1.0.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "atty"
version = "0.2.13"
version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"hermit-abi 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "autocfg"
version = "0.1.5"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
@ -29,24 +27,32 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "bstr"
version = "0.2.6"
version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"regex-automata 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "bumpalo"
version = "3.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "byteorder"
version = "1.3.2"
version = "1.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "cast"
version = "0.2.2"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "cfg-if"
@ -60,138 +66,150 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "cloudabi"
version = "0.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-width 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "criterion"
version = "0.2.11"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
"cast 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
"cast 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)",
"criterion-plot 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"csv 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_xoshiro 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rayon 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rayon-core 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)",
"tinytemplate 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"walkdir 2.2.9 (registry+https://github.com/rust-lang/crates.io-index)",
"criterion-plot 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"csv 1.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"oorandom 11.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"plotters 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
"rayon 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)",
"tinytemplate 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "criterion-plot"
version = "0.3.1"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cast 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cast 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "crossbeam-deque"
version = "0.6.3"
version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"crossbeam-epoch 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
"crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
"crossbeam-epoch 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)",
"crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
"maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "crossbeam-epoch"
version = "0.7.2"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)",
"autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"memoffset 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"scopeguard 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"memoffset 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
"scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "crossbeam-queue"
version = "0.1.2"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
"cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "crossbeam-utils"
version = "0.6.6"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "csv"
version = "1.1.1"
version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bstr 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
"csv-core 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
"ryu 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)",
"bstr 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"csv-core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
"itoa 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"ryu 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "csv-core"
version = "0.1.6"
version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "either"
version = "1.5.2"
version = "1.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "fuchsia-cprng"
version = "0.1.1"
name = "heck"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"unicode-segmentation 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "hermit-abi"
version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "itertools"
version = "0.8.0"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"either 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
"either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "itoa"
version = "0.4.4"
version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "js-sys"
version = "0.3.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"wasm-bindgen 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "lazy_static"
version = "1.3.0"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
@ -200,16 +218,26 @@ version = "0.2.60"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "memchr"
version = "2.2.1"
name = "log"
version = "0.4.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)",
"cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "maybe-uninit"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "memchr"
version = "2.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "memoffset"
version = "0.5.1"
version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
@ -217,121 +245,104 @@ dependencies = [
[[package]]
name = "mime"
version = "0.3.13"
version = "0.3.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"unicase 2.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "mime_guess"
version = "2.0.1"
version = "2.0.3"
dependencies = [
"criterion 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"mime 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)",
"unicase 2.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"criterion 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"mime 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"unicase 2.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "nodrop"
version = "0.1.13"
name = "nom"
version = "4.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "num-traits"
version = "0.2.8"
version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "num_cpus"
version = "1.10.1"
version = "1.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"hermit-abi 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "oorandom"
version = "11.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "plotters"
version = "0.2.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"js-sys 0.3.35 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"wasm-bindgen 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)",
"web-sys 0.3.35 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "proc-macro2"
version = "0.4.30"
version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "quote"
version = "0.6.13"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "rand_core"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "rand_core"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "rand_os"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "rand_xoshiro"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "rayon"
version = "1.1.0"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"crossbeam-deque 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
"either 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
"rayon-core 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"crossbeam-deque 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)",
"either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
"rayon-core 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "rayon-core"
version = "1.5.0"
version = "1.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"crossbeam-deque 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
"crossbeam-queue 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
"crossbeam-deque 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)",
"crossbeam-queue 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"num_cpus 1.12.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "rdrand"
version = "0.4.0"
name = "regex"
version = "1.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"regex-syntax 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -339,9 +350,14 @@ name = "regex-automata"
version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "regex-syntax"
version = "0.6.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "rustc_version"
version = "0.2.3"
@ -352,20 +368,20 @@ dependencies = [
[[package]]
name = "ryu"
version = "1.0.0"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "same-file"
version = "1.0.5"
version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "scopeguard"
version = "1.0.0"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
@ -383,37 +399,42 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "serde"
version = "1.0.98"
version = "1.0.104"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "serde_derive"
version = "1.0.98"
version = "1.0.104"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.15.42 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "serde_json"
version = "1.0.40"
version = "1.0.48"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
"ryu 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)",
"itoa 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"ryu 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "sourcefile"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "syn"
version = "0.15.42"
version = "1.0.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -421,34 +442,39 @@ name = "textwrap"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-width 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "tinytemplate"
version = "1.0.2"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"serde 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "unicase"
version = "2.4.0"
version = "2.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"version_check 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "unicode-segmentation"
version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "unicode-width"
version = "0.1.5"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "unicode-xid"
version = "0.1.0"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
@ -456,14 +482,103 @@ name = "version_check"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "version_check"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "walkdir"
version = "2.2.9"
version = "2.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
"same-file 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "wasm-bindgen"
version = "0.2.58"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"wasm-bindgen-macro 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "wasm-bindgen-backend"
version = "0.2.58"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bumpalo 3.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)",
"wasm-bindgen-shared 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "wasm-bindgen-macro"
version = "0.2.58"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"wasm-bindgen-macro-support 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "wasm-bindgen-macro-support"
version = "0.2.58"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)",
"wasm-bindgen-backend 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)",
"wasm-bindgen-shared 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "wasm-bindgen-shared"
version = "0.2.58"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "wasm-bindgen-webidl"
version = "0.2.58"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"anyhow 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)",
"heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)",
"wasm-bindgen-backend 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)",
"weedle 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "web-sys"
version = "0.3.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"anyhow 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)",
"js-sys 0.3.35 (registry+https://github.com/rust-lang/crates.io-index)",
"sourcefile 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"wasm-bindgen 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)",
"wasm-bindgen-webidl 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "weedle"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"nom 4.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -482,7 +597,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "winapi-util"
version = "0.1.2"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
@ -494,64 +609,78 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[metadata]
"checksum arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "b8d73f9beda665eaa98ab9e4f7442bd4e7de6652587de55b2525e52e29c1b0ba"
"checksum atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "1803c647a3ec87095e7ae7acfca019e98de5ec9a7d01343f611cf3152ed71a90"
"checksum autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "22130e92352b948e7e82a49cdb0aa94f2211761117f29e052dd397c1ac33542b"
"checksum anyhow 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)" = "7825f6833612eb2414095684fcf6c635becf3ce97fe48cf6421321e93bfbd53c"
"checksum atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
"checksum autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d"
"checksum bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3d155346769a6855b86399e9bc3814ab343cd3d62c7e985113d46a0ec3c281fd"
"checksum bstr 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "e0a692f1c740e7e821ca71a22cf99b9b2322dfa94d10f71443befb1797b3946a"
"checksum byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c3dd8985a7111efc5c80b44e23ecdd8c007de8ade3b96595387e812b957cf5"
"checksum cast 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "926013f2860c46252efceabb19f4a6b308197505082c609025aa6706c011d427"
"checksum bstr 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "502ae1441a0a5adb8fbd38a5955a6416b9493e92b465de5e4a9bde6a539c2c48"
"checksum bumpalo 3.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1f359dc14ff8911330a51ef78022d376f25ed00248912803b58f00cb1c27f742"
"checksum byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de"
"checksum cast 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4b9434b9a5aa1450faa3f9cb14ea0e8c53bb5d2b3c1bfd1ab4fc03e9f33fbfb0"
"checksum cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "b486ce3ccf7ffd79fdeb678eac06a9e6c09fc88d33836340becb8fffe87c5e33"
"checksum clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9"
"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f"
"checksum criterion 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "0363053954f3e679645fc443321ca128b7b950a6fe288cf5f9335cc22ee58394"
"checksum criterion-plot 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "76f9212ddf2f4a9eb2d401635190600656a1f88a932ef53d06e7fa4c7e02fb8e"
"checksum crossbeam-deque 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "05e44b8cf3e1a625844d1750e1f7820da46044ff6d28f4d43e455ba3e5bb2c13"
"checksum crossbeam-epoch 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "fedcd6772e37f3da2a9af9bf12ebe046c0dfe657992377b4df982a2b54cd37a9"
"checksum crossbeam-queue 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7c979cd6cfe72335896575c6b5688da489e420d36a27a0b9eb0c73db574b4a4b"
"checksum crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)" = "04973fa96e96579258a5091af6003abde64af786b860f18622b82e026cca60e6"
"checksum csv 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "37519ccdfd73a75821cac9319d4fce15a81b9fcf75f951df5b9988aa3a0af87d"
"checksum csv-core 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "9b5cadb6b25c77aeff80ba701712494213f4a8418fcda2ee11b6560c3ad0bf4c"
"checksum either 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5527cfe0d098f36e3f8839852688e63c8fff1c90b2b405aef730615f9a7bcf7b"
"checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba"
"checksum itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5b8467d9c1cebe26feb08c640139247fac215782d35371ade9a2136ed6085358"
"checksum itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "501266b7edd0174f8530248f87f99c88fbe60ca4ef3dd486835b8d8d53136f7f"
"checksum lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc5729f27f159ddd61f4df6228e827e86643d4d3e7c32183cb30a1c08f604a14"
"checksum criterion 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1fc755679c12bda8e5523a71e4d654b6bf2e14bd838dfc48cde6559a05caf7d1"
"checksum criterion-plot 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a01e15e0ea58e8234f96146b1f91fa9d0e4dd7a38da93ff7a75d42c0b9d3a545"
"checksum crossbeam-deque 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "9f02af974daeee82218205558e51ec8768b48cf524bd01d550abe5573a608285"
"checksum crossbeam-epoch 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "058ed274caafc1f60c4997b5fc07bf7dc7cca454af7c6e81edffe5f33f70dace"
"checksum crossbeam-queue 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c695eeca1e7173472a32221542ae469b3e9aac3a4fc81f7696bcad82029493db"
"checksum crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8"
"checksum csv 1.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "00affe7f6ab566df61b4be3ce8cf16bc2576bca0963ceb0955e45d514bf9a279"
"checksum csv-core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "2b2466559f260f48ad25fe6317b3c8dac77b5bdb5763ac7d9d6103530663bc90"
"checksum either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3"
"checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205"
"checksum hermit-abi 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "1010591b26bbfe835e9faeabeb11866061cc7dcebffd56ad7d0942d0e61aefd8"
"checksum itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f56a2d0bc861f9165be4eb3442afd3c236d8a98afd426f65d92324ae1091a484"
"checksum itoa 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "b8b7a7c0c47db5545ed3fef7468ee7bb5b74691498139e4b3f6a20685dc6dd8e"
"checksum js-sys 0.3.35 (registry+https://github.com/rust-lang/crates.io-index)" = "7889c7c36282151f6bf465be4700359318aef36baa951462382eae49e9577cf9"
"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
"checksum libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)" = "d44e80633f007889c7eff624b709ab43c92d708caad982295768a7b13ca3b5eb"
"checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e"
"checksum memoffset 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ce6075db033bbbb7ee5a0bbd3a3186bbae616f57fb001c485c7ff77955f8177f"
"checksum mime 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)" = "3e27ca21f40a310bd06d9031785f4801710d566c184a6e15bad4f1d9b65f9425"
"checksum nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9667ddcc6cc8a43afc9b7917599d7216aa09c463919ea32c59ed6cac8bc945"
"checksum num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "6ba9a427cfca2be13aa6f6403b0b7e7368fe982bfa16fccc450ce74c46cd9b32"
"checksum num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bcef43580c035376c0705c42792c294b66974abbfd2789b511784023f71f3273"
"checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759"
"checksum quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1"
"checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b"
"checksum rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d0e7a549d590831370895ab7ba4ea0c1b6b011d106b5ff2da6eee112615e6dc0"
"checksum rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071"
"checksum rand_xoshiro 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "03b418169fb9c46533f326efd6eed2576699c44ca92d3052a066214a8d828929"
"checksum rayon 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a4b0186e22767d5b9738a05eab7c6ac90b15db17e5b5f9bd87976dd7d89a10a4"
"checksum rayon-core 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ebbe0df8435ac0c397d467b6cad6d25543d06e8a019ef3f6af3c384597515bd2"
"checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2"
"checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7"
"checksum maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00"
"checksum memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400"
"checksum memoffset 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "75189eb85871ea5c2e2c15abbdd541185f63b408415e5051f5cac122d8c774b9"
"checksum mime 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)" = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d"
"checksum nom 4.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2ad2a91a8e869eeb30b9cb3119ae87773a8f4ae617f41b1eb9c154b2905f7bd6"
"checksum num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "c62be47e61d1842b9170f0fdeec8eba98e60e90e5446449a0545e5152acd7096"
"checksum num_cpus 1.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "46203554f085ff89c235cd12f7075f3233af9b11ed7c9e16dfe2560d03313ce6"
"checksum oorandom 11.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ebcec7c9c2a95cacc7cd0ecb89d8a8454eca13906f6deb55258ffff0adeb9405"
"checksum plotters 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)" = "4e3bb8da247d27ae212529352020f3e5ee16e83c0c258061d27b08ab92675eeb"
"checksum proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)" = "6c09721c6781493a2a492a96b5a5bf19b65917fe6728884e7c44dd0c60ca3435"
"checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe"
"checksum rayon 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "db6ce3297f9c85e16621bb8cca38a06779ffc31bb8184e1be4bed2be4678a098"
"checksum rayon-core 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "08a89b46efaf957e52b18062fb2f4660f8b8a4dde1807ca002690868ef2c85a9"
"checksum regex 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "322cf97724bea3ee221b78fe25ac9c46114ebb51747ad5babd51a2fc6a8235a8"
"checksum regex-automata 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "92b73c2a1770c255c240eaa4ee600df1704a38dc3feaa6e949e7fcd4f8dc09f9"
"checksum regex-syntax 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)" = "b28dfe3fe9badec5dbf0a79a9cccad2cfc2ab5484bdb3e44cbd1ae8b3ba2be06"
"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
"checksum ryu 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c92464b447c0ee8c4fb3824ecc8383b81717b9f1e74ba2e72540aef7b9f82997"
"checksum same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "585e8ddcedc187886a30fa705c47985c3fa88d06624095856b36ca0b82ff4421"
"checksum scopeguard 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b42e15e59b18a828bbf5c58ea01debb36b9b096346de35d941dcb89009f24a0d"
"checksum ryu 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bfa8506c1de11c9c4e4c38863ccbe02a305c8188e85a05a784c9e11e1c3910c8"
"checksum same-file 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502"
"checksum scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
"checksum serde 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)" = "7fe5626ac617da2f2d9c48af5515a21d5a480dbd151e01bb1c355e26a3e68113"
"checksum serde_derive 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)" = "01e69e1b8a631f245467ee275b8c757b818653c6d704cdbcaeb56b56767b529c"
"checksum serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)" = "051c49229f282f7c6f3813f8286cc1e3323e8051823fce42c7ea80fe13521704"
"checksum syn 0.15.42 (registry+https://github.com/rust-lang/crates.io-index)" = "eadc09306ca51a40555dd6fc2b415538e9e18bc9f870e47b1a524a79fe2dcf5e"
"checksum serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)" = "414115f25f818d7dfccec8ee535d76949ae78584fc4f79a6f45a904bf8ab4449"
"checksum serde_derive 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)" = "128f9e303a5a29922045a830221b8f78ec74a5f544944f3d5984f8ec3895ef64"
"checksum serde_json 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)" = "9371ade75d4c2d6cb154141b9752cf3781ec9c05e0e5cf35060e1e70ee7b9c25"
"checksum sourcefile 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4bf77cb82ba8453b42b6ae1d692e4cdc92f9a47beaf89a847c8be83f4e328ad3"
"checksum syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)" = "123bd9499cfb380418d509322d7a6d52e5315f064fe4b3ad18a53d6b92c07859"
"checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
"checksum tinytemplate 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4574b75faccaacddb9b284faecdf0b544b80b6b294f3d062d325c5726a209c20"
"checksum unicase 2.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a84e5511b2a947f3ae965dcb29b13b7b1691b6e7332cf5dbc1744138d5acb7f6"
"checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526"
"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
"checksum tinytemplate 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "57a3c6667d3e65eb1bc3aed6fd14011c6cbc3a0665218ab7f5daf040b9ec371a"
"checksum unicase 2.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6"
"checksum unicode-segmentation 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e83e153d1053cbb5a118eeff7fd5be06ed99153f00dbcd8ae310c5fb2b22edc0"
"checksum unicode-width 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "caaa9d531767d1ff2150b9332433f32a24622147e5ebb1f26409d5da67afd479"
"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c"
"checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd"
"checksum walkdir 2.2.9 (registry+https://github.com/rust-lang/crates.io-index)" = "9658c94fa8b940eab2250bd5a457f9c48b748420d71293b165c8cdbe2f55f71e"
"checksum version_check 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "078775d0255232fb988e6fccf26ddc9d1ac274299aaedcedce21c6f72cc533ce"
"checksum walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "777182bc735b6424e1a57516d35ed72cb8019d85c8c9bf536dccb3445c1a2f7d"
"checksum wasm-bindgen 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)" = "5205e9afdf42282b192e2310a5b463a6d1c1d774e30dc3c791ac37ab42d2616c"
"checksum wasm-bindgen-backend 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)" = "11cdb95816290b525b32587d76419facd99662a07e59d3cdb560488a819d9a45"
"checksum wasm-bindgen-macro 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)" = "574094772ce6921576fb6f2e3f7497b8a76273b6db092be18fc48a082de09dc3"
"checksum wasm-bindgen-macro-support 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)" = "e85031354f25eaebe78bb7db1c3d86140312a911a106b2e29f9cc440ce3e7668"
"checksum wasm-bindgen-shared 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)" = "f5e7e61fc929f4c0dddb748b102ebf9f632e2b8d739f2016542b4de2965a9601"
"checksum wasm-bindgen-webidl 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)" = "ef012a0d93fc0432df126a8eaf547b2dce25a8ce9212e1d3cbeef5c11157975d"
"checksum web-sys 0.3.35 (registry+https://github.com/rust-lang/crates.io-index)" = "aaf97caf6aa8c2b1dac90faf0db529d9d63c93846cca4911856f78a83cebf53b"
"checksum weedle 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3bb43f70885151e629e2a19ce9e50bd730fd436cfd4b666894c9ce4de9141164"
"checksum winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "f10e386af2b13e47c89e7236a7a14a086791a2b88ebad6df9bf42040195cf770"
"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
"checksum winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7168bab6e1daee33b4557efd0e95d5ca70a03706d39fa5f3fe7a236f584b03c9"
"checksum winapi-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4ccfbf554c6ad11084fb7517daca16cfdcaccbdadba4fc336f032a8b12c2ad80"
"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"

4
third_party/rust/mime_guess/Cargo.toml поставляемый
Просмотреть файл

@ -12,7 +12,7 @@
[package]
name = "mime_guess"
version = "2.0.1"
version = "2.0.3"
authors = ["Austin Bonander <austin.bonander@gmail.com>"]
description = "A simple crate for detection of a file's MIME type by its extension."
documentation = "https://docs.rs/mime_guess/"
@ -34,7 +34,7 @@ version = "0.3"
[dependencies.unicase]
version = "2.4.0"
[dev-dependencies.criterion]
version = "0.2"
version = "0.3"
[build-dependencies.unicase]
version = "2.4.0"

30
third_party/rust/mime_guess/README.md поставляемый
Просмотреть файл

@ -12,7 +12,7 @@ Uses a static map of known file extension -> MIME type mappings.
### Versioning
Due to a mistaken premature release, `mime_guess` currently publicly depends on a pre-1.0 `mime`,
which means `mime` upgrades are breaking changes and necessitates a major version bump.
which means `mime` upgrades are breaking changes and necessitate a major version bump.
Refer to the following table to find a version of `mime_guess` which matches your version of `mime`:
| `mime` version | `mime_guess` version |
@ -49,30 +49,26 @@ The latter is only for consistency's sake; the search is case-insensitive.
Simply add or update the appropriate string pair(s) to make the correction(s) needed.
Run `cargo test` to make sure the library continues to work correctly.
#### (Important! Updated as of 2.0.0) Citing the corrected MIME type
#### Important! Citing the corrected MIME type
When opening a pull request, please include a link to an official document or RFC noting
the correct MIME type for the file type in question **as a comment next to the addition**.
The latter is a new requirement as of 2.0.0 which is intended to make auditing easier in the future.
Bulk additions may request to omit this, although please provide a good reason.
the correct MIME type for the file type in question **in the commit message** so
that the commit history can be used as an audit trail.
Though we're only guessing here, we like to be as correct as we can.
It makes it much easier to vet your contribution if we don't have to search for corroborating material.
#### Providing citations for existing types
Historically, citations were only required in pull requests for additions
or corrections to media types; they are now required to be provided in-line
next to the mapping for easier auditing.
If anyone is looking for busy work, finding and adding citations for existing mappings would be an easy
way to get a few pull requests in. See the issue tracker for more information.
#### Multiple MIME types per extension
As of `2.0.0`, multiple MIME types per extension are supported. The first MIME type in the list for a given
extension should be the most "correct" so users who only care about getting a single MIME type can use the `first*()` methods.
As of `2.0.0`, multiple MIME types per extension are supported. The first MIME type in the list for
a given extension should be the most "correct" so users who only care about getting a single MIME
type can use the `first*()` methods.
The defintion of "correct" is open to debate, however. In the author's opinion this should be whatever is defined by the latest IETF RFC
for the given file format, or otherwise explicitly supercedes all others.
The definition of "correct" is open to debate, however. In the author's opinion this should be
whatever is defined by the latest IETF RFC for the given file format, or otherwise explicitly
supercedes all others.
If an official IANA registration replaces an older "experimental" style media type, please
place the new type before the old type in the list, but keep the old type for reference.
#### Changes to the API or operation of the crate

15
third_party/rust/mime_guess/src/mime_types.rs поставляемый
Просмотреть файл

@ -1,14 +1,15 @@
// Probably not exhaustive; keep updated.
/// A mapping of known file extensions and their MIME types.
///
/// Required to be sorted lexicographically by extension for ease of maintenance.
///
/// Multiple MIME types per extension are allowed but MUST be adjacent to each other; the
/// order is arbitrary but the first should be the most prevalent by most recent RFC declaration
/// or explicit succession of other media types.
/// Multiple MIME types per extension are supported; the order is arbitrary but the first should be
/// the most prevalent by most recent RFC declaration or explicit succession of other media types.
///
/// NOTE: when adding or modifying entries, please include a citation in the commit message.
/// If a media type for an extension changed, please keep the old entry but add the new one before
/// it in the slice literal, e.g.:
///
///
/// As of release 2.0.0, new and modified mappings should have citations provided inline
/// in order to provide an audit trail that's easier to follow than Git commit history.
///
/// Sourced from:
/// https://github.com/samuelneff/MimeTypeMap/blob/master/src/MimeTypes/MimeTypeMap.cs
@ -649,7 +650,7 @@ pub static MIME_TYPES: &[(&str, &[&str])] = &[
("mc1", &["application/vnd.medcalcdata"]),
("mcd", &["application/vnd.mcd"]),
("mcurl", &["text/vnd.curl.mcurl"]),
("md", &["text/x-markdown"]),
("md", &["text/markdown", "text/x-markdown"]),
("mda", &["application/msaccess"]),
("mdb", &["application/x-msaccess"]),
("mde", &["application/msaccess"]),

Просмотреть файл

@ -1 +1 @@
{"files":{"Cargo.toml":"61878763ccac1259d4d42ed0787a0dda1a003ccb37d51785f6e5ada5f5eb8942","src/codec.rs":"00846df0051f32ec8b75b2f8e0344422e0693acbd4151aaec31e3ae02d6e696c","src/datagram.rs":"4beb13d5ea7927df6801fbe684dc231626c1856010eaef975d866ee66e894a45","src/incrdecoder.rs":"7b7b7fba57714a3baf0fe881010a9f5a9814bf26b9283a6d56d1c44010cbd822","src/lib.rs":"f6ee17bc45cafdccb562340a4d253a517c5366a74d07c38960aedc2554fe783c","src/log.rs":"943e4e332400d94805d60f965d1d0ae7aad180f6d5b50936d0bd9e085bbc1502","src/once.rs":"d8b2bf7a9e3ce83bdd7f29d8f73ce7ad0268c9618ae7255028fea9f90c9c9fd6","src/timer.rs":"56082a6ecb45bd31c7c677c4c1f0830e55821c860e70b5637b2015fa3be63743","tests/log.rs":"480b165b7907ec642c508b303d63005eee1427115d6973a349eaf6b2242ed18d"},"package":null}
{"files":{"Cargo.toml":"984dfbcc49960dc1ede0d1ec13759be336c7683ea3b3675fd803d7206d6eb68f","src/codec.rs":"00846df0051f32ec8b75b2f8e0344422e0693acbd4151aaec31e3ae02d6e696c","src/datagram.rs":"4beb13d5ea7927df6801fbe684dc231626c1856010eaef975d866ee66e894a45","src/incrdecoder.rs":"7b7b7fba57714a3baf0fe881010a9f5a9814bf26b9283a6d56d1c44010cbd822","src/lib.rs":"f6ee17bc45cafdccb562340a4d253a517c5366a74d07c38960aedc2554fe783c","src/log.rs":"943e4e332400d94805d60f965d1d0ae7aad180f6d5b50936d0bd9e085bbc1502","src/once.rs":"d8b2bf7a9e3ce83bdd7f29d8f73ce7ad0268c9618ae7255028fea9f90c9c9fd6","src/timer.rs":"56082a6ecb45bd31c7c677c4c1f0830e55821c860e70b5637b2015fa3be63743","tests/log.rs":"480b165b7907ec642c508b303d63005eee1427115d6973a349eaf6b2242ed18d"},"package":null}

4
third_party/rust/neqo-common/Cargo.toml поставляемый
Просмотреть файл

@ -1,13 +1,13 @@
[package]
name = "neqo-common"
version = "0.2.0"
version = "0.2.1"
authors = ["Bobby Holley <bobbyholley@gmail.com>"]
edition = "2018"
license = "MIT/Apache-2.0"
[dependencies]
num-traits = "0.2"
log = "0.4.0"
log = {version = "0.4.0", default-features = false}
env_logger = "0.6.1"
lazy_static = "1.3.0"

Просмотреть файл

@ -1 +1 @@
{"files":{"Cargo.toml":"e72807e07438caec6dc6a21ecfc35d8e4703e66a822ec0194aa2258cef4e753f","TODO":"ac0f1c2ebcca03f5b3c0cc56c5aedbb030a4b511e438bc07a57361c789f91e9f","bindings/bindings.toml":"00ff7348732c956b4f8829f00df2b18b3a7211f5fa2a4cea4ae40c0f859e5f50","bindings/mozpkix.hpp":"77072c8bb0f6eb6bfe8cbadc111dcd92e0c79936d13f2e501aae1e5d289a6675","bindings/nspr_err.h":"2d5205d017b536c2d838bcf9bc4ec79f96dd50e7bb9b73892328781f1ee6629d","bindings/nspr_error.h":"e41c03c77b8c22046f8618832c9569fbcc7b26d8b9bbc35eea7168f35e346889","bindings/nspr_io.h":"085b289849ef0e77f88512a27b4d9bdc28252bd4d39c6a17303204e46ef45f72","bindings/nspr_time.h":"2e637fd338a5cf0fd3fb0070a47f474a34c2a7f4447f31b6875f5a9928d0a261","bindings/nss_ciphers.h":"95ec6344a607558b3c5ba8510f463b6295f3a2fb3f538a01410531045a5f62d1","bindings/nss_init.h":"ef49045063782fb612aff459172cc6a89340f15005808608ade5320ca9974310","bindings/nss_p11.h":"0b81e64fe6db49b2ecff94edd850be111ef99ec11220e88ceb1c67be90143a78","bindings/nss_secerr.h":"713e8368bdae5159af7893cfa517dabfe5103cede051dee9c9557c850a2defc6","bindings/nss_ssl.h":"af222fb957b989e392e762fa2125c82608a0053aff4fb97e556691646c88c335","bindings/nss_sslerr.h":"24b97f092183d8486f774cdaef5030d0249221c78343570d83a4ee5b594210ae","bindings/nss_sslopt.h":"b7807eb7abdad14db6ad7bc51048a46b065a0ea65a4508c95a12ce90e59d1eea","build.rs":"eb324a3f076f0079acc0332379bc68ba6fb1232c3f9e44ef63334fe625d569c1","src/aead.rs":"2013408fbcf9e93331ae14d9d6bdd096966f125b3cf48f83e671f537e89d4e77","src/agent.rs":"5f460010eff4a604b23c456b5cff132f995b30767f0188285fdf39d7724ecf6f","src/agentio.rs":"aeb91f3e4c4cc5b8a816307747090c5df02924801511f9523f9d767fe9dd67e9","src/auth.rs":"71ac7e297a5f872d26cf67b6bbd96e4548ea38374bdd84c1094f76a5de4ed1cb","src/cert.rs":"fd3fd2bbb38754bdcee3898549feae412943c9f719032531c1ad6e61783b5394","src/constants.rs":"e756c07525bd7c2ff271e504708f903b3ede0a3ae821446bd37701055eb11f5f","src/err.rs":"04f38831ca62d29d8aadfe9daf95fd29e68ece184e6d3e00bfb9ee1d12744033","src/exp.rs":"61586662407359c1ecb8ed4987bc3c702f26ba2e203a091a51b6d6363cbd510f","src/ext.rs":"bf7b5f23caf26ab14fba3baf0823dd093e4194f759779e4cfd608478312ed58c","src/hkdf.rs":"1bb57806bbf67af74966bb2bb724de9d6b0094c6f5cddbe12d46292d58ba1f16","src/hp.rs":"0384bc676d8cc66a2cfec7be9df176f04557e4f1424c6d19d03ba5687920ac86","src/lib.rs":"49e0ad22fb5aec2e0864b907cb6d419389d53014e33c147f53198b440ec8929f","src/p11.rs":"6e94cbb594b709c3081449bf50d9961d36648b5db95fb824779bff4f45125ad2","src/prio.rs":"bc4e97049563b136cb7b39f5171e7909d56a77ed46690aaacb781eeb4a4743e0","src/replay.rs":"9bc5826cc8be6afe787f0d403b3958245efce9bfbc7b3100734e5aec3f8b9753","src/result.rs":"cef34dfcb907723e195b56501132e4560e250b327783cb5e41201da5b63e9b5c","src/secrets.rs":"531ec0de048f55108f2612d8f330bee18ffd58b3b26124ca290cc14cec8671dc","src/selfencrypt.rs":"02e963e8b9ea0802f7ee64384e5ccef3e31420e75bc1aacd02270dd504ffbdb1","src/ssl.rs":"ee0e638bd0a6ce2f01ecb6a1c1a203ac7a7ae8145b889a0d6f2015f98d65c4b4","src/time.rs":"d77f0f276385603633b2078f05ff9b4dddc8cfb84c595697689876b6996f69d2","tests/aead.rs":"cccac271087fe37d0a890e5da04984bbfacb4bc12331473dfc189e4d6ebff5f2","tests/agent.rs":"4fa8fa803266b985e9b6329e6a218fe7bd779200b8e0cfa94f5813e0ccc10995","tests/ext.rs":"f5edc1f229703f786ec31a8035465c00275223f14a3c4abe52f3c7cf2686cc03","tests/handshake.rs":"bcc687c0e1b485658847faf28a9f5dbfdb297812bed1bd2e80593d5f9e1fee36","tests/hkdf.rs":"0e4853f629050ba4d8069be52b7a441b670d1abaf6b8cd670a8215e0b88beb37","tests/hp.rs":"e6dd3cb4bceebc6fca8f270d8302ef34e14bda6c91fc4f9342ba1681be57ee03","tests/init.rs":"55df7cb95deb629f8701b55a8bcb91e797f30fb10e847a36a0a5a4e80488b002","tests/selfencrypt.rs":"60bfe8a0729cdaa6c2171146083266fa0e625a1d98b5f8735cd22b725d32398b"},"package":null}
{"files":{"Cargo.toml":"0fc77368b4315f185e080214e9555da50d49c90718c9ed14630e408c47c235ec","TODO":"ac0f1c2ebcca03f5b3c0cc56c5aedbb030a4b511e438bc07a57361c789f91e9f","bindings/bindings.toml":"00ff7348732c956b4f8829f00df2b18b3a7211f5fa2a4cea4ae40c0f859e5f50","bindings/mozpkix.hpp":"77072c8bb0f6eb6bfe8cbadc111dcd92e0c79936d13f2e501aae1e5d289a6675","bindings/nspr_err.h":"2d5205d017b536c2d838bcf9bc4ec79f96dd50e7bb9b73892328781f1ee6629d","bindings/nspr_error.h":"e41c03c77b8c22046f8618832c9569fbcc7b26d8b9bbc35eea7168f35e346889","bindings/nspr_io.h":"085b289849ef0e77f88512a27b4d9bdc28252bd4d39c6a17303204e46ef45f72","bindings/nspr_time.h":"2e637fd338a5cf0fd3fb0070a47f474a34c2a7f4447f31b6875f5a9928d0a261","bindings/nss_ciphers.h":"95ec6344a607558b3c5ba8510f463b6295f3a2fb3f538a01410531045a5f62d1","bindings/nss_init.h":"ef49045063782fb612aff459172cc6a89340f15005808608ade5320ca9974310","bindings/nss_p11.h":"0b81e64fe6db49b2ecff94edd850be111ef99ec11220e88ceb1c67be90143a78","bindings/nss_secerr.h":"713e8368bdae5159af7893cfa517dabfe5103cede051dee9c9557c850a2defc6","bindings/nss_ssl.h":"af222fb957b989e392e762fa2125c82608a0053aff4fb97e556691646c88c335","bindings/nss_sslerr.h":"24b97f092183d8486f774cdaef5030d0249221c78343570d83a4ee5b594210ae","bindings/nss_sslopt.h":"b7807eb7abdad14db6ad7bc51048a46b065a0ea65a4508c95a12ce90e59d1eea","build.rs":"4250bc8cecf44ec155b2bf4119303f3a0bbcccce461db237e3f34da1636e8511","src/aead.rs":"2013408fbcf9e93331ae14d9d6bdd096966f125b3cf48f83e671f537e89d4e77","src/agent.rs":"5f460010eff4a604b23c456b5cff132f995b30767f0188285fdf39d7724ecf6f","src/agentio.rs":"aeb91f3e4c4cc5b8a816307747090c5df02924801511f9523f9d767fe9dd67e9","src/auth.rs":"71ac7e297a5f872d26cf67b6bbd96e4548ea38374bdd84c1094f76a5de4ed1cb","src/cert.rs":"fd3fd2bbb38754bdcee3898549feae412943c9f719032531c1ad6e61783b5394","src/constants.rs":"e756c07525bd7c2ff271e504708f903b3ede0a3ae821446bd37701055eb11f5f","src/err.rs":"04f38831ca62d29d8aadfe9daf95fd29e68ece184e6d3e00bfb9ee1d12744033","src/exp.rs":"61586662407359c1ecb8ed4987bc3c702f26ba2e203a091a51b6d6363cbd510f","src/ext.rs":"bf7b5f23caf26ab14fba3baf0823dd093e4194f759779e4cfd608478312ed58c","src/hkdf.rs":"1bb57806bbf67af74966bb2bb724de9d6b0094c6f5cddbe12d46292d58ba1f16","src/hp.rs":"0384bc676d8cc66a2cfec7be9df176f04557e4f1424c6d19d03ba5687920ac86","src/lib.rs":"49e0ad22fb5aec2e0864b907cb6d419389d53014e33c147f53198b440ec8929f","src/p11.rs":"6e94cbb594b709c3081449bf50d9961d36648b5db95fb824779bff4f45125ad2","src/prio.rs":"bc4e97049563b136cb7b39f5171e7909d56a77ed46690aaacb781eeb4a4743e0","src/replay.rs":"9bc5826cc8be6afe787f0d403b3958245efce9bfbc7b3100734e5aec3f8b9753","src/result.rs":"cef34dfcb907723e195b56501132e4560e250b327783cb5e41201da5b63e9b5c","src/secrets.rs":"531ec0de048f55108f2612d8f330bee18ffd58b3b26124ca290cc14cec8671dc","src/selfencrypt.rs":"02e963e8b9ea0802f7ee64384e5ccef3e31420e75bc1aacd02270dd504ffbdb1","src/ssl.rs":"ee0e638bd0a6ce2f01ecb6a1c1a203ac7a7ae8145b889a0d6f2015f98d65c4b4","src/time.rs":"d77f0f276385603633b2078f05ff9b4dddc8cfb84c595697689876b6996f69d2","tests/aead.rs":"cccac271087fe37d0a890e5da04984bbfacb4bc12331473dfc189e4d6ebff5f2","tests/agent.rs":"4fa8fa803266b985e9b6329e6a218fe7bd779200b8e0cfa94f5813e0ccc10995","tests/ext.rs":"f5edc1f229703f786ec31a8035465c00275223f14a3c4abe52f3c7cf2686cc03","tests/handshake.rs":"bcc687c0e1b485658847faf28a9f5dbfdb297812bed1bd2e80593d5f9e1fee36","tests/hkdf.rs":"0e4853f629050ba4d8069be52b7a441b670d1abaf6b8cd670a8215e0b88beb37","tests/hp.rs":"e6dd3cb4bceebc6fca8f270d8302ef34e14bda6c91fc4f9342ba1681be57ee03","tests/init.rs":"55df7cb95deb629f8701b55a8bcb91e797f30fb10e847a36a0a5a4e80488b002","tests/selfencrypt.rs":"60bfe8a0729cdaa6c2171146083266fa0e625a1d98b5f8735cd22b725d32398b"},"package":null}

6
third_party/rust/neqo-crypto/Cargo.toml поставляемый
Просмотреть файл

@ -1,6 +1,6 @@
[package]
name = "neqo-crypto"
version = "0.2.0"
version = "0.2.1"
authors = ["Martin Thomson <mt@lowentropy.net>"]
edition = "2018"
build = "build.rs"
@ -8,10 +8,10 @@ license = "MIT/Apache-2.0"
[dependencies]
neqo-common = { path = "../neqo-common" }
log = "0.4.0"
log = {version = "0.4.0", default-features = false}
[build-dependencies]
bindgen = {version = "0.51", default-features = false}
bindgen = {version = "0.53.2", default-features = false}
serde = "1.0"
serde_derive = "1.0"
toml = "0.4"

2
third_party/rust/neqo-crypto/build.rs поставляемый
Просмотреть файл

@ -226,7 +226,7 @@ fn build_bindings(base: &str, bindings: &Bindings, flags: &[String], gecko: bool
let mut builder = Builder::default().header(header);
builder = builder.generate_comments(false);
builder = builder.derive_debug(false); // https://github.com/rust-lang/rust-bindgen/issues/372
builder = builder.size_t_is_usize(true);
builder = builder.clang_arg("-v");

Просмотреть файл

@ -1 +1 @@
{"files":{"Cargo.toml":"0306007b0f3347e400f1a355353d1abd129e384c5896974e22856028a060a531","src/client_events.rs":"8e77e6e92c3d5933621f2baee3baacab230486ad8b6df1eca321ea74ed7cdcbd","src/connection.rs":"8499ea115fc061eb5d2eedb0a5cac6069a255ad756e6e89ce2f6e6a8dc5772fc","src/connection_client.rs":"b803756b3a81f16757e672023a1424c1f60b07ca9f5351475258814e92ab0a2c","src/connection_server.rs":"a32edf220f4664dccfc80141128a211d9997d86e8e988726c1380836015f1d0e","src/control_stream_local.rs":"319f8277fc4765b31a4a094bfd663e681d71831532925b0043bae5da96202e64","src/control_stream_remote.rs":"c205633af8539cd55f289071c6845b5bb2b0a9778f15976829c5d4a492360e19","src/hframe.rs":"5b580d431ae9639bebfa1868a8f4f358e46884c34b81011126745e64244e4323","src/hsettings_frame.rs":"349a4413ce13f03e05264e6c4b22d231276a1c96e3983aada4478b038ec89dbc","src/lib.rs":"383bfaacfe138a7cbbd9162973a430016ee0fc59cd3ae087743cf37c148f7edd","src/response_stream.rs":"808c40e0bc51599e2b253cf9d535ae8404abaccc7fd875f8e08eafdfaeab3012","src/server.rs":"212b98c363c0160304eaf02bb73dad6138236f52390ab7664ce4984657fdcca3","src/server_connection_events.rs":"d2b973a095f29cb0ac6fb84705165b034960d09b2dde7693bab96e6b802c6fba","src/server_events.rs":"f997bd329d45115f6a527eba8f0f1ecf21c0dd9a3184f08fc5002e34f4cfe2f0","src/stream_type_reader.rs":"da2b7b0358cb4829493cb964cae67c85e9efdf4127958aade7a56733ddc4f12e","src/transaction_client.rs":"8a96f2acb0cd6f7c09d1e9b92a71171a474d46c7e21b55e546aa4d6c330981d3","src/transaction_server.rs":"1af45a238950acfc563484d2b5ebe805a83bdcc1096f5c03ed8d180c4e7428d5","tests/httpconn.rs":"7955f6ac4406b5d770e0fb10258aff529a1c01020374dfc5f85d8608abb68f6f"},"package":null}
{"files":{"Cargo.toml":"916bfc8b33c1dca1d5f1906b04b10036f2b229e20fe8dd8d488f1f6f776403b0","src/client_events.rs":"8e77e6e92c3d5933621f2baee3baacab230486ad8b6df1eca321ea74ed7cdcbd","src/connection.rs":"8499ea115fc061eb5d2eedb0a5cac6069a255ad756e6e89ce2f6e6a8dc5772fc","src/connection_client.rs":"b803756b3a81f16757e672023a1424c1f60b07ca9f5351475258814e92ab0a2c","src/connection_server.rs":"a32edf220f4664dccfc80141128a211d9997d86e8e988726c1380836015f1d0e","src/control_stream_local.rs":"319f8277fc4765b31a4a094bfd663e681d71831532925b0043bae5da96202e64","src/control_stream_remote.rs":"c205633af8539cd55f289071c6845b5bb2b0a9778f15976829c5d4a492360e19","src/hframe.rs":"5b580d431ae9639bebfa1868a8f4f358e46884c34b81011126745e64244e4323","src/hsettings_frame.rs":"349a4413ce13f03e05264e6c4b22d231276a1c96e3983aada4478b038ec89dbc","src/lib.rs":"383bfaacfe138a7cbbd9162973a430016ee0fc59cd3ae087743cf37c148f7edd","src/response_stream.rs":"808c40e0bc51599e2b253cf9d535ae8404abaccc7fd875f8e08eafdfaeab3012","src/server.rs":"212b98c363c0160304eaf02bb73dad6138236f52390ab7664ce4984657fdcca3","src/server_connection_events.rs":"d2b973a095f29cb0ac6fb84705165b034960d09b2dde7693bab96e6b802c6fba","src/server_events.rs":"f997bd329d45115f6a527eba8f0f1ecf21c0dd9a3184f08fc5002e34f4cfe2f0","src/stream_type_reader.rs":"da2b7b0358cb4829493cb964cae67c85e9efdf4127958aade7a56733ddc4f12e","src/transaction_client.rs":"8a96f2acb0cd6f7c09d1e9b92a71171a474d46c7e21b55e546aa4d6c330981d3","src/transaction_server.rs":"1af45a238950acfc563484d2b5ebe805a83bdcc1096f5c03ed8d180c4e7428d5","tests/httpconn.rs":"7955f6ac4406b5d770e0fb10258aff529a1c01020374dfc5f85d8608abb68f6f"},"package":null}

4
third_party/rust/neqo-http3/Cargo.toml поставляемый
Просмотреть файл

@ -1,6 +1,6 @@
[package]
name = "neqo-http3"
version = "0.2.0"
version = "0.2.1"
authors = ["Dragana Damjanovic <dragana.damjano@gmail.com>"]
edition = "2018"
license = "MIT/Apache-2.0"
@ -11,7 +11,7 @@ neqo-crypto = { path = "./../neqo-crypto" }
neqo-transport = { path = "./../neqo-transport" }
neqo-qpack = { path = "./../neqo-qpack" }
num-traits = "0.2"
log = "0.4.0"
log = {version = "0.4.0", default-features = false}
smallvec = "1.0.0"
[dev-dependencies]

Просмотреть файл

@ -1 +1 @@
{"files":{"Cargo.toml":"7f54a2ebb0f59739f00a094404ae39d3ba61efbdd6e0ef416187f857e0726362","src/decoder.rs":"aac6d5b3dfb19779351c2568a4c54c551e2de83d0e458246c818a6af15514477","src/encoder.rs":"992bb211273d48b9d85ab4bc6bad5c0dbc5c12e7f9e7c1bb35f1b0db5eb7cffe","src/huffman.rs":"720eedace45205098a0b2210c876906ce15b7be469a799e75e70baafac8adee8","src/huffman_decode_helper.rs":"e4734353591770dfe9a9047b0be5d9068150433e9cea8cad029444b42b0afa39","src/huffman_table.rs":"06fea766a6276ac56c7ee0326faed800a742c15fda1f33bf2513e6cc6a5e6d27","src/lib.rs":"fa5b76f6b7db74904fe0317bbc1214292494365328c2efa06b4146cbd2ee6c1b","src/qpack_helper.rs":"200ab8bcb60728e3bcacf25b7006fa54b544458bfee5e66e09fa472a614347fc","src/qpack_send_buf.rs":"471e3b0af9f8783aa1bfe11a1959bf5694e62bc2d8e1cf783c933af81e3f3cf9","src/static_table.rs":"fda9d5c6f38f94b0bf92d3afdf8432dce6e27e189736596e16727090c77b78ec","src/table.rs":"1043a6e0761d9ff05a35dfab3b5a0e871d1b1666e83bc4fbd9e97383ca44e59e"},"package":null}
{"files":{"Cargo.toml":"4e79b0649553984849559edfa1002c9acf220bd2856af843439078582d19737f","src/decoder.rs":"aac6d5b3dfb19779351c2568a4c54c551e2de83d0e458246c818a6af15514477","src/encoder.rs":"992bb211273d48b9d85ab4bc6bad5c0dbc5c12e7f9e7c1bb35f1b0db5eb7cffe","src/huffman.rs":"720eedace45205098a0b2210c876906ce15b7be469a799e75e70baafac8adee8","src/huffman_decode_helper.rs":"e4734353591770dfe9a9047b0be5d9068150433e9cea8cad029444b42b0afa39","src/huffman_table.rs":"06fea766a6276ac56c7ee0326faed800a742c15fda1f33bf2513e6cc6a5e6d27","src/lib.rs":"fa5b76f6b7db74904fe0317bbc1214292494365328c2efa06b4146cbd2ee6c1b","src/qpack_helper.rs":"200ab8bcb60728e3bcacf25b7006fa54b544458bfee5e66e09fa472a614347fc","src/qpack_send_buf.rs":"471e3b0af9f8783aa1bfe11a1959bf5694e62bc2d8e1cf783c933af81e3f3cf9","src/static_table.rs":"fda9d5c6f38f94b0bf92d3afdf8432dce6e27e189736596e16727090c77b78ec","src/table.rs":"1043a6e0761d9ff05a35dfab3b5a0e871d1b1666e83bc4fbd9e97383ca44e59e"},"package":null}

4
third_party/rust/neqo-qpack/Cargo.toml поставляемый
Просмотреть файл

@ -1,6 +1,6 @@
[package]
name = "neqo-qpack"
version = "0.2.0"
version = "0.2.1"
authors = ["Dragana Damjanovic <dragana.damjano@gmail.com>"]
edition = "2018"
license = "MIT/Apache-2.0"
@ -9,7 +9,7 @@ license = "MIT/Apache-2.0"
neqo-common = { path = "./../neqo-common" }
neqo-transport = { path = "./../neqo-transport" }
neqo-crypto = { path = "./../neqo-crypto" }
log = "0.4.0"
log = {version = "0.4.0", default-features = false}
[dev-dependencies]
test-fixture = { path = "../test-fixture" }

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше