diff options
Diffstat (limited to 'vendor/displaydoc')
36 files changed, 2153 insertions, 1802 deletions
diff --git a/vendor/displaydoc/.cargo-checksum.json b/vendor/displaydoc/.cargo-checksum.json index 5a1aaf068..a1f0964fe 100644 --- a/vendor/displaydoc/.cargo-checksum.json +++ b/vendor/displaydoc/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"CHANGELOG.md":"1c4dbc1c48e7b5701be1d62f4628ecc1f933f70e43b5e8040203e8d98f53271d","Cargo.lock":"5a48a896619a85847e026ad6dde382c16385ca046f44eead947dbe8a787824be","Cargo.toml":"fcdfd7e2b923eb8cbf3bdf47da18cc26c17c5d530fe3704c5f7753d5541a9c2e","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3","README.md":"a83258f76a3af3aa3ca42731473d9a2789858b25e4e153fe3dbbd6614328bdcd","README.tpl":"974701ae7f6d238bd325dd32104a5265841e79a9b79a595f7fdd964711c0cd19","examples/simple.rs":"bca524b36621ac56044cbe3eebf8892f7a3b398fd8f257fc67b17b26ae34bfbf","src/attr.rs":"a41e416d4d2a854677052f18517549a20d05cccffa04a24398107237aff3c415","src/expand.rs":"52bbf8fca0b3cb70e3a5e4ec763d294230c0afdf47612b32e46ca5fbee64154d","src/fmt.rs":"9c13cbcd337066614bc26ecfd36ea9730c9b8099083a9a7ffd79f8dc17e414f1","src/lib.rs":"168a0b9ee9dda0b26b7c68ed13c92b9e8aaf0587110b9751ede12bbfbb58be76","tests/compile_tests.rs":"935609d68eaa52e0ce9f29b3dae649787cd1f540f9b4bbadcbefcb8a0febcfc8","tests/happy.rs":"1b4c119184ca3914684c1cafaa25a8fbb9e60ef45eb257ad7ac86b8b2d7a3856","tests/no_std/enum_prefix.rs":"12401753bb44e408e1940223e8c295e63f9ddaaa114b634aac1e057a771d7eee","tests/no_std/enum_prefix_missing.rs":"8531d335c3bb7036c2adecf9af6507c46017ef1d78e222a7528396bd78316002","tests/no_std/enum_prefix_missing.stderr":"8b9f12979bdd0f88d57c5f1217accb7268eb26ee434493fe454cf89be93394b1","tests/no_std/multi_line.rs":"a87214677020029f526cdc7024d38c738f4cbba335d215dbab5cbf394118700a","tests/no_std/multi_line.stderr":"a93b9dba31f879df465fffb0cbc8b962a07181e4e94a4ef3cf34fc5422eee4a8","tests/no_std/multi_line_allow.rs":"737ea03df1c75a1adcd375a84abcc654feb39781faf9964cdfef4b3253ce1376","tests/no_std/with.rs":"c13a2d4701606a5bacfa31593c16d6417f829259dd28dfa129b729a6f8fafac2","tests/no_std/without.rs":"992344f252e856ce4979e50cb19fdb6f4dc92fb8594e2cf26f47c4ff8124f2cd","tests/no_std/without.stderr":"811331272d445ebbc00019ff62d13cd0614bd8a83153a96136911f1a30221b20","tests/num_in_field.rs":"d0bc3ba7f9aea17d3abee4ac05afe6d4a0112d3527698791e1eeaa3464e2b1d4","tests/std/enum_prefix.rs":"12401753bb44e408e1940223e8c295e63f9ddaaa114b634aac1e057a771d7eee","tests/std/enum_prefix_missing.rs":"8531d335c3bb7036c2adecf9af6507c46017ef1d78e222a7528396bd78316002","tests/std/enum_prefix_missing.stderr":"6c5eff42d8ae6c06aceff7214b570ee179329d427f6a2117097a381eed2f2f17","tests/std/multi_line.rs":"a87214677020029f526cdc7024d38c738f4cbba335d215dbab5cbf394118700a","tests/std/multi_line.stderr":"af08a172042d4c7bce308f49044c5648896ea0707fbdfa9b971bcaf951584c77","tests/std/multi_line_allow.rs":"737ea03df1c75a1adcd375a84abcc654feb39781faf9964cdfef4b3253ce1376","tests/std/multiple.rs":"f59ea8ad70b9f6cc72e66d40832c8f8ee0402b170af0fb1443615ef6af9380dd","tests/std/without.rs":"992344f252e856ce4979e50cb19fdb6f4dc92fb8594e2cf26f47c4ff8124f2cd","tests/std/without.stderr":"43bd84eca8a361b1fcfc258014115dd12080357e15b640dd7ac6f42f59eee6ca"},"package":"3bf95dc3f046b9da4f2d51833c0d3547d8564ef6910f5c1ed130306a75b92886"}
\ No newline at end of file +{"files":{"CHANGELOG.md":"ac4b11a820a3251453aa5eed99f2e34758281c4794234376532ab1686fc4092e","Cargo.lock":"764c7f380095ccd0c22e10470ed71a1c38899a502943f70baf1b0641f30d61a9","Cargo.toml":"6eac127183532630ea388e11f07a33c1a8537175d4f1269290eacd0b5010b41d","LICENSE-APACHE":"7cfd738c53d61c79f07e348f622bf7707c9084237054d37fbe07788a75f5881c","LICENSE-MIT":"36516aefdc84c5d5a1e7485425913a22dbda69eb1930c5e84d6ae4972b5194b9","README.md":"60628c334f71eba035e7ba4d5ba4df966c9de953260f9d1f28b0141ad06a07a8","README.tpl":"a8b023f5f39b795ef553c2b75551d6ad42db6597362c8909101f4bc8c8994bcc","examples/simple.rs":"dd37ed49175e86124cf58aba6fdcf4b4c2adc13a2414d4a2ba31cfab21638415","src/attr.rs":"1aeaf46ea739f63bf7eca5a575ca4345ff325c16e959fb59b5671b9a338d5ddc","src/expand.rs":"a0e6c062e00b9e68a0811a7d4d739e7572cd4a5dd962dc3519c0c8bfa1e84d8b","src/fmt.rs":"9734d3b51206f73ca8d9a513bee46d72215ff877797500887d43bc64af639c37","src/lib.rs":"de304b1de4a60700c0a031c6bd568da7ed24f5169edcfc16b7009e9e9494daed","tests/compile_tests.rs":"6cd211e343c42873a287b02581bd342b09ae508022fc82022714ebdc625935aa","tests/happy.rs":"ebd93ca6cea7c2ab77c59f990335ca34714e19365fddd40a6eca5f180bf7cb75","tests/no_std/enum_prefix.rs":"fd2a565ceddffe0433f83c6d0c9b15bc1db96fbf952f222ff04bc0dc1ea34d41","tests/no_std/enum_prefix_missing.rs":"4ed8aaef3d9274b377837b90fb9a80315df502b1c569de3213b7a2e7fa613322","tests/no_std/enum_prefix_missing.stderr":"add42a5efa90502483b2fcd0152289b62c1d5b790faf9e46d8d930e4e474b781","tests/no_std/multi_line.rs":"6ce3c1554f8bffa409f42a12517f2ef79e884ce22c79d2514455263a9254ae10","tests/no_std/multi_line.stderr":"ee076d8d02e187fe9651429a755599752b82be5910aa19e9312cf678779b2c03","tests/no_std/multi_line_allow.rs":"ef1f5a6b551e81ec6405626c939d81fe6db279bd5c2c66a2c5cc6e30a318cdbe","tests/no_std/with.rs":"3607edede6069527e792e000bfe0062f539ec342048aa2b2322556f6d6462bcc","tests/no_std/without.rs":"518cd04d73bd950e70f2d515d2cdae48b0f409fbefa2132b4d9a1b97e9c0a406","tests/no_std/without.stderr":"b3ade743ec5597f433cfb6ac378db239207d349bc99b21d9f75399a8df6ec4ae","tests/num_in_field.rs":"cd83f7d79ae065a97dcb53b2e92dc57e2f269e12433d1cd4644cb0ec6b2a4d0f","tests/std/enum_prefix.rs":"fd2a565ceddffe0433f83c6d0c9b15bc1db96fbf952f222ff04bc0dc1ea34d41","tests/std/enum_prefix_missing.rs":"4ed8aaef3d9274b377837b90fb9a80315df502b1c569de3213b7a2e7fa613322","tests/std/enum_prefix_missing.stderr":"ac4b4ac371b6e134bc1781854e3bc4df2afecdb29182a9c8328ee1d37c0fef3d","tests/std/multi_line.rs":"86726db8140e5bf9f690ac3f2d607a7a9d74b9b79fae7945480cff62cf3e8700","tests/std/multi_line.stderr":"ed9de88820f5a0cacdf26f955790b1c433c784a432cf723a963211011e1ccd7b","tests/std/multi_line_allow.rs":"ef1f5a6b551e81ec6405626c939d81fe6db279bd5c2c66a2c5cc6e30a318cdbe","tests/std/multiple.rs":"a4194da6b5bef919bb0107ddb91c548421ef9812d69894bef5e5b6f316af8eee","tests/std/without.rs":"80a59e296ee3c205960b9e8dd18c1d2b210d8fd096e89652d482b963010f340b","tests/std/without.stderr":"fc699e263f1148b1db7f5ea63f0d952c74f997c8155578ff4efaf1cd9f8db8d4","tests/variantless.rs":"84495a36014bdc090b8e5d97442bcfd3229d07f0d40579e450e71596ef9a7b50","update-readme.sh":"794668cc4eb58da01049effb0370db4799e7a70a9db777edfba83d92c33e821a"},"package":"487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d"}
\ No newline at end of file diff --git a/vendor/displaydoc/CHANGELOG.md b/vendor/displaydoc/CHANGELOG.md index ed100925e..4513b4ad4 100644 --- a/vendor/displaydoc/CHANGELOG.md +++ b/vendor/displaydoc/CHANGELOG.md @@ -1,39 +1,50 @@ -# Changelog -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), -and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - -<!-- next-header --> - -## [Unreleased] - ReleaseDate - -# [0.2.3] - 2021-07-16 -## Added -- Added `#[displaydoc("..")]` attribute for overriding a doc comment - -# [0.2.2] - 2021-07-01 -## Added -- Added prefix feature to use the doc comment from an enum and prepend it - before the error message from each variant. - -# [0.2.1] - 2021-03-26 -## Added -- Added opt in support for ignoring extra doc attributes - -# [0.2.0] - 2021-03-16 -## Changed - -- (BREAKING) disallow multiple `doc` attributes in display impl - [https://github.com/yaahc/displaydoc/pull/22]. Allowing and ignoring extra - doc attributes made it too easy to accidentally create a broken display - implementation with missing context without realizing it, this change turns - that into a hard error and directs users towards block comments if multiple - lines are needed. - -<!-- next-url --> -[Unreleased]: https://github.com/yaahc/displaydoc/compare/v0.2.3...HEAD -[0.2.3]: https://github.com/yaahc/displaydoc/compare/v0.2.2...v0.2.3 -[0.2.2]: https://github.com/yaahc/displaydoc/compare/v0.2.1...v0.2.2 -[0.2.1]: https://github.com/yaahc/displaydoc/compare/v0.2.0...v0.2.1 -[0.2.0]: https://github.com/yaahc/displaydoc/releases/tag/v0.2.0 +# Changelog
+All notable changes to this project will be documented in this file.
+
+The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
+and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+
+<!-- next-header -->
+
+## [Unreleased] - ReleaseDate
+
+# [0.2.4] - 2022-05-02
+
+## Added
+- Updated `syn` dependency to 2.0
+- Support for empty enums
+- Implicitly require fmt::Display on all type parameters unless overridden
+
+## Changed
+- Bumped MSRV to 1.56
+
+# [0.2.3] - 2021-07-16
+## Added
+- Added `#[displaydoc("..")]` attribute for overriding a doc comment
+
+# [0.2.2] - 2021-07-01
+## Added
+- Added prefix feature to use the doc comment from an enum and prepend it
+ before the error message from each variant.
+
+# [0.2.1] - 2021-03-26
+## Added
+- Added opt in support for ignoring extra doc attributes
+
+# [0.2.0] - 2021-03-16
+## Changed
+
+- (BREAKING) disallow multiple `doc` attributes in display impl
+ [https://github.com/yaahc/displaydoc/pull/22]. Allowing and ignoring extra
+ doc attributes made it too easy to accidentally create a broken display
+ implementation with missing context without realizing it, this change turns
+ that into a hard error and directs users towards block comments if multiple
+ lines are needed.
+
+<!-- next-url -->
+[Unreleased]: https://github.com/yaahc/displaydoc/compare/v0.2.4...HEAD
+[0.2.4]: https://github.com/yaahc/displaydoc/compare/v0.2.3...v0.2.4
+[0.2.3]: https://github.com/yaahc/displaydoc/compare/v0.2.2...v0.2.3
+[0.2.2]: https://github.com/yaahc/displaydoc/compare/v0.2.1...v0.2.2
+[0.2.1]: https://github.com/yaahc/displaydoc/compare/v0.2.0...v0.2.1
+[0.2.0]: https://github.com/yaahc/displaydoc/releases/tag/v0.2.0
diff --git a/vendor/displaydoc/Cargo.lock b/vendor/displaydoc/Cargo.lock index ea4e30c7c..30580d940 100644 --- a/vendor/displaydoc/Cargo.lock +++ b/vendor/displaydoc/Cargo.lock @@ -12,13 +12,22 @@ dependencies = [ ] [[package]] +name = "basic-toml" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c0de75129aa8d0cceaf750b89013f0e08804d6ec61416da787b35ad0d7cddf1" +dependencies = [ + "serde", +] + +[[package]] name = "ctor" -version = "0.1.20" +version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e98e2ad1a782e33928b96fc3948e7c355e5af34ba4de7670fe8bac2a3b2006d" +checksum = "6d2301688392eb071b0bf1a37be05c469d3cc4dbbd95df672fe28ab021e6a096" dependencies = [ "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -29,7 +38,7 @@ checksum = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198" [[package]] name = "displaydoc" -version = "0.2.3" +version = "0.2.4" dependencies = [ "libc", "pretty_assertions", @@ -37,40 +46,40 @@ dependencies = [ "quote", "rustversion", "static_assertions", - "syn", + "syn 2.0.15", "thiserror", "trybuild", ] [[package]] name = "glob" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" +checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "itoa" -version = "0.4.7" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" +checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" [[package]] -name = "lazy_static" -version = "1.4.0" +name = "libc" +version = "0.2.142" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +checksum = "6a987beff54b60ffa6d51982e1aa1146bc42f19bd26be28b0586f252fccf5317" [[package]] -name = "libc" -version = "0.2.93" +name = "once_cell" +version = "1.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9385f66bf6105b241aa65a61cb923ef20efc665cb9f9bb50ac2f0c4b7f378d41" +checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" [[package]] name = "output_vt100" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53cdc5b785b7a58c5aad8216b3dfa114df64b0b06ae6e1501cef91df2fbdf8f9" +checksum = "628223faebab4e3e40667ee0b2336d34a5b960ff60ea743ddfdbcf7770bcfb66" dependencies = [ "winapi", ] @@ -89,59 +98,56 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.26" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a152013215dca273577e18d2bf00fa862b89b24169fb78c4c95aeb07992c9cec" +checksum = "2b63bdb0cd06f1f4dedf69b254734f9b45af66e4a031e42a7480257d9898b435" dependencies = [ - "unicode-xid", + "unicode-ident", ] [[package]] name = "quote" -version = "1.0.9" +version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" +checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" dependencies = [ "proc-macro2", ] [[package]] name = "rustversion" -version = "1.0.4" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb5d2a036dc6d2d8fd16fde3498b04306e29bd193bf306a57427019b823d5acd" +checksum = "4f3208ce4d8448b3f3e7d168a73f5e0c43a61e32930de3bceeccedb388b6bf06" [[package]] name = "ryu" -version = "1.0.5" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" +checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" [[package]] name = "serde" -version = "1.0.125" +version = "1.0.160" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "558dc50e1a5a5fa7112ca2ce4effcb321b0300c0d4ccf0776a9f60cd89031171" -dependencies = [ - "serde_derive", -] +checksum = "bb2f3770c8bce3bcda7e149193a069a0f4365bda1fa5cd88e03bca26afc1216c" [[package]] name = "serde_derive" -version = "1.0.125" +version = "1.0.160" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b093b7a2bb58203b5da3056c05b4ec1fed827dcfdb37347a8841695263b3d06d" +checksum = "291a097c63d8497e00160b166a967a4a79c64f3facdd01cbd7502231688d77df" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.15", ] [[package]] name = "serde_json" -version = "1.0.64" +version = "1.0.96" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79" +checksum = "057d394a50403bcac12672b2b18fb387ab6d289d957dab67dd201875391e52f1" dependencies = [ "itoa", "ryu", @@ -150,78 +156,81 @@ dependencies = [ [[package]] name = "static_assertions" -version = "0.3.4" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f3eb36b47e512f8f1c9e3d10c2c1965bc992bd9cdb024fa581e2194501c83d3" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "syn" -version = "1.0.68" +version = "1.0.109" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ce15dd3ed8aa2f8eeac4716d6ef5ab58b6b9256db41d7e1a0224c2788e8fd87" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" dependencies = [ "proc-macro2", "quote", - "unicode-xid", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a34fcf3e8b60f57e6a14301a2e916d323af98b0ea63c599441eec8558660c822" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", ] [[package]] name = "termcolor" -version = "1.1.2" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4" +checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" dependencies = [ "winapi-util", ] [[package]] name = "thiserror" -version = "1.0.25" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa6f76457f59514c7eeb4e59d891395fab0b2fd1d40723ae737d64153392e9c6" +checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.25" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a36768c0fbf1bb15eca10defa29526bda730a2376c2ab4393ccfa16fb1a318d" +checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" dependencies = [ "proc-macro2", "quote", - "syn", -] - -[[package]] -name = "toml" -version = "0.5.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa" -dependencies = [ - "serde", + "syn 2.0.15", ] [[package]] name = "trybuild" -version = "1.0.41" +version = "1.0.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99471a206425fba51842a9186315f32d91c56eadc21ea4c21f847b59cf778f8b" +checksum = "501dbdbb99861e4ab6b60eb6a7493956a9defb644fd034bc4a5ef27c693c8a3a" dependencies = [ + "basic-toml", "glob", - "lazy_static", + "once_cell", "serde", + "serde_derive", "serde_json", "termcolor", - "toml", ] [[package]] -name = "unicode-xid" -version = "0.2.1" +name = "unicode-ident" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" +checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" [[package]] name = "winapi" diff --git a/vendor/displaydoc/Cargo.toml b/vendor/displaydoc/Cargo.toml index 9803ab6e8..1affcca6b 100644 --- a/vendor/displaydoc/Cargo.toml +++ b/vendor/displaydoc/Cargo.toml @@ -3,69 +3,84 @@ # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies -# to registry (e.g., crates.io) dependencies +# to registry (e.g., crates.io) dependencies. # -# If you believe there's an error in this file please file an -# issue against the rust-lang/cargo repository. If you're -# editing this file be aware that the upstream Cargo.toml -# will likely look very different (and much more reasonable) +# If you are reading this file be aware that the original Cargo.toml +# will likely look very different (and much more reasonable). +# See Cargo.toml.orig for the original contents. [package] edition = "2018" name = "displaydoc" -version = "0.2.3" +version = "0.2.4" authors = ["Jane Lusby <jlusby@yaah.dev>"] -description = "A derive macro for implementing the display Trait via a doc comment and string interpolation\n" +description = """ +A derive macro for implementing the display Trait via a doc comment and string interpolation +""" homepage = "https://github.com/yaahc/displaydoc" documentation = "https://docs.rs/displaydoc" readme = "README.md" -keywords = ["display", "derive"] +keywords = [ + "display", + "derive", +] license = "MIT OR Apache-2.0" repository = "https://github.com/yaahc/displaydoc" + [package.metadata.docs.rs] all-features = true -rustdoc-args = ["--cfg", "docsrs"] +rustdoc-args = [ + "--cfg", + "docsrs", +] [package.metadata.release] no-dev-version = true +pre-release-hook = ["./update-readme.sh"] [[package.metadata.release.pre-release-replacements]] file = "CHANGELOG.md" -replace = "{{version}}" search = "Unreleased" +replace = "{{version}}" [[package.metadata.release.pre-release-replacements]] -exactly = 1 file = "src/lib.rs" +search = '#!\[doc\(html_root_url.*' replace = "#![doc(html_root_url = \"https://docs.rs/{{crate_name}}/{{version}}\")]" -search = "#!\\[doc\\(html_root_url.*" +exactly = 1 [[package.metadata.release.pre-release-replacements]] file = "CHANGELOG.md" -replace = "{{date}}" search = "ReleaseDate" +replace = "{{date}}" [[package.metadata.release.pre-release-replacements]] -exactly = 1 file = "CHANGELOG.md" -replace = "<!-- next-header -->\n\n## [Unreleased] - ReleaseDate" search = "<!-- next-header -->" +replace = """ +<!-- next-header --> -[[package.metadata.release.pre-release-replacements]] +# [Unreleased] - ReleaseDate""" exactly = 1 + +[[package.metadata.release.pre-release-replacements]] file = "CHANGELOG.md" +search = '\.\.\.HEAD' replace = "...{{tag_name}}" -search = "\\.\\.\\.HEAD" +exactly = 1 [[package.metadata.release.pre-release-replacements]] -exactly = 1 file = "CHANGELOG.md" -replace = "<!-- next-url -->\n[Unreleased]: https://github.com/yaahc/{{crate_name}}/compare/{{tag_name}}...HEAD" search = "<!-- next-url -->" +replace = """ +<!-- next-url --> +[Unreleased]: https://github.com/yaahc/{{crate_name}}/compare/{{tag_name}}...HEAD""" +exactly = 1 [lib] path = "src/lib.rs" proc-macro = true + [dependencies.proc-macro2] version = "1.0" @@ -73,7 +88,8 @@ version = "1.0" version = "1.0" [dependencies.syn] -version = "1.0" +version = "2.0" + [dev-dependencies.libc] version = "0.2" default-features = false @@ -85,7 +101,7 @@ version = "0.6.1" version = "1.0.0" [dev-dependencies.static_assertions] -version = "0.3.4" +version = "1.1" [dev-dependencies.thiserror] version = "1.0.24" diff --git a/vendor/displaydoc/LICENSE-APACHE b/vendor/displaydoc/LICENSE-APACHE index 16fe87b06..f47c94114 100644 --- a/vendor/displaydoc/LICENSE-APACHE +++ b/vendor/displaydoc/LICENSE-APACHE @@ -1,201 +1,201 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS - -APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - -Copyright [yyyy] [name of copyright owner] - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. + Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+Copyright [yyyy] [name of copyright owner]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
diff --git a/vendor/displaydoc/LICENSE-MIT b/vendor/displaydoc/LICENSE-MIT index 31aa79387..458723b37 100644 --- a/vendor/displaydoc/LICENSE-MIT +++ b/vendor/displaydoc/LICENSE-MIT @@ -1,23 +1,23 @@ -Permission is hereby granted, free of charge, to any -person obtaining a copy of this software and associated -documentation files (the "Software"), to deal in the -Software without restriction, including without -limitation the rights to use, copy, modify, merge, -publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software -is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice -shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF -ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED -TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT -SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR -IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. +Permission is hereby granted, free of charge, to any
+person obtaining a copy of this software and associated
+documentation files (the "Software"), to deal in the
+Software without restriction, including without
+limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software
+is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice
+shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
+ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
+TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
+SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
diff --git a/vendor/displaydoc/README.md b/vendor/displaydoc/README.md index 990a1385e..b8fa09157 100644 --- a/vendor/displaydoc/README.md +++ b/vendor/displaydoc/README.md @@ -1,99 +1,115 @@ -derive(Display) /// `From<docs>` -=============== - -[![Latest Version](https://img.shields.io/crates/v/displaydoc.svg)](https://crates.io/crates/displaydoc) -[![Rust Documentation](https://img.shields.io/badge/api-rustdoc-blue.svg)](https://docs.rs/displaydoc) - -This library provides a convenient derive macro for the standard library's -[`core::fmt::Display`] trait. - -[`core::fmt::Display`]: https://doc.rust-lang.org/std/fmt/trait.Display.html - -```toml -[dependencies] -displaydoc = "0.2" -``` - -*Compiler support: requires rustc 1.31+* - -<br> - -### Example - -```rust -use std::io; -use displaydoc::Display; -use thiserror::Error; - -#[derive(Display, Error, Debug)] -pub enum DataStoreError { - /// data store disconnected - Disconnect(#[source] io::Error), - /// the data for key `{0}` is not available - Redaction(String), - /// invalid header (expected {expected:?}, found {found:?}) - InvalidHeader { - expected: String, - found: String, - }, - /// unknown data store error - Unknown, -} -``` - -<br> - -### Details - -- A `Display` impl is generated for your type if you provide doc comment - messages on the struct or each variant of your enum, as shown above in the - example. - - The messages support a shorthand for interpolating fields from the error. - - - `/// {var}` ⟶ `write!("{}", self.var)` - - `/// {0}` ⟶ `write!("{}", self.0)` - - `/// {var:?}` ⟶ `write!("{:?}", self.var)` - - `/// {0:?}` ⟶ `write!("{:?}", self.0)` - -- Two optional attributes can be added to your types next to the derive: - - - `#[ignore_extra_doc_attributes]` makes the macro ignore any doc - comment attributes (or `///` lines) after the first. Multi-line - comments using `///` are otherwise treated as an error, so use this - attribute or consider switching to block doc comments (`/** */`). - - - `#[prefix_enum_doc_attributes]` combines the doc comment message on - your enum itself with the messages for each variant, in the format - “enum: variant”. When added to an enum, the doc comment on the enum - becomes mandatory. When added to any other type, it has no effect. - -- In case you want to have an independent doc comment, the - `#[displaydoc("...")` atrribute may be used on the variant or struct to - override it. - -<br> - -### FAQ - -1. **Is this crate `no_std` compatible?** - * Yes! This crate implements the `core::fmt::Display` trait not the `std::fmt::Display` trait so it should work in `std` and `no_std` environments. Just add `default-features = false`. - -2. **Does this crate work with `Path` and `PathBuf` via the `Display` trait?** - * Yuuup. This crate uses @dtolnay's [autoref specialization technique](https://github.com/dtolnay/case-studies/blob/master/autoref-specialization/README.md) to add a special trait for types to get the display impl, it then specializes for `Path` and `PathBuf` and when either of these types are found it calls `self.display()` to get a `std::path::Display<'_>` type which can be used with the Display format specifier! - - -#### License - -<sup> -Licensed under either of <a href="LICENSE-APACHE">Apache License, Version -2.0</a> or <a href="LICENSE-MIT">MIT license</a> at your option. -</sup> - -<br> - -<sub> -Unless you explicitly state otherwise, any contribution intentionally submitted -for inclusion in this crate by you, as defined in the Apache-2.0 license, shall -be dual licensed as above, without any additional terms or conditions. -</sub> +derive(Display) /// `From<docs>`
+===============
+
+[![Latest Version](https://img.shields.io/crates/v/displaydoc.svg)](https://crates.io/crates/displaydoc)
+[![Rust Documentation](https://img.shields.io/badge/api-rustdoc-blue.svg)](https://docs.rs/displaydoc)
+
+This library provides a convenient derive macro for the standard library's
+[`core::fmt::Display`] trait.
+
+[`core::fmt::Display`]: https://doc.rust-lang.org/std/fmt/trait.Display.html
+
+```toml
+[dependencies]
+displaydoc = "0.2"
+```
+
+*Compiler support: requires rustc 1.56+*
+
+<br>
+
+### Example
+
+*Demonstration alongside the [`Error`][std::error::Error] derive macro from [`thiserror`](https://docs.rs/thiserror/1.0.25/thiserror/index.html),
+to propagate source locations from [`io::Error`][std::io::Error] with the `#[source]` attribute:*
+```rust
+use std::io;
+use displaydoc::Display;
+use thiserror::Error;
+
+#[derive(Display, Error, Debug)]
+pub enum DataStoreError {
+ /// data store disconnected
+ Disconnect(#[source] io::Error),
+ /// the data for key `{0}` is not available
+ Redaction(String),
+ /// invalid header (expected {expected:?}, found {found:?})
+ InvalidHeader {
+ expected: String,
+ found: String,
+ },
+ /// unknown data store error
+ Unknown,
+}
+
+let error = DataStoreError::Redaction("CLASSIFIED CONTENT".to_string());
+assert!("the data for key `CLASSIFIED CONTENT` is not available" == &format!("{}", error));
+```
+*Note that although [`io::Error`][std::io::Error] implements `Display`, we do not add it to the
+generated message for `DataStoreError::Disconnect`, since it is already made available via
+`#[source]`. See further context on avoiding duplication in error reports at the rust blog
+[here](https://github.com/yaahc/blog.rust-lang.org/blob/master/posts/inside-rust/2021-05-15-What-the-error-handling-project-group-is-working-towards.md#duplicate-information-issue).*
+
+<br>
+
+### Details
+
+- A `fmt::Display` impl is generated for your enum if you provide
+ a docstring comment on each variant as shown above in the example. The
+ `Display` derive macro supports a shorthand for interpolating fields from
+ the error:
+ - `/// {var}` ⟶ `write!("{}", self.var)`
+ - `/// {0}` ⟶ `write!("{}", self.0)`
+ - `/// {var:?}` ⟶ `write!("{:?}", self.var)`
+ - `/// {0:?}` ⟶ `write!("{:?}", self.0)`
+- This also works with structs and [generic types][crate::Display#generic-type-parameters]:
+```rust
+/// oh no, an error: {0}
+#[derive(Display)]
+pub struct Error<E>(pub E);
+
+let error: Error<&str> = Error("muahaha i am an error");
+assert!("oh no, an error: muahaha i am an error" == &format!("{}", error));
+```
+
+- Two optional attributes can be added to your types next to the derive:
+
+ - `#[ignore_extra_doc_attributes]` makes the macro ignore any doc
+ comment attributes (or `///` lines) after the first. Multi-line
+ comments using `///` are otherwise treated as an error, so use this
+ attribute or consider switching to block doc comments (`/** */`).
+
+ - `#[prefix_enum_doc_attributes]` combines the doc comment message on
+ your enum itself with the messages for each variant, in the format
+ “enum: variant”. When added to an enum, the doc comment on the enum
+ becomes mandatory. When added to any other type, it has no effect.
+
+- In case you want to have an independent doc comment, the
+ `#[displaydoc("...")` atrribute may be used on the variant or struct to
+ override it.
+
+<br>
+
+### FAQ
+
+1. **Is this crate `no_std` compatible?**
+ * Yes! This crate implements the [`core::fmt::Display`] trait, not the [`std::fmt::Display`] trait, so it should work in `std` and `no_std` environments. Just add `default-features = false`.
+
+2. **Does this crate work with `Path` and `PathBuf` via the `Display` trait?**
+ * Yuuup. This crate uses @dtolnay's [autoref specialization technique](https://github.com/dtolnay/case-studies/blob/master/autoref-specialization/README.md) to add a special trait for types to get the display impl. It then specializes for `Path` and `PathBuf`, and when either of these types are found, it calls `self.display()` to get a `std::path::Display<'_>` type which can be used with the `Display` format specifier!
+
+
+#### License
+
+<sup>
+Licensed under either of <a href="LICENSE-APACHE">Apache License, Version
+2.0</a> or <a href="LICENSE-MIT">MIT license</a> at your option.
+</sup>
+
+<br>
+
+<sub>
+Unless you explicitly state otherwise, any contribution intentionally submitted
+for inclusion in this crate by you, as defined in the Apache-2.0 license, shall
+be dual licensed as above, without any additional terms or conditions.
+</sub>
diff --git a/vendor/displaydoc/README.tpl b/vendor/displaydoc/README.tpl index 6206a9e7e..b131fb8aa 100644 --- a/vendor/displaydoc/README.tpl +++ b/vendor/displaydoc/README.tpl @@ -1,23 +1,23 @@ -derive(Display) /// `From<docs>` -=============== - -[![Latest Version](https://img.shields.io/crates/v/displaydoc.svg)](https://crates.io/crates/displaydoc) -[![Rust Documentation](https://img.shields.io/badge/api-rustdoc-blue.svg)](https://docs.rs/displaydoc) - -{{readme}} - - -#### License - -<sup> -Licensed under either of <a href="LICENSE-APACHE">Apache License, Version -2.0</a> or <a href="LICENSE-MIT">MIT license</a> at your option. -</sup> - -<br> - -<sub> -Unless you explicitly state otherwise, any contribution intentionally submitted -for inclusion in this crate by you, as defined in the Apache-2.0 license, shall -be dual licensed as above, without any additional terms or conditions. -</sub> +derive(Display) /// `From<docs>`
+===============
+
+[![Latest Version](https://img.shields.io/crates/v/displaydoc.svg)](https://crates.io/crates/displaydoc)
+[![Rust Documentation](https://img.shields.io/badge/api-rustdoc-blue.svg)](https://docs.rs/displaydoc)
+
+{{readme}}
+
+
+#### License
+
+<sup>
+Licensed under either of <a href="LICENSE-APACHE">Apache License, Version
+2.0</a> or <a href="LICENSE-MIT">MIT license</a> at your option.
+</sup>
+
+<br>
+
+<sub>
+Unless you explicitly state otherwise, any contribution intentionally submitted
+for inclusion in this crate by you, as defined in the Apache-2.0 license, shall
+be dual licensed as above, without any additional terms or conditions.
+</sub>
diff --git a/vendor/displaydoc/examples/simple.rs b/vendor/displaydoc/examples/simple.rs index f4aad2131..1f9fd1198 100644 --- a/vendor/displaydoc/examples/simple.rs +++ b/vendor/displaydoc/examples/simple.rs @@ -1,36 +1,36 @@ -use displaydoc::Display; - -#[derive(Debug, Display)] -pub enum DataStoreError { - /// data store disconnected - Disconnect, - /// the data for key `{0}` is not available - Redaction(String), - /// invalid header (expected {expected:?}, found {found:?}) - InvalidHeader { expected: String, found: String }, - /// unknown data store error - Unknown, -} - -fn main() { - let disconnect = DataStoreError::Disconnect; - println!( - "Enum value `Disconnect` should be printed as:\n\t{}", - disconnect - ); - - let redaction = DataStoreError::Redaction(String::from("Dummy")); - println!( - "Enum value `Redaction` should be printed as:\n\t{}", - redaction - ); - - let invalid_header = DataStoreError::InvalidHeader { - expected: String::from("https"), - found: String::from("http"), - }; - println!( - "Enum value `InvalidHeader` should be printed as:\n\t{}", - invalid_header - ); -} +use displaydoc::Display;
+
+#[derive(Debug, Display)]
+pub enum DataStoreError {
+ /// data store disconnected
+ Disconnect,
+ /// the data for key `{0}` is not available
+ Redaction(String),
+ /// invalid header (expected {expected:?}, found {found:?})
+ InvalidHeader { expected: String, found: String },
+ /// unknown data store error
+ Unknown,
+}
+
+fn main() {
+ let disconnect = DataStoreError::Disconnect;
+ println!(
+ "Enum value `Disconnect` should be printed as:\n\t{}",
+ disconnect
+ );
+
+ let redaction = DataStoreError::Redaction(String::from("Dummy"));
+ println!(
+ "Enum value `Redaction` should be printed as:\n\t{}",
+ redaction
+ );
+
+ let invalid_header = DataStoreError::InvalidHeader {
+ expected: String::from("https"),
+ found: String::from("http"),
+ };
+ println!(
+ "Enum value `InvalidHeader` should be printed as:\n\t{}",
+ invalid_header
+ );
+}
diff --git a/vendor/displaydoc/src/attr.rs b/vendor/displaydoc/src/attr.rs index e14593556..a965d04de 100644 --- a/vendor/displaydoc/src/attr.rs +++ b/vendor/displaydoc/src/attr.rs @@ -1,134 +1,137 @@ -use proc_macro2::TokenStream; -use quote::{quote, ToTokens}; -use syn::{Attribute, LitStr, Meta, Result}; - -#[derive(Clone)] -pub(crate) struct Display { - pub(crate) fmt: LitStr, - pub(crate) args: TokenStream, -} - -pub(crate) struct VariantDisplay { - pub(crate) r#enum: Option<Display>, - pub(crate) variant: Display, -} - -impl ToTokens for Display { - fn to_tokens(&self, tokens: &mut TokenStream) { - let fmt = &self.fmt; - let args = &self.args; - tokens.extend(quote! { - write!(formatter, #fmt #args) - }); - } -} - -impl ToTokens for VariantDisplay { - fn to_tokens(&self, tokens: &mut TokenStream) { - if let Some(ref r#enum) = self.r#enum { - r#enum.to_tokens(tokens); - tokens.extend(quote! { ?; write!(formatter, ": ")?; }); - } - self.variant.to_tokens(tokens); - } -} - -pub(crate) struct AttrsHelper { - ignore_extra_doc_attributes: bool, - prefix_enum_doc_attributes: bool, -} - -impl AttrsHelper { - pub(crate) fn new(attrs: &[Attribute]) -> Self { - let ignore_extra_doc_attributes = attrs - .iter() - .any(|attr| attr.path.is_ident("ignore_extra_doc_attributes")); - let prefix_enum_doc_attributes = attrs - .iter() - .any(|attr| attr.path.is_ident("prefix_enum_doc_attributes")); - - Self { - ignore_extra_doc_attributes, - prefix_enum_doc_attributes, - } - } - - pub(crate) fn display(&self, attrs: &[Attribute]) -> Result<Option<Display>> { - let displaydoc_attr = attrs.iter().find(|attr| attr.path.is_ident("displaydoc")); - - if let Some(displaydoc_attr) = displaydoc_attr { - let lit = displaydoc_attr - .parse_args() - .expect("#[displaydoc(\"foo\")] must contain string arguments"); - let mut display = Display { - fmt: lit, - args: TokenStream::new(), - }; - - display.expand_shorthand(); - return Ok(Some(display)); - } - - let num_doc_attrs = attrs - .iter() - .filter(|attr| attr.path.is_ident("doc")) - .count(); - - if !self.ignore_extra_doc_attributes && num_doc_attrs > 1 { - panic!("Multi-line comments are disabled by default by displaydoc. Please consider using block doc comments (/** */) or adding the #[ignore_extra_doc_attributes] attribute to your type next to the derive."); - } - - for attr in attrs { - if attr.path.is_ident("doc") { - let meta = attr.parse_meta()?; - let lit = match meta { - Meta::NameValue(syn::MetaNameValue { - lit: syn::Lit::Str(lit), - .. - }) => lit, - _ => unimplemented!(), - }; - - // Make an attempt and cleaning up multiline doc comments - let doc_str = lit - .value() - .lines() - .map(|line| line.trim().trim_start_matches('*').trim()) - .collect::<Vec<&str>>() - .join("\n"); - - let lit = LitStr::new(doc_str.trim(), lit.span()); - - let mut display = Display { - fmt: lit, - args: TokenStream::new(), - }; - - display.expand_shorthand(); - return Ok(Some(display)); - } - } - - Ok(None) - } - - pub(crate) fn display_with_input( - &self, - r#enum: &[Attribute], - variant: &[Attribute], - ) -> Result<Option<VariantDisplay>> { - let r#enum = if self.prefix_enum_doc_attributes { - let result = self - .display(r#enum)? - .expect("Missing doc comment on enum with #[prefix_enum_doc_attributes]. Please remove the attribute or add a doc comment to the enum itself."); - - Some(result) - } else { - None - }; - - Ok(self - .display(variant)? - .map(|variant| VariantDisplay { r#enum, variant })) - } -} +use proc_macro2::TokenStream;
+use quote::{quote, ToTokens};
+use syn::{Attribute, LitStr, Meta, Result};
+
+#[derive(Clone)]
+pub(crate) struct Display {
+ pub(crate) fmt: LitStr,
+ pub(crate) args: TokenStream,
+}
+
+pub(crate) struct VariantDisplay {
+ pub(crate) r#enum: Option<Display>,
+ pub(crate) variant: Display,
+}
+
+impl ToTokens for Display {
+ fn to_tokens(&self, tokens: &mut TokenStream) {
+ let fmt = &self.fmt;
+ let args = &self.args;
+ tokens.extend(quote! {
+ write!(formatter, #fmt #args)
+ });
+ }
+}
+
+impl ToTokens for VariantDisplay {
+ fn to_tokens(&self, tokens: &mut TokenStream) {
+ if let Some(ref r#enum) = self.r#enum {
+ r#enum.to_tokens(tokens);
+ tokens.extend(quote! { ?; write!(formatter, ": ")?; });
+ }
+ self.variant.to_tokens(tokens);
+ }
+}
+
+pub(crate) struct AttrsHelper {
+ ignore_extra_doc_attributes: bool,
+ prefix_enum_doc_attributes: bool,
+}
+
+impl AttrsHelper {
+ pub(crate) fn new(attrs: &[Attribute]) -> Self {
+ let ignore_extra_doc_attributes = attrs
+ .iter()
+ .any(|attr| attr.path().is_ident("ignore_extra_doc_attributes"));
+ let prefix_enum_doc_attributes = attrs
+ .iter()
+ .any(|attr| attr.path().is_ident("prefix_enum_doc_attributes"));
+
+ Self {
+ ignore_extra_doc_attributes,
+ prefix_enum_doc_attributes,
+ }
+ }
+
+ pub(crate) fn display(&self, attrs: &[Attribute]) -> Result<Option<Display>> {
+ let displaydoc_attr = attrs.iter().find(|attr| attr.path().is_ident("displaydoc"));
+
+ if let Some(displaydoc_attr) = displaydoc_attr {
+ let lit = displaydoc_attr
+ .parse_args()
+ .expect("#[displaydoc(\"foo\")] must contain string arguments");
+ let mut display = Display {
+ fmt: lit,
+ args: TokenStream::new(),
+ };
+
+ display.expand_shorthand();
+ return Ok(Some(display));
+ }
+
+ let num_doc_attrs = attrs
+ .iter()
+ .filter(|attr| attr.path().is_ident("doc"))
+ .count();
+
+ if !self.ignore_extra_doc_attributes && num_doc_attrs > 1 {
+ panic!("Multi-line comments are disabled by default by displaydoc. Please consider using block doc comments (/** */) or adding the #[ignore_extra_doc_attributes] attribute to your type next to the derive.");
+ }
+
+ for attr in attrs {
+ if attr.path().is_ident("doc") {
+ let lit = match &attr.meta {
+ Meta::NameValue(syn::MetaNameValue {
+ value:
+ syn::Expr::Lit(syn::ExprLit {
+ lit: syn::Lit::Str(lit),
+ ..
+ }),
+ ..
+ }) => lit,
+ _ => unimplemented!(),
+ };
+
+ // Make an attempt at cleaning up multiline doc comments.
+ let doc_str = lit
+ .value()
+ .lines()
+ .map(|line| line.trim().trim_start_matches('*').trim())
+ .collect::<Vec<&str>>()
+ .join("\n");
+
+ let lit = LitStr::new(doc_str.trim(), lit.span());
+
+ let mut display = Display {
+ fmt: lit,
+ args: TokenStream::new(),
+ };
+
+ display.expand_shorthand();
+ return Ok(Some(display));
+ }
+ }
+
+ Ok(None)
+ }
+
+ pub(crate) fn display_with_input(
+ &self,
+ r#enum: &[Attribute],
+ variant: &[Attribute],
+ ) -> Result<Option<VariantDisplay>> {
+ let r#enum = if self.prefix_enum_doc_attributes {
+ let result = self
+ .display(r#enum)?
+ .expect("Missing doc comment on enum with #[prefix_enum_doc_attributes]. Please remove the attribute or add a doc comment to the enum itself.");
+
+ Some(result)
+ } else {
+ None
+ };
+
+ Ok(self
+ .display(variant)?
+ .map(|variant| VariantDisplay { r#enum, variant }))
+ }
+}
diff --git a/vendor/displaydoc/src/expand.rs b/vendor/displaydoc/src/expand.rs index 6904cbc8c..8a84390be 100644 --- a/vendor/displaydoc/src/expand.rs +++ b/vendor/displaydoc/src/expand.rs @@ -1,145 +1,410 @@ -use super::attr::AttrsHelper; -use proc_macro2::TokenStream; -use quote::{format_ident, quote}; -use syn::{Data, DataEnum, DataStruct, DeriveInput, Error, Fields, Result}; - -pub(crate) fn derive(input: &DeriveInput) -> Result<TokenStream> { - let impls = match &input.data { - Data::Struct(data) => impl_struct(input, data), - Data::Enum(data) => impl_enum(input, data), - Data::Union(_) => Err(Error::new_spanned(input, "Unions are not supported")), - }?; - - let helpers = specialization(); - let dummy_const = format_ident!("_DERIVE_Display_FOR_{}", input.ident); - Ok(quote! { - #[allow(non_upper_case_globals, unused_attributes, unused_qualifications)] - const #dummy_const: () = { - #helpers - #impls - }; - }) -} - -#[cfg(feature = "std")] -fn specialization() -> TokenStream { - quote! { - trait DisplayToDisplayDoc { - fn __displaydoc_display(&self) -> Self; - } - - impl<T: core::fmt::Display> DisplayToDisplayDoc for &T { - fn __displaydoc_display(&self) -> Self { - self - } - } - - // If the `std` feature gets enabled we want to ensure that any crate - // using displaydoc can still reference the std crate, which is already - // being compiled in by whoever enabled the `std` feature in - // `displaydoc`, even if the crates using displaydoc are no_std. - extern crate std; - - trait PathToDisplayDoc { - fn __displaydoc_display(&self) -> std::path::Display<'_>; - } - - impl PathToDisplayDoc for std::path::Path { - fn __displaydoc_display(&self) -> std::path::Display<'_> { - self.display() - } - } - - impl PathToDisplayDoc for std::path::PathBuf { - fn __displaydoc_display(&self) -> std::path::Display<'_> { - self.display() - } - } - } -} - -#[cfg(not(feature = "std"))] -fn specialization() -> TokenStream { - quote! {} -} - -fn impl_struct(input: &DeriveInput, data: &DataStruct) -> Result<TokenStream> { - let ty = &input.ident; - let (impl_generics, ty_generics, where_clause) = input.generics.split_for_impl(); - - let helper = AttrsHelper::new(&input.attrs); - - let display = helper.display(&input.attrs)?.map(|display| { - let pat = match &data.fields { - Fields::Named(fields) => { - let var = fields.named.iter().map(|field| &field.ident); - quote!(Self { #(#var),* }) - } - Fields::Unnamed(fields) => { - let var = (0..fields.unnamed.len()).map(|i| format_ident!("_{}", i)); - quote!(Self(#(#var),*)) - } - Fields::Unit => quote!(_), - }; - quote! { - impl #impl_generics core::fmt::Display for #ty #ty_generics #where_clause { - fn fmt(&self, formatter: &mut core::fmt::Formatter) -> core::fmt::Result { - #[allow(unused_variables)] - let #pat = self; - #display - } - } - } - }); - - Ok(quote! { #display }) -} - -fn impl_enum(input: &DeriveInput, data: &DataEnum) -> Result<TokenStream> { - let ty = &input.ident; - let (impl_generics, ty_generics, where_clause) = input.generics.split_for_impl(); - - let helper = AttrsHelper::new(&input.attrs); - - let displays = data - .variants - .iter() - .map(|variant| helper.display_with_input(&input.attrs, &variant.attrs)) - .collect::<Result<Vec<_>>>()?; - - if displays.iter().any(Option::is_some) { - let arms = data - .variants - .iter() - .zip(displays) - .map(|(variant, display)| { - let display = - display.ok_or_else(|| Error::new_spanned(variant, "missing doc comment"))?; - let ident = &variant.ident; - Ok(match &variant.fields { - Fields::Named(fields) => { - let var = fields.named.iter().map(|field| &field.ident); - quote!(#ty::#ident { #(#var),* } => { #display }) - } - Fields::Unnamed(fields) => { - let var = (0..fields.unnamed.len()).map(|i| format_ident!("_{}", i)); - quote!(#ty::#ident(#(#var),*) => { #display }) - } - Fields::Unit => quote!(#ty::#ident => { #display }), - }) - }) - .collect::<Result<Vec<_>>>()?; - Ok(quote! { - impl #impl_generics core::fmt::Display for #ty #ty_generics #where_clause { - fn fmt(&self, formatter: &mut core::fmt::Formatter) -> core::fmt::Result { - #[allow(unused_variables)] - match self { - #(#arms,)* - } - } - } - }) - } else { - Err(Error::new_spanned(input, "Missing doc comments")) - } -} +use super::attr::AttrsHelper;
+use proc_macro2::{Span, TokenStream};
+use quote::{format_ident, quote};
+use syn::{
+ punctuated::Punctuated,
+ token::{Colon, Comma, PathSep, Plus, Where},
+ Data, DataEnum, DataStruct, DeriveInput, Error, Fields, Generics, Ident, Path, PathArguments,
+ PathSegment, PredicateType, Result, TraitBound, TraitBoundModifier, Type, TypeParam,
+ TypeParamBound, TypePath, WhereClause, WherePredicate,
+};
+
+use std::collections::HashMap;
+
+pub(crate) fn derive(input: &DeriveInput) -> Result<TokenStream> {
+ let impls = match &input.data {
+ Data::Struct(data) => impl_struct(input, data),
+ Data::Enum(data) => impl_enum(input, data),
+ Data::Union(_) => Err(Error::new_spanned(input, "Unions are not supported")),
+ }?;
+
+ let helpers = specialization();
+ let dummy_const = format_ident!("_DERIVE_Display_FOR_{}", input.ident);
+ Ok(quote! {
+ #[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
+ const #dummy_const: () = {
+ #helpers
+ #impls
+ };
+ })
+}
+
+#[cfg(feature = "std")]
+fn specialization() -> TokenStream {
+ quote! {
+ trait DisplayToDisplayDoc {
+ fn __displaydoc_display(&self) -> Self;
+ }
+
+ impl<T: core::fmt::Display> DisplayToDisplayDoc for &T {
+ fn __displaydoc_display(&self) -> Self {
+ self
+ }
+ }
+
+ // If the `std` feature gets enabled we want to ensure that any crate
+ // using displaydoc can still reference the std crate, which is already
+ // being compiled in by whoever enabled the `std` feature in
+ // `displaydoc`, even if the crates using displaydoc are no_std.
+ extern crate std;
+
+ trait PathToDisplayDoc {
+ fn __displaydoc_display(&self) -> std::path::Display<'_>;
+ }
+
+ impl PathToDisplayDoc for std::path::Path {
+ fn __displaydoc_display(&self) -> std::path::Display<'_> {
+ self.display()
+ }
+ }
+
+ impl PathToDisplayDoc for std::path::PathBuf {
+ fn __displaydoc_display(&self) -> std::path::Display<'_> {
+ self.display()
+ }
+ }
+ }
+}
+
+#[cfg(not(feature = "std"))]
+fn specialization() -> TokenStream {
+ quote! {}
+}
+
+fn impl_struct(input: &DeriveInput, data: &DataStruct) -> Result<TokenStream> {
+ let ty = &input.ident;
+ let (impl_generics, ty_generics, where_clause) = input.generics.split_for_impl();
+ let where_clause = generate_where_clause(&input.generics, where_clause);
+
+ let helper = AttrsHelper::new(&input.attrs);
+
+ let display = helper.display(&input.attrs)?.map(|display| {
+ let pat = match &data.fields {
+ Fields::Named(fields) => {
+ let var = fields.named.iter().map(|field| &field.ident);
+ quote!(Self { #(#var),* })
+ }
+ Fields::Unnamed(fields) => {
+ let var = (0..fields.unnamed.len()).map(|i| format_ident!("_{}", i));
+ quote!(Self(#(#var),*))
+ }
+ Fields::Unit => quote!(_),
+ };
+ quote! {
+ impl #impl_generics core::fmt::Display for #ty #ty_generics #where_clause {
+ fn fmt(&self, formatter: &mut core::fmt::Formatter) -> core::fmt::Result {
+ // NB: This destructures the fields of `self` into named variables (for unnamed
+ // fields, it uses _0, _1, etc as above). The `#[allow(unused_variables)]`
+ // section means it doesn't have to parse the individual field references out of
+ // the docstring.
+ #[allow(unused_variables)]
+ let #pat = self;
+ #display
+ }
+ }
+ }
+ });
+
+ Ok(quote! { #display })
+}
+
+/// Create a `where` predicate for `ident`, without any [bound][TypeParamBound]s yet.
+fn new_empty_where_type_predicate(ident: Ident) -> PredicateType {
+ let mut path_segments = Punctuated::<PathSegment, PathSep>::new();
+ path_segments.push_value(PathSegment {
+ ident,
+ arguments: PathArguments::None,
+ });
+ PredicateType {
+ lifetimes: None,
+ bounded_ty: Type::Path(TypePath {
+ qself: None,
+ path: Path {
+ leading_colon: None,
+ segments: path_segments,
+ },
+ }),
+ colon_token: Colon {
+ spans: [Span::call_site()],
+ },
+ bounds: Punctuated::<TypeParamBound, Plus>::new(),
+ }
+}
+
+/// Create a `where` clause that we can add [WherePredicate]s to.
+fn new_empty_where_clause() -> WhereClause {
+ WhereClause {
+ where_token: Where {
+ span: Span::call_site(),
+ },
+ predicates: Punctuated::<WherePredicate, Comma>::new(),
+ }
+}
+
+enum UseGlobalPrefix {
+ LeadingColon,
+ #[allow(dead_code)]
+ NoLeadingColon,
+}
+
+/// Create a path with segments composed of [Idents] *without* any [PathArguments].
+fn join_paths(name_segments: &[&str], use_global_prefix: UseGlobalPrefix) -> Path {
+ let mut segments = Punctuated::<PathSegment, PathSep>::new();
+ assert!(!name_segments.is_empty());
+ segments.push_value(PathSegment {
+ ident: Ident::new(name_segments[0], Span::call_site()),
+ arguments: PathArguments::None,
+ });
+ for name in name_segments[1..].iter() {
+ segments.push_punct(PathSep {
+ spans: [Span::call_site(), Span::mixed_site()],
+ });
+ segments.push_value(PathSegment {
+ ident: Ident::new(name, Span::call_site()),
+ arguments: PathArguments::None,
+ });
+ }
+ Path {
+ leading_colon: match use_global_prefix {
+ UseGlobalPrefix::LeadingColon => Some(PathSep {
+ spans: [Span::call_site(), Span::mixed_site()],
+ }),
+ UseGlobalPrefix::NoLeadingColon => None,
+ },
+ segments,
+ }
+}
+
+/// Push `new_type_predicate` onto the end of `where_clause`.
+fn append_where_clause_type_predicate(
+ where_clause: &mut WhereClause,
+ new_type_predicate: PredicateType,
+) {
+ // Push a comma at the end if there are already any `where` predicates.
+ if !where_clause.predicates.is_empty() {
+ where_clause.predicates.push_punct(Comma {
+ spans: [Span::call_site()],
+ });
+ }
+ where_clause
+ .predicates
+ .push_value(WherePredicate::Type(new_type_predicate));
+}
+
+/// Add a requirement for [core::fmt::Display] to a `where` predicate for some type.
+fn add_display_constraint_to_type_predicate(
+ predicate_that_needs_a_display_impl: &mut PredicateType,
+) {
+ // Create a `Path` of `::core::fmt::Display`.
+ let display_path = join_paths(&["core", "fmt", "Display"], UseGlobalPrefix::LeadingColon);
+
+ let display_bound = TypeParamBound::Trait(TraitBound {
+ paren_token: None,
+ modifier: TraitBoundModifier::None,
+ lifetimes: None,
+ path: display_path,
+ });
+ if !predicate_that_needs_a_display_impl.bounds.is_empty() {
+ predicate_that_needs_a_display_impl.bounds.push_punct(Plus {
+ spans: [Span::call_site()],
+ });
+ }
+
+ predicate_that_needs_a_display_impl
+ .bounds
+ .push_value(display_bound);
+}
+
+/// Map each declared generic type parameter to the set of all trait boundaries declared on it.
+///
+/// These boundaries may come from the declaration site:
+/// pub enum E<T: MyTrait> { ... }
+/// or a `where` clause after the parameter declarations:
+/// pub enum E<T> where T: MyTrait { ... }
+/// This method will return the boundaries from both of those cases.
+fn extract_trait_constraints_from_source(
+ where_clause: &WhereClause,
+ type_params: &[&TypeParam],
+) -> HashMap<Ident, Vec<TraitBound>> {
+ // Add trait bounds provided at the declaration site of type parameters for the struct/enum.
+ let mut param_constraint_mapping: HashMap<Ident, Vec<TraitBound>> = type_params
+ .iter()
+ .map(|type_param| {
+ let trait_bounds: Vec<TraitBound> = type_param
+ .bounds
+ .iter()
+ .flat_map(|bound| match bound {
+ TypeParamBound::Trait(trait_bound) => Some(trait_bound),
+ _ => None,
+ })
+ .cloned()
+ .collect();
+ (type_param.ident.clone(), trait_bounds)
+ })
+ .collect();
+
+ // Add trait bounds from `where` clauses, which may be type parameters or types containing
+ // those parameters.
+ for predicate in where_clause.predicates.iter() {
+ // We only care about type and not lifetime constraints here.
+ if let WherePredicate::Type(ref pred_ty) = predicate {
+ let ident = match &pred_ty.bounded_ty {
+ Type::Path(TypePath { path, qself: None }) => match path.get_ident() {
+ None => continue,
+ Some(ident) => ident,
+ },
+ _ => continue,
+ };
+ // We ignore any type constraints that aren't direct references to type
+ // parameters of the current enum of struct definition. No types can be
+ // constrained in a `where` clause unless they are a type parameter or a generic
+ // type instantiated with one of the type parameters, so by only allowing single
+ // identifiers, we can be sure that the constrained type is a type parameter
+ // that is contained in `param_constraint_mapping`.
+ if let Some((_, ref mut known_bounds)) = param_constraint_mapping
+ .iter_mut()
+ .find(|(id, _)| *id == ident)
+ {
+ for bound in pred_ty.bounds.iter() {
+ // We only care about trait bounds here.
+ if let TypeParamBound::Trait(ref bound) = bound {
+ known_bounds.push(bound.clone());
+ }
+ }
+ }
+ }
+ }
+
+ param_constraint_mapping
+}
+
+/// Hygienically add `where _: Display` to the set of [TypeParamBound]s for `ident`, creating such
+/// a set if necessary.
+fn ensure_display_in_where_clause_for_type(where_clause: &mut WhereClause, ident: Ident) {
+ for pred_ty in where_clause
+ .predicates
+ .iter_mut()
+ // Find the `where` predicate constraining the current type param, if it exists.
+ .flat_map(|predicate| match predicate {
+ WherePredicate::Type(pred_ty) => Some(pred_ty),
+ // We're looking through type constraints, not lifetime constraints.
+ _ => None,
+ })
+ {
+ // Do a complicated destructuring in order to check if the type being constrained in this
+ // `where` clause is the type we're looking for, so we can use the mutable reference to
+ // `pred_ty` if so.
+ let matches_desired_type = matches!(
+ &pred_ty.bounded_ty,
+ Type::Path(TypePath { path, .. }) if Some(&ident) == path.get_ident());
+ if matches_desired_type {
+ add_display_constraint_to_type_predicate(pred_ty);
+ return;
+ }
+ }
+
+ // If there is no `where` predicate for the current type param, we will construct one.
+ let mut new_type_predicate = new_empty_where_type_predicate(ident);
+ add_display_constraint_to_type_predicate(&mut new_type_predicate);
+ append_where_clause_type_predicate(where_clause, new_type_predicate);
+}
+
+/// For all declared type parameters, add a [core::fmt::Display] constraint, unless the type
+/// parameter already has any type constraint.
+fn ensure_where_clause_has_display_for_all_unconstrained_members(
+ where_clause: &mut WhereClause,
+ type_params: &[&TypeParam],
+) {
+ let param_constraint_mapping = extract_trait_constraints_from_source(where_clause, type_params);
+
+ for (ident, known_bounds) in param_constraint_mapping.into_iter() {
+ // If the type parameter has any constraints already, we don't want to touch it, to avoid
+ // breaking use cases where a type parameter only needs to impl `Debug`, for example.
+ if known_bounds.is_empty() {
+ ensure_display_in_where_clause_for_type(where_clause, ident);
+ }
+ }
+}
+
+/// Generate a `where` clause that ensures all generic type parameters `impl`
+/// [core::fmt::Display] unless already constrained.
+///
+/// This approach allows struct/enum definitions deriving [crate::Display] to avoid hardcoding
+/// a [core::fmt::Display] constraint into every type parameter.
+///
+/// If the type parameter isn't already constrained, we add a `where _: Display` clause to our
+/// display implementation to expect to be able to format every enum case or struct member.
+///
+/// In fact, we would preferably only require `where _: Display` or `where _: Debug` where the
+/// format string actually requires it. However, while [`std::fmt` defines a formal syntax for
+/// `format!()`][format syntax], it *doesn't* expose the actual logic to parse the format string,
+/// which appears to live in [`rustc_parse_format`]. While we use the [`syn`] crate to parse rust
+/// syntax, it also doesn't currently provide any method to introspect a `format!()` string. It
+/// would be nice to contribute this upstream in [`syn`].
+///
+/// [format syntax]: std::fmt#syntax
+/// [`rustc_parse_format`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_parse_format/index.html
+fn generate_where_clause(generics: &Generics, where_clause: Option<&WhereClause>) -> WhereClause {
+ let mut where_clause = where_clause.cloned().unwrap_or_else(new_empty_where_clause);
+ let type_params: Vec<&TypeParam> = generics.type_params().collect();
+ ensure_where_clause_has_display_for_all_unconstrained_members(&mut where_clause, &type_params);
+ where_clause
+}
+
+fn impl_enum(input: &DeriveInput, data: &DataEnum) -> Result<TokenStream> {
+ let ty = &input.ident;
+ let (impl_generics, ty_generics, where_clause) = input.generics.split_for_impl();
+ let where_clause = generate_where_clause(&input.generics, where_clause);
+
+ let helper = AttrsHelper::new(&input.attrs);
+
+ let displays = data
+ .variants
+ .iter()
+ .map(|variant| helper.display_with_input(&input.attrs, &variant.attrs))
+ .collect::<Result<Vec<_>>>()?;
+
+ if data.variants.is_empty() {
+ Ok(quote! {
+ impl #impl_generics core::fmt::Display for #ty #ty_generics #where_clause {
+ fn fmt(&self, formatter: &mut core::fmt::Formatter) -> core::fmt::Result {
+ unreachable!("empty enums cannot be instantiated and thus cannot be printed")
+ }
+ }
+ })
+ } else if displays.iter().any(Option::is_some) {
+ let arms = data
+ .variants
+ .iter()
+ .zip(displays)
+ .map(|(variant, display)| {
+ let display =
+ display.ok_or_else(|| Error::new_spanned(variant, "missing doc comment"))?;
+ let ident = &variant.ident;
+ Ok(match &variant.fields {
+ Fields::Named(fields) => {
+ let var = fields.named.iter().map(|field| &field.ident);
+ quote!(Self::#ident { #(#var),* } => { #display })
+ }
+ Fields::Unnamed(fields) => {
+ let var = (0..fields.unnamed.len()).map(|i| format_ident!("_{}", i));
+ quote!(Self::#ident(#(#var),*) => { #display })
+ }
+ Fields::Unit => quote!(Self::#ident => { #display }),
+ })
+ })
+ .collect::<Result<Vec<_>>>()?;
+ Ok(quote! {
+ impl #impl_generics core::fmt::Display for #ty #ty_generics #where_clause {
+ fn fmt(&self, formatter: &mut core::fmt::Formatter) -> core::fmt::Result {
+ #[allow(unused_variables)]
+ match self {
+ #(#arms,)*
+ }
+ }
+ }
+ })
+ } else {
+ Err(Error::new_spanned(input, "Missing doc comments"))
+ }
+}
diff --git a/vendor/displaydoc/src/fmt.rs b/vendor/displaydoc/src/fmt.rs index 5848557ea..3334a82ff 100644 --- a/vendor/displaydoc/src/fmt.rs +++ b/vendor/displaydoc/src/fmt.rs @@ -1,159 +1,159 @@ -use crate::attr::Display; -use proc_macro2::TokenStream; -use quote::quote_spanned; -use syn::{Ident, LitStr}; - -macro_rules! peek_next { - ($read:ident) => { - match $read.chars().next() { - Some(next) => next, - None => return, - } - }; -} - -impl Display { - // Transform `"error {var}"` to `"error {}", var`. - pub(crate) fn expand_shorthand(&mut self) { - let span = self.fmt.span(); - let fmt = self.fmt.value(); - let mut read = fmt.as_str(); - let mut out = String::new(); - let mut args = TokenStream::new(); - - while let Some(brace) = read.find('{') { - out += &read[..=brace]; - read = &read[brace + 1..]; - - // skip cases where we find a {{ - if read.starts_with('{') { - out.push('{'); - read = &read[1..]; - continue; - } - - let next = peek_next!(read); - - let var = match next { - '0'..='9' => take_int(&mut read), - 'a'..='z' | 'A'..='Z' | '_' => take_ident(&mut read), - _ => return, - }; - - let ident = Ident::new(&var, span); - - let next = peek_next!(read); - - let arg = if cfg!(feature = "std") && next == '}' { - quote_spanned!(span=> , #ident.__displaydoc_display()) - } else { - quote_spanned!(span=> , #ident) - }; - - args.extend(arg); - } - - out += read; - self.fmt = LitStr::new(&out, self.fmt.span()); - self.args = args; - } -} - -fn take_int(read: &mut &str) -> String { - let mut int = String::new(); - int.push('_'); - for (i, ch) in read.char_indices() { - match ch { - '0'..='9' => int.push(ch), - _ => { - *read = &read[i..]; - break; - } - } - } - int -} - -fn take_ident(read: &mut &str) -> String { - let mut ident = String::new(); - for (i, ch) in read.char_indices() { - match ch { - 'a'..='z' | 'A'..='Z' | '0'..='9' | '_' => ident.push(ch), - _ => { - *read = &read[i..]; - break; - } - } - } - ident -} - -#[cfg(test)] -mod tests { - use super::*; - use pretty_assertions::assert_eq; - use proc_macro2::Span; - - fn assert(input: &str, fmt: &str, args: &str) { - let mut display = Display { - fmt: LitStr::new(input, Span::call_site()), - args: TokenStream::new(), - }; - display.expand_shorthand(); - assert_eq!(fmt, display.fmt.value()); - assert_eq!(args, display.args.to_string()); - } - - #[test] - fn test_expand() { - assert("fn main() {{ }}", "fn main() {{ }}", ""); - } - - #[test] - #[cfg_attr(not(feature = "std"), ignore)] - fn test_std_expand() { - assert( - "{v} {v:?} {0} {0:?}", - "{} {:?} {} {:?}", - ", v . __displaydoc_display () , v , _0 . __displaydoc_display () , _0", - ); - assert("error {var}", "error {}", ", var . __displaydoc_display ()"); - - assert( - "error {var1}", - "error {}", - ", var1 . __displaydoc_display ()", - ); - - assert( - "error {var1var}", - "error {}", - ", var1var . __displaydoc_display ()", - ); - - assert( - "The path {0}", - "The path {}", - ", _0 . __displaydoc_display ()", - ); - assert("The path {0:?}", "The path {:?}", ", _0"); - } - - #[test] - #[cfg_attr(feature = "std", ignore)] - fn test_nostd_expand() { - assert( - "{v} {v:?} {0} {0:?}", - "{} {:?} {} {:?}", - ", v , v , _0 , _0", - ); - assert("error {var}", "error {}", ", var"); - - assert("The path {0}", "The path {}", ", _0"); - assert("The path {0:?}", "The path {:?}", ", _0"); - - assert("error {var1}", "error {}", ", var1"); - - assert("error {var1var}", "error {}", ", var1var"); - } -} +use crate::attr::Display;
+use proc_macro2::TokenStream;
+use quote::quote_spanned;
+use syn::{Ident, LitStr};
+
+macro_rules! peek_next {
+ ($read:ident) => {
+ match $read.chars().next() {
+ Some(next) => next,
+ None => return,
+ }
+ };
+}
+
+impl Display {
+ // Transform `"error {var}"` to `"error {}", var`.
+ pub(crate) fn expand_shorthand(&mut self) {
+ let span = self.fmt.span();
+ let fmt = self.fmt.value();
+ let mut read = fmt.as_str();
+ let mut out = String::new();
+ let mut args = TokenStream::new();
+
+ while let Some(brace) = read.find('{') {
+ out += &read[..=brace];
+ read = &read[brace + 1..];
+
+ // skip cases where we find a {{
+ if read.starts_with('{') {
+ out.push('{');
+ read = &read[1..];
+ continue;
+ }
+
+ let next = peek_next!(read);
+
+ let var = match next {
+ '0'..='9' => take_int(&mut read),
+ 'a'..='z' | 'A'..='Z' | '_' => take_ident(&mut read),
+ _ => return,
+ };
+
+ let ident = Ident::new(&var, span);
+
+ let next = peek_next!(read);
+
+ let arg = if cfg!(feature = "std") && next == '}' {
+ quote_spanned!(span=> , #ident.__displaydoc_display())
+ } else {
+ quote_spanned!(span=> , #ident)
+ };
+
+ args.extend(arg);
+ }
+
+ out += read;
+ self.fmt = LitStr::new(&out, self.fmt.span());
+ self.args = args;
+ }
+}
+
+fn take_int(read: &mut &str) -> String {
+ let mut int = String::new();
+ int.push('_');
+ for (i, ch) in read.char_indices() {
+ match ch {
+ '0'..='9' => int.push(ch),
+ _ => {
+ *read = &read[i..];
+ break;
+ }
+ }
+ }
+ int
+}
+
+fn take_ident(read: &mut &str) -> String {
+ let mut ident = String::new();
+ for (i, ch) in read.char_indices() {
+ match ch {
+ 'a'..='z' | 'A'..='Z' | '0'..='9' | '_' => ident.push(ch),
+ _ => {
+ *read = &read[i..];
+ break;
+ }
+ }
+ }
+ ident
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+ use pretty_assertions::assert_eq;
+ use proc_macro2::Span;
+
+ fn assert(input: &str, fmt: &str, args: &str) {
+ let mut display = Display {
+ fmt: LitStr::new(input, Span::call_site()),
+ args: TokenStream::new(),
+ };
+ display.expand_shorthand();
+ assert_eq!(fmt, display.fmt.value());
+ assert_eq!(args, display.args.to_string());
+ }
+
+ #[test]
+ fn test_expand() {
+ assert("fn main() {{ }}", "fn main() {{ }}", "");
+ }
+
+ #[test]
+ #[cfg_attr(not(feature = "std"), ignore)]
+ fn test_std_expand() {
+ assert(
+ "{v} {v:?} {0} {0:?}",
+ "{} {:?} {} {:?}",
+ ", v . __displaydoc_display () , v , _0 . __displaydoc_display () , _0",
+ );
+ assert("error {var}", "error {}", ", var . __displaydoc_display ()");
+
+ assert(
+ "error {var1}",
+ "error {}",
+ ", var1 . __displaydoc_display ()",
+ );
+
+ assert(
+ "error {var1var}",
+ "error {}",
+ ", var1var . __displaydoc_display ()",
+ );
+
+ assert(
+ "The path {0}",
+ "The path {}",
+ ", _0 . __displaydoc_display ()",
+ );
+ assert("The path {0:?}", "The path {:?}", ", _0");
+ }
+
+ #[test]
+ #[cfg_attr(feature = "std", ignore)]
+ fn test_nostd_expand() {
+ assert(
+ "{v} {v:?} {0} {0:?}",
+ "{} {:?} {} {:?}",
+ ", v , v , _0 , _0",
+ );
+ assert("error {var}", "error {}", ", var");
+
+ assert("The path {0}", "The path {}", ", _0");
+ assert("The path {0:?}", "The path {:?}", ", _0");
+
+ assert("error {var1}", "error {}", ", var1");
+
+ assert("error {var1var}", "error {}", ", var1var");
+ }
+}
diff --git a/vendor/displaydoc/src/lib.rs b/vendor/displaydoc/src/lib.rs index 083c61384..e4653d675 100644 --- a/vendor/displaydoc/src/lib.rs +++ b/vendor/displaydoc/src/lib.rs @@ -1,122 +1,187 @@ -//! This library provides a convenient derive macro for the standard library's -//! [`core::fmt::Display`] trait. -//! -//! [`core::fmt::Display`]: https://doc.rust-lang.org/std/fmt/trait.Display.html -//! -//! ```toml -//! [dependencies] -//! displaydoc = "0.2" -//! ``` -//! -//! *Compiler support: requires rustc 1.31+* -//! -//! <br> -//! -//! ## Example -//! -//! ```rust -//! use std::io; -//! use displaydoc::Display; -//! use thiserror::Error; -//! -//! #[derive(Display, Error, Debug)] -//! pub enum DataStoreError { -//! /// data store disconnected -//! Disconnect(#[source] io::Error), -//! /// the data for key `{0}` is not available -//! Redaction(String), -//! /// invalid header (expected {expected:?}, found {found:?}) -//! InvalidHeader { -//! expected: String, -//! found: String, -//! }, -//! /// unknown data store error -//! Unknown, -//! } -//! ``` -//! -//! <br> -//! -//! ## Details -//! -//! - A `Display` impl is generated for your type if you provide doc comment -//! messages on the struct or each variant of your enum, as shown above in the -//! example. -//! -//! The messages support a shorthand for interpolating fields from the error. -//! -//! - `/// {var}` ⟶ `write!("{}", self.var)` -//! - `/// {0}` ⟶ `write!("{}", self.0)` -//! - `/// {var:?}` ⟶ `write!("{:?}", self.var)` -//! - `/// {0:?}` ⟶ `write!("{:?}", self.0)` -//! -//! - Two optional attributes can be added to your types next to the derive: -//! -//! - `#[ignore_extra_doc_attributes]` makes the macro ignore any doc -//! comment attributes (or `///` lines) after the first. Multi-line -//! comments using `///` are otherwise treated as an error, so use this -//! attribute or consider switching to block doc comments (`/** */`). -//! -//! - `#[prefix_enum_doc_attributes]` combines the doc comment message on -//! your enum itself with the messages for each variant, in the format -//! “enum: variant”. When added to an enum, the doc comment on the enum -//! becomes mandatory. When added to any other type, it has no effect. -//! -//! - In case you want to have an independent doc comment, the -//! `#[displaydoc("...")` atrribute may be used on the variant or struct to -//! override it. -//! -//! <br> -//! -//! ## FAQ -//! -//! 1. **Is this crate `no_std` compatible?** -//! * Yes! This crate implements the `core::fmt::Display` trait not the `std::fmt::Display` trait so it should work in `std` and `no_std` environments. Just add `default-features = false`. -//! -//! 2. **Does this crate work with `Path` and `PathBuf` via the `Display` trait?** -//! * Yuuup. This crate uses @dtolnay's [autoref specialization technique](https://github.com/dtolnay/case-studies/blob/master/autoref-specialization/README.md) to add a special trait for types to get the display impl, it then specializes for `Path` and `PathBuf` and when either of these types are found it calls `self.display()` to get a `std::path::Display<'_>` type which can be used with the Display format specifier! -#![doc(html_root_url = "https://docs.rs/displaydoc/0.2.3")] -#![cfg_attr(docsrs, feature(doc_cfg))] -#![warn( - rust_2018_idioms, - unreachable_pub, - bad_style, - const_err, - dead_code, - improper_ctypes, - non_shorthand_field_patterns, - no_mangle_generic_items, - overflowing_literals, - path_statements, - patterns_in_fns_without_body, - private_in_public, - unconditional_recursion, - unused, - unused_allocation, - unused_comparisons, - unused_parens, - while_true -)] -#![allow(clippy::try_err)] - -#[allow(unused_extern_crates)] -extern crate proc_macro; - -mod attr; -mod expand; -mod fmt; - -use proc_macro::TokenStream; -use syn::{parse_macro_input, DeriveInput}; - -/// Derive macro for implementing `Display` via doc comment attributes -#[proc_macro_derive( - Display, - attributes(ignore_extra_doc_attributes, prefix_enum_doc_attributes, displaydoc) -)] -pub fn derive_error(input: TokenStream) -> TokenStream { - let input = parse_macro_input!(input as DeriveInput); - expand::derive(&input) - .unwrap_or_else(|err| err.to_compile_error()) - .into() -} +//! This library provides a convenient derive macro for the standard library's
+//! [`core::fmt::Display`] trait.
+//!
+//! [`core::fmt::Display`]: https://doc.rust-lang.org/std/fmt/trait.Display.html
+//!
+//! ```toml
+//! [dependencies]
+//! displaydoc = "0.2"
+//! ```
+//!
+//! *Compiler support: requires rustc 1.56+*
+//!
+//! <br>
+//!
+//! ## Example
+//!
+//! *Demonstration alongside the [`Error`][std::error::Error] derive macro from [`thiserror`](https://docs.rs/thiserror/1.0.25/thiserror/index.html),
+//! to propagate source locations from [`io::Error`][std::io::Error] with the `#[source]` attribute:*
+//! ```rust
+//! use std::io;
+//! use displaydoc::Display;
+//! use thiserror::Error;
+//!
+//! #[derive(Display, Error, Debug)]
+//! pub enum DataStoreError {
+//! /// data store disconnected
+//! Disconnect(#[source] io::Error),
+//! /// the data for key `{0}` is not available
+//! Redaction(String),
+//! /// invalid header (expected {expected:?}, found {found:?})
+//! InvalidHeader {
+//! expected: String,
+//! found: String,
+//! },
+//! /// unknown data store error
+//! Unknown,
+//! }
+//!
+//! let error = DataStoreError::Redaction("CLASSIFIED CONTENT".to_string());
+//! assert!("the data for key `CLASSIFIED CONTENT` is not available" == &format!("{}", error));
+//! ```
+//! *Note that although [`io::Error`][std::io::Error] implements `Display`, we do not add it to the
+//! generated message for `DataStoreError::Disconnect`, since it is already made available via
+//! `#[source]`. See further context on avoiding duplication in error reports at the rust blog
+//! [here](https://github.com/yaahc/blog.rust-lang.org/blob/master/posts/inside-rust/2021-05-15-What-the-error-handling-project-group-is-working-towards.md#duplicate-information-issue).*
+//!
+//! <br>
+//!
+//! ## Details
+//!
+//! - A `fmt::Display` impl is generated for your enum if you provide
+//! a docstring comment on each variant as shown above in the example. The
+//! `Display` derive macro supports a shorthand for interpolating fields from
+//! the error:
+//! - `/// {var}` ⟶ `write!("{}", self.var)`
+//! - `/// {0}` ⟶ `write!("{}", self.0)`
+//! - `/// {var:?}` ⟶ `write!("{:?}", self.var)`
+//! - `/// {0:?}` ⟶ `write!("{:?}", self.0)`
+//! - This also works with structs and [generic types][crate::Display#generic-type-parameters]:
+//! ```rust
+//! # use displaydoc::Display;
+//! /// oh no, an error: {0}
+//! #[derive(Display)]
+//! pub struct Error<E>(pub E);
+//!
+//! let error: Error<&str> = Error("muahaha i am an error");
+//! assert!("oh no, an error: muahaha i am an error" == &format!("{}", error));
+//! ```
+//!
+//! - Two optional attributes can be added to your types next to the derive:
+//!
+//! - `#[ignore_extra_doc_attributes]` makes the macro ignore any doc
+//! comment attributes (or `///` lines) after the first. Multi-line
+//! comments using `///` are otherwise treated as an error, so use this
+//! attribute or consider switching to block doc comments (`/** */`).
+//!
+//! - `#[prefix_enum_doc_attributes]` combines the doc comment message on
+//! your enum itself with the messages for each variant, in the format
+//! “enum: variant”. When added to an enum, the doc comment on the enum
+//! becomes mandatory. When added to any other type, it has no effect.
+//!
+//! - In case you want to have an independent doc comment, the
+//! `#[displaydoc("...")` atrribute may be used on the variant or struct to
+//! override it.
+//!
+//! <br>
+//!
+//! ## FAQ
+//!
+//! 1. **Is this crate `no_std` compatible?**
+//! * Yes! This crate implements the [`core::fmt::Display`] trait, not the [`std::fmt::Display`] trait, so it should work in `std` and `no_std` environments. Just add `default-features = false`.
+//!
+//! 2. **Does this crate work with `Path` and `PathBuf` via the `Display` trait?**
+//! * Yuuup. This crate uses @dtolnay's [autoref specialization technique](https://github.com/dtolnay/case-studies/blob/master/autoref-specialization/README.md) to add a special trait for types to get the display impl. It then specializes for `Path` and `PathBuf`, and when either of these types are found, it calls `self.display()` to get a `std::path::Display<'_>` type which can be used with the `Display` format specifier!
+#![doc(html_root_url = "https://docs.rs/displaydoc/0.2.3")]
+#![cfg_attr(docsrs, feature(doc_cfg))]
+#![warn(
+ rust_2018_idioms,
+ unreachable_pub,
+ bad_style,
+ dead_code,
+ improper_ctypes,
+ non_shorthand_field_patterns,
+ no_mangle_generic_items,
+ overflowing_literals,
+ path_statements,
+ patterns_in_fns_without_body,
+ private_in_public,
+ unconditional_recursion,
+ unused,
+ unused_allocation,
+ unused_comparisons,
+ unused_parens,
+ while_true
+)]
+#![allow(clippy::try_err)]
+
+#[allow(unused_extern_crates)]
+extern crate proc_macro;
+
+mod attr;
+mod expand;
+mod fmt;
+
+use proc_macro::TokenStream;
+use syn::{parse_macro_input, DeriveInput};
+
+/// [Custom `#[derive(...)]` macro](https://doc.rust-lang.org/edition-guide/rust-2018/macros/custom-derive.html)
+/// for implementing [`fmt::Display`][core::fmt::Display] via doc comment attributes.
+///
+/// ### Generic Type Parameters
+///
+/// Type parameters to an enum or struct using this macro should *not* need to
+/// have an explicit `Display` constraint at the struct or enum definition
+/// site. A `Display` implementation for the `derive`d struct or enum is
+/// generated assuming each type parameter implements `Display`, but that should
+/// be possible without adding the constraint to the struct definition itself:
+/// ```rust
+/// use displaydoc::Display;
+///
+/// /// oh no, an error: {0}
+/// #[derive(Display)]
+/// pub struct Error<E>(pub E);
+///
+/// // No need to require `E: Display`, since `displaydoc::Display` adds that implicitly.
+/// fn generate_error<E>(e: E) -> Error<E> { Error(e) }
+///
+/// assert!("oh no, an error: muahaha" == &format!("{}", generate_error("muahaha")));
+/// ```
+///
+/// ### Using [`Debug`][core::fmt::Debug] Implementations with Type Parameters
+/// However, if a type parameter must instead be constrained with the
+/// [`Debug`][core::fmt::Debug] trait so that some field may be printed with
+/// `{:?}`, that constraint must currently still also be specified redundantly
+/// at the struct or enum definition site. If a struct or enum field is being
+/// formatted with `{:?}` via [`displaydoc`][crate], and a generic type
+/// parameter must implement `Debug` to do that, then that struct or enum
+/// definition will need to propagate the `Debug` constraint to every type
+/// parameter it's instantiated with:
+/// ```rust
+/// use core::fmt::Debug;
+/// use displaydoc::Display;
+///
+/// /// oh no, an error: {0:?}
+/// #[derive(Display)]
+/// pub struct Error<E: Debug>(pub E);
+///
+/// // `E: Debug` now has to propagate to callers.
+/// fn generate_error<E: Debug>(e: E) -> Error<E> { Error(e) }
+///
+/// assert!("oh no, an error: \"cool\"" == &format!("{}", generate_error("cool")));
+///
+/// // Try this with a struct that doesn't impl `Display` at all, unlike `str`.
+/// #[derive(Debug)]
+/// pub struct Oh;
+/// assert!("oh no, an error: Oh" == &format!("{}", generate_error(Oh)));
+/// ```
+#[proc_macro_derive(
+ Display,
+ attributes(ignore_extra_doc_attributes, prefix_enum_doc_attributes, displaydoc)
+)]
+pub fn derive_error(input: TokenStream) -> TokenStream {
+ let input = parse_macro_input!(input as DeriveInput);
+ expand::derive(&input)
+ .unwrap_or_else(|err| err.to_compile_error())
+ .into()
+}
diff --git a/vendor/displaydoc/tests/compile_tests.rs b/vendor/displaydoc/tests/compile_tests.rs index 29c72a862..ac7427a75 100644 --- a/vendor/displaydoc/tests/compile_tests.rs +++ b/vendor/displaydoc/tests/compile_tests.rs @@ -1,29 +1,29 @@ -#[allow(unused_attributes)] -#[rustversion::attr(not(nightly), ignore)] -#[test] -fn no_std() { - let t = trybuild::TestCases::new(); - #[cfg(not(feature = "std"))] - t.compile_fail("tests/no_std/without.rs"); - #[cfg(not(feature = "std"))] - t.compile_fail("tests/no_std/multi_line.rs"); - #[cfg(not(feature = "std"))] - t.pass("tests/no_std/multi_line_allow.rs"); - #[cfg(not(feature = "std"))] - t.compile_fail("tests/no_std/enum_prefix_missing.rs"); - #[cfg(not(feature = "std"))] - t.pass("tests/no_std/enum_prefix.rs"); - #[cfg(feature = "std")] - t.compile_fail("tests/std/without.rs"); - #[cfg(feature = "std")] - t.compile_fail("tests/std/multi_line.rs"); - #[cfg(feature = "std")] - t.pass("tests/std/multi_line_allow.rs"); - #[cfg(feature = "std")] - t.compile_fail("tests/std/enum_prefix_missing.rs"); - #[cfg(feature = "std")] - t.pass("tests/std/enum_prefix.rs"); - #[cfg(feature = "std")] - t.pass("tests/std/multiple.rs"); - t.pass("tests/no_std/with.rs"); -} +#[allow(unused_attributes)]
+#[rustversion::attr(not(nightly), ignore)]
+#[test]
+fn no_std() {
+ let t = trybuild::TestCases::new();
+ #[cfg(not(feature = "std"))]
+ t.compile_fail("tests/no_std/without.rs");
+ #[cfg(not(feature = "std"))]
+ t.compile_fail("tests/no_std/multi_line.rs");
+ #[cfg(not(feature = "std"))]
+ t.pass("tests/no_std/multi_line_allow.rs");
+ #[cfg(not(feature = "std"))]
+ t.compile_fail("tests/no_std/enum_prefix_missing.rs");
+ #[cfg(not(feature = "std"))]
+ t.pass("tests/no_std/enum_prefix.rs");
+ #[cfg(feature = "std")]
+ t.compile_fail("tests/std/without.rs");
+ #[cfg(feature = "std")]
+ t.compile_fail("tests/std/multi_line.rs");
+ #[cfg(feature = "std")]
+ t.pass("tests/std/multi_line_allow.rs");
+ #[cfg(feature = "std")]
+ t.compile_fail("tests/std/enum_prefix_missing.rs");
+ #[cfg(feature = "std")]
+ t.pass("tests/std/enum_prefix.rs");
+ #[cfg(feature = "std")]
+ t.pass("tests/std/multiple.rs");
+ t.pass("tests/no_std/with.rs");
+}
diff --git a/vendor/displaydoc/tests/happy.rs b/vendor/displaydoc/tests/happy.rs index 85aa78f13..f8fde9c61 100644 --- a/vendor/displaydoc/tests/happy.rs +++ b/vendor/displaydoc/tests/happy.rs @@ -1,152 +1,152 @@ -use displaydoc::Display; - -#[cfg(feature = "std")] -use std::path::PathBuf; - -#[derive(Display)] -/// Just a basic struct {thing} -struct HappyStruct { - thing: &'static str, -} - -#[derive(Display)] -#[ignore_extra_doc_attributes] -/// Just a basic struct {thing} -/// and this line should get ignored -struct HappyStruct2 { - thing: &'static str, -} - -#[derive(Display)] -enum Happy { - /// I really like Variant1 - Variant1, - /// Variant2 is pretty swell 2 - Variant2, - /// Variant3 is okay {sometimes} - Variant3 { sometimes: &'static str }, - /** - * Variant4 wants to have a lot of lines - * - * Lets see how this works out for it - */ - Variant4, - /// Variant5 has a parameter {0} and some regular comments - // A regular comment that won't get picked - Variant5(u32), - - /// The path {0} - #[cfg(feature = "std")] - Variant6(PathBuf), - - /// These docs are ignored - #[displaydoc("Variant7 has a parameter {0} and uses #[displaydoc]")] - /// These docs are also ignored - Variant7(u32), -} - -// Used for testing indented doc comments -mod inner_mod { - use super::Display; - - #[derive(Display)] - pub enum InnerHappy { - /// I really like Variant1 - Variant1, - /// Variant2 is pretty swell 2 - Variant2, - /// Variant3 is okay {sometimes} - Variant3 { sometimes: &'static str }, - /** - * Variant4 wants to have a lot of lines - * - * Lets see how this works out for it - */ - Variant4, - /// Variant5 has a parameter {0} and some regular comments - // A regular comment that won't get picked - Variant5(u32), - - /** what happens if we - * put text on the first line? - */ - Variant6, - - /** - what happens if we don't use *? - */ - Variant7, - - /** - * - * what about extra new lines? - */ - Variant8, - } -} - -fn assert_display<T: std::fmt::Display>(input: T, expected: &'static str) { - let out = format!("{}", input); - assert_eq!(expected, out); -} - -#[test] -fn does_it_print() { - assert_display(Happy::Variant1, "I really like Variant1"); - assert_display(Happy::Variant2, "Variant2 is pretty swell 2"); - assert_display(Happy::Variant3 { sometimes: "hi" }, "Variant3 is okay hi"); - assert_display( - Happy::Variant4, - "Variant4 wants to have a lot of lines\n\nLets see how this works out for it", - ); - assert_display( - Happy::Variant5(2), - "Variant5 has a parameter 2 and some regular comments", - ); - assert_display( - Happy::Variant7(2), - "Variant7 has a parameter 2 and uses #[displaydoc]", - ); - assert_display(HappyStruct { thing: "hi" }, "Just a basic struct hi"); - - assert_display(HappyStruct2 { thing: "hi2" }, "Just a basic struct hi2"); - - assert_display(inner_mod::InnerHappy::Variant1, "I really like Variant1"); - assert_display( - inner_mod::InnerHappy::Variant2, - "Variant2 is pretty swell 2", - ); - assert_display( - inner_mod::InnerHappy::Variant3 { sometimes: "hi" }, - "Variant3 is okay hi", - ); - assert_display( - inner_mod::InnerHappy::Variant4, - "Variant4 wants to have a lot of lines\n\nLets see how this works out for it", - ); - assert_display( - inner_mod::InnerHappy::Variant5(2), - "Variant5 has a parameter 2 and some regular comments", - ); - assert_display( - inner_mod::InnerHappy::Variant6, - "what happens if we\nput text on the first line?", - ); - assert_display( - inner_mod::InnerHappy::Variant7, - "what happens if we don\'t use *?", - ); - assert_display( - inner_mod::InnerHappy::Variant8, - "what about extra new lines?", - ); -} - -#[test] -#[cfg(feature = "std")] -fn does_it_print_path() { - assert_display( - Happy::Variant6(PathBuf::from("/var/log/happy")), - "The path /var/log/happy", - ); -} +use displaydoc::Display;
+
+#[cfg(feature = "std")]
+use std::path::PathBuf;
+
+#[derive(Display)]
+/// Just a basic struct {thing}
+struct HappyStruct {
+ thing: &'static str,
+}
+
+#[derive(Display)]
+#[ignore_extra_doc_attributes]
+/// Just a basic struct {thing}
+/// and this line should get ignored
+struct HappyStruct2 {
+ thing: &'static str,
+}
+
+#[derive(Display)]
+enum Happy {
+ /// I really like Variant1
+ Variant1,
+ /// Variant2 is pretty swell 2
+ Variant2,
+ /// Variant3 is okay {sometimes}
+ Variant3 { sometimes: &'static str },
+ /**
+ * Variant4 wants to have a lot of lines
+ *
+ * Lets see how this works out for it
+ */
+ Variant4,
+ /// Variant5 has a parameter {0} and some regular comments
+ // A regular comment that won't get picked
+ Variant5(u32),
+
+ /// The path {0}
+ #[cfg(feature = "std")]
+ Variant6(PathBuf),
+
+ /// These docs are ignored
+ #[displaydoc("Variant7 has a parameter {0} and uses #[displaydoc]")]
+ /// These docs are also ignored
+ Variant7(u32),
+}
+
+// Used for testing indented doc comments
+mod inner_mod {
+ use super::Display;
+
+ #[derive(Display)]
+ pub enum InnerHappy {
+ /// I really like Variant1
+ Variant1,
+ /// Variant2 is pretty swell 2
+ Variant2,
+ /// Variant3 is okay {sometimes}
+ Variant3 { sometimes: &'static str },
+ /**
+ * Variant4 wants to have a lot of lines
+ *
+ * Lets see how this works out for it
+ */
+ Variant4,
+ /// Variant5 has a parameter {0} and some regular comments
+ // A regular comment that won't get picked
+ Variant5(u32),
+
+ /** what happens if we
+ * put text on the first line?
+ */
+ Variant6,
+
+ /**
+ what happens if we don't use *?
+ */
+ Variant7,
+
+ /**
+ *
+ * what about extra new lines?
+ */
+ Variant8,
+ }
+}
+
+fn assert_display<T: std::fmt::Display>(input: T, expected: &'static str) {
+ let out = format!("{}", input);
+ assert_eq!(expected, out);
+}
+
+#[test]
+fn does_it_print() {
+ assert_display(Happy::Variant1, "I really like Variant1");
+ assert_display(Happy::Variant2, "Variant2 is pretty swell 2");
+ assert_display(Happy::Variant3 { sometimes: "hi" }, "Variant3 is okay hi");
+ assert_display(
+ Happy::Variant4,
+ "Variant4 wants to have a lot of lines\n\nLets see how this works out for it",
+ );
+ assert_display(
+ Happy::Variant5(2),
+ "Variant5 has a parameter 2 and some regular comments",
+ );
+ assert_display(
+ Happy::Variant7(2),
+ "Variant7 has a parameter 2 and uses #[displaydoc]",
+ );
+ assert_display(HappyStruct { thing: "hi" }, "Just a basic struct hi");
+
+ assert_display(HappyStruct2 { thing: "hi2" }, "Just a basic struct hi2");
+
+ assert_display(inner_mod::InnerHappy::Variant1, "I really like Variant1");
+ assert_display(
+ inner_mod::InnerHappy::Variant2,
+ "Variant2 is pretty swell 2",
+ );
+ assert_display(
+ inner_mod::InnerHappy::Variant3 { sometimes: "hi" },
+ "Variant3 is okay hi",
+ );
+ assert_display(
+ inner_mod::InnerHappy::Variant4,
+ "Variant4 wants to have a lot of lines\n\nLets see how this works out for it",
+ );
+ assert_display(
+ inner_mod::InnerHappy::Variant5(2),
+ "Variant5 has a parameter 2 and some regular comments",
+ );
+ assert_display(
+ inner_mod::InnerHappy::Variant6,
+ "what happens if we\nput text on the first line?",
+ );
+ assert_display(
+ inner_mod::InnerHappy::Variant7,
+ "what happens if we don\'t use *?",
+ );
+ assert_display(
+ inner_mod::InnerHappy::Variant8,
+ "what about extra new lines?",
+ );
+}
+
+#[test]
+#[cfg(feature = "std")]
+fn does_it_print_path() {
+ assert_display(
+ Happy::Variant6(PathBuf::from("/var/log/happy")),
+ "The path /var/log/happy",
+ );
+}
diff --git a/vendor/displaydoc/tests/no_std/enum_prefix.rs b/vendor/displaydoc/tests/no_std/enum_prefix.rs index 1c5479118..b8482cac8 100644 --- a/vendor/displaydoc/tests/no_std/enum_prefix.rs +++ b/vendor/displaydoc/tests/no_std/enum_prefix.rs @@ -1,36 +1,36 @@ -#![cfg_attr(not(feature = "std"), feature(lang_items, start))] -#![cfg_attr(not(feature = "std"), no_std)] - -#[cfg_attr(not(feature = "std"), start)] -fn start(_argc: isize, _argv: *const *const u8) -> isize { - 0 -} -#[lang = "eh_personality"] -#[no_mangle] -#[cfg(not(feature = "std"))] -pub extern "C" fn rust_eh_personality() {} -#[panic_handler] -#[cfg(not(feature = "std"))] -fn panic(_info: &core::panic::PanicInfo) -> ! { - unsafe { - libc::abort(); - } -} - -use displaydoc::Display; - -/// this type is pretty swell -#[derive(Display)] -#[prefix_enum_doc_attributes] -enum TestType { - /// this variant is too - Variant1, - - /// this variant is two - Variant2, -} - -static_assertions::assert_impl_all!(label; TestType, core::fmt::Display); - -#[cfg(feature = "std")] -fn main() {} +#![cfg_attr(not(feature = "std"), feature(lang_items, start))]
+#![cfg_attr(not(feature = "std"), no_std)]
+
+#[cfg_attr(not(feature = "std"), start)]
+fn start(_argc: isize, _argv: *const *const u8) -> isize {
+ 0
+}
+#[lang = "eh_personality"]
+#[no_mangle]
+#[cfg(not(feature = "std"))]
+pub extern "C" fn rust_eh_personality() {}
+#[panic_handler]
+#[cfg(not(feature = "std"))]
+fn panic(_info: &core::panic::PanicInfo) -> ! {
+ unsafe {
+ libc::abort();
+ }
+}
+
+use displaydoc::Display;
+
+/// this type is pretty swell
+#[derive(Display)]
+#[prefix_enum_doc_attributes]
+enum TestType {
+ /// this variant is too
+ Variant1,
+
+ /// this variant is two
+ Variant2,
+}
+
+static_assertions::assert_impl_all!(TestType: core::fmt::Display);
+
+#[cfg(feature = "std")]
+fn main() {}
diff --git a/vendor/displaydoc/tests/no_std/enum_prefix_missing.rs b/vendor/displaydoc/tests/no_std/enum_prefix_missing.rs index 5cd9e6df8..474073e8f 100644 --- a/vendor/displaydoc/tests/no_std/enum_prefix_missing.rs +++ b/vendor/displaydoc/tests/no_std/enum_prefix_missing.rs @@ -1,35 +1,35 @@ -#![cfg_attr(not(feature = "std"), feature(lang_items, start))] -#![cfg_attr(not(feature = "std"), no_std)] - -#[cfg_attr(not(feature = "std"), start)] -fn start(_argc: isize, _argv: *const *const u8) -> isize { - 0 -} -#[lang = "eh_personality"] -#[no_mangle] -#[cfg(not(feature = "std"))] -pub extern "C" fn rust_eh_personality() {} -#[panic_handler] -#[cfg(not(feature = "std"))] -fn panic(_info: &core::panic::PanicInfo) -> ! { - unsafe { - libc::abort(); - } -} - -use displaydoc::Display; - -#[derive(Display)] -#[prefix_enum_doc_attributes] -enum TestType { - /// this variant is too - Variant1, - - /// this variant is two - Variant2, -} - -static_assertions::assert_impl_all!(label; TestType, core::fmt::Display); - -#[cfg(feature = "std")] -fn main() {} +#![cfg_attr(not(feature = "std"), feature(lang_items, start))]
+#![cfg_attr(not(feature = "std"), no_std)]
+
+#[cfg_attr(not(feature = "std"), start)]
+fn start(_argc: isize, _argv: *const *const u8) -> isize {
+ 0
+}
+#[lang = "eh_personality"]
+#[no_mangle]
+#[cfg(not(feature = "std"))]
+pub extern "C" fn rust_eh_personality() {}
+#[panic_handler]
+#[cfg(not(feature = "std"))]
+fn panic(_info: &core::panic::PanicInfo) -> ! {
+ unsafe {
+ libc::abort();
+ }
+}
+
+use displaydoc::Display;
+
+#[derive(Display)]
+#[prefix_enum_doc_attributes]
+enum TestType {
+ /// this variant is too
+ Variant1,
+
+ /// this variant is two
+ Variant2,
+}
+
+static_assertions::assert_impl_all!(TestType: core::fmt::Display);
+
+#[cfg(feature = "std")]
+fn main() {}
diff --git a/vendor/displaydoc/tests/no_std/enum_prefix_missing.stderr b/vendor/displaydoc/tests/no_std/enum_prefix_missing.stderr index a0db21694..8d4023258 100644 --- a/vendor/displaydoc/tests/no_std/enum_prefix_missing.stderr +++ b/vendor/displaydoc/tests/no_std/enum_prefix_missing.stderr @@ -1,19 +1,22 @@ -error: proc-macro derive panicked - --> $DIR/enum_prefix_missing.rs:22:10 - | -22 | #[derive(Display)] - | ^^^^^^^ - | - = help: message: Missing doc comment on enum with #[prefix_enum_doc_attributes]. Please remove the attribute or add a doc comment to the enum itself. - -error[E0277]: `TestType` doesn't implement `Display` - --> $DIR/enum_prefix_missing.rs:32:44 - | -32 | static_assertions::assert_impl_all!(label; TestType, core::fmt::Display); - | -------------------------------------------^^^^^^^^---------------------- - | | | - | | `TestType` cannot be formatted with the default formatter - | required by this bound in `assert_impl_all` - | - = help: the trait `Display` is not implemented for `TestType` - = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead +error: proc-macro derive panicked
+ --> $DIR/enum_prefix_missing.rs:22:10
+ |
+22 | #[derive(Display)]
+ | ^^^^^^^
+ |
+ = help: message: Missing doc comment on enum with #[prefix_enum_doc_attributes]. Please remove the attribute or add a doc comment to the enum itself.
+
+error[E0277]: `TestType` doesn't implement `Display`
+ --> $DIR/enum_prefix_missing.rs:32:37
+ |
+32 | static_assertions::assert_impl_all!(TestType: core::fmt::Display);
+ | ^^^^^^^^ `TestType` cannot be formatted with the default formatter
+ |
+ = help: the trait `Display` is not implemented for `TestType`
+ = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
+note: required by a bound in `assert_impl_all`
+ --> $DIR/enum_prefix_missing.rs:32:1
+ |
+32 | static_assertions::assert_impl_all!(TestType: core::fmt::Display);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `assert_impl_all`
+ = note: this error originates in the macro `static_assertions::assert_impl_all` (in Nightly builds, run with -Z macro-backtrace for more info)
diff --git a/vendor/displaydoc/tests/no_std/multi_line.rs b/vendor/displaydoc/tests/no_std/multi_line.rs index cadb83e70..351f6a4eb 100644 --- a/vendor/displaydoc/tests/no_std/multi_line.rs +++ b/vendor/displaydoc/tests/no_std/multi_line.rs @@ -1,37 +1,37 @@ -#![cfg_attr(not(feature = "std"), feature(lang_items, start))] -#![cfg_attr(not(feature = "std"), no_std)] - -#[cfg_attr(not(feature = "std"), start)] -fn start(_argc: isize, _argv: *const *const u8) -> isize { - 0 -} -#[lang = "eh_personality"] -#[no_mangle] -#[cfg(not(feature = "std"))] -pub extern "C" fn rust_eh_personality() {} -#[panic_handler] -#[cfg(not(feature = "std"))] -fn panic(_info: &core::panic::PanicInfo) -> ! { - unsafe { - libc::abort(); - } -} - -use displaydoc::Display; - -/// this type is pretty swell -#[derive(Display)] -enum TestType { - /// This one is okay - Variant1, - - /// Multi - /// line - /// doc. - Variant2, -} - -static_assertions::assert_impl_all!(label; TestType, core::fmt::Display); - -#[cfg(feature = "std")] -fn main() {} +#![cfg_attr(not(feature = "std"), feature(lang_items, start))]
+#![cfg_attr(not(feature = "std"), no_std)]
+
+#[cfg_attr(not(feature = "std"), start)]
+fn start(_argc: isize, _argv: *const *const u8) -> isize {
+ 0
+}
+#[lang = "eh_personality"]
+#[no_mangle]
+#[cfg(not(feature = "std"))]
+pub extern "C" fn rust_eh_personality() {}
+#[panic_handler]
+#[cfg(not(feature = "std"))]
+fn panic(_info: &core::panic::PanicInfo) -> ! {
+ unsafe {
+ libc::abort();
+ }
+}
+
+use displaydoc::Display;
+
+/// this type is pretty swell
+#[derive(Display)]
+enum TestType {
+ /// This one is okay
+ Variant1,
+
+ /// Multi
+ /// line
+ /// doc.
+ Variant2,
+}
+
+static_assertions::assert_impl_all!(TestType: core::fmt::Display);
+
+#[cfg(feature = "std")]
+fn main() {}
diff --git a/vendor/displaydoc/tests/no_std/multi_line.stderr b/vendor/displaydoc/tests/no_std/multi_line.stderr index e23d134c8..ae4956e30 100644 --- a/vendor/displaydoc/tests/no_std/multi_line.stderr +++ b/vendor/displaydoc/tests/no_std/multi_line.stderr @@ -1,19 +1,22 @@ -error: proc-macro derive panicked - --> $DIR/multi_line.rs:23:10 - | -23 | #[derive(Display)] - | ^^^^^^^ - | - = help: message: Multi-line comments are disabled by default by displaydoc. Please consider using block doc comments (/** */) or adding the #[ignore_extra_doc_attributes] attribute to your type next to the derive. - -error[E0277]: `TestType` doesn't implement `Display` - --> $DIR/multi_line.rs:34:44 - | -34 | static_assertions::assert_impl_all!(label; TestType, core::fmt::Display); - | -------------------------------------------^^^^^^^^---------------------- - | | | - | | `TestType` cannot be formatted with the default formatter - | required by this bound in `assert_impl_all` - | - = help: the trait `Display` is not implemented for `TestType` - = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead +error: proc-macro derive panicked
+ --> $DIR/multi_line.rs:23:10
+ |
+23 | #[derive(Display)]
+ | ^^^^^^^
+ |
+ = help: message: Multi-line comments are disabled by default by displaydoc. Please consider using block doc comments (/** */) or adding the #[ignore_extra_doc_attributes] attribute to your type next to the derive.
+
+error[E0277]: `TestType` doesn't implement `Display`
+ --> $DIR/multi_line.rs:34:37
+ |
+34 | static_assertions::assert_impl_all!(TestType: core::fmt::Display);
+ | ^^^^^^^^ `TestType` cannot be formatted with the default formatter
+ |
+ = help: the trait `Display` is not implemented for `TestType`
+ = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
+note: required by a bound in `assert_impl_all`
+ --> $DIR/multi_line.rs:34:1
+ |
+34 | static_assertions::assert_impl_all!(TestType: core::fmt::Display);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `assert_impl_all`
+ = note: this error originates in the macro `static_assertions::assert_impl_all` (in Nightly builds, run with -Z macro-backtrace for more info)
diff --git a/vendor/displaydoc/tests/no_std/multi_line_allow.rs b/vendor/displaydoc/tests/no_std/multi_line_allow.rs index 05bdcf9fb..22511d9e7 100644 --- a/vendor/displaydoc/tests/no_std/multi_line_allow.rs +++ b/vendor/displaydoc/tests/no_std/multi_line_allow.rs @@ -1,38 +1,38 @@ -#![cfg_attr(not(feature = "std"), feature(lang_items, start))] -#![cfg_attr(not(feature = "std"), no_std)] - -#[cfg_attr(not(feature = "std"), start)] -fn start(_argc: isize, _argv: *const *const u8) -> isize { - 0 -} -#[lang = "eh_personality"] -#[no_mangle] -#[cfg(not(feature = "std"))] -pub extern "C" fn rust_eh_personality() {} -#[panic_handler] -#[cfg(not(feature = "std"))] -fn panic(_info: &core::panic::PanicInfo) -> ! { - unsafe { - libc::abort(); - } -} - -use displaydoc::Display; - -/// this type is pretty swell -#[derive(Display)] -#[ignore_extra_doc_attributes] -enum TestType { - /// This one is okay - Variant1, - - /// Multi - /// line - /// doc. - Variant2, -} - -static_assertions::assert_impl_all!(label; TestType, core::fmt::Display); - -#[cfg(feature = "std")] -fn main() {} +#![cfg_attr(not(feature = "std"), feature(lang_items, start))]
+#![cfg_attr(not(feature = "std"), no_std)]
+
+#[cfg_attr(not(feature = "std"), start)]
+fn start(_argc: isize, _argv: *const *const u8) -> isize {
+ 0
+}
+#[lang = "eh_personality"]
+#[no_mangle]
+#[cfg(not(feature = "std"))]
+pub extern "C" fn rust_eh_personality() {}
+#[panic_handler]
+#[cfg(not(feature = "std"))]
+fn panic(_info: &core::panic::PanicInfo) -> ! {
+ unsafe {
+ libc::abort();
+ }
+}
+
+use displaydoc::Display;
+
+/// this type is pretty swell
+#[derive(Display)]
+#[ignore_extra_doc_attributes]
+enum TestType {
+ /// This one is okay
+ Variant1,
+
+ /// Multi
+ /// line
+ /// doc.
+ Variant2,
+}
+
+static_assertions::assert_impl_all!(TestType: core::fmt::Display);
+
+#[cfg(feature = "std")]
+fn main() {}
diff --git a/vendor/displaydoc/tests/no_std/with.rs b/vendor/displaydoc/tests/no_std/with.rs index 7de3da67f..eba74609d 100644 --- a/vendor/displaydoc/tests/no_std/with.rs +++ b/vendor/displaydoc/tests/no_std/with.rs @@ -1,32 +1,32 @@ -#![feature(lang_items, start)] -#![no_std] - -#[start] -#[cfg(not(feature = "std"))] -fn start(_argc: isize, _argv: *const *const u8) -> isize { - 0 -} - -#[lang = "eh_personality"] -#[no_mangle] -#[cfg(not(feature = "std"))] -pub extern "C" fn rust_eh_personality() {} - -#[panic_handler] -#[cfg(not(feature = "std"))] -fn panic(_info: &core::panic::PanicInfo) -> ! { - unsafe { - libc::abort(); - } -} - -#[cfg(feature = "std")] -fn main() {} - -use displaydoc::Display; - -/// this type is pretty swell -#[derive(Display)] -struct FakeType; - -static_assertions::assert_impl_all!(label; FakeType, core::fmt::Display); +#![feature(lang_items, start)]
+#![no_std]
+
+#[start]
+#[cfg(not(feature = "std"))]
+fn start(_argc: isize, _argv: *const *const u8) -> isize {
+ 0
+}
+
+#[lang = "eh_personality"]
+#[no_mangle]
+#[cfg(not(feature = "std"))]
+pub extern "C" fn rust_eh_personality() {}
+
+#[panic_handler]
+#[cfg(not(feature = "std"))]
+fn panic(_info: &core::panic::PanicInfo) -> ! {
+ unsafe {
+ libc::abort();
+ }
+}
+
+#[cfg(feature = "std")]
+fn main() {}
+
+use displaydoc::Display;
+
+/// this type is pretty swell
+#[derive(Display)]
+struct FakeType;
+
+static_assertions::assert_impl_all!(FakeType: core::fmt::Display);
diff --git a/vendor/displaydoc/tests/no_std/without.rs b/vendor/displaydoc/tests/no_std/without.rs index 32905aad9..aab3164f0 100644 --- a/vendor/displaydoc/tests/no_std/without.rs +++ b/vendor/displaydoc/tests/no_std/without.rs @@ -1,28 +1,28 @@ -#![cfg_attr(not(feature = "std"), feature(lang_items, start))] -#![cfg_attr(not(feature = "std"), no_std)] - -#[cfg_attr(not(feature = "std"), start)] -fn start(_argc: isize, _argv: *const *const u8) -> isize { - 0 -} -#[lang = "eh_personality"] -#[no_mangle] -#[cfg(not(feature = "std"))] -pub extern "C" fn rust_eh_personality() {} -#[panic_handler] -#[cfg(not(feature = "std"))] -fn panic(_info: &core::panic::PanicInfo) -> ! { - unsafe { - libc::abort(); - } -} - -use displaydoc::Display; - -/// this type is pretty swell -struct FakeType; - -static_assertions::assert_impl_all!(label; FakeType, core::fmt::Display); - -#[cfg(feature = "std")] -fn main() {} +#![cfg_attr(not(feature = "std"), feature(lang_items, start))]
+#![cfg_attr(not(feature = "std"), no_std)]
+
+#[cfg_attr(not(feature = "std"), start)]
+fn start(_argc: isize, _argv: *const *const u8) -> isize {
+ 0
+}
+#[lang = "eh_personality"]
+#[no_mangle]
+#[cfg(not(feature = "std"))]
+pub extern "C" fn rust_eh_personality() {}
+#[panic_handler]
+#[cfg(not(feature = "std"))]
+fn panic(_info: &core::panic::PanicInfo) -> ! {
+ unsafe {
+ libc::abort();
+ }
+}
+
+use displaydoc::Display;
+
+/// this type is pretty swell
+struct FakeType;
+
+static_assertions::assert_impl_all!(FakeType: core::fmt::Display);
+
+#[cfg(feature = "std")]
+fn main() {}
diff --git a/vendor/displaydoc/tests/no_std/without.stderr b/vendor/displaydoc/tests/no_std/without.stderr index 81de13b74..afcea63f7 100644 --- a/vendor/displaydoc/tests/no_std/without.stderr +++ b/vendor/displaydoc/tests/no_std/without.stderr @@ -1,19 +1,22 @@ -warning: unused import: `displaydoc::Display` - --> $DIR/without.rs:20:5 - | -20 | use displaydoc::Display; - | ^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(unused_imports)]` on by default - -error[E0277]: `FakeType` doesn't implement `Display` - --> $DIR/without.rs:25:44 - | -25 | static_assertions::assert_impl_all!(label; FakeType, core::fmt::Display); - | -------------------------------------------^^^^^^^^---------------------- - | | | - | | `FakeType` cannot be formatted with the default formatter - | required by this bound in `assert_impl_all` - | - = help: the trait `Display` is not implemented for `FakeType` - = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead +warning: unused import: `displaydoc::Display`
+ --> $DIR/without.rs:20:5
+ |
+20 | use displaydoc::Display;
+ | ^^^^^^^^^^^^^^^^^^^
+ |
+ = note: `#[warn(unused_imports)]` on by default
+
+error[E0277]: `FakeType` doesn't implement `Display`
+ --> $DIR/without.rs:25:37
+ |
+25 | static_assertions::assert_impl_all!(FakeType: core::fmt::Display);
+ | ^^^^^^^^ `FakeType` cannot be formatted with the default formatter
+ |
+ = help: the trait `Display` is not implemented for `FakeType`
+ = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
+note: required by a bound in `assert_impl_all`
+ --> $DIR/without.rs:25:1
+ |
+25 | static_assertions::assert_impl_all!(FakeType: core::fmt::Display);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `assert_impl_all`
+ = note: this error originates in the macro `static_assertions::assert_impl_all` (in Nightly builds, run with -Z macro-backtrace for more info)
diff --git a/vendor/displaydoc/tests/num_in_field.rs b/vendor/displaydoc/tests/num_in_field.rs index 9510f8206..ab90f0d76 100644 --- a/vendor/displaydoc/tests/num_in_field.rs +++ b/vendor/displaydoc/tests/num_in_field.rs @@ -1,22 +1,22 @@ -/// {foo1} {foo2} -#[derive(displaydoc::Display)] -pub struct Test { - foo1: String, - foo2: String, -} - -fn assert_display<T: std::fmt::Display>(input: T, expected: &'static str) { - let out = format!("{}", input); - assert_eq!(expected, out); -} - -#[test] -fn does_it_print() { - assert_display( - Test { - foo1: "hi".into(), - foo2: "hello".into(), - }, - "hi hello", - ); -} +/// {foo1} {foo2}
+#[derive(displaydoc::Display)]
+pub struct Test {
+ foo1: String,
+ foo2: String,
+}
+
+fn assert_display<T: std::fmt::Display>(input: T, expected: &'static str) {
+ let out = format!("{}", input);
+ assert_eq!(expected, out);
+}
+
+#[test]
+fn does_it_print() {
+ assert_display(
+ Test {
+ foo1: "hi".into(),
+ foo2: "hello".into(),
+ },
+ "hi hello",
+ );
+}
diff --git a/vendor/displaydoc/tests/std/enum_prefix.rs b/vendor/displaydoc/tests/std/enum_prefix.rs index 1c5479118..b8482cac8 100644 --- a/vendor/displaydoc/tests/std/enum_prefix.rs +++ b/vendor/displaydoc/tests/std/enum_prefix.rs @@ -1,36 +1,36 @@ -#![cfg_attr(not(feature = "std"), feature(lang_items, start))] -#![cfg_attr(not(feature = "std"), no_std)] - -#[cfg_attr(not(feature = "std"), start)] -fn start(_argc: isize, _argv: *const *const u8) -> isize { - 0 -} -#[lang = "eh_personality"] -#[no_mangle] -#[cfg(not(feature = "std"))] -pub extern "C" fn rust_eh_personality() {} -#[panic_handler] -#[cfg(not(feature = "std"))] -fn panic(_info: &core::panic::PanicInfo) -> ! { - unsafe { - libc::abort(); - } -} - -use displaydoc::Display; - -/// this type is pretty swell -#[derive(Display)] -#[prefix_enum_doc_attributes] -enum TestType { - /// this variant is too - Variant1, - - /// this variant is two - Variant2, -} - -static_assertions::assert_impl_all!(label; TestType, core::fmt::Display); - -#[cfg(feature = "std")] -fn main() {} +#![cfg_attr(not(feature = "std"), feature(lang_items, start))]
+#![cfg_attr(not(feature = "std"), no_std)]
+
+#[cfg_attr(not(feature = "std"), start)]
+fn start(_argc: isize, _argv: *const *const u8) -> isize {
+ 0
+}
+#[lang = "eh_personality"]
+#[no_mangle]
+#[cfg(not(feature = "std"))]
+pub extern "C" fn rust_eh_personality() {}
+#[panic_handler]
+#[cfg(not(feature = "std"))]
+fn panic(_info: &core::panic::PanicInfo) -> ! {
+ unsafe {
+ libc::abort();
+ }
+}
+
+use displaydoc::Display;
+
+/// this type is pretty swell
+#[derive(Display)]
+#[prefix_enum_doc_attributes]
+enum TestType {
+ /// this variant is too
+ Variant1,
+
+ /// this variant is two
+ Variant2,
+}
+
+static_assertions::assert_impl_all!(TestType: core::fmt::Display);
+
+#[cfg(feature = "std")]
+fn main() {}
diff --git a/vendor/displaydoc/tests/std/enum_prefix_missing.rs b/vendor/displaydoc/tests/std/enum_prefix_missing.rs index 5cd9e6df8..474073e8f 100644 --- a/vendor/displaydoc/tests/std/enum_prefix_missing.rs +++ b/vendor/displaydoc/tests/std/enum_prefix_missing.rs @@ -1,35 +1,35 @@ -#![cfg_attr(not(feature = "std"), feature(lang_items, start))] -#![cfg_attr(not(feature = "std"), no_std)] - -#[cfg_attr(not(feature = "std"), start)] -fn start(_argc: isize, _argv: *const *const u8) -> isize { - 0 -} -#[lang = "eh_personality"] -#[no_mangle] -#[cfg(not(feature = "std"))] -pub extern "C" fn rust_eh_personality() {} -#[panic_handler] -#[cfg(not(feature = "std"))] -fn panic(_info: &core::panic::PanicInfo) -> ! { - unsafe { - libc::abort(); - } -} - -use displaydoc::Display; - -#[derive(Display)] -#[prefix_enum_doc_attributes] -enum TestType { - /// this variant is too - Variant1, - - /// this variant is two - Variant2, -} - -static_assertions::assert_impl_all!(label; TestType, core::fmt::Display); - -#[cfg(feature = "std")] -fn main() {} +#![cfg_attr(not(feature = "std"), feature(lang_items, start))]
+#![cfg_attr(not(feature = "std"), no_std)]
+
+#[cfg_attr(not(feature = "std"), start)]
+fn start(_argc: isize, _argv: *const *const u8) -> isize {
+ 0
+}
+#[lang = "eh_personality"]
+#[no_mangle]
+#[cfg(not(feature = "std"))]
+pub extern "C" fn rust_eh_personality() {}
+#[panic_handler]
+#[cfg(not(feature = "std"))]
+fn panic(_info: &core::panic::PanicInfo) -> ! {
+ unsafe {
+ libc::abort();
+ }
+}
+
+use displaydoc::Display;
+
+#[derive(Display)]
+#[prefix_enum_doc_attributes]
+enum TestType {
+ /// this variant is too
+ Variant1,
+
+ /// this variant is two
+ Variant2,
+}
+
+static_assertions::assert_impl_all!(TestType: core::fmt::Display);
+
+#[cfg(feature = "std")]
+fn main() {}
diff --git a/vendor/displaydoc/tests/std/enum_prefix_missing.stderr b/vendor/displaydoc/tests/std/enum_prefix_missing.stderr index 7f60f1bf5..fe4b5ef70 100644 --- a/vendor/displaydoc/tests/std/enum_prefix_missing.stderr +++ b/vendor/displaydoc/tests/std/enum_prefix_missing.stderr @@ -1,19 +1,22 @@ -error: proc-macro derive panicked - --> $DIR/enum_prefix_missing.rs:22:10 - | -22 | #[derive(Display)] - | ^^^^^^^ - | - = help: message: Missing doc comment on enum with #[prefix_enum_doc_attributes]. Please remove the attribute or add a doc comment to the enum itself. - -error[E0277]: `TestType` doesn't implement `std::fmt::Display` - --> $DIR/enum_prefix_missing.rs:32:44 - | -32 | static_assertions::assert_impl_all!(label; TestType, core::fmt::Display); - | -------------------------------------------^^^^^^^^---------------------- - | | | - | | `TestType` cannot be formatted with the default formatter - | required by this bound in `assert_impl_all` - | - = help: the trait `std::fmt::Display` is not implemented for `TestType` - = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead +error: proc-macro derive panicked
+ --> $DIR/enum_prefix_missing.rs:22:10
+ |
+22 | #[derive(Display)]
+ | ^^^^^^^
+ |
+ = help: message: Missing doc comment on enum with #[prefix_enum_doc_attributes]. Please remove the attribute or add a doc comment to the enum itself.
+
+error[E0277]: `TestType` doesn't implement `std::fmt::Display`
+ --> $DIR/enum_prefix_missing.rs:32:37
+ |
+32 | static_assertions::assert_impl_all!(TestType: core::fmt::Display);
+ | ^^^^^^^^ `TestType` cannot be formatted with the default formatter
+ |
+ = help: the trait `std::fmt::Display` is not implemented for `TestType`
+ = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
+note: required by a bound in `assert_impl_all`
+ --> $DIR/enum_prefix_missing.rs:32:1
+ |
+32 | static_assertions::assert_impl_all!(TestType: core::fmt::Display);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `assert_impl_all`
+ = note: this error originates in the macro `static_assertions::assert_impl_all` (in Nightly builds, run with -Z macro-backtrace for more info)
diff --git a/vendor/displaydoc/tests/std/multi_line.rs b/vendor/displaydoc/tests/std/multi_line.rs index cadb83e70..5b0f2cfdf 100644 --- a/vendor/displaydoc/tests/std/multi_line.rs +++ b/vendor/displaydoc/tests/std/multi_line.rs @@ -1,37 +1 @@ -#![cfg_attr(not(feature = "std"), feature(lang_items, start))] -#![cfg_attr(not(feature = "std"), no_std)] - -#[cfg_attr(not(feature = "std"), start)] -fn start(_argc: isize, _argv: *const *const u8) -> isize { - 0 -} -#[lang = "eh_personality"] -#[no_mangle] -#[cfg(not(feature = "std"))] -pub extern "C" fn rust_eh_personality() {} -#[panic_handler] -#[cfg(not(feature = "std"))] -fn panic(_info: &core::panic::PanicInfo) -> ! { - unsafe { - libc::abort(); - } -} - -use displaydoc::Display; - -/// this type is pretty swell -#[derive(Display)] -enum TestType { - /// This one is okay - Variant1, - - /// Multi - /// line - /// doc. - Variant2, -} - -static_assertions::assert_impl_all!(label; TestType, core::fmt::Display); - -#[cfg(feature = "std")] -fn main() {} +../no_std/multi_line.rs
\ No newline at end of file diff --git a/vendor/displaydoc/tests/std/multi_line.stderr b/vendor/displaydoc/tests/std/multi_line.stderr index 5e41e5428..a8b6602b8 100644 --- a/vendor/displaydoc/tests/std/multi_line.stderr +++ b/vendor/displaydoc/tests/std/multi_line.stderr @@ -1,19 +1,22 @@ -error: proc-macro derive panicked - --> $DIR/multi_line.rs:23:10 - | -23 | #[derive(Display)] - | ^^^^^^^ - | - = help: message: Multi-line comments are disabled by default by displaydoc. Please consider using block doc comments (/** */) or adding the #[ignore_extra_doc_attributes] attribute to your type next to the derive. - -error[E0277]: `TestType` doesn't implement `std::fmt::Display` - --> $DIR/multi_line.rs:34:44 - | -34 | static_assertions::assert_impl_all!(label; TestType, core::fmt::Display); - | -------------------------------------------^^^^^^^^---------------------- - | | | - | | `TestType` cannot be formatted with the default formatter - | required by this bound in `assert_impl_all` - | - = help: the trait `std::fmt::Display` is not implemented for `TestType` - = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead +error: proc-macro derive panicked
+ --> $DIR/multi_line.rs:23:10
+ |
+23 | #[derive(Display)]
+ | ^^^^^^^
+ |
+ = help: message: Multi-line comments are disabled by default by displaydoc. Please consider using block doc comments (/** */) or adding the #[ignore_extra_doc_attributes] attribute to your type next to the derive.
+
+error[E0277]: `TestType` doesn't implement `std::fmt::Display`
+ --> $DIR/multi_line.rs:34:37
+ |
+34 | static_assertions::assert_impl_all!(TestType: core::fmt::Display);
+ | ^^^^^^^^ `TestType` cannot be formatted with the default formatter
+ |
+ = help: the trait `std::fmt::Display` is not implemented for `TestType`
+ = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
+note: required by a bound in `assert_impl_all`
+ --> $DIR/multi_line.rs:34:1
+ |
+34 | static_assertions::assert_impl_all!(TestType: core::fmt::Display);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `assert_impl_all`
+ = note: this error originates in the macro `static_assertions::assert_impl_all` (in Nightly builds, run with -Z macro-backtrace for more info)
diff --git a/vendor/displaydoc/tests/std/multi_line_allow.rs b/vendor/displaydoc/tests/std/multi_line_allow.rs index 05bdcf9fb..22511d9e7 100644 --- a/vendor/displaydoc/tests/std/multi_line_allow.rs +++ b/vendor/displaydoc/tests/std/multi_line_allow.rs @@ -1,38 +1,38 @@ -#![cfg_attr(not(feature = "std"), feature(lang_items, start))] -#![cfg_attr(not(feature = "std"), no_std)] - -#[cfg_attr(not(feature = "std"), start)] -fn start(_argc: isize, _argv: *const *const u8) -> isize { - 0 -} -#[lang = "eh_personality"] -#[no_mangle] -#[cfg(not(feature = "std"))] -pub extern "C" fn rust_eh_personality() {} -#[panic_handler] -#[cfg(not(feature = "std"))] -fn panic(_info: &core::panic::PanicInfo) -> ! { - unsafe { - libc::abort(); - } -} - -use displaydoc::Display; - -/// this type is pretty swell -#[derive(Display)] -#[ignore_extra_doc_attributes] -enum TestType { - /// This one is okay - Variant1, - - /// Multi - /// line - /// doc. - Variant2, -} - -static_assertions::assert_impl_all!(label; TestType, core::fmt::Display); - -#[cfg(feature = "std")] -fn main() {} +#![cfg_attr(not(feature = "std"), feature(lang_items, start))]
+#![cfg_attr(not(feature = "std"), no_std)]
+
+#[cfg_attr(not(feature = "std"), start)]
+fn start(_argc: isize, _argv: *const *const u8) -> isize {
+ 0
+}
+#[lang = "eh_personality"]
+#[no_mangle]
+#[cfg(not(feature = "std"))]
+pub extern "C" fn rust_eh_personality() {}
+#[panic_handler]
+#[cfg(not(feature = "std"))]
+fn panic(_info: &core::panic::PanicInfo) -> ! {
+ unsafe {
+ libc::abort();
+ }
+}
+
+use displaydoc::Display;
+
+/// this type is pretty swell
+#[derive(Display)]
+#[ignore_extra_doc_attributes]
+enum TestType {
+ /// This one is okay
+ Variant1,
+
+ /// Multi
+ /// line
+ /// doc.
+ Variant2,
+}
+
+static_assertions::assert_impl_all!(TestType: core::fmt::Display);
+
+#[cfg(feature = "std")]
+fn main() {}
diff --git a/vendor/displaydoc/tests/std/multiple.rs b/vendor/displaydoc/tests/std/multiple.rs index 915f9abdd..b0a4de0f7 100644 --- a/vendor/displaydoc/tests/std/multiple.rs +++ b/vendor/displaydoc/tests/std/multiple.rs @@ -1,38 +1,38 @@ -#![feature(lang_items, start)] -#![no_std] - -#[start] -#[cfg(not(feature = "std"))] -fn start(_argc: isize, _argv: *const *const u8) -> isize { - 0 -} - -#[lang = "eh_personality"] -#[no_mangle] -#[cfg(not(feature = "std"))] -pub extern "C" fn rust_eh_personality() {} - -#[panic_handler] -#[cfg(not(feature = "std"))] -fn panic(_info: &core::panic::PanicInfo) -> ! { - unsafe { - libc::abort(); - } -} - -#[cfg(feature = "std")] -fn main() {} - -use displaydoc::Display; - -/// this type is pretty swell -#[derive(Display)] -struct FakeType; - -static_assertions::assert_impl_all!(label; FakeType, core::fmt::Display); - -/// this type is pretty swell2 -#[derive(Display)] -struct FakeType2; - -static_assertions::assert_impl_all!(label2; FakeType2, core::fmt::Display); +#![feature(lang_items, start)]
+#![no_std]
+
+#[start]
+#[cfg(not(feature = "std"))]
+fn start(_argc: isize, _argv: *const *const u8) -> isize {
+ 0
+}
+
+#[lang = "eh_personality"]
+#[no_mangle]
+#[cfg(not(feature = "std"))]
+pub extern "C" fn rust_eh_personality() {}
+
+#[panic_handler]
+#[cfg(not(feature = "std"))]
+fn panic(_info: &core::panic::PanicInfo) -> ! {
+ unsafe {
+ libc::abort();
+ }
+}
+
+#[cfg(feature = "std")]
+fn main() {}
+
+use displaydoc::Display;
+
+/// this type is pretty swell
+#[derive(Display)]
+struct FakeType;
+
+static_assertions::assert_impl_all!(FakeType: core::fmt::Display);
+
+/// this type is pretty swell2
+#[derive(Display)]
+struct FakeType2;
+
+static_assertions::assert_impl_all!(FakeType2: core::fmt::Display);
diff --git a/vendor/displaydoc/tests/std/without.rs b/vendor/displaydoc/tests/std/without.rs index 32905aad9..6b5b71488 100644 --- a/vendor/displaydoc/tests/std/without.rs +++ b/vendor/displaydoc/tests/std/without.rs @@ -1,28 +1 @@ -#![cfg_attr(not(feature = "std"), feature(lang_items, start))] -#![cfg_attr(not(feature = "std"), no_std)] - -#[cfg_attr(not(feature = "std"), start)] -fn start(_argc: isize, _argv: *const *const u8) -> isize { - 0 -} -#[lang = "eh_personality"] -#[no_mangle] -#[cfg(not(feature = "std"))] -pub extern "C" fn rust_eh_personality() {} -#[panic_handler] -#[cfg(not(feature = "std"))] -fn panic(_info: &core::panic::PanicInfo) -> ! { - unsafe { - libc::abort(); - } -} - -use displaydoc::Display; - -/// this type is pretty swell -struct FakeType; - -static_assertions::assert_impl_all!(label; FakeType, core::fmt::Display); - -#[cfg(feature = "std")] -fn main() {} +../no_std/without.rs
\ No newline at end of file diff --git a/vendor/displaydoc/tests/std/without.stderr b/vendor/displaydoc/tests/std/without.stderr index 9780427e8..552ae826f 100644 --- a/vendor/displaydoc/tests/std/without.stderr +++ b/vendor/displaydoc/tests/std/without.stderr @@ -1,19 +1,22 @@ -warning: unused import: `displaydoc::Display` - --> $DIR/without.rs:20:5 - | -20 | use displaydoc::Display; - | ^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(unused_imports)]` on by default - -error[E0277]: `FakeType` doesn't implement `std::fmt::Display` - --> $DIR/without.rs:25:44 - | -25 | static_assertions::assert_impl_all!(label; FakeType, core::fmt::Display); - | -------------------------------------------^^^^^^^^---------------------- - | | | - | | `FakeType` cannot be formatted with the default formatter - | required by this bound in `assert_impl_all` - | - = help: the trait `std::fmt::Display` is not implemented for `FakeType` - = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead +warning: unused import: `displaydoc::Display`
+ --> $DIR/without.rs:20:5
+ |
+20 | use displaydoc::Display;
+ | ^^^^^^^^^^^^^^^^^^^
+ |
+ = note: `#[warn(unused_imports)]` on by default
+
+error[E0277]: `FakeType` doesn't implement `std::fmt::Display`
+ --> $DIR/without.rs:25:37
+ |
+25 | static_assertions::assert_impl_all!(FakeType: core::fmt::Display);
+ | ^^^^^^^^ `FakeType` cannot be formatted with the default formatter
+ |
+ = help: the trait `std::fmt::Display` is not implemented for `FakeType`
+ = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
+note: required by a bound in `assert_impl_all`
+ --> $DIR/without.rs:25:1
+ |
+25 | static_assertions::assert_impl_all!(FakeType: core::fmt::Display);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `assert_impl_all`
+ = note: this error originates in the macro `static_assertions::assert_impl_all` (in Nightly builds, run with -Z macro-backtrace for more info)
diff --git a/vendor/displaydoc/tests/variantless.rs b/vendor/displaydoc/tests/variantless.rs new file mode 100644 index 000000000..bc23ed464 --- /dev/null +++ b/vendor/displaydoc/tests/variantless.rs @@ -0,0 +1,6 @@ +use displaydoc::Display;
+
+#[derive(Display)]
+enum EmptyInside {}
+
+static_assertions::assert_impl_all!(EmptyInside: core::fmt::Display);
diff --git a/vendor/displaydoc/update-readme.sh b/vendor/displaydoc/update-readme.sh new file mode 100644 index 000000000..90db1a817 --- /dev/null +++ b/vendor/displaydoc/update-readme.sh @@ -0,0 +1,5 @@ +#! /usr/bin/env bash
+
+cargo readme > ./README.md
+git add ./README.md
+git commit -m "Update readme" || true
|