Bug 1587468 - Update failure_derive and malloc_size_of_derive. r=heycam

This removes an old version of synstructure.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Emilio Cobos Álvarez 2019-11-18 02:31:58 +00:00
Родитель 6ce098c064
Коммит 716f5cc49d
40 изменённых файлов: 722 добавлений и 3119 удалений

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

@ -316,8 +316,8 @@ version = "0.2.0"
dependencies = [
"bits 0.2.0",
"comedy 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"failure_derive 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"failure_derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"guid_win 0.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)",
"rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
@ -332,8 +332,8 @@ dependencies = [
"bits_client 0.2.0",
"comedy 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
"failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"failure_derive 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"failure_derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.59 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"moz_task 0.1.0",
@ -537,8 +537,8 @@ name = "comedy"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"failure_derive 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"failure_derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -645,8 +645,8 @@ dependencies = [
"cranelift-codegen-meta 0.46.1 (git+https://github.com/CraneStation/Cranelift?rev=da179e4fd83d49b7ad6c9f286b1ea04d4f64907e)",
"cranelift-codegen-shared 0.46.1 (git+https://github.com/CraneStation/Cranelift?rev=da179e4fd83d49b7ad6c9f286b1ea04d4f64907e)",
"cranelift-entity 0.46.1 (git+https://github.com/CraneStation/Cranelift?rev=da179e4fd83d49b7ad6c9f286b1ea04d4f64907e)",
"failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"failure_derive 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"failure_derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)",
"target-lexicon 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -695,8 +695,8 @@ dependencies = [
"cranelift-codegen 0.46.1 (git+https://github.com/CraneStation/Cranelift?rev=da179e4fd83d49b7ad6c9f286b1ea04d4f64907e)",
"cranelift-entity 0.46.1 (git+https://github.com/CraneStation/Cranelift?rev=da179e4fd83d49b7ad6c9f286b1ea04d4f64907e)",
"cranelift-frontend 0.46.1 (git+https://github.com/CraneStation/Cranelift?rev=da179e4fd83d49b7ad6c9f286b1ea04d4f64907e)",
"failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"failure_derive 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"failure_derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"wasmparser 0.39.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -1089,22 +1089,22 @@ dependencies = [
[[package]]
name = "failure"
version = "0.1.3"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"backtrace 0.3.38 (registry+https://github.com/rust-lang/crates.io-index)",
"failure_derive 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"failure_derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "failure_derive"
version = "0.1.3"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.15.30 (registry+https://github.com/rust-lang/crates.io-index)",
"synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2 1.0.5 (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.5 (registry+https://github.com/rust-lang/crates.io-index)",
"synstructure 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -1737,7 +1737,7 @@ version = "0.1.0"
dependencies = [
"atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
"failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.59 (registry+https://github.com/rust-lang/crates.io-index)",
"lmdb-rkv 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1881,7 +1881,7 @@ dependencies = [
"bincode 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"cranelift-entity 0.41.0 (git+https://github.com/PLSysSec/lucet_sandbox_compiler)",
"failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"num-derive 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
"object 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1911,7 +1911,7 @@ dependencies = [
"bitflags 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"cc 1.0.47 (registry+https://github.com/rust-lang/crates.io-index)",
"failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"getrandom 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.59 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1930,7 +1930,7 @@ version = "0.1.1"
source = "git+https://github.com/PLSysSec/lucet_sandbox_compiler#5c22392b5b1aaa60e915c75e92b57391e1e61e6d"
dependencies = [
"cast 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.59 (registry+https://github.com/rust-lang/crates.io-index)",
"lucet-module 0.1.1 (git+https://github.com/PLSysSec/lucet_sandbox_compiler)",
"lucet-runtime 0.1.1 (git+https://github.com/PLSysSec/lucet_sandbox_compiler)",
@ -1978,12 +1978,12 @@ dependencies = [
[[package]]
name = "malloc_size_of_derive"
version = "0.1.0"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.15.30 (registry+https://github.com/rust-lang/crates.io-index)",
"synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
"synstructure 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -2996,7 +2996,7 @@ name = "redox_users"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)",
"rust-argon2 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -3078,7 +3078,7 @@ dependencies = [
"bincode 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lmdb-rkv 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)",
"ordered-float 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -3097,7 +3097,7 @@ dependencies = [
"bincode 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"id-arena 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)",
"lmdb-rkv 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)",
@ -3114,7 +3114,7 @@ name = "rlbox_lucet_sandbox"
version = "0.1.0"
source = "git+https://github.com/PLSysSec/rlbox_lucet_sandbox/?rev=997c648eb0eaeaaa7a00a9eee20431f750b4e190#997c648eb0eaeaaa7a00a9eee20431f750b4e190"
dependencies = [
"failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"goblin 0.0.24 (registry+https://github.com/rust-lang/crates.io-index)",
"lucet-module 0.1.1 (git+https://github.com/PLSysSec/lucet_sandbox_compiler)",
"lucet-runtime 0.1.1 (git+https://github.com/PLSysSec/lucet_sandbox_compiler)",
@ -3170,7 +3170,7 @@ dependencies = [
"byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"digest 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"murmurhash3 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -3551,7 +3551,7 @@ dependencies = [
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"malloc_size_of 0.0.1",
"malloc_size_of_derive 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"malloc_size_of_derive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"new_debug_unreachable 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"nsstring 0.1.0",
@ -3607,7 +3607,7 @@ dependencies = [
"euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"malloc_size_of 0.0.1",
"malloc_size_of_derive 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"malloc_size_of_derive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.21.0",
"serde 1.0.88 (registry+https://github.com/rust-lang/crates.io-index)",
"servo_arc 0.1.1",
@ -3661,17 +3661,6 @@ dependencies = [
"unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "synstructure"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.15.30 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "synstructure"
version = "0.12.1"
@ -3688,8 +3677,8 @@ name = "target-lexicon"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"failure_derive 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"failure_derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -4182,7 +4171,7 @@ dependencies = [
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.59 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"malloc_size_of_derive 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"malloc_size_of_derive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
"plane-split 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rayon 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -4211,7 +4200,7 @@ dependencies = [
"core-graphics 0.17.3 (registry+https://github.com/rust-lang/crates.io-index)",
"derive_more 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)",
"malloc_size_of_derive 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"malloc_size_of_derive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"peek-poke 0.2.0",
"serde 1.0.88 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_bytes 0.11.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -4451,7 +4440,7 @@ version = "0.1.0"
dependencies = [
"crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
"cstr 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.59 (registry+https://github.com/rust-lang/crates.io-index)",
"lmdb-rkv 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)",
@ -4585,8 +4574,8 @@ dependencies = [
"checksum env_logger 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "aafcde04e90a5226a6443b7aabdb016ba2f8307c847d524724bd9b346dd1a2d3"
"checksum error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ff511d5dc435d703f4971bc399647c9bc38e20cb41452e3b9feb4765419ed3f3"
"checksum euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2c4786521fec183792e755bf32cd0188e4e7628c6d0fcfd51426435b9081a106"
"checksum failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6dd377bcc1b1b7ce911967e3ec24fa19c3224394ec05b54aa7b083d498341ac7"
"checksum failure_derive 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "64c2d913fe8ed3b6c6518eedf4538255b989945c14c2a7d5cbff62a5e2120596"
"checksum failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "f8273f13c977665c5db7eb2b99ae520952fe5ac831ae4cd09d80c4c7042b5ed9"
"checksum failure_derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0bc225b78e0391e4b8683440bf2e63c2deeeb2ce5189eab46e2b68c6d3725d08"
"checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed"
"checksum filetime_win 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b8c37abd4a58e0cb794bcae4a7dc4f02fff376949d8d1066d4c729e97bfb38ec"
"checksum flate2 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)" = "2adaffba6388640136149e18ed080b77a78611c1e1d6de75aedcdf78df5d4682"
@ -4654,7 +4643,7 @@ dependencies = [
"checksum lzw 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7d947cbb889ed21c2a84be6ffbaebf5b4e0f4340638cba0444907e38b56be084"
"checksum mach 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa"
"checksum malloc_buf 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb"
"checksum malloc_size_of_derive 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "35adee9ed962cf7d07d62cb58bc45029f3227f5b5b86246caa8632f06c187bc3"
"checksum malloc_size_of_derive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e37c5d4cd9473c5f4c9c111f033f15d4df9bd378fdf615944e360a4f55a05f0b"
"checksum mapped_hyph 0.3.0 (git+https://github.com/jfkthame/mapped_hyph.git?tag=v0.3.0)" = "<none>"
"checksum matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "100aabe6b8ff4e4a7e32c1c13523379802df0772b82466207ac25b013f193376"
"checksum memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2efc7bc57c883d4a4d6e3246905283d8dae951bb3bd32f49d6ef297f546e1c39"
@ -4800,7 +4789,6 @@ dependencies = [
"checksum svg_fmt 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c666f0fed8e1e20e057af770af9077d72f3d5a33157b8537c1475dd8ffd6d32b"
"checksum syn 0.15.30 (registry+https://github.com/rust-lang/crates.io-index)" = "66c8865bf5a7cbb662d8b011950060b3c8743dca141b054bf7195b20d314d8e2"
"checksum syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "66850e97125af79138385e9b88339cbcd037e3f28ceab8c5ad98e64f0f1f80bf"
"checksum synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "73687139bf99285483c96ac0add482c3776528beac1d97d444f6e91f203a2015"
"checksum synstructure 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3f085a5855930c0441ca1288cf044ea4aecf4f43a91668abdb870b4ba546a203"
"checksum target-lexicon 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7975cb2c6f37d77b190bc5004a2bb015971464756fde9514651a525ada2a741a"
"checksum tempfile 3.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "7e91405c14320e5c79b3d148e1c86f40749a36e490642202a31689cb1a3452b2"

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

@ -1 +1 @@
{"files":{"CODE_OF_CONDUCT.md":"9a7bc3fdffac1288f51485e70a910a4e9de1260a64fbe894f60ad73b3386dda9","Cargo.toml":"2e6b46b3ac49b9890868cd4ea2118efbaf4ca80e136a1b5b417ce95ea91fb293","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3","Makefile":"61a649ecb55115ba0f357215eb322fa6676ce163ca20bff59d7c5e275aa37035","README.md":"d4dba8ed8b388c1e24bcaaa0f0e75a0830885d6db9bedc9630591a180c744f73","RELEASES.md":"42304b5bc4cfd3a5f93d17bfe34d24f6b8bb918e89c57425adbb503f500b558c","book/src/SUMMARY.md":"32f211f5aeb51a05b3c6a41a128bdb9e410ae84008a93e6b13442e45cd1c91d4","book/src/bail-and-ensure.md":"08fb463570143ec6568189468f1f54a7210b0a1ad66a57f7f7c36619831b4d72","book/src/custom-fail.md":"d4b1501201f9c54637bc40a2413e333f6f7d4fcfc8e3de74bf40d48eca0d4e41","book/src/derive-fail.md":"69916338286f970ae6709fb309bd4d80c321fea10b927f14efe402e3c0a5fdc9","book/src/error-errorkind.md":"40663de622bfb89a3dedcf6e093ec61eb1ab704d512d725e33f66aec38911757","book/src/error-msg.md":"2ab003bde8e88e0e3b9d1559d95e84b0ca7068522e324235bc4b2fdb88996d51","book/src/error.md":"c978778e7986e5febfb37e635525053ef73c534e4b6e9fc25deb576fdbdc111d","book/src/fail.md":"076ed560e9ad293bf99611f9407d4dc17310c42cf1652dd1f3f4be85fb5f17b8","book/src/guidance.md":"614cb85ae32c2b59119cd1db7eea008e50b051563c15ba1305f312fa2eeb3ac0","book/src/howto.md":"e18744011f5cc5779f5bb981ebd10f0af440c98398b2eb5af0ee27b9662ee410","book/src/intro.md":"eeb23e1ac3ccf75c4779603662910e96df647a02c73665a206dcc34c56d77eaf","book/src/string-custom-error.md":"f1d94e211f1d2dfb2d9d9a0d7eb745b8ea7f08f26243283fddb440cb099893ff","book/src/use-error.md":"a7f91e06eb676318da04a56e4b31c73dd7db888d43c215e1534a5bc415e98258","build-docs.sh":"27b611219773192b9f972b2054522481fd5c2c9419c155535f58d05bfc31fffe","examples/bail_ensure.rs":"fffc71e41f9fbbc2a7db453ef20779716007ed6bbb01e45fbcefb1e073745ecc","examples/error_as_cause.rs":"e0a6472455db5e484febc196667bc46c939d9f890bfe550ab7435d52b1ac6b2b","examples/simple.rs":"7a5fc0673b6bb5bd3716416a6545f7ff471d182292a2c8424cf18bc4a72f6936","examples/string_custom_error_pattern.rs":"23b5bf79a7219aa8a80484c0df70cd43d882b7dccd91de9ceb1aac05b0b1b4f2","src/as_fail.rs":"8a381a9624b3d28b45f92f8b527d7496e7a722c8aa0d632f0b23bbe0af98a76e","src/backtrace/internal.rs":"3fc4943061d4396c855571f134cd922f428cbe930689c8191376867b729d7b08","src/backtrace/mod.rs":"df3a348300775182c2780c542f119c989a6004cff841d817bdf7b93eef9a0dd3","src/box_std.rs":"224f3e3f48ad217ba34a54a62f608f9cba3ce95b176558684706c2f7fe72ce72","src/compat.rs":"97ed4fa49ac80c915b384b29a1bf678430cf1ea8ea61aa794a6014a1c3217762","src/context.rs":"d91ed85add638af7c9d481cb82ee6633c3678978951a5530c166fc156efac2e4","src/error/error_impl.rs":"063b9d9127f455b7555184af2576bc59e650add13c820be4960a3a5e5da0a9e4","src/error/error_impl_small.rs":"e6cbbd4d12e8eec1bd0f15713d33a0e525599268c9316dd40240eb7cd9e19a9d","src/error/mod.rs":"103621b313bd729c94054c5d88edd59d8c07311b650873e81b5021362647ae7a","src/error_message.rs":"2a45a3bd142e6547fc5da27c182fb690e2990de11db2a9b8ce63e50d9c589997","src/lib.rs":"0969303376ab328e16d7c64d690fc71a1e4eee00b413e79009cd590a2c4abbc0","src/macros.rs":"47cc9c73291e6edb3365d72b772d781215d123240f89a5fff914d23927781efa","src/result_ext.rs":"8088c3cb1481e81891014c99cc0f1b75f25a2f212b52ae856583e4c1f1901d09","src/small_error.rs":"652bf6ff2016d8e31b6ee709ad3efaff9f4e96d5aec8120ea3986a0bb8f57c54","src/sync_failure.rs":"a92a2e8b416196322718a4e7e1262f5b1b0a6be47b849d9a7e1050c1d33490db","travis.sh":"836024f7a56fdbe24a99ab9ce9350713831f4375a60f02593aad6637b766a330"},"package":"6dd377bcc1b1b7ce911967e3ec24fa19c3224394ec05b54aa7b083d498341ac7"}
{"files":{"CODE_OF_CONDUCT.md":"9a7bc3fdffac1288f51485e70a910a4e9de1260a64fbe894f60ad73b3386dda9","Cargo.lock":"3206fd88e783a8cc7da73232c080b0b7d7a3c8332d5b2976f0c0c4afa873befb","Cargo.lock.ci":"3c1120d0dc287aa2966eb168521ec84016b09f7f335c6d320f1bee1d367a618e","Cargo.toml":"55a4adc0822ccc0826689542349068af9b83eec4523802b410c1c607daa0e029","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3","Makefile":"61a649ecb55115ba0f357215eb322fa6676ce163ca20bff59d7c5e275aa37035","README.md":"bce9d1eae485cda6c5f9ed94fef92c30d60de117a1e3a23563b9308be1bf5d55","RELEASES.md":"3314fd66e694c74ee389796c0307c1ac94e93c62bf9cb7cc3b029d5396244feb","book/src/SUMMARY.md":"32f211f5aeb51a05b3c6a41a128bdb9e410ae84008a93e6b13442e45cd1c91d4","book/src/bail-and-ensure.md":"08fb463570143ec6568189468f1f54a7210b0a1ad66a57f7f7c36619831b4d72","book/src/custom-fail.md":"d4b1501201f9c54637bc40a2413e333f6f7d4fcfc8e3de74bf40d48eca0d4e41","book/src/derive-fail.md":"69916338286f970ae6709fb309bd4d80c321fea10b927f14efe402e3c0a5fdc9","book/src/error-errorkind.md":"5aae25fce531e9740aa70343bcda3de0f2718949922c2e4a91ceb09062c45892","book/src/error-msg.md":"32e17b280379d2bc83e7cb7a6c664a2e9225802f31638beda508056da53ba6af","book/src/error.md":"c978778e7986e5febfb37e635525053ef73c534e4b6e9fc25deb576fdbdc111d","book/src/fail.md":"2865d1fef1d94de5fc086306ba5a734b26dd1d60effa718906919557bf4d779c","book/src/guidance.md":"614cb85ae32c2b59119cd1db7eea008e50b051563c15ba1305f312fa2eeb3ac0","book/src/howto.md":"e18744011f5cc5779f5bb981ebd10f0af440c98398b2eb5af0ee27b9662ee410","book/src/intro.md":"2a6eed661e059016d067d2891e9e27b673425dbc87f077849a302619a182d112","book/src/string-custom-error.md":"55e3ef77748c1dcdfe984fe3c510e7001267ac2b3ece230b90844655dd2da957","book/src/use-error.md":"a7f91e06eb676318da04a56e4b31c73dd7db888d43c215e1534a5bc415e98258","build-docs.sh":"27b611219773192b9f972b2054522481fd5c2c9419c155535f58d05bfc31fffe","examples/bail_ensure.rs":"fffc71e41f9fbbc2a7db453ef20779716007ed6bbb01e45fbcefb1e073745ecc","examples/error_as_cause.rs":"e0a6472455db5e484febc196667bc46c939d9f890bfe550ab7435d52b1ac6b2b","examples/simple.rs":"39b2263d4b92f22c9e1ceefb78b67e1299fc46eba5621d1c47afd937fd7d5318","examples/string_custom_error_pattern.rs":"23b5bf79a7219aa8a80484c0df70cd43d882b7dccd91de9ceb1aac05b0b1b4f2","src/as_fail.rs":"6d4f549f8c9d8abcfbb0a70fe5c0853c82f1c127f87f94fc14c06e2fdaf09db1","src/backtrace/internal.rs":"ff809782e9f9f17928595e00d1bc2f3ff8ccf9b48482126049a318d34957ceb6","src/backtrace/mod.rs":"33c7988b61db9995260fd4470821ea4bce5316052d4c41b4326f99dcc9858b0e","src/box_std.rs":"0455cd53c4a7e5150574ea7c30d5d2692e7e0ff98a83a2fd9656f62600077112","src/compat.rs":"8825b752a92cf1f902424be83b139fa76c85bd016e27565e2ec2fe5dfb4759aa","src/context.rs":"0ee2a96a5c84761bdba37c65babdfd8c556747778a8cac649cdc18747f7d15ba","src/error/error_impl.rs":"74b3337d9dc16de0bdd1cd355841f7035972cded053d7a213590c11c3463d595","src/error/error_impl_small.rs":"e6cbbd4d12e8eec1bd0f15713d33a0e525599268c9316dd40240eb7cd9e19a9d","src/error/mod.rs":"a4f7c1db02d3d16034993b78f5e93d36f70a23ef9218375f952034effd5d58bc","src/error_message.rs":"9c45597e8237c601c4c49aa07adeab41126d38f0886789acf3f8874bb149c6be","src/lib.rs":"11ff9348d697afbf44f73eb82d1cd22509ce4064bd41929fd5fbc677e4d04a42","src/macros.rs":"351758673f77384f82ff3373d96f378706b07ff7ef9c98788a21ae8b1cc70359","src/result_ext.rs":"8088c3cb1481e81891014c99cc0f1b75f25a2f212b52ae856583e4c1f1901d09","src/small_error.rs":"652bf6ff2016d8e31b6ee709ad3efaff9f4e96d5aec8120ea3986a0bb8f57c54","src/sync_failure.rs":"a92a2e8b416196322718a4e7e1262f5b1b0a6be47b849d9a7e1050c1d33490db","tests/basic_fail.rs":"d24b8a90a5a122287eedc91c7322a162f2e0c124494a1084c8dc13c711db278b","tests/fail_compat.rs":"ffc1db79138168a618889d8eb1917d3963e6367a3fc5b2541d3120c480a73310","tests/macro_trailing_comma.rs":"e98caf539fa5e34bb11cd0f7c2a315190cdb8b2aeadeb12c706c19f1f5e8cf3e","travis.sh":"836024f7a56fdbe24a99ab9ce9350713831f4375a60f02593aad6637b766a330"},"package":"f8273f13c977665c5db7eb2b99ae520952fe5ac831ae4cd09d80c4c7042b5ed9"}

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

@ -0,0 +1,116 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
[[package]]
name = "backtrace"
version = "0.3.38"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"backtrace-sys 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)",
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "backtrace-sys"
version = "0.1.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cc 1.0.45 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "cc"
version = "1.0.45"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "cfg-if"
version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "failure"
version = "0.1.6"
dependencies = [
"backtrace 0.3.38 (registry+https://github.com/rust-lang/crates.io-index)",
"failure_derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "failure_derive"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 1.0.5 (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.5 (registry+https://github.com/rust-lang/crates.io-index)",
"synstructure 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "libc"
version = "0.2.62"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "proc-macro2"
version = "1.0.5"
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)",
]
[[package]]
name = "quote"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "rustc-demangle"
version = "0.1.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "syn"
version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 1.0.5 (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]]
name = "synstructure"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 1.0.5 (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.5 (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 = "unicode-xid"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[metadata]
"checksum backtrace 0.3.38 (registry+https://github.com/rust-lang/crates.io-index)" = "690a62be8920ccf773ee00ef0968649b0e724cda8bd5b12286302b4ae955fdf5"
"checksum backtrace-sys 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)" = "82a830b4ef2d1124a711c71d263c5abdc710ef8e907bd508c88be475cebc422b"
"checksum cc 1.0.45 (registry+https://github.com/rust-lang/crates.io-index)" = "4fc9a35e1f4290eb9e5fc54ba6cf40671ed2a2514c3eeb2b2a908dda2ea5a1be"
"checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
"checksum failure_derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0bc225b78e0391e4b8683440bf2e63c2deeeb2ce5189eab46e2b68c6d3725d08"
"checksum libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)" = "34fcd2c08d2f832f376f4173a231990fa5aef4e99fb569867318a227ef4c06ba"
"checksum proc-macro2 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "90cf5f418035b98e655e9cdb225047638296b862b42411c4e45bb88d700f7fc0"
"checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe"
"checksum rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783"
"checksum syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "66850e97125af79138385e9b88339cbcd037e3f28ceab8c5ad98e64f0f1f80bf"
"checksum synstructure 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3f085a5855930c0441ca1288cf044ea4aecf4f43a91668abdb870b4ba546a203"
"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c"

136
third_party/rust/failure/Cargo.lock.ci поставляемый Normal file
Просмотреть файл

@ -0,0 +1,136 @@
[[package]]
name = "backtrace"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"backtrace-sys 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)",
"cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-demangle 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "backtrace-sys"
version = "0.1.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "cc"
version = "1.0.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "cfg-if"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "failure"
version = "0.1.6"
dependencies = [
"backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
"failure_derive 0.1.6",
]
[[package]]
name = "failure_derive"
version = "0.1.6"
dependencies = [
"failure 0.1.6",
"proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.15.23 (registry+https://github.com/rust-lang/crates.io-index)",
"synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "libc"
version = "0.2.43"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "proc-macro2"
version = "0.4.24"
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)",
]
[[package]]
name = "quote"
version = "0.6.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "rustc-demangle"
version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "syn"
version = "0.15.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "synstructure"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.15.23 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "unicode-xid"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "winapi"
version = "0.3.6"
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-x86_64-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[metadata]
"checksum backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "89a47830402e9981c5c41223151efcced65a0510c13097c769cede7efb34782a"
"checksum backtrace-sys 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)" = "c66d56ac8dabd07f6aacdaf633f4b8262f5b3601a810a0dcddffd5c22c69daa0"
"checksum cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4a8b715cb4597106ea87c7c84b2f1d452c7492033765df7f32651e66fcf749"
"checksum cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "082bb9b28e00d3c9d39cc03e64ce4cea0f1bb9b3fde493f0cbc008472d22bdf4"
"checksum libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)" = "76e3a3ef172f1a0b9a9ff0dd1491ae5e6c948b94479a3021819ba7d860c8645d"
"checksum proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)" = "77619697826f31a02ae974457af0b29b723e5619e113e9397b8b82c6bd253f09"
"checksum quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "53fa22a1994bd0f9372d7a816207d8a2677ad0325b073f5c5332760f0fb62b5c"
"checksum rustc-demangle 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "01b90379b8664dd83460d59bdc5dd1fd3172b8913788db483ed1325171eab2f7"
"checksum syn 0.15.23 (registry+https://github.com/rust-lang/crates.io-index)" = "9545a6a093a3f0bd59adb472700acc08cad3776f860f16a897dfce8c88721cbc"
"checksum synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "73687139bf99285483c96ac0add482c3776528beac1d97d444f6e91f203a2015"
"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
"checksum winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0"
"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"

8
third_party/rust/failure/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,10 +12,10 @@
[package]
name = "failure"
version = "0.1.3"
version = "0.1.6"
authors = ["Without Boats <boats@mozilla.com>"]
description = "Experimental error handling abstraction."
homepage = "https://boats.gitlab.io/failure"
homepage = "https://rust-lang-nursery.github.io/failure/"
documentation = "https://docs.rs/failure"
license = "MIT OR Apache-2.0"
repository = "https://github.com/rust-lang-nursery/failure"
@ -24,7 +24,7 @@ version = "0.3.3"
optional = true
[dependencies.failure_derive]
version = "0.1.3"
version = "0.1.6"
optional = true
[features]

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

@ -100,8 +100,8 @@ pub fn read_toolchains(path: PathBuf) -> Result<Toolchains, Error>
## Requirements
Both failure and failure_derive are intended to compile on all stable versions
of Rust newer than 1.18.0, as well as the latest beta and the latest nightly.
If either crate fails to compile on any version newer than 1.18.0, please open
of Rust newer than 1.31.0, as well as the latest beta and the latest nightly.
If either crate fails to compile on any version newer than 1.31.0, please open
an issue.
failure is **no_std** compatible, though some aspects of it (primarily the

18
third_party/rust/failure/RELEASES.md поставляемый
Просмотреть файл

@ -1,3 +1,21 @@
# Version 0.1.6
- Update `syn`, `quote`, and `proc_macro2` dependencies to 1.0.
- Bump MSRV to 1.31.0.
# Version 0.1.5
- Resolve a regression with error conversions (#290)
- Added `name()` to `Fail` and `Error`
# Version 0.1.4
- Improved error reporting of the derive feature
- Resolved a potential internal ambiguity when using the backtrace feature
that prevented backtrace from improving an upstream API.
- Changed the bounds on std error compat conversions through the From trait
to take Sync and Send into account.
# Version 0.1.3
- Added `Context::map`

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

@ -39,6 +39,10 @@ yourself:
```rust
impl Fail for MyError {
fn name(&self) -> Option<&str> {
self.inner.name()
}
fn cause(&self) -> Option<&Fail> {
self.inner.cause()
}
@ -140,4 +144,4 @@ case, you should not use this pattern.
[use-error]: ./use-error.html
[custom-fail]: ./custom-fail.html
[context-api]: https://boats.gitlab.io/failure/doc/failure/struct.Context.html
[context-api]: https://docs.rs/failure/latest/failure/struct.Context.html

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

@ -55,5 +55,5 @@ to the users.
[custom-fail]: ./custom-fail.html
[use-error]: ./use-error.html
[err-msg-api]: https://boats.gitlab.io/failure/doc/failure/fn.err_msg.html
[format-err-api]: https://boats.gitlab.io/failure/doc/failure/macro.format_err.html
[err-msg-api]: https://docs.rs/failure/latest/failure/fn.err_msg.html
[format-err-api]: https://docs.rs/failure/latest/failure/macro.format_err.html

2
third_party/rust/failure/book/src/fail.md поставляемый
Просмотреть файл

@ -147,6 +147,6 @@ The biggest hole in our backwards compatibility story is that you cannot
implement `std::error::Error` and also override the backtrace and cause methods
on `Fail`. We intend to enable this with specialization when it becomes stable.
[derive-docs]: https://boats.gitlab.io/failure/derive-fail.html
[derive-docs]: ./derive-fail.html
[stderror]: https://doc.rust-lang.org/std/error/trait.Error.html
[backtrace-crate]: http://alexcrichton.com/backtrace-rs

2
third_party/rust/failure/book/src/intro.md поставляемый
Просмотреть файл

@ -6,7 +6,7 @@ creating and managing errors in Rust. Additional documentation is found here:
* [API documentation][api]
* [failure source code][repo]
[api]: https://boats.gitlab.io/failure/doc/failure
[api]: https://docs.rs/failure
[repo]: https://github.com/rust-lang-nursery/failure
```rust

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

@ -20,6 +20,10 @@ pub struct MyError {
}
impl Fail for MyError {
fn name(&self) -> Option<&str> {
self.inner.name()
}
fn cause(&self) -> Option<&Fail> {
self.inner.cause()
}
@ -105,6 +109,10 @@ pub struct MyError {
}
impl Fail for MyError {
fn name(&self) -> Option<&str> {
self.inner.name()
}
fn cause(&self) -> Option<&Fail> {
self.inner.cause()
}

4
third_party/rust/failure/examples/simple.rs поставляемый
Просмотреть файл

@ -16,7 +16,7 @@ fn bad_function() -> Result<(), WrappingError> {
}
fn main() {
for cause in Fail::iter_causes(&bad_function().unwrap_err()) {
println!("{}", cause);
for cause in Fail::iter_chain(&bad_function().unwrap_err()) {
println!("{}: {}", cause.name().unwrap_or("Error"), cause);
}
}

10
third_party/rust/failure/src/as_fail.rs поставляемый
Просмотреть файл

@ -8,20 +8,20 @@ use Fail;
/// custom cause.
pub trait AsFail {
/// Converts a reference to `Self` into a dynamic trait object of `Fail`.
fn as_fail(&self) -> &Fail;
fn as_fail(&self) -> &dyn Fail;
}
impl<T> AsFail for T
where
T: Fail,
{
fn as_fail(&self) -> &Fail {
fn as_fail(&self) -> &dyn Fail {
self
}
}
impl AsFail for Fail {
fn as_fail(&self) -> &Fail {
impl AsFail for dyn Fail {
fn as_fail(&self) -> &dyn Fail {
self
}
}
@ -30,7 +30,7 @@ with_std! {
use error::Error;
impl AsFail for Error {
fn as_fail(&self) -> &Fail {
fn as_fail(&self) -> &dyn Fail {
self.as_fail()
}
}

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

@ -2,6 +2,7 @@ use std::cell::UnsafeCell;
use std::env;
use std::ffi::OsString;
use std::fmt;
#[allow(deprecated)] // to allow for older Rust versions (<1.24)
use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering};
use std::sync::Mutex;
@ -24,6 +25,7 @@ unsafe impl Sync for MaybeResolved {}
impl InternalBacktrace {
pub(super) fn new() -> InternalBacktrace {
#[allow(deprecated)] // to allow for older Rust versions (<1.24)
static ENABLED: AtomicUsize = ATOMIC_USIZE_INIT;
match ENABLED.load(Ordering::SeqCst) {

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

@ -52,6 +52,16 @@ without_backtrace! {
pub(crate) fn is_none(&self) -> bool {
true
}
/// Returns true if displaying this backtrace would be an empty string.
///
/// > (We have detected that this crate was documented with no_std
/// > compatibility turned on. The version of this crate that has been
/// > documented here will never generate a backtrace and this method
/// > will always return true.)
pub fn is_empty(&self) -> bool {
true
}
}
impl Default for Backtrace {
@ -118,6 +128,11 @@ with_backtrace! {
pub(crate) fn is_none(&self) -> bool {
self.internal.is_none()
}
/// Returns true if displaying this backtrace would be an empty string.
pub fn is_empty(&self) -> bool {
self.internal.is_none()
}
}
impl Default for Backtrace {
@ -129,7 +144,7 @@ with_backtrace! {
impl Debug for Backtrace {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
if let Some(bt) = self.internal.as_backtrace() {
bt.fmt(f)
Debug::fmt(bt, f)
} else { Ok(()) }
}
}
@ -137,7 +152,7 @@ with_backtrace! {
impl Display for Backtrace {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
if let Some(bt) = self.internal.as_backtrace() {
bt.fmt(f)
Debug::fmt(bt, f)
} else { Ok(()) }
}
}

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

@ -2,7 +2,7 @@ use std::error::Error;
use std::fmt;
use Fail;
pub struct BoxStd(pub Box<Error + Send + Sync + 'static>);
pub struct BoxStd(pub Box<dyn Error + Send + Sync + 'static>);
impl fmt::Display for BoxStd {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {

10
third_party/rust/failure/src/compat.rs поставляемый
Просмотреть файл

@ -39,8 +39,14 @@ with_std! {
}
}
impl From<Error> for Box<StdError> {
fn from(error: Error) -> Box<StdError> {
impl From<Error> for Box<dyn StdError> {
fn from(error: Error) -> Box<dyn StdError> {
Box::new(Compat { error })
}
}
impl From<Error> for Box<dyn StdError + Send + Sync> {
fn from(error: Error) -> Box<dyn StdError + Send + Sync> {
Box::new(Compat { error })
}
}

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

@ -108,7 +108,11 @@ with_std! {
}
impl<D: Display + Send + Sync + 'static> Fail for Context<D> {
fn cause(&self) -> Option<&Fail> {
fn name(&self) -> Option<&str> {
self.failure.as_cause().and_then(|x| x.name())
}
fn cause(&self) -> Option<&dyn Fail> {
self.failure.as_cause()
}
@ -142,7 +146,7 @@ with_std! {
}
}
fn as_cause(&self) -> Option<&Fail> {
fn as_cause(&self) -> Option<&dyn Fail> {
match *self {
Either::This(_) => None,
Either::That(ref error) => Some(error.as_fail())

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

@ -4,7 +4,7 @@ use Fail;
use backtrace::Backtrace;
pub(crate) struct ErrorImpl {
inner: Box<Inner<Fail>>,
inner: Box<Inner<dyn Fail>>,
}
struct Inner<F: ?Sized + Fail> {
@ -25,11 +25,11 @@ impl<F: Fail> From<F> for ErrorImpl {
}
impl ErrorImpl {
pub(crate) fn failure(&self) -> &Fail {
pub(crate) fn failure(&self) -> &dyn Fail {
&self.inner.failure
}
pub(crate) fn failure_mut(&mut self) -> &mut Fail {
pub(crate) fn failure_mut(&mut self) -> &mut dyn Fail {
&mut self.inner.failure
}

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

@ -60,16 +60,21 @@ impl Error {
/// }
/// ```
#[cfg(feature = "std")]
pub fn from_boxed_compat(err: Box<StdError + Sync + Send + 'static>) -> Error {
pub fn from_boxed_compat(err: Box<dyn StdError + Sync + Send + 'static>) -> Error {
Error::from(BoxStd(err))
}
/// Return a reference to the underlying failure that this `Error`
/// contains.
pub fn as_fail(&self) -> &Fail {
pub fn as_fail(&self) -> &dyn Fail {
self.imp.failure()
}
/// Returns the name of the underlying fail.
pub fn name(&self) -> Option<&str> {
self.as_fail().name()
}
/// Returns a reference to the underlying cause of this `Error`. Unlike the
/// method on `Fail`, this does not return an `Option`. The `Error` type
/// always has an underlying failure.
@ -77,7 +82,7 @@ impl Error {
/// This method has been deprecated in favor of the [Error::as_fail] method,
/// which does the same thing.
#[deprecated(since = "0.1.2", note = "please use 'as_fail()' method instead")]
pub fn cause(&self) -> &Fail {
pub fn cause(&self) -> &dyn Fail {
self.as_fail()
}
@ -128,7 +133,7 @@ impl Error {
/// Returns the "root cause" of this error - the last value in the
/// cause chain which does not return an underlying `cause`.
pub fn find_root_cause(&self) -> &Fail {
pub fn find_root_cause(&self) -> &dyn Fail {
self.as_fail().find_root_cause()
}
@ -168,7 +173,7 @@ impl Error {
/// Deprecated alias to `find_root_cause`.
#[deprecated(since = "0.1.2", note = "please use the 'find_root_cause()' method instead")]
pub fn root_cause(&self) -> &Fail {
pub fn root_cause(&self) -> &dyn Fail {
::find_root_cause(self.as_fail())
}
@ -196,8 +201,8 @@ impl Debug for Error {
}
}
impl AsRef<Fail> for Error {
fn as_ref(&self) -> &Fail {
impl AsRef<dyn Fail> for Error {
fn as_ref(&self) -> &dyn Fail {
self.as_fail()
}
}

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

@ -19,7 +19,11 @@ struct ErrorMessage<D: Display + Debug + Sync + Send + 'static> {
msg: D,
}
impl<D: Display + Debug + Sync + Send + 'static> Fail for ErrorMessage<D> { }
impl<D: Display + Debug + Sync + Send + 'static> Fail for ErrorMessage<D> {
fn name(&self) -> Option<&str> {
Some("failure::ErrorMessage")
}
}
impl<D: Display + Debug + Sync + Send + 'static> Display for ErrorMessage<D> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {

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

@ -23,10 +23,7 @@
#![cfg_attr(not(feature = "std"), no_std)]
#![deny(missing_docs)]
#![deny(warnings)]
#![cfg_attr(
feature = "small-error",
feature(extern_types, allocator_api)
)]
#![cfg_attr(feature = "small-error", feature(extern_types, allocator_api))]
macro_rules! with_std { ($($i:item)*) => ($(#[cfg(feature = "std")]$i)*) }
macro_rules! without_std { ($($i:item)*) => ($(#[cfg(not(feature = "std"))]$i)*) }
@ -109,6 +106,16 @@ with_std! {
/// `std::error::Error`, and are also `Send`, `Sync`, and `'static`, implement
/// `Fail` by a blanket impl.
pub trait Fail: Display + Debug + Send + Sync + 'static {
/// Returns the "name" of the error.
///
/// This is typically the type name. Not all errors will implement
/// this. This method is expected to be most useful in situations
/// where errors need to be reported to external instrumentation systems
/// such as crash reporters.
fn name(&self) -> Option<&str> {
None
}
/// Returns a reference to the underlying cause of this failure, if it
/// is an error that wraps other errors.
///
@ -119,7 +126,7 @@ pub trait Fail: Display + Debug + Send + Sync + 'static {
/// `Some` when it can return a **different** failure. Users may loop
/// over the cause chain, and returning `self` would result in an infinite
/// loop.
fn cause(&self) -> Option<&Fail> {
fn cause(&self) -> Option<&dyn Fail> {
None
}
@ -166,10 +173,7 @@ pub trait Fail: Display + Debug + Send + Sync + 'static {
}
#[doc(hidden)]
#[deprecated(
since = "0.1.2",
note = "please use the 'iter_chain()' method instead"
)]
#[deprecated(since = "0.1.2", note = "please use the 'iter_chain()' method instead")]
fn causes(&self) -> Causes
where
Self: Sized,
@ -182,7 +186,7 @@ pub trait Fail: Display + Debug + Send + Sync + 'static {
since = "0.1.2",
note = "please use the 'find_root_cause()' method instead"
)]
fn root_cause(&self) -> &Fail
fn root_cause(&self) -> &dyn Fail
where
Self: Sized,
{
@ -195,13 +199,13 @@ pub trait Fail: Display + Debug + Send + Sync + 'static {
}
}
impl Fail {
impl dyn Fail {
/// Attempts to downcast this failure to a concrete type by reference.
///
/// If the underlying error is not of type `T`, this will return `None`.
pub fn downcast_ref<T: Fail>(&self) -> Option<&T> {
if self.__private_get_type_id__() == TypeId::of::<T>() {
unsafe { Some(&*(self as *const Fail as *const T)) }
unsafe { Some(&*(self as *const dyn Fail as *const T)) }
} else {
None
}
@ -213,7 +217,7 @@ impl Fail {
/// If the underlying error is not of type `T`, this will return `None`.
pub fn downcast_mut<T: Fail>(&mut self) -> Option<&mut T> {
if self.__private_get_type_id__() == TypeId::of::<T>() {
unsafe { Some(&mut *(self as *mut Fail as *mut T)) }
unsafe { Some(&mut *(self as *mut dyn Fail as *mut T)) }
} else {
None
}
@ -227,7 +231,7 @@ impl Fail {
///
/// This is equivalent to iterating over `iter_causes()` and taking
/// the last item.
pub fn find_root_cause(&self) -> &Fail {
pub fn find_root_cause(&self) -> &dyn Fail {
find_root_cause(self)
}
@ -254,15 +258,12 @@ impl Fail {
since = "0.1.2",
note = "please use the 'find_root_cause()' method instead"
)]
pub fn root_cause(&self) -> &Fail {
pub fn root_cause(&self) -> &dyn Fail {
find_root_cause(self)
}
/// Deprecated alias to `iter_chain`.
#[deprecated(
since = "0.1.2",
note = "please use the 'iter_chain()' method instead"
)]
#[deprecated(since = "0.1.2", note = "please use the 'iter_chain()' method instead")]
pub fn causes(&self) -> Causes {
Causes { fail: Some(self) }
}
@ -272,8 +273,8 @@ impl Fail {
impl<E: StdError + Send + Sync + 'static> Fail for E {}
#[cfg(feature = "std")]
impl Fail for Box<Fail> {
fn cause(&self) -> Option<&Fail> {
impl Fail for Box<dyn Fail> {
fn cause(&self) -> Option<&dyn Fail> {
(**self).cause()
}
@ -284,12 +285,12 @@ impl Fail for Box<Fail> {
/// A iterator over the causes of a `Fail`
pub struct Causes<'f> {
fail: Option<&'f Fail>,
fail: Option<&'f dyn Fail>,
}
impl<'f> Iterator for Causes<'f> {
type Item = &'f Fail;
fn next(&mut self) -> Option<&'f Fail> {
type Item = &'f dyn Fail;
fn next(&mut self) -> Option<&'f dyn Fail> {
self.fail.map(|fail| {
self.fail = fail.cause();
fail
@ -297,7 +298,7 @@ impl<'f> Iterator for Causes<'f> {
}
}
fn find_root_cause(mut fail: &Fail) -> &Fail {
fn find_root_cause(mut fail: &dyn Fail) -> &dyn Fail {
while let Some(cause) = fail.cause() {
fail = cause;
}

21
third_party/rust/failure/src/macros.rs поставляемый
Просмотреть файл

@ -11,8 +11,8 @@ macro_rules! bail {
($e:expr) => {
return Err($crate::err_msg($e));
};
($fmt:expr, $($arg:tt)+) => {
return Err($crate::err_msg(format!($fmt, $($arg)+)));
($fmt:expr, $($arg:tt)*) => {
return Err($crate::err_msg(format!($fmt, $($arg)*)));
};
}
@ -23,18 +23,31 @@ macro_rules! bail {
/// it does not panic.
#[macro_export(local_inner_macros)]
macro_rules! ensure {
($cond:expr) => {
if !($cond) {
bail!("{}", _failure__stringify!($cond));
}
};
($cond:expr, $e:expr) => {
if !($cond) {
bail!($e);
}
};
($cond:expr, $fmt:expr, $($arg:tt)+) => {
($cond:expr, $fmt:expr, $($arg:tt)*) => {
if !($cond) {
bail!($fmt, $($arg)+);
bail!($fmt, $($arg)*);
}
};
}
#[doc(hidden)]
#[macro_export]
macro_rules! _failure__stringify {
($($inner:tt)*) => {
stringify! { $($inner)* }
}
}
/// Constructs an `Error` using the standard string interpolation syntax.
///
/// ```rust

21
third_party/rust/failure/tests/basic_fail.rs поставляемый Normal file
Просмотреть файл

@ -0,0 +1,21 @@
#[macro_use]
extern crate failure;
use failure::Fail;
#[test]
fn test_name() {
#[derive(Fail, Debug)]
#[fail(display = "my error")]
struct MyError;
let err = MyError;
assert_eq!(err.to_string(), "my error");
assert_eq!(err.name(), Some("basic_fail::MyError"));
let ctx = err.context("whatever");
assert_eq!(ctx.to_string(), "whatever");
assert_eq!(ctx.name(), Some("basic_fail::MyError"));
}

35
third_party/rust/failure/tests/fail_compat.rs поставляемый Normal file
Просмотреть файл

@ -0,0 +1,35 @@
#[macro_use]
extern crate failure;
use failure::Fail;
fn return_failure() -> Result<(), failure::Error> {
#[derive(Fail, Debug)]
#[fail(display = "my error")]
struct MyError;
let err = MyError;
Err(err.into())
}
fn return_error() -> Result<(), Box<dyn std::error::Error>> {
return_failure()?;
Ok(())
}
fn return_error_send_sync() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
return_failure()?;
Ok(())
}
#[test]
fn smoke_default_compat() {
let err = return_error();
assert!(err.is_err());
}
#[test]
fn smoke_compat_send_sync() {
let err = return_error_send_sync();
assert!(err.is_err());
}

67
third_party/rust/failure/tests/macro_trailing_comma.rs поставляемый Normal file
Просмотреть файл

@ -0,0 +1,67 @@
#[macro_use]
extern crate failure;
// NOTE:
//
// This test is in a separate file due to the fact that ensure! cannot be used
// from within failure.
//
// (you get: 'macro-expanded `macro_export` macros from the current crate cannot
// be referred to by absolute paths')
// Encloses an early-returning macro in an IIFE so that we
// can treat it as a Result-returning function.
macro_rules! wrap_early_return {
($expr:expr) => {{
fn func() -> Result<(), failure::Error> {
let _ = $expr;
#[allow(unreachable_code)]
Ok(())
}
func().map_err(|e| e.to_string())
}};
}
#[test]
fn bail() {
assert_eq!(
wrap_early_return!(bail!("test")),
wrap_early_return!(bail!("test",)));
assert_eq!(
wrap_early_return!(bail!("test {}", 4)),
wrap_early_return!(bail!("test {}", 4,)));
}
#[test]
fn ensure() {
assert_eq!(
wrap_early_return!(ensure!(false, "test")),
wrap_early_return!(ensure!(false, "test",)));
assert_eq!(
wrap_early_return!(ensure!(false, "test {}", 4)),
wrap_early_return!(ensure!(false, "test {}", 4,)));
}
#[test]
fn single_arg_ensure() {
assert_eq!(
wrap_early_return!(ensure!(false)),
Err("false".to_string()));
assert_eq!(
wrap_early_return!(ensure!(true == false)),
Err("true == false".to_string()));
assert_eq!(
wrap_early_return!(ensure!(4 == 5)),
Err("4 == 5".to_string()));
}
#[test]
fn format_err() {
assert_eq!(
format_err!("test").to_string(),
format_err!("test",).to_string());
assert_eq!(
format_err!("test {}", 4).to_string(),
format_err!("test {}", 4,).to_string());
}

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

@ -1 +1 @@
{"files":{"Cargo.toml":"e00026aba3492ad169fcb6123e896280d679ffb9a198c6830052c99df3246142","build.rs":"c7481c027fc4c09e2d6dc8ac642ec5314b6a02269fb022b0f3c1850f000d31f5","src/lib.rs":"833b9916cd18b2e0b4fa79cc795afd00089697be7a25bf6895e85ed4cef97916","tests/backtrace.rs":"56b2b97f83e5341108aac403a50491560dc6d897d6002973248c9c9014c0e494","tests/custom_type_bounds.rs":"745d3e488738f5d90bcb1fa66a6784b64a88881b1d62c241cba2f863f4eb31c8","tests/no_derive_display.rs":"3ab159aadf809a95d578b4909470f6ecca24cea0caf514509d326601cc7b933b","tests/tests.rs":"eaf131c01cc101b94fd6478a9964f5e3d919f2260f6d327f0e435ac3520fe71e","tests/wraps.rs":"e00c2761ccd9fe84df47bd102945818f5d8868c95bcab719ebdde0db8334d4a6"},"package":"64c2d913fe8ed3b6c6518eedf4538255b989945c14c2a7d5cbff62a5e2120596"}
{"files":{"Cargo.toml":"3fe281152af8a1081e0816949e3e476d3c991341c1a294c064414345aa6bc995","build.rs":"c7481c027fc4c09e2d6dc8ac642ec5314b6a02269fb022b0f3c1850f000d31f5","src/lib.rs":"c446d83b42f5aca4453da4e2dd8e40dbfe9aa33ba1a038217174ece5158b7196","tests/backtrace.rs":"56b2b97f83e5341108aac403a50491560dc6d897d6002973248c9c9014c0e494","tests/custom_type_bounds.rs":"745d3e488738f5d90bcb1fa66a6784b64a88881b1d62c241cba2f863f4eb31c8","tests/no_derive_display.rs":"3ab159aadf809a95d578b4909470f6ecca24cea0caf514509d326601cc7b933b","tests/tests.rs":"eaf131c01cc101b94fd6478a9964f5e3d919f2260f6d327f0e435ac3520fe71e","tests/wraps.rs":"cc2bc5a5555756082ec570afa310939ba7f74a20898991a89fab75232380fd21"},"package":"0bc225b78e0391e4b8683440bf2e63c2deeeb2ce5189eab46e2b68c6d3725d08"}

16
third_party/rust/failure_derive/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,28 +12,28 @@
[package]
name = "failure_derive"
version = "0.1.3"
version = "0.1.6"
authors = ["Without Boats <woboats@gmail.com>"]
build = "build.rs"
description = "derives for the failure crate"
homepage = "https://boats.gitlab.io/failure"
documentation = "https://boats.gitlab.io/failure"
homepage = "https://rust-lang-nursery.github.io/failure/"
documentation = "https://docs.rs/failure"
license = "MIT OR Apache-2.0"
repository = "https://github.com/withoutboats/failure_derive"
[lib]
proc-macro = true
[dependencies.proc-macro2]
version = "0.4.8"
version = "1"
[dependencies.quote]
version = "0.6.3"
version = "1"
[dependencies.syn]
version = "0.15.0"
version = "1.0.3"
[dependencies.synstructure]
version = "0.10.0"
version = "0.12.0"
[dev-dependencies.failure]
version = "0.1.0"

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

@ -6,17 +6,49 @@ extern crate synstructure;
#[macro_use]
extern crate quote;
use proc_macro2::TokenStream;
use proc_macro2::{TokenStream, Span};
use syn::LitStr;
use syn::spanned::Spanned;
#[derive(Debug)]
struct Error(TokenStream);
impl Error {
fn new(span: Span, message: &str) -> Error {
Error(quote_spanned! { span =>
compile_error!(#message);
})
}
fn into_tokens(self) -> TokenStream {
self.0
}
}
impl From<syn::Error> for Error {
fn from(e: syn::Error) -> Error {
Error(e.to_compile_error())
}
}
decl_derive!([Fail, attributes(fail, cause)] => fail_derive);
fn fail_derive(s: synstructure::Structure) -> TokenStream {
match fail_derive_impl(s) {
Err(err) => err.into_tokens(),
Ok(tokens) => tokens,
}
}
fn fail_derive_impl(s: synstructure::Structure) -> Result<TokenStream, Error> {
let make_dyn = if cfg!(has_dyn_trait) {
quote! { &dyn }
} else {
quote! { & }
};
let ty_name = LitStr::new(&s.ast().ident.to_string(), Span::call_site());
let cause_body = s.each_variant(|v| {
if let Some(cause) = v.bindings().iter().find(is_cause) {
quote!(return Some(::failure::AsFail::as_fail(#cause)))
@ -36,6 +68,10 @@ fn fail_derive(s: synstructure::Structure) -> TokenStream {
let fail = s.unbound_impl(
quote!(::failure::Fail),
quote! {
fn name(&self) -> Option<&str> {
Some(concat!(module_path!(), "::", #ty_name))
}
#[allow(unreachable_code)]
fn cause(&self) -> ::failure::_core::option::Option<#make_dyn(::failure::Fail)> {
match *self { #cause_body }
@ -49,7 +85,7 @@ fn fail_derive(s: synstructure::Structure) -> TokenStream {
}
},
);
let display = display_body(&s).map(|display_body| {
let display = display_body(&s)?.map(|display_body| {
s.unbound_impl(
quote!(::failure::_core::fmt::Display),
quote! {
@ -62,98 +98,128 @@ fn fail_derive(s: synstructure::Structure) -> TokenStream {
)
});
(quote! {
Ok(quote! {
#fail
#display
}).into()
})
}
fn display_body(s: &synstructure::Structure) -> Option<quote::__rt::TokenStream> {
fn display_body(s: &synstructure::Structure) -> Result<Option<quote::__rt::TokenStream>, Error> {
let mut msgs = s.variants().iter().map(|v| find_error_msg(&v.ast().attrs));
if msgs.all(|msg| msg.is_none()) {
return None;
if msgs.all(|msg| msg.map(|m| m.is_none()).unwrap_or(true)) {
return Ok(None);
}
Some(s.each_variant(|v| {
let mut tokens = TokenStream::new();
for v in s.variants() {
let msg =
find_error_msg(&v.ast().attrs).expect("All variants must have display attribute.");
find_error_msg(&v.ast().attrs)?
.ok_or_else(|| Error::new(
v.ast().ident.span(),
"All variants must have display attribute."
))?;
if msg.nested.is_empty() {
panic!("Expected at least one argument to fail attribute");
return Err(Error::new(
msg.span(),
"Expected at least one argument to fail attribute"
));
}
let format_string = match msg.nested[0] {
syn::NestedMeta::Meta(syn::Meta::NameValue(ref nv)) if nv.ident == "display" => {
syn::NestedMeta::Meta(syn::Meta::NameValue(ref nv)) if nv.path.is_ident("display") => {
nv.lit.clone()
}
_ => {
panic!("Fail attribute must begin `display = \"\"` to control the Display message.")
return Err(Error::new(
msg.span(),
"Fail attribute must begin `display = \"\"` to control the Display message."
));
}
};
let args = msg.nested.iter().skip(1).map(|arg| match *arg {
syn::NestedMeta::Literal(syn::Lit::Int(ref i)) => {
let bi = &v.bindings()[i.value() as usize];
quote!(#bi)
syn::NestedMeta::Lit(syn::Lit::Int(ref i)) => {
let bi = &v.bindings()[i.base10_parse::<usize>()?];
Ok(quote!(#bi))
}
syn::NestedMeta::Meta(syn::Meta::Word(ref id)) => {
let id_s = id.to_string();
syn::NestedMeta::Meta(syn::Meta::Path(ref path)) => {
let id_s = path.get_ident().map(syn::Ident::to_string).unwrap_or("".to_string());
if id_s.starts_with("_") {
if let Ok(idx) = id_s[1..].parse::<usize>() {
let bi = match v.bindings().get(idx) {
Some(bi) => bi,
None => {
panic!(
"display attempted to access field `{}` in `{}::{}` which \
return Err(Error::new(
arg.span(),
&format!(
"display attempted to access field `{}` in `{}::{}` which \
does not exist (there are {} field{})",
idx,
s.ast().ident,
v.ast().ident,
v.bindings().len(),
if v.bindings().len() != 1 { "s" } else { "" }
);
idx,
s.ast().ident,
v.ast().ident,
v.bindings().len(),
if v.bindings().len() != 1 { "s" } else { "" }
)
));
}
};
return quote!(#bi);
return Ok(quote!(#bi));
}
}
for bi in v.bindings() {
if bi.ast().ident.as_ref() == Some(id) {
return quote!(#bi);
let id = bi.ast().ident.as_ref();
if id.is_some() && path.is_ident(id.unwrap()) {
return Ok(quote!(#bi));
}
}
panic!(
"Couldn't find field `{}` in `{}::{}`",
id,
s.ast().ident,
v.ast().ident
);
return Err(Error::new(
arg.span(),
&format!(
"Couldn't find field `{:?}` in `{}::{}`",
path,
s.ast().ident,
v.ast().ident
)
));
}
_ => panic!("Invalid argument to fail attribute!"),
ref arg => {
return Err(Error::new(
arg.span(),
"Invalid argument to fail attribute!"
));
},
});
let args = args.collect::<Result<Vec<_>, _>>()?;
quote! {
return write!(f, #format_string #(, #args)*)
}
}))
let pat = v.pat();
tokens.extend(quote!(#pat => { return write!(f, #format_string #(, #args)*) }));
}
Ok(Some(tokens))
}
fn find_error_msg(attrs: &[syn::Attribute]) -> Option<syn::MetaList> {
fn find_error_msg(attrs: &[syn::Attribute]) -> Result<Option<syn::MetaList>, Error> {
let mut error_msg = None;
for attr in attrs {
if let Some(meta) = attr.interpret_meta() {
if meta.name() == "fail" {
if let Ok(meta) = attr.parse_meta() {
if meta.path().is_ident("fail") {
if error_msg.is_some() {
panic!("Cannot have two display attributes")
return Err(Error::new(
meta.span(),
"Cannot have two display attributes"
));
} else {
if let syn::Meta::List(list) = meta {
error_msg = Some(list);
} else {
panic!("fail attribute must take a list in parentheses")
return Err(Error::new(
meta.span(),
"fail attribute must take a list in parentheses"
));
}
}
}
}
}
error_msg
Ok(error_msg)
}
fn is_backtrace(bi: &&synstructure::BindingInfo) -> bool {
@ -164,7 +230,7 @@ fn is_backtrace(bi: &&synstructure::BindingInfo) -> bool {
segments: ref path, ..
},
}) => path.last().map_or(false, |s| {
s.value().ident == "Backtrace" && s.value().arguments.is_empty()
s.ident == "Backtrace" && s.arguments.is_empty()
}),
_ => false,
}
@ -173,18 +239,18 @@ fn is_backtrace(bi: &&synstructure::BindingInfo) -> bool {
fn is_cause(bi: &&synstructure::BindingInfo) -> bool {
let mut found_cause = false;
for attr in &bi.ast().attrs {
if let Some(meta) = attr.interpret_meta() {
if meta.name() == "cause" {
if let Ok(meta) = attr.parse_meta() {
if meta.path().is_ident("cause") {
if found_cause {
panic!("Cannot have two `cause` attributes");
}
found_cause = true;
}
if meta.name() == "fail" {
if meta.path().is_ident("fail") {
if let syn::Meta::List(ref list) = meta {
if let Some(ref pair) = list.nested.first() {
if let &&syn::NestedMeta::Meta(syn::Meta::Word(ref word)) = pair.value() {
if word == "cause" {
if let &&syn::NestedMeta::Meta(syn::Meta::Path(ref path)) = pair {
if path.is_ident("cause") {
if found_cause {
panic!("Cannot have two `cause` attributes");
}

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

@ -18,11 +18,10 @@ struct WrapError {
fn wrap_error() {
let inner = io::Error::from_raw_os_error(98);
let err = WrapError { inner };
assert!(
err.cause()
.and_then(|err| err.downcast_ref::<io::Error>())
.is_some()
);
assert!(err
.cause()
.and_then(|err| err.downcast_ref::<io::Error>())
.is_some());
}
#[derive(Fail, Debug)]
@ -33,11 +32,10 @@ struct WrapTupleError(#[fail(cause)] io::Error);
fn wrap_tuple_error() {
let io_error = io::Error::from_raw_os_error(98);
let err: WrapTupleError = WrapTupleError(io_error);
assert!(
err.cause()
.and_then(|err| err.downcast_ref::<io::Error>())
.is_some()
);
assert!(err
.cause()
.and_then(|err| err.downcast_ref::<io::Error>())
.is_some());
}
#[derive(Fail, Debug)]
@ -55,12 +53,13 @@ fn wrap_backtrace_error() {
inner,
backtrace: Backtrace::new(),
};
assert!(
err.cause()
.and_then(|err| err.downcast_ref::<io::Error>())
.is_some()
);
assert!(err
.cause()
.and_then(|err| err.downcast_ref::<io::Error>())
.is_some());
assert!(err.backtrace().is_some());
assert!(err.backtrace().unwrap().is_empty());
assert!(err.backtrace().unwrap().to_string().trim().is_empty());
}
#[derive(Fail, Debug)]
@ -79,21 +78,21 @@ enum WrapEnumError {
fn wrap_enum_error() {
let io_error = io::Error::from_raw_os_error(98);
let err: WrapEnumError = WrapEnumError::Io(io_error);
assert!(
err.cause()
.and_then(|err| err.downcast_ref::<io::Error>())
.is_some()
);
assert!(err
.cause()
.and_then(|err| err.downcast_ref::<io::Error>())
.is_some());
assert!(err.backtrace().is_none());
let fmt_error = fmt::Error::default();
let err: WrapEnumError = WrapEnumError::Fmt {
inner: fmt_error,
backtrace: Backtrace::new(),
};
assert!(
err.cause()
.and_then(|err| err.downcast_ref::<fmt::Error>())
.is_some()
);
assert!(err
.cause()
.and_then(|err| err.downcast_ref::<fmt::Error>())
.is_some());
assert!(err.backtrace().is_some());
assert!(err.backtrace().unwrap().is_empty());
assert!(err.backtrace().unwrap().to_string().trim().is_empty());
}

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

@ -1 +1 @@
{"files":{"Cargo.toml":"ca54d29c0cfac91471c60317233978b7e23f4d82537b3116431f681b44f98b33","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3","README.md":"c6f47e3c516f7dfc1b0eeaa999e557ec129cb0bbe2e70d712293d56af09141c3","lib.rs":"d0aec9f3ccc0a86d4d8979baa7b8c334e211878b12f1a3df9c6489b786894f03"},"package":"35adee9ed962cf7d07d62cb58bc45029f3227f5b5b86246caa8632f06c187bc3"}
{"files":{"Cargo.toml":"8dd7d4c64162814f1633a91c8705ce70e3821da10b1571c7f5702d9985c7e54d","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3","README.md":"c6f47e3c516f7dfc1b0eeaa999e557ec129cb0bbe2e70d712293d56af09141c3","lib.rs":"222afac401a8cb257b30c45afb844f61d06bb031c999f8b2d45992163fbd7706"},"package":"e37c5d4cd9473c5f4c9c111f033f15d4df9bd378fdf615944e360a4f55a05f0b"}

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

@ -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 = "malloc_size_of_derive"
version = "0.1.0"
version = "0.1.1"
authors = ["The Servo Project Developers"]
description = "Crate for Firefox memory reporting, not intended for external use"
license = "MIT/Apache-2.0"
@ -22,11 +22,11 @@ repository = "https://github.com/bholley/malloc_size_of_derive"
path = "lib.rs"
proc-macro = true
[dependencies.proc-macro2]
version = "0.4"
version = "1"
[dependencies.syn]
version = "0.15"
version = "1"
features = ["full"]
[dependencies.synstructure]
version = "0.10"
version = "0.12"

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

@ -25,17 +25,17 @@ fn malloc_size_of_derive(s: synstructure::Structure) -> proc_macro2::TokenStream
.ast()
.attrs
.iter()
.any(|attr| match attr.interpret_meta().unwrap() {
syn::Meta::Word(ref ident) | syn::Meta::List(syn::MetaList { ref ident, .. })
if ident == "ignore_malloc_size_of" =>
.any(|attr| match attr.parse_meta().unwrap() {
syn::Meta::Path(ref path) | syn::Meta::List(syn::MetaList { ref path, .. })
if path.is_ident("ignore_malloc_size_of") =>
{
panic!(
"#[ignore_malloc_size_of] should have an explanation, \
e.g. #[ignore_malloc_size_of = \"because reasons\"]"
);
}
syn::Meta::NameValue(syn::MetaNameValue { ref ident, .. })
if ident == "ignore_malloc_size_of" =>
syn::Meta::NameValue(syn::MetaNameValue { ref path, .. })
if path.is_ident("ignore_malloc_size_of") =>
{
true
},

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

@ -1 +0,0 @@
{"files":{"Cargo.toml":"e36eaee82d5b5aa7864148b96c363f1aa05676de4537d914b244446b685d23c0","LICENSE":"219920e865eee70b7dcfc948a86b099e7f4fe2de01bcca2ca9a20c0a033f2b59","README.md":"1ae9f6797e1affc45eaafac10cd5e2b68f4b7d9463c38d61bccbfb1115523bb1","src/lib.rs":"30ddc0d6d750328f146985d90c8a8e873f4105363722c31f16f466013c58cf82","src/macros.rs":"0db8830809f1e0e9f72767e3a0d45d8bd3f5be78ad20dc6e083e3b80fadebf60"},"package":"73687139bf99285483c96ac0add482c3776528beac1d97d444f6e91f203a2015"}

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

@ -1,40 +0,0 @@
# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
#
# When uploading crates to the registry Cargo will automatically
# "normalize" Cargo.toml files for maximal compatibility
# with all versions of Cargo and also rewrite `path` dependencies
# to registry (e.g. crates.io) dependencies
#
# If you believe there's an error in this file please file an
# issue against the rust-lang/cargo repository. If you're
# editing this file be aware that the upstream Cargo.toml
# will likely look very different (and much more reasonable)
[package]
name = "synstructure"
version = "0.10.1"
authors = ["Nika Layzell <nika@thelayzells.com>"]
include = ["src/**/*", "Cargo.toml", "README.md", "LICENSE"]
description = "Helper methods and macros for custom derives"
documentation = "https://docs.rs/synstructure"
readme = "README.md"
keywords = ["syn", "macros", "derive", "expand_substructure", "enum"]
license = "MIT"
repository = "https://github.com/mystor/synstructure"
[dependencies.proc-macro2]
version = "0.4"
[dependencies.quote]
version = "0.6"
[dependencies.syn]
version = "0.15"
features = ["visit", "extra-traits"]
[dependencies.unicode-xid]
version = "0.1"
[dev-dependencies.synstructure_test_traits]
version = "0.1"
[features]
simple-derive = []

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

@ -1,7 +0,0 @@
Copyright 2016 Nika Layzell
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

159
third_party/rust/synstructure-0.10.1/README.md поставляемый
Просмотреть файл

@ -1,159 +0,0 @@
# synstructure
[![Latest Version](https://img.shields.io/crates/v/synstructure.svg)](https://crates.io/crates/synstructure)
[![Documentation](https://docs.rs/synstructure/badge.svg)](https://docs.rs/synstructure)
[![Build Status](https://travis-ci.org/mystor/synstructure.svg?branch=master)](https://travis-ci.org/mystor/synstructure)
[![Rustc Version 1.15+](https://img.shields.io/badge/rustc-1.15+-lightgray.svg)](https://blog.rust-lang.org/2017/02/02/Rust-1.15.html)
> NOTE: What follows is an exerpt from the module level documentation. For full
> details read the docs on [docs.rs](https://docs.rs/synstructure/)
This crate provides helper types for matching against enum variants, and
extracting bindings to each of the fields in the deriving Struct or Enum in
a generic way.
If you are writing a `#[derive]` which needs to perform some operation on
every field, then you have come to the right place!
# Example: `WalkFields`
### Trait Implementation
```rust
pub trait WalkFields: std::any::Any {
fn walk_fields(&self, walk: &mut FnMut(&WalkFields));
}
impl WalkFields for i32 {
fn walk_fields(&self, _walk: &mut FnMut(&WalkFields)) {}
}
```
### Custom Derive
```rust
#[macro_use]
extern crate synstructure;
#[macro_use]
extern crate quote;
extern crate proc_macro2;
fn walkfields_derive(s: synstructure::Structure) -> proc_macro2::TokenStream {
let body = s.each(|bi| quote!{
walk(#bi)
});
s.bound_impl(quote!(example_traits::WalkFields), quote!{
fn walk_fields(&self, walk: &mut FnMut(&example_traits::WalkFields)) {
match *self { #body }
}
})
}
decl_derive!([WalkFields] => walkfields_derive);
/*
* Test Case
*/
fn main() {
test_derive! {
walkfields_derive {
enum A<T> {
B(i32, T),
C(i32),
}
}
expands to {
#[allow(non_upper_case_globals)]
const _DERIVE_example_traits_WalkFields_FOR_A: () = {
extern crate example_traits;
impl<T> example_traits::WalkFields for A<T>
where T: example_traits::WalkFields
{
fn walk_fields(&self, walk: &mut FnMut(&example_traits::WalkFields)) {
match *self {
A::B(ref __binding_0, ref __binding_1,) => {
{ walk(__binding_0) }
{ walk(__binding_1) }
}
A::C(ref __binding_0,) => {
{ walk(__binding_0) }
}
}
}
}
};
}
}
}
```
# Example: `Interest`
### Trait Implementation
```rust
pub trait Interest {
fn interesting(&self) -> bool;
}
impl Interest for i32 {
fn interesting(&self) -> bool { *self > 0 }
}
```
### Custom Derive
```rust
#[macro_use]
extern crate synstructure;
#[macro_use]
extern crate quote;
extern crate proc_macro2;
fn interest_derive(mut s: synstructure::Structure) -> proc_macro2::TokenStream {
let body = s.fold(false, |acc, bi| quote!{
#acc || example_traits::Interest::interesting(#bi)
});
s.bound_impl(quote!(example_traits::Interest), quote!{
fn interesting(&self) -> bool {
match *self {
#body
}
}
})
}
decl_derive!([Interest] => interest_derive);
/*
* Test Case
*/
fn main() {
test_derive!{
interest_derive {
enum A<T> {
B(i32, T),
C(i32),
}
}
expands to {
#[allow(non_upper_case_globals)]
const _DERIVE_example_traits_Interest_FOR_A: () = {
extern crate example_traits;
impl<T> example_traits::Interest for A<T>
where T: example_traits::Interest
{
fn interesting(&self) -> bool {
match *self {
A::B(ref __binding_0, ref __binding_1,) => {
false ||
example_traits::Interest::interesting(__binding_0) ||
example_traits::Interest::interesting(__binding_1)
}
A::C(ref __binding_0,) => {
false ||
example_traits::Interest::interesting(__binding_0)
}
}
}
}
};
}
}
}
```
For more example usage, consider investigating the `abomonation_derive` crate,
which makes use of this crate, and is fairly simple.

2283
third_party/rust/synstructure-0.10.1/src/lib.rs поставляемый

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

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

@ -1,415 +0,0 @@
//! This module provides two utility macros for testing custom derives. They can
//! be used together to eliminate some of the boilerplate required in order to
//! declare and test custom derive implementations.
// Re-exports used by the decl_derive! and test_derive!
pub use syn::{parse_str, parse, DeriveInput};
pub use proc_macro::TokenStream as TokenStream;
pub use proc_macro2::TokenStream as TokenStream2;
/// The `decl_derive!` macro declares a custom derive wrapper. It will parse the
/// incoming `TokenStream` into a `synstructure::Structure` object, and pass it
/// into the inner function.
///
/// Your inner function should have the following type:
///
/// ```
/// # extern crate quote;
/// # extern crate proc_macro2;
/// # extern crate synstructure;
/// fn derive(input: synstructure::Structure) -> proc_macro2::TokenStream {
/// unimplemented!()
/// }
/// ```
///
/// # Usage
///
/// ### Without Attributes
/// ```
/// # #[macro_use] extern crate quote;
/// # extern crate proc_macro2;
/// # extern crate synstructure;
/// # fn main() {}
/// fn derive_interesting(_input: synstructure::Structure) -> proc_macro2::TokenStream {
/// quote! { ... }
/// }
///
/// # const _IGNORE: &'static str = stringify! {
/// decl_derive!([Interesting] => derive_interesting);
/// # };
/// ```
///
/// ### With Attributes
/// ```
/// # #[macro_use] extern crate quote;
/// # extern crate proc_macro2;
/// # extern crate synstructure;
/// # fn main() {}
/// fn derive_interesting(_input: synstructure::Structure) -> proc_macro2::TokenStream {
/// quote! { ... }
/// }
///
/// # const _IGNORE: &'static str = stringify! {
/// decl_derive!([Interesting, attributes(interesting_ignore)] => derive_interesting);
/// # };
/// ```
#[macro_export]
macro_rules! decl_derive {
// XXX: Switch to using this variant everywhere?
([$derives:ident $($derive_t:tt)*] => $inner:path) => {
#[proc_macro_derive($derives $($derive_t)*)]
#[allow(non_snake_case)]
pub fn $derives(
i: $crate::macros::TokenStream
) -> $crate::macros::TokenStream
{
let parsed = $crate::macros::parse::<$crate::macros::DeriveInput>(i)
.expect(concat!("Failed to parse input to `#[derive(",
stringify!($derives),
")]`"));
$inner($crate::Structure::new(&parsed)).into()
}
};
}
/// Run a test on a custom derive. This macro expands both the original struct
/// and the expansion to ensure that they compile correctly, and confirms that
/// feeding the original struct into the named derive will produce the written
/// output.
///
/// You can add `no_build` to the end of the macro invocation to disable
/// checking that the written code compiles. This is useful in contexts where
/// the procedural macro cannot depend on the crate where it is used during
/// tests.
///
/// # Usage
///
/// ```
/// # #[macro_use] extern crate quote;
/// # extern crate proc_macro2;
/// # #[macro_use] extern crate synstructure;
/// fn test_derive_example(_s: synstructure::Structure) -> proc_macro2::TokenStream {
/// quote! { const YOUR_OUTPUT: &'static str = "here"; }
/// }
///
/// fn main() {
/// test_derive!{
/// test_derive_example {
/// struct A;
/// }
/// expands to {
/// const YOUR_OUTPUT: &'static str = "here";
/// }
/// }
/// }
/// ```
#[macro_export]
macro_rules! test_derive {
($name:path { $($i:tt)* } expands to { $($o:tt)* }) => {
{
#[allow(dead_code)]
fn ensure_compiles() {
$($i)*
$($o)*
}
test_derive!($name { $($i)* } expands to { $($o)* } no_build);
}
};
($name:path { $($i:tt)* } expands to { $($o:tt)* } no_build) => {
{
let i = stringify!( $($i)* );
let parsed = $crate::macros::parse_str::<$crate::macros::DeriveInput>(i)
.expect(concat!("Failed to parse input to `#[derive(",
stringify!($name),
")]`"));
let res = $name($crate::Structure::new(&parsed));
let expected = stringify!( $($o)* )
.parse::<$crate::macros::TokenStream2>()
.expect("output should be a valid TokenStream");
let mut expected_toks = $crate::macros::TokenStream2::from(expected);
if res.to_string() != expected_toks.to_string() {
panic!("\
test_derive failed:
expected:
```
{}
```
got:
```
{}
```\n",
$crate::unpretty_print(&expected_toks),
$crate::unpretty_print(&res),
);
}
// assert_eq!(res, expected_toks)
}
};
}
/// A helper macro for declaring relatively straightforward derive
/// implementations. It provides mechanisms for operating over structures
/// performing modifications on each field etc.
///
/// This macro doesn't define the actual derive, but rather the implementation
/// method. Use `decl_derive!` to generate the implementation wrapper.
///
/// # Stability Warning
///
/// This is an unstable experimental macro API, which may be changed or removed
/// in a future version. I'm not yet confident enough that this API is useful
/// enough to warrant its complexity and inclusion in `synstructure`.
///
/// # Caveat
///
/// The `quote!` macro from `quote` must be imported in the calling crate, as
/// this macro depends on it.
///
/// # Note
///
/// This feature is implemented behind the `simple-derive` feature, and is only
/// available when that feature is enabled.
///
/// # Example
///
/// ```
/// extern crate syn;
/// #[macro_use]
/// extern crate quote;
/// #[macro_use]
/// extern crate synstructure;
/// extern crate proc_macro2;
/// # const _IGNORE: &'static str = stringify! {
/// decl_derive!([Interest] => derive_interest);
/// # };
///
/// simple_derive! {
/// // This macro implements the `Interesting` method exported by the `aa`
/// // crate. It will explicitly add an `extern crate` invocation to import the
/// // crate into the expanded context.
/// derive_interest impl synstructure_test_traits::Interest {
/// // A "filter" block can be added. It evaluates its body with the (s)
/// // variable bound to a mutable reference to the input `Structure`
/// // object.
/// //
/// // This block can be used to perform general transformations, such as
/// // filtering out fields which should be ignored by all methods and for
/// // the purposes of binding type parameters.
/// filter(s) {
/// s.filter(|bi| bi.ast().ident != Some(syn::Ident::new("a",
/// proc_macro2::Span::call_site())));
/// }
///
/// // This is an implementation of a method in the implemented crate. The
/// // return value should be the series of match patterns to destructure
/// // the `self` argument with.
/// fn interesting(&self as s) -> bool {
/// s.fold(false, |acc, bi| {
/// quote!(#acc || synstructure_test_traits::Interest::interesting(#bi))
/// })
/// }
/// }
/// }
///
/// fn main() {
/// test_derive!{
/// derive_interest {
/// struct A<T> {
/// x: i32,
/// a: bool, // Will be ignored by filter
/// c: T,
/// }
/// }
/// expands to {
/// #[allow(non_upper_case_globals)]
/// const _DERIVE_synstructure_test_traits_Interest_FOR_A: () = {
/// extern crate synstructure_test_traits;
/// impl<T> synstructure_test_traits::Interest for A<T>
/// where T: synstructure_test_traits::Interest
/// {
/// fn interesting(&self) -> bool {
/// match *self {
/// A {
/// x: ref __binding_0,
/// c: ref __binding_2,
/// ..
/// } => {
/// false ||
/// synstructure_test_traits::Interest::interesting(__binding_0) ||
/// synstructure_test_traits::Interest::interesting(__binding_2)
/// }
/// }
/// }
/// }
/// };
/// }
/// }
/// }
/// ```
#[cfg(feature = "simple-derive")]
#[macro_export]
macro_rules! simple_derive {
// entry point
(
$iname:ident impl $path:path { $($rest:tt)* }
) => {
simple_derive!(__I [$iname, $path] { $($rest)* } [] []);
};
// Adding a filter block
(
__I $opt:tt {
filter($s:ident) {
$($body:tt)*
}
$($rest:tt)*
} [$($done:tt)*] [$($filter:tt)*]
) => {
simple_derive!(
__I $opt { $($rest)* } [$($done)*] [
$($filter)*
[
st_name = $s,
body = {
$($body)*
},
]
]
);
};
// &self bound method
(
__I $opt:tt {
fn $fn_name:ident (&self as $s:ident $($params:tt)*) $(-> $t:ty)* {
$($body:tt)*
}
$($rest:tt)*
} [$($done:tt)*] [$($filter:tt)*]
) => {
simple_derive!(
__I $opt { $($rest)* } [
$($done)*
[
st_name = $s,
bind_style = Ref,
body = { $($body)* },
result = result,
expanded = {
fn $fn_name(&self $($params)*) $(-> $t)* {
match *self { #result }
}
},
]
] [$($filter)*]
);
};
// &mut self bound method
(
__I $opt:tt {
fn $fn_name:ident (&mut self as $s:ident $($params:tt)*) $(-> $t:ty)* {
$($body:tt)*
}
$($rest:tt)*
} [$($done:tt)*] [$($filter:tt)*]
) => {
simple_derive!(
__I $opt { $($rest)* } [
$($done)*
[
st_name = $s,
bind_style = RefMut,
body = { $($body)* },
result = result,
expanded = {
fn $fn_name(&mut self $($params)*) $(-> $t)* {
match *self { #result }
}
},
]
] [$($filter)*]
);
};
// self bound method
(
__I $opt:tt {
fn $fn_name:ident (self as $s:ident $($params:tt)*) $(-> $t:ty)* {
$($body:tt)*
}
$($rest:tt)*
} [$($done:tt)*] [$($filter:tt)*]
) => {
simple_derive!(
__I $opt { $($rest)* } [
$($done)*
[
st_name = $s,
bind_style = Move,
body = { $($body)* },
result = result,
expanded = {
fn $fn_name(self $($params)*) $(-> $t)* {
match self { #result }
}
},
]
] [$($filter)*]
);
};
// XXX: Static methods?
// codegen after data collection
(
__I [$iname:ident, $path:path] {} [$(
[
st_name = $st_name:ident,
bind_style = $bind_style:ident,
body = $body:tt,
result = $result:ident,
expanded = { $($expanded:tt)* },
]
)*] [$(
[
st_name = $filter_st_name:ident,
body = $filter_body:tt,
]
)*]
) => {
fn $iname(mut st: $crate::Structure) -> $crate::macros::TokenStream2 {
let _ = &mut st; // Silence the unused mut warning
// Filter/transform the `Structure` object before cloning it for
// individual methods.
$(
{
let $filter_st_name = &mut st;
$filter_body
}
)*
// Clone the `Structure` object and set the correct binding style,
// then perform method specific expansion.
$(
let $result = {
let mut $st_name = st.clone();
$st_name.bind_with(|_| ::synstructure::BindStyle::$bind_style);
let $result = {
$body
};
quote!{ $($expanded)* }
};
)*
st.bound_impl(quote!($path), quote!{
$(#$result)*
})
}
}
}