Update anyhow to 1.0.95
Test: treehugger
Change-Id: I43d063b5b2541667ece5bf26221ffb6c96961ce8
diff --git a/crates/anyhow/.android-checksum.json b/crates/anyhow/.android-checksum.json
index 6806122..17f0459 100644
--- a/crates/anyhow/.android-checksum.json
+++ b/crates/anyhow/.android-checksum.json
@@ -1 +1 @@
-{"package":null,"files":{".cargo-checksum.json":"eb6ac638329e1e22dff1a85c94cc3466af98a3e057d9806dcf354570cac200cd","Android.bp":"ee8a7d1eb0ed6f0e9f6170590dd0ffb1fbfab561db53e96e76105a5043c17554","Cargo.toml":"a239b1153fe69af2dac6e8cb8858711a84ca06b7a39fb2a08eb5745225a4d314","LICENSE":"50f827348bfd5def2df4f30cb41264072cf9c180bd9ed698437e8d85b2482754","LICENSE-APACHE":"50f827348bfd5def2df4f30cb41264072cf9c180bd9ed698437e8d85b2482754","LICENSE-MIT":"38620a3cfaeec97a9197e8c39e436ea7f0bc86699b1f1c35f1aa41785b6d4eac","METADATA":"e28c08e692d8edcf4cf416b41f8679d3acdd4b8cb3d7ac93bd1d07335841fb16","MODULE_LICENSE_APACHE2":"0d6f8afa3940b7f06bebee651376d43bc8b0d5b437337be2696d30377451e93a","NOTICE":"50f827348bfd5def2df4f30cb41264072cf9c180bd9ed698437e8d85b2482754","README.md":"8a77d709791a6f1cb645d2526bc5213c9de5c9d17c631844dd3a23958be1ad73","TEST_MAPPING":"29c108f688eb487511b09dad52fd194a6c615116e8b6cbd1e086bfd0446fbe49","build.rs":"e0dac83067c845e156836f0024fca74692325f6ebbae30f702b53e4e530e4051","build/probe.rs":"d6fedff361865fdfac422b38c7e377cd9044b4ee6cfddc971f69647568bdb727","cargo_embargo.json":"8de1ddbaead22702faddd35234241c9bac36a1732a4d91d693ac3c9f1ef9de27","patches/0001-Support-RUST_BACKTRACE-settings-in-test_fmt.patch":"c1f3920eccde9102ec4eb781e16af4a8d44332d9340afa5890463fce7fe6e767","rust-toolchain.toml":"25bc44c2a4cb625e0f16003c73ac0db2fc79a3b79a5b0e6d4b6175c6dbe5af69","src/backtrace.rs":"d9d4415db753717978ccb20df5fccca2e7bfac14ae5529cb384b82732c4db804","src/chain.rs":"c1af745a06948c326758c185c50d5f46e54b5628098091d1ca53b3569d29dc66","src/context.rs":"0c9b6ee3126f2af8d34e7e749d0a70aaa0fa33c6b462b14a7c7fa2e9c9792336","src/ensure.rs":"db4aa1411171ce2cd03518d583b302bbbf4e6f7f456bac15d1d867bd6f8808f6","src/error.rs":"9c5d4ee6a6473c7dcbbeb0d01c41cc56e36e01dd4af7e453135d669a82d5bce4","src/fmt.rs":"805c7503e09f60bf78932b36b3e3ba56881597358cafe183f99878a256bd1bf1","src/kind.rs":"d466f5fe9d5ddc1ec010ee3a8e8bfdacd241ceffc3672a207a6a82a0ff8ec9f0","src/lib.rs":"da49746563a57801f83b5b5e530dce47a018aa84daa8768cb79656011213aa99","src/macros.rs":"e3e5aaa02b7c76ef9282dcff6763c0df8418c032a7e11a410be33390c033fb35","src/ptr.rs":"fb5381f35e251f864d19bbf5c12267500e3f1dba4b2a3b778c43a28f9d37ddf1","src/wrapper.rs":"ea6e738a1be71dc45be466df6b5fdac2967c47e487f0ae0579d5274a827094d4","tests/common/mod.rs":"d94b75b7944203361428a1c836608fb591b794756dfc05e64f82d6ac4462ce79","tests/compiletest.rs":"8f2cbc080ae802a72afbc627b943e187f66bfe0214f7d989460badb57ddfbb8d","tests/drop/mod.rs":"6014e5b3530fe0827b9dc65ef01de6bfc1a0b1f8649dc69c3e40f61343985dc6","tests/test_autotrait.rs":"4a0dee1d8479aff7d4e39e06fb750df4b6e9cac492099bbab91ed20a5248e457","tests/test_backtrace.rs":"fa323eec398ca29f95a1cda7cd52602d7550d251cf0ee0791100a477e0656ed9","tests/test_boxed.rs":"09eb41525fc3cecb764e6778be876d1d4ffb81fa096659ca7ff2e753d3f2030c","tests/test_chain.rs":"262727a8ac16a701bf71c86d768e14452a77fffcebb34943186a0cbb87161866","tests/test_context.rs":"4746fa09f5ae9284304d2bb394350f089ce8ca5c2f0418b34145f3588e2aeb58","tests/test_convert.rs":"06562ab10fd1d88990a38ed400eb6ab4707e89c7f1e5cd1125992b4615ad8046","tests/test_downcast.rs":"c30595e7dab09f0d1246a554a6fc1f0857665234498ff13eb7df7597d0a4718d","tests/test_ensure.rs":"6d957308486ed80d4b9ae2c4ddaafb52f4a39145479cd93a9eddb927b57b03ec","tests/test_ffi.rs":"161a32a63dbdda98e129e2f943afb3fae4e68ca2cee1fef40f18e84b1e74138b","tests/test_fmt.rs":"f2e5123bd2232f59809f633e955027a2d0e9aa567dc8eedbee417eeebfa76e60","tests/test_macros.rs":"074a6d20e953d38d44c8860aa9083b7570c3cd58b0f632bef37d290b60aa5067","tests/test_repr.rs":"053356028202f3fea232745ab3aa8eba05fec011da43fcb8f856c81927f455cd","tests/test_source.rs":"54bb2d6fc197ede956f7696f86371357e4c14665a685d83a54b94fbfa6511d95","tests/ui/chained-comparison.rs":"910c5b8fdc859eabc2d6bc99b40569327f876cc85575039c4c3abf2c3977f1df","tests/ui/chained-comparison.stderr":"4f747b5a7e118a5d01c45e5d873c7f9461064e182b465dacb51ebf0c74abc235","tests/ui/empty-ensure.rs":"cc27e33cf5a48c9da6c1428a2369ca42dfa278229e479208f18efce5a4b12dcf","tests/ui/empty-ensure.stderr":"4a10e37a7eb01e15df621dd7ae340e71eb1b1e27bdd8da987bc3c5dc23bc437c","tests/ui/must-use.rs":"ec808205dd1957405858e72d67ae797de6059646858177840d9236554d3bc216","tests/ui/must-use.stderr":"211bddda8eed673b87e886ccd2beeb2f444c347d2be8cbd6f4c0dd2e3bb736a1","tests/ui/no-impl.rs":"f6262246417870658aa407892096680e0fc251873a33ed3ea4aa5f36b856d616","tests/ui/no-impl.stderr":"704ea781435ed5f2780b7af28c88cf8915e5475c8bf9ea6b9fe764d7b0611ccd","tests/ui/temporary-value.rs":"5b41a722c1de06cf094a9778d772f1fbde2f11e4fabfcd1d63020f930bfda107","tests/ui/temporary-value.stderr":"85c060a15ec8dad4a1971706e22e048bb3d3b1d1307b56628fd03e95563bdfce","tests/ui/wrong-interpolation.rs":"27554486996e93cc5ae9b05f74cd6b8c92d0654284741bc3d1426dcf622c8ea1","tests/ui/wrong-interpolation.stderr":"86394096d6b66ce0355c77a466dfb355ebe700154f82412dad391767c007290e"}}
\ No newline at end of file
+{"package":null,"files":{".cargo-checksum.json":"2b9bbb7069087bdff3bb65c77f5a097a646046eaf140639622ffee9b41227e93","Android.bp":"19834c7501599ed756a6e2427e00e3ebab75ba73288d19cd164a7bd9f162d840","Cargo.toml":"ac95f981b23c70ea175e59704904b74ead55d82a37d98629b44ed9f8ea164469","LICENSE":"50f827348bfd5def2df4f30cb41264072cf9c180bd9ed698437e8d85b2482754","LICENSE-APACHE":"50f827348bfd5def2df4f30cb41264072cf9c180bd9ed698437e8d85b2482754","LICENSE-MIT":"38620a3cfaeec97a9197e8c39e436ea7f0bc86699b1f1c35f1aa41785b6d4eac","METADATA":"bcae4642b151f8ba51561f3a2a2d39ec6c236b292b0b9c2e7d6f124283aa6587","MODULE_LICENSE_APACHE2":"0d6f8afa3940b7f06bebee651376d43bc8b0d5b437337be2696d30377451e93a","NOTICE":"50f827348bfd5def2df4f30cb41264072cf9c180bd9ed698437e8d85b2482754","README.md":"183e2c7bed174e9a35c3917de2160585f057bf302d56958329de0d867e1ce537","TEST_MAPPING":"29c108f688eb487511b09dad52fd194a6c615116e8b6cbd1e086bfd0446fbe49","build.rs":"37a90d5fe4a386cdf72c0a81f40d49572e0e8e44b3c5c4c034c6288bcd01b60b","build/probe.rs":"ca94474c6ba3d02f68acda33b5cf060ba7c21c916a3925fec514212861d0e25c","cargo_embargo.json":"8de1ddbaead22702faddd35234241c9bac36a1732a4d91d693ac3c9f1ef9de27","patches/0001-Support-RUST_BACKTRACE-settings-in-test_fmt.patch":"3d7d29ffe13113a36e0cac95abafb1dec4fbd27d8527ca0eba357c1fcbb793b8","rust-toolchain.toml":"25bc44c2a4cb625e0f16003c73ac0db2fc79a3b79a5b0e6d4b6175c6dbe5af69","src/backtrace.rs":"bff4118d23ae4585136bea47b6ce87ebb1d836ad4a962dcc2ef35ccabc7d518a","src/chain.rs":"9b925129e4aa99f6aaa66f801752cace3924ddeabb858655dae7d82083c5f05a","src/context.rs":"5903781a8cdf048199cd29b065714f7f1b1d3b4baa3b982a40901ef0404e1231","src/ensure.rs":"3c2f8c92d1b878d16caa2a1cef527eff4afa0184e76fecba2454974b0bebc50f","src/error.rs":"873995ea757d30a10ab7db12352065bb0c0ff082f0ccae2489eb838d92150f31","src/fmt.rs":"21689e9443109fa58677269fc6c6004909c63677da0886e8d99e2b8d63c15438","src/kind.rs":"3f6731b901afe9be7877db5a125d0e18ee2ddd8d4b7a572534cd132b9d5e144a","src/lib.rs":"82761355a51533ba8eecf44c68496e2218321f11bb50aac294465491b51aff1e","src/macros.rs":"ea096b7a733c527eac71fac0479439e9a6d9860264796a640fc69b83dae39bf3","src/ptr.rs":"fb5381f35e251f864d19bbf5c12267500e3f1dba4b2a3b778c43a28f9d37ddf1","src/wrapper.rs":"8a7323dd2981eb7faf05bba78b9a989f7f6ade45adae5a082616631cea3dc79a","tests/common/mod.rs":"d94b75b7944203361428a1c836608fb591b794756dfc05e64f82d6ac4462ce79","tests/compiletest.rs":"5876a4728abd95ed4ed3b78777fe95428d32a32730d7718f58001bdbd4d1e168","tests/drop/mod.rs":"6014e5b3530fe0827b9dc65ef01de6bfc1a0b1f8649dc69c3e40f61343985dc6","tests/test_autotrait.rs":"f3a4992b0a9c7e68395f8c6ffe7256c64a0effb729dbb638dde5bfc596df74f6","tests/test_backtrace.rs":"12f8d2bc280eb7a843c1ec423ed74c156deeebcb2f4f0df6657fc32661d21d9a","tests/test_boxed.rs":"09eb41525fc3cecb764e6778be876d1d4ffb81fa096659ca7ff2e753d3f2030c","tests/test_chain.rs":"262727a8ac16a701bf71c86d768e14452a77fffcebb34943186a0cbb87161866","tests/test_context.rs":"4746fa09f5ae9284304d2bb394350f089ce8ca5c2f0418b34145f3588e2aeb58","tests/test_convert.rs":"06562ab10fd1d88990a38ed400eb6ab4707e89c7f1e5cd1125992b4615ad8046","tests/test_downcast.rs":"c30595e7dab09f0d1246a554a6fc1f0857665234498ff13eb7df7597d0a4718d","tests/test_ensure.rs":"6a3f2121ad073878599c0c13631f6897351e2890a44ed7b87b148680f59a433f","tests/test_ffi.rs":"161a32a63dbdda98e129e2f943afb3fae4e68ca2cee1fef40f18e84b1e74138b","tests/test_fmt.rs":"2a971e5e9595a0af78325658cb74fa0e88fc39da8af05ec8c443dd35b359fccc","tests/test_macros.rs":"8b6f94d010bf74947e73862ca117e786ad440a0d800e387964bd0320d47f73ae","tests/test_repr.rs":"aac784a91c2347f397b960a92cfe6c56aba38f68216579e3e802e2cac131f761","tests/test_source.rs":"54bb2d6fc197ede956f7696f86371357e4c14665a685d83a54b94fbfa6511d95","tests/ui/chained-comparison.rs":"910c5b8fdc859eabc2d6bc99b40569327f876cc85575039c4c3abf2c3977f1df","tests/ui/chained-comparison.stderr":"4f747b5a7e118a5d01c45e5d873c7f9461064e182b465dacb51ebf0c74abc235","tests/ui/empty-ensure.rs":"cc27e33cf5a48c9da6c1428a2369ca42dfa278229e479208f18efce5a4b12dcf","tests/ui/empty-ensure.stderr":"4a10e37a7eb01e15df621dd7ae340e71eb1b1e27bdd8da987bc3c5dc23bc437c","tests/ui/ensure-nonbool.rs":"81e39527169c0cc2e0c34bbf4714570efb21ce65ad7e7abe421a5ab87c6da1c5","tests/ui/ensure-nonbool.stderr":"2819e6e4261e3b2a2e10d177d1c8f9622c8723843d2bb2cc8ef7a16acd9630c1","tests/ui/must-use.rs":"ec808205dd1957405858e72d67ae797de6059646858177840d9236554d3bc216","tests/ui/must-use.stderr":"211bddda8eed673b87e886ccd2beeb2f444c347d2be8cbd6f4c0dd2e3bb736a1","tests/ui/no-impl.rs":"f6262246417870658aa407892096680e0fc251873a33ed3ea4aa5f36b856d616","tests/ui/no-impl.stderr":"850e114f66992b8ec3a7c52e394195be98cdb55176b01a2e0e61db7fd0a5ac49","tests/ui/temporary-value.rs":"5b41a722c1de06cf094a9778d772f1fbde2f11e4fabfcd1d63020f930bfda107","tests/ui/temporary-value.stderr":"85c060a15ec8dad4a1971706e22e048bb3d3b1d1307b56628fd03e95563bdfce","tests/ui/wrong-interpolation.rs":"27554486996e93cc5ae9b05f74cd6b8c92d0654284741bc3d1426dcf622c8ea1","tests/ui/wrong-interpolation.stderr":"86394096d6b66ce0355c77a466dfb355ebe700154f82412dad391767c007290e"}}
\ No newline at end of file
diff --git a/crates/anyhow/.cargo-checksum.json b/crates/anyhow/.cargo-checksum.json
index 367a669..f976510 100644
--- a/crates/anyhow/.cargo-checksum.json
+++ b/crates/anyhow/.cargo-checksum.json
@@ -1 +1 @@
-{"files":{"Cargo.toml":"1696b9f34686556027ae9ba768e09f5e4a2362291158399fed2a1891a13d02ed","LICENSE-APACHE":"62c7a1e35f56406896d7aa7ca52d0cc0d272ac022b5d2796e7d6905db8a3636a","LICENSE-MIT":"23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3","README.md":"0999fd320cdb3300dd22ff03b97cd41945cc9833a02a5b7c53ed36ab6d6f66e7","build.rs":"a5ac61a8922f6b9bf319e2f8c0c20bdafb362b9c1f7805fc6d878660708e5ac2","build/probe.rs":"b8b792036f13c9c1fbc6b1244198ea2305e61ddfcda3856563b581dcb1e1fe6e","rust-toolchain.toml":"6bbb61302978c736b2da03e4fb40e3beab908f85d533ab46fd541e637b5f3e0f","src/backtrace.rs":"652ab0ff85c57cb6d34b97e15a705494f50aef77fc3916333d2b25ee05e6406c","src/chain.rs":"6edefc5f3c7d69683095862e54e3bb56faba5b3387bf2eeaed429da090007a0a","src/context.rs":"04e4b80b9f6d8163edc53455b98ab0c40cb9ad104bcf0c74f8075f22024471ab","src/ensure.rs":"d4c2588608e529275bfee1c1afc8860d7def868ab01e95a692a995ee06b2936e","src/error.rs":"a274234af662770340b237c9016beea2f94e7906f3fe69d0d78057929889f25b","src/fmt.rs":"b27311c860a9bd7c2b16367a30fc5131b3eea56751e69208d196dfc656a2ba91","src/kind.rs":"89883cd3287921355ee99c988fb7687beb77644c3dec6fb3bb1308db5d6dc51a","src/lib.rs":"bbe72815f1ab2fdba675990e4083b77f62a96e76031a55ce5ad27ef98a230f2b","src/macros.rs":"dd35f2ec2a0a25e4504fb04bcd42f6d0963bc0035aaaefc412f5ee1d78945fe1","src/ptr.rs":"4cb31d2f815b178daf951bfb94a1930383e056c0ca68d494603f45d8eea35d50","src/wrapper.rs":"8800848623b464eb19e77550201e446ff6913c8c39537fe6f70df9e2b43a9b21","tests/common/mod.rs":"f9088c2d7afafa64ff730b629272045b776bfafc2f5957508242da630635f2e1","tests/compiletest.rs":"022a8e400ef813d7ea1875b944549cee5125f6a995dc33e93b48cba3e1b57bd1","tests/drop/mod.rs":"08c3e553c1cc0d2dbd936fc45f4b5b1105057186affd6865e8d261e05f0f0646","tests/test_autotrait.rs":"ecccf9202a33611f64b76598806aa82abec2560ae058e32f63fb2fb3ef225be9","tests/test_backtrace.rs":"ed144f90bf62cc441de067f6cee09ece94bca9da8f9b492d11d3dc652ba83e26","tests/test_boxed.rs":"6b26db0e2eb72afe9af7352ea820837aab90f8d486294616dd5dc34c1b94038c","tests/test_chain.rs":"3a8a8d7569913bd98c0e27c69d0bda35101e7fde7c056ed57cdd8ed018e4cbcb","tests/test_context.rs":"8409c53b328562c11e822bd6c3cd17e0d4d50b9bbb8fc3617333fd77303a6a33","tests/test_convert.rs":"7e7a8b4772a427a911014ac4d1083f9519000e786177f898808980dd9bdfde61","tests/test_downcast.rs":"797e69a72d125758c4c4897e5dc776d549d52cc9a6a633e0a33193f588a62b88","tests/test_ensure.rs":"89bb15f2a6288037bcf6ad976705038d9bea714da4244dee8314c720f88393c8","tests/test_ffi.rs":"d0cb4c1d6d9154090982dee72ae3ebe05a5981f976058c3250f1c9da5a45edef","tests/test_fmt.rs":"81b14dd207ba5fbf02aaed031646810906c9c9c2fc5cabffc8e88f82462be499","tests/test_macros.rs":"11f05010bc9b16319884c1286444100e30cddc2ecd1ffe5e0fd3fee5ffb32683","tests/test_repr.rs":"b3fa96b52a98b2111e845b59974910acb107a6526514c80fc5d9db7eed402682","tests/test_source.rs":"b80723cf635a4f8c4df21891b34bfab9ed2b2aa407e7a2f826d24e334cd5f88e","tests/ui/chained-comparison.rs":"6504b03d95b5acc232a7f4defc9f343b2be6733bf475fa0992e8e6545b912bd4","tests/ui/chained-comparison.stderr":"7f1d0a8c251b0ede2d30b3087ec157fc660945c97a642c4a5acf5a14ec58de34","tests/ui/empty-ensure.rs":"ab5bf37c846a0d689f26ce9257a27228411ed64154f9c950f1602d88a355d94b","tests/ui/empty-ensure.stderr":"315782f5f4246290fe190e3767b22c3dcaffaabc19c5ace0373537d53e765278","tests/ui/must-use.rs":"fb59860b43f673bf4a430a6036ba463e95028844d8dd4243cfe5ebc7f2be582f","tests/ui/must-use.stderr":"c2848c5f254b4c061eea6714d9baf709924aba06619eaf2a8b3aee1266b75f9e","tests/ui/no-impl.rs":"fab6cbf2f6ea510b86f567dfb3b7c31250a9fd71ae5d110dbb9188be569ec593","tests/ui/no-impl.stderr":"04415aeaa14995f47f06f35fb1f6971d332d2110aabca920c30ab0803d6a0a5e","tests/ui/temporary-value.rs":"4dcc96271b2403e6372cf4cfc813445e5ce4365fc6e156b6bc38274098499a70","tests/ui/temporary-value.stderr":"171f6c1c962503855480696e5d39e68946ec2a027b61a6f36ca1ad1b40265c5d","tests/ui/wrong-interpolation.rs":"9c44d4674c2dccd27b9dedd03341346ec02d993b41793ee89b5755202e7e367e","tests/ui/wrong-interpolation.stderr":"301e60e2eb9401782c7dc0b3580613a4cb2aafd4cc8065734a630a62e1161aa5"},"package":"080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca"}
\ No newline at end of file
+{"files":{"Cargo.toml":"c48ec90cc7af9588407beaafaebf22839f25cf8bcb7a3c6cac5cc8c83bde3a91","LICENSE-APACHE":"62c7a1e35f56406896d7aa7ca52d0cc0d272ac022b5d2796e7d6905db8a3636a","LICENSE-MIT":"23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3","README.md":"136d2b44cc4060192516f18e43ec3eafb65693c1819a80a867e7a00c60a45ee6","build.rs":"27bcb3380f8b9b52a12d1aedad324858a94de974f17efa86ff93aa7e556b3798","build/probe.rs":"ee0a4518493c0b3cca121ed2e937b1779eb7e8313a5c4d5fc5aea28ff015366b","rust-toolchain.toml":"6bbb61302978c736b2da03e4fb40e3beab908f85d533ab46fd541e637b5f3e0f","src/backtrace.rs":"bbaa0e0e228475c9c9532786e305cf04f53729f386c48adb1d93bb8ce07f37ad","src/chain.rs":"85af447405f075633fab186b7f1c94d7f33a36474f239c50a961b2d6197d5426","src/context.rs":"a80ec8f297c1eae04653a6786042e316c5ff2fa6f5ea8566108bee8bdcc705cb","src/ensure.rs":"709524741c8f9365e01cb36fc2349a8724513de02cf9e253809a93af8d6a7b6e","src/error.rs":"c212c4599541c7561d5098aa61a9d112d6291ab181502e7cf874cc7085083398","src/fmt.rs":"adf4be906b29900153bfb4b767a6049d58697dc3bcce7dfbb85ca773f5de5b33","src/kind.rs":"ddcabf15b3b47a4ef16ed361c45cc0cc82e7be90622995ff6c04b3fec78bb04f","src/lib.rs":"bd57600ee8caa6a1c2fc9a60befa627223add2177527db49c144c902112e3698","src/macros.rs":"875797636fde708dcb9c82e0cb3107cf38334086274aaada267fb5bfd60547a9","src/ptr.rs":"4cb31d2f815b178daf951bfb94a1930383e056c0ca68d494603f45d8eea35d50","src/wrapper.rs":"d4e45caee3c2d861d4609a8141310d5c901af59a57d5f0a0de30251347dbd23c","tests/common/mod.rs":"f9088c2d7afafa64ff730b629272045b776bfafc2f5957508242da630635f2e1","tests/compiletest.rs":"4e381aa8ca3eabb7ac14d1e0c3700b3223e47640547a6988cfa13ad68255f60f","tests/drop/mod.rs":"08c3e553c1cc0d2dbd936fc45f4b5b1105057186affd6865e8d261e05f0f0646","tests/test_autotrait.rs":"ba9bc18416115cb48fd08675a3e7fc89584de7926dad6b2be6645dc13d5931df","tests/test_backtrace.rs":"60afdd7ee5850dc22625ff486fe41c47fd322db874a93c4871ddfed2bf603930","tests/test_boxed.rs":"6b26db0e2eb72afe9af7352ea820837aab90f8d486294616dd5dc34c1b94038c","tests/test_chain.rs":"3a8a8d7569913bd98c0e27c69d0bda35101e7fde7c056ed57cdd8ed018e4cbcb","tests/test_context.rs":"8409c53b328562c11e822bd6c3cd17e0d4d50b9bbb8fc3617333fd77303a6a33","tests/test_convert.rs":"7e7a8b4772a427a911014ac4d1083f9519000e786177f898808980dd9bdfde61","tests/test_downcast.rs":"797e69a72d125758c4c4897e5dc776d549d52cc9a6a633e0a33193f588a62b88","tests/test_ensure.rs":"5ac28daf6889e957134309c0a0fbdec89b6bd974596e2205fbc4e8c1bb02ee5b","tests/test_ffi.rs":"d0cb4c1d6d9154090982dee72ae3ebe05a5981f976058c3250f1c9da5a45edef","tests/test_fmt.rs":"0e49b48f08e4faaf03e2f202e1efc5250018876c4e1b01b8379d7a38ae8df870","tests/test_macros.rs":"68673942662a43bceee62aaed69c25d7ddbc55e25d62d528e13033c3e2e756cd","tests/test_repr.rs":"034dee888abd08741e11ac2e95ef4fcb2ab3943d0a76e8e976db404658e1a252","tests/test_source.rs":"b80723cf635a4f8c4df21891b34bfab9ed2b2aa407e7a2f826d24e334cd5f88e","tests/ui/chained-comparison.rs":"6504b03d95b5acc232a7f4defc9f343b2be6733bf475fa0992e8e6545b912bd4","tests/ui/chained-comparison.stderr":"7f1d0a8c251b0ede2d30b3087ec157fc660945c97a642c4a5acf5a14ec58de34","tests/ui/empty-ensure.rs":"ab5bf37c846a0d689f26ce9257a27228411ed64154f9c950f1602d88a355d94b","tests/ui/empty-ensure.stderr":"315782f5f4246290fe190e3767b22c3dcaffaabc19c5ace0373537d53e765278","tests/ui/ensure-nonbool.rs":"7e57cb93fbcd82959b36586ed6bd2ad978b051fe5facd5274651fde6b1600905","tests/ui/ensure-nonbool.stderr":"0b4d1611e3bb65081bf38c1e49b1f12e5096738f276608661016e68f1fe13f7c","tests/ui/must-use.rs":"fb59860b43f673bf4a430a6036ba463e95028844d8dd4243cfe5ebc7f2be582f","tests/ui/must-use.stderr":"c2848c5f254b4c061eea6714d9baf709924aba06619eaf2a8b3aee1266b75f9e","tests/ui/no-impl.rs":"fab6cbf2f6ea510b86f567dfb3b7c31250a9fd71ae5d110dbb9188be569ec593","tests/ui/no-impl.stderr":"0d8ed712d25de898eae18cfdffc575a47f4d5596346058cf6cd50d016c4f8ce8","tests/ui/temporary-value.rs":"4dcc96271b2403e6372cf4cfc813445e5ce4365fc6e156b6bc38274098499a70","tests/ui/temporary-value.stderr":"171f6c1c962503855480696e5d39e68946ec2a027b61a6f36ca1ad1b40265c5d","tests/ui/wrong-interpolation.rs":"9c44d4674c2dccd27b9dedd03341346ec02d993b41793ee89b5755202e7e367e","tests/ui/wrong-interpolation.stderr":"301e60e2eb9401782c7dc0b3580613a4cb2aafd4cc8065734a630a62e1161aa5"},"package":"34ac096ce696dc2fcabef30516bb13c0a68a11d30131d3df6f04711467681b04"}
\ No newline at end of file
diff --git a/crates/anyhow/Android.bp b/crates/anyhow/Android.bp
index 9b9c2cf..cc6311c 100644
--- a/crates/anyhow/Android.bp
+++ b/crates/anyhow/Android.bp
@@ -18,7 +18,7 @@
host_supported: true,
crate_name: "anyhow",
cargo_env_compat: true,
- cargo_pkg_version: "1.0.79",
+ cargo_pkg_version: "1.0.95",
crate_root: "src/lib.rs",
test_suites: ["general-tests"],
auto_gen_config: true,
@@ -41,7 +41,7 @@
host_supported: true,
crate_name: "test_autotrait",
cargo_env_compat: true,
- cargo_pkg_version: "1.0.79",
+ cargo_pkg_version: "1.0.95",
crate_root: "tests/test_autotrait.rs",
test_suites: ["general-tests"],
auto_gen_config: true,
@@ -65,7 +65,7 @@
host_supported: true,
crate_name: "test_boxed",
cargo_env_compat: true,
- cargo_pkg_version: "1.0.79",
+ cargo_pkg_version: "1.0.95",
crate_root: "tests/test_boxed.rs",
test_suites: ["general-tests"],
auto_gen_config: true,
@@ -89,7 +89,7 @@
host_supported: true,
crate_name: "test_chain",
cargo_env_compat: true,
- cargo_pkg_version: "1.0.79",
+ cargo_pkg_version: "1.0.95",
crate_root: "tests/test_chain.rs",
test_suites: ["general-tests"],
auto_gen_config: true,
@@ -113,7 +113,7 @@
host_supported: true,
crate_name: "test_context",
cargo_env_compat: true,
- cargo_pkg_version: "1.0.79",
+ cargo_pkg_version: "1.0.95",
crate_root: "tests/test_context.rs",
test_suites: ["general-tests"],
auto_gen_config: true,
@@ -137,7 +137,7 @@
host_supported: true,
crate_name: "test_convert",
cargo_env_compat: true,
- cargo_pkg_version: "1.0.79",
+ cargo_pkg_version: "1.0.95",
crate_root: "tests/test_convert.rs",
test_suites: ["general-tests"],
auto_gen_config: true,
@@ -161,7 +161,7 @@
host_supported: true,
crate_name: "test_downcast",
cargo_env_compat: true,
- cargo_pkg_version: "1.0.79",
+ cargo_pkg_version: "1.0.95",
crate_root: "tests/test_downcast.rs",
test_suites: ["general-tests"],
auto_gen_config: true,
@@ -185,7 +185,7 @@
host_supported: true,
crate_name: "test_fmt",
cargo_env_compat: true,
- cargo_pkg_version: "1.0.79",
+ cargo_pkg_version: "1.0.95",
crate_root: "tests/test_fmt.rs",
test_suites: ["general-tests"],
auto_gen_config: true,
@@ -209,7 +209,7 @@
host_supported: true,
crate_name: "test_macros",
cargo_env_compat: true,
- cargo_pkg_version: "1.0.79",
+ cargo_pkg_version: "1.0.95",
crate_root: "tests/test_macros.rs",
test_suites: ["general-tests"],
auto_gen_config: true,
@@ -233,7 +233,7 @@
host_supported: true,
crate_name: "test_repr",
cargo_env_compat: true,
- cargo_pkg_version: "1.0.79",
+ cargo_pkg_version: "1.0.95",
crate_root: "tests/test_repr.rs",
test_suites: ["general-tests"],
auto_gen_config: true,
@@ -257,7 +257,7 @@
host_supported: true,
crate_name: "test_source",
cargo_env_compat: true,
- cargo_pkg_version: "1.0.79",
+ cargo_pkg_version: "1.0.95",
crate_root: "tests/test_source.rs",
test_suites: ["general-tests"],
auto_gen_config: true,
@@ -281,7 +281,7 @@
host_supported: true,
crate_name: "anyhow",
cargo_env_compat: true,
- cargo_pkg_version: "1.0.79",
+ cargo_pkg_version: "1.0.95",
crate_root: "src/lib.rs",
edition: "2018",
features: [
diff --git a/crates/anyhow/Cargo.toml b/crates/anyhow/Cargo.toml
index b92e7a3..119adf4 100644
--- a/crates/anyhow/Cargo.toml
+++ b/crates/anyhow/Cargo.toml
@@ -13,8 +13,14 @@
edition = "2018"
rust-version = "1.39"
name = "anyhow"
-version = "1.0.79"
+version = "1.0.95"
authors = ["David Tolnay <[email protected]>"]
+build = "build.rs"
+autolib = false
+autobins = false
+autoexamples = false
+autotests = false
+autobenches = false
description = "Flexible concrete Error type built on std::error::Error"
documentation = "https://docs.rs/anyhow"
readme = "README.md"
@@ -30,16 +36,74 @@
repository = "https://github.com/dtolnay/anyhow"
[package.metadata.docs.rs]
-rustdoc-args = [
- "--cfg",
- "doc_cfg",
- "--generate-link-to-definition",
-]
+rustdoc-args = ["--generate-link-to-definition"]
targets = ["x86_64-unknown-linux-gnu"]
+[features]
+default = ["std"]
+std = []
+
[lib]
+name = "anyhow"
+path = "src/lib.rs"
doc-scrape-examples = false
+[[test]]
+name = "compiletest"
+path = "tests/compiletest.rs"
+
+[[test]]
+name = "test_autotrait"
+path = "tests/test_autotrait.rs"
+
+[[test]]
+name = "test_backtrace"
+path = "tests/test_backtrace.rs"
+
+[[test]]
+name = "test_boxed"
+path = "tests/test_boxed.rs"
+
+[[test]]
+name = "test_chain"
+path = "tests/test_chain.rs"
+
+[[test]]
+name = "test_context"
+path = "tests/test_context.rs"
+
+[[test]]
+name = "test_convert"
+path = "tests/test_convert.rs"
+
+[[test]]
+name = "test_downcast"
+path = "tests/test_downcast.rs"
+
+[[test]]
+name = "test_ensure"
+path = "tests/test_ensure.rs"
+
+[[test]]
+name = "test_ffi"
+path = "tests/test_ffi.rs"
+
+[[test]]
+name = "test_fmt"
+path = "tests/test_fmt.rs"
+
+[[test]]
+name = "test_macros"
+path = "tests/test_macros.rs"
+
+[[test]]
+name = "test_repr"
+path = "tests/test_repr.rs"
+
+[[test]]
+name = "test_source"
+path = "tests/test_source.rs"
+
[dependencies.backtrace]
version = "0.3.51"
optional = true
@@ -56,12 +120,8 @@
features = ["full"]
[dev-dependencies.thiserror]
-version = "1.0.45"
+version = "2"
[dev-dependencies.trybuild]
version = "1.0.66"
features = ["diff"]
-
-[features]
-default = ["std"]
-std = []
diff --git a/crates/anyhow/METADATA b/crates/anyhow/METADATA
index 3600ae8..164ed5c 100644
--- a/crates/anyhow/METADATA
+++ b/crates/anyhow/METADATA
@@ -1,17 +1,17 @@
name: "anyhow"
description: "Flexible concrete Error type built on std::error::Error"
third_party {
- version: "1.0.79"
+ version: "1.0.95"
license_type: NOTICE
last_upgrade_date {
- year: 2024
+ year: 2025
month: 1
- day: 31
+ day: 15
}
homepage: "https://crates.io/crates/anyhow"
identifier {
type: "Archive"
- value: "https://static.crates.io/crates/anyhow/anyhow-1.0.79.crate"
- version: "1.0.79"
+ value: "https://static.crates.io/crates/anyhow/anyhow-1.0.95.crate"
+ version: "1.0.95"
}
}
diff --git a/crates/anyhow/README.md b/crates/anyhow/README.md
index ccf3097..ff83168 100644
--- a/crates/anyhow/README.md
+++ b/crates/anyhow/README.md
@@ -26,7 +26,7 @@
return type of any fallible function.
Within the function, use `?` to easily propagate any error that implements the
- `std::error::Error` trait.
+ [`std::error::Error`] trait.
```rust
use anyhow::Result;
@@ -38,6 +38,8 @@
}
```
+ [`std::error::Error`]: https://doc.rust-lang.org/std/error/trait.Error.html
+
- Attach context to help the person troubleshooting the error understand where
things went wrong. A low-level error like "No such file or directory" can be
annoying to debug without more context about what higher level step the
@@ -125,8 +127,8 @@
## No-std support
-In no_std mode, the same API is almost all available and works the same way. To
-depend on Anyhow in no_std mode, disable our default enabled "std" feature in
+In no_std mode, almost all of the same API is available and works the same way.
+To depend on Anyhow in no_std mode, disable our default enabled "std" feature in
Cargo.toml. A global allocator is required.
```toml
@@ -134,10 +136,10 @@
anyhow = { version = "1.0", default-features = false }
```
-Since the `?`-based error conversions would normally rely on the
-`std::error::Error` trait which is only available through std, no_std mode will
-require an explicit `.map_err(Error::msg)` when working with a non-Anyhow error
-type inside a function that returns Anyhow's error type.
+With versions of Rust older than 1.81, no_std mode may require an additional
+`.map_err(Error::msg)` when working with a non-Anyhow error type inside a
+function that returns Anyhow's error type, as the trait that `?`-based error
+conversions are defined by is only available in std in those old versions.
<br>
diff --git a/crates/anyhow/build.rs b/crates/anyhow/build.rs
index 7e95e6b..8124690 100644
--- a/crates/anyhow/build.rs
+++ b/crates/anyhow/build.rs
@@ -1,5 +1,8 @@
use std::env;
use std::ffi::OsString;
+use std::fs;
+use std::io::ErrorKind;
+use std::iter;
use std::path::Path;
use std::process::{self, Command, Stdio};
use std::str;
@@ -64,6 +67,17 @@
None => return,
};
+ if rustc >= 80 {
+ println!("cargo:rustc-check-cfg=cfg(anyhow_nightly_testing)");
+ println!("cargo:rustc-check-cfg=cfg(anyhow_no_core_error)");
+ println!("cargo:rustc-check-cfg=cfg(anyhow_no_core_unwind_safe)");
+ println!("cargo:rustc-check-cfg=cfg(anyhow_no_fmt_arguments_as_str)");
+ println!("cargo:rustc-check-cfg=cfg(anyhow_no_ptr_addr_of)");
+ println!("cargo:rustc-check-cfg=cfg(anyhow_no_unsafe_op_in_unsafe_fn_lint)");
+ println!("cargo:rustc-check-cfg=cfg(error_generic_member_access)");
+ println!("cargo:rustc-check-cfg=cfg(std_backtrace)");
+ }
+
if rustc < 51 {
// core::ptr::addr_of
// https://blog.rust-lang.org/2021/03/25/Rust-1.51.0.html#stabilized-apis
@@ -80,11 +94,23 @@
println!("cargo:rustc-cfg=anyhow_no_unsafe_op_in_unsafe_fn_lint");
}
+ if rustc < 56 {
+ // core::panic::{UnwindSafe, RefUnwindSafe}
+ // https://blog.rust-lang.org/2021/10/21/Rust-1.56.0.html#stabilized-apis
+ println!("cargo:rustc-cfg=anyhow_no_core_unwind_safe");
+ }
+
if !error_generic_member_access && cfg!(feature = "std") && rustc >= 65 {
// std::backtrace::Backtrace
// https://blog.rust-lang.org/2022/11/03/Rust-1.65.0.html#stabilized-apis
println!("cargo:rustc-cfg=std_backtrace");
}
+
+ if rustc < 81 {
+ // core::error::Error
+ // https://blog.rust-lang.org/2024/09/05/Rust-1.81.0.html#coreerrorerror
+ println!("cargo:rustc-cfg=anyhow_no_core_error");
+ }
}
fn compile_probe(rustc_bootstrap: bool) -> bool {
@@ -101,17 +127,25 @@
let rustc = cargo_env_var("RUSTC");
let out_dir = cargo_env_var("OUT_DIR");
+ let out_subdir = Path::new(&out_dir).join("probe");
let probefile = Path::new("build").join("probe.rs");
- // Make sure to pick up Cargo rustc configuration.
- let mut cmd = if let Some(wrapper) = env::var_os("RUSTC_WRAPPER") {
- let mut cmd = Command::new(wrapper);
- // The wrapper's first argument is supposed to be the path to rustc.
- cmd.arg(rustc);
- cmd
- } else {
- Command::new(rustc)
- };
+ if let Err(err) = fs::create_dir(&out_subdir) {
+ if err.kind() != ErrorKind::AlreadyExists {
+ eprintln!("Failed to create {}: {}", out_subdir.display(), err);
+ process::exit(1);
+ }
+ }
+
+ let rustc_wrapper = env::var_os("RUSTC_WRAPPER").filter(|wrapper| !wrapper.is_empty());
+ let rustc_workspace_wrapper =
+ env::var_os("RUSTC_WORKSPACE_WRAPPER").filter(|wrapper| !wrapper.is_empty());
+ let mut rustc = rustc_wrapper
+ .into_iter()
+ .chain(rustc_workspace_wrapper)
+ .chain(iter::once(rustc));
+ let mut cmd = Command::new(rustc.next().unwrap());
+ cmd.args(rustc);
if !rustc_bootstrap {
cmd.env_remove("RUSTC_BOOTSTRAP");
@@ -122,8 +156,9 @@
.arg("--crate-name=anyhow")
.arg("--crate-type=lib")
.arg("--emit=dep-info,metadata")
+ .arg("--cap-lints=allow")
.arg("--out-dir")
- .arg(out_dir)
+ .arg(&out_subdir)
.arg(probefile);
if let Some(target) = env::var_os("TARGET") {
@@ -139,10 +174,22 @@
}
}
- match cmd.status() {
+ let success = match cmd.status() {
Ok(status) => status.success(),
Err(_) => false,
+ };
+
+ // Clean up to avoid leaving nondeterministic absolute paths in the dep-info
+ // file in OUT_DIR, which causes nonreproducible builds in build systems
+ // that treat the entire OUT_DIR as an artifact.
+ if let Err(err) = fs::remove_dir_all(&out_subdir) {
+ if err.kind() != ErrorKind::NotFound {
+ eprintln!("Failed to clean up {}: {}", out_subdir.display(), err);
+ process::exit(1);
+ }
}
+
+ success
}
fn rustc_minor_version() -> Option<u32> {
diff --git a/crates/anyhow/build/probe.rs b/crates/anyhow/build/probe.rs
index 21e776d..742d15c 100644
--- a/crates/anyhow/build/probe.rs
+++ b/crates/anyhow/build/probe.rs
@@ -4,9 +4,9 @@
#![feature(error_generic_member_access)]
+use core::error::{self, Error, Request};
+use core::fmt::{self, Debug, Display};
use std::backtrace::Backtrace;
-use std::error::{self, Error, Request};
-use std::fmt::{self, Debug, Display};
struct MyError(Thing);
struct Thing;
diff --git a/crates/anyhow/patches/0001-Support-RUST_BACKTRACE-settings-in-test_fmt.patch b/crates/anyhow/patches/0001-Support-RUST_BACKTRACE-settings-in-test_fmt.patch
index 55087e6..e453046 100644
--- a/crates/anyhow/patches/0001-Support-RUST_BACKTRACE-settings-in-test_fmt.patch
+++ b/crates/anyhow/patches/0001-Support-RUST_BACKTRACE-settings-in-test_fmt.patch
@@ -21,14 +21,14 @@
index 9766d366..016b4b8c 100644
--- b/tests/test_fmt.rs
+++ a/tests/test_fmt.rs
-@@ -68,27 +68,27 @@ Error {
-
+@@ -68,26 +68,26 @@
+
#[test]
fn test_display() {
- assert_eq!("g failed", h().unwrap_err().to_string());
+ assert!(h().unwrap_err().to_string().starts_with("g failed"));
}
-
+
#[test]
fn test_altdisplay() {
- assert_eq!(EXPECTED_ALTDISPLAY_F, format!("{:#}", f().unwrap_err()));
@@ -38,9 +38,8 @@
+ assert!(format!("{:#}", g().unwrap_err()).starts_with(EXPECTED_ALTDISPLAY_G));
+ assert!(format!("{:#}", h().unwrap_err()).starts_with(EXPECTED_ALTDISPLAY_H));
}
-
+
#[test]
- #[cfg_attr(not(std_backtrace), ignore)]
fn test_debug() {
- assert_eq!(EXPECTED_DEBUG_F, format!("{:?}", f().unwrap_err()));
- assert_eq!(EXPECTED_DEBUG_G, format!("{:?}", g().unwrap_err()));
@@ -49,7 +48,7 @@
+ assert!(format!("{:?}", g().unwrap_err()).starts_with(EXPECTED_DEBUG_G));
+ assert!(format!("{:?}", h().unwrap_err()).starts_with(EXPECTED_DEBUG_H));
}
-
+
#[test]
fn test_altdebug() {
- assert_eq!(EXPECTED_ALTDEBUG_F, format!("{:#?}", f().unwrap_err()));
diff --git a/crates/anyhow/src/backtrace.rs b/crates/anyhow/src/backtrace.rs
index 65ad1cc..303f911 100644
--- a/crates/anyhow/src/backtrace.rs
+++ b/crates/anyhow/src/backtrace.rs
@@ -38,7 +38,8 @@
#[cfg(error_generic_member_access)]
macro_rules! backtrace_if_absent {
($err:expr) => {
- match std::error::request_ref::<std::backtrace::Backtrace>($err as &dyn std::error::Error) {
+ match core::error::request_ref::<std::backtrace::Backtrace>($err as &dyn core::error::Error)
+ {
Some(_) => None,
None => backtrace!(),
}
@@ -46,7 +47,7 @@
}
#[cfg(all(
- feature = "std",
+ any(feature = "std", not(anyhow_no_core_error)),
not(error_generic_member_access),
any(std_backtrace, feature = "backtrace")
))]
@@ -56,7 +57,11 @@
};
}
-#[cfg(all(feature = "std", not(std_backtrace), not(feature = "backtrace")))]
+#[cfg(all(
+ any(feature = "std", not(anyhow_no_core_error)),
+ not(std_backtrace),
+ not(feature = "backtrace"),
+))]
macro_rules! backtrace_if_absent {
($err:expr) => {
None
@@ -65,11 +70,12 @@
#[cfg(all(not(std_backtrace), feature = "backtrace"))]
mod capture {
+ use alloc::borrow::{Cow, ToOwned as _};
+ use alloc::vec::Vec;
use backtrace::{BacktraceFmt, BytesOrWideString, Frame, PrintFmt, SymbolName};
use core::cell::UnsafeCell;
use core::fmt::{self, Debug, Display};
use core::sync::atomic::{AtomicUsize, Ordering};
- use std::borrow::Cow;
use std::env;
use std::path::{self, Path, PathBuf};
use std::sync::Once;
@@ -400,6 +406,6 @@
}
fn _assert_send_sync() {
- fn _assert<T: Send + Sync>() {}
- _assert::<Backtrace>();
+ fn assert<T: Send + Sync>() {}
+ assert::<Backtrace>();
}
diff --git a/crates/anyhow/src/chain.rs b/crates/anyhow/src/chain.rs
index f7baff2..e56bc66 100644
--- a/crates/anyhow/src/chain.rs
+++ b/crates/anyhow/src/chain.rs
@@ -1,13 +1,13 @@
use self::ChainState::*;
use crate::StdError;
-#[cfg(feature = "std")]
-use std::vec;
+#[cfg(any(feature = "std", not(anyhow_no_core_error)))]
+use alloc::vec::{self, Vec};
-#[cfg(feature = "std")]
+#[cfg(any(feature = "std", not(anyhow_no_core_error)))]
pub(crate) use crate::Chain;
-#[cfg(not(feature = "std"))]
+#[cfg(all(not(feature = "std"), anyhow_no_core_error))]
pub(crate) struct Chain<'a> {
state: ChainState<'a>,
}
@@ -17,7 +17,7 @@
Linked {
next: Option<&'a (dyn StdError + 'static)>,
},
- #[cfg(feature = "std")]
+ #[cfg(any(feature = "std", not(anyhow_no_core_error)))]
Buffered {
rest: vec::IntoIter<&'a (dyn StdError + 'static)>,
},
@@ -42,7 +42,7 @@
*next = error.source();
Some(error)
}
- #[cfg(feature = "std")]
+ #[cfg(any(feature = "std", not(anyhow_no_core_error)))]
Buffered { rest } => rest.next(),
}
}
@@ -53,7 +53,7 @@
}
}
-#[cfg(feature = "std")]
+#[cfg(any(feature = "std", not(anyhow_no_core_error)))]
impl DoubleEndedIterator for Chain<'_> {
fn next_back(&mut self) -> Option<Self::Item> {
match &mut self.state {
@@ -84,13 +84,13 @@
}
len
}
- #[cfg(feature = "std")]
+ #[cfg(any(feature = "std", not(anyhow_no_core_error)))]
Buffered { rest } => rest.len(),
}
}
}
-#[cfg(feature = "std")]
+#[cfg(any(feature = "std", not(anyhow_no_core_error)))]
impl Default for Chain<'_> {
fn default() -> Self {
Chain {
diff --git a/crates/anyhow/src/context.rs b/crates/anyhow/src/context.rs
index 11b31ba..326c2a4 100644
--- a/crates/anyhow/src/context.rs
+++ b/crates/anyhow/src/context.rs
@@ -4,7 +4,7 @@
use core::fmt::{self, Debug, Display, Write};
#[cfg(error_generic_member_access)]
-use std::error::Request;
+use core::error::Request;
mod ext {
use super::*;
@@ -15,17 +15,17 @@
C: Display + Send + Sync + 'static;
}
- #[cfg(feature = "std")]
+ #[cfg(any(feature = "std", not(anyhow_no_core_error)))]
impl<E> StdError for E
where
- E: std::error::Error + Send + Sync + 'static,
+ E: crate::StdError + Send + Sync + 'static,
{
fn ext_context<C>(self, context: C) -> Error
where
C: Display + Send + Sync + 'static,
{
let backtrace = backtrace_if_absent!(&self);
- Error::from_context(context, self, backtrace)
+ Error::construct_from_context(context, self, backtrace)
}
}
@@ -96,7 +96,7 @@
// backtrace.
match self {
Some(ok) => Ok(ok),
- None => Err(Error::from_display(context, backtrace!())),
+ None => Err(Error::construct_from_display(context, backtrace!())),
}
}
@@ -107,7 +107,7 @@
{
match self {
Some(ok) => Ok(ok),
- None => Err(Error::from_display(context(), backtrace!())),
+ None => Err(Error::construct_from_display(context(), backtrace!())),
}
}
}
diff --git a/crates/anyhow/src/ensure.rs b/crates/anyhow/src/ensure.rs
index c40cb92..795757d 100644
--- a/crates/anyhow/src/ensure.rs
+++ b/crates/anyhow/src/ensure.rs
@@ -147,14 +147,22 @@
$crate::__parse_ensure!(pat $stack $bail ($($fuel)*) {($($buf)* $let) $($parse)*} ($($rest)*) $($rest)*)
};
- (0 $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($life:tt $colon:tt $($dup:tt)*) $label:lifetime : $($rest:tt)*) => {
- $crate::__parse_ensure!(0 $stack $bail ($($fuel)*) {($($buf)* $life $colon) $($parse)*} ($($rest)*) $($rest)*)
+ (0 $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($lifetime:tt $colon:tt $($dup:tt)*) $label:lifetime : $($rest:tt)*) => {
+ $crate::__parse_ensure!(0 $stack $bail ($($fuel)*) {($($buf)* $lifetime $colon) $($parse)*} ($($rest)*) $($rest)*)
};
(0 $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($and:tt $mut:tt $($dup:tt)*) &mut $($rest:tt)*) => {
$crate::__parse_ensure!(0 $stack $bail ($($fuel)*) {($($buf)* $and $mut) $($parse)*} ($($rest)*) $($rest)*)
};
+ (0 $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($and:tt $raw:tt $mut:tt $($dup:tt)*) &raw mut $($rest:tt)*) => {
+ $crate::__parse_ensure!(0 $stack $bail ($($fuel)*) {($($buf)* $and $raw $mut) $($parse)*} ($($rest)*) $($rest)*)
+ };
+
+ (0 $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($and:tt $raw:tt $const:tt $($dup:tt)*) &raw const $($rest:tt)*) => {
+ $crate::__parse_ensure!(0 $stack $bail ($($fuel)*) {($($buf)* $and $raw $const) $($parse)*} ($($rest)*) $($rest)*)
+ };
+
(0 $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($and:tt $($dup:tt)*) & $($rest:tt)*) => {
$crate::__parse_ensure!(0 $stack $bail ($($fuel)*) {($($buf)* $and) $($parse)*} ($($rest)*) $($rest)*)
};
@@ -163,6 +171,14 @@
$crate::__parse_ensure!(0 $stack $bail ($($fuel)*) {($($buf)* $andand $mut) $($parse)*} ($($rest)*) $($rest)*)
};
+ (0 $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($andand:tt $raw:tt $mut:tt $($dup:tt)*) &&raw mut $($rest:tt)*) => {
+ $crate::__parse_ensure!(0 $stack $bail ($($fuel)*) {($($buf)* $andand $raw $mut) $($parse)*} ($($rest)*) $($rest)*)
+ };
+
+ (0 $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($andand:tt $raw:tt $const:tt $($dup:tt)*) &&raw const $($rest:tt)*) => {
+ $crate::__parse_ensure!(0 $stack $bail ($($fuel)*) {($($buf)* $andand $raw $const) $($parse)*} ($($rest)*) $($rest)*)
+ };
+
(0 $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($andand:tt $($dup:tt)*) && $($rest:tt)*) => {
$crate::__parse_ensure!(0 $stack $bail ($($fuel)*) {($($buf)* $andand) $($parse)*} ($($rest)*) $($rest)*)
};
@@ -236,17 +252,17 @@
$crate::__parse_ensure!(atom $stack $bail ($($fuel)*) {($($buf)* $const $block) $($parse)*} ($($rest)*) $($rest)*)
};
- (0 $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} $dup:tt $lit:literal $($rest:tt)*) => {
- $crate::__parse_ensure!(atom $stack $bail ($($fuel)*) {($($buf)* $lit) $($parse)*} ($($rest)*) $($rest)*)
+ (0 $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($literal:tt $($dup:tt)*) $lit:literal $($rest:tt)*) => {
+ $crate::__parse_ensure!(atom $stack $bail ($($fuel)*) {($($buf)* $literal) $($parse)*} ($($rest)*) $($rest)*)
};
// path expressions
- (0 $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($colons:tt $($dup:tt)*) :: $ident:ident $($rest:tt)*) => {
+ (0 $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($colons:tt $ident:tt $($dup:tt)*) :: $i:ident $($rest:tt)*) => {
$crate::__parse_ensure!(epath (atom $stack) $bail ($($fuel)*) {($($buf)* $colons $ident) $($parse)*} ($($rest)*) $($rest)*)
};
- (0 $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} $dup:tt $ident:ident $($rest:tt)*) => {
+ (0 $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($ident:tt $($dup:tt)*) $i:ident $($rest:tt)*) => {
$crate::__parse_ensure!(epath (atom $stack) $bail ($($fuel)*) {($($buf)* $ident) $($parse)*} ($($rest)*) $($rest)*)
};
@@ -258,15 +274,19 @@
$crate::__parse_ensure!(generic (epath $stack) $bail ($($fuel)*) {($($buf)* $colons $langle) $($parse)*} ($($rest)*) $($rest)*)
};
- (epath $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($colons:tt $($dup:tt)*) :: << $($rest:tt)*) => {
- $crate::__parse_ensure!(generic (epath $stack) $bail ($($fuel)*) {($($buf)* $colons <) $($parse)*} (< $($rest)*) < $($rest)*)
+ (epath $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($colons:tt $langle:tt $($dup:tt)*) :: << $($rest:tt)*) => {
+ $crate::__parse_ensure!(type (qpath (tpath (arglist (epath $stack)))) $bail ($($fuel)*) {($($buf)* $colons $langle) $($parse)*} ($($rest)*) $($rest)*)
};
- (epath $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($colons:tt $($dup:tt)*) :: <- $($rest:tt)*) => {
- $crate::__parse_ensure!(generic (epath $stack) $bail ($($fuel)*) {($($buf)* $colons <) $($parse)*} (- $($rest)*) - $($rest)*)
+ (epath $stack:tt ($($bail:tt)*) (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} $dup:tt :: <- - $($rest:tt)*) => {
+ $crate::__fallback_ensure!($($bail)*)
};
- (epath $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($colons:tt $($dup:tt)*) :: $ident:ident $($rest:tt)*) => {
+ (epath $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($colons:tt $larrow:tt $($dup:tt)*) :: <- $lit:literal $($rest:tt)*) => {
+ $crate::__parse_ensure!(generic (epath $stack) $bail ($($fuel)*) {($($buf)* $colons $larrow) $($parse)*} ($($dup)*) $($dup)*)
+ };
+
+ (epath $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($colons:tt $ident:tt $($dup:tt)*) :: $i:ident $($rest:tt)*) => {
$crate::__parse_ensure!(epath $stack $bail ($($fuel)*) {($($buf)* $colons $ident) $($parse)*} ($($rest)*) $($rest)*)
};
@@ -282,6 +302,10 @@
$crate::__parse_ensure!($pop $stack $bail ($($fuel)*) {($($buf)* $bang $args) $($parse)*} ($($rest)*) $($rest)*)
};
+ (epath (split ($pop:ident $stack:tt)) $bail:tt (~$($fuel:tt)*) $parse:tt $dup:tt $($rest:tt)*) => {
+ $crate::__parse_ensure!($pop (split $stack) $bail ($($fuel)*) $parse $dup $($rest)*)
+ };
+
(epath ($pop:ident $stack:tt) $bail:tt (~$($fuel:tt)*) $parse:tt $dup:tt $($rest:tt)*) => {
$crate::__parse_ensure!($pop $stack $bail ($($fuel)*) $parse $dup $($rest)*)
};
@@ -308,18 +332,26 @@
$crate::__parse_ensure!(generic (atom $stack) $bail ($($fuel)*) {($($buf)* $dot $ident $colons $langle) $($parse)*} ($($rest)*) $($rest)*)
};
- (atom $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($dot:tt $ident:tt $colons:tt $($dup:tt)*) . $i:ident :: << $($rest:tt)*) => {
- $crate::__parse_ensure!(generic (atom $stack) $bail ($($fuel)*) {($($buf)* $dot $ident $colons <) $($parse)*} (< $($rest)*) < $($rest)*)
+ (atom $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($dot:tt $ident:tt $colons:tt $langle:tt $($dup:tt)*) . $i:ident :: << $($rest:tt)*) => {
+ $crate::__parse_ensure!(type (qpath (tpath (arglist (atom $stack)))) $bail ($($fuel)*) {($($buf)* $dot $ident $colons $langle) $($parse)*} ($($rest)*) $($rest)*)
};
- (atom $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($dot:tt $ident:tt $colons:tt $($dup:tt)*) . $i:ident :: <- $($rest:tt)*) => {
- $crate::__parse_ensure!(generic (atom $stack) $bail ($($fuel)*) {($($buf)* $dot $ident $colons <) $($parse)*} (- $($rest)*) - $($rest)*)
+ (atom $stack:tt ($($bail:tt)*) (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} $dup:tt . $i:ident :: <- - $($rest:tt)*) => {
+ $crate::__fallback_ensure!($($bail)*)
};
- (atom $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($dot:tt $($dup:tt)*) . $field:ident $($rest:tt)*) => {
+ (atom $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($dot:tt $ident:tt $colons:tt $larrow:tt $($dup:tt)*) . $i:ident :: <- $lit:literal $($rest:tt)*) => {
+ $crate::__parse_ensure!(generic (atom $stack) $bail ($($fuel)*) {($($buf)* $dot $ident $colons $larrow) $($parse)*} ($($dup)*) $($dup)*)
+ };
+
+ (atom $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($dot:tt $field:tt $($dup:tt)*) . $i:ident $($rest:tt)*) => {
$crate::__parse_ensure!(atom $stack $bail ($($fuel)*) {($($buf)* $dot $field) $($parse)*} ($($rest)*) $($rest)*)
};
+ (atom $stack:tt ($($bail:tt)*) (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} $dup:tt . - $($rest:tt)*) => {
+ $crate::__fallback_ensure!($($bail)*)
+ };
+
(atom $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($dot:tt $index:tt $($dup:tt)*) . $lit:literal $($rest:tt)*) => {
$crate::__parse_ensure!(atom $stack $bail ($($fuel)*) {($($buf)* $dot $index) $($parse)*} ($($rest)*) $($rest)*)
};
@@ -346,43 +378,51 @@
$crate::__parse_ensure!(type $stack $bail ($($fuel)*) {($($buf)* $star $mut) $($parse)*} ($($rest)*) $($rest)*)
};
- (type $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($and:tt $life:lifetime $mut:tt $($dup:tt)*) & $l:lifetime mut $($rest:tt)*) => {
- $crate::__parse_ensure!(type $stack $bail ($($fuel)*) {($($buf)* $and $life $mut) $($parse)*} ($($rest)*) $($rest)*)
+ (type $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($and:tt $lifetime:tt $mut:tt $($dup:tt)*) & $l:lifetime mut $($rest:tt)*) => {
+ $crate::__parse_ensure!(type $stack $bail ($($fuel)*) {($($buf)* $and $lifetime $mut) $($parse)*} ($($rest)*) $($rest)*)
};
(type $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($and:tt $mut:tt $($dup:tt)*) & mut $($rest:tt)*) => {
$crate::__parse_ensure!(type $stack $bail ($($fuel)*) {($($buf)* $and $mut) $($parse)*} ($($rest)*) $($rest)*)
};
- (type $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($and:tt $life:lifetime $($dup:tt)*) & $l:lifetime $($rest:tt)*) => {
- $crate::__parse_ensure!(type $stack $bail ($($fuel)*) {($($buf)* $and $life) $($parse)*} ($($rest)*) $($rest)*)
+ (type $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($and:tt $lifetime:tt $($dup:tt)*) & $l:lifetime $($rest:tt)*) => {
+ $crate::__parse_ensure!(type $stack $bail ($($fuel)*) {($($buf)* $and $lifetime) $($parse)*} ($($rest)*) $($rest)*)
};
(type $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($and:tt $($dup:tt)*) & $($rest:tt)*) => {
$crate::__parse_ensure!(type $stack $bail ($($fuel)*) {($($buf)* $and) $($parse)*} ($($rest)*) $($rest)*)
};
- (type $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($and:tt $life:lifetime $mut:tt $($dup:tt)*) && $l:lifetime mut $($rest:tt)*) => {
- $crate::__parse_ensure!(type $stack $bail ($($fuel)*) {($($buf)* $and $life $mut) $($parse)*} ($($rest)*) $($rest)*)
+ (type $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($and:tt $lifetime:tt $mut:tt $($dup:tt)*) && $l:lifetime mut $($rest:tt)*) => {
+ $crate::__parse_ensure!(type $stack $bail ($($fuel)*) {($($buf)* $and $lifetime $mut) $($parse)*} ($($rest)*) $($rest)*)
};
(type $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($and:tt $mut:tt $($dup:tt)*) && mut $($rest:tt)*) => {
$crate::__parse_ensure!(type $stack $bail ($($fuel)*) {($($buf)* $and $mut) $($parse)*} ($($rest)*) $($rest)*)
};
- (type $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($and:tt $life:lifetime $($dup:tt)*) && $l:lifetime $($rest:tt)*) => {
- $crate::__parse_ensure!(type $stack $bail ($($fuel)*) {($($buf)* $and $life) $($parse)*} ($($rest)*) $($rest)*)
+ (type $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($and:tt $lifetime:tt $($dup:tt)*) && $l:lifetime $($rest:tt)*) => {
+ $crate::__parse_ensure!(type $stack $bail ($($fuel)*) {($($buf)* $and $lifetime) $($parse)*} ($($rest)*) $($rest)*)
};
(type $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($and:tt $($dup:tt)*) && $($rest:tt)*) => {
$crate::__parse_ensure!(type $stack $bail ($($fuel)*) {($($buf)* $and) $($parse)*} ($($rest)*) $($rest)*)
};
+ (type $stack:tt ($($bail:tt)*) (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} $dup:tt unsafe extern - $($rest:tt)*) => {
+ $crate::__fallback_ensure!($($bail)*)
+ };
+
(type $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($unsafe:tt $(extern $($abi:literal)?)? fn $($dup:tt)*) unsafe $($rest:tt)*) => {
$crate::__parse_ensure!(type $stack $bail ($($fuel)*) {($($buf)* $unsafe) $($parse)*} ($($rest)*) $($rest)*)
};
- (type $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($extern:tt $abi:literal fn $($dup:tt)*) extern $lit:literal $($rest:tt)*) => {
+ (type $stack:tt ($($bail:tt)*) (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} $dup:tt extern - $($rest:tt)*) => {
+ $crate::__fallback_ensure!($($bail)*)
+ };
+
+ (type $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($extern:tt $abi:tt fn $($dup:tt)*) extern $lit:literal $($rest:tt)*) => {
$crate::__parse_ensure!(type $stack $bail ($($fuel)*) {($($buf)* $extern $abi) $($parse)*} ($($rest)*) $($rest)*)
};
@@ -420,11 +460,11 @@
// path types
- (type $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($colons:tt $($dup:tt)*) :: $ident:ident $($rest:tt)*) => {
+ (type $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($colons:tt $ident:tt $($dup:tt)*) :: $i:ident $($rest:tt)*) => {
$crate::__parse_ensure!(tpath $stack $bail ($($fuel)*) {($($buf)* $colons $ident) $($parse)*} ($($rest)*) $($rest)*)
};
- (type $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} $dup:tt $ident:ident $($rest:tt)*) => {
+ (type $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($ident:tt $($dup:tt)*) $i:ident $($rest:tt)*) => {
$crate::__parse_ensure!(tpath $stack $bail ($($fuel)*) {($($buf)* $ident) $($parse)*} ($($rest)*) $($rest)*)
};
@@ -436,27 +476,35 @@
$crate::__parse_ensure!(generic (tpath $stack) $bail ($($fuel)*) {($($buf)* $langle) $($parse)*} ($($rest)*) $($rest)*)
};
- (tpath $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} $dup:tt << $($rest:tt)*) => {
- $crate::__parse_ensure!(generic (tpath $stack) $bail ($($fuel)*) {($($buf)* <) $($parse)*} (< $($rest)*) < $($rest)*)
+ (tpath $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($langle:tt $($dup:tt)*) << $($rest:tt)*) => {
+ $crate::__parse_ensure!(type (qpath (tpath (arglist (tpath $stack)))) $bail ($($fuel)*) {($($buf)* $langle) $($parse)*} ($($rest)*) $($rest)*)
};
- (tpath $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} $dup:tt <- $($rest:tt)*) => {
- $crate::__parse_ensure!(generic (tpath $stack) $bail ($($fuel)*) {($($buf)* <) $($parse)*} (- $($rest)*) - $($rest)*)
+ (tpath $stack:tt ($($bail:tt)*) (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} $dup:tt <- - $($rest:tt)*) => {
+ $crate::__fallback_ensure!($($bail)*)
+ };
+
+ (tpath $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($larrow:tt $($dup:tt)*) <- $lit:literal $($rest:tt)*) => {
+ $crate::__parse_ensure!(generic (tpath $stack) $bail ($($fuel)*) {($($buf)* $larrow) $($parse)*} ($($dup)*) $($dup)*)
};
(tpath $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($colons:tt $langle:tt $($dup:tt)*) :: < $($rest:tt)*) => {
$crate::__parse_ensure!(generic (tpath $stack) $bail ($($fuel)*) {($($buf)* $colons $langle) $($parse)*} ($($rest)*) $($rest)*)
};
- (tpath $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($colons:tt $($dup:tt)*) :: << $($rest:tt)*) => {
- $crate::__parse_ensure!(generic (tpath $stack) $bail ($($fuel)*) {($($buf)* $colons <) $($parse)*} (< $($rest)*) < $($rest)*)
+ (tpath $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($colons:tt $langle:tt $($dup:tt)*) :: << $($rest:tt)*) => {
+ $crate::__parse_ensure!(type (qpath (tpath (arglist (tpath $stack)))) $bail ($($fuel)*) {($($buf)* $colons $langle) $($parse)*} ($($rest)*) $($rest)*)
};
- (tpath $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($colons:tt $($dup:tt)*) :: <- $($rest:tt)*) => {
- $crate::__parse_ensure!(generic (tpath $stack) $bail ($($fuel)*) {($($buf)* $colons <) $($parse)*} (- $($rest)*) - $($rest)*)
+ (tpath $stack:tt ($($bail:tt)*) (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} $dup:tt :: <- - $($rest:tt)*) => {
+ $crate::__fallback_ensure!($($bail)*)
};
- (tpath $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($colons:tt $($dup:tt)*) :: $ident:ident $($rest:tt)*) => {
+ (tpath $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($colons:tt $larrow:tt $($dup:tt)*) :: <- $lit:literal $($rest:tt)*) => {
+ $crate::__parse_ensure!(generic (tpath $stack) $bail ($($fuel)*) {($($buf)* $colons $larrow) $($parse)*} ($($dup)*) $($dup)*)
+ };
+
+ (tpath $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($colons:tt $ident:tt $($dup:tt)*) :: $i:ident $($rest:tt)*) => {
$crate::__parse_ensure!(tpath $stack $bail ($($fuel)*) {($($buf)* $colons $ident) $($parse)*} ($($rest)*) $($rest)*)
};
@@ -494,7 +542,11 @@
// qualified paths
- (qpath ($pop:ident $stack:tt) $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($rangle:tt $colons:tt $($dup:tt)*) > :: $ident:ident $($rest:tt)*) => {
+ (qpath (split ($pop:ident $stack:tt)) $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($rangle:tt $colons:tt $ident:tt $($dup:tt)*) >> :: $i:ident $($rest:tt)*) => {
+ $crate::__parse_ensure!($pop $stack $bail ($($fuel)*) {($($buf)* $rangle $colons $ident) $($parse)*} ($($rest)*) $($rest)*)
+ };
+
+ (qpath ($pop:ident $stack:tt) $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($rangle:tt $colons:tt $ident:tt $($dup:tt)*) > :: $i:ident $($rest:tt)*) => {
$crate::__parse_ensure!($pop $stack $bail ($($fuel)*) {($($buf)* $rangle $colons $ident) $($parse)*} ($($rest)*) $($rest)*)
};
@@ -504,41 +556,61 @@
// trait objects
- (object (arglist $stack:tt) $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($plus:tt $colons:tt $($dup:tt)*) + :: $ident:ident $($rest:tt)*) => {
+ (object (arglist $stack:tt) $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($plus:tt $colons:tt $ident:tt $($dup:tt)*) + :: $i:ident $($rest:tt)*) => {
$crate::__parse_ensure!(tpath (arglist $stack) $bail ($($fuel)*) {($($buf)* $plus $colons $ident) $($parse)*} ($($rest)*) $($rest)*)
};
- (object (arglist $stack:tt) $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($plus:tt $($dup:tt)*) + $ident:ident $($rest:tt)*) => {
+ (object (arglist $stack:tt) $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($plus:tt $ident:tt $($dup:tt)*) + $i:ident $($rest:tt)*) => {
$crate::__parse_ensure!(tpath (arglist $stack) $bail ($($fuel)*) {($($buf)* $plus $ident) $($parse)*} ($($rest)*) $($rest)*)
};
+ (object (split ($pop:ident $stack:tt)) $bail:tt (~$($fuel:tt)*) $parse:tt $dup:tt $($rest:tt)*) => {
+ $crate::__parse_ensure!($pop (split $stack) $bail ($($fuel)*) $parse $dup $($rest)*)
+ };
+
(object ($pop:ident $stack:tt) $bail:tt (~$($fuel:tt)*) $parse:tt $dup:tt $($rest:tt)*) => {
$crate::__parse_ensure!($pop $stack $bail ($($fuel)*) $parse $dup $($rest)*)
};
// angle bracketed generic arguments
+ (generic (split ($pop:ident $stack:tt)) $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($rangle:tt $($dup:tt)*) >> $($rest:tt)*) => {
+ $crate::__parse_ensure!($pop $stack $bail ($($fuel)*) {($($buf)* $rangle) $($parse)*} ($($rest)*) $($rest)*)
+ };
+
(generic ($pop:ident $stack:tt) $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($rangle:tt $($dup:tt)*) > $($rest:tt)*) => {
$crate::__parse_ensure!($pop $stack $bail ($($fuel)*) {($($buf)* $rangle) $($parse)*} ($($rest)*) $($rest)*)
};
- (generic ($pop:ident $stack:tt) $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} $dup:tt >> $($rest:tt)*) => {
- $crate::__parse_ensure!($pop $stack $bail ($($fuel)*) {($($buf)* >) $($parse)*} (> $($rest)*) > $($rest)*)
+ (generic ($pop:ident $stack:tt) $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($rangle:tt $($dup:tt)*) >> $($rest:tt)*) => {
+ $crate::__parse_ensure!($pop (split $stack) $bail ($($fuel)*) {($($buf)*) $($parse)*} ($rangle $($rest)*) $rangle $($rest)*)
};
- (generic $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} $dup:tt $lit:literal $($rest:tt)*) => {
- $crate::__parse_ensure!(arglist $stack $bail ($($fuel)*) {($($buf)* $lit) $($parse)*} ($($rest)*) $($rest)*)
+ (generic $stack:tt ($($bail:tt)*) (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} $dup:tt - - $($rest:tt)*) => {
+ $crate::__fallback_ensure!($($bail)*)
+ };
+
+ (generic $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($neg:tt $($dup:tt)*) - $lit:literal $($rest:tt)*) => {
+ $crate::__parse_ensure!(generic $stack $bail ($($fuel)*) {($($buf)* $neg) $($parse)*} ($($dup)*) $($dup)*)
+ };
+
+ (generic $stack:tt ($($bail:tt)*) (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} $dup:tt - $($rest:tt)*) => {
+ $crate::__fallback_ensure!($($bail)*)
+ };
+
+ (generic $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($literal:tt $($dup:tt)*) $lit:literal $($rest:tt)*) => {
+ $crate::__parse_ensure!(arglist $stack $bail ($($fuel)*) {($($buf)* $literal) $($parse)*} ($($rest)*) $($rest)*)
};
(generic $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($brace:tt $($dup:tt)*) {$($block:tt)*} $($rest:tt)*) => {
$crate::__parse_ensure!(arglist $stack $bail ($($fuel)*) {($($buf)* $brace) $($parse)*} ($($rest)*) $($rest)*)
};
- (generic $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} $dup:tt $life:lifetime $($rest:tt)*) => {
- $crate::__parse_ensure!(arglist $stack $bail ($($fuel)*) {($($buf)* $life) $($parse)*} ($($rest)*) $($rest)*)
+ (generic $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($lifetime:tt $($dup:tt)*) $l:lifetime $($rest:tt)*) => {
+ $crate::__parse_ensure!(arglist $stack $bail ($($fuel)*) {($($buf)* $lifetime) $($parse)*} ($($rest)*) $($rest)*)
};
- (generic $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($assoc:ident $eq:tt $($dup:tt)*) $ident:ident = $($rest:tt)*) => {
+ (generic $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($assoc:tt $eq:tt $($dup:tt)*) $ident:ident = $($rest:tt)*) => {
$crate::__parse_ensure!(type (arglist $stack) $bail ($($fuel)*) {($($buf)* $assoc $eq) $($parse)*} ($($rest)*) $($rest)*)
};
@@ -550,12 +622,16 @@
$crate::__parse_ensure!(generic $stack $bail ($($fuel)*) {($($buf)* $comma) $($parse)*} ($($rest)*) $($rest)*)
};
+ (arglist (split ($pop:ident $stack:tt)) $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($rangle:tt $($dup:tt)*) >> $($rest:tt)*) => {
+ $crate::__parse_ensure!($pop $stack $bail ($($fuel)*) {($($buf)*) $rangle $($parse)*} ($($rest)*) $($rest)*)
+ };
+
(arglist ($pop:ident $stack:tt) $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($rangle:tt $($dup:tt)*) > $($rest:tt)*) => {
$crate::__parse_ensure!($pop $stack $bail ($($fuel)*) {($($buf)* $rangle) $($parse)*} ($($rest)*) $($rest)*)
};
- (arglist ($pop:ident $stack:tt) $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} $dup:tt >> $($rest:tt)*) => {
- $crate::__parse_ensure!($pop $stack $bail ($($fuel)*) {($($buf)* >) $($parse)*} (> $($rest)*) > $($rest)*)
+ (arglist ($pop:ident $stack:tt) $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($rangle:tt $($dup:tt)*) >> $($rest:tt)*) => {
+ $crate::__parse_ensure!($pop (split $stack) $bail ($($fuel)*) {($($buf)*) $($parse)*} ($rangle $($rest)*) $rangle $($rest)*)
};
// patterns
@@ -584,8 +660,20 @@
$crate::__parse_ensure!(pat $stack $bail ($($fuel)*) {($($buf)* $at) $($parse)*} ($($rest)*) $($rest)*)
};
- (pat $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} $dup:tt $lit:literal $($rest:tt)*) => {
- $crate::__parse_ensure!(pat $stack $bail ($($fuel)*) {($($buf)* $lit) $($parse)*} ($($rest)*) $($rest)*)
+ (pat $stack:tt ($($bail:tt)*) (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} $dup:tt - - $($rest:tt)*) => {
+ $crate::__fallback_ensure!($($bail)*)
+ };
+
+ (pat $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($neg:tt $($dup:tt)*) - $lit:literal $($rest:tt)*) => {
+ $crate::__parse_ensure!(pat $stack $bail ($($fuel)*) {($($buf)* $neg) $($parse)*} ($($dup)*) $($dup)*)
+ };
+
+ (pat $stack:tt ($($bail:tt)*) (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} $dup:tt - $($rest:tt)*) => {
+ $crate::__fallback_ensure!($($bail)*)
+ };
+
+ (pat $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($literal:tt $($dup:tt)*) $lit:literal $($rest:tt)*) => {
+ $crate::__parse_ensure!(pat $stack $bail ($($fuel)*) {($($buf)* $literal) $($parse)*} ($($rest)*) $($rest)*)
};
(pat $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($range:tt $($dup:tt)*) .. $($rest:tt)*) => {
@@ -620,11 +708,11 @@
$crate::__parse_ensure!(pat $stack $bail ($($fuel)*) {($($buf)* $wild) $($parse)*} ($($rest)*) $($rest)*)
};
- (pat $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($colons:tt $($dup:tt)*) :: $ident:ident $($rest:tt)*) => {
+ (pat $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($colons:tt $ident:tt $($dup:tt)*) :: $i:ident $($rest:tt)*) => {
$crate::__parse_ensure!(epath (pat $stack) $bail ($($fuel)*) {($($buf)* $colons $ident) $($parse)*} ($($rest)*) $($rest)*)
};
- (pat $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} $dup:tt $ident:ident $($rest:tt)*) => {
+ (pat $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($ident:tt $($dup:tt)*) $i:ident $($rest:tt)*) => {
$crate::__parse_ensure!(epath (pat $stack) $bail ($($fuel)*) {($($buf)* $ident) $($parse)*} ($($rest)*) $($rest)*)
};
@@ -632,48 +720,6 @@
$crate::__parse_ensure!(type (qpath (epath (pat $stack))) $bail ($($fuel)*) {($($buf)* $langle) $($parse)*} ($($rest)*) $($rest)*)
};
- // high precedence binary operators
-
- (atom $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($add:tt $($dup:tt)*) + $($rest:tt)*) => {
- $crate::__parse_ensure!(0 $stack $bail ($($fuel)*) {($($buf)* $add) $($parse)*} ($($rest)*) $($rest)*)
- };
-
- (atom $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($sub:tt $($dup:tt)*) - $($rest:tt)*) => {
- $crate::__parse_ensure!(0 $stack $bail ($($fuel)*) {($($buf)* $sub) $($parse)*} ($($rest)*) $($rest)*)
- };
-
- (atom $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($mul:tt $($dup:tt)*) * $($rest:tt)*) => {
- $crate::__parse_ensure!(0 $stack $bail ($($fuel)*) {($($buf)* $mul) $($parse)*} ($($rest)*) $($rest)*)
- };
-
- (atom $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($div:tt $($dup:tt)*) / $($rest:tt)*) => {
- $crate::__parse_ensure!(0 $stack $bail ($($fuel)*) {($($buf)* $div) $($parse)*} ($($rest)*) $($rest)*)
- };
-
- (atom $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($rem:tt $($dup:tt)*) % $($rest:tt)*) => {
- $crate::__parse_ensure!(0 $stack $bail ($($fuel)*) {($($buf)* $rem) $($parse)*} ($($rest)*) $($rest)*)
- };
-
- (atom $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($bitxor:tt $($dup:tt)*) ^ $($rest:tt)*) => {
- $crate::__parse_ensure!(0 $stack $bail ($($fuel)*) {($($buf)* $bitxor) $($parse)*} ($($rest)*) $($rest)*)
- };
-
- (atom $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($bitand:tt $($dup:tt)*) & $($rest:tt)*) => {
- $crate::__parse_ensure!(0 $stack $bail ($($fuel)*) {($($buf)* $bitand) $($parse)*} ($($rest)*) $($rest)*)
- };
-
- (atom $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($bitor:tt $($dup:tt)*) | $($rest:tt)*) => {
- $crate::__parse_ensure!(0 $stack $bail ($($fuel)*) {($($buf)* $bitor) $($parse)*} ($($rest)*) $($rest)*)
- };
-
- (atom $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($shl:tt $($dup:tt)*) << $($rest:tt)*) => {
- $crate::__parse_ensure!(0 $stack $bail ($($fuel)*) {($($buf)* $shl) $($parse)*} ($($rest)*) $($rest)*)
- };
-
- (atom $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($shr:tt $($dup:tt)*) >> $($rest:tt)*) => {
- $crate::__parse_ensure!(0 $stack $bail ($($fuel)*) {($($buf)* $shr) $($parse)*} ($($rest)*) $($rest)*)
- };
-
// comparison binary operators
(atom () $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($eq:tt $($dup:tt)*) == $($rest:tt)*) => {
@@ -716,14 +762,64 @@
$crate::__parse_ensure!(0 $stack $bail ($($fuel)*) {($($buf)* $ge) $($parse)*} ($($rest)*) $($rest)*)
};
+ (atom (split ()) $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} $dup:tt >> $($rest:tt)*) => {
+ $crate::__parse_ensure!(0 () $bail ($($fuel)*) {() $($parse)* ($($buf)* > ) > } ($($rest)*) $($rest)*)
+ };
+
(atom () $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($gt:tt $($dup:tt)*) > $($rest:tt)*) => {
$crate::__parse_ensure!(0 () $bail ($($fuel)*) {() $($parse)* ($($buf)*) $gt} ($($rest)*) $($rest)*)
};
+ (atom (split $stack:tt) $bail:tt (~$($fuel:tt)*) {($($buf:tt)+) $($parse:tt)*} ($rangle:tt $($dup:tt)*) >> $($rest:tt)*) => {
+ $crate::__parse_ensure!(0 $stack $bail ($($fuel)*) {($($buf)* $rangle) $($parse)*} ($($rest)*) $($rest)*)
+ };
+
(atom $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)+) $($parse:tt)*} ($gt:tt $($dup:tt)*) > $($rest:tt)*) => {
$crate::__parse_ensure!(0 $stack $bail ($($fuel)*) {($($buf)* $gt) $($parse)*} ($($rest)*) $($rest)*)
};
+ // high precedence binary operators
+
+ (atom $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($add:tt $($dup:tt)*) + $($rest:tt)*) => {
+ $crate::__parse_ensure!(0 $stack $bail ($($fuel)*) {($($buf)* $add) $($parse)*} ($($rest)*) $($rest)*)
+ };
+
+ (atom $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($sub:tt $($dup:tt)*) - $($rest:tt)*) => {
+ $crate::__parse_ensure!(0 $stack $bail ($($fuel)*) {($($buf)* $sub) $($parse)*} ($($rest)*) $($rest)*)
+ };
+
+ (atom $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($mul:tt $($dup:tt)*) * $($rest:tt)*) => {
+ $crate::__parse_ensure!(0 $stack $bail ($($fuel)*) {($($buf)* $mul) $($parse)*} ($($rest)*) $($rest)*)
+ };
+
+ (atom $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($div:tt $($dup:tt)*) / $($rest:tt)*) => {
+ $crate::__parse_ensure!(0 $stack $bail ($($fuel)*) {($($buf)* $div) $($parse)*} ($($rest)*) $($rest)*)
+ };
+
+ (atom $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($rem:tt $($dup:tt)*) % $($rest:tt)*) => {
+ $crate::__parse_ensure!(0 $stack $bail ($($fuel)*) {($($buf)* $rem) $($parse)*} ($($rest)*) $($rest)*)
+ };
+
+ (atom $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($bitxor:tt $($dup:tt)*) ^ $($rest:tt)*) => {
+ $crate::__parse_ensure!(0 $stack $bail ($($fuel)*) {($($buf)* $bitxor) $($parse)*} ($($rest)*) $($rest)*)
+ };
+
+ (atom $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($bitand:tt $($dup:tt)*) & $($rest:tt)*) => {
+ $crate::__parse_ensure!(0 $stack $bail ($($fuel)*) {($($buf)* $bitand) $($parse)*} ($($rest)*) $($rest)*)
+ };
+
+ (atom $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($bitor:tt $($dup:tt)*) | $($rest:tt)*) => {
+ $crate::__parse_ensure!(0 $stack $bail ($($fuel)*) {($($buf)* $bitor) $($parse)*} ($($rest)*) $($rest)*)
+ };
+
+ (atom $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($shl:tt $($dup:tt)*) << $($rest:tt)*) => {
+ $crate::__parse_ensure!(0 $stack $bail ($($fuel)*) {($($buf)* $shl) $($parse)*} ($($rest)*) $($rest)*)
+ };
+
+ (atom $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($shr:tt $($dup:tt)*) >> $($rest:tt)*) => {
+ $crate::__parse_ensure!(0 $stack $bail ($($fuel)*) {($($buf)* $shr) $($parse)*} ($($rest)*) $($rest)*)
+ };
+
// low precedence binary operators
(atom ($($stack:tt)+) $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($and:tt $($dup:tt)*) && $($rest:tt)*) => {
@@ -815,24 +911,24 @@
#[macro_export]
macro_rules! __fallback_ensure {
($cond:expr $(,)?) => {
- if !$cond {
+ if $crate::__private::not($cond) {
return $crate::__private::Err($crate::Error::msg(
$crate::__private::concat!("Condition failed: `", $crate::__private::stringify!($cond), "`")
));
}
};
($cond:expr, $msg:literal $(,)?) => {
- if !$cond {
+ if $crate::__private::not($cond) {
return $crate::__private::Err($crate::__anyhow!($msg));
}
};
($cond:expr, $err:expr $(,)?) => {
- if !$cond {
+ if $crate::__private::not($cond) {
return $crate::__private::Err($crate::__anyhow!($err));
}
};
($cond:expr, $fmt:expr, $($arg:tt)*) => {
- if !$cond {
+ if $crate::__private::not($cond) {
return $crate::__private::Err($crate::__anyhow!($fmt, $($arg)*));
}
};
diff --git a/crates/anyhow/src/error.rs b/crates/anyhow/src/error.rs
index f24c4a6..cd1f5f5 100644
--- a/crates/anyhow/src/error.rs
+++ b/crates/anyhow/src/error.rs
@@ -1,21 +1,24 @@
use crate::backtrace::Backtrace;
use crate::chain::Chain;
-#[cfg(any(feature = "std", anyhow_no_ptr_addr_of))]
+#[cfg(any(feature = "std", not(anyhow_no_core_error), anyhow_no_ptr_addr_of))]
use crate::ptr::Mut;
use crate::ptr::{Own, Ref};
use crate::{Error, StdError};
use alloc::boxed::Box;
use core::any::TypeId;
+#[cfg(error_generic_member_access)]
+use core::error::{self, Request};
use core::fmt::{self, Debug, Display};
use core::mem::ManuallyDrop;
+#[cfg(any(feature = "std", not(anyhow_no_core_error)))]
+use core::ops::{Deref, DerefMut};
+#[cfg(not(anyhow_no_core_unwind_safe))]
+use core::panic::{RefUnwindSafe, UnwindSafe};
#[cfg(not(anyhow_no_ptr_addr_of))]
use core::ptr;
use core::ptr::NonNull;
-#[cfg(error_generic_member_access)]
-use std::error::{self, Request};
-
-#[cfg(feature = "std")]
-use core::ops::{Deref, DerefMut};
+#[cfg(all(feature = "std", anyhow_no_core_unwind_safe))]
+use std::panic::{RefUnwindSafe, UnwindSafe};
impl Error {
/// Create a new error object from any error type.
@@ -25,8 +28,7 @@
///
/// If the error type does not provide a backtrace, a backtrace will be
/// created here to ensure that a backtrace exists.
- #[cfg(feature = "std")]
- #[cfg_attr(doc_cfg, doc(cfg(feature = "std")))]
+ #[cfg(any(feature = "std", not(anyhow_no_core_error)))]
#[cold]
#[must_use]
pub fn new<E>(error: E) -> Self
@@ -34,7 +36,7 @@
E: StdError + Send + Sync + 'static,
{
let backtrace = backtrace_if_absent!(&error);
- Error::from_std(error, backtrace)
+ Error::construct_from_std(error, backtrace)
}
/// Create a new error object from a printable error message.
@@ -80,12 +82,73 @@
where
M: Display + Debug + Send + Sync + 'static,
{
- Error::from_adhoc(message, backtrace!())
+ Error::construct_from_adhoc(message, backtrace!())
}
- #[cfg(feature = "std")]
+ /// Construct an error object from a type-erased standard library error.
+ ///
+ /// This is mostly useful for interop with other error libraries.
+ ///
+ /// # Example
+ ///
+ /// Here is a skeleton of a library that provides its own error abstraction.
+ /// The pair of `From` impls provide bidirectional support for `?`
+ /// conversion between `Report` and `anyhow::Error`.
+ ///
+ /// ```
+ /// use std::error::Error as StdError;
+ ///
+ /// pub struct Report {/* ... */}
+ ///
+ /// impl<E> From<E> for Report
+ /// where
+ /// E: Into<anyhow::Error>,
+ /// Result<(), E>: anyhow::Context<(), E>,
+ /// {
+ /// fn from(error: E) -> Self {
+ /// let anyhow_error: anyhow::Error = error.into();
+ /// let boxed_error: Box<dyn StdError + Send + Sync + 'static> = anyhow_error.into();
+ /// Report::from_boxed(boxed_error)
+ /// }
+ /// }
+ ///
+ /// impl From<Report> for anyhow::Error {
+ /// fn from(report: Report) -> Self {
+ /// let boxed_error: Box<dyn StdError + Send + Sync + 'static> = report.into_boxed();
+ /// anyhow::Error::from_boxed(boxed_error)
+ /// }
+ /// }
+ ///
+ /// impl Report {
+ /// fn from_boxed(boxed_error: Box<dyn StdError + Send + Sync + 'static>) -> Self {
+ /// todo!()
+ /// }
+ /// fn into_boxed(self) -> Box<dyn StdError + Send + Sync + 'static> {
+ /// todo!()
+ /// }
+ /// }
+ ///
+ /// // Example usage: can use `?` in both directions.
+ /// fn a() -> anyhow::Result<()> {
+ /// b()?;
+ /// Ok(())
+ /// }
+ /// fn b() -> Result<(), Report> {
+ /// a()?;
+ /// Ok(())
+ /// }
+ /// ```
+ #[cfg(any(feature = "std", not(anyhow_no_core_error)))]
#[cold]
- pub(crate) fn from_std<E>(error: E, backtrace: Option<Backtrace>) -> Self
+ #[must_use]
+ pub fn from_boxed(boxed_error: Box<dyn StdError + Send + Sync + 'static>) -> Self {
+ let backtrace = backtrace_if_absent!(&*boxed_error);
+ Error::construct_from_boxed(boxed_error, backtrace)
+ }
+
+ #[cfg(any(feature = "std", not(anyhow_no_core_error)))]
+ #[cold]
+ pub(crate) fn construct_from_std<E>(error: E, backtrace: Option<Backtrace>) -> Self
where
E: StdError + Send + Sync + 'static,
{
@@ -111,7 +174,7 @@
}
#[cold]
- pub(crate) fn from_adhoc<M>(message: M, backtrace: Option<Backtrace>) -> Self
+ pub(crate) fn construct_from_adhoc<M>(message: M, backtrace: Option<Backtrace>) -> Self
where
M: Display + Debug + Send + Sync + 'static,
{
@@ -120,7 +183,7 @@
let vtable = &ErrorVTable {
object_drop: object_drop::<MessageError<M>>,
object_ref: object_ref::<MessageError<M>>,
- #[cfg(all(feature = "std", anyhow_no_ptr_addr_of))]
+ #[cfg(all(any(feature = "std", not(anyhow_no_core_error)), anyhow_no_ptr_addr_of))]
object_mut: object_mut::<MessageError<M>>,
object_boxed: object_boxed::<MessageError<M>>,
object_downcast: object_downcast::<M>,
@@ -140,7 +203,7 @@
}
#[cold]
- pub(crate) fn from_display<M>(message: M, backtrace: Option<Backtrace>) -> Self
+ pub(crate) fn construct_from_display<M>(message: M, backtrace: Option<Backtrace>) -> Self
where
M: Display + Send + Sync + 'static,
{
@@ -149,7 +212,7 @@
let vtable = &ErrorVTable {
object_drop: object_drop::<DisplayError<M>>,
object_ref: object_ref::<DisplayError<M>>,
- #[cfg(all(feature = "std", anyhow_no_ptr_addr_of))]
+ #[cfg(all(any(feature = "std", not(anyhow_no_core_error)), anyhow_no_ptr_addr_of))]
object_mut: object_mut::<DisplayError<M>>,
object_boxed: object_boxed::<DisplayError<M>>,
object_downcast: object_downcast::<M>,
@@ -168,9 +231,13 @@
unsafe { Error::construct(error, vtable, backtrace) }
}
- #[cfg(feature = "std")]
+ #[cfg(any(feature = "std", not(anyhow_no_core_error)))]
#[cold]
- pub(crate) fn from_context<C, E>(context: C, error: E, backtrace: Option<Backtrace>) -> Self
+ pub(crate) fn construct_from_context<C, E>(
+ context: C,
+ error: E,
+ backtrace: Option<Backtrace>,
+ ) -> Self
where
C: Display + Send + Sync + 'static,
E: StdError + Send + Sync + 'static,
@@ -198,9 +265,9 @@
unsafe { Error::construct(error, vtable, backtrace) }
}
- #[cfg(feature = "std")]
+ #[cfg(any(feature = "std", not(anyhow_no_core_error)))]
#[cold]
- pub(crate) fn from_boxed(
+ pub(crate) fn construct_from_boxed(
error: Box<dyn StdError + Send + Sync>,
backtrace: Option<Backtrace>,
) -> Self {
@@ -325,7 +392,7 @@
let vtable = &ErrorVTable {
object_drop: object_drop::<ContextError<C, Error>>,
object_ref: object_ref::<ContextError<C, Error>>,
- #[cfg(all(feature = "std", anyhow_no_ptr_addr_of))]
+ #[cfg(all(any(feature = "std", not(anyhow_no_core_error)), anyhow_no_ptr_addr_of))]
object_mut: object_mut::<ContextError<C, Error>>,
object_boxed: object_boxed::<ContextError<C, Error>>,
object_downcast: context_chain_downcast::<C>,
@@ -399,8 +466,7 @@
/// None
/// }
/// ```
- #[cfg(feature = "std")]
- #[cfg_attr(doc_cfg, doc(cfg(feature = "std")))]
+ #[cfg(any(feature = "std", not(anyhow_no_core_error)))]
#[cold]
pub fn chain(&self) -> Chain {
unsafe { ErrorImpl::chain(self.inner.by_ref()) }
@@ -411,8 +477,7 @@
///
/// The root cause is the last error in the iterator produced by
/// [`chain()`][Error::chain].
- #[cfg(feature = "std")]
- #[cfg_attr(doc_cfg, doc(cfg(feature = "std")))]
+ #[cfg(any(feature = "std", not(anyhow_no_core_error)))]
pub fn root_cause(&self) -> &(dyn StdError + 'static) {
self.chain().last().unwrap()
}
@@ -554,8 +619,7 @@
}
}
-#[cfg(feature = "std")]
-#[cfg_attr(doc_cfg, doc(cfg(feature = "std")))]
+#[cfg(any(feature = "std", not(anyhow_no_core_error)))]
impl<E> From<E> for Error
where
E: StdError + Send + Sync + 'static,
@@ -563,12 +627,11 @@
#[cold]
fn from(error: E) -> Self {
let backtrace = backtrace_if_absent!(&error);
- Error::from_std(error, backtrace)
+ Error::construct_from_std(error, backtrace)
}
}
-#[cfg(feature = "std")]
-#[cfg_attr(doc_cfg, doc(cfg(feature = "std")))]
+#[cfg(any(feature = "std", not(anyhow_no_core_error)))]
impl Deref for Error {
type Target = dyn StdError + Send + Sync + 'static;
@@ -577,8 +640,7 @@
}
}
-#[cfg(feature = "std")]
-#[cfg_attr(doc_cfg, doc(cfg(feature = "std")))]
+#[cfg(any(feature = "std", not(anyhow_no_core_error)))]
impl DerefMut for Error {
fn deref_mut(&mut self) -> &mut Self::Target {
unsafe { ErrorImpl::error_mut(self.inner.by_mut()) }
@@ -609,7 +671,7 @@
struct ErrorVTable {
object_drop: unsafe fn(Own<ErrorImpl>),
object_ref: unsafe fn(Ref<ErrorImpl>) -> Ref<dyn StdError + Send + Sync + 'static>,
- #[cfg(all(feature = "std", anyhow_no_ptr_addr_of))]
+ #[cfg(all(any(feature = "std", not(anyhow_no_core_error)), anyhow_no_ptr_addr_of))]
object_mut: unsafe fn(Mut<ErrorImpl>) -> &mut (dyn StdError + Send + Sync + 'static),
object_boxed: unsafe fn(Own<ErrorImpl>) -> Box<dyn StdError + Send + Sync + 'static>,
object_downcast: unsafe fn(Ref<ErrorImpl>, TypeId) -> Option<Ref<()>>,
@@ -661,7 +723,7 @@
// Safety: requires layout of *e to match ErrorImpl<E>, and for `e` to be derived
// from a `&mut`
-#[cfg(all(feature = "std", anyhow_no_ptr_addr_of))]
+#[cfg(all(any(feature = "std", not(anyhow_no_core_error)), anyhow_no_ptr_addr_of))]
unsafe fn object_mut<E>(e: Mut<ErrorImpl>) -> &mut (dyn StdError + Send + Sync + 'static)
where
E: StdError + Send + Sync + 'static,
@@ -734,7 +796,7 @@
}
// Safety: requires layout of *e to match ErrorImpl<ContextError<C, E>>.
-#[cfg(feature = "std")]
+#[cfg(any(feature = "std", not(anyhow_no_core_error)))]
unsafe fn context_downcast<C, E>(e: Ref<ErrorImpl>, target: TypeId) -> Option<Ref<()>>
where
C: 'static,
@@ -774,7 +836,7 @@
}
// Safety: requires layout of *e to match ErrorImpl<ContextError<C, E>>.
-#[cfg(feature = "std")]
+#[cfg(any(feature = "std", not(anyhow_no_core_error)))]
unsafe fn context_drop_rest<C, E>(e: Own<ErrorImpl>, target: TypeId)
where
C: 'static,
@@ -906,7 +968,7 @@
unsafe { (vtable(this.ptr).object_ref)(this).deref() }
}
- #[cfg(feature = "std")]
+ #[cfg(any(feature = "std", not(anyhow_no_core_error)))]
pub(crate) unsafe fn error_mut(this: Mut<Self>) -> &mut (dyn StdError + Send + Sync + 'static) {
// Use vtable to attach E's native StdError vtable for the right
// original type E.
@@ -1009,16 +1071,22 @@
}
}
-#[cfg(feature = "std")]
+#[cfg(any(feature = "std", not(anyhow_no_core_error)))]
impl AsRef<dyn StdError + Send + Sync> for Error {
fn as_ref(&self) -> &(dyn StdError + Send + Sync + 'static) {
&**self
}
}
-#[cfg(feature = "std")]
+#[cfg(any(feature = "std", not(anyhow_no_core_error)))]
impl AsRef<dyn StdError> for Error {
fn as_ref(&self) -> &(dyn StdError + 'static) {
&**self
}
}
+
+#[cfg(any(feature = "std", not(anyhow_no_core_unwind_safe)))]
+impl UnwindSafe for Error {}
+
+#[cfg(any(feature = "std", not(anyhow_no_core_unwind_safe)))]
+impl RefUnwindSafe for Error {}
diff --git a/crates/anyhow/src/fmt.rs b/crates/anyhow/src/fmt.rs
index a99649b..85c84a9 100644
--- a/crates/anyhow/src/fmt.rs
+++ b/crates/anyhow/src/fmt.rs
@@ -43,6 +43,7 @@
#[cfg(any(std_backtrace, feature = "backtrace"))]
{
use crate::backtrace::BacktraceStatus;
+ use alloc::string::ToString;
let backtrace = unsafe { Self::backtrace(this) };
if let BacktraceStatus::Captured = backtrace.status() {
@@ -102,6 +103,7 @@
#[cfg(test)]
mod tests {
use super::*;
+ use alloc::string::String;
#[test]
fn one_digit() {
diff --git a/crates/anyhow/src/kind.rs b/crates/anyhow/src/kind.rs
index 21d76aa..a9f40c3 100644
--- a/crates/anyhow/src/kind.rs
+++ b/crates/anyhow/src/kind.rs
@@ -47,8 +47,10 @@
use crate::Error;
use core::fmt::{Debug, Display};
-#[cfg(feature = "std")]
+#[cfg(any(feature = "std", not(anyhow_no_core_error)))]
use crate::StdError;
+#[cfg(any(feature = "std", not(anyhow_no_core_error)))]
+use alloc::boxed::Box;
pub struct Adhoc;
@@ -68,7 +70,7 @@
where
M: Display + Debug + Send + Sync + 'static,
{
- Error::from_adhoc(message, backtrace!())
+ Error::construct_from_adhoc(message, backtrace!())
}
}
@@ -94,10 +96,10 @@
}
}
-#[cfg(feature = "std")]
+#[cfg(any(feature = "std", not(anyhow_no_core_error)))]
pub struct Boxed;
-#[cfg(feature = "std")]
+#[cfg(any(feature = "std", not(anyhow_no_core_error)))]
#[doc(hidden)]
pub trait BoxedKind: Sized {
#[inline]
@@ -106,14 +108,14 @@
}
}
-#[cfg(feature = "std")]
+#[cfg(any(feature = "std", not(anyhow_no_core_error)))]
impl BoxedKind for Box<dyn StdError + Send + Sync> {}
-#[cfg(feature = "std")]
+#[cfg(any(feature = "std", not(anyhow_no_core_error)))]
impl Boxed {
#[cold]
pub fn new(self, error: Box<dyn StdError + Send + Sync>) -> Error {
let backtrace = backtrace_if_absent!(&*error);
- Error::from_boxed(error, backtrace)
+ Error::construct_from_boxed(error, backtrace)
}
}
diff --git a/crates/anyhow/src/lib.rs b/crates/anyhow/src/lib.rs
index 490a075..947ed20 100644
--- a/crates/anyhow/src/lib.rs
+++ b/crates/anyhow/src/lib.rs
@@ -17,7 +17,7 @@
//! the return type of any fallible function.
//!
//! Within the function, use `?` to easily propagate any error that implements
-//! the `std::error::Error` trait.
+//! the [`std::error::Error`] trait.
//!
//! ```
//! # pub trait Deserialize {}
@@ -192,8 +192,8 @@
//!
//! # No-std support
//!
-//! In no_std mode, the same API is almost all available and works the same way.
-//! To depend on Anyhow in no_std mode, disable our default enabled "std"
+//! In no_std mode, almost all of the same API is available and works the same
+//! way. To depend on Anyhow in no_std mode, disable our default enabled "std"
//! feature in Cargo.toml. A global allocator is required.
//!
//! ```toml
@@ -201,15 +201,14 @@
//! anyhow = { version = "1.0", default-features = false }
//! ```
//!
-//! Since the `?`-based error conversions would normally rely on the
-//! `std::error::Error` trait which is only available through std, no_std mode
-//! will require an explicit `.map_err(Error::msg)` when working with a
-//! non-Anyhow error type inside a function that returns Anyhow's error type.
+//! With versions of Rust older than 1.81, no_std mode may require an additional
+//! `.map_err(Error::msg)` when working with a non-Anyhow error type inside a
+//! function that returns Anyhow's error type, as the trait that `?`-based error
+//! conversions are defined by is only available in std in those old versions.
-#![doc(html_root_url = "https://docs.rs/anyhow/1.0.79")]
+#![doc(html_root_url = "https://docs.rs/anyhow/1.0.95")]
#![cfg_attr(error_generic_member_access, feature(error_generic_member_access))]
-#![cfg_attr(doc_cfg, feature(doc_cfg))]
-#![cfg_attr(not(feature = "std"), no_std)]
+#![no_std]
#![deny(dead_code, unused_imports, unused_mut)]
#![cfg_attr(
not(anyhow_no_unsafe_op_in_unsafe_fn_lint),
@@ -221,12 +220,14 @@
clippy::enum_glob_use,
clippy::explicit_auto_deref,
clippy::extra_unused_type_parameters,
+ clippy::incompatible_msrv,
clippy::let_underscore_untyped,
clippy::missing_errors_doc,
clippy::missing_panics_doc,
clippy::module_name_repetitions,
clippy::must_use_candidate,
clippy::needless_doctest_main,
+ clippy::needless_lifetimes,
clippy::new_ret_no_self,
clippy::redundant_else,
clippy::return_self_not_must_use,
@@ -246,6 +247,9 @@
extern crate alloc;
+#[cfg(feature = "std")]
+extern crate std;
+
#[macro_use]
mod backtrace;
mod chain;
@@ -262,13 +266,16 @@
use crate::ptr::Own;
use core::fmt::Display;
-#[cfg(not(feature = "std"))]
+#[cfg(all(not(feature = "std"), anyhow_no_core_error))]
use core::fmt::Debug;
#[cfg(feature = "std")]
use std::error::Error as StdError;
-#[cfg(not(feature = "std"))]
+#[cfg(not(any(feature = "std", anyhow_no_core_error)))]
+use core::error::Error as StdError;
+
+#[cfg(all(not(feature = "std"), anyhow_no_core_error))]
trait StdError: Debug + Display {
fn source(&self) -> Option<&(dyn StdError + 'static)> {
None
@@ -379,7 +386,7 @@
/// # Ok(())
/// }
/// ```
-#[cfg_attr(not(doc), repr(transparent))]
+#[repr(transparent)]
pub struct Error {
inner: Own<ErrorImpl>,
}
@@ -403,8 +410,7 @@
/// None
/// }
/// ```
-#[cfg(feature = "std")]
-#[cfg_attr(doc_cfg, doc(cfg(feature = "std")))]
+#[cfg(any(feature = "std", not(anyhow_no_core_error)))]
#[derive(Clone)]
pub struct Chain<'a> {
state: crate::chain::ChainState<'a>,
@@ -621,11 +627,11 @@
F: FnOnce() -> C;
}
-/// Equivalent to Ok::<_, anyhow::Error>(value).
+/// Equivalent to `Ok::<_, anyhow::Error>(value)`.
///
-/// This simplifies creation of an anyhow::Result in places where type inference
-/// cannot deduce the `E` type of the result — without needing to write
-/// `Ok::<_, anyhow::Error>(value)`.
+/// This simplifies creation of an `anyhow::Result` in places where type
+/// inference cannot deduce the `E` type of the result — without needing
+/// to write`Ok::<_, anyhow::Error>(value)`.
///
/// One might think that `anyhow::Result::Ok(value)` would work in such cases
/// but it does not.
@@ -640,13 +646,14 @@
/// | consider giving this pattern the explicit type `std::result::Result<i32, E>`, where the type parameter `E` is specified
/// ```
#[allow(non_snake_case)]
-pub fn Ok<T>(t: T) -> Result<T> {
- Result::Ok(t)
+pub fn Ok<T>(value: T) -> Result<T> {
+ Result::Ok(value)
}
// Not public API. Referenced by macro-generated code.
#[doc(hidden)]
pub mod __private {
+ use self::not::Bool;
use crate::Error;
use alloc::fmt;
use core::fmt::Arguments;
@@ -665,7 +672,7 @@
#[doc(hidden)]
pub use crate::kind::{AdhocKind, TraitKind};
- #[cfg(feature = "std")]
+ #[cfg(any(feature = "std", not(anyhow_no_core_error)))]
#[doc(hidden)]
pub use crate::kind::BoxedKind;
}
@@ -695,4 +702,31 @@
pub fn must_use(error: Error) -> Error {
error
}
+
+ #[doc(hidden)]
+ #[inline]
+ pub fn not(cond: impl Bool) -> bool {
+ cond.not()
+ }
+
+ mod not {
+ #[doc(hidden)]
+ pub trait Bool {
+ fn not(self) -> bool;
+ }
+
+ impl Bool for bool {
+ #[inline]
+ fn not(self) -> bool {
+ !self
+ }
+ }
+
+ impl Bool for &bool {
+ #[inline]
+ fn not(self) -> bool {
+ !*self
+ }
+ }
+ }
}
diff --git a/crates/anyhow/src/macros.rs b/crates/anyhow/src/macros.rs
index 6dd2274..469b3d8 100644
--- a/crates/anyhow/src/macros.rs
+++ b/crates/anyhow/src/macros.rs
@@ -1,9 +1,10 @@
/// Return early with an error.
///
-/// This macro is equivalent to `return Err(`[`anyhow!($args...)`][anyhow!]`)`.
+/// This macro is equivalent to
+/// <code>return Err([anyhow!($args\...)][anyhow!])</code>.
///
/// The surrounding function's or closure's return value is required to be
-/// `Result<_,`[`anyhow::Error`][crate::Error]`>`.
+/// <code>Result<_, [anyhow::Error][crate::Error]></code>.
///
/// [anyhow!]: crate::anyhow
///
@@ -65,98 +66,108 @@
};
}
-/// Return early with an error if a condition is not satisfied.
-///
-/// This macro is equivalent to `if !$cond { return
-/// Err(`[`anyhow!($args...)`][anyhow!]`); }`.
-///
-/// The surrounding function's or closure's return value is required to be
-/// `Result<_,`[`anyhow::Error`][crate::Error]`>`.
-///
-/// Analogously to `assert!`, `ensure!` takes a condition and exits the function
-/// if the condition fails. Unlike `assert!`, `ensure!` returns an `Error`
-/// rather than panicking.
-///
-/// [anyhow!]: crate::anyhow
-///
-/// # Example
-///
-/// ```
-/// # use anyhow::{ensure, Result};
-/// #
-/// # fn main() -> Result<()> {
-/// # let user = 0;
-/// #
-/// ensure!(user == 0, "only user 0 is allowed");
-/// # Ok(())
-/// # }
-/// ```
-///
-/// ```
-/// # use anyhow::{ensure, Result};
-/// # use thiserror::Error;
-/// #
-/// # const MAX_DEPTH: usize = 1;
-/// #
-/// #[derive(Error, Debug)]
-/// enum ScienceError {
-/// #[error("recursion limit exceeded")]
-/// RecursionLimitExceeded,
-/// # #[error("...")]
-/// # More = (stringify! {
-/// ...
-/// # }, 1).1,
-/// }
-///
-/// # fn main() -> Result<()> {
-/// # let depth = 0;
-/// #
-/// ensure!(depth <= MAX_DEPTH, ScienceError::RecursionLimitExceeded);
-/// # Ok(())
-/// # }
-/// ```
-#[cfg(doc)]
-#[macro_export]
-macro_rules! ensure {
- ($cond:expr $(,)?) => {
- if !$cond {
- return $crate::__private::Err($crate::Error::msg(
- $crate::__private::concat!("Condition failed: `", $crate::__private::stringify!($cond), "`")
- ));
- }
- };
- ($cond:expr, $msg:literal $(,)?) => {
- if !$cond {
- return $crate::__private::Err($crate::__anyhow!($msg));
- }
- };
- ($cond:expr, $err:expr $(,)?) => {
- if !$cond {
- return $crate::__private::Err($crate::__anyhow!($err));
- }
- };
- ($cond:expr, $fmt:expr, $($arg:tt)*) => {
- if !$cond {
- return $crate::__private::Err($crate::__anyhow!($fmt, $($arg)*));
- }
+macro_rules! __ensure {
+ ($ensure:item) => {
+ /// Return early with an error if a condition is not satisfied.
+ ///
+ /// This macro is equivalent to
+ /// <code>if !$cond { return Err([anyhow!($args\...)][anyhow!]); }</code>.
+ ///
+ /// The surrounding function's or closure's return value is required to be
+ /// <code>Result<_, [anyhow::Error][crate::Error]></code>.
+ ///
+ /// Analogously to `assert!`, `ensure!` takes a condition and exits the function
+ /// if the condition fails. Unlike `assert!`, `ensure!` returns an `Error`
+ /// rather than panicking.
+ ///
+ /// [anyhow!]: crate::anyhow
+ ///
+ /// # Example
+ ///
+ /// ```
+ /// # use anyhow::{ensure, Result};
+ /// #
+ /// # fn main() -> Result<()> {
+ /// # let user = 0;
+ /// #
+ /// ensure!(user == 0, "only user 0 is allowed");
+ /// # Ok(())
+ /// # }
+ /// ```
+ ///
+ /// ```
+ /// # use anyhow::{ensure, Result};
+ /// # use thiserror::Error;
+ /// #
+ /// # const MAX_DEPTH: usize = 1;
+ /// #
+ /// #[derive(Error, Debug)]
+ /// enum ScienceError {
+ /// #[error("recursion limit exceeded")]
+ /// RecursionLimitExceeded,
+ /// # #[error("...")]
+ /// # More = (stringify! {
+ /// ...
+ /// # }, 1).1,
+ /// }
+ ///
+ /// # fn main() -> Result<()> {
+ /// # let depth = 0;
+ /// #
+ /// ensure!(depth <= MAX_DEPTH, ScienceError::RecursionLimitExceeded);
+ /// # Ok(())
+ /// # }
+ /// ```
+ $ensure
};
}
+#[cfg(doc)]
+__ensure![
+ #[macro_export]
+ macro_rules! ensure {
+ ($cond:expr $(,)?) => {
+ if !$cond {
+ return $crate::__private::Err($crate::Error::msg(
+ $crate::__private::concat!("Condition failed: `", $crate::__private::stringify!($cond), "`")
+ ));
+ }
+ };
+ ($cond:expr, $msg:literal $(,)?) => {
+ if !$cond {
+ return $crate::__private::Err($crate::__anyhow!($msg));
+ }
+ };
+ ($cond:expr, $err:expr $(,)?) => {
+ if !$cond {
+ return $crate::__private::Err($crate::__anyhow!($err));
+ }
+ };
+ ($cond:expr, $fmt:expr, $($arg:tt)*) => {
+ if !$cond {
+ return $crate::__private::Err($crate::__anyhow!($fmt, $($arg)*));
+ }
+ };
+ }
+];
+
#[cfg(not(doc))]
-#[macro_export]
-macro_rules! ensure {
- ($($tt:tt)*) => {
- $crate::__parse_ensure!(
- /* state */ 0
- /* stack */ ()
- /* bail */ ($($tt)*)
- /* fuel */ (~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~)
- /* parse */ {()}
- /* dup */ ($($tt)*)
- /* rest */ $($tt)*
- )
- };
-}
+__ensure![
+ #[macro_export]
+ macro_rules! ensure {
+ ($($tt:tt)*) => {
+ $crate::__parse_ensure!(
+ /* state */ 0
+ /* stack */ ()
+ /* bail */ ($($tt)*)
+ /* fuel */ (~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~)
+ /* parse */ {()}
+ /* dup */ ($($tt)*)
+ /* rest */ $($tt)*
+ )
+ };
+ }
+];
/// Construct an ad-hoc error from a string or existing non-`anyhow` error
/// value.
diff --git a/crates/anyhow/src/wrapper.rs b/crates/anyhow/src/wrapper.rs
index 0eb5478..6f46779 100644
--- a/crates/anyhow/src/wrapper.rs
+++ b/crates/anyhow/src/wrapper.rs
@@ -1,8 +1,11 @@
use crate::StdError;
use core::fmt::{self, Debug, Display};
+#[cfg(any(feature = "std", not(anyhow_no_core_error)))]
+use alloc::boxed::Box;
+
#[cfg(error_generic_member_access)]
-use std::error::Request;
+use core::error::Request;
#[repr(transparent)]
pub struct MessageError<M>(pub M);
@@ -50,25 +53,25 @@
impl<M> StdError for DisplayError<M> where M: Display + 'static {}
-#[cfg(feature = "std")]
+#[cfg(any(feature = "std", not(anyhow_no_core_error)))]
#[repr(transparent)]
pub struct BoxedError(pub Box<dyn StdError + Send + Sync>);
-#[cfg(feature = "std")]
+#[cfg(any(feature = "std", not(anyhow_no_core_error)))]
impl Debug for BoxedError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
Debug::fmt(&self.0, f)
}
}
-#[cfg(feature = "std")]
+#[cfg(any(feature = "std", not(anyhow_no_core_error)))]
impl Display for BoxedError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
Display::fmt(&self.0, f)
}
}
-#[cfg(feature = "std")]
+#[cfg(any(feature = "std", not(anyhow_no_core_error)))]
impl StdError for BoxedError {
fn source(&self) -> Option<&(dyn StdError + 'static)> {
self.0.source()
diff --git a/crates/anyhow/tests/compiletest.rs b/crates/anyhow/tests/compiletest.rs
index 7974a62..23a6a06 100644
--- a/crates/anyhow/tests/compiletest.rs
+++ b/crates/anyhow/tests/compiletest.rs
@@ -1,5 +1,5 @@
-#[rustversion::attr(not(nightly), ignore)]
-#[cfg_attr(miri, ignore)]
+#[rustversion::attr(not(nightly), ignore = "requires nightly")]
+#[cfg_attr(miri, ignore = "incompatible with miri")]
#[test]
fn ui() {
let t = trybuild::TestCases::new();
diff --git a/crates/anyhow/tests/test_autotrait.rs b/crates/anyhow/tests/test_autotrait.rs
index 94d7a59..080b3b9 100644
--- a/crates/anyhow/tests/test_autotrait.rs
+++ b/crates/anyhow/tests/test_autotrait.rs
@@ -1,6 +1,7 @@
#![allow(clippy::extra_unused_type_parameters)]
use anyhow::Error;
+use std::panic::{RefUnwindSafe, UnwindSafe};
#[test]
fn test_send() {
@@ -13,3 +14,21 @@
fn assert_sync<T: Sync>() {}
assert_sync::<Error>();
}
+
+#[test]
+fn test_unwind_safe() {
+ fn assert_unwind_safe<T: UnwindSafe>() {}
+ assert_unwind_safe::<Error>();
+}
+
+#[test]
+fn test_ref_unwind_safe() {
+ fn assert_ref_unwind_safe<T: RefUnwindSafe>() {}
+ assert_ref_unwind_safe::<Error>();
+}
+
+#[test]
+fn test_unpin() {
+ fn assert_unpin<T: Unpin>() {}
+ assert_unpin::<Error>();
+}
diff --git a/crates/anyhow/tests/test_backtrace.rs b/crates/anyhow/tests/test_backtrace.rs
index c89559e..938c1c2 100644
--- a/crates/anyhow/tests/test_backtrace.rs
+++ b/crates/anyhow/tests/test_backtrace.rs
@@ -1,7 +1,7 @@
#![allow(clippy::let_underscore_untyped)]
#[rustversion::not(nightly)]
-#[ignore]
+#[ignore = "requires nightly"]
#[test]
fn test_backtrace() {}
diff --git a/crates/anyhow/tests/test_ensure.rs b/crates/anyhow/tests/test_ensure.rs
index aeff3ac..b43490a 100644
--- a/crates/anyhow/tests/test_ensure.rs
+++ b/crates/anyhow/tests/test_ensure.rs
@@ -1,6 +1,9 @@
#![allow(
clippy::bool_to_int_with_if,
+ clippy::char_lit_as_u8,
+ clippy::deref_addrof,
clippy::diverging_sub_expression,
+ clippy::erasing_op,
clippy::extra_unused_type_parameters,
clippy::if_same_then_else,
clippy::ifs_same_cond,
@@ -16,6 +19,7 @@
clippy::redundant_pattern_matching,
clippy::too_many_lines,
clippy::unit_arg,
+ clippy::unnecessary_cast,
clippy::while_immutable_condition,
clippy::zero_ptr,
irrefutable_let_patterns
@@ -128,6 +132,19 @@
test,
"Condition failed: `while false == true && false {} < ()` (() vs ())",
);
+
+ let a = 15;
+ let b = 3;
+ let test = || Ok(ensure!(a <= b || a - b <= 10));
+ assert_err(test, "Condition failed: `a <= b || a - b <= 10`");
+}
+
+#[test]
+fn test_high_precedence_binary_operator() {
+ let a = 15;
+ let b = 3;
+ let test = || Ok(ensure!(a - b <= 10));
+ assert_err(test, "Condition failed: `a - b <= 10` (12 vs 10)");
}
#[test]
@@ -136,18 +153,18 @@
// identifier, nor as `(S + move || 1) == (1)` by misinterpreting the
// closure precedence.
let test = || Ok(ensure!(S + move || 1 == 1));
- assert_err(test, "Condition failed: `S + (move || 1 == 1)`");
+ assert_err(test, "Condition failed: `S + move || 1 == 1`");
let test = || Ok(ensure!(S + || 1 == 1));
- assert_err(test, "Condition failed: `S + (|| 1 == 1)`");
+ assert_err(test, "Condition failed: `S + || 1 == 1`");
// Must not partition as `S + ((move | ()) | 1) == 1` by treating those
// pipes as bitwise-or.
let test = || Ok(ensure!(S + move |()| 1 == 1));
- assert_err(test, "Condition failed: `S + (move |()| 1 == 1)`");
+ assert_err(test, "Condition failed: `S + move |()| 1 == 1`");
let test = || Ok(ensure!(S + |()| 1 == 1));
- assert_err(test, "Condition failed: `S + (|()| 1 == 1)`");
+ assert_err(test, "Condition failed: `S + |()| 1 == 1`");
}
#[test]
@@ -169,6 +186,17 @@
assert_err(test, "Condition failed: `&mut x == *&&mut &2` (1 vs 2)");
}
+#[rustversion::since(1.82)]
+#[test]
+fn test_raw_addr() {
+ let mut x = 1;
+ let test = || Ok(ensure!(S + &raw const x != S + &raw mut x));
+ assert_err(
+ test,
+ "Condition failed: `S + &raw const x != S + &raw mut x` (false vs false)",
+ );
+}
+
#[test]
fn test_if() {
#[rustfmt::skip]
@@ -207,7 +235,7 @@
let test = || Ok(ensure!(if let | 1 | 2 = 2 {}.t(1) == 2));
assert_err(
test,
- "Condition failed: `if let 1 | 2 = 2 {}.t(1) == 2` (1 vs 2)",
+ "Condition failed: `if let | 1 | 2 = 2 {}.t(1) == 2` (1 vs 2)",
);
}
@@ -252,7 +280,7 @@
let test = || Ok(ensure!(for | _x in iter::once(0) {}.t(1) == 2));
assert_err(
test,
- "Condition failed: `for _x in iter::once(0) {}.t(1) == 2` (1 vs 2)",
+ "Condition failed: `for | _x in iter::once(0) {}.t(1) == 2` (1 vs 2)",
);
#[rustfmt::skip]
@@ -269,7 +297,7 @@
let test = || Ok(ensure!(match 1 == 1 { true => 1, false => 0 } == 2));
assert_err(
test,
- "Condition failed: `match 1 == 1 { true => 1, false => 0, } == 2` (1 vs 2)",
+ "Condition failed: `match 1 == 1 { true => 1, false => 0 } == 2` (1 vs 2)",
);
}
@@ -326,7 +354,7 @@
let test = || Ok(ensure!(Error::msg::<&str,>.t(1) == 2));
assert_err(
test,
- "Condition failed: `Error::msg::<&str>.t(1) == 2` (1 vs 2)",
+ "Condition failed: `Error::msg::<&str,>.t(1) == 2` (1 vs 2)",
);
let test = || Ok(ensure!(Error::msg::<<str as ToOwned>::Owned>.t(1) == 2));
@@ -345,7 +373,7 @@
let test = || Ok(ensure!(Chain::<'static,>::new.t(1) == 2));
assert_err(
test,
- "Condition failed: `Chain::<'static>::new.t(1) == 2` (1 vs 2)",
+ "Condition failed: `Chain::<'static,>::new.t(1) == 2` (1 vs 2)",
);
fn f<const I: isize>() {}
@@ -377,7 +405,7 @@
#[rustfmt::skip]
let test = || Ok(ensure!(E::U::<u8,>>E::U));
- assert_err(test, "Condition failed: `E::U::<u8> > E::U` (U vs U)");
+ assert_err(test, "Condition failed: `E::U::<u8,> > E::U` (U vs U)");
let test = || Ok(ensure!(Generic::<dyn Debug + Sync> != Generic));
assert_err(
@@ -399,7 +427,7 @@
};
assert_err(
test,
- "Condition failed: `Generic::<dyn Fn() + ::std::marker::Sync> != Generic` (Generic vs Generic)",
+ "Condition failed: `Generic::<dyn Fn::() + ::std::marker::Sync> != Generic` (Generic vs Generic)",
);
}
@@ -464,7 +492,9 @@
fn test_whitespace() {
#[derive(Debug)]
pub struct Point {
+ #[allow(dead_code)]
pub x: i32,
+ #[allow(dead_code)]
pub y: i32,
}
diff --git a/crates/anyhow/tests/test_fmt.rs b/crates/anyhow/tests/test_fmt.rs
index 016b4b8..4cd2d7b 100644
--- a/crates/anyhow/tests/test_fmt.rs
+++ b/crates/anyhow/tests/test_fmt.rs
@@ -79,7 +79,6 @@
}
#[test]
-#[cfg_attr(not(std_backtrace), ignore)]
fn test_debug() {
assert!(format!("{:?}", f().unwrap_err()).starts_with(EXPECTED_DEBUG_F));
assert!(format!("{:?}", g().unwrap_err()).starts_with(EXPECTED_DEBUG_G));
diff --git a/crates/anyhow/tests/test_macros.rs b/crates/anyhow/tests/test_macros.rs
index a3342ab..10740a9 100644
--- a/crates/anyhow/tests/test_macros.rs
+++ b/crates/anyhow/tests/test_macros.rs
@@ -1,7 +1,9 @@
#![allow(
clippy::assertions_on_result_states,
clippy::eq_op,
+ clippy::incompatible_msrv, // https://github.com/rust-lang/rust-clippy/issues/12257
clippy::items_after_statements,
+ clippy::match_single_binding,
clippy::needless_pass_by_value,
clippy::shadow_unrelated,
clippy::wildcard_imports
@@ -10,7 +12,7 @@
mod common;
use self::common::*;
-use anyhow::{anyhow, ensure};
+use anyhow::{anyhow, ensure, Result};
use std::cell::Cell;
use std::future;
@@ -53,6 +55,20 @@
}
#[test]
+fn test_ensure_nonbool() -> Result<()> {
+ struct Struct {
+ condition: bool,
+ }
+
+ let s = Struct { condition: true };
+ match &s {
+ Struct { condition } => ensure!(condition), // &bool
+ }
+
+ Ok(())
+}
+
+#[test]
fn test_temporaries() {
fn require_send_sync(_: impl Send + Sync) {}
diff --git a/crates/anyhow/tests/test_repr.rs b/crates/anyhow/tests/test_repr.rs
index 065041c..2976cd8 100644
--- a/crates/anyhow/tests/test_repr.rs
+++ b/crates/anyhow/tests/test_repr.rs
@@ -4,7 +4,6 @@
use self::drop::{DetectDrop, Flag};
use anyhow::Error;
-use std::marker::Unpin;
use std::mem;
#[test]
diff --git a/crates/anyhow/tests/ui/ensure-nonbool.rs b/crates/anyhow/tests/ui/ensure-nonbool.rs
new file mode 100644
index 0000000..c7df4e1
--- /dev/null
+++ b/crates/anyhow/tests/ui/ensure-nonbool.rs
@@ -0,0 +1,40 @@
+use anyhow::{ensure, Result};
+use std::ops::{Deref, Not};
+
+struct Bool(bool);
+
+struct DerefBool(bool);
+
+struct NotBool(bool);
+
+impl Deref for DerefBool {
+ type Target = bool;
+ fn deref(&self) -> &Self::Target {
+ &self.0
+ }
+}
+
+impl Not for NotBool {
+ type Output = bool;
+ fn not(self) -> Self::Output {
+ !self.0
+ }
+}
+
+fn main() -> Result<()> {
+ ensure!("...");
+
+ let mut s = Bool(true);
+ match &mut s {
+ Bool(cond) => ensure!(cond),
+ }
+
+ let db = DerefBool(true);
+ ensure!(db);
+ ensure!(&db);
+
+ let nb = NotBool(true);
+ ensure!(nb);
+
+ Ok(())
+}
diff --git a/crates/anyhow/tests/ui/ensure-nonbool.stderr b/crates/anyhow/tests/ui/ensure-nonbool.stderr
new file mode 100644
index 0000000..3fdb8e6
--- /dev/null
+++ b/crates/anyhow/tests/ui/ensure-nonbool.stderr
@@ -0,0 +1,91 @@
+error[E0277]: the trait bound `&str: __private::not::Bool` is not satisfied
+ --> tests/ui/ensure-nonbool.rs:25:13
+ |
+25 | ensure!("...");
+ | --------^^^^^-
+ | | |
+ | | the trait `__private::not::Bool` is not implemented for `&str`
+ | required by a bound introduced by this call
+ |
+ = help: the following other types implement trait `__private::not::Bool`:
+ &bool
+ bool
+note: required by a bound in `anyhow::__private::not`
+ --> src/lib.rs
+ |
+ | pub fn not(cond: impl Bool) -> bool {
+ | ^^^^ required by this bound in `not`
+
+error[E0277]: the trait bound `&mut bool: __private::not::Bool` is not satisfied
+ --> tests/ui/ensure-nonbool.rs:29:31
+ |
+29 | Bool(cond) => ensure!(cond),
+ | --------^^^^-
+ | | |
+ | | the trait `__private::not::Bool` is not implemented for `&mut bool`
+ | required by a bound introduced by this call
+ |
+ = help: the following other types implement trait `__private::not::Bool`:
+ &bool
+ bool
+ = note: `__private::not::Bool` is implemented for `&bool`, but not for `&mut bool`
+note: required by a bound in `anyhow::__private::not`
+ --> src/lib.rs
+ |
+ | pub fn not(cond: impl Bool) -> bool {
+ | ^^^^ required by this bound in `not`
+
+error[E0277]: the trait bound `DerefBool: __private::not::Bool` is not satisfied
+ --> tests/ui/ensure-nonbool.rs:33:13
+ |
+33 | ensure!(db);
+ | --------^^-
+ | | |
+ | | the trait `__private::not::Bool` is not implemented for `DerefBool`
+ | required by a bound introduced by this call
+ |
+ = help: the following other types implement trait `__private::not::Bool`:
+ &bool
+ bool
+note: required by a bound in `anyhow::__private::not`
+ --> src/lib.rs
+ |
+ | pub fn not(cond: impl Bool) -> bool {
+ | ^^^^ required by this bound in `not`
+
+error[E0277]: the trait bound `&DerefBool: __private::not::Bool` is not satisfied
+ --> tests/ui/ensure-nonbool.rs:34:13
+ |
+34 | ensure!(&db);
+ | --------^^^-
+ | | |
+ | | the trait `__private::not::Bool` is not implemented for `&DerefBool`
+ | required by a bound introduced by this call
+ |
+note: required by a bound in `anyhow::__private::not`
+ --> src/lib.rs
+ |
+ | pub fn not(cond: impl Bool) -> bool {
+ | ^^^^ required by this bound in `not`
+help: consider dereferencing here
+ |
+34 | ensure!(&*db);
+ | +
+
+error[E0277]: the trait bound `NotBool: __private::not::Bool` is not satisfied
+ --> tests/ui/ensure-nonbool.rs:37:13
+ |
+37 | ensure!(nb);
+ | --------^^-
+ | | |
+ | | the trait `__private::not::Bool` is not implemented for `NotBool`
+ | required by a bound introduced by this call
+ |
+ = help: the following other types implement trait `__private::not::Bool`:
+ &bool
+ bool
+note: required by a bound in `anyhow::__private::not`
+ --> src/lib.rs
+ |
+ | pub fn not(cond: impl Bool) -> bool {
+ | ^^^^ required by this bound in `not`
diff --git a/crates/anyhow/tests/ui/no-impl.stderr b/crates/anyhow/tests/ui/no-impl.stderr
index 1ddf768..e06d70b 100644
--- a/crates/anyhow/tests/ui/no-impl.stderr
+++ b/crates/anyhow/tests/ui/no-impl.stderr
@@ -2,11 +2,7 @@
--> tests/ui/no-impl.rs:7:13
|
4 | struct Error;
- | ------------
- | |
- | doesn't satisfy `Error: Into<anyhow::Error>`
- | doesn't satisfy `Error: anyhow::kind::TraitKind`
- | doesn't satisfy `Error: std::fmt::Display`
+ | ------------ doesn't satisfy `Error: Into<anyhow::Error>`, `Error: anyhow::kind::TraitKind` or `Error: std::fmt::Display`
...
7 | let _ = anyhow!(Error);
| ^^^^^^^^^^^^^^ method cannot be called on `&Error` due to unsatisfied trait bounds
@@ -28,4 +24,9 @@
|
| pub trait Into<T>: Sized {
| ^^^^^^^^^^^^^^^^^^^^^^^^
+ = help: items from traits can only be used if the trait is implemented and in scope
+ = note: the following traits define an item `anyhow_kind`, perhaps you need to implement one of them:
+ candidate #1: `anyhow::kind::AdhocKind`
+ candidate #2: `anyhow::kind::BoxedKind`
+ candidate #3: `anyhow::kind::TraitKind`
= note: this error originates in the macro `anyhow` (in Nightly builds, run with -Z macro-backtrace for more info)
diff --git a/pseudo_crate/Cargo.lock b/pseudo_crate/Cargo.lock
index a496ef7..89f76ca 100644
--- a/pseudo_crate/Cargo.lock
+++ b/pseudo_crate/Cargo.lock
@@ -600,9 +600,9 @@
[[package]]
name = "anyhow"
-version = "1.0.79"
+version = "1.0.95"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca"
+checksum = "34ac096ce696dc2fcabef30516bb13c0a68a11d30131d3df6f04711467681b04"
[[package]]
name = "arbitrary"
diff --git a/pseudo_crate/Cargo.toml b/pseudo_crate/Cargo.toml
index 35020fc..7a9ed26 100644
--- a/pseudo_crate/Cargo.toml
+++ b/pseudo_crate/Cargo.toml
@@ -15,7 +15,7 @@
anes = "=0.2.0"
annotate-snippets = "=0.9.2"
anstyle = "=1.0.10"
-anyhow = "=1.0.79"
+anyhow = "=1.0.95"
arbitrary = "=1.4.1"
arc-swap = "=1.7.1"
argh = "=0.1.12"