diff --git a/Cargo.lock b/Cargo.lock index f96d098ad6e..0a813e09cd2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "addr2line" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a76fd60b23679b7d19bd066031410fb7e458ccc5e958eb5c325888ce4baedc97" +checksum = "f4fa78e18c64fce05e902adecd7a5eed15a5e0a3439f7b0e169f0252214865e3" dependencies = [ "gimli", ] @@ -30,9 +30,9 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "0.7.20" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" +checksum = "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41" dependencies = [ "memchr", ] @@ -53,6 +53,12 @@ dependencies = [ "tracing 0.1.0", ] +[[package]] +name = "android-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + [[package]] name = "android_system_properties" version = "0.1.5" @@ -64,49 +70,58 @@ dependencies = [ [[package]] name = "anstream" -version = "0.2.6" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "342258dd14006105c2b75ab1bd7543a03bdf0cfc94383303ac212a04939dff6f" +checksum = "0ca84f3628370c59db74ee214b3263d58f9aadd9b4fe7e711fd87dc452b7f163" dependencies = [ "anstyle", "anstyle-parse", + "anstyle-query", "anstyle-wincon", - "concolor-override", - "concolor-query 0.3.3", + "colorchoice", "is-terminal", "utf8parse", ] [[package]] name = "anstyle" -version = "0.3.5" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23ea9e81bd02e310c216d080f6223c179012256e5151c41db88d12c88a1684d2" +checksum = "3a30da5c5f2d5e72842e00bcb57657162cdabef0931f40e2deb9b4140440cecd" [[package]] name = "anstyle-parse" -version = "0.1.1" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7d1bb534e9efed14f3e5f44e7dd1a4f709384023a4165199a4241e18dff0116" +checksum = "938874ff5980b03a87c5524b3ae5b59cf99b1d6bc836848df7bc5ada9643c333" dependencies = [ "utf8parse", ] +[[package]] +name = "anstyle-query" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" +dependencies = [ + "windows-sys 0.48.0", +] + [[package]] name = "anstyle-wincon" -version = "0.2.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3127af6145b149f3287bb9a0d10ad9c5692dba8c53ad48285e5bec4063834fa" +checksum = "180abfa45703aebe0093f79badacc01b8fd4ea2e35118747e5811127f926e188" dependencies = [ "anstyle", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] name = "anyhow" -version = "1.0.70" +version = "1.0.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7de8ce5e0f9f8d88245311066a578d72b7af3e7088f32783804676302df237e4" +checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8" [[package]] name = "async-attributes" @@ -120,9 +135,9 @@ dependencies = [ [[package]] name = "async-channel" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf46fee83e5ccffc220104713af3292ff9bc7c64c7de289f66dae8e38d826833" +checksum = "81953c529336010edd6d8e358f886d9581267795c61b19475b71314bffa46d35" dependencies = [ "concurrent-queue", "event-listener", @@ -172,7 +187,7 @@ dependencies = [ "log", "parking", "polling", - "rustix", + "rustix 0.37.23", "slab", "socket2", "waker-fn", @@ -200,7 +215,7 @@ dependencies = [ "cfg-if", "event-listener", "futures-lite", - "rustix", + "rustix 0.37.23", "signal-hook", "windows-sys 0.48.0", ] @@ -241,13 +256,13 @@ checksum = "ecc7ab41815b3c653ccd2978ec3255c81349336702dfdf62ee6f7069b12a3aae" [[package]] name = "async-trait" -version = "0.1.68" +version = "0.1.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9ccdd8f2a161be9bd5c023df56f1b2a0bd1d83872ae53b71a84a12c9bf6e842" +checksum = "a564d521dd56509c4c47480d00b80ee55f7e385ae48db5744c67ad50c92d2ebf" dependencies = [ "proc-macro2", "quote", - "syn 2.0.14", + "syn 2.0.25", ] [[package]] @@ -290,9 +305,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "backtrace" -version = "0.3.67" +version = "0.3.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "233d376d6d185f2a3093e58f283f60f880315b6c60075b01f36b3b85154564ca" +checksum = "4319208da049c43661739c5fade2ba182f09d1dc2299b32298d3a31692b17e12" dependencies = [ "addr2line", "cc", @@ -303,6 +318,12 @@ dependencies = [ "rustc-demangle", ] +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + [[package]] name = "base64" version = "0.13.1" @@ -311,9 +332,15 @@ checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "base64" -version = "0.21.0" +version = "0.21.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" + +[[package]] +name = "base64ct" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a" +checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" [[package]] name = "bencher" @@ -336,6 +363,12 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "bitflags" +version = "2.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42" + [[package]] name = "block-buffer" version = "0.10.4" @@ -362,9 +395,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.12.0" +version = "3.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535" +checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" [[package]] name = "byteorder" @@ -381,50 +414,54 @@ checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" [[package]] name = "cargo-test-macro" version = "0.1.0" -source = "git+https://github.com/rust-lang/cargo.git?rev=17f8088#17f8088d6eafd82349630a8de8cc6efe03abf5fb" +source = "git+https://github.com/rust-lang/cargo.git?rev=ec8a8a0#ec8a8a0cabb0e0cadef58902470f6c7ee7868bdc" [[package]] name = "cargo-test-support" version = "0.1.0" -source = "git+https://github.com/rust-lang/cargo.git?rev=17f8088#17f8088d6eafd82349630a8de8cc6efe03abf5fb" +source = "git+https://github.com/rust-lang/cargo.git?rev=ec8a8a0#ec8a8a0cabb0e0cadef58902470f6c7ee7868bdc" dependencies = [ "anyhow", "cargo-test-macro", "cargo-util", + "crates-io", "filetime", "flate2", "git2", "glob", - "itertools", + "itertools 0.10.5", "lazy_static", - "remove_dir_all 0.5.3", + "pasetors", + "serde", "serde_json", "snapbox", "tar", "termcolor", - "toml_edit 0.14.4", + "time", + "toml 0.7.6", "url", + "windows-sys 0.45.0", ] [[package]] name = "cargo-util" -version = "0.1.4" -source = "git+https://github.com/rust-lang/cargo.git?rev=17f8088#17f8088d6eafd82349630a8de8cc6efe03abf5fb" +version = "0.2.4" +source = "git+https://github.com/rust-lang/cargo.git?rev=ec8a8a0#ec8a8a0cabb0e0cadef58902470f6c7ee7868bdc" dependencies = [ "anyhow", "core-foundation", - "crypto-hash", "filetime", - "hex 0.4.3", + "hex", "jobserver", "libc", "log", - "miow", + "miow 0.5.0", "same-file", + "sha2", "shell-escape", "tempfile", "walkdir", - "winapi", + "windows-sys 0.45.0", ] [[package]] @@ -450,21 +487,21 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.24" +version = "0.4.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e3c5919066adf22df73762e50cffcde3a758f2a848b113b586d1f86728b673b" +checksum = "ec837a71355b28f6556dbd569b37b3f363091c0bd4b2e735674521b4c5fd9bc5" dependencies = [ + "android-tzdata", "iana-time-zone", - "num-integer", "num-traits", "winapi", ] [[package]] name = "clap" -version = "4.2.1" +version = "4.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "046ae530c528f252094e4a77886ee1374437744b2bff1497aa898bbddbbb29b3" +checksum = "1640e5cc7fb47dbb8338fd471b105e7ed6c3cb2aeb00c2e067127ffd3764a05d" dependencies = [ "clap_builder", "clap_derive", @@ -473,44 +510,33 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.2.1" +version = "4.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "223163f58c9a40c3b0a43e1c4b50a9ce09f007ea2cb1ec258a687945b4b7929f" +checksum = "98c59138d527eeaf9b53f35a77fcc1fad9d883116070c63d5de1c7dc7b00c72b" dependencies = [ "anstream", "anstyle", - "bitflags", "clap_lex", "strsim", ] [[package]] name = "clap_derive" -version = "4.2.0" +version = "4.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9644cd56d6b87dbe899ef8b053e331c0637664e9e21a33dfcdc36093f5c5c4" +checksum = "b8cd2b2a819ad6eec39e8f1d6b53001af1e5469f8c177579cdaeb313115b825f" dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.14", + "syn 2.0.25", ] [[package]] name = "clap_lex" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a2dd5a6fe8c6e3502f568a6353e5273bbb15193ad9a89e457b9970798efbea1" - -[[package]] -name = "codespan-reporting" -version = "0.11.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" -dependencies = [ - "termcolor", - "unicode-width", -] +checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b" [[package]] name = "color-backtrace" @@ -523,6 +549,12 @@ dependencies = [ "termcolor", ] +[[package]] +name = "colorchoice" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" + [[package]] name = "combine" version = "4.6.6" @@ -533,29 +565,11 @@ dependencies = [ "memchr", ] -[[package]] -name = "commoncrypto" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d056a8586ba25a1e4d61cb090900e495952c7886786fc55f909ab2f819b69007" -dependencies = [ - "commoncrypto-sys", -] - -[[package]] -name = "commoncrypto-sys" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fed34f46747aa73dfaa578069fd8279d2818ade2b55f38f22a9401c7f4083e2" -dependencies = [ - "libc", -] - [[package]] name = "compiletest_rs" -version = "0.9.0" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70489bbb718aea4f92e5f48f2e3b5be670c2051de30e57cb6e5377b4aa08b372" +checksum = "7225fee1bcf9247bb3a1b1a2d7ecfe2f7a990e549a09d766a257a4ae30dac0d6" dependencies = [ "diff", "filetime", @@ -563,7 +577,7 @@ dependencies = [ "lazy_static", "libc", "log", - "miow", + "miow 0.3.7", "regex", "rustfix", "serde", @@ -573,38 +587,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "concolor" -version = "0.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "015267563b1df20adccdd00cb05257b1dfbea70a04928e9cf88ffb850c1a40af" -dependencies = [ - "atty", - "bitflags", - "concolor-query 0.0.5", -] - -[[package]] -name = "concolor-override" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a855d4a1978dc52fb0536a04d384c2c0c1aa273597f08b77c8c4d3b2eec6037f" - -[[package]] -name = "concolor-query" -version = "0.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6417fe6fc03a8b533fd2177742eeb39a90c7233eedec7bac96d4d6b69a09449" - -[[package]] -name = "concolor-query" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88d11d52c3d7ca2e6d0040212be9e4dbbcd78b6447f535b6b561f449427944cf" -dependencies = [ - "windows-sys 0.45.0", -] - [[package]] name = "concurrent-queue" version = "2.2.0" @@ -633,6 +615,12 @@ dependencies = [ "yaml-rust", ] +[[package]] +name = "const-oid" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6340df57935414636969091153f35f68d9f00bbc8fb4a9c6054706c213e6c6bc" + [[package]] name = "content_inspector" version = "0.2.4" @@ -666,13 +654,26 @@ checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" [[package]] name = "cpufeatures" -version = "0.2.6" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "280a9f2d8b3a38871a3c8a46fb80db65e5e5ed97da80c4d08bf27fb63e35e181" +checksum = "a17b76ff3a4162b0b27f354a0c87015ddad39d35f9c0c36607a3bdd175dde1f1" dependencies = [ "libc", ] +[[package]] +name = "crates-io" +version = "0.36.0" +source = "git+https://github.com/rust-lang/cargo.git?rev=ec8a8a0#ec8a8a0cabb0e0cadef58902470f6c7ee7868bdc" +dependencies = [ + "anyhow", + "curl", + "percent-encoding", + "serde", + "serde_json", + "url", +] + [[package]] name = "crc32fast" version = "1.3.2" @@ -705,53 +706,53 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.14" +version = "0.9.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46bd5f3f85273295a9d14aedfb86f6aadbff6d8f5295c4a9edb08e819dcf5695" +checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7" dependencies = [ "autocfg", "cfg-if", "crossbeam-utils", - "memoffset 0.8.0", + "memoffset 0.9.0", "scopeguard", ] [[package]] name = "crossbeam-utils" -version = "0.8.15" +version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c063cd8cc95f5c377ed0d4b49a4b21f632396ff690e8470c29b3359b346984b" +checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" dependencies = [ "cfg-if", ] [[package]] -name = "crypto-common" -version = "0.1.6" +name = "crypto-bigint" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +checksum = "cf4c2f4e1afd912bc40bfd6fed5d9dc1f288e0ba01bfcc835cc5bc3eb13efe15" dependencies = [ "generic-array", - "typenum", + "rand_core", + "subtle", + "zeroize", ] [[package]] -name = "crypto-hash" -version = "0.3.4" +name = "crypto-common" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a77162240fd97248d19a564a565eb563a3f592b386e4136fb300909e67dddca" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ - "commoncrypto", - "hex 0.3.2", - "openssl", - "winapi", + "generic-array", + "typenum", ] [[package]] name = "csv" -version = "1.2.1" +version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b015497079b9a9d69c02ad25de6c0a6edef051ea6360a327d0bd05802ef64ad" +checksum = "626ae34994d3d8d668f4269922248239db4ae42d538b14c398b74a52208e8086" dependencies = [ "csv-core", "itoa", @@ -769,75 +770,68 @@ dependencies = [ ] [[package]] -name = "ctor" -version = "0.1.26" +name = "ct-codecs" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d2301688392eb071b0bf1a37be05c469d3cc4dbbd95df672fe28ab021e6a096" -dependencies = [ - "quote", - "syn 1.0.109", -] +checksum = "f3b7eb4404b8195a9abb6356f4ac07d8ba267045c8d6d220ac4dc992e6cc75df" [[package]] name = "ctrlc" -version = "3.2.5" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbcf33c2a618cbe41ee43ae6e9f2e48368cd9f9db2896f10167d8d762679f639" +checksum = "2a011bbe2c35ce9c1f143b7af6f94f29a167beb4cd1d29e6740ce836f723120e" dependencies = [ "nix 0.26.2", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] -name = "cxx" -version = "1.0.94" +name = "curl" +version = "0.4.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f61f1b6389c3fe1c316bf8a4dccc90a38208354b330925bce1f74a6c4756eb93" +checksum = "509bd11746c7ac09ebd19f0b17782eae80aadee26237658a6b4808afb5c11a22" dependencies = [ - "cc", - "cxxbridge-flags", - "cxxbridge-macro", - "link-cplusplus", + "curl-sys", + "libc", + "openssl-probe", + "openssl-sys", + "schannel", + "socket2", + "winapi", ] [[package]] -name = "cxx-build" -version = "1.0.94" +name = "curl-sys" +version = "0.4.63+curl-8.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12cee708e8962df2aeb38f594aae5d827c022b6460ac71a7a3e2c3c2aae5a07b" +checksum = "aeb0fef7046022a1e2ad67a004978f0e3cacb9e3123dc62ce768f92197b771dc" dependencies = [ "cc", - "codespan-reporting", - "once_cell", - "proc-macro2", - "quote", - "scratch", - "syn 2.0.14", + "libc", + "libz-sys", + "openssl-sys", + "pkg-config", + "vcpkg", + "winapi", ] [[package]] -name = "cxxbridge-flags" -version = "1.0.94" +name = "datafrog" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7944172ae7e4068c533afbb984114a56c46e9ccddda550499caa222902c7f7bb" +checksum = "a0afaad2b26fa326569eb264b1363e8ae3357618c43982b3f285f0774ce76b69" [[package]] -name = "cxxbridge-macro" -version = "1.0.94" +name = "der" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2345488264226bf682893e25de0769f3360aac9957980ec49361b083ddaa5bc5" +checksum = "0c7ed52955ce76b1554f509074bb357d3fb8ac9b51288a65a3fd480d1dfba946" dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.14", + "const-oid", + "pem-rfc7468", + "zeroize", ] -[[package]] -name = "datafrog" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0afaad2b26fa326569eb264b1363e8ae3357618c43982b3f285f0774ce76b69" - [[package]] name = "derivative" version = "2.2.0" @@ -879,12 +873,14 @@ dependencies = [ [[package]] name = "digest" -version = "0.10.6" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", + "const-oid", "crypto-common", + "subtle", ] [[package]] @@ -916,9 +912,32 @@ checksum = "0688c2a7f92e427f44895cd63841bff7b29f8d7a1648b9e7e07a4a365b2e1257" [[package]] name = "dunce" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bd4b30a6560bbd9b4620f4de34c3f14f60848e58a9b7216801afcb4c7b31c3c" +checksum = "56ce8c6da7551ec6c462cbaf3bfbc75131ebbfa1c944aeaa9dab51ca1c5f0c3b" + +[[package]] +name = "ecdsa" +version = "0.16.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0997c976637b606099b9985693efa3581e84e41f5c11ba5255f88711058ad428" +dependencies = [ + "der", + "digest", + "elliptic-curve", + "rfc6979", + "signature", + "spki", +] + +[[package]] +name = "ed25519-compact" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a3d382e8464107391c8706b4c14b087808ecb909f6c15c34114bc42e53a9e4c" +dependencies = [ + "getrandom", +] [[package]] name = "either" @@ -926,6 +945,27 @@ version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" +[[package]] +name = "elliptic-curve" +version = "0.13.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "968405c8fdc9b3bf4df0a6638858cc0b52462836ab6b1c87377785dd09cf1c0b" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array", + "group", + "hkdf", + "pem-rfc7468", + "pkcs8", + "rand_core", + "sec1", + "subtle", + "zeroize", +] + [[package]] name = "encoding_rs" version = "0.8.32" @@ -948,6 +988,12 @@ dependencies = [ "termcolor", ] +[[package]] +name = "equivalent" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88bffebc5d80432c9b140ee17875ff173a8ab62faad5b257da912bd2f6c1c0a1" + [[package]] name = "errno" version = "0.3.1" @@ -1016,6 +1062,22 @@ dependencies = [ "instant", ] +[[package]] +name = "ff" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" +dependencies = [ + "rand_core", + "subtle", +] + +[[package]] +name = "fiat-crypto" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e825f6987101665dea6ec934c09ec6d721de7bc1bf92248e1d5810c8cd636b77" + [[package]] name = "filetime" version = "0.2.21" @@ -1030,9 +1092,9 @@ dependencies = [ [[package]] name = "flate2" -version = "1.0.25" +version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8a2db397cb1c8772f31494cb8917e48cd1e64f0fa7efac59fbd741a0a8ce841" +checksum = "3b9429470923de8e8cbd4d2dc513535400b4b3fef0319fb5c4e1f520a7bef743" dependencies = [ "crc32fast", "libz-sys", @@ -1062,9 +1124,9 @@ checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" [[package]] name = "form_urlencoded" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8" +checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" dependencies = [ "percent-encoding", ] @@ -1150,7 +1212,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.14", + "syn 2.0.25", ] [[package]] @@ -1191,6 +1253,7 @@ checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", "version_check", + "zeroize", ] [[package]] @@ -1204,28 +1267,30 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.9" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c85e1d9ab2eadba7e5040d4e09cbd6d072b76a557ad64e797c2cb9d4da21d7e4" +checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" dependencies = [ "cfg-if", + "js-sys", "libc", "wasi", + "wasm-bindgen", ] [[package]] name = "gimli" -version = "0.27.2" +version = "0.27.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad0a93d233ebf96623465aad4046a8d3aa4da22d4f4beba5388838c8a434bbb4" +checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" [[package]] name = "git2" -version = "0.14.4" +version = "0.17.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0155506aab710a86160ddb504a480d2964d7ab5b9e62419be69e0032bc5931c" +checksum = "7b989d6a7ca95a362cf2cfc5ad688b3a467be1f87e480b8dad07fee8c79b0044" dependencies = [ - "bitflags", + "bitflags 1.3.2", "libc", "libgit2-sys", "log", @@ -1252,11 +1317,22 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core", + "subtle", +] + [[package]] name = "h2" -version = "0.3.16" +version = "0.3.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5be7b54589b581f624f566bf5d8eb2bab1db736c51528720b6bd36b96b55924d" +checksum = "97ec8491ebaf99c8eaa73058b045fe58073cd6be7f596ac993ced0b0a0c01049" dependencies = [ "bytes", "fnv", @@ -1264,7 +1340,7 @@ dependencies = [ "futures-sink", "futures-util", "http", - "indexmap", + "indexmap 1.9.3", "slab", "tokio", "tokio-util", @@ -1280,6 +1356,12 @@ dependencies = [ "ahash", ] +[[package]] +name = "hashbrown" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" + [[package]] name = "headers" version = "0.3.8" @@ -1287,7 +1369,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f3e372db8e5c0d213e0cd0b9be18be2aca3d44cf2fe30a9d46a65581cd454584" dependencies = [ "base64 0.13.1", - "bitflags", + "bitflags 1.3.2", "bytes", "headers-core", "http", @@ -1322,30 +1404,33 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.2.6" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" -dependencies = [ - "libc", -] +checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" [[package]] -name = "hermit-abi" -version = "0.3.1" +name = "hex" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] -name = "hex" -version = "0.3.2" +name = "hkdf" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "805026a5d0141ffc30abb3be3173848ad46a1b1664fe632428479619a3644d77" +checksum = "791a029f6b9fc27657f6f188ec6e5e43f6911f6f878e0dc5501396e09809d437" +dependencies = [ + "hmac", +] [[package]] -name = "hex" -version = "0.4.3" +name = "hmac" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] [[package]] name = "http" @@ -1389,9 +1474,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "0.14.25" +version = "0.14.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc5e554ff619822309ffd57d8734d77cd5ce6238bc956f037ea06c58238c9899" +checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" dependencies = [ "bytes", "futures-channel", @@ -1413,10 +1498,11 @@ dependencies = [ [[package]] name = "hyper-rustls" -version = "0.23.2" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1788965e61b367cd03a62950836d5cd41560c3577d90e40e0819373194d1661c" +checksum = "8d78e1e73ec14cf7375674f74d7dde185c8206fd9dea6fb6295e8a98098aaa97" dependencies = [ + "futures-util", "http", "hyper", "rustls", @@ -1426,9 +1512,9 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.56" +version = "0.1.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0722cd7114b7de04316e7ea5456a0bbb20e4adb46fd27a3697adb812cff0f37c" +checksum = "2fad5b825842d2b38bd206f3e81d6957625fd7f0a361e345c30e01a0ae2dd613" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -1440,19 +1526,18 @@ dependencies = [ [[package]] name = "iana-time-zone-haiku" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0703ae284fc167426161c2e3f1da3ea71d94b21bedbcc9494e92b28e334e3dca" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" dependencies = [ - "cxx", - "cxx-build", + "cc", ] [[package]] name = "idna" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6" +checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" dependencies = [ "unicode-bidi", "unicode-normalization", @@ -1474,7 +1559,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" dependencies = [ "autocfg", - "hashbrown", + "hashbrown 0.12.3", +] + +[[package]] +name = "indexmap" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d" +dependencies = [ + "equivalent", + "hashbrown 0.14.0", ] [[package]] @@ -1488,30 +1583,29 @@ dependencies = [ [[package]] name = "io-lifetimes" -version = "1.0.10" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c66c74d2ae7e79a5a8f7ac924adbe38ee42a859c6539ad869eb51f0b52dc220" +checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" dependencies = [ - "hermit-abi 0.3.1", + "hermit-abi 0.3.2", "libc", "windows-sys 0.48.0", ] [[package]] name = "ipnet" -version = "2.7.2" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12b6ee2129af8d4fb011108c73d99a1b83a85977f23b82460c0ae2e25bb4b57f" +checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6" [[package]] name = "is-terminal" -version = "0.4.7" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f" +checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" dependencies = [ - "hermit-abi 0.3.1", - "io-lifetimes", - "rustix", + "hermit-abi 0.3.2", + "rustix 0.38.3", "windows-sys 0.48.0", ] @@ -1524,11 +1618,20 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" +dependencies = [ + "either", +] + [[package]] name = "itoa" -version = "1.0.6" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" +checksum = "62b02a5381cc465bd3041d84623d0fa3b66738b52b8e2fc3bab8ad63ab032f4a" [[package]] name = "jni" @@ -1573,9 +1676,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.61" +version = "0.3.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "445dde2150c55e483f3d8416706b97ec8e8237c307e5b7b4b8dd15e6af2a0730" +checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" dependencies = [ "wasm-bindgen", ] @@ -1591,15 +1694,6 @@ dependencies = [ "serde", ] -[[package]] -name = "kstring" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec3066350882a1cd6d950d055997f379ac37fd39f81cd4d8ed186032eb3c5747" -dependencies = [ - "static_assertions", -] - [[package]] name = "kv-log-macro" version = "1.0.7" @@ -1617,15 +1711,15 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.141" +version = "0.2.147" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3304a64d199bb964be99741b7a14d26972741915b3649639149b2479bb46f4b5" +checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" [[package]] name = "libgit2-sys" -version = "0.13.5+1.4.5" +version = "0.15.2+1.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51e5ea06c26926f1002dd553fded6cfcdc9784c1f60feeb58368b4d9b07b6dba" +checksum = "a80df2e11fb4a61f4ba2ab42dbe7f74468da143f1a75c74e11dee7c813f694fa" dependencies = [ "cc", "libc", @@ -1637,9 +1731,9 @@ dependencies = [ [[package]] name = "libssh2-sys" -version = "0.2.23" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b094a36eb4b8b8c8a7b4b8ae43b2944502be3e59cd87687595cf6b0a71b3f4ca" +checksum = "2dc8a030b787e2119a731f1951d6a773e2280c660f8ec4b0f5e1505a386e71ee" dependencies = [ "cc", "libc", @@ -1651,9 +1745,9 @@ dependencies = [ [[package]] name = "libz-sys" -version = "1.1.8" +version = "1.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9702761c3935f8cc2f101793272e202c72b99da8f4224a19ddcf1279a6450bbf" +checksum = "56ee889ecc9568871456d42f603d6a0ce59ff328d291063a45cbdf0036baf6db" dependencies = [ "cc", "libc", @@ -1662,33 +1756,29 @@ dependencies = [ ] [[package]] -name = "link-cplusplus" -version = "1.0.8" +name = "linked-hash-map" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecd207c9c713c34f95a097a5b029ac2ce6010530c7b49d7fea24d977dede04f5" -dependencies = [ - "cc", -] +checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" [[package]] -name = "linked-hash-map" -version = "0.5.6" +name = "linux-raw-sys" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" +checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" [[package]] name = "linux-raw-sys" -version = "0.3.1" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d59d8c75012853d2e872fb56bc8a2e53718e2cafe1a4c823143141c6d90c322f" +checksum = "09fc20d2ca12cb9f044c93e3bd6d32d523e6e2ec3db4f7b2939cd99026ecd3f0" [[package]] name = "log" -version = "0.4.17" +version = "0.4.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" +checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" dependencies = [ - "cfg-if", "value-bag", ] @@ -1698,7 +1788,7 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" dependencies = [ - "regex-automata", + "regex-automata 0.1.10", ] [[package]] @@ -1727,9 +1817,9 @@ dependencies = [ [[package]] name = "memoffset" -version = "0.8.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d61c719bcfbcf5d62b3a09efa6088de8c54bc0bfcd3ea7ae39fcc186108b8de1" +checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" dependencies = [ "autocfg", ] @@ -1758,23 +1848,22 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.6.2" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa" +checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" dependencies = [ "adler", ] [[package]] name = "mio" -version = "0.8.6" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b9d9a46eff5b4ff64b45a9e316a6d1e0bc719ef429cbec4dc630684212bfdf9" +checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" dependencies = [ "libc", - "log", "wasi", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] @@ -1787,17 +1876,30 @@ dependencies = [ ] [[package]] -name = "multiparty" -version = "0.1.0" +name = "miow" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52ffbca2f655e33c08be35d87278e5b18b89550a37dbd598c20db92f6a471123" +dependencies = [ + "windows-sys 0.42.0", +] + +[[package]] +name = "multer" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed1ec6589a6d4a1e0b33b4c0a3f6ee96dfba88ebdb3da51403fd7cf0a24a4b04" +checksum = "01acbdc23469fd8fe07ab135923371d5f5a422fbf9c522158677c8eb15bc51c2" dependencies = [ "bytes", - "futures-core", + "encoding_rs", + "futures-util", + "http", "httparse", + "log", "memchr", - "pin-project-lite", - "try-lock", + "mime", + "spin 0.9.8", + "version_check", ] [[package]] @@ -1825,7 +1927,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f346ff70e7dbfd675fe90590b92d59ef2de15a8779ae305ebcbfd3f0caf59be4" dependencies = [ "autocfg", - "bitflags", + "bitflags 1.3.2", "cfg-if", "libc", "memoffset 0.6.5", @@ -1838,7 +1940,7 @@ version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfdda3d196821d6af13126e40375cdf7da646a96114af134d5f417a9a1dc8e1a" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cfg-if", "libc", "memoffset 0.7.1", @@ -1872,16 +1974,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "num-integer" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" -dependencies = [ - "autocfg", - "num-traits", -] - [[package]] name = "num-traits" version = "0.2.15" @@ -1893,36 +1985,36 @@ dependencies = [ [[package]] name = "num_cpus" -version = "1.15.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "hermit-abi 0.2.6", + "hermit-abi 0.3.2", "libc", ] [[package]] name = "object" -version = "0.30.3" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea86265d3d3dcb6a27fc51bd29a4bf387fae9d2986b823079d4986af253eb439" +checksum = "8bda667d9f2b5051b8833f59f3bf748b28ef54f850f4fcb389a252aa383866d1" dependencies = [ "memchr", ] [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "openssl" -version = "0.10.50" +version = "0.10.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e30d8bc91859781f0a943411186324d580f2bbeb71b452fe91ae344806af3f1" +checksum = "345df152bc43501c5eb9e4654ff05f794effb78d4efe3d53abc158baddc0703d" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cfg-if", "foreign-types", "libc", @@ -1939,7 +2031,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.14", + "syn 2.0.25", ] [[package]] @@ -1950,9 +2042,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.85" +version = "0.9.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d3d193fb1488ad46ffe3aaabc912cc931d02ee8518fe2959aea8ef52718b0c0" +checksum = "374533b0e45f3a7ced10fcaeccca020e66656bc03dac384f852e4e5a7a8104a6" dependencies = [ "cc", "libc", @@ -1967,7 +2059,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ccd746e37177e1711c20dd619a1620f34f5c8b569c53590a72dedd5344d8924a" dependencies = [ "dlv-list", - "hashbrown", + "hashbrown 0.12.3", +] + +[[package]] +name = "orion" +version = "0.17.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b11468cc6afd61a126fe3f91cc4cc8a0dbe7917d0a4b5e8357ba91cc47444462" +dependencies = [ + "fiat-crypto", + "subtle", + "zeroize", ] [[package]] @@ -1976,29 +2079,71 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" +[[package]] +name = "p384" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70786f51bcc69f6a4c0360e063a4cac5419ef7c5cd5b3c99ad70f3be5ba79209" +dependencies = [ + "ecdsa", + "elliptic-curve", + "primeorder", + "sha2", +] + [[package]] name = "parking" version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14f2252c834a40ed9bb5422029649578e63aa341ac401f74e719dd1afda8394e" +[[package]] +name = "pasetors" +version = "0.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba765699a309908d55950919a3445e9491453e89b2587b1b2abe4143a48894c0" +dependencies = [ + "ct-codecs", + "ed25519-compact", + "getrandom", + "orion", + "p384", + "rand_core", + "regex", + "serde", + "serde_json", + "sha2", + "subtle", + "time", + "zeroize", +] + [[package]] name = "pathdiff" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" +[[package]] +name = "pem-rfc7468" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412" +dependencies = [ + "base64ct", +] + [[package]] name = "percent-encoding" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" +checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" [[package]] name = "pest" -version = "2.5.7" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b1403e8401ad5dedea73c626b99758535b342502f8d1e361f4a2dd952749122" +checksum = "f73935e4d55e2abf7f130186537b19e7a4abc886a0252380b59248af473a3fc9" dependencies = [ "thiserror", "ucd-trie", @@ -2006,9 +2151,9 @@ dependencies = [ [[package]] name = "pest_derive" -version = "2.5.7" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be99c4c1d2fc2769b1d00239431d711d08f6efedcecb8b6e30707160aee99c15" +checksum = "aef623c9bbfa0eedf5a0efba11a5ee83209c326653ca31ff019bec3a95bfff2b" dependencies = [ "pest", "pest_generator", @@ -2016,22 +2161,22 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.5.7" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e56094789873daa36164de2e822b3888c6ae4b4f9da555a1103587658c805b1e" +checksum = "b3e8cba4ec22bada7fc55ffe51e2deb6a0e0db2d0b7ab0b103acc80d2510c190" dependencies = [ "pest", "pest_meta", "proc-macro2", "quote", - "syn 2.0.14", + "syn 2.0.25", ] [[package]] name = "pest_meta" -version = "2.5.7" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6733073c7cff3d8459fda0e42f13a047870242aed8b509fe98000928975f359e" +checksum = "a01f71cb40bd8bb94232df14b946909e14660e33fc05db3e50ae2a82d7ea0ca0" dependencies = [ "once_cell", "pest", @@ -2040,29 +2185,29 @@ dependencies = [ [[package]] name = "pin-project" -version = "1.0.12" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad29a609b6bcd67fee905812e544992d216af9d755757c05ed2d0e15a74c6ecc" +checksum = "030ad2bc4db10a8944cb0d837f158bdfec4d4a4873ab701a95046770d11f8842" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.0.12" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55" +checksum = "ec2e072ecce94ec471b13398d5402c188e76ac03cf74dd1a975161b23a3f6d9c" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.25", ] [[package]] name = "pin-project-lite" -version = "0.2.9" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" +checksum = "4c40d25201921e5ff0c862a505c6557ea88568a4e3ace775ab55e93f2f4f9d57" [[package]] name = "pin-utils" @@ -2070,20 +2215,30 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + [[package]] name = "pkg-config" -version = "0.3.26" +version = "0.3.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" +checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" [[package]] name = "polling" -version = "2.7.0" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4be1c66a6add46bff50935c313dae30a5030cf8385c5206e8a95e9e9def974aa" +checksum = "4b2d323e8ca7996b3e23126511a523f7e62924d93ecd5ae73b333815b0eb3dce" dependencies = [ "autocfg", - "bitflags", + "bitflags 1.3.2", "cfg-if", "concurrent-queue", "libc", @@ -2098,6 +2253,15 @@ version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +[[package]] +name = "primeorder" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c2fcef82c0ec6eefcc179b978446c399b3cdf73c392c35604e399eee6df1ee3" +dependencies = [ + "elliptic-curve", +] + [[package]] name = "proc-macro-tracing" version = "0.1.0" @@ -2109,9 +2273,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.56" +version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b63bdb0cd06f1f4dedf69b254734f9b45af66e4a031e42a7480257d9898b435" +checksum = "78803b62cbf1f46fde80d7c0e803111524b9877184cfe7c3033659490ac7a7da" dependencies = [ "unicode-ident", ] @@ -2138,7 +2302,7 @@ name = "prusti-common" version = "0.1.0" dependencies = [ "config", - "itertools", + "itertools 0.11.0", "lazy_static", "log", "prusti-utils", @@ -2225,9 +2389,9 @@ dependencies = [ [[package]] name = "prusti-specs" -version = "0.1.7" +version = "0.1.9" dependencies = [ - "itertools", + "itertools 0.11.0", "proc-macro2", "quote", "rustc-hash", @@ -2255,13 +2419,13 @@ version = "0.1.0" dependencies = [ "config", "ctrlc", - "itertools", + "itertools 0.11.0", "lazy_static", "log", "nix 0.26.2", "rustc-hash", "serde", - "toml 0.7.3", + "toml 0.7.6", "uuid", "walkdir", "winapi", @@ -2274,7 +2438,7 @@ dependencies = [ "backtrace", "derive_more", "diffy", - "itertools", + "itertools 0.11.0", "lazy_static", "log", "num-traits", @@ -2294,9 +2458,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.26" +version = "1.0.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "573015e8ab27661678357f27dc26460738fd2b6c86e46f386fde94cb5d913105" dependencies = [ "proc-macro2", ] @@ -2359,7 +2523,7 @@ version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" dependencies = [ - "bitflags", + "bitflags 1.3.2", ] [[package]] @@ -2368,7 +2532,7 @@ version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" dependencies = [ - "bitflags", + "bitflags 1.3.2", ] [[package]] @@ -2384,13 +2548,14 @@ dependencies = [ [[package]] name = "regex" -version = "1.7.3" +version = "1.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b1f693b24f6ac912f4893ef08244d70b6067480d2f1a46e950c9691e6749d1d" +checksum = "b2eae68fc220f7cf2532e4494aded17545fce192d59cd996e0fe7887f4ceb575" dependencies = [ "aho-corasick", "memchr", - "regex-syntax", + "regex-automata 0.3.2", + "regex-syntax 0.7.3", ] [[package]] @@ -2399,7 +2564,18 @@ version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" dependencies = [ - "regex-syntax", + "regex-syntax 0.6.29", +] + +[[package]] +name = "regex-automata" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83d3daa6976cffb758ec878f108ba0e062a45b2d6ca3a2cca965338855476caf" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax 0.7.3", ] [[package]] @@ -2409,13 +2585,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] -name = "remove_dir_all" -version = "0.5.3" +name = "regex-syntax" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" -dependencies = [ - "winapi", -] +checksum = "2ab07dc67230e4a4718e70fd5c20055a4334b121f1f9db8fe63ef39ce9b8c846" [[package]] name = "remove_dir_all" @@ -2432,11 +2605,11 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.11.16" +version = "0.11.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27b71749df584b7f4cac2c426c127a7c785a5106cc98f7a8feb044115f0fa254" +checksum = "cde824a14b7c14f85caff81225f411faacc04a2013f41670f41443742b1c1c55" dependencies = [ - "base64 0.21.0", + "base64 0.21.2", "bytes", "encoding_rs", "futures-core", @@ -2465,10 +2638,20 @@ dependencies = [ "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "webpki-roots", + "webpki-roots 0.22.6", "winreg", ] +[[package]] +name = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +dependencies = [ + "hmac", + "subtle", +] + [[package]] name = "ring" version = "0.16.20" @@ -2478,7 +2661,7 @@ dependencies = [ "cc", "libc", "once_cell", - "spin", + "spin 0.5.2", "untrusted", "web-sys", "winapi", @@ -2491,7 +2674,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "88073939a61e5b7680558e6be56b419e208420c2adb92be54921fa6b72283f1a" dependencies = [ "base64 0.13.1", - "bitflags", + "bitflags 1.3.2", "serde", ] @@ -2507,9 +2690,9 @@ dependencies = [ [[package]] name = "rustc-demangle" -version = "0.1.22" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4a36c42d1873f9a77c53bde094f9664d9891bc604a45b4798fd2c389ed12e5b" +checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" [[package]] name = "rustc-hash" @@ -2540,50 +2723,83 @@ dependencies = [ [[package]] name = "rustix" -version = "0.37.11" +version = "0.37.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85597d61f83914ddeba6a47b3b8ffe7365107221c2e557ed94426489fefb5f77" +checksum = "4d69718bf81c6127a49dc64e44a742e8bb9213c0ff8869a22c308f84c1d4ab06" dependencies = [ - "bitflags", + "bitflags 1.3.2", "errno", "io-lifetimes", "libc", - "linux-raw-sys", + "linux-raw-sys 0.3.8", + "windows-sys 0.48.0", +] + +[[package]] +name = "rustix" +version = "0.38.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac5ffa1efe7548069688cd7028f32591853cd7b5b756d41bcffd2353e4fc75b4" +dependencies = [ + "bitflags 2.3.3", + "errno", + "libc", + "linux-raw-sys 0.4.3", "windows-sys 0.48.0", ] [[package]] name = "rustls" -version = "0.20.8" +version = "0.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fff78fc74d175294f4e83b28343315ffcfb114b156f0185e9741cb5570f50e2f" +checksum = "b19faa85ecb5197342b54f987b142fb3e30d0c90da40f80ef4fa9a726e6676ed" dependencies = [ "log", "ring", + "rustls-webpki 0.101.1", "sct", - "webpki", ] [[package]] name = "rustls-pemfile" -version = "1.0.2" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d3987094b1d07b653b7dfdc3f70ce9a1da9c51ac18c1b06b662e4f9a0e9f4b2" +dependencies = [ + "base64 0.21.2", +] + +[[package]] +name = "rustls-webpki" +version = "0.100.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d194b56d58803a43635bdc398cd17e383d6f71f9182b9a192c127ca42494a59b" +checksum = "d6207cd5ed3d8dca7816f8f3725513a34609c0c765bf652b8c3cb4cfd87db46b" dependencies = [ - "base64 0.21.0", + "ring", + "untrusted", +] + +[[package]] +name = "rustls-webpki" +version = "0.101.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15f36a6828982f422756984e47912a7a51dcbc2a197aa791158f8ca61cd8204e" +dependencies = [ + "ring", + "untrusted", ] [[package]] name = "rustversion" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f3208ce4d8448b3f3e7d168a73f5e0c43a61e32930de3bceeccedb388b6bf06" +checksum = "dc31bd9b61a32c31f9650d18add92aa83a49ba979c143eefd27fe7177b05bd5f" [[package]] name = "rustwide" -version = "0.15.2" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1b0070cdf593a5b66ba6160974bbfb504a837f8c06f3357a623c9a7b6619c64" +checksum = "4f77082ac67ce0958dca987d10f5a994114cd98ee0a81afa6f5bc44fb2e416f0" dependencies = [ "attohttpc", "base64 0.13.1", @@ -2598,7 +2814,7 @@ dependencies = [ "log", "nix 0.25.1", "percent-encoding", - "remove_dir_all 0.7.0", + "remove_dir_all", "scopeguard", "serde", "serde_json", @@ -2614,9 +2830,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.13" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" +checksum = "fe232bdf6be8c8de797b22184ee71118d63780ea42ac85b61d1baa6d3b782ae9" [[package]] name = "same-file" @@ -2629,11 +2845,11 @@ dependencies = [ [[package]] name = "schannel" -version = "0.1.21" +version = "0.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "713cfb06c7059f3588fb8044c0fad1d09e3c01d225e25b9220dbfdcf16dbb1b3" +checksum = "0c3733bf4cf7ea0880754e19cb5a462007c4a8c1914bff372ccc95b464f1df88" dependencies = [ - "windows-sys 0.42.0", + "windows-sys 0.48.0", ] [[package]] @@ -2648,12 +2864,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" -[[package]] -name = "scratch" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1792db035ce95be60c3f8853017b3999209281c24e2ba5bc8e59bf97a0c590c1" - [[package]] name = "sct" version = "0.7.0" @@ -2664,13 +2874,27 @@ dependencies = [ "untrusted", ] +[[package]] +name = "sec1" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0aec48e813d6b90b15f0b8948af3c63483992dee44c03e9930b3eebdabe046e" +dependencies = [ + "base16ct", + "der", + "generic-array", + "pkcs8", + "subtle", + "zeroize", +] + [[package]] name = "security-framework" -version = "2.8.2" +version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a332be01508d814fed64bf28f798a146d73792121129962fdf335bb3c49a4254" +checksum = "1fc758eb7bffce5b308734e9b0c1468893cae9ff70ebf13e7090be8dcbcc83a8" dependencies = [ - "bitflags", + "bitflags 1.3.2", "core-foundation", "core-foundation-sys", "libc", @@ -2679,9 +2903,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.8.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31c9bb296072e961fcbd8853511dd39c2d8be2deb1e17c6860b1d30732b323b4" +checksum = "f51d0c0d83bec45f16480d0ce0058397a69e48fcdc52d1dc8855fb68acbd31a7" dependencies = [ "core-foundation-sys", "libc", @@ -2695,29 +2919,29 @@ checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed" [[package]] name = "serde" -version = "1.0.160" +version = "1.0.171" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb2f3770c8bce3bcda7e149193a069a0f4365bda1fa5cd88e03bca26afc1216c" +checksum = "30e27d1e4fd7659406c492fd6cfaf2066ba8773de45ca75e855590f856dc34a9" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.160" +version = "1.0.171" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291a097c63d8497e00160b166a967a4a79c64f3facdd01cbd7502231688d77df" +checksum = "389894603bd18c46fa56231694f8d827779c0951a667087194cf9de94ed24682" dependencies = [ "proc-macro2", "quote", - "syn 2.0.14", + "syn 2.0.25", ] [[package]] name = "serde_json" -version = "1.0.95" +version = "1.0.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d721eca97ac802aa7777b701877c8004d950fc142651367300d21c1cc0194744" +checksum = "0f1e14e89be7aa4c4b78bdbdc9eb5bf8517829a600ae8eaa39a6e1d960b5185c" dependencies = [ "itoa", "ryu", @@ -2726,9 +2950,9 @@ dependencies = [ [[package]] name = "serde_spanned" -version = "0.6.1" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0efd8caf556a6cebd3b285caf480045fcc1ac04f6bd786b09a6f11af30c4fcf4" +checksum = "96426c9936fd7a0124915f9185ea1d20aa9445cc9821142f0a73bc9207a2e186" dependencies = [ "serde", ] @@ -2758,9 +2982,9 @@ dependencies = [ [[package]] name = "sha2" -version = "0.10.6" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" +checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8" dependencies = [ "cfg-if", "cpufeatures", @@ -2801,6 +3025,16 @@ dependencies = [ "libc", ] +[[package]] +name = "signature" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e1788eed21689f9cf370582dfc467ef36ed9c707f073528ddafa8d83e3b8500" +dependencies = [ + "digest", + "rand_core", +] + [[package]] name = "similar" version = "2.2.1" @@ -2818,9 +3052,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" +checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" [[package]] name = "smt-log-analyzer" @@ -2832,11 +3066,12 @@ dependencies = [ [[package]] name = "snapbox" -version = "0.2.10" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "767a1d5da232b6959cd1bd5c9e8db8a7cce09c3038e89deedb49a549a2aefd93" +checksum = "f6bccd62078347f89a914e3004d94582e13824d4e3d8a816317862884c423835" dependencies = [ - "concolor", + "anstream", + "anstyle", "content_inspector", "dunce", "filetime", @@ -2845,14 +3080,16 @@ dependencies = [ "snapbox-macros", "tempfile", "walkdir", - "yansi", ] [[package]] name = "snapbox-macros" -version = "0.2.1" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c01dea7e04cbb27ef4c86e9922184608185f7cd95c1763bc30d727cda4a5e930" +checksum = "eaaf09df9f0eeae82be96290918520214530e738a7fe5a351b0f24cf77c0ca31" +dependencies = [ + "anstream", +] [[package]] name = "socket2" @@ -2870,6 +3107,22 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" +[[package]] +name = "spin" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" + +[[package]] +name = "spki" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d1e996ef02c474957d681f1b05213dfb0abab947b446a62d37770b23500184a" +dependencies = [ + "base64ct", + "der", +] + [[package]] name = "static_assertions" version = "1.1.0" @@ -2882,6 +3135,12 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +[[package]] +name = "subtle" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" + [[package]] name = "syn" version = "1.0.109" @@ -2895,9 +3154,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.14" +version = "2.0.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcf316d5356ed6847742d036f8a39c3b8435cac10bd528a4bd461928a6ab34d5" +checksum = "15e3fc8c0c74267e2df136e5e5fb656a464158aa57624053375eb9c8c6e25ae2" dependencies = [ "proc-macro2", "quote", @@ -2942,15 +3201,16 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.5.0" +version = "3.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9fbec84f381d5795b08656e4912bec604d162bff9291d6189a78f4c8ab87998" +checksum = "31c0432476357e58790aaa47a8efb0c5138f137343f3b5f23bd36a27e3b0a6d6" dependencies = [ + "autocfg", "cfg-if", "fastrand", "redox_syscall 0.3.5", - "rustix", - "windows-sys 0.45.0", + "rustix 0.37.23", + "windows-sys 0.48.0", ] [[package]] @@ -2988,14 +3248,14 @@ dependencies = [ "prusti-launch", "rustwide", "serde", - "toml 0.7.3", + "toml 0.7.6", ] [[package]] name = "tester" -version = "0.9.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0639d10d8f4615f223a57275cf40f9bdb7cfbb806bcb7f7cc56e3beb55a576eb" +checksum = "89e8bf7e0eb2dd7b4228cc1b6821fc5114cd6841ae59f652a85488c016091e5f" dependencies = [ "cfg-if", "getopts", @@ -3006,22 +3266,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.40" +version = "1.0.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac" +checksum = "a35fc5b8971143ca348fa6df4f024d4d55264f3468c71ad1c2f365b0a4d58c42" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.40" +version = "1.0.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" +checksum = "463fe12d7993d3b327787537ce8dd4dfa058de32fc2b195ef3cde03dc4771e8f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.14", + "syn 2.0.25", ] [[package]] @@ -3034,6 +3294,33 @@ dependencies = [ "once_cell", ] +[[package]] +name = "time" +version = "0.3.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59e399c068f43a5d116fedaf73b203fa4f9c519f17e2b34f63221d3792f81446" +dependencies = [ + "itoa", + "serde", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" + +[[package]] +name = "time-macros" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96ba15a897f3c86766b757e5ac7221554c6750054d74d5b28844fce5fb36a6c4" +dependencies = [ + "time-core", +] + [[package]] name = "tinyvec" version = "1.6.0" @@ -3051,11 +3338,12 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.27.0" +version = "1.29.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0de47a4eecbe11f498978a9b29d792f0d2692d1dd003650c24c76510e3bc001" +checksum = "532826ff75199d5833b9d2c5fe410f29235e25704ee5f0ef599fb51c21f4a4da" dependencies = [ "autocfg", + "backtrace", "bytes", "libc", "mio", @@ -3063,25 +3351,24 @@ dependencies = [ "pin-project-lite", "signal-hook-registry", "socket2", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] name = "tokio-rustls" -version = "0.23.4" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c43ee83903113e03984cb9e5cebe6c04a5116269e900e3ddba8f068a62adda59" +checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" dependencies = [ "rustls", "tokio", - "webpki", ] [[package]] name = "tokio-stream" -version = "0.1.12" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fb52b74f05dbf495a8fba459fdc331812b96aa086d9eb78101fa0d4569c3313" +checksum = "397c988d37662c7dda6d2208364a706264bf3d6138b11d436cbac0ad38832842" dependencies = [ "futures-core", "pin-project-lite", @@ -3102,9 +3389,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.7" +version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5427d89453009325de0d8f342c9490009f76e999cb7672d77e46267448f7e6b2" +checksum = "806fe8c2c87eccc8b3267cbae29ed3ab2d0bd37fca70ab622e46aaa9375ddb7d" dependencies = [ "bytes", "futures-core", @@ -3125,45 +3412,32 @@ dependencies = [ [[package]] name = "toml" -version = "0.7.3" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b403acf6f2bb0859c93c7f0d967cb4a75a7ac552100f9322faf64dc047669b21" +checksum = "c17e963a819c331dcacd7ab957d80bc2b9a9c1e71c804826d2f283dd65306542" dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.19.8", + "toml_edit", ] [[package]] name = "toml_datetime" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ab8ed2edee10b50132aed5f331333428b011c99402b5a534154ed15746f9622" -dependencies = [ - "serde", -] - -[[package]] -name = "toml_edit" -version = "0.14.4" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5376256e44f2443f8896ac012507c19a012df0fe8758b55246ae51a2279db51f" +checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" dependencies = [ - "combine", - "indexmap", - "itertools", - "kstring", "serde", ] [[package]] name = "toml_edit" -version = "0.19.8" +version = "0.19.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "239410c8609e8125456927e6707163a3b1fdb40561e4b803bc041f466ccfdc13" +checksum = "c500344a19072298cd05a7224b3c0c629348b78692bf48466c5238656e315a78" dependencies = [ - "indexmap", + "indexmap 2.0.0", "serde", "serde_spanned", "toml_datetime", @@ -3199,13 +3473,13 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.23" +version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4017f8f45139870ca7e672686113917c71c7a6e02d4924eda67186083c03081a" +checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.25", ] [[package]] @@ -3221,9 +3495,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.30" +version = "0.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a" +checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" dependencies = [ "once_cell", "valuable", @@ -3242,9 +3516,9 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.3.16" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6176eae26dd70d0c919749377897b54a9276bd7061339665dd68777926b5a70" +checksum = "30a651bc37f915e81f087d86e62a18eec5f79550c7faff886f7090b4ea757c77" dependencies = [ "matchers", "nu-ansi-term", @@ -3291,9 +3565,9 @@ checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" [[package]] name = "ucd-trie" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e79c4d996edb816c91e4308506774452e55e95c3c9de07b6729e17e15a5ef81" +checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9" [[package]] name = "unicase" @@ -3312,9 +3586,9 @@ checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "22049a19f4a68748a168c0fc439f9516686aa045927ff767eca0a85101fb6e73" [[package]] name = "unicode-normalization" @@ -3345,25 +3619,25 @@ checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" [[package]] name = "ureq" -version = "2.6.2" +version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "338b31dd1314f68f3aabf3ed57ab922df95ffcd902476ca7ba3c4ce7b908c46d" +checksum = "0b11c96ac7ee530603dcdf68ed1557050f374ce55a5a07193ebf8cbc9f8927e9" dependencies = [ - "base64 0.13.1", + "base64 0.21.2", "flate2", "log", "once_cell", "rustls", + "rustls-webpki 0.100.1", "url", - "webpki", - "webpki-roots", + "webpki-roots 0.23.1", ] [[package]] name = "url" -version = "2.3.1" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643" +checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb" dependencies = [ "form_urlencoded", "idna", @@ -3384,9 +3658,9 @@ checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" [[package]] name = "uuid" -version = "1.3.1" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b55a3fef2a1e3b3a00ce878640918820d3c51081576ac657d23af9fc7928fdb" +checksum = "d023da39d1fde5a8a3fe1f3e01ca9632ada0a63e9797de55a879d6e2236277be" dependencies = [ "getrandom", ] @@ -3399,13 +3673,9 @@ checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" [[package]] name = "value-bag" -version = "1.0.0-alpha.9" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2209b78d1249f7e6f3293657c9779fe31ced465df091bbd433a1cf88e916ec55" -dependencies = [ - "ctor", - "version_check", -] +checksum = "d92ccd67fb88503048c01b59152a04effd0782d035a83a6d256ce6085f08f4a3" [[package]] name = "vcpkg" @@ -3467,7 +3737,7 @@ dependencies = [ "derivative", "derive_more", "index_vec", - "itertools", + "itertools 0.11.0", "lazy_static", "log", "proc-macro2", @@ -3512,19 +3782,18 @@ dependencies = [ [[package]] name = "want" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" dependencies = [ - "log", "try-lock", ] [[package]] name = "warp" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27e1a710288f0f91a98dd8a74f05b76a10768db245ce183edf64dc1afdc3016c" +checksum = "ba431ef570df1287f7f8b07e376491ad54f84d26ac473489427231e1718e1f69" dependencies = [ "bytes", "futures-channel", @@ -3535,7 +3804,7 @@ dependencies = [ "log", "mime", "mime_guess", - "multiparty", + "multer", "percent-encoding", "pin-project", "rustls-pemfile", @@ -3559,9 +3828,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.84" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31f8dcbc21f30d9b8f2ea926ecb58f6b91192c17e9d33594b3df58b2007ca53b" +checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -3569,24 +3838,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.84" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95ce90fd5bcc06af55a641a86428ee4229e44e07033963a2290a8e241607ccb9" +checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.25", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.34" +version = "0.4.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f219e0d211ba40266969f6dbdd90636da12f75bee4fc9d6c23d1260dadb51454" +checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03" dependencies = [ "cfg-if", "js-sys", @@ -3596,9 +3865,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.84" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c21f77c0bedc37fd5dc21f897894a5ca01e7bb159884559461862ae90c0b4c5" +checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -3606,28 +3875,28 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.84" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6" +checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.25", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.84" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d" +checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" [[package]] name = "web-sys" -version = "0.3.61" +version = "0.3.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e33b99f4b23ba3eec1a53ac264e35a755f00e966e0065077d6027c0f575b0b97" +checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" dependencies = [ "js-sys", "wasm-bindgen", @@ -3652,6 +3921,15 @@ dependencies = [ "webpki", ] +[[package]] +name = "webpki-roots" +version = "0.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b03058f88386e5ff5310d9111d53f48b17d732b401aeb83a8d5190f2ac459338" +dependencies = [ + "rustls-webpki 0.100.1", +] + [[package]] name = "wildmatch" version = "1.1.0" @@ -3695,7 +3973,7 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" dependencies = [ - "windows-targets 0.48.0", + "windows-targets 0.48.1", ] [[package]] @@ -3741,7 +4019,7 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "windows-targets 0.48.0", + "windows-targets 0.48.1", ] [[package]] @@ -3761,9 +4039,9 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.48.0" +version = "0.48.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" +checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f" dependencies = [ "windows_aarch64_gnullvm 0.48.0", "windows_aarch64_msvc 0.48.0", @@ -3890,9 +4168,9 @@ checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" [[package]] name = "winnow" -version = "0.4.1" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae8970b36c66498d8ff1d66685dc86b91b29db0c7739899012f63a63814b4b28" +checksum = "81a2094c43cc94775293eaa0e499fbc30048a6d824ac82c0351a8c0bf9112529" dependencies = [ "memchr", ] @@ -3925,7 +4203,7 @@ dependencies = [ ] [[package]] -name = "yansi" -version = "0.5.1" +name = "zeroize" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" +checksum = "2a0956f1ba7c7909bfb66c2e9e4124ab6f6482560f6628b5aaeba39207c9aad9" diff --git a/Cargo.toml b/Cargo.toml index 35b669b8d23..fd6efd1f9dc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,6 +25,7 @@ members = [ exclude = [ "docs/dummy" ] +resolver = "2" [profile.dev] debug = 1 diff --git a/analysis/Cargo.toml b/analysis/Cargo.toml index 03af388fc0e..b1ef5e53f44 100644 --- a/analysis/Cargo.toml +++ b/analysis/Cargo.toml @@ -15,7 +15,7 @@ prusti-rustc-interface = { path = "../prusti-rustc-interface" } tracing = { path = "../tracing" } [dev-dependencies] -compiletest_rs = "0.9" +compiletest_rs = "0.10" glob = "0.3" [package.metadata.rust-analyzer] diff --git a/analysis/src/bin/analysis-driver.rs b/analysis/src/bin/analysis-driver.rs index 58e17900f23..e6bfba65d4f 100644 --- a/analysis/src/bin/analysis-driver.rs +++ b/analysis/src/bin/analysis-driver.rs @@ -13,14 +13,14 @@ use analysis::{ }; use prusti_rustc_interface::{ ast::ast, - borrowck::BodyWithBorrowckFacts, + borrowck::consumers::{self, BodyWithBorrowckFacts}, data_structures::fx::FxHashMap, driver::Compilation, hir::def_id::{DefId, LocalDefId}, interface::{interface, Config, Queries}, middle::{ + query::{queries::mir_borrowck::ProvidedValue, ExternProviders, Providers}, ty, - ty::query::{query_values::mir_borrowck, ExternProviders, Providers}, }, polonius_engine::{Algorithm, Output}, session::{Attribute, Session}, @@ -116,10 +116,11 @@ mod mir_storage { } #[allow(clippy::needless_lifetimes)] -fn mir_borrowck<'tcx>(tcx: ty::TyCtxt<'tcx>, def_id: LocalDefId) -> mir_borrowck<'tcx> { - let body_with_facts = prusti_rustc_interface::borrowck::consumers::get_body_with_borrowck_facts( +fn mir_borrowck<'tcx>(tcx: ty::TyCtxt<'tcx>, def_id: LocalDefId) -> ProvidedValue<'tcx> { + let body_with_facts = consumers::get_body_with_borrowck_facts( tcx, - ty::WithOptConstParam::unknown(def_id), + def_id, + consumers::ConsumerOptions::PoloniusOutputFacts, ); // SAFETY: This is safe because we are feeding in the same `tcx` that is // going to be used as a witness when pulling out the data. @@ -190,12 +191,17 @@ impl prusti_rustc_interface::driver::Callbacks for OurCompilerCalls { // that was used to store the data. let mut body_with_facts = unsafe { self::mir_storage::retrieve_mir_body(tcx, local_def_id) }; - body_with_facts.output_facts = Rc::new(Output::compute( - &body_with_facts.input_facts, + body_with_facts.output_facts = Some(Rc::new(Output::compute( + body_with_facts.input_facts.as_ref().unwrap(), Algorithm::Naive, true, - )); - assert!(!body_with_facts.input_facts.cfg_edge.is_empty()); + ))); + assert!(!body_with_facts + .input_facts + .as_ref() + .unwrap() + .cfg_edge + .is_empty()); let body = &body_with_facts.body; match abstract_domain { diff --git a/analysis/src/bin/gen-accessibility-driver.rs b/analysis/src/bin/gen-accessibility-driver.rs index 66c9ddc548b..5c6d1c36cfb 100644 --- a/analysis/src/bin/gen-accessibility-driver.rs +++ b/analysis/src/bin/gen-accessibility-driver.rs @@ -6,15 +6,15 @@ use analysis::domains::DefinitelyAccessibleAnalysis; use prusti_rustc_interface::{ - borrowck::BodyWithBorrowckFacts, + borrowck::consumers::{self, BodyWithBorrowckFacts}, data_structures::fx::FxHashMap, driver::Compilation, hir, hir::def_id::LocalDefId, interface::{interface, Config, Queries}, middle::{ + query::{queries::mir_borrowck::ProvidedValue, ExternProviders, Providers}, ty, - ty::query::{query_values::mir_borrowck, ExternProviders, Providers}, }, polonius_engine::{Algorithm, Output}, session::Session, @@ -69,10 +69,11 @@ mod mir_storage { } #[allow(clippy::needless_lifetimes)] -fn mir_borrowck<'tcx>(tcx: ty::TyCtxt<'tcx>, def_id: LocalDefId) -> mir_borrowck<'tcx> { - let body_with_facts = prusti_rustc_interface::borrowck::consumers::get_body_with_borrowck_facts( +fn mir_borrowck<'tcx>(tcx: ty::TyCtxt<'tcx>, def_id: LocalDefId) -> ProvidedValue<'tcx> { + let body_with_facts = consumers::get_body_with_borrowck_facts( tcx, - ty::WithOptConstParam::unknown(def_id), + def_id, + consumers::ConsumerOptions::PoloniusOutputFacts, ); // SAFETY: This is safe because we are feeding in the same `tcx` that is // going to be used as a witness when pulling out the data. @@ -135,11 +136,11 @@ impl prusti_rustc_interface::driver::Callbacks for OurCompilerCalls { // that was used to store the data. let mut body_with_facts = unsafe { self::mir_storage::retrieve_mir_body(tcx, local_def_id) }; - body_with_facts.output_facts = Rc::new(Output::compute( - &body_with_facts.input_facts, + body_with_facts.output_facts = Some(Rc::new(Output::compute( + body_with_facts.input_facts.as_ref().unwrap(), Algorithm::Naive, true, - )); + ))); // Skip macro expansions let mir_span = body_with_facts.body.span; @@ -175,7 +176,12 @@ impl prusti_rustc_interface::driver::Callbacks for OurCompilerCalls { // Generate and print the programs with the additional statements to check accessibility. for (num, (local_def_id, body_with_facts)) in def_ids_with_body.iter().enumerate() { - assert!(!body_with_facts.input_facts.cfg_edge.is_empty()); + assert!(!body_with_facts + .input_facts + .as_ref() + .unwrap() + .cfg_edge + .is_empty()); let body = &body_with_facts.body; if num > 0 { diff --git a/analysis/src/domains/definitely_accessible/analysis.rs b/analysis/src/domains/definitely_accessible/analysis.rs index 3ff2146c033..6e5684137b4 100644 --- a/analysis/src/domains/definitely_accessible/analysis.rs +++ b/analysis/src/domains/definitely_accessible/analysis.rs @@ -14,7 +14,7 @@ use crate::{ PointwiseState, }; use prusti_rustc_interface::{ - borrowck::BodyWithBorrowckFacts, + borrowck::consumers::BodyWithBorrowckFacts, data_structures::fx::{FxHashMap, FxHashSet}, middle::{mir, ty::TyCtxt}, span::def_id::DefId, @@ -48,8 +48,8 @@ impl<'mir, 'tcx: 'mir> DefinitelyAccessibleAnalysis<'mir, 'tcx> { let borrowed_analysis = MaybeBorrowedAnalysis::new(self.tcx, self.body_with_facts); let def_init = def_init_analysis.run_fwd_analysis()?; let borrowed = borrowed_analysis.run_analysis()?; - let location_table = &self.body_with_facts.location_table; - let borrowck_out_facts = self.body_with_facts.output_facts.as_ref(); + let location_table = self.body_with_facts.location_table.as_ref().unwrap(); + let borrowck_out_facts = self.body_with_facts.output_facts.as_ref().unwrap().as_ref(); let var_live_on_entry: FxHashMap<_, _> = borrowck_out_facts .var_live_on_entry .iter() diff --git a/analysis/src/domains/definitely_initialized/state.rs b/analysis/src/domains/definitely_initialized/state.rs index 4a1e213c2ef..84e43077735 100644 --- a/analysis/src/domains/definitely_initialized/state.rs +++ b/analysis/src/domains/definitely_initialized/state.rs @@ -261,11 +261,12 @@ impl<'mir, 'tcx: 'mir> DefinitelyInitializedState<'mir, 'tcx> { place, target, unwind, + .. } => { new_state.set_place_uninitialised(place); res_vec.push((target, new_state)); - if let Some(bb) = unwind { + if let mir::UnwindAction::Cleanup(bb) = unwind { // imprecision for error states res_vec.push((bb, Self::new_top(self.def_id, self.mir, self.tcx))); } @@ -275,7 +276,7 @@ impl<'mir, 'tcx: 'mir> DefinitelyInitializedState<'mir, 'tcx> { ref args, destination, target, - cleanup, + unwind, .. } => { for arg in args.iter() { @@ -287,7 +288,7 @@ impl<'mir, 'tcx: 'mir> DefinitelyInitializedState<'mir, 'tcx> { res_vec.push((bb, new_state)); } - if let Some(bb) = cleanup { + if let mir::UnwindAction::Cleanup(bb) = unwind { // imprecision for error states res_vec.push((bb, Self::new_top(self.def_id, self.mir, self.tcx))); } @@ -295,13 +296,13 @@ impl<'mir, 'tcx: 'mir> DefinitelyInitializedState<'mir, 'tcx> { mir::TerminatorKind::Assert { ref cond, target, - cleanup, + unwind, .. } => { new_state.apply_operand_effect(cond, move_out_copy_types); res_vec.push((target, new_state)); - if let Some(bb) = cleanup { + if let mir::UnwindAction::Cleanup(bb) = unwind { // imprecision for error states res_vec.push((bb, Self::new_top(self.def_id, self.mir, self.tcx))); } diff --git a/analysis/src/domains/framing/analysis.rs b/analysis/src/domains/framing/analysis.rs index 32742fef2d3..980b07d746f 100644 --- a/analysis/src/domains/framing/analysis.rs +++ b/analysis/src/domains/framing/analysis.rs @@ -11,7 +11,7 @@ use crate::{ PointwiseState, }; use prusti_rustc_interface::{ - borrowck::BodyWithBorrowckFacts, + borrowck::consumers::BodyWithBorrowckFacts, middle::{ mir, mir::visit::{NonMutatingUseContext, PlaceContext, Visitor}, @@ -105,7 +105,6 @@ impl<'mir, 'tcx: 'mir> Visitor<'tcx> for ComputeFramingState<'mir, 'tcx> { ) { let place = (*place).into(); match context { - PlaceContext::NonMutatingUse(NonMutatingUseContext::UniqueBorrow) => todo!(), PlaceContext::MutatingUse(_) | PlaceContext::NonMutatingUse(NonMutatingUseContext::Move) => { // No permission can be framed diff --git a/analysis/src/domains/maybe_borrowed/analysis.rs b/analysis/src/domains/maybe_borrowed/analysis.rs index 28442789383..122dcc7ff92 100644 --- a/analysis/src/domains/maybe_borrowed/analysis.rs +++ b/analysis/src/domains/maybe_borrowed/analysis.rs @@ -10,7 +10,7 @@ use crate::{ }; use log::{error, trace}; use prusti_rustc_interface::{ - borrowck::{consumers::RichLocation, BodyWithBorrowckFacts}, + borrowck::consumers::{BodyWithBorrowckFacts, RichLocation}, data_structures::fx::FxHashMap, middle::{mir, ty::TyCtxt}, }; @@ -33,9 +33,9 @@ impl<'mir, 'tcx: 'mir> MaybeBorrowedAnalysis<'mir, 'tcx> { &self, ) -> AnalysisResult>> { let body = &self.body_with_facts.body; - let location_table = &self.body_with_facts.location_table; - let borrowck_in_facts = &self.body_with_facts.input_facts; - let borrowck_out_facts = self.body_with_facts.output_facts.as_ref(); + let location_table = self.body_with_facts.location_table.as_ref().unwrap(); + let borrowck_in_facts = self.body_with_facts.input_facts.as_ref().unwrap(); + let borrowck_out_facts = self.body_with_facts.output_facts.as_ref().unwrap().as_ref(); let loan_issued_at = &borrowck_in_facts.loan_issued_at; let loan_live_at = &borrowck_out_facts.loan_live_at; let loan_issued_at_location: FxHashMap<_, mir::Location> = loan_issued_at diff --git a/analysis/src/domains/reaching_definitions/state.rs b/analysis/src/domains/reaching_definitions/state.rs index 39350192e7b..62058c8140c 100644 --- a/analysis/src/domains/reaching_definitions/state.rs +++ b/analysis/src/domains/reaching_definitions/state.rs @@ -128,7 +128,7 @@ impl<'mir, 'tcx: 'mir> ReachingDefsState<'mir, 'tcx> { mir::TerminatorKind::Call { ref destination, target, - cleanup, + unwind, .. } => { if let Some(bb) = target { @@ -144,7 +144,7 @@ impl<'mir, 'tcx: 'mir> ReachingDefsState<'mir, 'tcx> { res_vec.push((bb, dest_state)); } - if let Some(bb) = cleanup { + if let mir::UnwindAction::Cleanup(bb) = unwind { let mut cleanup_state = self.clone(); // error state -> be conservative & add destination as possible reaching def // while keeping all others diff --git a/analysis/tests/test_cases/definitely_accessible/expired.stdout b/analysis/tests/test_cases/definitely_accessible/expired.stdout index 7b59accc472..63328abb663 100644 --- a/analysis/tests/test_cases/definitely_accessible/expired.stdout +++ b/analysis/tests/test_cases/definitely_accessible/expired.stdout @@ -438,7 +438,7 @@ Result for function main(): "accessible": [], "owned": [] }, - "terminator: drop(_1) -> bb6", + "terminator: drop(_1) -> [return: bb6, unwind terminate]", { "bb6": [ "state:", diff --git a/analysis/tests/test_cases/definitely_accessible/fields.rs b/analysis/tests/test_cases/definitely_accessible/fields.rs index 0ae84f1b940..bcbc0bf27c2 100644 --- a/analysis/tests/test_cases/definitely_accessible/fields.rs +++ b/analysis/tests/test_cases/definitely_accessible/fields.rs @@ -1,3 +1,5 @@ +#![allow(dropping_references)] + #[derive(Clone, Default)] struct T { // Wrap in Box to have non-Copy types diff --git a/analysis/tests/test_cases/definitely_accessible/fields.stdout b/analysis/tests/test_cases/definitely_accessible/fields.stdout index a8881fab293..b1f1682ea5f 100644 --- a/analysis/tests/test_cases/definitely_accessible/fields.stdout +++ b/analysis/tests/test_cases/definitely_accessible/fields.stdout @@ -685,7 +685,7 @@ Result for function main(): "(_1.0: std::boxed::Box)" ] }, - "terminator: drop(_11) -> bb13", + "terminator: drop(_11) -> [return: bb13, unwind terminate]", { "bb13": [ "state:", @@ -918,7 +918,7 @@ Result for function main(): "accessible": [], "owned": [] }, - "terminator: drop(_13) -> bb13", + "terminator: drop(_13) -> [return: bb13, unwind terminate]", { "bb13": [ "state:", @@ -936,7 +936,7 @@ Result for function main(): "accessible": [], "owned": [] }, - "terminator: drop(_3) -> bb13", + "terminator: drop(_3) -> [return: bb13, unwind terminate]", { "bb13": [ "state:", @@ -954,7 +954,7 @@ Result for function main(): "accessible": [], "owned": [] }, - "terminator: drop(_1) -> bb14", + "terminator: drop(_1) -> [return: bb14, unwind terminate]", { "bb14": [ "state:", diff --git a/analysis/tests/test_cases/definitely_accessible/infinite_list.stdout b/analysis/tests/test_cases/definitely_accessible/infinite_list.stdout index b971bd8b0ee..dc86edfb7d1 100644 --- a/analysis/tests/test_cases/definitely_accessible/infinite_list.stdout +++ b/analysis/tests/test_cases/definitely_accessible/infinite_list.stdout @@ -164,7 +164,7 @@ Result for function test1(): "accessible": [], "owned": [] }, - "terminator: drop(_1) -> bb4", + "terminator: drop(_1) -> [return: bb4, unwind terminate]", { "bb4": [ "state:", @@ -316,7 +316,7 @@ Result for function test2(): "_1" ] }, - "terminator: drop(_2) -> bb5", + "terminator: drop(_2) -> [return: bb5, unwind terminate]", { "bb5": [ "state:", @@ -412,7 +412,7 @@ Result for function test2(): "accessible": [], "owned": [] }, - "terminator: drop(_1) -> bb6", + "terminator: drop(_1) -> [return: bb6, unwind terminate]", { "bb6": [ "state:", diff --git a/analysis/tests/test_cases/definitely_accessible/ref_field.stdout b/analysis/tests/test_cases/definitely_accessible/ref_field.stdout index 7cd44ae95ab..2816524e035 100644 --- a/analysis/tests/test_cases/definitely_accessible/ref_field.stdout +++ b/analysis/tests/test_cases/definitely_accessible/ref_field.stdout @@ -939,7 +939,7 @@ Result for function main(): "accessible": [], "owned": [] }, - "terminator: drop(_16) -> bb10", + "terminator: drop(_16) -> [return: bb10, unwind terminate]", { "bb10": [ "state:", @@ -957,7 +957,7 @@ Result for function main(): "accessible": [], "owned": [] }, - "terminator: drop(_1) -> bb12", + "terminator: drop(_1) -> [return: bb12, unwind terminate]", { "bb12": [ "state:", @@ -975,7 +975,7 @@ Result for function main(): "accessible": [], "owned": [] }, - "terminator: drop(_2) -> bb12", + "terminator: drop(_2) -> [return: bb12, unwind terminate]", { "bb12": [ "state:", diff --git a/analysis/tests/test_cases/definitely_initialized/array.rs b/analysis/tests/test_cases/definitely_initialized/array.rs index a128f7b330e..ce548896d52 100644 --- a/analysis/tests/test_cases/definitely_initialized/array.rs +++ b/analysis/tests/test_cases/definitely_initialized/array.rs @@ -1,3 +1,5 @@ +#![allow(dropping_copy_types)] + #[analyzer::run] fn main() { let x = [1, 2, 3]; diff --git a/analysis/tests/test_cases/definitely_initialized/array.stdout b/analysis/tests/test_cases/definitely_initialized/array.stdout index 584132712a2..10abdd188b4 100644 --- a/analysis/tests/test_cases/definitely_initialized/array.stdout +++ b/analysis/tests/test_cases/definitely_initialized/array.stdout @@ -284,7 +284,7 @@ Result for function main(): [], "state before terminator:", [], - "terminator: drop(_7) -> bb7", + "terminator: drop(_7) -> [return: bb7, unwind terminate]", { "bb7": [ "state:", @@ -296,7 +296,7 @@ Result for function main(): [], "state before terminator:", [], - "terminator: drop(_4) -> bb8", + "terminator: drop(_4) -> [return: bb8, unwind terminate]", { "bb8": [ "state:", diff --git a/analysis/tests/test_cases/definitely_initialized/fields.rs b/analysis/tests/test_cases/definitely_initialized/fields.rs index daad1c00a77..dda348eb912 100644 --- a/analysis/tests/test_cases/definitely_initialized/fields.rs +++ b/analysis/tests/test_cases/definitely_initialized/fields.rs @@ -1,3 +1,5 @@ +#![allow(dropping_references)] + #[derive(Clone, Default)] struct T { // Wrap in box to have non-Copy types diff --git a/analysis/tests/test_cases/definitely_initialized/fields.stdout b/analysis/tests/test_cases/definitely_initialized/fields.stdout index f94196af729..de323a654b5 100644 --- a/analysis/tests/test_cases/definitely_initialized/fields.stdout +++ b/analysis/tests/test_cases/definitely_initialized/fields.stdout @@ -478,7 +478,7 @@ Result for function main(): [ "(_1.0: std::boxed::Box)" ], - "terminator: drop(_11) -> bb13", + "terminator: drop(_11) -> [return: bb13, unwind terminate]", { "bb13": [ "state:", @@ -653,7 +653,7 @@ Result for function main(): [], "state before terminator:", [], - "terminator: drop(_13) -> bb13", + "terminator: drop(_13) -> [return: bb13, unwind terminate]", { "bb13": [ "state:", @@ -665,7 +665,7 @@ Result for function main(): [], "state before terminator:", [], - "terminator: drop(_3) -> bb13", + "terminator: drop(_3) -> [return: bb13, unwind terminate]", { "bb13": [ "state:", @@ -677,7 +677,7 @@ Result for function main(): [], "state before terminator:", [], - "terminator: drop(_1) -> bb14", + "terminator: drop(_1) -> [return: bb14, unwind terminate]", { "bb14": [ "state:", diff --git a/analysis/tests/test_cases/framing/ref_field.stdout b/analysis/tests/test_cases/framing/ref_field.stdout index 61ac9657157..c091e46c43b 100644 --- a/analysis/tests/test_cases/framing/ref_field.stdout +++ b/analysis/tests/test_cases/framing/ref_field.stdout @@ -529,7 +529,7 @@ Result for function main(): "frame_accessible": [], "frame_owned": [] }, - "terminator: drop(_9) -> bb10", + "terminator: drop(_9) -> [return: bb10, unwind terminate]", { "bb10": [ "state:", @@ -547,7 +547,7 @@ Result for function main(): "frame_accessible": [], "frame_owned": [] }, - "terminator: drop(_1) -> bb12", + "terminator: drop(_1) -> [return: bb12, unwind terminate]", { "bb12": [ "state:", @@ -565,7 +565,7 @@ Result for function main(): "frame_accessible": [], "frame_owned": [] }, - "terminator: drop(_2) -> bb12", + "terminator: drop(_2) -> [return: bb12, unwind terminate]", { "bb12": [ "state:", diff --git a/analysis/tests/test_cases/framing/rust_issue_63787.stdout b/analysis/tests/test_cases/framing/rust_issue_63787.stdout index a1574869764..b420a60165a 100644 --- a/analysis/tests/test_cases/framing/rust_issue_63787.stdout +++ b/analysis/tests/test_cases/framing/rust_issue_63787.stdout @@ -350,7 +350,7 @@ Result for function break_it(): "frame_accessible": [], "frame_owned": [] }, - "terminator: drop(_7) -> bb8", + "terminator: drop(_7) -> [return: bb8, unwind terminate]", { "bb8": [ "state:", @@ -368,7 +368,7 @@ Result for function break_it(): "frame_accessible": [], "frame_owned": [] }, - "terminator: drop(_4) -> bb8", + "terminator: drop(_4) -> [return: bb8, unwind terminate]", { "bb8": [ "state:", @@ -386,7 +386,7 @@ Result for function break_it(): "frame_accessible": [], "frame_owned": [] }, - "terminator: drop(_2) -> bb9", + "terminator: drop(_2) -> [return: bb9, unwind terminate]", { "bb9": [ "state:", @@ -688,7 +688,7 @@ Result for function main(): "frame_accessible": [], "frame_owned": [] }, - "terminator: drop(_4) -> bb5", + "terminator: drop(_4) -> [return: bb5, unwind terminate]", { "bb5": [ "state:", diff --git a/analysis/tests/test_cases/maybe_borrowed/linked_list.stdout b/analysis/tests/test_cases/maybe_borrowed/linked_list.stdout index bf45a257710..62755fd616c 100644 --- a/analysis/tests/test_cases/maybe_borrowed/linked_list.stdout +++ b/analysis/tests/test_cases/maybe_borrowed/linked_list.stdout @@ -162,7 +162,7 @@ Result for function borrow_fields(): "frozen": [], "blocked": [] }, - "terminator: drop(_1) -> bb4", + "terminator: drop(_1) -> [return: bb4, unwind terminate]", { "bb4": [ "state:", @@ -252,7 +252,7 @@ Result for function last_val_mut(): "frozen": [], "blocked": [] }, - "terminator: falseUnwind -> [real: bb2, cleanup: bb6]", + "terminator: falseUnwind -> [real: bb2, unwind: bb6]", { "bb2": [ "state:", diff --git a/jni-gen/systest/tests/jvm_builtin_classes.rs b/jni-gen/systest/tests/jvm_builtin_classes.rs index 523fe7d12ed..b40bf76d8be 100644 --- a/jni-gen/systest/tests/jvm_builtin_classes.rs +++ b/jni-gen/systest/tests/jvm_builtin_classes.rs @@ -10,7 +10,7 @@ fn string_to_jobject<'a>(env: &JNIEnv<'a>, string: &str) -> JNIResult(env: &JNIEnv<'a>, obj: JObject) -> JNIResult { +fn jobject_to_string(env: &JNIEnv<'_>, obj: JObject) -> JNIResult { Ok(String::from(env.get_string(JString::from(obj))?)) } diff --git a/prusti-common/Cargo.toml b/prusti-common/Cargo.toml index dfabcba8b76..a27a0f9dc2e 100644 --- a/prusti-common/Cargo.toml +++ b/prusti-common/Cargo.toml @@ -13,7 +13,7 @@ viper = { path = "../viper" } vir = { path = "../vir" } log = { version = "0.4", features = ["release_max_level_info"] } config = "0.13" -itertools = "0.10.3" +itertools = "0.11" serde = { version = "1.0", features = ["derive"] } lazy_static = "1.4.0" uuid = { version = "1.0", features = ["v4"] } diff --git a/prusti-contracts/Cargo.toml b/prusti-contracts/Cargo.toml index 2c8254cd48f..de39952ddb5 100644 --- a/prusti-contracts/Cargo.toml +++ b/prusti-contracts/Cargo.toml @@ -5,6 +5,7 @@ members = [ "prusti-specs", "prusti-std", ] +resolver = "2" # This should not be built as part of Prusti (instead being build by `prusti-contracts-build`) # It would require setting the `build.rustc-wrapper` in a `../.cargo/config.toml` correctly diff --git a/prusti-contracts/prusti-contracts-proc-macros/Cargo.toml b/prusti-contracts/prusti-contracts-proc-macros/Cargo.toml index 90a8e02eae8..06f0ba29fa1 100644 --- a/prusti-contracts/prusti-contracts-proc-macros/Cargo.toml +++ b/prusti-contracts/prusti-contracts-proc-macros/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "prusti-contracts-proc-macros" -version = "0.1.8" +version = "0.1.9" authors = ["Prusti Devs "] edition = "2021" license = "MPL-2.0" @@ -15,7 +15,7 @@ categories = ["development-tools", "development-tools::testing"] proc-macro = true [dependencies] -prusti-specs = { path = "../prusti-specs", version = "0.1.8", optional = true } +prusti-specs = { path = "../prusti-specs", version = "0.1.9", optional = true } proc-macro2 = { version = "1.0", optional = true } [features] diff --git a/prusti-contracts/prusti-contracts/Cargo.toml b/prusti-contracts/prusti-contracts/Cargo.toml index afbd45a10f9..fe3b13abb19 100644 --- a/prusti-contracts/prusti-contracts/Cargo.toml +++ b/prusti-contracts/prusti-contracts/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "prusti-contracts" -version = "0.1.8" +version = "0.1.9" authors = ["Prusti Devs "] edition = "2021" license = "MPL-2.0" @@ -12,7 +12,7 @@ keywords = ["prusti", "contracts", "verification", "formal", "specifications"] categories = ["development-tools", "development-tools::testing"] [dependencies] -prusti-contracts-proc-macros = { path = "../prusti-contracts-proc-macros", version = "0.1.8" } +prusti-contracts-proc-macros = { path = "../prusti-contracts-proc-macros", version = "0.1.9" } [dev-dependencies] trybuild = "1.0" diff --git a/prusti-contracts/prusti-contracts/tests/pass/true.rs b/prusti-contracts/prusti-contracts/tests/pass/true.rs index 2310954d101..7db7983b2b3 100644 --- a/prusti-contracts/prusti-contracts/tests/pass/true.rs +++ b/prusti-contracts/prusti-contracts/tests/pass/true.rs @@ -3,7 +3,6 @@ // These feature flags are not needed when executing under Prusti // because it generates them for us. -#![cfg_attr(feature = "prusti", feature(type_ascription))] #![cfg_attr(feature = "prusti", feature(register_tool))] #![cfg_attr(feature = "prusti", register_tool(prusti))] diff --git a/prusti-contracts/prusti-specs/Cargo.toml b/prusti-contracts/prusti-specs/Cargo.toml index 66c3f75c5fd..4c4aded9a47 100644 --- a/prusti-contracts/prusti-specs/Cargo.toml +++ b/prusti-contracts/prusti-specs/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "prusti-specs" -version = "0.1.8" +version = "0.1.9" authors = ["Prusti Devs "] edition = "2021" license = "MPL-2.0" @@ -19,5 +19,5 @@ syn = { version = "1.0", features = ["full", "extra-traits", "visit", "visit-mut quote = "1.0" proc-macro2 = "1.0" uuid = { version = "1.0", features = ["v4"] } -itertools = "0.10.3" +itertools = "0.11" rustc-hash = "1.1.0" diff --git a/prusti-contracts/prusti-specs/src/extern_spec_rewriter/impls.rs b/prusti-contracts/prusti-specs/src/extern_spec_rewriter/impls.rs index 9515be76f18..d6ab88c2f2f 100644 --- a/prusti-contracts/prusti-specs/src/extern_spec_rewriter/impls.rs +++ b/prusti-contracts/prusti-specs/src/extern_spec_rewriter/impls.rs @@ -192,11 +192,11 @@ mod tests { #[test] fn generated_struct() { - let mut inp_impl: syn::ItemImpl = parse_quote!( + let inp_impl: syn::ItemImpl = parse_quote!( impl<'a, const CONST: i32, T> MyStruct<'a, CONST, T> {} ); - let rewritten = rewrite_extern_spec_internal(&mut inp_impl).unwrap(); + let rewritten = rewrite_extern_spec_internal(&inp_impl).unwrap(); let struct_ident = &rewritten.generated_struct.ident; let expected: syn::ItemStruct = parse_quote! { @@ -212,7 +212,7 @@ mod tests { #[test] fn impl_no_generics() { - let mut inp_impl: syn::ItemImpl = parse_quote!( + let inp_impl: syn::ItemImpl = parse_quote!( impl MyStruct { fn foo(&self); fn bar(&mut self); @@ -220,7 +220,7 @@ mod tests { } ); - let rewritten = rewrite_extern_spec_internal(&mut inp_impl).unwrap(); + let rewritten = rewrite_extern_spec_internal(&inp_impl).unwrap(); let newtype_ident = &rewritten.generated_struct.ident; let expected: syn::ItemImpl = parse_quote! { @@ -251,13 +251,13 @@ mod tests { #[test] fn impl_generics() { - let mut inp_impl: syn::ItemImpl = parse_quote!( + let inp_impl: syn::ItemImpl = parse_quote!( impl MyStruct { fn foo(&self, arg1: I, arg2: i32) -> O; } ); - let rewritten = rewrite_extern_spec_internal(&mut inp_impl).unwrap(); + let rewritten = rewrite_extern_spec_internal(&inp_impl).unwrap(); let newtype_ident = &rewritten.generated_struct.ident; let expected: syn::ItemImpl = parse_quote! { @@ -276,13 +276,13 @@ mod tests { #[test] fn impl_forwarded_generics() { - let mut inp_impl: syn::ItemImpl = parse_quote!( + let inp_impl: syn::ItemImpl = parse_quote!( impl MyStruct { fn foo(&self) -> bool; } ); - let rewritten = rewrite_extern_spec_internal(&mut inp_impl).unwrap(); + let rewritten = rewrite_extern_spec_internal(&inp_impl).unwrap(); let newtype_ident = &rewritten.generated_struct.ident; let expected: syn::ItemImpl = parse_quote! { @@ -305,13 +305,13 @@ mod tests { #[test] fn associated_types() { - let mut inp_impl: syn::ItemImpl = parse_quote!( + let inp_impl: syn::ItemImpl = parse_quote!( impl MyTrait for MyStruct { fn foo(&mut self) -> Self::Result; } ); - let rewritten = rewrite_extern_spec_internal(&mut inp_impl).unwrap(); + let rewritten = rewrite_extern_spec_internal(&inp_impl).unwrap(); let newtype_ident = &rewritten.generated_struct.ident; let expected_impl: syn::ItemImpl = parse_quote! { @@ -330,13 +330,13 @@ mod tests { #[test] fn generic_trait() { - let mut inp_impl: syn::ItemImpl = parse_quote!( + let inp_impl: syn::ItemImpl = parse_quote!( impl MyTrait for MyStruct { fn foo(&mut self, arg1: Foo); } ); - let rewritten = rewrite_extern_spec_internal(&mut inp_impl).unwrap(); + let rewritten = rewrite_extern_spec_internal(&inp_impl).unwrap(); let newtype_ident = &rewritten.generated_struct.ident; let expected_impl: syn::ItemImpl = parse_quote! { @@ -355,13 +355,13 @@ mod tests { #[test] fn generic_blanket_impl() { - let mut inp_impl: syn::ItemImpl = parse_quote!( + let inp_impl: syn::ItemImpl = parse_quote!( impl MyTrait for MyStruct { fn foo(&mut self, arg1: I); } ); - let rewritten = rewrite_extern_spec_internal(&mut inp_impl).unwrap(); + let rewritten = rewrite_extern_spec_internal(&inp_impl).unwrap(); let newtype_ident = &rewritten.generated_struct.ident; let expected_impl: syn::ItemImpl = parse_quote! { diff --git a/prusti-contracts/prusti-specs/src/lib.rs b/prusti-contracts/prusti-specs/src/lib.rs index e2383573575..965c92790c0 100644 --- a/prusti-contracts/prusti-specs/src/lib.rs +++ b/prusti-contracts/prusti-specs/src/lib.rs @@ -737,7 +737,7 @@ pub fn invariant(attr: TokenStream, tokens: TokenStream) -> TokenStream { #[prusti::type_invariant_spec] #[prusti::spec_id = #spec_id_str] fn #item_name(self) -> bool { - !!((#attr) : bool) + !!(#attr) } }; diff --git a/prusti-contracts/prusti-specs/src/rewriter.rs b/prusti-contracts/prusti-specs/src/rewriter.rs index 16128256439..a971de3b7a6 100644 --- a/prusti-contracts/prusti-specs/src/rewriter.rs +++ b/prusti-contracts/prusti-specs/src/rewriter.rs @@ -105,30 +105,21 @@ impl AstRewriter { // - `item_span` is set to `expr.span()` so that any errors reported // for the spec item will be reported on the span of the expression // written by the user - // - `((#expr) : bool)` syntax is used to report type errors in the + // - `let ...: bool = #expr` syntax is used to report type errors in the // expression with the correct error message, i.e. that the expected // type is `bool`, not that the expected *return* type is `bool` - // - `!!(...)` is used to fix an edge-case when the expression consists - // of a single identifier; without the double negation, the `Return` - // terminator in MIR has a span set to the one character just after - // the identifier - let (return_type, return_modifier) = match &spec_type { - SpecItemType::Termination => ( - quote_spanned! {item_span => Int}, - quote_spanned! {item_span => Int::new(0) + }, - ), - SpecItemType::Predicate(return_type) => (return_type.clone(), TokenStream::new()), - _ => ( - quote_spanned! {item_span => bool}, - quote_spanned! {item_span => !!}, - ), + let return_type = match &spec_type { + SpecItemType::Termination => quote_spanned! {item_span => Int}, + SpecItemType::Predicate(return_type) => return_type.clone(), + _ => quote_spanned! {item_span => bool}, }; let mut spec_item: syn::ItemFn = parse_quote_spanned! {item_span=> #[allow(unused_must_use, unused_parens, unused_variables, dead_code, non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = #spec_id_str] fn #item_name() -> #return_type { - #return_modifier ((#expr) : #return_type) + let prusti_result: #return_type = #expr; + prusti_result } }; diff --git a/prusti-contracts/prusti-specs/src/specifications/preparser.rs b/prusti-contracts/prusti-specs/src/specifications/preparser.rs index 3bfebc60992..790e516fabc 100644 --- a/prusti-contracts/prusti-specs/src/specifications/preparser.rs +++ b/prusti-contracts/prusti-specs/src/specifications/preparser.rs @@ -722,8 +722,8 @@ fn translate_spec_ent( specification_entailment( #once, __cl_ref, - ( #( #[prusti::spec_only] || -> bool { ((#preconds): bool) }, )* ), - ( #( #[prusti::spec_only] || -> bool { ((#postconds): bool) }, )* ), + ( #( #[prusti::spec_only] || -> bool { #preconds }, )* ), + ( #( #[prusti::spec_only] || -> bool { #postconds }, )* ), ) } } } @@ -753,7 +753,7 @@ impl Quantifier { quote_spanned! { full_span => ( #triggers ) } }) .collect::>(); - let body = quote_spanned! { body.span() => ((#body): bool) }; + let body = quote_spanned! { body.span() => #body }; match self { Self::Forall => quote_spanned! { full_span => ::prusti_contracts::forall( ( #( #trigger_sets, )* ), @@ -1089,15 +1089,15 @@ mod tests { parse_prusti("forall(|x: i32| a ==> b)".parse().unwrap()) .unwrap() .to_string(), - ":: prusti_contracts :: forall (() , # [prusti :: spec_only] | x : i32 | -> bool { ((! (a) || (b)) : bool) })", + ":: prusti_contracts :: forall (() , # [prusti :: spec_only] | x : i32 | -> bool { ! (a) || (b) })", ); assert_eq!( parse_prusti("exists(|x: i32| a === b)".parse().unwrap()).unwrap().to_string(), - ":: prusti_contracts :: exists (() , # [prusti :: spec_only] | x : i32 | -> bool { ((snapshot_equality (& (a) , & (b))) : bool) })", + ":: prusti_contracts :: exists (() , # [prusti :: spec_only] | x : i32 | -> bool { snapshot_equality (& (a) , & (b)) })", ); assert_eq!( parse_prusti("forall(|x: i32| a ==> b, triggers = [(c,), (d, e)])".parse().unwrap()).unwrap().to_string(), - ":: prusti_contracts :: forall (((# [prusti :: spec_only] | x : i32 | (c) ,) , (# [prusti :: spec_only] | x : i32 | (d) , # [prusti :: spec_only] | x : i32 | (e) ,) ,) , # [prusti :: spec_only] | x : i32 | -> bool { ((! (a) || (b)) : bool) })", + ":: prusti_contracts :: forall (((# [prusti :: spec_only] | x : i32 | (c) ,) , (# [prusti :: spec_only] | x : i32 | (d) , # [prusti :: spec_only] | x : i32 | (e) ,) ,) , # [prusti :: spec_only] | x : i32 | -> bool { ! (a) || (b) })", ); assert_eq!( parse_prusti("assert!(a === b ==> b)".parse().unwrap()) diff --git a/prusti-contracts/prusti-std/Cargo.toml b/prusti-contracts/prusti-std/Cargo.toml index 01eba50e347..ab17a78b49c 100644 --- a/prusti-contracts/prusti-std/Cargo.toml +++ b/prusti-contracts/prusti-std/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "prusti-std" -version = "0.1.8" +version = "0.1.9" authors = ["Prusti Devs "] edition = "2021" license = "MPL-2.0" @@ -12,7 +12,7 @@ keywords = ["prusti", "contracts", "verification", "formal", "specifications"] categories = ["development-tools", "development-tools::testing"] [dependencies] -prusti-contracts = { path = "../prusti-contracts", version = "0.1.8" } +prusti-contracts = { path = "../prusti-contracts", version = "0.1.9" } # Forward "prusti" flag [features] diff --git a/prusti-interface/src/environment/body.rs b/prusti-interface/src/environment/body.rs index 3327ca82e6c..009ae794eaa 100644 --- a/prusti-interface/src/environment/body.rs +++ b/prusti-interface/src/environment/body.rs @@ -1,4 +1,3 @@ -use prusti_common::config; use prusti_rustc_interface::{ macros::{TyDecodable, TyEncodable}, middle::{ @@ -33,12 +32,14 @@ struct BodyWithBorrowckFacts<'tcx> { /// Bodies which need not be synched across crates and so can be /// loaded dynamically as needed during encoding. type DynamicallyLoadedBodies = RefCell>; + /// Bodies which must be exported across crates and thus must be /// loaded prior to exporting (which happens before encoding). struct PreLoadedBodies<'tcx> { local: FxHashMap>, external: FxHashMap>, } + impl<'tcx> PreLoadedBodies<'tcx> { fn new() -> Self { Self { @@ -120,14 +121,16 @@ impl<'tcx> EnvBody<'tcx> { tcx: TyCtxt<'tcx>, def_id: LocalDefId, ) -> BodyWithBorrowckFacts<'tcx> { + // The analysis pass of the compiler already takes care of borrow-checking all MIR bodies, + // so the following call should not panic. // SAFETY: This is safe because we are feeding in the same `tcx` // that was used to store the data. let body_with_facts = unsafe { mir_storage::retrieve_mir_body(tcx, def_id) }; let facts = BorrowckFacts { - input_facts: RefCell::new(Some(body_with_facts.input_facts)), + input_facts: RefCell::new(body_with_facts.input_facts.map(|f| *f)), output_facts: body_with_facts.output_facts, - location_table: RefCell::new(Some(body_with_facts.location_table)), + location_table: RefCell::new(body_with_facts.location_table), }; BodyWithBorrowckFacts { @@ -139,11 +142,10 @@ impl<'tcx> EnvBody<'tcx> { /// Get local MIR body of spec or pure functions. Retrieves the body from /// the compiler (relatively cheap). fn load_local_mir(tcx: TyCtxt<'tcx>, def_id: LocalDefId) -> MirBody<'tcx> { - let body = tcx - .mir_promoted(ty::WithOptConstParam::unknown(def_id)) - .0 - .borrow(); - MirBody(Rc::new(body.clone())) + // SAFETY: This is safe because we are feeding in the same `tcx` + // that was used to store the data. + let body = unsafe { mir_storage::retrieve_promoted_mir_body(tcx, def_id) }; + MirBody(Rc::new(body)) } fn get_monomorphised( @@ -171,10 +173,13 @@ impl<'tcx> EnvBody<'tcx> { { let monomorphised = if let Some(caller_def_id) = caller_def_id { let param_env = self.tcx.param_env(caller_def_id); - self.tcx - .subst_and_normalize_erasing_regions(substs, param_env, body.0) + self.tcx.subst_and_normalize_erasing_regions( + substs, + param_env, + ty::EarlyBinder::bind(body.0), + ) } else { - ty::EarlyBinder(body.0).subst(self.tcx, substs) + ty::EarlyBinder::bind(body.0).subst(self.tcx, substs) }; v.insert(MirBody(monomorphised)).clone() } else { @@ -194,11 +199,18 @@ impl<'tcx> EnvBody<'tcx> { /// Get the MIR body of a local impure function, monomorphised /// with the given type substitutions. + /// + /// FIXME: This function is called only in pure contexts??? pub fn get_impure_fn_body(&self, def_id: LocalDefId, substs: SubstsRef<'tcx>) -> MirBody<'tcx> { if let Some(body) = self.get_monomorphised(def_id.to_def_id(), substs, None) { return body; } - let body = self.get_impure_fn_body_identity(def_id); + // let body = self.get_impure_fn_body_identity(def_id); + let body = if let Some(body) = self.pure_fns.local.get(&def_id) { + body.clone() + } else { + Self::load_local_mir(self.tcx, def_id) + }; self.set_monomorphised(def_id.to_def_id(), substs, None, body) } @@ -315,15 +327,11 @@ impl<'tcx> EnvBody<'tcx> { pub(crate) fn load_pure_fn_body(&mut self, def_id: LocalDefId) { assert!(!self.pure_fns.local.contains_key(&def_id)); - if config::no_verify() { - let body = Self::load_local_mir(self.tcx, def_id); - self.pure_fns.local.insert(def_id, body); - } else { - let bwbf = Self::load_local_mir_with_facts(self.tcx, def_id); - self.pure_fns.local.insert(def_id, bwbf.body.clone()); - // Also add to `impure_fns` since we'll also be encoding this as impure - self.local_impure_fns.borrow_mut().insert(def_id, bwbf); - } + let body = Self::load_local_mir(self.tcx, def_id); + self.pure_fns.local.insert(def_id, body); + let bwbf = Self::load_local_mir_with_facts(self.tcx, def_id); + // Also add to `impure_fns` since we'll also be encoding this as impure + self.local_impure_fns.borrow_mut().insert(def_id, bwbf); } pub(crate) fn load_closure_body(&mut self, def_id: LocalDefId) { diff --git a/prusti-interface/src/environment/borrowck/facts.rs b/prusti-interface/src/environment/borrowck/facts.rs index 659ab7bb7ed..5e93a9d3be3 100644 --- a/prusti-interface/src/environment/borrowck/facts.rs +++ b/prusti-interface/src/environment/borrowck/facts.rs @@ -36,7 +36,7 @@ pub struct BorrowckFacts { /// Polonius input facts. pub input_facts: RefCell>, /// Polonius output facts. - pub output_facts: Rc, + pub output_facts: Option>, /// The table that maps Polonius points to locations in the table. pub location_table: RefCell>, } diff --git a/prusti-interface/src/environment/debug_utils/to_text.rs b/prusti-interface/src/environment/debug_utils/to_text.rs index b0aee910c0a..88f8d1aa440 100644 --- a/prusti-interface/src/environment/debug_utils/to_text.rs +++ b/prusti-interface/src/environment/debug_utils/to_text.rs @@ -67,8 +67,8 @@ impl ToText impl ToText for prusti_rustc_interface::middle::ty::BoundRegionKind { fn to_text(&self) -> String { match self { - prusti_rustc_interface::middle::ty::BoundRegionKind::BrAnon(id, _) => { - format!("lft_br_anon_{id}") + prusti_rustc_interface::middle::ty::BoundRegionKind::BrAnon(_) => { + "lft_br_anon".to_string() } prusti_rustc_interface::middle::ty::BoundRegionKind::BrNamed(_, name) => { format!("lft_br_named_{name}") diff --git a/prusti-interface/src/environment/diagnostic.rs b/prusti-interface/src/environment/diagnostic.rs index e3e84075f9a..6991e6141a9 100644 --- a/prusti-interface/src/environment/diagnostic.rs +++ b/prusti-interface/src/environment/diagnostic.rs @@ -25,13 +25,13 @@ impl<'tcx> EnvDiagnostic<'tcx> { ) { diagnostic.set_span(sp); if let Some(help_msg) = help { - diagnostic.help(help_msg); + diagnostic.help(help_msg.clone()); } for (note_msg, opt_note_sp) in notes { if let Some(note_sp) = opt_note_sp { - diagnostic.span_note(note_sp.clone(), note_msg); + diagnostic.span_note(note_sp.clone(), note_msg.clone()); } else { - diagnostic.note(note_msg); + diagnostic.note(note_msg.clone()); } } } @@ -44,7 +44,7 @@ impl<'tcx> EnvDiagnostic<'tcx> { help: &Option, notes: &[(String, Option)], ) { - let mut diagnostic = self.tcx.sess.struct_err(msg); + let mut diagnostic = self.tcx.sess.struct_err(msg.to_string()); Self::configure_diagnostic(&mut diagnostic, sp, help, notes); for warn in self.warn_buffer.borrow_mut().iter_mut() { self.tcx.sess.diagnostic().emit_diagnostic(warn); @@ -60,7 +60,7 @@ impl<'tcx> EnvDiagnostic<'tcx> { help: &Option, notes: &[(String, Option)], ) { - let mut diagnostic = self.tcx.sess.struct_warn(msg); + let mut diagnostic = self.tcx.sess.struct_warn(msg.to_string()); Self::configure_diagnostic(&mut diagnostic, sp, help, notes); diagnostic.emit(); } @@ -73,7 +73,7 @@ impl<'tcx> EnvDiagnostic<'tcx> { help: &Option, notes: &[(String, Option)], ) { - let mut diagnostic = self.tcx.sess.struct_warn(msg); + let mut diagnostic = self.tcx.sess.struct_warn(msg.to_string()); Self::configure_diagnostic(&mut diagnostic, sp, help, notes); diagnostic.buffer(&mut self.warn_buffer.borrow_mut()); } diff --git a/prusti-interface/src/environment/loops.rs b/prusti-interface/src/environment/loops.rs index 884ac907275..efe8644ca55 100644 --- a/prusti-interface/src/environment/loops.rs +++ b/prusti-interface/src/environment/loops.rs @@ -11,7 +11,7 @@ use crate::{ use log::{debug, trace}; use prusti_rustc_interface::{ data_structures::graph::dominators::Dominators, - index::vec::{Idx, IndexVec}, + index::{Idx, IndexVec}, middle::{mir, mir::visit::Visitor}, }; use rustc_hash::{FxHashMap, FxHashSet}; @@ -32,8 +32,7 @@ fn collect_loop_body( ) { let mut work_queue = vec![back_edge_source]; body.insert(back_edge_source); - while !work_queue.is_empty() { - let current = work_queue.pop().unwrap(); + while let Some(current) = work_queue.pop() { for &predecessor in real_edges.predecessors(current).iter() { if body.contains(&predecessor) { continue; @@ -124,6 +123,9 @@ impl<'b, 'tcx> Visitor<'tcx> for AccessCollector<'b, 'tcx> { NonMutatingUse(mir::visit::NonMutatingUseContext::Copy) => PlaceAccessKind::Read, NonMutatingUse(mir::visit::NonMutatingUseContext::Move) => PlaceAccessKind::Move, NonMutatingUse(mir::visit::NonMutatingUseContext::Inspect) => PlaceAccessKind::Read, + NonMutatingUse(mir::visit::NonMutatingUseContext::PlaceMention) => { + PlaceAccessKind::Read + } NonMutatingUse(mir::visit::NonMutatingUseContext::SharedBorrow) => { PlaceAccessKind::SharedBorrow } @@ -257,7 +259,7 @@ pub type ReadAndWriteLeaves<'tcx> = ( impl ProcedureLoops { #[tracing::instrument(name = "ProcedureLoops::new", level = "trace", skip(mir, real_edges))] pub fn new<'a, 'tcx: 'a>(mir: &'a mir::Body<'tcx>, real_edges: &RealEdges) -> ProcedureLoops { - let dominators = mir.basic_blocks.dominators(); + let dominators = mir.basic_blocks.dominators().clone(); let mut back_edges: FxHashSet<(_, _)> = FxHashSet::default(); for bb in mir.basic_blocks.indices() { diff --git a/prusti-interface/src/environment/mir_body/borrowck/facts/patch.rs b/prusti-interface/src/environment/mir_body/borrowck/facts/patch.rs index 86229969ac0..df538f4bb98 100644 --- a/prusti-interface/src/environment/mir_body/borrowck/facts/patch.rs +++ b/prusti-interface/src/environment/mir_body/borrowck/facts/patch.rs @@ -178,7 +178,7 @@ pub fn apply_patch_to_borrowck<'tcx>( } mir::TerminatorKind::Drop { target, unwind, .. } => { let mut target_points = vec![lt_patcher.start_point(target.index(), 0)]; - if let Some(unwind) = unwind { + if let mir::UnwindAction::Cleanup(unwind) = unwind { target_points.push(lt_patcher.start_point(unwind.index(), 0)); } assert!(cfg_edges diff --git a/prusti-interface/src/environment/mir_body/dead_blocks.rs b/prusti-interface/src/environment/mir_body/dead_blocks.rs index 888f97a4b0a..17d1b29b619 100644 --- a/prusti-interface/src/environment/mir_body/dead_blocks.rs +++ b/prusti-interface/src/environment/mir_body/dead_blocks.rs @@ -1,5 +1,5 @@ use prusti_rustc_interface::{ - index::{bit_set::BitSet, vec::Idx}, + index::{bit_set::BitSet, Idx}, middle::mir, }; use std::collections::BTreeMap; diff --git a/prusti-interface/src/environment/mir_body/graphviz.rs b/prusti-interface/src/environment/mir_body/graphviz.rs index 132ef24ae45..52de7556e9c 100644 --- a/prusti-interface/src/environment/mir_body/graphviz.rs +++ b/prusti-interface/src/environment/mir_body/graphviz.rs @@ -176,8 +176,8 @@ fn visit_terminator(graph: &mut Graph, bb: mir::BasicBlock, terminator: &mir::Te TerminatorKind::Resume => { graph.add_exit_edge(bb.to_text(), "resume".to_text()); } - TerminatorKind::Abort => { - graph.add_exit_edge(bb.to_text(), "abort".to_text()); + TerminatorKind::Terminate => { + graph.add_exit_edge(bb.to_text(), "terminate".to_text()); } TerminatorKind::Return => { graph.add_exit_edge(bb.to_text(), "return".to_text()); @@ -187,25 +187,21 @@ fn visit_terminator(graph: &mut Graph, bb: mir::BasicBlock, terminator: &mir::Te } TerminatorKind::Drop { target, unwind, .. } => { graph.add_regular_edge(bb.to_text(), target.to_text()); - if let Some(target) = unwind { + if let mir::UnwindAction::Cleanup(target) = unwind { graph.add_unwind_edge(bb.to_text(), target.to_text()); } } - TerminatorKind::Call { - target, cleanup, .. - } => { + TerminatorKind::Call { target, unwind, .. } => { if let Some(target) = target { graph.add_regular_edge(bb.to_text(), target.to_text()); } - if let Some(target) = cleanup { + if let mir::UnwindAction::Cleanup(target) = unwind { graph.add_unwind_edge(bb.to_text(), target.to_text()); } } - TerminatorKind::Assert { - target, cleanup, .. - } => { + TerminatorKind::Assert { target, unwind, .. } => { graph.add_regular_edge(bb.to_text(), target.to_text()); - if let Some(target) = cleanup { + if let mir::UnwindAction::Cleanup(target) = unwind { graph.add_unwind_edge(bb.to_text(), target.to_text()); } } @@ -227,7 +223,7 @@ fn visit_terminator(graph: &mut Graph, bb: mir::BasicBlock, terminator: &mir::Te unwind, } => { graph.add_regular_edge(bb.to_text(), real_target.to_text()); - if let Some(imaginary_target) = unwind { + if let mir::UnwindAction::Cleanup(imaginary_target) = unwind { graph.add_imaginary_edge(bb.to_text(), imaginary_target.to_text()); } } diff --git a/prusti-interface/src/environment/mir_body/patch/compiler.rs b/prusti-interface/src/environment/mir_body/patch/compiler.rs index b51e4f2c7ca..ca85b91fdb5 100644 --- a/prusti-interface/src/environment/mir_body/patch/compiler.rs +++ b/prusti-interface/src/environment/mir_body/patch/compiler.rs @@ -12,7 +12,7 @@ use log::debug; use prusti_rustc_interface::{ - index::vec::{Idx, IndexVec}, + index::{Idx, IndexVec}, middle::{mir::*, ty::Ty}, span::Span, }; @@ -26,7 +26,11 @@ pub struct MirPatch<'tcx> { pub new_blocks: Vec>, pub new_statements: Vec<(Location, StatementKind<'tcx>)>, pub new_locals: Vec>, - pub resume_block: BasicBlock, + pub resume_block: Option, + // Only for unreachable in cleanup path. + pub unreachable_cleanup_block: Option, + pub terminate_block: Option, + pub body_span: Span, pub next_local: usize, } @@ -38,51 +42,87 @@ impl<'tcx> MirPatch<'tcx> { new_statements: vec![], new_locals: vec![], next_local: body.local_decls.len(), - resume_block: START_BLOCK, + resume_block: None, + unreachable_cleanup_block: None, + terminate_block: None, + body_span: body.span, }; - // make sure the MIR we create has a resume block. It is - // completely legal to convert jumps to the resume block - // to jumps to None, but we occasionally have to add - // instructions just before that. - - let mut resume_block = None; - let mut resume_stmt_block = None; for (bb, block) in body.basic_blocks.iter_enumerated() { - if let TerminatorKind::Resume = block.terminator().kind { - if !block.statements.is_empty() { - assert!(resume_stmt_block.is_none()); - resume_stmt_block = Some(bb); - } else { - resume_block = Some(bb); - } - break; + // Check if we already have a resume block + if let TerminatorKind::Resume = block.terminator().kind && block.statements.is_empty() { + result.resume_block = Some(bb); + continue; + } + + // Check if we already have an unreachable block + if let TerminatorKind::Unreachable = block.terminator().kind + && block.statements.is_empty() + && block.is_cleanup + { + result.unreachable_cleanup_block = Some(bb); + continue; } + + // Check if we already have a terminate block + if let TerminatorKind::Terminate = block.terminator().kind && block.statements.is_empty() { + result.terminate_block = Some(bb); + continue; + } + } + + result + } + + pub fn resume_block(&mut self) -> BasicBlock { + if let Some(bb) = self.resume_block { + return bb; } - let resume_block = resume_block.unwrap_or_else(|| { - result.new_block(BasicBlockData { - statements: vec![], - terminator: Some(Terminator { - source_info: SourceInfo::outermost(body.span), - kind: TerminatorKind::Resume, - }), - is_cleanup: true, - }) + + let bb = self.new_block(BasicBlockData { + statements: vec![], + terminator: Some(Terminator { + source_info: SourceInfo::outermost(self.body_span), + kind: TerminatorKind::Resume, + }), + is_cleanup: true, }); - result.resume_block = resume_block; - if let Some(resume_stmt_block) = resume_stmt_block { - result.patch_terminator( - resume_stmt_block, - TerminatorKind::Goto { - target: resume_block, - }, - ); + self.resume_block = Some(bb); + bb + } + + pub fn unreachable_cleanup_block(&mut self) -> BasicBlock { + if let Some(bb) = self.unreachable_cleanup_block { + return bb; } - result + + let bb = self.new_block(BasicBlockData { + statements: vec![], + terminator: Some(Terminator { + source_info: SourceInfo::outermost(self.body_span), + kind: TerminatorKind::Unreachable, + }), + is_cleanup: true, + }); + self.unreachable_cleanup_block = Some(bb); + bb } - pub fn resume_block(&self) -> BasicBlock { - self.resume_block + pub fn terminate_block(&mut self) -> BasicBlock { + if let Some(bb) = self.terminate_block { + return bb; + } + + let bb = self.new_block(BasicBlockData { + statements: vec![], + terminator: Some(Terminator { + source_info: SourceInfo::outermost(self.body_span), + kind: TerminatorKind::Terminate, + }), + is_cleanup: true, + }); + self.terminate_block = Some(bb); + bb } pub fn is_patched(&self, bb: BasicBlock) -> bool { @@ -100,6 +140,20 @@ impl<'tcx> MirPatch<'tcx> { } } + pub fn new_internal_with_info( + &mut self, + ty: Ty<'tcx>, + span: Span, + local_info: LocalInfo<'tcx>, + ) -> Local { + let index = self.next_local; + self.next_local += 1; + let mut new_decl = LocalDecl::new(ty, span).internal(); + **new_decl.local_info.as_mut().assert_crate_local() = local_info; + self.new_locals.push(new_decl); + Local::new(index) + } + pub fn new_temp(&mut self, ty: Ty<'tcx>, span: Span) -> Local { let index = self.next_local; self.next_local += 1; @@ -114,7 +168,6 @@ impl<'tcx> MirPatch<'tcx> { Local::new(index) } - #[tracing::instrument(level = "debug", skip(self))] pub fn new_block(&mut self, data: BasicBlockData<'tcx>) -> BasicBlock { let block = BasicBlock::new(self.patch_map.len()); debug!("MirPatch: new_block: {:?}: {:?}", block, data); @@ -123,14 +176,14 @@ impl<'tcx> MirPatch<'tcx> { block } - #[tracing::instrument(level = "debug", skip(self))] pub fn patch_terminator(&mut self, block: BasicBlock, new: TerminatorKind<'tcx>) { assert!(self.patch_map[block].is_none()); + debug!("MirPatch: patch_terminator({:?}, {:?})", block, new); self.patch_map[block] = Some(new); } - #[tracing::instrument(level = "debug", skip(self))] pub fn add_statement(&mut self, loc: Location, stmt: StatementKind<'tcx>) { + debug!("MirPatch: add_statement({:?}, {:?})", loc, stmt); self.new_statements.push((loc, stmt)); } @@ -138,7 +191,6 @@ impl<'tcx> MirPatch<'tcx> { self.add_statement(loc, StatementKind::Assign(Box::new((place, rv)))); } - #[tracing::instrument(level = "debug", skip_all)] pub fn apply(self, body: &mut Body<'tcx>) { debug!( "MirPatch: {:?} new temps, starting from index {}: {:?}", @@ -151,12 +203,17 @@ impl<'tcx> MirPatch<'tcx> { self.new_blocks.len(), body.basic_blocks.len() ); - body.basic_blocks_mut().extend(self.new_blocks); + let bbs = if self.patch_map.is_empty() && self.new_blocks.is_empty() { + body.basic_blocks.as_mut_preserves_cfg() + } else { + body.basic_blocks.as_mut() + }; + bbs.extend(self.new_blocks); body.local_decls.extend(self.new_locals); for (src, patch) in self.patch_map.into_iter_enumerated() { if let Some(patch) = patch { debug!("MirPatch: patching block {:?}", src); - body[src].terminator_mut().kind = patch; + bbs[src].terminator_mut().kind = patch; } } diff --git a/prusti-interface/src/environment/mir_storage.rs b/prusti-interface/src/environment/mir_storage.rs index 495cde9f21d..1dd393bd421 100644 --- a/prusti-interface/src/environment/mir_storage.rs +++ b/prusti-interface/src/environment/mir_storage.rs @@ -7,15 +7,20 @@ //! `'tcx`. use prusti_rustc_interface::{ - borrowck::BodyWithBorrowckFacts, data_structures::fx::FxHashMap, hir::def_id::LocalDefId, - middle::ty::TyCtxt, + borrowck::consumers::BodyWithBorrowckFacts, + data_structures::fx::FxHashMap, + hir::def_id::LocalDefId, + middle::{mir, ty::TyCtxt}, }; use std::{cell::RefCell, thread_local}; thread_local! { - pub static SHARED_STATE: + pub static SHARED_STATE_WITH_FACTS: RefCell>> = RefCell::new(FxHashMap::default()); + pub static SHARED_STATE_WITHOUT_FACTS: + RefCell>> = + RefCell::new(FxHashMap::default()); } /// # Safety @@ -29,12 +34,15 @@ pub unsafe fn store_mir_body<'tcx>( // SAFETY: See the module level comment. let body_with_facts: BodyWithBorrowckFacts<'static> = unsafe { std::mem::transmute(body_with_facts) }; - SHARED_STATE.with(|state| { + SHARED_STATE_WITH_FACTS.with(|state| { let mut map = state.borrow_mut(); assert!(map.insert(def_id, body_with_facts).is_none()); }); } +/// This function should only be called once per `def_id` after the borrow checker has run. +/// Otherwise, it will panic. +/// /// # Safety /// /// See the module level comment. @@ -43,10 +51,39 @@ pub(super) unsafe fn retrieve_mir_body<'tcx>( _tcx: TyCtxt<'tcx>, def_id: LocalDefId, ) -> BodyWithBorrowckFacts<'tcx> { - let body_with_facts: BodyWithBorrowckFacts<'static> = SHARED_STATE.with(|state| { + let body_with_facts: BodyWithBorrowckFacts<'static> = SHARED_STATE_WITH_FACTS.with(|state| { let mut map = state.borrow_mut(); map.remove(&def_id).unwrap() }); // SAFETY: See the module level comment. unsafe { std::mem::transmute(body_with_facts) } } + +/// # Safety +/// +/// See the module level comment. +pub unsafe fn store_promoted_mir_body<'tcx>( + _tcx: TyCtxt<'tcx>, + def_id: LocalDefId, + body: mir::Body<'tcx>, +) { + // SAFETY: See the module level comment. + let body: mir::Body<'static> = unsafe { std::mem::transmute(body) }; + SHARED_STATE_WITHOUT_FACTS.with(|state| { + let mut map = state.borrow_mut(); + assert!(map.insert(def_id, body).is_none()); + }); +} + +#[allow(clippy::needless_lifetimes)] // We want to be very explicit about lifetimes here. +pub(super) unsafe fn retrieve_promoted_mir_body<'tcx>( + _tcx: TyCtxt<'tcx>, + def_id: LocalDefId, +) -> mir::Body<'tcx> { + let body_without_facts: mir::Body<'static> = SHARED_STATE_WITHOUT_FACTS.with(|state| { + let mut map = state.borrow_mut(); + map.remove(&def_id).unwrap() + }); + // SAFETY: See the module level comment. + unsafe { std::mem::transmute(body_without_facts) } +} diff --git a/prusti-interface/src/environment/mir_utils/args_for_mir.rs b/prusti-interface/src/environment/mir_utils/args_for_mir.rs index f14ff738510..bb8f9c87950 100644 --- a/prusti-interface/src/environment/mir_utils/args_for_mir.rs +++ b/prusti-interface/src/environment/mir_utils/args_for_mir.rs @@ -1,5 +1,5 @@ use prusti_rustc_interface::{ - index::vec::Idx, + index::Idx, middle::{mir, ty}, }; diff --git a/prusti-interface/src/environment/mir_utils/real_edges.rs b/prusti-interface/src/environment/mir_utils/real_edges.rs index 1be11280e8b..6546d4a9acf 100644 --- a/prusti-interface/src/environment/mir_utils/real_edges.rs +++ b/prusti-interface/src/environment/mir_utils/real_edges.rs @@ -6,7 +6,7 @@ use prusti_rustc_interface::middle::mir::{self, TerminatorKind}; -use prusti_rustc_interface::index::vec::IndexVec; +use prusti_rustc_interface::index::IndexVec; /// A data structure to store the non-virtual CFG edges of a MIR body. pub struct RealEdges { @@ -53,7 +53,7 @@ fn real_targets(terminator: &mir::Terminator) -> Vec { TerminatorKind::SwitchInt { ref targets, .. } => targets.all_targets().to_vec(), TerminatorKind::Resume - | TerminatorKind::Abort + | TerminatorKind::Terminate | TerminatorKind::Return | TerminatorKind::GeneratorDrop | TerminatorKind::Unreachable => vec![], diff --git a/prusti-interface/src/environment/mod.rs b/prusti-interface/src/environment/mod.rs index 7f1acf512fe..368779a83b8 100644 --- a/prusti-interface/src/environment/mod.rs +++ b/prusti-interface/src/environment/mod.rs @@ -145,13 +145,16 @@ impl<'tcx> Environment<'tcx> { true } else { let param_env = self.tcx().param_env(caller_def_id); - if let Some(instance) = self + if let Some(_instance) = self .tcx() .resolve_instance(param_env.and((called_def_id, call_substs))) .unwrap() { - self.tcx() - .mir_callgraph_reachable((instance, caller_def_id.expect_local())) + // FIXME: This call panics due to stolen MIR. Therefore, we + // unsoundly assume that the callee is not reachable. + // self.tcx() + // .mir_callgraph_reachable((instance, caller_def_id.expect_local())) + false } else { true } diff --git a/prusti-interface/src/environment/polonius_info.rs b/prusti-interface/src/environment/polonius_info.rs index 3eeb05011f5..c5647f30728 100644 --- a/prusti-interface/src/environment/polonius_info.rs +++ b/prusti-interface/src/environment/polonius_info.rs @@ -29,7 +29,7 @@ use log::{debug, trace}; use prusti_common::config; use prusti_rustc_interface::{ borrowck::consumers::RustcFacts, - index::vec::Idx, + index::Idx, middle::{mir, ty}, polonius_engine::{Algorithm, AllFacts, Output}, span::{def_id::DefId, Span}, diff --git a/prusti-interface/src/environment/procedure.rs b/prusti-interface/src/environment/procedure.rs index fbb3537a7fc..41923263e09 100644 --- a/prusti-interface/src/environment/procedure.rs +++ b/prusti-interface/src/environment/procedure.rs @@ -205,9 +205,7 @@ fn build_reachable_basic_blocks(mir: &Body, real_edges: &RealEdges) -> FxHashSet let mut visited: FxHashSet = FxHashSet::default(); let mut to_visit: Vec = vec![mir.basic_blocks.indices().next().unwrap()]; - while !to_visit.is_empty() { - let source = to_visit.pop().unwrap(); - + while let Some(source) = to_visit.pop() { if visited.contains(&source) { continue; } @@ -391,9 +389,7 @@ fn build_nonspec_basic_blocks( let mut bb_graph: FxHashMap = FxHashMap::default(); - while !to_visit.is_empty() { - let source = to_visit.pop().unwrap(); - + while let Some(source) = to_visit.pop() { if visited.contains(&source) { continue; } diff --git a/prusti-interface/src/environment/query.rs b/prusti-interface/src/environment/query.rs index 4afeb53d4bb..32370da15a0 100644 --- a/prusti-interface/src/environment/query.rs +++ b/prusti-interface/src/environment/query.rs @@ -161,7 +161,7 @@ impl<'tcx> EnvQuery<'tcx> { ) -> ty::PolyFnSig<'tcx> { let def_id = def_id.into_param(); let sig = if self.tcx.is_closure(def_id) { - ty::EarlyBinder(substs.as_closure().sig()) + ty::EarlyBinder::bind(substs.as_closure().sig()) } else { self.tcx.fn_sig(def_id) }; @@ -255,7 +255,7 @@ impl<'tcx> EnvQuery<'tcx> { // more precisely. We can do this directly with `impl_method_substs` // because they contain the substs for the `impl` block as a prefix. let call_trait_substs = - ty::EarlyBinder(trait_ref.substs).subst(self.tcx, impl_method_substs); + ty::EarlyBinder::bind(trait_ref.substs).subst(self.tcx, impl_method_substs); let impl_substs = self.identity_substs(impl_def_id); let trait_method_substs = self.tcx.mk_substs_from_iter( call_trait_substs @@ -284,7 +284,7 @@ impl<'tcx> EnvQuery<'tcx> { debug!("Fetching implementations of method '{:?}' defined in trait '{}' with substs '{:?}'", proc_def_id, self.tcx.def_path_str(trait_id), substs); let infcx = self.tcx.infer_ctxt().build(); let mut sc = SelectionContext::new(&infcx); - let trait_ref = self.tcx.mk_trait_ref(trait_id, substs); + let trait_ref = ty::TraitRef::new(self.tcx, trait_id, substs); let obligation = Obligation::new( self.tcx, ObligationCause::dummy(), diff --git a/prusti-interface/src/lib.rs b/prusti-interface/src/lib.rs index 0b077ce0921..d1b7bdaf632 100644 --- a/prusti-interface/src/lib.rs +++ b/prusti-interface/src/lib.rs @@ -13,6 +13,7 @@ #![feature(box_patterns)] #![feature(control_flow_enum)] #![feature(min_specialization)] +#![feature(let_chains)] // We may want to remove this in the future. #![allow(clippy::needless_lifetimes)] diff --git a/prusti-interface/src/specs/cross_crate.rs b/prusti-interface/src/specs/cross_crate.rs index aa4041a0dae..13a363d3169 100644 --- a/prusti-interface/src/specs/cross_crate.rs +++ b/prusti-interface/src/specs/cross_crate.rs @@ -82,18 +82,15 @@ impl CrossCrateSpecs { fn write_into_file( env: &Environment, def_spec: &DefSpecificationMap, - path: &path::PathBuf, + path: &path::Path, ) -> io::Result { - use std::io::Write; - let mut encoder = DefSpecsEncoder::new(env.tcx()); + // Probably not needed; dir should already exist? + fs::create_dir_all(path.parent().unwrap())?; + let mut encoder = DefSpecsEncoder::new(env.tcx(), path)?; def_spec.proc_specs.encode(&mut encoder); def_spec.type_specs.encode(&mut encoder); CrossCrateBodies::from(&env.body).encode(&mut encoder); - - // Probably not needed; dir should already exist? - fs::create_dir_all(path.parent().unwrap())?; - let mut file = fs::File::create(path)?; - file.write(&encoder.into_inner()) + encoder.finish() } #[tracing::instrument(level = "debug", skip(env, def_spec))] diff --git a/prusti-interface/src/specs/decoder.rs b/prusti-interface/src/specs/decoder.rs index cb5fffcbee8..a46756a0bb6 100644 --- a/prusti-interface/src/specs/decoder.rs +++ b/prusti-interface/src/specs/decoder.rs @@ -110,16 +110,6 @@ impl<'a, 'tcx> TyDecoder for DefSpecsDecoder<'a, 'tcx> { self.tcx } - #[inline] - fn peek_byte(&self) -> u8 { - self.opaque.data[self.opaque.position()] - } - - #[inline] - fn position(&self) -> usize { - self.opaque.position() - } - fn cached_ty_for_shorthand(&mut self, shorthand: usize, or_insert_with: F) -> Ty<'tcx> where F: FnOnce(&mut Self) -> Ty<'tcx>, @@ -137,7 +127,7 @@ impl<'a, 'tcx> TyDecoder for DefSpecsDecoder<'a, 'tcx> { where F: FnOnce(&mut Self) -> R, { - let new_opaque = opaque::MemDecoder::new(self.opaque.data, pos); + let new_opaque = opaque::MemDecoder::new(self.opaque.data(), pos); let old_opaque = std::mem::replace(&mut self.opaque, new_opaque); let r = f(self); self.opaque = old_opaque; diff --git a/prusti-interface/src/specs/encoder.rs b/prusti-interface/src/specs/encoder.rs index 3f89aa44c59..7c14a2095ad 100644 --- a/prusti-interface/src/specs/encoder.rs +++ b/prusti-interface/src/specs/encoder.rs @@ -11,24 +11,24 @@ use prusti_rustc_interface::{ pub struct DefSpecsEncoder<'tcx> { tcx: TyCtxt<'tcx>, - opaque: opaque::MemEncoder, + opaque: opaque::FileEncoder, type_shorthands: FxHashMap, usize>, predicate_shorthands: FxHashMap, usize>, interpret_allocs: FxIndexSet, } impl<'tcx> DefSpecsEncoder<'tcx> { - pub fn new(tcx: TyCtxt<'tcx>) -> Self { - DefSpecsEncoder { + pub fn new(tcx: TyCtxt<'tcx>, file: &std::path::Path) -> std::io::Result { + Ok(DefSpecsEncoder { tcx, - opaque: opaque::MemEncoder::new(), + opaque: opaque::FileEncoder::new(file)?, type_shorthands: Default::default(), predicate_shorthands: Default::default(), interpret_allocs: Default::default(), - } + }) } - pub fn into_inner(self) -> Vec { + pub fn finish(self) -> std::io::Result { self.opaque.finish() } } @@ -59,8 +59,8 @@ impl<'tcx> Encoder for DefSpecsEncoder<'tcx> { emit_i8(i8); emit_bool(bool); - emit_f64(f64); - emit_f32(f32); + // emit_f64(f64); + // emit_f32(f32); emit_char(char); emit_str(&str); emit_raw_bytes(&[u8]); diff --git a/prusti-tests/Cargo.toml b/prusti-tests/Cargo.toml index 568cca9184b..3c5ae2a7673 100644 --- a/prusti-tests/Cargo.toml +++ b/prusti-tests/Cargo.toml @@ -5,11 +5,11 @@ authors = ["Prusti Devs "] edition = "2021" [dev-dependencies] -compiletest_rs = "0.9" +compiletest_rs = "0.10" prusti-server = { path = "../prusti-server" } prusti-launch = { path = "../prusti-launch", artifact = "bin" } prusti = { path = "../prusti", artifact = "bin" } -cargo-test-support = { git = "https://github.com/rust-lang/cargo.git", rev = "17f8088" } +cargo-test-support = { git = "https://github.com/rust-lang/cargo.git", rev = "ec8a8a0" } ureq = "2.1" log = { version = "0.4", features = ["release_max_level_info"] } env_logger = "0.10" diff --git a/prusti-tests/tests/cargo_verify/prusti_toml/output.stdout b/prusti-tests/tests/cargo_verify/prusti_toml/output.stdout index 0931f816dea..6ddb0ea3555 100644 --- a/prusti-tests/tests/cargo_verify/prusti_toml/output.stdout +++ b/prusti-tests/tests/cargo_verify/prusti_toml/output.stdout @@ -1,7 +1,6 @@ -#![feature(type_ascription)] #![feature(stmt_expr_attributes)] #![feature(register_tool)] #![register_tool(prusti)] @@ -16,7 +15,8 @@ non_snake_case)] #[prusti::spec_id = "[..]"] fn prusti_post_item_test1_[..](result: ()) -> bool { - !!((false): bool) + let prusti_result: bool = false; + prusti_result } #[prusti::post_spec_id_ref = "[..]"] #[prusti::specs_version = "[..]"] diff --git a/prusti-tests/tests/parse/ui/after_expiry.stdout b/prusti-tests/tests/parse/ui/after_expiry.stdout index d941c81ba15..d4541662198 100644 --- a/prusti-tests/tests/parse/ui/after_expiry.stdout +++ b/prusti-tests/tests/parse/ui/after_expiry.stdout @@ -8,7 +8,6 @@ -#![feature(type_ascription)] #![feature(stmt_expr_attributes)] #![feature(register_tool)] #![register_tool(prusti)] @@ -23,7 +22,8 @@ non_snake_case)] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pledge_item_test1_$(NUM_UUID)(a: bool, result: ()) -> bool { - !!((a): bool) + let prusti_result: bool = a; + prusti_result } #[prusti::pledge_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -34,7 +34,8 @@ non_snake_case)] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pledge_item_test2_$(NUM_UUID)(a: bool, result: ()) -> bool { - !!((a): bool) + let prusti_result: bool = a; + prusti_result } #[prusti::pledge_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -45,7 +46,8 @@ non_snake_case)] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pledge_item_test3_$(NUM_UUID)(x: u32, result: u32) -> bool { - !!((result == match x { 1 => 1, 2 => 2, _ => 0, }): bool) + let prusti_result: bool = result == match x { 1 => 1, 2 => 2, _ => 0, }; + prusti_result } #[prusti::pledge_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] diff --git a/prusti-tests/tests/parse/ui/and.stdout b/prusti-tests/tests/parse/ui/and.stdout index e587bf8d92e..6c638fe1785 100644 --- a/prusti-tests/tests/parse/ui/and.stdout +++ b/prusti-tests/tests/parse/ui/and.stdout @@ -10,7 +10,6 @@ -#![feature(type_ascription)] #![feature(stmt_expr_attributes)] #![feature(register_tool)] #![register_tool(prusti)] @@ -24,7 +23,8 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test1_$(NUM_UUID)() -> bool { - !!(((true) && (true)): bool) + let prusti_result: bool = (true) && (true); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -34,7 +34,8 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test2_$(NUM_UUID)() -> bool { - !!((((true) && (true)) && (true)): bool) + let prusti_result: bool = ((true) && (true)) && (true); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -44,7 +45,8 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test3_$(NUM_UUID)() -> bool { - !!(((true) && (((true) && (true)))): bool) + let prusti_result: bool = (true) && (((true) && (true))); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -54,7 +56,8 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test4_$(NUM_UUID)() -> bool { - !!(((((true) && (true))) && (true)): bool) + let prusti_result: bool = (((true) && (true))) && (true); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -64,7 +67,8 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test5_$(NUM_UUID)() -> bool { - !!(((((true) && (true))) && (((true) && (true)))): bool) + let prusti_result: bool = (((true) && (true))) && (((true) && (true))); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] diff --git a/prusti-tests/tests/parse/ui/assert_on_expiry.stdout b/prusti-tests/tests/parse/ui/assert_on_expiry.stdout index dd95f8bd8ca..0ffdf3d80e0 100644 --- a/prusti-tests/tests/parse/ui/assert_on_expiry.stdout +++ b/prusti-tests/tests/parse/ui/assert_on_expiry.stdout @@ -9,7 +9,6 @@ -#![feature(type_ascription)] #![feature(stmt_expr_attributes)] #![feature(register_tool)] #![register_tool(prusti)] @@ -24,7 +23,8 @@ non_snake_case)] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pledge_item_test1_$(NUM_UUID)(a: bool, result: ()) -> bool { - !!((true): bool) + let prusti_result: bool = true; + prusti_result } #[allow(unused_must_use, unused_parens, unused_variables, dead_code, non_snake_case)] @@ -32,7 +32,8 @@ non_snake_case)] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pledge_item_test1_$(NUM_UUID)(a: bool, result: ()) -> bool { - !!((a): bool) + let prusti_result: bool = a; + prusti_result } #[prusti::assert_pledge_spec_id_ref_lhs = "$(NUM_UUID)"] #[prusti::assert_pledge_spec_id_ref_rhs = "$(NUM_UUID)"] @@ -44,7 +45,8 @@ non_snake_case)] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pledge_item_test2_$(NUM_UUID)(a: bool, result: ()) -> bool { - !!((true): bool) + let prusti_result: bool = true; + prusti_result } #[allow(unused_must_use, unused_parens, unused_variables, dead_code, non_snake_case)] @@ -52,7 +54,8 @@ non_snake_case)] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pledge_item_test2_$(NUM_UUID)(a: bool, result: ()) -> bool { - !!((a): bool) + let prusti_result: bool = a; + prusti_result } #[prusti::assert_pledge_spec_id_ref_lhs = "$(NUM_UUID)"] #[prusti::assert_pledge_spec_id_ref_rhs = "$(NUM_UUID)"] @@ -64,7 +67,8 @@ non_snake_case)] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pledge_item_test3_$(NUM_UUID)(x: u32, result: u32) -> bool { - !!((true): bool) + let prusti_result: bool = true; + prusti_result } #[allow(unused_must_use, unused_parens, unused_variables, dead_code, non_snake_case)] @@ -72,7 +76,8 @@ non_snake_case)] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pledge_item_test3_$(NUM_UUID)(x: u32, result: u32) -> bool { - !!((result == match x { 1 => 1, 2 => 2, _ => 0, }): bool) + let prusti_result: bool = result == match x { 1 => 1, 2 => 2, _ => 0, }; + prusti_result } #[prusti::assert_pledge_spec_id_ref_lhs = "$(NUM_UUID)"] #[prusti::assert_pledge_spec_id_ref_rhs = "$(NUM_UUID)"] diff --git a/prusti-tests/tests/parse/ui/composite.stdout b/prusti-tests/tests/parse/ui/composite.stdout index e135aebb9b1..8c0238fa2cc 100644 --- a/prusti-tests/tests/parse/ui/composite.stdout +++ b/prusti-tests/tests/parse/ui/composite.stdout @@ -29,7 +29,6 @@ -#![feature(type_ascription)] #![feature(stmt_expr_attributes)] #![feature(register_tool)] #![register_tool(prusti)] @@ -43,7 +42,8 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test1_$(NUM_UUID)() -> bool { - !!((!((true) && (true)) || ((true) && (true))): bool) + let prusti_result: bool = !((true) && (true)) || ((true) && (true)); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -53,8 +53,9 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test2_$(NUM_UUID)() -> bool { - !!(((((true) && ((!(true) || (true)))) && (((true) || (true)))) && - (true)): bool) + let prusti_result: bool = + (((true) && ((!(true) || (true)))) && (((true) || (true)))) && (true); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -64,7 +65,8 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test3_$(NUM_UUID)() -> bool { - !!((!(((true) && (true))) || (true)): bool) + let prusti_result: bool = !(((true) && (true))) || (true); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -74,7 +76,8 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test4_$(NUM_UUID)() -> bool { - !!((!(((!(true) || (true))) && (true)) || (true)): bool) + let prusti_result: bool = !(((!(true) || (true))) && (true)) || (true); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -84,8 +87,10 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test5_$(NUM_UUID)() -> bool { - !!((((!(true) || (true))) && - ((!(true) || ((true) && (((true) || (true))))))): bool) + let prusti_result: bool = + ((!(true) || (true))) && + ((!(true) || ((true) && (((true) || (true)))))); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -95,8 +100,10 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test6_$(NUM_UUID)() -> bool { - !!((!(((true) && (true))) || - (!(true) || (!(true) || (!(true) || (true))))): bool) + let prusti_result: bool = + !(((true) && (true))) || + (!(true) || (!(true) || (!(true) || (true)))); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -106,8 +113,10 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test7_$(NUM_UUID)() -> bool { - !!((!(((true) && (true))) || - (!(((true) && (true))) || (((true) && (true))))): bool) + let prusti_result: bool = + !(((true) && (true))) || + (!(((true) && (true))) || (((true) && (true)))); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -117,7 +126,8 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test8_$(NUM_UUID)() -> bool { - !!((!(((true) || (true))) || (((true) || (true)))): bool) + let prusti_result: bool = !(((true) || (true))) || (((true) || (true))); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -127,8 +137,10 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test9_$(NUM_UUID)() -> bool { - !!((!(((true) || (true))) || - (((true) || (((true) && (((true) || (true)))))))): bool) + let prusti_result: bool = + !(((true) || (true))) || + (((true) || (((true) && (((true) || (true))))))); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -138,10 +150,11 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test10_$(NUM_UUID)() -> bool { - !!(((true) && - (::prusti_contracts::forall((), - #[prusti::spec_only] |a: i32| -> bool - { ((a == 5): bool) }))): bool) + let prusti_result: bool = + (true) && + (::prusti_contracts::forall((), + #[prusti::spec_only] |a: i32| -> bool { a == 5 })); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -151,9 +164,10 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test12_$(NUM_UUID)() -> bool { - !!((::prusti_contracts::forall((), - #[prusti::spec_only] |a: i32| -> bool - { ((a == 5): bool) })): bool) + let prusti_result: bool = + ::prusti_contracts::forall((), + #[prusti::spec_only] |a: i32| -> bool { a == 5 }); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -163,10 +177,12 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test13_$(NUM_UUID)() -> bool { - !!((!(true) || - (!(::prusti_contracts::forall((), - #[prusti::spec_only] |a: i32, b: i32| -> bool - { ((a == 5): bool) })) || (true))): bool) + let prusti_result: bool = + !(true) || + (!(::prusti_contracts::forall((), + #[prusti::spec_only] |a: i32, b: i32| -> bool { a == 5 })) + || (true)); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -176,10 +192,11 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test14_$(NUM_UUID)() -> bool { - !!((!(true) || - (::prusti_contracts::forall((), - #[prusti::spec_only] |a: i32| -> bool - { ((a == 5): bool) }))): bool) + let prusti_result: bool = + !(true) || + (::prusti_contracts::forall((), + #[prusti::spec_only] |a: i32| -> bool { a == 5 })); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -189,9 +206,11 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test15_$(NUM_UUID)() -> bool { - !!((!(::prusti_contracts::forall((), - #[prusti::spec_only] |a: i32| -> bool { ((a == 5): bool) })) - || (true)): bool) + let prusti_result: bool = + !(::prusti_contracts::forall((), + #[prusti::spec_only] |a: i32| -> bool { a == 5 })) || + (true); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -201,13 +220,13 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test16_$(NUM_UUID)() -> bool { - !!((!(::prusti_contracts::forall((), - #[prusti::spec_only] |b: i32| -> bool - { ((b == 10): bool) })) || - (!(true) || - (::prusti_contracts::forall((), - #[prusti::spec_only] |a: u32, b: u32| -> bool - { ((a == 5): bool) })))): bool) + let prusti_result: bool = + !(::prusti_contracts::forall((), + #[prusti::spec_only] |b: i32| -> bool { b == 10 })) || + (!(true) || + (::prusti_contracts::forall((), + #[prusti::spec_only] |a: u32, b: u32| -> bool { a == 5 }))); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -217,10 +236,11 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test17_$(NUM_UUID)() -> bool { - !!(((true) && - (::prusti_contracts::exists((), - #[prusti::spec_only] |a: i32| -> bool - { ((a == 5): bool) }))): bool) + let prusti_result: bool = + (true) && + (::prusti_contracts::exists((), + #[prusti::spec_only] |a: i32| -> bool { a == 5 })); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -230,9 +250,10 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test19_$(NUM_UUID)() -> bool { - !!((::prusti_contracts::exists((), - #[prusti::spec_only] |a: i32| -> bool - { ((a == 5): bool) })): bool) + let prusti_result: bool = + ::prusti_contracts::exists((), + #[prusti::spec_only] |a: i32| -> bool { a == 5 }); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -242,10 +263,12 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test20_$(NUM_UUID)() -> bool { - !!((!(true) || - (!(::prusti_contracts::exists((), - #[prusti::spec_only] |a: i32, b: i32| -> bool - { ((a == 5): bool) })) || (true))): bool) + let prusti_result: bool = + !(true) || + (!(::prusti_contracts::exists((), + #[prusti::spec_only] |a: i32, b: i32| -> bool { a == 5 })) + || (true)); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -255,10 +278,11 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test21_$(NUM_UUID)() -> bool { - !!((!(true) || - (::prusti_contracts::exists((), - #[prusti::spec_only] |a: i32| -> bool - { ((a == 5): bool) }))): bool) + let prusti_result: bool = + !(true) || + (::prusti_contracts::exists((), + #[prusti::spec_only] |a: i32| -> bool { a == 5 })); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -268,9 +292,11 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test22_$(NUM_UUID)() -> bool { - !!((!(::prusti_contracts::exists((), - #[prusti::spec_only] |a: i32| -> bool { ((a == 5): bool) })) - || (true)): bool) + let prusti_result: bool = + !(::prusti_contracts::exists((), + #[prusti::spec_only] |a: i32| -> bool { a == 5 })) || + (true); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -280,13 +306,13 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test23_$(NUM_UUID)() -> bool { - !!((!(::prusti_contracts::exists((), - #[prusti::spec_only] |b: i32| -> bool - { ((b == 10): bool) })) || - (!(true) || - (::prusti_contracts::exists((), - #[prusti::spec_only] |a: u32, b: u32| -> bool - { ((a == 5): bool) })))): bool) + let prusti_result: bool = + !(::prusti_contracts::exists((), + #[prusti::spec_only] |b: i32| -> bool { b == 10 })) || + (!(true) || + (::prusti_contracts::exists((), + #[prusti::spec_only] |a: u32, b: u32| -> bool { a == 5 }))); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -296,7 +322,8 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test24_$(NUM_UUID)() -> bool { - !!((((true) && (true)) || (true)): bool) + let prusti_result: bool = ((true) && (true)) || (true); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -306,12 +333,12 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test25_$(NUM_UUID)() -> bool { - !!(((::prusti_contracts::forall((), - #[prusti::spec_only] |a: i32| -> bool { ((a == 5): bool) })) - || - (::prusti_contracts::forall((), - #[prusti::spec_only] |a: i32| -> bool - { ((a == 5): bool) }))): bool) + let prusti_result: bool = + (::prusti_contracts::forall((), + #[prusti::spec_only] |a: i32| -> bool { a == 5 })) || + (::prusti_contracts::forall((), + #[prusti::spec_only] |a: i32| -> bool { a == 5 })); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -321,12 +348,12 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test26_$(NUM_UUID)() -> bool { - !!(((::prusti_contracts::exists((), - #[prusti::spec_only] |a: i32| -> bool { ((a == 5): bool) })) - || - (::prusti_contracts::exists((), - #[prusti::spec_only] |a: i32| -> bool - { ((a == 5): bool) }))): bool) + let prusti_result: bool = + (::prusti_contracts::exists((), + #[prusti::spec_only] |a: i32| -> bool { a == 5 })) || + (::prusti_contracts::exists((), + #[prusti::spec_only] |a: i32| -> bool { a == 5 })); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] diff --git a/prusti-tests/tests/parse/ui/empty.stdout b/prusti-tests/tests/parse/ui/empty.stdout index 4676c524737..77f14acdd73 100644 --- a/prusti-tests/tests/parse/ui/empty.stdout +++ b/prusti-tests/tests/parse/ui/empty.stdout @@ -1,6 +1,5 @@ // compile-flags: -Pprint_desugared_specs=true -Pno_verify=true -Phide_uuids=true -#![feature(type_ascription)] #![feature(stmt_expr_attributes)] #![feature(register_tool)] #![register_tool(prusti)] diff --git a/prusti-tests/tests/parse/ui/exists.stdout b/prusti-tests/tests/parse/ui/exists.stdout index a3a7150c4b5..be7b7034c8a 100644 --- a/prusti-tests/tests/parse/ui/exists.stdout +++ b/prusti-tests/tests/parse/ui/exists.stdout @@ -11,7 +11,6 @@ -#![feature(type_ascription)] #![feature(stmt_expr_attributes)] #![feature(register_tool)] #![register_tool(prusti)] @@ -25,9 +24,10 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test1_$(NUM_UUID)() -> bool { - !!((::prusti_contracts::exists((), - #[prusti::spec_only] |a: i32| -> bool - { (((a + a == a + a)): bool) })): bool) + let prusti_result: bool = + ::prusti_contracts::exists((), + #[prusti::spec_only] |a: i32| -> bool { (a + a == a + a) }); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -37,11 +37,11 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test2_$(NUM_UUID)() -> bool { - !!((::prusti_contracts::exists((), - #[prusti::spec_only] |a: i32, b: i32| -> bool - { - ((((a + b == a + b) && (true)) == (a + b == a + b)): bool) - })): bool) + let prusti_result: bool = + ::prusti_contracts::exists((), + #[prusti::spec_only] |a: i32, b: i32| -> bool + { ((a + b == a + b) && (true)) == (a + b == a + b) }); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -51,9 +51,11 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test3_$(NUM_UUID)() -> bool { - !!((::prusti_contracts::exists((), - #[prusti::spec_only] |a: i32, b: i32| -> bool - { ((!(a + b == a + b) || (a + b == a + b)): bool) })): bool) + let prusti_result: bool = + ::prusti_contracts::exists((), + #[prusti::spec_only] |a: i32, b: i32| -> bool + { !(a + b == a + b) || (a + b == a + b) }); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -63,10 +65,11 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test4_$(NUM_UUID)() -> bool { - !!((::prusti_contracts::exists(((#[prusti::spec_only] |a: i32| (1), - #[prusti::spec_only] |a: i32| ((2 == 2) && (true))),), - #[prusti::spec_only] |a: i32| -> bool - { ((a + a == a + a): bool) })): bool) + let prusti_result: bool = + ::prusti_contracts::exists(((#[prusti::spec_only] |a: i32| (1), + #[prusti::spec_only] |a: i32| ((2 == 2) && (true))),), + #[prusti::spec_only] |a: i32| -> bool { a + a == a + a }); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -76,11 +79,12 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test5_$(NUM_UUID)() -> bool { - !!((::prusti_contracts::exists(((#[prusti::spec_only] |a: i32, b: i32| - (1), #[prusti::spec_only] |a: i32, b: i32| (2)), - (#[prusti::spec_only] |a: i32, b: i32| (1),)), - #[prusti::spec_only] |a: i32, b: i32| -> bool - { ((a + b == a + b): bool) })): bool) + let prusti_result: bool = + ::prusti_contracts::exists(((#[prusti::spec_only] |a: i32, b: i32| + (1), #[prusti::spec_only] |a: i32, b: i32| (2)), + (#[prusti::spec_only] |a: i32, b: i32| (1),)), + #[prusti::spec_only] |a: i32, b: i32| -> bool { a + b == a + b }); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -90,14 +94,16 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test6_$(NUM_UUID)() -> bool { - !!((::prusti_contracts::exists(((#[prusti::spec_only] |a: i32, b: i32| - (1), #[prusti::spec_only] |a: i32, b: i32| (2), - #[prusti::spec_only] |a: i32, b: i32| (3)), - (#[prusti::spec_only] |a: i32, b: i32| (1), - #[prusti::spec_only] |a: i32, b: i32| (2)), - (#[prusti::spec_only] |a: i32, b: i32| (1),)), - #[prusti::spec_only] |a: i32, b: i32| -> bool - { ((!(a + b == a + b) || (a + b == a + b)): bool) })): bool) + let prusti_result: bool = + ::prusti_contracts::exists(((#[prusti::spec_only] |a: i32, b: i32| + (1), #[prusti::spec_only] |a: i32, b: i32| (2), + #[prusti::spec_only] |a: i32, b: i32| (3)), + (#[prusti::spec_only] |a: i32, b: i32| (1), + #[prusti::spec_only] |a: i32, b: i32| (2)), + (#[prusti::spec_only] |a: i32, b: i32| (1),)), + #[prusti::spec_only] |a: i32, b: i32| -> bool + { !(a + b == a + b) || (a + b == a + b) }); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] diff --git a/prusti-tests/tests/parse/ui/expression.stdout b/prusti-tests/tests/parse/ui/expression.stdout index a675007c16a..3737677aaa9 100644 --- a/prusti-tests/tests/parse/ui/expression.stdout +++ b/prusti-tests/tests/parse/ui/expression.stdout @@ -7,7 +7,6 @@ -#![feature(type_ascription)] #![feature(stmt_expr_attributes)] #![feature(register_tool)] #![register_tool(prusti)] @@ -21,7 +20,8 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test1_$(NUM_UUID)() -> bool { - !!(((1 == 1) && (1 != 2)): bool) + let prusti_result: bool = (1 == 1) && (1 != 2); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -32,7 +32,8 @@ non_snake_case)] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_post_item_test2_$(NUM_UUID)(result: ()) -> bool { - !!(((1 == 1) || (1 == 2)): bool) + let prusti_result: bool = (1 == 1) || (1 == 2); + prusti_result } #[prusti::post_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] diff --git a/prusti-tests/tests/parse/ui/forall.stdout b/prusti-tests/tests/parse/ui/forall.stdout index 96f3c59b5b1..b2b9a4f66e7 100644 --- a/prusti-tests/tests/parse/ui/forall.stdout +++ b/prusti-tests/tests/parse/ui/forall.stdout @@ -11,7 +11,6 @@ -#![feature(type_ascription)] #![feature(stmt_expr_attributes)] #![feature(register_tool)] #![register_tool(prusti)] @@ -25,9 +24,10 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test1_$(NUM_UUID)() -> bool { - !!((::prusti_contracts::forall((), - #[prusti::spec_only] |a: i32| -> bool - { (((a + a == a + a)): bool) })): bool) + let prusti_result: bool = + ::prusti_contracts::forall((), + #[prusti::spec_only] |a: i32| -> bool { (a + a == a + a) }); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -37,11 +37,11 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test2_$(NUM_UUID)() -> bool { - !!((::prusti_contracts::forall((), - #[prusti::spec_only] |a: i32, b: i32| -> bool - { - ((((a + b == a + b) && (true)) == (a + b == a + b)): bool) - })): bool) + let prusti_result: bool = + ::prusti_contracts::forall((), + #[prusti::spec_only] |a: i32, b: i32| -> bool + { ((a + b == a + b) && (true)) == (a + b == a + b) }); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -51,9 +51,11 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test3_$(NUM_UUID)() -> bool { - !!((::prusti_contracts::forall((), - #[prusti::spec_only] |a: i32, b: i32| -> bool - { ((!(a + b == a + b) || (a + b == a + b)): bool) })): bool) + let prusti_result: bool = + ::prusti_contracts::forall((), + #[prusti::spec_only] |a: i32, b: i32| -> bool + { !(a + b == a + b) || (a + b == a + b) }); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -63,10 +65,11 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test4_$(NUM_UUID)() -> bool { - !!((::prusti_contracts::forall(((#[prusti::spec_only] |a: i32| (1), - #[prusti::spec_only] |a: i32| ((2 == 2) && (true))),), - #[prusti::spec_only] |a: i32| -> bool - { ((a + a == a + a): bool) })): bool) + let prusti_result: bool = + ::prusti_contracts::forall(((#[prusti::spec_only] |a: i32| (1), + #[prusti::spec_only] |a: i32| ((2 == 2) && (true))),), + #[prusti::spec_only] |a: i32| -> bool { a + a == a + a }); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -76,11 +79,12 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test5_$(NUM_UUID)() -> bool { - !!((::prusti_contracts::forall(((#[prusti::spec_only] |a: i32, b: i32| - (1), #[prusti::spec_only] |a: i32, b: i32| (2)), - (#[prusti::spec_only] |a: i32, b: i32| (1),)), - #[prusti::spec_only] |a: i32, b: i32| -> bool - { ((a + b == a + b): bool) })): bool) + let prusti_result: bool = + ::prusti_contracts::forall(((#[prusti::spec_only] |a: i32, b: i32| + (1), #[prusti::spec_only] |a: i32, b: i32| (2)), + (#[prusti::spec_only] |a: i32, b: i32| (1),)), + #[prusti::spec_only] |a: i32, b: i32| -> bool { a + b == a + b }); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -90,14 +94,16 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test6_$(NUM_UUID)() -> bool { - !!((::prusti_contracts::forall(((#[prusti::spec_only] |a: i32, b: i32| - (1), #[prusti::spec_only] |a: i32, b: i32| (2), - #[prusti::spec_only] |a: i32, b: i32| (3)), - (#[prusti::spec_only] |a: i32, b: i32| (1), - #[prusti::spec_only] |a: i32, b: i32| (2)), - (#[prusti::spec_only] |a: i32, b: i32| (1),)), - #[prusti::spec_only] |a: i32, b: i32| -> bool - { ((!(a + b == a + b) || (a + b == a + b)): bool) })): bool) + let prusti_result: bool = + ::prusti_contracts::forall(((#[prusti::spec_only] |a: i32, b: i32| + (1), #[prusti::spec_only] |a: i32, b: i32| (2), + #[prusti::spec_only] |a: i32, b: i32| (3)), + (#[prusti::spec_only] |a: i32, b: i32| (1), + #[prusti::spec_only] |a: i32, b: i32| (2)), + (#[prusti::spec_only] |a: i32, b: i32| (1),)), + #[prusti::spec_only] |a: i32, b: i32| -> bool + { !(a + b == a + b) || (a + b == a + b) }); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] diff --git a/prusti-tests/tests/parse/ui/implies.stdout b/prusti-tests/tests/parse/ui/implies.stdout index 89bdf502e21..736afa8a39f 100644 --- a/prusti-tests/tests/parse/ui/implies.stdout +++ b/prusti-tests/tests/parse/ui/implies.stdout @@ -15,7 +15,6 @@ -#![feature(type_ascription)] #![feature(stmt_expr_attributes)] #![feature(register_tool)] #![register_tool(prusti)] @@ -29,7 +28,8 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test1_$(NUM_UUID)() -> bool { - !!((!(true) || (true)): bool) + let prusti_result: bool = !(true) || (true); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -39,7 +39,8 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test2_$(NUM_UUID)() -> bool { - !!((!(true) || (!(true) || (true))): bool) + let prusti_result: bool = !(true) || (!(true) || (true)); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -49,7 +50,8 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test3_$(NUM_UUID)() -> bool { - !!((!(true) || ((!(true) || (true)))): bool) + let prusti_result: bool = !(true) || ((!(true) || (true))); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -59,7 +61,8 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test4_$(NUM_UUID)() -> bool { - !!((!((!(true) || (true))) || (true)): bool) + let prusti_result: bool = !((!(true) || (true))) || (true); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -69,7 +72,8 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test5_$(NUM_UUID)() -> bool { - !!((!((!(true) || (true))) || ((!(true) || (true)))): bool) + let prusti_result: bool = !((!(true) || (true))) || ((!(true) || (true))); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -79,7 +83,8 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test21_$(NUM_UUID)() -> bool { - !!((!(true) || (true)): bool) + let prusti_result: bool = !(true) || (true); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -89,7 +94,8 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test22_$(NUM_UUID)() -> bool { - !!((!(true) || (!(true) || (true))): bool) + let prusti_result: bool = !(true) || (!(true) || (true)); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -99,7 +105,8 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test23_$(NUM_UUID)() -> bool { - !!((!(true) || ((!(true) || (true)))): bool) + let prusti_result: bool = !(true) || ((!(true) || (true))); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -109,7 +116,8 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test24_$(NUM_UUID)() -> bool { - !!((!((!(true) || (true))) || (true)): bool) + let prusti_result: bool = !((!(true) || (true))) || (true); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -119,7 +127,8 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test25_$(NUM_UUID)() -> bool { - !!((!((!(true) || (true))) || ((!(true) || (true)))): bool) + let prusti_result: bool = !((!(true) || (true))) || ((!(true) || (true))); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] diff --git a/prusti-tests/tests/parse/ui/parenthesis.stderr b/prusti-tests/tests/parse/ui/parenthesis.stderr index a783c287344..54a1d67f983 100644 --- a/prusti-tests/tests/parse/ui/parenthesis.stderr +++ b/prusti-tests/tests/parse/ui/parenthesis.stderr @@ -2,7 +2,10 @@ error[E0308]: mismatched types --> $DIR/parenthesis.rs:8:15 | 8 | #[requires( ( 12345))] - | ^^^^^^^^^^^ expected `bool`, found integer + | ^^^^^^^^^^^ + | | + | expected `bool`, found integer + | expected due to this error[E0308]: mismatched types --> $DIR/parenthesis.rs:11:20 diff --git a/prusti-tests/tests/parse/ui/predicates-visibility.stdout b/prusti-tests/tests/parse/ui/predicates-visibility.stdout index 3ebd48713fd..f1a453b2e48 100644 --- a/prusti-tests/tests/parse/ui/predicates-visibility.stdout +++ b/prusti-tests/tests/parse/ui/predicates-visibility.stdout @@ -8,7 +8,6 @@ -#![feature(type_ascription)] #![feature(stmt_expr_attributes)] #![feature(register_tool)] #![register_tool(prusti)] @@ -26,17 +25,21 @@ mod foo { #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pred_item_pred1_$(NUM_UUID)(a: bool) -> bool { - (({ - ::prusti_contracts::forall((), - #[prusti::spec_only] |b: bool| -> bool { ((a == b): bool) }) - }): bool) + let prusti_result: bool = + { + ::prusti_contracts::forall((), + #[prusti::spec_only] |b: bool| -> bool { a == b }) + }; + prusti_result } #[allow(unused_must_use, unused_variables, dead_code)] #[prusti::pred_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] pub fn pred1(a: bool) -> bool { - ::core::panicking::panic_fmt(format_args!("not implemented: {0}", - format_args!("predicate"))) + { + ::core::panicking::panic_fmt(format_args!("not implemented: {0}", + format_args!("predicate"))); + } } } #[allow(unused_must_use, unused_parens, unused_variables, dead_code, @@ -44,7 +47,8 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test_pub_pred_$(NUM_UUID)() -> bool { - !!((foo::pred1(true)): bool) + let prusti_result: bool = foo::pred1(true); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] diff --git a/prusti-tests/tests/parse/ui/predicates.stdout b/prusti-tests/tests/parse/ui/predicates.stdout index bd47d01ae3c..aea6d0a2371 100644 --- a/prusti-tests/tests/parse/ui/predicates.stdout +++ b/prusti-tests/tests/parse/ui/predicates.stdout @@ -12,7 +12,6 @@ -#![feature(type_ascription)] #![feature(stmt_expr_attributes)] #![feature(register_tool)] #![register_tool(prusti)] @@ -27,24 +26,29 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pred_item_pred1_$(NUM_UUID)(a: bool) -> bool { - (({ - ::prusti_contracts::forall((), - #[prusti::spec_only] |b: bool| -> bool { ((a == b): bool) }) - }): bool) + let prusti_result: bool = + { + ::prusti_contracts::forall((), + #[prusti::spec_only] |b: bool| -> bool { a == b }) + }; + prusti_result } #[allow(unused_must_use, unused_variables, dead_code)] #[prusti::pred_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] fn pred1(a: bool) -> bool { - ::core::panicking::panic_fmt(format_args!("not implemented: {0}", - format_args!("predicate"))) + { + ::core::panicking::panic_fmt(format_args!("not implemented: {0}", + format_args!("predicate"))); + } } #[allow(unused_must_use, unused_parens, unused_variables, dead_code, non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_use_pred1_$(NUM_UUID)() -> bool { - !!((pred1(true)): bool) + let prusti_result: bool = pred1(true); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -54,24 +58,29 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pred_item_pred2_$(NUM_UUID)(a: bool) -> bool { - (({ - ::prusti_contracts::exists((), - #[prusti::spec_only] |b: bool| -> bool { ((a == b): bool) }) - }): bool) + let prusti_result: bool = + { + ::prusti_contracts::exists((), + #[prusti::spec_only] |b: bool| -> bool { a == b }) + }; + prusti_result } #[allow(unused_must_use, unused_variables, dead_code)] #[prusti::pred_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] fn pred2(a: bool) -> bool { - ::core::panicking::panic_fmt(format_args!("not implemented: {0}", - format_args!("predicate"))) + { + ::core::panicking::panic_fmt(format_args!("not implemented: {0}", + format_args!("predicate"))); + } } #[allow(unused_must_use, unused_parens, unused_variables, dead_code, non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_use_pred2_$(NUM_UUID)() -> bool { - !!((pred2(true)): bool) + let prusti_result: bool = pred2(true); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -82,18 +91,22 @@ non_snake_case)] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pred_item_forall_implication_$(NUM_UUID)() -> bool { - (({ - ::prusti_contracts::forall((), - #[prusti::spec_only] |x: usize| -> bool - { ((!((x != 0)) || (x * 2 != 0)): bool) }) - }): bool) + let prusti_result: bool = + { + ::prusti_contracts::forall((), + #[prusti::spec_only] |x: usize| -> bool + { !((x != 0)) || (x * 2 != 0) }) + }; + prusti_result } #[allow(unused_must_use, unused_variables, dead_code)] #[prusti::pred_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] fn forall_implication() -> bool { - ::core::panicking::panic_fmt(format_args!("not implemented: {0}", - format_args!("predicate"))) + { + ::core::panicking::panic_fmt(format_args!("not implemented: {0}", + format_args!("predicate"))); + } } #[allow(unused_must_use, unused_parens, unused_variables, dead_code, non_snake_case)] @@ -101,18 +114,22 @@ non_snake_case)] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pred_item_exists_implication_$(NUM_UUID)() -> bool { - (({ - ::prusti_contracts::exists((), - #[prusti::spec_only] |x: usize| -> bool - { ((!((x != 0)) || (x * 2 != 0)): bool) }) - }): bool) + let prusti_result: bool = + { + ::prusti_contracts::exists((), + #[prusti::spec_only] |x: usize| -> bool + { !((x != 0)) || (x * 2 != 0) }) + }; + prusti_result } #[allow(unused_must_use, unused_variables, dead_code)] #[prusti::pred_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] fn exists_implication() -> bool { - ::core::panicking::panic_fmt(format_args!("not implemented: {0}", - format_args!("predicate"))) + { + ::core::panicking::panic_fmt(format_args!("not implemented: {0}", + format_args!("predicate"))); + } } fn main() {} ProcedureSpecification { source: DefId(0:7 ~ predicates[$(CRATE_ID)]::pred1), kind: Inherent(Predicate(Some(DefId(0:5 ~ predicates[$(CRATE_ID)]::prusti_pred_item_pred1_$(NUM_UUID))))), pres: Empty, posts: Empty, pledges: Empty, trusted: Inherent(false), terminates: Inherent(None), purity: Inherent(None) } diff --git a/prusti-tests/tests/parse/ui/simple_and.stderr b/prusti-tests/tests/parse/ui/simple_and.stderr index 43847c58c76..d68d12687ab 100644 --- a/prusti-tests/tests/parse/ui/simple_and.stderr +++ b/prusti-tests/tests/parse/ui/simple_and.stderr @@ -2,25 +2,37 @@ error[E0308]: mismatched types --> $DIR/simple_and.rs:5:12 | 5 | #[requires(12345)] - | ^^^^^ expected `bool`, found integer + | ^^^^^ + | | + | expected `bool`, found integer + | expected due to this error[E0308]: mismatched types --> $DIR/simple_and.rs:8:17 | 8 | #[requires (12345)] - | ^^^^^ expected `bool`, found integer + | ^^^^^ + | | + | expected `bool`, found integer + | expected due to this error[E0308]: mismatched types --> $DIR/simple_and.rs:17:5 | 17 | 12345) ] - | ^^^^^ expected `bool`, found integer + | ^^^^^ + | | + | expected `bool`, found integer + | expected due to this error[E0308]: mismatched types --> $DIR/simple_and.rs:22:5 | 22 | 12345) - | ^^^^^ expected `bool`, found integer + | ^^^^^ + | | + | expected `bool`, found integer + | expected due to this error[E0308]: mismatched types --> $DIR/simple_and.rs:26:20 diff --git a/prusti-tests/tests/parse/ui/trait-bounds.stdout b/prusti-tests/tests/parse/ui/trait-bounds.stdout index dffbf72abcd..2bd0f271c5b 100644 --- a/prusti-tests/tests/parse/ui/trait-bounds.stdout +++ b/prusti-tests/tests/parse/ui/trait-bounds.stdout @@ -8,7 +8,6 @@ -#![feature(type_ascription)] #![feature(stmt_expr_attributes)] #![feature(register_tool)] #![register_tool(prusti)] @@ -35,7 +34,8 @@ impl<'a, T: PartialEq, const L : usize> #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_post_item_bar_$(NUM_UUID)(_self: Foo<'a, T, L>, result: &'a [T; L]) -> bool { - !!((result == _self.0): bool) + let prusti_result: bool = result == _self.0; + prusti_result } #[prusti::extern_spec = "inherent_impl"] #[allow(unused, dead_code)] diff --git a/prusti-tests/tests/parse/ui/traits.stdout b/prusti-tests/tests/parse/ui/traits.stdout index 48b8cc30964..fb4a259b168 100644 --- a/prusti-tests/tests/parse/ui/traits.stdout +++ b/prusti-tests/tests/parse/ui/traits.stdout @@ -25,7 +25,6 @@ -#![feature(type_ascription)] #![feature(stmt_expr_attributes)] #![feature(register_tool)] #![register_tool(prusti)] @@ -40,7 +39,8 @@ trait Test1 { #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test1_$(NUM_UUID)() -> bool { - !!((true): bool) + let prusti_result: bool = true; + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -51,7 +51,8 @@ trait Test1 { #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_post_item_test2_$(NUM_UUID)(result: ()) -> bool { - !!((true): bool) + let prusti_result: bool = true; + prusti_result } #[prusti::post_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -61,7 +62,8 @@ trait Test1 { #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test3_$(NUM_UUID)() -> bool { - !!((true): bool) + let prusti_result: bool = true; + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -72,7 +74,8 @@ trait Test1 { #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_post_item_test4_$(NUM_UUID)(result: ()) -> bool { - !!((true): bool) + let prusti_result: bool = true; + prusti_result } #[prusti::post_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -84,7 +87,8 @@ trait Test2 { #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test1_$(NUM_UUID)() -> bool { - !!((true): bool) + let prusti_result: bool = true; + prusti_result } #[allow(unused_must_use, unused_parens, unused_variables, dead_code, non_snake_case)] @@ -92,7 +96,8 @@ trait Test2 { #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_post_item_test1_$(NUM_UUID)(result: ()) -> bool { - !!((true): bool) + let prusti_result: bool = true; + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::post_spec_id_ref = "$(NUM_UUID)"] @@ -103,7 +108,8 @@ trait Test2 { #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test2_$(NUM_UUID)() -> bool { - !!((true): bool) + let prusti_result: bool = true; + prusti_result } #[allow(unused_must_use, unused_parens, unused_variables, dead_code, non_snake_case)] @@ -111,7 +117,8 @@ trait Test2 { #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_post_item_test2_$(NUM_UUID)(result: ()) -> bool { - !!((true): bool) + let prusti_result: bool = true; + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::post_spec_id_ref = "$(NUM_UUID)"] @@ -124,7 +131,8 @@ trait Test3 { #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test1_$(NUM_UUID)(&self) -> bool { - !!((true): bool) + let prusti_result: bool = true; + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -135,7 +143,8 @@ trait Test3 { #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_post_item_test2_$(NUM_UUID)(&self, result: ()) -> bool { - !!((true): bool) + let prusti_result: bool = true; + prusti_result } #[prusti::post_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -145,7 +154,8 @@ trait Test3 { #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test3_$(NUM_UUID)(&self) -> bool { - !!((true): bool) + let prusti_result: bool = true; + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -156,7 +166,8 @@ trait Test3 { #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_post_item_test4_$(NUM_UUID)(&self, result: ()) -> bool { - !!((true): bool) + let prusti_result: bool = true; + prusti_result } #[prusti::post_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -168,7 +179,8 @@ trait Test4 { #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test1_$(NUM_UUID)(&self) -> bool { - !!((true): bool) + let prusti_result: bool = true; + prusti_result } #[allow(unused_must_use, unused_parens, unused_variables, dead_code, non_snake_case)] @@ -176,7 +188,8 @@ trait Test4 { #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_post_item_test1_$(NUM_UUID)(&self, result: ()) -> bool { - !!((true): bool) + let prusti_result: bool = true; + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::post_spec_id_ref = "$(NUM_UUID)"] @@ -187,7 +200,8 @@ trait Test4 { #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test2_$(NUM_UUID)(&self) -> bool { - !!((true): bool) + let prusti_result: bool = true; + prusti_result } #[allow(unused_must_use, unused_parens, unused_variables, dead_code, non_snake_case)] @@ -195,7 +209,8 @@ trait Test4 { #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_post_item_test2_$(NUM_UUID)(&self, result: ()) -> bool { - !!((true): bool) + let prusti_result: bool = true; + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::post_spec_id_ref = "$(NUM_UUID)"] diff --git a/prusti-tests/tests/parse/ui/true.stdout b/prusti-tests/tests/parse/ui/true.stdout index 38d8e2be6c2..21f2c83de9a 100644 --- a/prusti-tests/tests/parse/ui/true.stdout +++ b/prusti-tests/tests/parse/ui/true.stdout @@ -9,7 +9,6 @@ -#![feature(type_ascription)] #![feature(stmt_expr_attributes)] #![feature(register_tool)] #![register_tool(prusti)] @@ -23,7 +22,8 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test1_$(NUM_UUID)() -> bool { - !!((true): bool) + let prusti_result: bool = true; + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -34,7 +34,8 @@ non_snake_case)] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_post_item_test2_$(NUM_UUID)(result: ()) -> bool { - !!((true): bool) + let prusti_result: bool = true; + prusti_result } #[prusti::post_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -61,7 +62,8 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test4_$(NUM_UUID)() -> bool { - !!((true): bool) + let prusti_result: bool = true; + prusti_result } #[allow(unused_must_use, unused_parens, unused_variables, dead_code, non_snake_case)] @@ -69,7 +71,8 @@ non_snake_case)] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_post_item_test4_$(NUM_UUID)(result: ()) -> bool { - !!((true): bool) + let prusti_result: bool = true; + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::post_spec_id_ref = "$(NUM_UUID)"] diff --git a/prusti-tests/tests/parse/ui/trusted.stdout b/prusti-tests/tests/parse/ui/trusted.stdout index ee4abe3abf6..c50084f549e 100644 --- a/prusti-tests/tests/parse/ui/trusted.stdout +++ b/prusti-tests/tests/parse/ui/trusted.stdout @@ -7,7 +7,6 @@ -#![feature(type_ascription)] #![feature(stmt_expr_attributes)] #![feature(register_tool)] #![register_tool(prusti)] diff --git a/prusti-tests/tests/typecheck/ui/forall_encode_typeck.stdout b/prusti-tests/tests/typecheck/ui/forall_encode_typeck.stdout index 9c1730f139e..dfcfc0f4f02 100644 --- a/prusti-tests/tests/typecheck/ui/forall_encode_typeck.stdout +++ b/prusti-tests/tests/typecheck/ui/forall_encode_typeck.stdout @@ -7,7 +7,6 @@ -#![feature(type_ascription)] #![feature(stmt_expr_attributes)] #![feature(register_tool)] #![register_tool(prusti)] @@ -21,11 +20,12 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test1_$(NUM_UUID)() -> bool { - !!((::prusti_contracts::forall(((#[prusti::spec_only] |a: i32, b: u32| - (a == a), #[prusti::spec_only] |a: i32, b: u32| (a == a)), - (#[prusti::spec_only] |a: i32, b: u32| (true),)), - #[prusti::spec_only] |a: i32, b: u32| -> bool - { ((a == a): bool) })): bool) + let prusti_result: bool = + ::prusti_contracts::forall(((#[prusti::spec_only] |a: i32, b: u32| + (a == a), #[prusti::spec_only] |a: i32, b: u32| (a == a)), + (#[prusti::spec_only] |a: i32, b: u32| (true),)), + #[prusti::spec_only] |a: i32, b: u32| -> bool { a == a }); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -35,11 +35,12 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test2_$(NUM_UUID)() -> bool { - !!((::prusti_contracts::exists(((#[prusti::spec_only] |a: i32, b: u32| - (a == a), #[prusti::spec_only] |a: i32, b: u32| (a == a)), - (#[prusti::spec_only] |a: i32, b: u32| (true),)), - #[prusti::spec_only] |a: i32, b: u32| -> bool - { ((a == a): bool) })): bool) + let prusti_result: bool = + ::prusti_contracts::exists(((#[prusti::spec_only] |a: i32, b: u32| + (a == a), #[prusti::spec_only] |a: i32, b: u32| (a == a)), + (#[prusti::spec_only] |a: i32, b: u32| (true),)), + #[prusti::spec_only] |a: i32, b: u32| -> bool { a == a }); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] diff --git a/prusti-tests/tests/typecheck/ui/forall_triggers.stdout b/prusti-tests/tests/typecheck/ui/forall_triggers.stdout index e24630b4595..ac6ac3c3288 100644 --- a/prusti-tests/tests/typecheck/ui/forall_triggers.stdout +++ b/prusti-tests/tests/typecheck/ui/forall_triggers.stdout @@ -13,7 +13,6 @@ -#![feature(type_ascription)] #![feature(stmt_expr_attributes)] #![feature(register_tool)] #![register_tool(prusti)] @@ -27,10 +26,11 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test1_$(NUM_UUID)() -> bool { - !!((::prusti_contracts::forall(((#[prusti::spec_only] |a: i32| - (a == a),),), - #[prusti::spec_only] |a: i32| -> bool { ((true): bool) })): - bool) + let prusti_result: bool = + ::prusti_contracts::forall(((#[prusti::spec_only] |a: i32| + (a == a),),), + #[prusti::spec_only] |a: i32| -> bool { true }); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -40,14 +40,15 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test2_$(NUM_UUID)() -> bool { - !!((::prusti_contracts::forall(((#[prusti::spec_only] |a: i32| - ((a == a) && (true)),),), - #[prusti::spec_only] |a: i32| -> bool - { - ((::prusti_contracts::forall((), - #[prusti::spec_only] |b: i32| -> bool { ((true): bool) })): - bool) - })): bool) + let prusti_result: bool = + ::prusti_contracts::forall(((#[prusti::spec_only] |a: i32| + ((a == a) && (true)),),), + #[prusti::spec_only] |a: i32| -> bool + { + ::prusti_contracts::forall((), + #[prusti::spec_only] |b: i32| -> bool { true }) + }); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -57,15 +58,16 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test3_$(NUM_UUID)() -> bool { - !!((::prusti_contracts::forall(((#[prusti::spec_only] |a: i32| - (a == a),),), - #[prusti::spec_only] |a: i32| -> bool - { - ((::prusti_contracts::forall(((#[prusti::spec_only] |b: i32| - (a == a),),), - #[prusti::spec_only] |b: i32| -> bool { ((true): bool) })): - bool) - })): bool) + let prusti_result: bool = + ::prusti_contracts::forall(((#[prusti::spec_only] |a: i32| + (a == a),),), + #[prusti::spec_only] |a: i32| -> bool + { + ::prusti_contracts::forall(((#[prusti::spec_only] |b: i32| + (a == a),),), + #[prusti::spec_only] |b: i32| -> bool { true }) + }); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -75,15 +77,16 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test4_$(NUM_UUID)() -> bool { - !!((::prusti_contracts::forall(((#[prusti::spec_only] |a: i32| - ((a == a) && (true)),),), - #[prusti::spec_only] |a: i32| -> bool - { - ((::prusti_contracts::forall(((#[prusti::spec_only] |b: i32| - (a == b),),), - #[prusti::spec_only] |b: i32| -> bool { ((true): bool) })): - bool) - })): bool) + let prusti_result: bool = + ::prusti_contracts::forall(((#[prusti::spec_only] |a: i32| + ((a == a) && (true)),),), + #[prusti::spec_only] |a: i32| -> bool + { + ::prusti_contracts::forall(((#[prusti::spec_only] |b: i32| + (a == b),),), + #[prusti::spec_only] |b: i32| -> bool { true }) + }); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -93,10 +96,11 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test5_$(NUM_UUID)() -> bool { - !!((::prusti_contracts::exists(((#[prusti::spec_only] |a: i32| - (a == a),),), - #[prusti::spec_only] |a: i32| -> bool { ((true): bool) })): - bool) + let prusti_result: bool = + ::prusti_contracts::exists(((#[prusti::spec_only] |a: i32| + (a == a),),), + #[prusti::spec_only] |a: i32| -> bool { true }); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -106,14 +110,15 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test6_$(NUM_UUID)() -> bool { - !!((::prusti_contracts::exists(((#[prusti::spec_only] |a: i32| - ((a == a) && (true)),),), - #[prusti::spec_only] |a: i32| -> bool - { - ((::prusti_contracts::exists((), - #[prusti::spec_only] |b: i32| -> bool { ((true): bool) })): - bool) - })): bool) + let prusti_result: bool = + ::prusti_contracts::exists(((#[prusti::spec_only] |a: i32| + ((a == a) && (true)),),), + #[prusti::spec_only] |a: i32| -> bool + { + ::prusti_contracts::exists((), + #[prusti::spec_only] |b: i32| -> bool { true }) + }); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -123,15 +128,16 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test7_$(NUM_UUID)() -> bool { - !!((::prusti_contracts::exists(((#[prusti::spec_only] |a: i32| - (a == a),),), - #[prusti::spec_only] |a: i32| -> bool - { - ((::prusti_contracts::exists(((#[prusti::spec_only] |b: i32| - (a == a),),), - #[prusti::spec_only] |b: i32| -> bool { ((true): bool) })): - bool) - })): bool) + let prusti_result: bool = + ::prusti_contracts::exists(((#[prusti::spec_only] |a: i32| + (a == a),),), + #[prusti::spec_only] |a: i32| -> bool + { + ::prusti_contracts::exists(((#[prusti::spec_only] |b: i32| + (a == a),),), + #[prusti::spec_only] |b: i32| -> bool { true }) + }); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -141,15 +147,16 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test8_$(NUM_UUID)() -> bool { - !!((::prusti_contracts::exists(((#[prusti::spec_only] |a: i32| - ((a == a) && (true)),),), - #[prusti::spec_only] |a: i32| -> bool - { - ((::prusti_contracts::exists(((#[prusti::spec_only] |b: i32| - (a == b),),), - #[prusti::spec_only] |b: i32| -> bool { ((true): bool) })): - bool) - })): bool) + let prusti_result: bool = + ::prusti_contracts::exists(((#[prusti::spec_only] |a: i32| + ((a == a) && (true)),),), + #[prusti::spec_only] |a: i32| -> bool + { + ::prusti_contracts::exists(((#[prusti::spec_only] |b: i32| + (a == b),),), + #[prusti::spec_only] |b: i32| -> bool { true }) + }); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] diff --git a/prusti-tests/tests/typecheck/ui/nested_forall.stdout b/prusti-tests/tests/typecheck/ui/nested_forall.stdout index 54d10eb6239..4f9fc90254e 100644 --- a/prusti-tests/tests/typecheck/ui/nested_forall.stdout +++ b/prusti-tests/tests/typecheck/ui/nested_forall.stdout @@ -12,7 +12,6 @@ -#![feature(type_ascription)] #![feature(stmt_expr_attributes)] #![feature(register_tool)] #![register_tool(prusti)] @@ -26,13 +25,14 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test1_$(NUM_UUID)() -> bool { - !!((::prusti_contracts::forall((), - #[prusti::spec_only] |a: i32| -> bool - { - ((::prusti_contracts::forall((), - #[prusti::spec_only] |a: i32| -> bool - { ((a == a): bool) })): bool) - })): bool) + let prusti_result: bool = + ::prusti_contracts::forall((), + #[prusti::spec_only] |a: i32| -> bool + { + ::prusti_contracts::forall((), + #[prusti::spec_only] |a: i32| -> bool { a == a }) + }); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -42,13 +42,15 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test2_$(NUM_UUID)() -> bool { - !!((::prusti_contracts::forall((), - #[prusti::spec_only] |a: i32| -> bool - { - ((::prusti_contracts::forall((), - #[prusti::spec_only] |b: i32| -> bool - { ((!(a == a) || (b == b)): bool) })): bool) - })): bool) + let prusti_result: bool = + ::prusti_contracts::forall((), + #[prusti::spec_only] |a: i32| -> bool + { + ::prusti_contracts::forall((), + #[prusti::spec_only] |b: i32| -> bool + { !(a == a) || (b == b) }) + }); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -58,17 +60,19 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test3_$(NUM_UUID)() -> bool { - !!((::prusti_contracts::forall((), - #[prusti::spec_only] |a: i32| -> bool - { - ((::prusti_contracts::forall((), - #[prusti::spec_only] |b: i32| -> bool - { - ((::prusti_contracts::forall((), - #[prusti::spec_only] |c: i32| -> bool - { (((a == a) && (b == b)): bool) })): bool) - })): bool) - })): bool) + let prusti_result: bool = + ::prusti_contracts::forall((), + #[prusti::spec_only] |a: i32| -> bool + { + ::prusti_contracts::forall((), + #[prusti::spec_only] |b: i32| -> bool + { + ::prusti_contracts::forall((), + #[prusti::spec_only] |c: i32| -> bool + { (a == a) && (b == b) }) + }) + }); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -78,13 +82,14 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test4_$(NUM_UUID)() -> bool { - !!((::prusti_contracts::exists((), - #[prusti::spec_only] |a: i32| -> bool - { - ((::prusti_contracts::exists((), - #[prusti::spec_only] |a: i32| -> bool - { ((a == a): bool) })): bool) - })): bool) + let prusti_result: bool = + ::prusti_contracts::exists((), + #[prusti::spec_only] |a: i32| -> bool + { + ::prusti_contracts::exists((), + #[prusti::spec_only] |a: i32| -> bool { a == a }) + }); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -94,13 +99,15 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test5_$(NUM_UUID)() -> bool { - !!((::prusti_contracts::exists((), - #[prusti::spec_only] |a: i32| -> bool - { - ((::prusti_contracts::exists((), - #[prusti::spec_only] |b: i32| -> bool - { ((!(a == a) || (b == b)): bool) })): bool) - })): bool) + let prusti_result: bool = + ::prusti_contracts::exists((), + #[prusti::spec_only] |a: i32| -> bool + { + ::prusti_contracts::exists((), + #[prusti::spec_only] |b: i32| -> bool + { !(a == a) || (b == b) }) + }); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -110,17 +117,19 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test6_$(NUM_UUID)() -> bool { - !!((::prusti_contracts::exists((), - #[prusti::spec_only] |a: i32| -> bool - { - ((::prusti_contracts::exists((), - #[prusti::spec_only] |b: i32| -> bool - { - ((::prusti_contracts::exists((), - #[prusti::spec_only] |c: i32| -> bool - { (((a == a) && (b == b)): bool) })): bool) - })): bool) - })): bool) + let prusti_result: bool = + ::prusti_contracts::exists((), + #[prusti::spec_only] |a: i32| -> bool + { + ::prusti_contracts::exists((), + #[prusti::spec_only] |b: i32| -> bool + { + ::prusti_contracts::exists((), + #[prusti::spec_only] |c: i32| -> bool + { (a == a) && (b == b) }) + }) + }); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] diff --git a/prusti-tests/tests/verify/fail/no-annotations/divide-by-zero.rs b/prusti-tests/tests/verify/fail/no-annotations/divide-by-zero.rs index e07b8573673..a3c2fc8ef3b 100644 --- a/prusti-tests/tests/verify/fail/no-annotations/divide-by-zero.rs +++ b/prusti-tests/tests/verify/fail/no-annotations/divide-by-zero.rs @@ -1,4 +1,5 @@ fn main() { let y = 0; let z = 1 / y; //~ ERROR assertion might fail with "attempt to divide by zero" + //~^ ERROR this operation will panic at runtime } diff --git a/prusti-tests/tests/verify/ui/calls.stdout b/prusti-tests/tests/verify/ui/calls.stdout index 6b3c7be3f31..7b51abd5015 100644 --- a/prusti-tests/tests/verify/ui/calls.stdout +++ b/prusti-tests/tests/verify/ui/calls.stdout @@ -15,7 +15,6 @@ -#![feature(type_ascription)] #![feature(stmt_expr_attributes)] #![feature(register_tool)] #![register_tool(prusti)] @@ -30,7 +29,8 @@ non_snake_case)] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_post_item_max_$(NUM_UUID)(a: i32, b: i32, result: i32) -> bool { - !!(((result == a) || (result == b)): bool) + let prusti_result: bool = (result == a) || (result == b); + prusti_result } #[allow(unused_must_use, unused_parens, unused_variables, dead_code, non_snake_case)] @@ -38,7 +38,8 @@ non_snake_case)] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_post_item_max_$(NUM_UUID)(a: i32, b: i32, result: i32) -> bool { - !!(((result >= a) && (result >= b)): bool) + let prusti_result: bool = (result >= a) && (result >= b); + prusti_result } #[prusti::post_spec_id_ref = "$(NUM_UUID)"] #[prusti::post_spec_id_ref = "$(NUM_UUID)"] @@ -62,8 +63,9 @@ non_snake_case)] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_post_item_test_max3_$(NUM_UUID)(result: i32) -> bool { - !!((((true) && ((!(true) || (result == 3)))) && (((true) || (false)))): - bool) + let prusti_result: bool = + ((true) && ((!(true) || (result == 3)))) && (((true) || (false))); + prusti_result } #[prusti::post_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] diff --git a/prusti-tests/tests/verify/ui/collect.stdout b/prusti-tests/tests/verify/ui/collect.stdout index 2a3e4baddac..ead43b41e13 100644 --- a/prusti-tests/tests/verify/ui/collect.stdout +++ b/prusti-tests/tests/verify/ui/collect.stdout @@ -9,7 +9,6 @@ -#![feature(type_ascription)] #![feature(stmt_expr_attributes)] #![feature(register_tool)] #![register_tool(prusti)] @@ -23,7 +22,8 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test1_$(NUM_UUID)() -> bool { - !!((true): bool) + let prusti_result: bool = true; + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -34,7 +34,8 @@ non_snake_case)] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_post_item_test2_$(NUM_UUID)(result: ()) -> bool { - !!((true): bool) + let prusti_result: bool = true; + prusti_result } #[prusti::post_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -63,7 +64,8 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test4_$(NUM_UUID)() -> bool { - !!((true): bool) + let prusti_result: bool = true; + prusti_result } #[allow(unused_must_use, unused_parens, unused_variables, dead_code, non_snake_case)] @@ -71,7 +73,8 @@ non_snake_case)] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_post_item_test4_$(NUM_UUID)(result: ()) -> bool { - !!((true): bool) + let prusti_result: bool = true; + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::post_spec_id_ref = "$(NUM_UUID)"] diff --git a/prusti-tests/tests/verify/ui/false.stdout b/prusti-tests/tests/verify/ui/false.stdout index 85324948ecc..4fb5c13e414 100644 --- a/prusti-tests/tests/verify/ui/false.stdout +++ b/prusti-tests/tests/verify/ui/false.stdout @@ -7,7 +7,6 @@ -#![feature(type_ascription)] #![feature(stmt_expr_attributes)] #![feature(register_tool)] #![register_tool(prusti)] @@ -22,7 +21,8 @@ non_snake_case)] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_post_item_test1_$(NUM_UUID)(result: ()) -> bool { - !!((false): bool) + let prusti_result: bool = false; + prusti_result } #[prusti::post_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] diff --git a/prusti-tests/tests/verify/ui/forall_verify.stdout b/prusti-tests/tests/verify/ui/forall_verify.stdout index 29f01018e3e..917f179fcd2 100644 --- a/prusti-tests/tests/verify/ui/forall_verify.stdout +++ b/prusti-tests/tests/verify/ui/forall_verify.stdout @@ -16,7 +16,6 @@ // have checked the emitted Viper code (including the positions) and // could not see any relevant differences. -#![feature(type_ascription)] #![feature(stmt_expr_attributes)] #![feature(register_tool)] #![register_tool(prusti)] @@ -34,9 +33,10 @@ non_snake_case)] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_post_item_test1_$(NUM_UUID)(result: ()) -> bool { - !!((::prusti_contracts::forall((), - #[prusti::spec_only] |x: i32| -> bool { ((true): bool) })): - bool) + let prusti_result: bool = + ::prusti_contracts::forall((), + #[prusti::spec_only] |x: i32| -> bool { true }); + prusti_result } #[prusti::post_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -47,9 +47,10 @@ non_snake_case)] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_post_item_test2_$(NUM_UUID)(result: ()) -> bool { - !!((::prusti_contracts::forall((), - #[prusti::spec_only] |x: i32| -> bool - { ((identity(x) == x): bool) })): bool) + let prusti_result: bool = + ::prusti_contracts::forall((), + #[prusti::spec_only] |x: i32| -> bool { identity(x) == x }); + prusti_result } #[prusti::post_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -60,9 +61,10 @@ non_snake_case)] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_post_item_test3_$(NUM_UUID)(result: ()) -> bool { - !!((::prusti_contracts::forall((), - #[prusti::spec_only] |x: i32| -> bool - { ((identity(x) == x + 1): bool) })): bool) + let prusti_result: bool = + ::prusti_contracts::forall((), + #[prusti::spec_only] |x: i32| -> bool { identity(x) == x + 1 }); + prusti_result } #[prusti::post_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -73,9 +75,10 @@ non_snake_case)] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_post_item_test4_$(NUM_UUID)(result: ()) -> bool { - !!((::prusti_contracts::exists((), - #[prusti::spec_only] |x: i32| -> bool { ((true): bool) })): - bool) + let prusti_result: bool = + ::prusti_contracts::exists((), + #[prusti::spec_only] |x: i32| -> bool { true }); + prusti_result } #[prusti::post_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -86,7 +89,8 @@ non_snake_case)] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_post_item_test5_$(NUM_UUID)(result: ()) -> bool { - !!((identity(1) == 1): bool) + let prusti_result: bool = identity(1) == 1; + prusti_result } #[allow(unused_must_use, unused_parens, unused_variables, dead_code, non_snake_case)] @@ -94,9 +98,10 @@ non_snake_case)] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_post_item_test5_$(NUM_UUID)(result: ()) -> bool { - !!((::prusti_contracts::exists((), - #[prusti::spec_only] |x: i32| -> bool - { ((identity(x) == x): bool) })): bool) + let prusti_result: bool = + ::prusti_contracts::exists((), + #[prusti::spec_only] |x: i32| -> bool { identity(x) == x }); + prusti_result } #[prusti::post_spec_id_ref = "$(NUM_UUID)"] #[prusti::post_spec_id_ref = "$(NUM_UUID)"] @@ -108,9 +113,10 @@ non_snake_case)] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_post_item_test6_$(NUM_UUID)(result: ()) -> bool { - !!((::prusti_contracts::exists((), - #[prusti::spec_only] |x: i32| -> bool - { ((identity(x) == x + 1): bool) })): bool) + let prusti_result: bool = + ::prusti_contracts::exists((), + #[prusti::spec_only] |x: i32| -> bool { identity(x) == x + 1 }); + prusti_result } #[prusti::post_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] diff --git a/prusti-tests/tests/verify/ui/pledges.stdout b/prusti-tests/tests/verify/ui/pledges.stdout index b8567ce292a..2bf20a2ccb7 100644 --- a/prusti-tests/tests/verify/ui/pledges.stdout +++ b/prusti-tests/tests/verify/ui/pledges.stdout @@ -11,7 +11,6 @@ -#![feature(type_ascription)] #![feature(stmt_expr_attributes)] #![feature(register_tool)] #![register_tool(prusti)] @@ -52,7 +51,8 @@ non_snake_case)] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pledge_item_reborrow_$(NUM_UUID)<'a>(x: &'a mut T, result: &'a mut u32) -> bool { - !!((before_expiry(*result) == x.f): bool) + let prusti_result: bool = before_expiry(*result) == x.f; + prusti_result } #[prusti::pledge_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] diff --git a/prusti-tests/tests/verify/ui/predicate.stdout b/prusti-tests/tests/verify/ui/predicate.stdout index 36ab9225986..1164fc9e071 100644 --- a/prusti-tests/tests/verify/ui/predicate.stdout +++ b/prusti-tests/tests/verify/ui/predicate.stdout @@ -18,7 +18,6 @@ // somewhere down the call stack is false // Provide an existential witness. -#![feature(type_ascription)] #![feature(stmt_expr_attributes)] #![feature(register_tool)] #![register_tool(prusti)] @@ -35,34 +34,42 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pred_item_true_p1_$(NUM_UUID)() -> bool { - (({ - ::prusti_contracts::forall((), - #[prusti::spec_only] |x: i32| -> bool { ((true): bool) }) - }): bool) + let prusti_result: bool = + { + ::prusti_contracts::forall((), + #[prusti::spec_only] |x: i32| -> bool { true }) + }; + prusti_result } #[allow(unused_must_use, unused_variables, dead_code)] #[prusti::pred_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] fn true_p1() -> bool { - ::core::panicking::panic_fmt(format_args!("not implemented: {0}", - format_args!("predicate"))) + { + ::core::panicking::panic_fmt(format_args!("not implemented: {0}", + format_args!("predicate"))); + } } #[allow(unused_must_use, unused_parens, unused_variables, dead_code, non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pred_item_true_p2_$(NUM_UUID)() -> bool { - (({ - ::prusti_contracts::exists((), - #[prusti::spec_only] |x: i32| -> bool { ((true): bool) }) - }): bool) + let prusti_result: bool = + { + ::prusti_contracts::exists((), + #[prusti::spec_only] |x: i32| -> bool { true }) + }; + prusti_result } #[allow(unused_must_use, unused_variables, dead_code)] #[prusti::pred_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] fn true_p2() -> bool { - ::core::panicking::panic_fmt(format_args!("not implemented: {0}", - format_args!("predicate"))) + { + ::core::panicking::panic_fmt(format_args!("not implemented: {0}", + format_args!("predicate"))); + } } #[allow(unused_must_use, unused_parens, unused_variables, dead_code, non_snake_case)] @@ -70,18 +77,21 @@ non_snake_case)] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pred_item_forall_identity_$(NUM_UUID)() -> bool { - (({ - ::prusti_contracts::forall((), - #[prusti::spec_only] |x: i32| -> bool - { ((identity(x) == x): bool) }) - }): bool) + let prusti_result: bool = + { + ::prusti_contracts::forall((), + #[prusti::spec_only] |x: i32| -> bool { identity(x) == x }) + }; + prusti_result } #[allow(unused_must_use, unused_variables, dead_code)] #[prusti::pred_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] fn forall_identity() -> bool { - ::core::panicking::panic_fmt(format_args!("not implemented: {0}", - format_args!("predicate"))) + { + ::core::panicking::panic_fmt(format_args!("not implemented: {0}", + format_args!("predicate"))); + } } #[allow(unused_must_use, unused_parens, unused_variables, dead_code, non_snake_case)] @@ -89,19 +99,22 @@ non_snake_case)] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pred_item_exists_identity_$(NUM_UUID)() -> bool { - (({ - ::prusti_contracts::exists(((#[prusti::spec_only] |x: i32| - (identity(x)),),), - #[prusti::spec_only] |x: i32| -> bool - { ((identity(x) == x): bool) }) - }): bool) + let prusti_result: bool = + { + ::prusti_contracts::exists(((#[prusti::spec_only] |x: i32| + (identity(x)),),), + #[prusti::spec_only] |x: i32| -> bool { identity(x) == x }) + }; + prusti_result } #[allow(unused_must_use, unused_variables, dead_code)] #[prusti::pred_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] fn exists_identity() -> bool { - ::core::panicking::panic_fmt(format_args!("not implemented: {0}", - format_args!("predicate"))) + { + ::core::panicking::panic_fmt(format_args!("not implemented: {0}", + format_args!("predicate"))); + } } #[allow(unused_must_use, unused_parens, unused_variables, dead_code, non_snake_case)] @@ -109,7 +122,8 @@ non_snake_case)] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test_identity_1_$(NUM_UUID)() -> bool { - !!((true_p1()): bool) + let prusti_result: bool = true_p1(); + prusti_result } #[allow(unused_must_use, unused_parens, unused_variables, dead_code, non_snake_case)] @@ -117,7 +131,8 @@ non_snake_case)] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test_identity_1_$(NUM_UUID)() -> bool { - !!((forall_identity()): bool) + let prusti_result: bool = forall_identity(); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] @@ -129,7 +144,8 @@ non_snake_case)] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test_identity_2_$(NUM_UUID)() -> bool { - !!((true_p2()): bool) + let prusti_result: bool = true_p2(); + prusti_result } #[allow(unused_must_use, unused_parens, unused_variables, dead_code, non_snake_case)] @@ -137,7 +153,8 @@ non_snake_case)] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test_identity_2_$(NUM_UUID)() -> bool { - !!((exists_identity()): bool) + let prusti_result: bool = exists_identity(); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] @@ -148,14 +165,17 @@ non_snake_case)] #[prusti::spec_only] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pred_item_false_p_$(NUM_UUID)() -> bool { - (({ false }): bool) + let prusti_result: bool = { false }; + prusti_result } #[allow(unused_must_use, unused_variables, dead_code)] #[prusti::pred_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] fn false_p() -> bool { - ::core::panicking::panic_fmt(format_args!("not implemented: {0}", - format_args!("predicate"))) + { + ::core::panicking::panic_fmt(format_args!("not implemented: {0}", + format_args!("predicate"))); + } } #[allow(unused_must_use, unused_parens, unused_variables, dead_code, non_snake_case)] @@ -163,7 +183,8 @@ non_snake_case)] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_precond_or_correctly_$(NUM_UUID)() -> bool { - !!(((false_p()) || (true)): bool) + let prusti_result: bool = (false_p()) || (true); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] diff --git a/prusti-tests/tests/verify/ui/pure.stdout b/prusti-tests/tests/verify/ui/pure.stdout index 9a3c5be52ce..ed73cc72f2f 100644 --- a/prusti-tests/tests/verify/ui/pure.stdout +++ b/prusti-tests/tests/verify/ui/pure.stdout @@ -20,7 +20,6 @@ -#![feature(type_ascription)] #![feature(stmt_expr_attributes)] #![feature(register_tool)] #![register_tool(prusti)] @@ -43,7 +42,8 @@ non_snake_case)] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_post_item_test_identity2_$(NUM_UUID)(result: ()) -> bool { - !!((6 == identity(6)): bool) + let prusti_result: bool = 6 == identity(6); + prusti_result } #[prusti::post_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -69,8 +69,9 @@ non_snake_case)] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_post_item_test_max3_$(NUM_UUID)(result: i32) -> bool { - !!((((true) && ((!(true) || (result == 3)))) && (((true) || (false)))): - bool) + let prusti_result: bool = + ((true) && ((!(true) || (result == 3)))) && (((true) || (false))); + prusti_result } #[prusti::post_spec_id_ref = "$(NUM_UUID)"] #[prusti::specs_version = $(SPECS_VERSION)] @@ -81,7 +82,8 @@ non_snake_case)] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test_max4_$(NUM_UUID)(a: i32, b: i32) -> bool { - !!((a > b): bool) + let prusti_result: bool = a > b; + prusti_result } #[allow(unused_must_use, unused_parens, unused_variables, dead_code, non_snake_case)] @@ -89,7 +91,8 @@ non_snake_case)] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_post_item_test_max4_$(NUM_UUID)(a: i32, b: i32, result: i32) -> bool { - !!((result == max(a, b)): bool) + let prusti_result: bool = result == max(a, b); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::post_spec_id_ref = "$(NUM_UUID)"] @@ -101,7 +104,8 @@ non_snake_case)] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_pre_item_test_max5_$(NUM_UUID)(a: i32, b: i32) -> bool { - !!((a < b): bool) + let prusti_result: bool = a < b; + prusti_result } #[allow(unused_must_use, unused_parens, unused_variables, dead_code, non_snake_case)] @@ -109,7 +113,8 @@ non_snake_case)] #[prusti::spec_id = "$(NUM_UUID)"] fn prusti_post_item_test_max5_$(NUM_UUID)(a: i32, b: i32, result: i32) -> bool { - !!((result == max(a, b)): bool) + let prusti_result: bool = result == max(a, b); + prusti_result } #[prusti::pre_spec_id_ref = "$(NUM_UUID)"] #[prusti::post_spec_id_ref = "$(NUM_UUID)"] diff --git a/prusti-tests/tests/verify_overflow/fail/bitvectors/bitsub.rs b/prusti-tests/tests/verify_overflow/fail/bitvectors/bitsub.rs index 4fbc32a4b3b..cf5dcdac66e 100644 --- a/prusti-tests/tests/verify_overflow/fail/bitvectors/bitsub.rs +++ b/prusti-tests/tests/verify_overflow/fail/bitvectors/bitsub.rs @@ -12,7 +12,7 @@ fn bitsub_1() { fn bitsub_2() { let a = 1u8; let b = a | 2; - let c = b - 4; + let c = b - 4; //~ ERROR: this arithmetic operation will overflow assert!(c == 8); //~ ERROR: the asserted expression might not hold } diff --git a/prusti-tests/tests/verify_overflow/fail/bitvectors/shifts.rs b/prusti-tests/tests/verify_overflow/fail/bitvectors/shifts.rs index faaa93d3dbb..cc297dcf201 100644 --- a/prusti-tests/tests/verify_overflow/fail/bitvectors/shifts.rs +++ b/prusti-tests/tests/verify_overflow/fail/bitvectors/shifts.rs @@ -17,6 +17,7 @@ fn shift_left_2() { fn shift_left_3() { let a = 1u8; let _b = a << 8u32; //~ ERROR: assertion might fail with "attempt to shift left with overflow" + //~^ ERROR: this arithmetic operation will overflow } fn shift_unsigned_right_1() { @@ -34,6 +35,7 @@ fn shift_unsigned_right_2() { fn shift_unsigned_right_3() { let a = 4u8; let b = a >> 9u32; //~ ERROR: assertion might fail with "attempt to shift right with overflow" + //~^ ERROR: this arithmetic operation will overflow } fn shift_unsigned_right_4() { @@ -57,6 +59,7 @@ fn shift_signed_right_2() { fn shift_signed_right_3() { let a = -1i8; let b = a >> 9u32; //~ ERROR: assertion might fail with "attempt to shift right with overflow" + //~^ ERROR: this arithmetic operation will overflow } fn shift_signed_right_4() { diff --git a/prusti-tests/tests/verify_overflow/fail/termination1.rs b/prusti-tests/tests/verify_overflow/fail/termination1.rs index 29ae938310f..c4a384a3d8a 100644 --- a/prusti-tests/tests/verify_overflow/fail/termination1.rs +++ b/prusti-tests/tests/verify_overflow/fail/termination1.rs @@ -82,12 +82,12 @@ fn recursion_disallowed() { #[terminates] fn mutual_recursion_disallowed1() { - mutual_recursion_disallowed2(); //~ ERROR + mutual_recursion_disallowed2(); // FIXME: This should be an error. } #[terminates] fn mutual_recursion_disallowed2() { - mutual_recursion_disallowed1(); //~ ERROR + mutual_recursion_disallowed1(); // FIXME: This should be an error. } //thread 'rustc' panicked at 'internal error: entered unreachable code: cannot convert abstract type into a memory block: impl_Fn()$0', prusti-viper/src/encoder/middle/core_proof/builtin_methods/interface.rs:2527:62 diff --git a/prusti-tests/tests/verify_overflow/pass/extern-spec/linked-list.rs b/prusti-tests/tests/verify_overflow/pass/extern-spec/linked-list.rs index b42998e2fd0..d502713c4cd 100644 --- a/prusti-tests/tests/verify_overflow/pass/extern-spec/linked-list.rs +++ b/prusti-tests/tests/verify_overflow/pass/extern-spec/linked-list.rs @@ -1,3 +1,5 @@ +#![feature(allocator_api)] + use prusti_contracts::*; use std::collections::LinkedList; @@ -24,7 +26,7 @@ impl std::option::Option { #[trusted] #[pure] #[requires(index < list.len())] -fn get(list: &LinkedList, index: usize) -> T { +fn get(list: &LinkedList, index: usize) -> T { for (i, elem) in list.iter().enumerate() { if i == index { return *elem; @@ -34,11 +36,24 @@ fn get(list: &LinkedList, index: usize) -> T { } #[extern_spec] -impl LinkedList +impl LinkedList where T: Copy + PartialEq { #[ensures(result.is_empty())] - pub fn new() -> LinkedList; + pub fn new() -> LinkedList; + + #[ensures(self.len() == old(self.len() + other.len()))] + #[ensures(forall (|i: usize| (i < old(self.len())) ==> + get(self, i) == old(get(self, i))))] + #[ensures(forall (|j: usize| (old(self.len()) <= j && j < self.len()) ==> + get(self, j) == old(get(other, j - self.len()))))] + #[ensures(other.len() == 0)] + pub fn append(&mut self, other: &mut LinkedList); +} +#[extern_spec] +impl LinkedList + where T: Copy + PartialEq, + A: std::alloc::Allocator + Clone { #[pure] #[ensures(result ==> self.len() == 0)] #[ensures(!result ==> self.len() > 0)] @@ -74,14 +89,6 @@ impl LinkedList get(self, i) == old(get(self, i))))] pub fn pop_back(&mut self) -> Option; - #[ensures(self.len() == old(self.len() + other.len()))] - #[ensures(forall (|i: usize| (i < old(self.len())) ==> - get(self, i) == old(get(self, i))))] - #[ensures(forall (|j: usize| (old(self.len()) <= j && j < self.len()) ==> - get(self, j) == old(get(other, j - self.len()))))] - #[ensures(other.len() == 0)] - pub fn append(&mut self, other: &mut LinkedList); - #[requires(at <= self.len())] #[ensures(result.len() == old(self.len()) - at)] #[ensures(self.len() == at)] @@ -89,7 +96,7 @@ impl LinkedList get(self, i) == old(get(self, i))))] #[ensures(forall (|j: usize| (j < result.len()) ==> get(&result, j) == old(get(self, j + at))))] - pub fn split_off(&mut self, at: usize) -> LinkedList; + pub fn split_off(&mut self, at: usize) -> LinkedList; } fn main() { diff --git a/prusti-utils/Cargo.toml b/prusti-utils/Cargo.toml index 7deb6ef44fc..83d9b40efc4 100644 --- a/prusti-utils/Cargo.toml +++ b/prusti-utils/Cargo.toml @@ -10,7 +10,7 @@ doctest = false # we have no doc tests [dependencies] log = { version = "0.4", features = ["release_max_level_info"] } config = "0.13" -itertools = "0.10.3" +itertools = "0.11" serde = { version = "1.0", features = ["derive"] } lazy_static = "1.4.0" uuid = { version = "1.0", features = ["v4"] } diff --git a/prusti-viper/Cargo.toml b/prusti-viper/Cargo.toml index 8ff1f75d43a..9606064ad01 100644 --- a/prusti-viper/Cargo.toml +++ b/prusti-viper/Cargo.toml @@ -26,7 +26,7 @@ serde_json = "1.0" backtrace = "0.3" rustc-hash = "1.1.0" derive_more = "0.99.16" -itertools = "0.10.3" +itertools = "0.11" once_cell = "1.17.1" [dev-dependencies] diff --git a/prusti-viper/src/encoder/encoder.rs b/prusti-viper/src/encoder/encoder.rs index c6ff636ec35..b63a3f95700 100644 --- a/prusti-viper/src/encoder/encoder.rs +++ b/prusti-viper/src/encoder/encoder.rs @@ -308,7 +308,7 @@ impl<'v, 'tcx> Encoder<'v, 'tcx> { ct: mir::UnevaluatedConst<'tcx>, ) -> Option { let tcx = self.env.tcx(); - let param_env = tcx.param_env(ct.def.did); + let param_env = tcx.param_env(ct.def); tcx.const_eval_resolve(param_env, ct, None) .ok() .and_then(|const_value| const_value.try_to_scalar()) diff --git a/prusti-viper/src/encoder/middle/core_proof/snapshots/into_snapshot/context_independent/traits.rs b/prusti-viper/src/encoder/middle/core_proof/snapshots/into_snapshot/context_independent/traits.rs index 6c292ffe9c4..10b5146bf5e 100644 --- a/prusti-viper/src/encoder/middle/core_proof/snapshots/into_snapshot/context_independent/traits.rs +++ b/prusti-viper/src/encoder/middle/core_proof/snapshots/into_snapshot/context_independent/traits.rs @@ -44,6 +44,6 @@ impl IntoSnapshot for vir_mid::Type { &self, lowerer: &mut Lowerer<'p, 'v, 'tcx>, ) -> SpannedEncodingResult { - ContextIndependentSnapshot::default().type_to_snapshot(lowerer, self) + ContextIndependentSnapshot.type_to_snapshot(lowerer, self) } } diff --git a/prusti-viper/src/encoder/mir/contracts/borrows.rs b/prusti-viper/src/encoder/mir/contracts/borrows.rs index 39182d84716..fd045187a65 100644 --- a/prusti-viper/src/encoder/mir/contracts/borrows.rs +++ b/prusti-viper/src/encoder/mir/contracts/borrows.rs @@ -44,7 +44,7 @@ impl fmt::Display for BorrowInfo

{ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let lifetime = match self.region { None => "static".to_string(), - Some(ty::BoundRegionKind::BrAnon(id, _)) => format!("#{id}"), + Some(ty::BoundRegionKind::BrAnon(_)) => "anon".to_string(), Some(ty::BoundRegionKind::BrNamed(_, name)) => name.to_string(), _ => unimplemented!(), }; diff --git a/prusti-viper/src/encoder/mir/errors/interface.rs b/prusti-viper/src/encoder/mir/errors/interface.rs index 0060e77e9df..845b91e3058 100644 --- a/prusti-viper/src/encoder/mir/errors/interface.rs +++ b/prusti-viper/src/encoder/mir/errors/interface.rs @@ -27,12 +27,12 @@ pub(crate) trait ErrorInterface { error_ctxt: ErrorCtxt, ) -> vir_high::Position; fn set_surrounding_error_context( - &mut self, + &self, position: vir_high::Position, error_ctxt: ErrorCtxt, ) -> vir_high::Position; fn set_surrounding_error_context_for_expression( - &mut self, + &self, expression: vir_high::Expression, default_position: vir_high::Position, error_ctxt: ErrorCtxt, @@ -93,7 +93,7 @@ impl<'v, 'tcx: 'v> ErrorInterface for super::super::super::Encoder<'v, 'tcx> { new_position.into() } fn set_surrounding_error_context( - &mut self, + &self, position: vir_high::Position, error_ctxt: ErrorCtxt, ) -> vir_high::Position { @@ -106,14 +106,14 @@ impl<'v, 'tcx: 'v> ErrorInterface for super::super::super::Encoder<'v, 'tcx> { /// 1. `default_position` if `position.is_default()`. /// 2. With surrounding error context otherwise. fn set_surrounding_error_context_for_expression( - &mut self, + &self, expression: vir_high::Expression, default_position: vir_high::Position, error_ctxt: ErrorCtxt, ) -> vir_high::Expression { assert!(!default_position.is_default()); struct Visitor<'p, 'v: 'p, 'tcx: 'v> { - encoder: &'p mut super::super::super::Encoder<'v, 'tcx>, + encoder: &'p super::super::super::Encoder<'v, 'tcx>, default_position: vir_high::Position, error_ctxt: ErrorCtxt, } diff --git a/prusti-viper/src/encoder/mir/procedures/encoder/builtin_function_encoder.rs b/prusti-viper/src/encoder/mir/procedures/encoder/builtin_function_encoder.rs index 4f2b3f9d56c..998c7f9aa1d 100644 --- a/prusti-viper/src/encoder/mir/procedures/encoder/builtin_function_encoder.rs +++ b/prusti-viper/src/encoder/mir/procedures/encoder/builtin_function_encoder.rs @@ -12,7 +12,7 @@ pub(super) trait BuiltinFuncAppEncoder<'p, 'v, 'tcx> { args: &[mir::Operand<'tcx>], destination: mir::Place<'tcx>, target: &Option, - cleanup: &Option, + unwind: mir::UnwindAction, ) -> SpannedEncodingResult; } @@ -28,7 +28,7 @@ impl<'p, 'v, 'tcx> BuiltinFuncAppEncoder<'p, 'v, 'tcx> for super::ProcedureEncod args: &[mir::Operand<'tcx>], destination: mir::Place<'tcx>, target: &Option, - cleanup: &Option, + unwind: mir::UnwindAction, ) -> SpannedEncodingResult { let full_called_function_name = self .encoder @@ -192,9 +192,9 @@ impl<'p, 'v, 'tcx> BuiltinFuncAppEncoder<'p, 'v, 'tcx> for super::ProcedureEncod debug!("Absence of panic will not be checked") } assert!(target.is_none()); - if let Some(cleanup) = cleanup { + if let mir::UnwindAction::Cleanup(cleanup) = unwind { let successor = - vir_high::Successor::Goto(self.encode_basic_block_label(*cleanup)); + vir_high::Successor::Goto(self.encode_basic_block_label(cleanup)); block_builder.set_successor_jump(successor); } else { unimplemented!(); diff --git a/prusti-viper/src/encoder/mir/procedures/encoder/elaborate_drops/mir_dataflow.rs b/prusti-viper/src/encoder/mir/procedures/encoder/elaborate_drops/mir_dataflow.rs index ae27c065786..025d2ca4682 100644 --- a/prusti-viper/src/encoder/mir/procedures/encoder/elaborate_drops/mir_dataflow.rs +++ b/prusti-viper/src/encoder/mir/procedures/encoder/elaborate_drops/mir_dataflow.rs @@ -1,5 +1,5 @@ // This file was taken from the compiler: -// https://github.com/rust-lang/rust/blob/661e8beec1fa5f3c58bf6e4362ae3c3fe0b4b1bd/compiler/rustc_mir_dataflow/src/elaborate_drops.rs +// https://github.com/rust-lang/rust/blob/e69c7306e2be08939d95f14229e3f96566fb206c/compiler/rustc_mir_dataflow/src/elaborate_drops.rs // This file is licensed under Apache 2.0 // (https://github.com/rust-lang/rust/blob/949b98cab8a186b98bf87e64374b8d0848c55271/LICENSE-APACHE) // and MIT @@ -14,23 +14,23 @@ use log::debug; use prusti_interface::environment::mir_body::patch::MirPatch; use prusti_rustc_interface::{ - abi::FieldIdx, + abi::{FieldIdx, VariantIdx, FIRST_VARIANT}, dataflow::elaborate_drops::{DropFlagMode, DropStyle, Unwind}, hir, hir::lang_items::LangItem, - index::vec::Idx, + index::Idx, middle::{ mir::*, traits::Reveal, ty::{self, subst::SubstsRef, util::IntTypeExt, Ty, TyCtxt}, }, - target::abi::VariantIdx, }; use std::{fmt, iter}; +use tracing::instrument; trait UnwindPublic { fn is_cleanup(self) -> bool; - fn into_option(self) -> Option; + fn into_action(self) -> UnwindAction; fn map(self, f: F) -> Self where F: FnOnce(BasicBlock) -> BasicBlock; @@ -44,10 +44,10 @@ impl UnwindPublic for Unwind { } } - fn into_option(self) -> Option { + fn into_action(self) -> UnwindAction { match self { - Unwind::To(bb) => Some(bb), - Unwind::InCleanup => None, + Unwind::To(bb) => UnwindAction::Cleanup(bb), + Unwind::InCleanup => UnwindAction::Terminate, } } @@ -195,8 +195,8 @@ where // // FIXME: I think we should just control the flags externally, // and then we do not need this machinery. - #[tracing::instrument(level = "debug")] pub fn elaborate_drop(&mut self, bb: BasicBlock) { + debug!("elaborate_drop({:?}, {:?})", bb, self); let style = self.elaborator.drop_style(self.path, DropFlagMode::Deep); debug!("elaborate_drop({:?}, {:?}): live - {:?}", bb, self, style); match style { @@ -211,7 +211,8 @@ where TerminatorKind::Drop { place: self.place, target: self.succ, - unwind: self.unwind.into_option(), + unwind: self.unwind.into_action(), + replace: false, }, ); } @@ -244,19 +245,19 @@ where .iter() .enumerate() .map(|(i, f)| { - let field = FieldIdx::from_usize(i); + let field = FieldIdx::new(i); let subpath = self.elaborator.field_subpath(variant_path, field); let tcx = self.tcx(); assert_eq!(self.elaborator.param_env().reveal(), Reveal::All); let field_ty = tcx.normalize_erasing_regions(self.elaborator.param_env(), f.ty(tcx, substs)); + (tcx.mk_place_field(base_place, field, field_ty), subpath) }) .collect() } - #[tracing::instrument(level = "debug", skip(self))] fn drop_subpath( &mut self, place: Place<'tcx>, @@ -346,13 +347,14 @@ where /// /// NOTE: this does not clear the master drop flag, so you need /// to point succ/unwind on a `drop_ladder_bottom`. - #[tracing::instrument(level = "debug")] fn drop_ladder( &mut self, fields: Vec<(Place<'tcx>, Option)>, succ: BasicBlock, unwind: Unwind, ) -> (BasicBlock, Unwind) { + debug!("drop_ladder({:?}, {:?})", self, fields); + let mut fields = fields; fields.retain(|&(place, _)| { self.place_ty(place) @@ -377,17 +379,16 @@ where ) } - #[tracing::instrument(level = "debug")] fn open_drop_for_tuple(&mut self, tys: &[Ty<'tcx>]) -> BasicBlock { + debug!("open_drop_for_tuple({:?}, {:?})", self, tys); + let fields = tys .iter() .enumerate() .map(|(i, &ty)| { ( - self.tcx() - .mk_place_field(self.place, FieldIdx::from_usize(i), ty), - self.elaborator - .field_subpath(self.path, FieldIdx::from_usize(i)), + self.tcx().mk_place_field(self.place, FieldIdx::new(i), ty), + self.elaborator.field_subpath(self.path, FieldIdx::new(i)), ) }) .collect(); @@ -396,9 +397,26 @@ where self.drop_ladder(fields, succ, unwind).0 } - #[tracing::instrument(level = "debug")] + #[instrument(level = "debug", ret)] fn open_drop_for_box(&mut self, adt: ty::AdtDef<'tcx>, substs: SubstsRef<'tcx>) -> BasicBlock { - let interior = self.tcx().mk_place_deref(self.place); + // drop glue is sent straight to codegen + // box cannot be directly dereferenced + let unique_ty = adt.non_enum_variant().fields[FieldIdx::new(0)].ty(self.tcx(), substs); + let unique_variant = unique_ty.ty_adt_def().unwrap().non_enum_variant(); + let nonnull_ty = unique_variant.fields[FieldIdx::from_u32(0)].ty(self.tcx(), substs); + let ptr_ty = self.tcx().mk_imm_ptr(substs[0].expect_ty()); + + let unique_place = self + .tcx() + .mk_place_field(self.place, FieldIdx::new(0), unique_ty); + let nonnull_place = self + .tcx() + .mk_place_field(unique_place, FieldIdx::new(0), nonnull_ty); + let ptr_place = self + .tcx() + .mk_place_field(nonnull_place, FieldIdx::new(0), ptr_ty); + let interior = self.tcx().mk_place_deref(ptr_place); + let interior_path = self.elaborator.deref_subpath(self.path); let succ = self.box_free_block(adt, substs, self.succ, self.unwind); @@ -409,7 +427,7 @@ where self.drop_subpath(interior, interior_path, succ, unwind_succ) } - #[tracing::instrument(level = "debug")] + #[instrument(level = "debug", ret)] fn open_drop_for_adt(&mut self, adt: ty::AdtDef<'tcx>, substs: SubstsRef<'tcx>) -> BasicBlock { if adt.variants().is_empty() { return self.elaborator.patch().new_block(BasicBlockData { @@ -447,7 +465,7 @@ where let fields = self.move_paths_for_fields( self.place, self.path, - adt.variant(VariantIdx::new(0)), + adt.variant(FIRST_VARIANT), substs, ); self.drop_ladder(fields, succ, unwind) @@ -602,7 +620,6 @@ where let drop_trait = tcx.require_lang_item(LangItem::Drop, None); let drop_fn = tcx.associated_item_def_ids(drop_trait)[0]; let ty = self.place_ty(self.place); - let substs = tcx.mk_substs_trait(ty, []); let ref_ty = tcx.mk_ref( tcx.lifetimes.re_erased, @@ -627,11 +644,16 @@ where )], terminator: Some(Terminator { kind: TerminatorKind::Call { - func: Operand::function_handle(tcx, drop_fn, substs, self.source_info.span), + func: Operand::function_handle( + tcx, + drop_fn, + [ty.into()], + self.source_info.span, + ), args: vec![Operand::Move(Place::from(ref_place))], destination: unit_temp, target: Some(succ), - cleanup: unwind.into_option(), + unwind: unwind.into_action(), from_hir_call: true, fn_span: self.source_info.span, }, @@ -646,26 +668,20 @@ where /// /// ```text /// loop-block: - /// can_go = cur == length_or_end + /// can_go = cur == len /// if can_go then succ else drop-block /// drop-block: - /// if ptr_based { - /// ptr = cur - /// cur = cur.offset(1) - /// } else { - /// ptr = &raw mut P[cur] - /// cur = cur + 1 - /// } + /// ptr = &raw mut P[cur] + /// cur = cur + 1 /// drop(ptr) /// ``` fn drop_loop( &mut self, succ: BasicBlock, cur: Local, - length_or_end: Place<'tcx>, + len: Local, ety: Ty<'tcx>, unwind: Unwind, - ptr_based: bool, ) -> BasicBlock { let copy = Operand::Copy; let move_ = Operand::Move; @@ -677,24 +693,18 @@ where }); let ptr = Place::from(self.new_temp(ptr_ty)); let can_go = Place::from(self.new_temp(tcx.types.bool)); - let one = self.constant_usize(1); - let (ptr_next, cur_next) = if ptr_based { - ( - Rvalue::Use(copy(cur.into())), - Rvalue::BinaryOp(BinOp::Offset, Box::new((move_(cur.into()), one))), - ) - } else { - ( - Rvalue::AddressOf(Mutability::Mut, tcx.mk_place_index(self.place, cur)), - Rvalue::BinaryOp(BinOp::Add, Box::new((move_(cur.into()), one))), - ) - }; let drop_block = BasicBlockData { statements: vec![ - self.assign(ptr, ptr_next), - self.assign(Place::from(cur), cur_next), + self.assign( + ptr, + Rvalue::AddressOf(Mutability::Mut, tcx.mk_place_index(self.place, cur)), + ), + self.assign( + cur.into(), + Rvalue::BinaryOp(BinOp::Add, Box::new((move_(cur.into()), one))), + ), ], is_cleanup: unwind.is_cleanup(), terminator: Some(Terminator { @@ -710,7 +720,7 @@ where can_go, Rvalue::BinaryOp( BinOp::Eq, - Box::new((copy(Place::from(cur)), copy(length_or_end))), + Box::new((copy(Place::from(cur)), copy(len.into()))), ), )], is_cleanup: unwind.is_cleanup(), @@ -726,144 +736,108 @@ where TerminatorKind::Drop { place: tcx.mk_place_deref(ptr), target: loop_block, - unwind: unwind.into_option(), + unwind: unwind.into_action(), + replace: false, }, ); loop_block } - #[tracing::instrument(level = "debug")] fn open_drop_for_array(&mut self, ety: Ty<'tcx>, opt_size: Option) -> BasicBlock { - // if size_of::() == 0 { - // index_based_loop - // } else { - // ptr_based_loop - // } - + debug!("open_drop_for_array({:?}, {:?})", ety, opt_size); let tcx = self.tcx(); if let Some(size) = opt_size { - let fields: Vec<(Place<'tcx>, Option)> = (0..size) - .map(|i| { - ( - tcx.mk_place_elem( - self.place, - ProjectionElem::ConstantIndex { - offset: i, - min_length: size, - from_end: false, - }, - ), - self.elaborator.array_subpath(self.path, i, size), - ) - }) - .collect(); - - if fields.iter().any(|(_, path)| path.is_some()) { + enum ProjectionKind { + Drop(std::ops::Range), + Keep(u64, Path), + } + // Previously, we'd make a projection for every element in the array and create a drop + // ladder if any `array_subpath` was `Some`, i.e. moving out with an array pattern. + // This caused huge memory usage when generating the drops for large arrays, so we instead + // record the *subslices* which are dropped and the *indexes* which are kept + let mut drop_ranges = vec![]; + let mut dropping = true; + let mut start = 0; + for i in 0..size { + let path = self.elaborator.array_subpath(self.path, i, size); + if dropping && path.is_some() { + drop_ranges.push(ProjectionKind::Drop(start..i)); + dropping = false; + } else if !dropping && path.is_none() { + dropping = true; + start = i; + } + if let Some(path) = path { + drop_ranges.push(ProjectionKind::Keep(i, path)); + } + } + if !drop_ranges.is_empty() { + if dropping { + drop_ranges.push(ProjectionKind::Drop(start..size)); + } + let fields = drop_ranges + .iter() + .rev() + .map(|p| { + let (project, path) = match p { + ProjectionKind::Drop(r) => ( + ProjectionElem::Subslice { + from: r.start, + to: r.end, + from_end: false, + }, + None, + ), + &ProjectionKind::Keep(offset, path) => ( + ProjectionElem::ConstantIndex { + offset, + min_length: size, + from_end: false, + }, + Some(path), + ), + }; + (tcx.mk_place_elem(self.place, project), path) + }) + .collect::>(); let (succ, unwind) = self.drop_ladder_bottom(); return self.drop_ladder(fields, succ, unwind).0; } } - let move_ = Operand::Move; - let elem_size = Place::from(self.new_temp(tcx.types.usize)); - let len = Place::from(self.new_temp(tcx.types.usize)); - - let base_block = BasicBlockData { - statements: vec![ - self.assign(elem_size, Rvalue::NullaryOp(NullOp::SizeOf, ety)), - self.assign(len, Rvalue::Len(self.place)), - ], - is_cleanup: self.unwind.is_cleanup(), - terminator: Some(Terminator { - source_info: self.source_info, - kind: TerminatorKind::SwitchInt { - discr: move_(elem_size), - targets: SwitchTargets::static_if( - 0, - self.drop_loop_pair(ety, false, len), - self.drop_loop_pair(ety, true, len), - ), - }, - }), - }; - self.elaborator.patch().new_block(base_block) + self.drop_loop_pair(ety) } /// Creates a pair of drop-loops of `place`, which drops its contents, even - /// in the case of 1 panic. If `ptr_based`, creates a pointer loop, - /// otherwise create an index loop. - #[tracing::instrument(level = "debug")] - fn drop_loop_pair( - &mut self, - ety: Ty<'tcx>, - ptr_based: bool, - length: Place<'tcx>, - ) -> BasicBlock { + /// in the case of 1 panic. + fn drop_loop_pair(&mut self, ety: Ty<'tcx>) -> BasicBlock { + debug!("drop_loop_pair({:?})", ety); let tcx = self.tcx(); - let iter_ty = if ptr_based { - tcx.mk_mut_ptr(ety) - } else { - tcx.types.usize - }; + let len = self.new_temp(tcx.types.usize); + let cur = self.new_temp(tcx.types.usize); - let cur = self.new_temp(iter_ty); - let length_or_end = if ptr_based { - Place::from(self.new_temp(iter_ty)) - } else { - length - }; + let unwind = self + .unwind + .map(|unwind| self.drop_loop(unwind, cur, len, ety, Unwind::InCleanup)); - let unwind = self.unwind.map(|unwind| { - self.drop_loop( - unwind, - cur, - length_or_end, - ety, - Unwind::InCleanup, - ptr_based, - ) - }); + let loop_block = self.drop_loop(self.succ, cur, len, ety, unwind); - let loop_block = self.drop_loop(self.succ, cur, length_or_end, ety, unwind, ptr_based); - - let cur = Place::from(cur); - let drop_block_stmts = if ptr_based { - let tmp_ty = tcx.mk_mut_ptr(self.place_ty(self.place)); - let tmp = Place::from(self.new_temp(tmp_ty)); - // tmp = &raw mut P; - // cur = tmp as *mut T; - // end = Offset(cur, len); - let mir_cast_kind = ty::cast::mir_cast_kind(iter_ty, tmp_ty); - vec![ - self.assign(tmp, Rvalue::AddressOf(Mutability::Mut, self.place)), - self.assign( - cur, - Rvalue::Cast(mir_cast_kind, Operand::Move(tmp), iter_ty), - ), - self.assign( - length_or_end, - Rvalue::BinaryOp( - BinOp::Offset, - Box::new((Operand::Copy(cur), Operand::Move(length))), - ), - ), - ] - } else { - // cur = 0 (length already pushed) - let zero = self.constant_usize(0); - vec![self.assign(cur, Rvalue::Use(zero))] - }; - let drop_block = self.elaborator.patch().new_block(BasicBlockData { - statements: drop_block_stmts, + let zero = self.constant_usize(0); + let block = BasicBlockData { + statements: vec![ + self.assign(len.into(), Rvalue::Len(self.place)), + self.assign(cur.into(), Rvalue::Use(zero)), + ], is_cleanup: unwind.is_cleanup(), terminator: Some(Terminator { source_info: self.source_info, kind: TerminatorKind::Goto { target: loop_block }, }), - }); + }; + let drop_block = self.elaborator.patch().new_block(block); // FIXME(#34708): handle partially-dropped array/slice elements. let reset_block = self.drop_flag_reset_block(DropFlagMode::Deep, drop_block, unwind); self.drop_flag_test_block(reset_block, self.succ, unwind) @@ -888,7 +862,7 @@ where // and this is ok because `open_drop` here can only be reached // within that own generator's resume function. // This should only happen for the self argument on the resume function. - // It effetively only contains upvars until the generator transformation runs. + // It effectively only contains upvars until the generator transformation runs. // See librustc_body/transform/generator.rs for more details. ty::Generator(_, substs, _) => { let tys: Vec<_> = substs.as_generator().upvar_tys().collect(); @@ -907,14 +881,15 @@ where let size = size.try_eval_target_usize(self.tcx(), self.elaborator.param_env()); self.open_drop_for_array(*ety, size) } - ty::Slice(ety) => self.open_drop_for_array(*ety, None), + ty::Slice(ety) => self.drop_loop_pair(*ety), _ => unreachable!("open drop from non-ADT `{:?}`", ty), } } - #[tracing::instrument(level = "debug")] fn complete_drop(&mut self, succ: BasicBlock, unwind: Unwind) -> BasicBlock { + debug!("complete_drop(succ={:?}, unwind={:?})", succ, unwind); + let drop_block = self.drop_block(succ, unwind); self.drop_flag_test_block(drop_block, succ, unwind) @@ -922,13 +897,14 @@ where /// Creates a block that resets the drop flag. If `mode` is deep, all children drop flags will /// also be cleared. - #[tracing::instrument(level = "debug")] fn drop_flag_reset_block( &mut self, mode: DropFlagMode, succ: BasicBlock, unwind: Unwind, ) -> BasicBlock { + debug!("drop_flag_reset_block({:?},{:?})", self, mode); + if unwind.is_cleanup() { // The drop flag isn't read again on the unwind path, so don't // bother setting it. @@ -944,8 +920,8 @@ where block } - #[tracing::instrument(level = "debug")] fn elaborated_drop_block(&mut self) -> BasicBlock { + debug!("elaborated_drop_block({:?})", self); let blk = self.drop_block(self.succ, self.unwind); self.elaborate_drop(blk); blk @@ -979,12 +955,12 @@ where let unit_temp = Place::from(self.new_temp(tcx.mk_unit())); let free_func = tcx.require_lang_item(LangItem::BoxFree, Some(self.source_info.span)); let args = adt - .variant(VariantIdx::new(0)) + .variant(FIRST_VARIANT) .fields .iter() .enumerate() .map(|(i, f)| { - let field = FieldIdx::from_usize(i); + let field = FieldIdx::new(i); let field_ty = f.ty(tcx, substs); Operand::Move(tcx.mk_place_field(self.place, field, field_ty)) }) @@ -995,7 +971,11 @@ where args, destination: unit_temp, target: Some(target), - cleanup: None, + unwind: if unwind.is_cleanup() { + UnwindAction::Terminate + } else { + UnwindAction::Continue + }, from_hir_call: false, fn_span: self.source_info.span, }; // FIXME(#43234) @@ -1014,7 +994,8 @@ where let block = TerminatorKind::Drop { place: self.place, target, - unwind: unwind.into_option(), + unwind: unwind.into_action(), + replace: false, }; self.new_block(unwind, block) } @@ -1029,7 +1010,6 @@ where /// Depending on the required `DropStyle`, this might be a generated block with an `if` /// terminator (for dynamic/open drops), or it might be `on_set` or `on_unset` itself, in case /// the drop can be statically determined. - #[tracing::instrument(level = "debug", skip_all)] fn drop_flag_test_block( &mut self, on_set: BasicBlock, @@ -1072,7 +1052,7 @@ where Operand::Constant(Box::new(Constant { span: self.source_info.span, user_ty: None, - literal: ConstantKind::Ty(ty::Const::from_target_usize(self.tcx(), val.into())), + literal: ConstantKind::from_usize(self.tcx(), val.into()), })) } diff --git a/prusti-viper/src/encoder/mir/procedures/encoder/elaborate_drops/mir_transform.rs b/prusti-viper/src/encoder/mir/procedures/encoder/elaborate_drops/mir_transform.rs index b8f2bbb33a7..35f81bf40a7 100644 --- a/prusti-viper/src/encoder/mir/procedures/encoder/elaborate_drops/mir_transform.rs +++ b/prusti-viper/src/encoder/mir/procedures/encoder/elaborate_drops/mir_transform.rs @@ -1,5 +1,5 @@ // This file was taken from the compiler: -// https://github.com/rust-lang/rust/blob/661e8beec1fa5f3c58bf6e4362ae3c3fe0b4b1bd/compiler/rustc_mir_transform/src/elaborate_drops.rs +// https://github.com/rust-lang/rust/blob/e69c7306e2be08939d95f14229e3f96566fb206c/compiler/rustc_mir_transform/src/elaborate_drops.rs // This file is licensed under Apache 2.0 // (https://github.com/rust-lang/rust/blob/949b98cab8a186b98bf87e64374b8d0848c55271/LICENSE-APACHE) // and MIT @@ -15,7 +15,6 @@ use log::debug; use prusti_interface::environment::mir_body::patch::MirPatch; use prusti_rustc_interface::{ abi::FieldIdx, - data_structures::fx::FxHashMap, dataflow::{ elaborate_drops::{DropFlagMode, DropFlagState, DropStyle, Unwind}, impls::{MaybeInitializedPlaces, MaybeUninitializedPlaces}, @@ -24,25 +23,24 @@ use prusti_rustc_interface::{ un_derefer::UnDerefer, Analysis, MoveDataParamEnv, ResultsCursor, }, - index::bit_set::BitSet, + index::{bit_set::BitSet, IndexVec}, middle::{ mir::*, ty::{self, TyCtxt}, }, - span::{hygiene::DesugaringKind, Span}, + span::Span, target::abi::VariantIdx, }; use std::fmt; -/// During MIR building, Drop and DropAndReplace terminators are inserted in every place where a drop may occur. +/// During MIR building, Drop terminators are inserted in every place where a drop may occur. /// However, in this phase, the presence of these terminators does not guarantee that a destructor will run, /// as the target of the drop may be uninitialized. /// In general, the compiler cannot determine at compile time whether a destructor will run or not. /// -/// At a high level, this pass refines Drop and DropAndReplace to only run the destructor if the -/// target is initialized. The way this is achievied is by inserting drop flags for every variable +/// At a high level, this pass refines Drop to only run the destructor if the +/// target is initialized. The way this is achieved is by inserting drop flags for every variable /// that may be dropped, and then using those flags to determine whether a destructor should run. -/// This pass also removes DropAndReplace, replacing it with a Drop paired with an assign statement. /// Once this is complete, Drop terminators in the MIR correspond to a call to the "drop glue" or /// "drop shim" for the type of the dropped place. /// @@ -104,20 +102,20 @@ pub(in super::super) fn run_pass<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) let reachable = traversal::reachable_as_bitset(body); + let drop_flags = IndexVec::from_elem(None, &env.move_data.move_paths); ElaborateDropsCtxt { tcx, body, env: &env, init_data: InitializationData { inits, uninits }, - drop_flags: Default::default(), + drop_flags, patch: MirPatch::new(body), un_derefer, reachable, } .elaborate() }; - elaborate_patch //.apply(body); - // deref_finder(tcx, body); + elaborate_patch } /// Removes unwind edges which are known to be unreachable, because they are in `drop` terminators @@ -141,7 +139,7 @@ pub(in super::super) fn remove_dead_unwinds<'tcx>( let place = match bb_data.terminator().kind { TerminatorKind::Drop { ref place, - unwind: Some(_), + unwind: UnwindAction::Cleanup(_), .. } => und.derefer(place.as_ref(), body).unwrap_or(*place), _ => continue, @@ -181,7 +179,7 @@ pub(in super::super) fn remove_dead_unwinds<'tcx>( let basic_blocks = body.basic_blocks.as_mut(); for &bb in dead_unwinds.iter() { if let Some(unwind) = basic_blocks[bb].terminator_mut().unwind_mut() { - *unwind = None; + *unwind = UnwindAction::Unreachable; } } } @@ -335,7 +333,7 @@ struct ElaborateDropsCtxt<'a, 'tcx> { body: &'a Body<'tcx>, env: &'a MoveDataParamEnv<'tcx>, init_data: InitializationData<'a, 'tcx>, - drop_flags: FxHashMap, + drop_flags: IndexVec>, patch: MirPatch<'tcx>, un_derefer: UnDerefer<'tcx>, reachable: BitSet, @@ -354,13 +352,11 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> { let tcx = self.tcx; let patch = &mut self.patch; debug!("create_drop_flag({:?})", self.body.span); - self.drop_flags - .entry(index) - .or_insert_with(|| patch.new_internal(tcx.types.bool, span)); + self.drop_flags[index].get_or_insert_with(|| patch.new_internal(tcx.types.bool, span)); } fn drop_flag(&mut self, index: MovePathIndex) -> Option> { - self.drop_flags.get(&index).map(|t| Place::from(*t)) + self.drop_flags[index].map(Place::from) } /// create a patch that elaborates all drops in the input @@ -413,7 +409,7 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> { if maybe_dead { self.tcx.sess.delay_span_bug( terminator.source_info.span, - &format!( + format!( "drop of untracked, uninitialized value {:?}, place {:?} ({:?})", bb, place, path ), @@ -450,12 +446,12 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> { }; let terminator = data.terminator(); - let resume_block = self.patch.resume_block(); match terminator.kind { TerminatorKind::Drop { mut place, target, unwind, + replace, } => { if let Some(new_place) = self.un_derefer.derefer(place.as_ref(), self.body) { place = new_place; @@ -463,27 +459,36 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> { self.init_data.seek_before(loc); match self.move_data().rev_lookup.find(place.as_ref()) { - LookupResult::Exact(path) => elaborate_drop( - &mut Elaborator { ctxt: self }, - terminator.source_info, - place, - path, - target, - if data.is_cleanup { + LookupResult::Exact(path) => { + let unwind = if data.is_cleanup { Unwind::InCleanup } else { - Unwind::To(Option::unwrap_or(unwind, resume_block)) - }, - bb, - ), + match unwind { + UnwindAction::Cleanup(cleanup) => Unwind::To(cleanup), + UnwindAction::Continue => Unwind::To(self.patch.resume_block()), + UnwindAction::Unreachable => { + Unwind::To(self.patch.unreachable_cleanup_block()) + } + UnwindAction::Terminate => { + Unwind::To(self.patch.terminate_block()) + } + } + }; + elaborate_drop( + &mut Elaborator { ctxt: self }, + terminator.source_info, + place, + path, + target, + unwind, + bb, + ) + } LookupResult::Parent(..) => { - if !matches!( - terminator.source_info.span.desugaring_kind(), - Some(DesugaringKind::Replace), - ) { + if !replace { self.tcx.sess.delay_span_bug( terminator.source_info.span, - &format!("drop of untracked value {:?}", bb), + format!("drop of untracked value {:?}", bb), ); } // A drop and replace behind a pointer/array/whatever. @@ -507,7 +512,7 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> { } fn set_drop_flag(&mut self, loc: Location, path: MovePathIndex, val: DropFlagState) { - if let Some(&flag) = self.drop_flags.get(&path) { + if let Some(flag) = self.drop_flags[path] { let span = self.patch.source_info_for_location(self.body, loc).span; let val = self.constant_bool(span, val.value()); self.patch.add_assign(loc, Place::from(flag), val); @@ -518,7 +523,7 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> { let loc = Location::START; let span = self.patch.source_info_for_location(self.body, loc).span; let false_ = self.constant_bool(span, false); - for flag in self.drop_flags.values() { + for flag in self.drop_flags.iter().flatten() { self.patch .add_assign(loc, Place::from(*flag), false_.clone()); } @@ -532,7 +537,7 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> { if let TerminatorKind::Call { destination, target: Some(tgt), - cleanup: Some(_), + unwind: UnwindAction::Cleanup(_), .. } = data.terminator().kind { @@ -611,7 +616,7 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> { if let TerminatorKind::Call { destination, target: Some(_), - cleanup: None, + unwind: UnwindAction::Continue | UnwindAction::Unreachable | UnwindAction::Terminate, .. } = data.terminator().kind { diff --git a/prusti-viper/src/encoder/mir/procedures/encoder/mod.rs b/prusti-viper/src/encoder/mir/procedures/encoder/mod.rs index 6013c273f81..7e0dced682b 100644 --- a/prusti-viper/src/encoder/mir/procedures/encoder/mod.rs +++ b/prusti-viper/src/encoder/mir/procedures/encoder/mod.rs @@ -34,8 +34,10 @@ use prusti_interface::environment::{ Procedure, }; use prusti_rustc_interface::{ + abi::FieldIdx, data_structures::graph::WithStartNode, hir::def_id::DefId, + index::IndexSlice, middle::{mir, ty, ty::subst::SubstsRef}, span::Span, }; @@ -814,7 +816,7 @@ impl<'p, 'v: 'p, 'tcx: 'v> ProcedureEncoder<'p, 'v, 'tcx> { location, encoded_target, aggregate_kind, - operands, + operands.as_slice(), )?; } // mir::Rvalue::ShallowInitBox(Operand<'tcx>, Ty<'tcx>), @@ -832,7 +834,7 @@ impl<'p, 'v: 'p, 'tcx: 'v> ProcedureEncoder<'p, 'v, 'tcx> { location: mir::Location, encoded_target: vir_crate::high::Expression, aggregate_kind: &mir::AggregateKind<'tcx>, - operands: &[mir::Operand<'tcx>], + operands: &IndexSlice>, ) -> SpannedEncodingResult<()> { let ty = match aggregate_kind { mir::AggregateKind::Array(_) | mir::AggregateKind::Tuple => { @@ -857,7 +859,7 @@ impl<'p, 'v: 'p, 'tcx: 'v> ProcedureEncoder<'p, 'v, 'tcx> { assert!(ty.is_union()); let adt_def = tcx.adt_def(*adt_did); let variant_def = adt_def.non_enum_variant(); - let field_name = variant_def.fields[(*active_field_index).into()] + let field_name = variant_def.fields[*active_field_index] .ident(tcx) .to_string(); ty = ty.variant(field_name.into()); @@ -1210,20 +1212,25 @@ impl<'p, 'v: 'p, 'tcx: 'v> ProcedureEncoder<'p, 'v, 'tcx> { )?); SuccessorBuilder::exit_resume_panic() } - // TerminatorKind::DropAndReplace { target, unwind, .. } TerminatorKind::Drop { place, target, unwind, - } => { - self.encode_terminator_drop(block_builder, location, span, *place, *target, unwind)? - } + replace: _, + } => self.encode_terminator_drop( + block_builder, + location, + span, + *place, + *target, + *unwind, + )?, TerminatorKind::Call { func: mir::Operand::Constant(box mir::Constant { literal, .. }), args, destination, target, - cleanup, + unwind, fn_span, from_hir_call: _, } => { @@ -1235,7 +1242,7 @@ impl<'p, 'v: 'p, 'tcx: 'v> ProcedureEncoder<'p, 'v, 'tcx> { args, *destination, target, - cleanup, + *unwind, *fn_span, )?; // The encoding of the call is expected to set the successor. @@ -1246,7 +1253,7 @@ impl<'p, 'v: 'p, 'tcx: 'v> ProcedureEncoder<'p, 'v, 'tcx> { expected, msg, target, - cleanup, + unwind, } => self.encode_terminator_assert( block_builder, span, @@ -1254,7 +1261,7 @@ impl<'p, 'v: 'p, 'tcx: 'v> ProcedureEncoder<'p, 'v, 'tcx> { *expected, msg, *target, - *cleanup, + *unwind, )?, // TerminatorKind::Yield { .. } => { // graph.add_exit_edge(bb, "yield"); @@ -1375,7 +1382,7 @@ impl<'p, 'v: 'p, 'tcx: 'v> ProcedureEncoder<'p, 'v, 'tcx> { span: Span, place: mir::Place<'tcx>, target: mir::BasicBlock, - unwind: &Option, + unwind: mir::UnwindAction, ) -> SpannedEncodingResult { let target_block_label = self.encode_basic_block_label(target); let target_block_label = self.encode_lft_for_block_with_edge( @@ -1409,10 +1416,10 @@ impl<'p, 'v: 'p, 'tcx: 'v> ProcedureEncoder<'p, 'v, 'tcx> { )?; statement.check_no_default_position(); block_builder.add_statement(statement); - if let Some(unwind_block) = unwind { - let encoded_unwind_block_label = self.encode_basic_block_label(*unwind_block); + if let mir::UnwindAction::Cleanup(unwind_block) = unwind { + let encoded_unwind_block_label = self.encode_basic_block_label(unwind_block); let encoded_unwind_block_label = self.encode_lft_for_block_with_edge( - *unwind_block, + unwind_block, encoded_unwind_block_label, location, block_builder, @@ -1438,7 +1445,7 @@ impl<'p, 'v: 'p, 'tcx: 'v> ProcedureEncoder<'p, 'v, 'tcx> { args: &[mir::Operand<'tcx>], destination: mir::Place<'tcx>, target: &Option, - cleanup: &Option, + unwind: mir::UnwindAction, _fn_span: Span, ) -> SpannedEncodingResult<()> { if let ty::TyKind::FnDef(called_def_id, call_substs) = ty.kind() { @@ -1451,7 +1458,7 @@ impl<'p, 'v: 'p, 'tcx: 'v> ProcedureEncoder<'p, 'v, 'tcx> { args, destination, target, - cleanup, + unwind, )? { self.encode_function_call( block_builder, @@ -1462,7 +1469,7 @@ impl<'p, 'v: 'p, 'tcx: 'v> ProcedureEncoder<'p, 'v, 'tcx> { args, destination, target, - cleanup, + unwind, )?; } } else { @@ -1483,7 +1490,7 @@ impl<'p, 'v: 'p, 'tcx: 'v> ProcedureEncoder<'p, 'v, 'tcx> { args: &[mir::Operand<'tcx>], destination: mir::Place<'tcx>, target: &Option, - cleanup: &Option, + unwind: mir::UnwindAction, ) -> SpannedEncodingResult<()> { // The called method might be a trait method. // We try to resolve it to the concrete implementation @@ -1743,8 +1750,8 @@ impl<'p, 'v: 'p, 'tcx: 'v> ProcedureEncoder<'p, 'v, 'tcx> { } post_call_block_builder.build(); - if let Some(cleanup_block) = cleanup { - let encoded_cleanup_block = self.encode_basic_block_label(*cleanup_block); + if let mir::UnwindAction::Cleanup(cleanup_block) = unwind { + let encoded_cleanup_block = self.encode_basic_block_label(cleanup_block); let fresh_cleanup_label = self.fresh_basic_block_label(); let mut cleanup_block_builder = block_builder.create_basic_block_builder(fresh_cleanup_label.clone()); @@ -1777,11 +1784,7 @@ impl<'p, 'v: 'p, 'tcx: 'v> ProcedureEncoder<'p, 'v, 'tcx> { self.def_id, )?; cleanup_block_builder.add_statement(function_lifetime_return); - self.encode_lft_for_block( - *cleanup_block, - location, - &mut cleanup_block_builder, - )?; + self.encode_lft_for_block(cleanup_block, location, &mut cleanup_block_builder)?; cleanup_block_builder.build(); block_builder.set_successor_jump(vir_high::Successor::NonDetChoice( @@ -1794,7 +1797,7 @@ impl<'p, 'v: 'p, 'tcx: 'v> ProcedureEncoder<'p, 'v, 'tcx> { } else { unimplemented!(); } - } else if let Some(_cleanup_block) = cleanup { + } else if let mir::UnwindAction::Cleanup(_cleanup_block) = unwind { // TODO: add panic postconditions. unimplemented!(); } else { @@ -1814,7 +1817,7 @@ impl<'p, 'v: 'p, 'tcx: 'v> ProcedureEncoder<'p, 'v, 'tcx> { expected: bool, msg: &mir::AssertMessage<'tcx>, target: mir::BasicBlock, - cleanup: Option, + unwind: mir::UnwindAction, ) -> SpannedEncodingResult { let condition = self .encoder @@ -1846,7 +1849,7 @@ impl<'p, 'v: 'p, 'tcx: 'v> ProcedureEncoder<'p, 'v, 'tcx> { self.def_id, )?); } - let successor = if let Some(cleanup) = cleanup { + let successor = if let mir::UnwindAction::Cleanup(cleanup) = unwind { let successors = vec![ (guard, target_label), (true.into(), self.encode_basic_block_label(cleanup)), @@ -2088,7 +2091,7 @@ impl<'p, 'v: 'p, 'tcx: 'v> ProcedureEncoder<'p, 'v, 'tcx> { args, destination: _, target: _, - cleanup: _, + unwind: _, fn_span: _, from_hir_call: _, } => { diff --git a/prusti-viper/src/encoder/mir/pure/interpreter/backward_interpreter.rs b/prusti-viper/src/encoder/mir/pure/interpreter/backward_interpreter.rs index 5608def5b72..33242f32112 100644 --- a/prusti-viper/src/encoder/mir/pure/interpreter/backward_interpreter.rs +++ b/prusti-viper/src/encoder/mir/pure/interpreter/backward_interpreter.rs @@ -56,8 +56,7 @@ where .collect(); // Interpret all the blocks in `pending_blocks` - while !pending_blocks.is_empty() { - let curr_bb = pending_blocks.pop().unwrap(); + while let Some(curr_bb) = pending_blocks.pop() { let bb_data = &basic_blocks[curr_bb]; // Apply the terminator @@ -126,8 +125,7 @@ pub fn run_backward_interpretation_point_to_point< let mut pending_blocks: Vec = vec![final_bbi]; // Interpret all the blocks in `pending_blocks` - while !pending_blocks.is_empty() { - let curr_bb = pending_blocks.pop().unwrap(); + while let Some(curr_bb) = pending_blocks.pop() { let bb_data = &basic_blocks[curr_bb]; trace!("curr_bb: {:?}", curr_bb); diff --git a/prusti-viper/src/encoder/mir/pure/interpreter/interpreter_high.rs b/prusti-viper/src/encoder/mir/pure/interpreter/interpreter_high.rs index 44f37bc2bdd..afa6f24bbd9 100644 --- a/prusti-viper/src/encoder/mir/pure/interpreter/interpreter_high.rs +++ b/prusti-viper/src/encoder/mir/pure/interpreter/interpreter_high.rs @@ -31,7 +31,9 @@ use log::{debug, trace}; use prusti_common::vir_high_local; use prusti_interface::environment::mir_utils::SliceOrArrayRef; use prusti_rustc_interface::{ + abi::FieldIdx, hir::def_id::DefId, + index::IndexSlice, middle::{mir, ty, ty::subst::SubstsRef}, span::Span, }; @@ -113,7 +115,7 @@ impl<'p, 'v: 'p, 'tcx: 'v> ExpressionBackwardInterpreter<'p, 'v, 'tcx> { ty: vir_high::Type, lhs: &vir_high::Expression, aggregate: &mir::AggregateKind<'tcx>, - operands: &[mir::Operand<'tcx>], + operands: &IndexSlice>, span: Span, ) -> SpannedEncodingResult<()> { let mut arguments = Vec::new(); @@ -180,7 +182,14 @@ impl<'p, 'v: 'p, 'tcx: 'v> ExpressionBackwardInterpreter<'p, 'v, 'tcx> { } mir::Rvalue::Aggregate(aggregate, operands) => { debug!("Encode aggregate {:?}, {:?}", aggregate, operands); - self.apply_assign_aggregate(state, ty, &encoded_lhs, aggregate, operands, span)? + self.apply_assign_aggregate( + state, + ty, + &encoded_lhs, + aggregate, + operands.as_slice(), + span, + )? } mir::Rvalue::BinaryOp(op, box (left, right)) => { let encoded_left = self.encode_operand(left, span)?; @@ -438,7 +447,8 @@ impl<'p, 'v: 'p, 'tcx: 'v> ExpressionBackwardInterpreter<'p, 'v, 'tcx> { // compose substitutions // TODO(tymap): do we need this? - let substs = ty::EarlyBinder(*call_substs).subst(self.encoder.env().tcx(), self.substs); + let substs = + ty::EarlyBinder::bind(*call_substs).subst(self.encoder.env().tcx(), self.substs); let state = if let Some(target_block) = target { let encoded_lhs = self.encode_place(destination).with_span(span)?; @@ -890,7 +900,7 @@ impl<'p, 'v: 'p, 'tcx: 'v> BackwardMirInterpreter<'tcx> ) } - TerminatorKind::Abort | TerminatorKind::Resume { .. } => { + TerminatorKind::Terminate | TerminatorKind::Resume { .. } => { assert!(states.is_empty()); let pos = self .encoder @@ -971,7 +981,7 @@ impl<'p, 'v: 'p, 'tcx: 'v> BackwardMirInterpreter<'tcx> vir_high::Expression::not(encoded_condition) }; - let error_ctxt = if let mir::AssertKind::BoundsCheck { .. } = msg { + let error_ctxt = if let box mir::AssertKind::BoundsCheck { .. } = msg { ErrorCtxt::BoundsCheckAssert } else { let assert_msg = msg.description().to_string(); @@ -1053,6 +1063,7 @@ impl<'p, 'v: 'p, 'tcx: 'v> BackwardMirInterpreter<'tcx> mir::StatementKind::StorageLive(..) | mir::StatementKind::StorageDead(..) | mir::StatementKind::FakeRead(..) + | mir::StatementKind::AscribeUserType(..) | mir::StatementKind::PlaceMention(..) => { // Nothing to do } diff --git a/prusti-viper/src/encoder/mir/pure/interpreter/interpreter_poly.rs b/prusti-viper/src/encoder/mir/pure/interpreter/interpreter_poly.rs index a660f2146e4..b63d3400dda 100644 --- a/prusti-viper/src/encoder/mir/pure/interpreter/interpreter_poly.rs +++ b/prusti-viper/src/encoder/mir/pure/interpreter/interpreter_poly.rs @@ -267,7 +267,7 @@ impl<'p, 'v: 'p, 'tcx: 'v> BackwardMirInterpreter<'tcx> ) } - TerminatorKind::Abort | TerminatorKind::Resume { .. } => { + TerminatorKind::Terminate | TerminatorKind::Resume { .. } => { assert!(states.is_empty()); let pos = self.encoder.error_manager().register_error( term.source_info.span, @@ -734,7 +734,7 @@ impl<'p, 'v: 'p, 'tcx: 'v> BackwardMirInterpreter<'tcx> vir::Expr::not(cond_val) }; - let error_ctxt = if let mir::AssertKind::BoundsCheck { .. } = msg { + let error_ctxt = if let box mir::AssertKind::BoundsCheck { .. } = msg { ErrorCtxt::BoundsCheckAssert } else { let assert_msg = msg.description().to_string(); @@ -945,7 +945,7 @@ impl<'p, 'v: 'p, 'tcx: 'v> BackwardMirInterpreter<'tcx> } let mut field_exprs = vec![]; for (field_index, field) in variant_def.fields.iter().enumerate() { - let operand = &operands[field_index]; + let operand = &operands[field_index.into()]; let field_name = field.ident(tcx).to_string(); let field_ty = field.ty(tcx, subst); let encoded_field = self.encoder @@ -981,7 +981,7 @@ impl<'p, 'v: 'p, 'tcx: 'v> BackwardMirInterpreter<'tcx> let cl_substs = substs.as_closure(); let mut field_exprs = vec![]; for (field_index, field_ty) in cl_substs.upvar_tys().enumerate() { - let operand = &operands[field_index]; + let operand = &operands[field_index.into()]; let field_name = format!("closure_{field_index}"); let encoded_field = self.encoder diff --git a/prusti-viper/src/encoder/mir/pure/pure_functions/encoder_high.rs b/prusti-viper/src/encoder/mir/pure/pure_functions/encoder_high.rs index 9062e611852..44060d88e92 100644 --- a/prusti-viper/src/encoder/mir/pure/pure_functions/encoder_high.rs +++ b/prusti-viper/src/encoder/mir/pure/pure_functions/encoder_high.rs @@ -3,6 +3,7 @@ use crate::encoder::{ errors::{ErrorCtxt, SpannedEncodingError, SpannedEncodingResult, WithSpan}, mir::{ contracts::{ContractsEncoderInterface, ProcedureContractMirDef}, + errors::ErrorInterface, generics::MirGenericsEncoderInterface, pure::{ interpreter::{ @@ -341,11 +342,12 @@ impl<'p, 'v: 'p, 'tcx: 'v> PureEncoder<'p, 'v, 'tcx> { self.parent_def_id, assertion_substs, )?; - self.encoder.error_manager().set_error( - encoded_assertion.position().into(), + let original_position = encoded_assertion.position(); + conjuncts.push(self.encoder.set_surrounding_error_context_for_expression( + encoded_assertion, + original_position, ErrorCtxt::PureFunctionDefinition, - ); - conjuncts.push(encoded_assertion); + )); } Ok(conjuncts.into_iter().conjoin()) } @@ -369,11 +371,12 @@ impl<'p, 'v: 'p, 'tcx: 'v> PureEncoder<'p, 'v, 'tcx> { self.parent_def_id, assertion_substs, )?; - self.encoder.error_manager().set_error( - encoded_assertion.position().into(), + let original_position = encoded_assertion.position(); + conjuncts.push(self.encoder.set_surrounding_error_context_for_expression( + encoded_assertion, + original_position, ErrorCtxt::PureFunctionDefinition, - ); - conjuncts.push(encoded_assertion); + )); } let post = conjuncts.into_iter().conjoin(); diff --git a/prusti-viper/src/encoder/mir/pure/pure_functions/encoder_poly.rs b/prusti-viper/src/encoder/mir/pure/pure_functions/encoder_poly.rs index bddcb4bdd32..fc413de09a1 100644 --- a/prusti-viper/src/encoder/mir/pure/pure_functions/encoder_poly.rs +++ b/prusti-viper/src/encoder/mir/pure/pure_functions/encoder_poly.rs @@ -80,23 +80,23 @@ pub(super) fn encode_body<'p, 'v: 'p, 'tcx: 'v>( /// Used to encode unevaluated constants. pub(super) fn encode_promoted<'p, 'v: 'p, 'tcx: 'v>( encoder: &'p Encoder<'v, 'tcx>, - proc_def_id: ty::WithOptConstParam, + proc_def_id: DefId, promoted_id: mir::Promoted, parent_def_id: DefId, substs: SubstsRef<'tcx>, ) -> SpannedEncodingResult { let tcx = encoder.env().tcx(); - let promoted_bodies = tcx.promoted_mir_opt_const_arg(proc_def_id); + let promoted_bodies = tcx.promoted_mir(proc_def_id); let param_env = tcx.param_env(parent_def_id); let mir = tcx.subst_and_normalize_erasing_regions( substs, param_env, - promoted_bodies[promoted_id].clone(), + ty::EarlyBinder::bind(promoted_bodies[promoted_id].clone()), ); encode_mir( encoder, &mir, - proc_def_id.did, + proc_def_id, PureEncodingContext::Code, parent_def_id, ) @@ -479,10 +479,11 @@ impl<'p, 'v: 'p, 'tcx: 'v> PureFunctionEncoder<'p, 'v, 'tcx> { self.parent_def_id, assertion_substs, )?; - self.encoder - .error_manager() - .set_error(encoded_assertion.pos(), ErrorCtxt::PureFunctionDefinition); - func_spec.push(encoded_assertion); + let new_pos = self.encoder.error_manager().set_surrounding_error_context( + encoded_assertion.pos(), + ErrorCtxt::PureFunctionDefinition, + ); + func_spec.push(encoded_assertion.set_pos(new_pos)); } Ok(( @@ -521,10 +522,11 @@ impl<'p, 'v: 'p, 'tcx: 'v> PureFunctionEncoder<'p, 'v, 'tcx> { self.parent_def_id, assertion_substs, )?; - self.encoder - .error_manager() - .set_error(encoded_postcond.pos(), ErrorCtxt::PureFunctionDefinition); - func_spec.push(encoded_postcond); + let new_pos = self.encoder.error_manager().set_surrounding_error_context( + encoded_postcond.pos(), + ErrorCtxt::PureFunctionDefinition, + ); + func_spec.push(encoded_postcond.set_pos(new_pos)); } let post = func_spec.into_iter().conjoin(); diff --git a/prusti-viper/src/encoder/mir/pure/pure_functions/interface.rs b/prusti-viper/src/encoder/mir/pure/pure_functions/interface.rs index bea769e4d09..3da23a5ded1 100644 --- a/prusti-viper/src/encoder/mir/pure/pure_functions/interface.rs +++ b/prusti-viper/src/encoder/mir/pure/pure_functions/interface.rs @@ -253,7 +253,7 @@ impl<'v, 'tcx: 'v> PureFunctionEncoderInterface<'v, 'tcx> }: mir::UnevaluatedConst<'tcx>, ) -> SpannedEncodingResult { let promoted_id = promoted.expect("unevaluated const should have a promoted ID"); - super::encoder_poly::encode_promoted(self, def, promoted_id, def.did, substs) + super::encoder_poly::encode_promoted(self, def, promoted_id, def, substs) } // FIXME: This should be refactored to depend on encode_pure_expression_high diff --git a/prusti-viper/src/encoder/mir/specifications/constraints.rs b/prusti-viper/src/encoder/mir/specifications/constraints.rs index 557745c3fe6..0cffadea6a8 100644 --- a/prusti-viper/src/encoder/mir/specifications/constraints.rs +++ b/prusti-viper/src/encoder/mir/specifications/constraints.rs @@ -186,7 +186,7 @@ mod trait_bounds { .find_trait_method_substs(context.proc_def_id, context.substs); let param_env = if let Some((_, trait_substs)) = maybe_trait_method { trace!("Applying trait substs {:?}", trait_substs); - ty::EarlyBinder(param_env).subst(env.tcx(), trait_substs) + ty::EarlyBinder::bind(param_env).subst(env.tcx(), trait_substs) } else { param_env }; @@ -200,7 +200,7 @@ mod trait_bounds { param_env } else { trace!("Applying call substs {:?}", context.substs); - ty::EarlyBinder(param_env).subst(env.tcx(), context.substs) + ty::EarlyBinder::bind(param_env).subst(env.tcx(), context.substs) } } diff --git a/prusti-viper/src/encoder/mir/types/const_parameters.rs b/prusti-viper/src/encoder/mir/types/const_parameters.rs index 5f4dc7b8796..e472c9132a8 100644 --- a/prusti-viper/src/encoder/mir/types/const_parameters.rs +++ b/prusti-viper/src/encoder/mir/types/const_parameters.rs @@ -17,6 +17,17 @@ pub(super) fn extract_const_parameters_from_substs<'tcx>( Ok(()) } +pub(super) fn extract_const_parameters_from_types<'tcx>( + type_encoder: &impl super::MirTypeEncoderInterface<'tcx>, + types: impl IntoIterator>, + const_parameters: &mut Vec, +) -> SpannedEncodingResult<()> { + for ty in types { + extract_const_parameters_from_type(type_encoder, ty, const_parameters)?; + } + Ok(()) +} + pub(super) fn extract_const_parameters_from_type<'tcx>( type_encoder: &impl super::MirTypeEncoderInterface<'tcx>, ty: ty::Ty<'tcx>, @@ -35,7 +46,7 @@ pub(super) fn extract_const_parameters_from_type<'tcx>( | ty::TyKind::Dynamic(..) => {} ty::TyKind::Adt(_, substs) | ty::TyKind::Closure(_, substs) - | ty::TyKind::Alias(ty::AliasKind::Opaque, ty::AliasTy { substs, .. }) + | ty::TyKind::Alias(_, ty::AliasTy { substs, .. }) | ty::TyKind::FnDef(_, substs) => { extract_const_parameters_from_substs(type_encoder, substs, const_parameters)? } @@ -68,9 +79,6 @@ pub(super) fn extract_const_parameters_from_type<'tcx>( ty::TyKind::Param(_param_ty) => { // FIXME: extract const_parameters from TyKind::Param() } - ty::TyKind::Alias(ty::AliasKind::Projection, alias_ty) => { - extract_const_parameters_from_substs(type_encoder, alias_ty.substs, const_parameters)? - } ty::TyKind::Bound(_, _) | ty::TyKind::Placeholder(_) | ty::TyKind::Infer(_) diff --git a/prusti-viper/src/encoder/mir/types/encoder.rs b/prusti-viper/src/encoder/mir/types/encoder.rs index 4cc5f8703fb..c6df1436f6f 100644 --- a/prusti-viper/src/encoder/mir/types/encoder.rs +++ b/prusti-viper/src/encoder/mir/types/encoder.rs @@ -272,7 +272,6 @@ impl<'p, 'v, 'r: 'v, 'tcx: 'v> TypeEncoder<'p, 'v, 'tcx> { | ty::TyKind::GeneratorWitnessMIR(..) | ty::TyKind::Never | ty::TyKind::Tuple(_) - | ty::TyKind::Alias(ty::AliasKind::Projection, _) | ty::TyKind::Param(_) | ty::TyKind::Bound(..) | ty::TyKind::Placeholder(_) @@ -283,7 +282,7 @@ impl<'p, 'v, 'r: 'v, 'tcx: 'v> TypeEncoder<'p, 'v, 'tcx> { | ty::TyKind::FnDef(did, _) | ty::TyKind::Closure(did, _) | ty::TyKind::Generator(did, _, _) - | ty::TyKind::Alias(ty::AliasKind::Opaque, ty::AliasTy { def_id: did, .. }) => { + | ty::TyKind::Alias(_, ty::AliasTy { def_id: did, .. }) => { self.encoder.env().query.get_def_span(did).into() } } @@ -412,10 +411,8 @@ impl<'p, 'v, 'r: 'v, 'tcx: 'v> TypeEncoder<'p, 'v, 'tcx> { ) } ty::TyKind::Tuple(elems) => { - let lifetimes = self.encoder.get_lifetimes_from_substs(elems.as_substs())?; - let const_parameters = self - .encoder - .get_const_parameters_from_substs(elems.as_substs())?; + let lifetimes = self.encoder.get_lifetimes_from_types(*elems)?; + let const_parameters = self.encoder.get_const_parameters_from_types(*elems)?; let arguments = elems .into_iter() .map(|ty| self.encoder.encode_type_high(ty)) diff --git a/prusti-viper/src/encoder/mir/types/interface.rs b/prusti-viper/src/encoder/mir/types/interface.rs index 1b26bdf00b8..28ca979996a 100644 --- a/prusti-viper/src/encoder/mir/types/interface.rs +++ b/prusti-viper/src/encoder/mir/types/interface.rs @@ -39,6 +39,10 @@ pub(crate) trait MirTypeEncoderInterface<'tcx> { declaration_span: Span, ) -> SpannedEncodingResult; fn encode_value_field_high(&self, ty: ty::Ty<'tcx>) -> EncodingResult; + fn get_lifetimes_from_types( + &self, + types: impl IntoIterator>, + ) -> SpannedEncodingResult>; fn get_lifetimes_from_substs( &self, substs: SubstsRef<'tcx>, @@ -47,6 +51,10 @@ pub(crate) trait MirTypeEncoderInterface<'tcx> { &self, substs: SubstsRef<'tcx>, ) -> SpannedEncodingResult>; + fn get_const_parameters_from_types( + &self, + types: impl IntoIterator>, + ) -> SpannedEncodingResult>; fn get_lifetimes_from_type_high( &self, ty: ty::Ty<'tcx>, @@ -183,6 +191,14 @@ impl<'v, 'tcx: 'v> MirTypeEncoderInterface<'tcx> for super::super::super::Encode super::lifetimes::extract_lifetimes_from_substs(self, substs, &mut lifetimes)?; Ok(lifetimes) } + fn get_lifetimes_from_types( + &self, + types: impl IntoIterator>, + ) -> SpannedEncodingResult> { + let mut lifetimes = Vec::new(); + super::lifetimes::extract_lifetimes_from_types(self, types, &mut lifetimes)?; + Ok(lifetimes) + } fn get_const_parameters_from_substs( &self, substs: SubstsRef<'tcx>, @@ -195,6 +211,18 @@ impl<'v, 'tcx: 'v> MirTypeEncoderInterface<'tcx> for super::super::super::Encode )?; Ok(const_parameters) } + fn get_const_parameters_from_types( + &self, + types: impl IntoIterator>, + ) -> SpannedEncodingResult> { + let mut const_parameters = Vec::new(); + super::const_parameters::extract_const_parameters_from_types( + self, + types, + &mut const_parameters, + )?; + Ok(const_parameters) + } /// FIXME: This method causes a lifetime clash in case the same lifetime is /// used in multiple places: diff --git a/prusti-viper/src/encoder/mir/types/lifetimes.rs b/prusti-viper/src/encoder/mir/types/lifetimes.rs index e63f9a7847b..f53b1762fa3 100644 --- a/prusti-viper/src/encoder/mir/types/lifetimes.rs +++ b/prusti-viper/src/encoder/mir/types/lifetimes.rs @@ -25,6 +25,17 @@ pub(super) fn extract_lifetimes_from_substs<'tcx>( Ok(()) } +pub(super) fn extract_lifetimes_from_types<'tcx>( + type_encoder: &impl super::MirTypeEncoderInterface<'tcx>, + types: impl IntoIterator>, + lifetimes: &mut Vec, +) -> SpannedEncodingResult<()> { + for ty in types { + extract_lifetimes_from_type(type_encoder, ty, lifetimes)?; + } + Ok(()) +} + pub(super) fn extract_lifetimes_from_type<'tcx>( type_encoder: &impl super::MirTypeEncoderInterface<'tcx>, ty: ty::Ty<'tcx>, @@ -42,7 +53,7 @@ pub(super) fn extract_lifetimes_from_type<'tcx>( | ty::TyKind::Never => {} ty::TyKind::Adt(_, substs) | ty::TyKind::Closure(_, substs) - | ty::TyKind::Alias(ty::AliasKind::Opaque, ty::AliasTy { substs, .. }) + | ty::TyKind::Alias(_, ty::AliasTy { substs, .. }) | ty::TyKind::FnDef(_, substs) => { extract_lifetimes_from_substs(type_encoder, substs, lifetimes)? } @@ -79,9 +90,6 @@ pub(super) fn extract_lifetimes_from_type<'tcx>( ty::TyKind::Param(_param_ty) => { // FIXME: extract lifetimes from TyKind::Param() } - ty::TyKind::Alias(ty::AliasKind::Projection, alias_ty) => { - extract_lifetimes_from_substs(type_encoder, alias_ty.substs, lifetimes)? - } ty::TyKind::Bound(_, _) | ty::TyKind::Placeholder(_) | ty::TyKind::Infer(_) diff --git a/prusti-viper/src/encoder/mir_encoder/mod.rs b/prusti-viper/src/encoder/mir_encoder/mod.rs index 7be46484647..a8bdfbc6c52 100644 --- a/prusti-viper/src/encoder/mir_encoder/mod.rs +++ b/prusti-viper/src/encoder/mir_encoder/mod.rs @@ -19,7 +19,7 @@ use prusti_common::config; use prusti_rustc_interface::target::abi; use prusti_rustc_interface::hir::def_id::DefId; use prusti_rustc_interface::middle::{mir, ty}; -use prusti_rustc_interface::index::vec::IndexVec; +use prusti_rustc_interface::index::IndexVec; use prusti_rustc_interface::span::{Span, DUMMY_SP}; use log::{trace, debug}; use prusti_interface::environment::mir_utils::MirPlace; diff --git a/prusti-viper/src/encoder/places.rs b/prusti-viper/src/encoder/places.rs index 5eb34f3c298..6ab6c1e8bbd 100644 --- a/prusti-viper/src/encoder/places.rs +++ b/prusti-viper/src/encoder/places.rs @@ -6,7 +6,7 @@ use prusti_rustc_interface::middle::mir; use prusti_rustc_interface::middle::ty::Ty; -use prusti_rustc_interface::index::vec::{Idx, IndexVec}; +use prusti_rustc_interface::index::{Idx, IndexVec}; use std::{iter}; /// A local variable used as an abstraction over both real Rust MIR local diff --git a/prusti-viper/src/encoder/procedure_encoder.rs b/prusti-viper/src/encoder/procedure_encoder.rs index faab64c38a1..433c1dedc2b 100644 --- a/prusti-viper/src/encoder/procedure_encoder.rs +++ b/prusti-viper/src/encoder/procedure_encoder.rs @@ -52,11 +52,12 @@ use prusti_interface::{ use std::collections::{BTreeMap}; use std::fmt::Debug; use prusti_interface::utils; +use prusti_rustc_interface::index::IndexSlice; use prusti_rustc_interface::middle::mir::Mutability; use prusti_rustc_interface::middle::mir; use prusti_rustc_interface::middle::mir::{TerminatorKind}; use prusti_rustc_interface::middle::ty::{self, subst::SubstsRef}; -use prusti_rustc_interface::target::abi::Integer; +use prusti_rustc_interface::target::abi::{FieldIdx, Integer}; use rustc_hash::{FxHashMap, FxHashSet}; use prusti_rustc_interface::span::Span; use prusti_rustc_interface::errors::MultiSpan; @@ -1522,7 +1523,7 @@ impl<'p, 'v: 'p, 'tcx: 'v> ProcedureEncoder<'p, 'v, 'tcx> { &encoded_lhs, ty, aggregate, - operands, + operands.as_slice(), location )? }, @@ -1554,7 +1555,7 @@ impl<'p, 'v: 'p, 'tcx: 'v> ProcedureEncoder<'p, 'v, 'tcx> { location )? } - mir::Rvalue::NullaryOp(op, op_ty) => { + mir::Rvalue::NullaryOp(ref op, op_ty) => { self.encode_assign_nullary_op( op, op_ty, @@ -2436,7 +2437,7 @@ impl<'p, 'v: 'p, 'tcx: 'v> ProcedureEncoder<'p, 'v, 'tcx> { (stmts, MirSuccessor::Kill) } - TerminatorKind::Abort => { + TerminatorKind::Terminate => { let pos = self.register_error(term.source_info.span, ErrorCtxt::AbortTerminator); stmts.push(vir::Stmt::Assert( vir::Assert { expr: false.into(), @@ -2754,7 +2755,7 @@ impl<'p, 'v: 'p, 'tcx: 'v> ProcedureEncoder<'p, 'v, 'tcx> { }; // Check or assume the assertion - let (assert_msg, error_ctxt) = if let mir::AssertKind::BoundsCheck { .. } = msg { + let (assert_msg, error_ctxt) = if let box mir::AssertKind::BoundsCheck { .. } = msg { let mut s = String::new(); msg.fmt_assert_args(&mut s).unwrap(); (s, ErrorCtxt::BoundsCheckAssert) @@ -5510,10 +5511,8 @@ impl<'p, 'v: 'p, 'tcx: 'v> ProcedureEncoder<'p, 'v, 'tcx> { } } else { // FIXME: why are we getting the MIR body for this? - let mir = self.encoder.env().body.get_impure_fn_body( + let mir = self.encoder.env().body.get_impure_fn_body_identity( containing_def_id.expect_local(), - // TODO(tymap): identity substs here are probably wrong? - self.encoder.env().query.identity_substs(containing_def_id), ); let return_ty = mir.return_ty(); let arg_tys = mir.args_iter().map(|arg| mir.local_decls[arg].ty).collect(); @@ -5987,7 +5986,7 @@ impl<'p, 'v: 'p, 'tcx: 'v> ProcedureEncoder<'p, 'v, 'tcx> { #[tracing::instrument(level = "trace", skip(self))] fn encode_assign_nullary_op( &mut self, - op: mir::NullOp, + op: &mir::NullOp, op_ty: ty::Ty<'tcx>, encoded_lhs: vir::Expr, ty: ty::Ty<'tcx>, @@ -6006,6 +6005,12 @@ impl<'p, 'v: 'p, 'tcx: 'v> ProcedureEncoder<'p, 'v, 'tcx> { mir::NullOp::SizeOf => layout.size().bytes(), // FIXME: abi or pref? mir::NullOp::AlignOf => layout.align().abi.bytes(), + mir::NullOp::OffsetOf(_) => { + return Err(SpannedEncodingError::internal( + "`OffsetOf` is not supported yet".to_string(), + self.mir.source_info(location).span, + )) + } }; let bytes_vir = vir::Expr::from(bytes); self.encode_copy_value_assign( @@ -6579,7 +6584,7 @@ impl<'p, 'v: 'p, 'tcx: 'v> ProcedureEncoder<'p, 'v, 'tcx> { dst: &vir::Expr, ty: ty::Ty<'tcx>, aggregate: &mir::AggregateKind<'tcx>, - operands: &[mir::Operand<'tcx>], + operands: &IndexSlice>, location: mir::Location, ) -> SpannedEncodingResult> { let span = self.mir_encoder.get_span_of_location(location); @@ -6665,7 +6670,7 @@ impl<'p, 'v: 'p, 'tcx: 'v> ProcedureEncoder<'p, 'v, 'tcx> { dst_base = new_dst_base; } for (field_index, field) in variant_def.fields.iter().enumerate() { - let operand = &operands[field_index]; + let operand = &operands[field_index.into()]; let field_name = field.ident(tcx).to_string(); let field_ty = field.ty(tcx, subst); let encoded_field = self.encoder @@ -6684,7 +6689,7 @@ impl<'p, 'v: 'p, 'tcx: 'v> ProcedureEncoder<'p, 'v, 'tcx> { assert!(!self.encoder.is_spec_closure(def_id), "spec closure: {def_id:?}"); let cl_substs = substs.as_closure(); for (field_index, field_ty) in cl_substs.upvar_tys().enumerate() { - let operand = &operands[field_index]; + let operand = &operands[field_index.into()]; let field_name = format!("closure_{field_index}"); let encoded_field = self.encoder .encode_raw_ref_field(field_name, field_ty) diff --git a/prusti-viper/src/utils/mod.rs b/prusti-viper/src/utils/mod.rs index daa4f02a198..16afb3574f3 100644 --- a/prusti-viper/src/utils/mod.rs +++ b/prusti-viper/src/utils/mod.rs @@ -35,6 +35,7 @@ pub fn ty_to_string(typ: &ty::TyKind) -> String { &ty::TyKind::Tuple(_) => "tuple", &ty::TyKind::Alias(ty::AliasKind::Projection, _) => "projection", &ty::TyKind::Alias(ty::AliasKind::Opaque, _) => "opaque type", + &ty::TyKind::Alias(ty::AliasKind::Inherent, _) => "inherent alias type", &ty::TyKind::Param(_) => "type parameter", &ty::TyKind::Bound(_, _) => "bound type variable", &ty::TyKind::Placeholder(_) => "placeholder type", diff --git a/prusti/src/callbacks.rs b/prusti/src/callbacks.rs index f8018ade5ee..b622a8b1ad0 100644 --- a/prusti/src/callbacks.rs +++ b/prusti/src/callbacks.rs @@ -5,13 +5,16 @@ use prusti_interface::{ specs::{self, cross_crate::CrossCrateSpecs, is_spec_fn}, }; use prusti_rustc_interface::{ + borrowck::consumers, + data_structures::steal::Steal, driver::Compilation, hir::{def::DefKind, def_id::LocalDefId}, + index::IndexVec, interface::{interface::Compiler, Config, Queries}, - middle::ty::{ - self, - query::{query_values::mir_borrowck, ExternProviders, Providers}, - TyCtxt, + middle::{ + mir::{self, BorrowCheckResult}, + query::{ExternProviders, Providers}, + ty::TyCtxt, }, session::Session, }; @@ -24,25 +27,23 @@ pub struct PrustiCompilerCalls; #[allow(clippy::needless_lifetimes)] #[tracing::instrument(level = "debug", skip(tcx))] -fn mir_borrowck<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) -> mir_borrowck<'tcx> { - // *Don't take MIR bodies with borrowck info if we won't need them* - if !is_spec_fn(tcx, def_id.to_def_id()) { - let def_kind = tcx.def_kind(def_id.to_def_id()); - let is_anon_const = matches!(def_kind, DefKind::AnonConst); - // Anon Const bodies have already been stolen and so will result in a crash - // when calling `get_body_with_borrowck_facts`. TODO: figure out if we need - // (anon) const bodies at all, and if so, how to get them? - if !is_anon_const { - let body_with_facts = - prusti_rustc_interface::borrowck::consumers::get_body_with_borrowck_facts( - tcx, - ty::WithOptConstParam::unknown(def_id), - ); - // SAFETY: This is safe because we are feeding in the same `tcx` that is - // going to be used as a witness when pulling out the data. - unsafe { - mir_storage::store_mir_body(tcx, def_id, body_with_facts); - } +fn mir_borrowck<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) -> &BorrowCheckResult<'tcx> { + let def_kind = tcx.def_kind(def_id.to_def_id()); + let is_anon_const = matches!(def_kind, DefKind::AnonConst); + // Anon Const bodies have already been stolen and so will result in a crash + // when calling `get_body_with_borrowck_facts`. TODO: figure out if we need + // (anon) const bodies at all, and if so, how to get them? + if !is_anon_const { + let consumer_opts = if is_spec_fn(tcx, def_id.to_def_id()) || config::no_verify() { + consumers::ConsumerOptions::RegionInferenceContext + } else { + consumers::ConsumerOptions::PoloniusOutputFacts + }; + let body_with_facts = consumers::get_body_with_borrowck_facts(tcx, def_id, consumer_opts); + // SAFETY: This is safe because we are feeding in the same `tcx` that is + // going to be used as a witness when pulling out the data. + unsafe { + mir_storage::store_mir_body(tcx, def_id, body_with_facts); } } let mut providers = Providers::default(); @@ -51,17 +52,35 @@ fn mir_borrowck<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) -> mir_borrowck<'tc original_mir_borrowck(tcx, def_id) } +#[allow(clippy::needless_lifetimes)] +#[tracing::instrument(level = "debug", skip(tcx))] +fn mir_promoted<'tcx>( + tcx: TyCtxt<'tcx>, + def_id: LocalDefId, +) -> ( + &'tcx Steal>, + &'tcx Steal>>, +) { + let original_mir_promoted = + prusti_rustc_interface::interface::DEFAULT_QUERY_PROVIDERS.mir_promoted; + let result = original_mir_promoted(tcx, def_id); + // SAFETY: This is safe because we are feeding in the same `tcx` that is + // going to be used as a witness when pulling out the data. + unsafe { + mir_storage::store_promoted_mir_body(tcx, def_id, result.0.borrow().clone()); + } + result +} + impl prusti_rustc_interface::driver::Callbacks for PrustiCompilerCalls { fn config(&mut self, config: &mut Config) { - // *Don't take MIR bodies with borrowck info if we won't need them* - if !config::no_verify() { - assert!(config.override_queries.is_none()); - config.override_queries = Some( - |_session: &Session, providers: &mut Providers, _external: &mut ExternProviders| { - providers.mir_borrowck = mir_borrowck; - }, - ); - } + assert!(config.override_queries.is_none()); + config.override_queries = Some( + |_session: &Session, providers: &mut Providers, _external: &mut ExternProviders| { + providers.mir_borrowck = mir_borrowck; + providers.mir_promoted = mir_promoted; + }, + ); } #[tracing::instrument(level = "debug", skip_all)] fn after_expansion<'tcx>( diff --git a/prusti/src/driver.rs b/prusti/src/driver.rs index 729476a40d6..9e70d900848 100644 --- a/prusti/src/driver.rs +++ b/prusti/src/driver.rs @@ -19,7 +19,7 @@ use lazy_static::lazy_static; use log::info; use prusti_common::{config, report::user, Stopwatch}; use prusti_rustc_interface::interface::interface::try_print_query_stack; -use std::{borrow::Cow, env, panic}; +use std::{env, panic}; use tracing_chrome::{ChromeLayerBuilder, FlushGuard}; use tracing_subscriber::{filter::EnvFilter, prelude::*}; @@ -86,14 +86,14 @@ fn report_prusti_ice(info: &panic::PanicInfo<'_>, bug_report_url: &str) { let version_info = get_prusti_version_info(); - let xs: Vec> = vec![ + let xs: Vec = vec![ "Prusti or the compiler unexpectedly panicked. This is a bug.".into(), - format!("We would appreciate a bug report: {bug_report_url}").into(), - format!("Prusti version: {version_info}").into(), + format!("We would appreciate a bug report: {bug_report_url}"), + format!("Prusti version: {version_info}"), ]; - for note in &xs { - handler.note_without_error(note.as_ref()); + for note in xs { + handler.note_without_error(note); } // If backtraces are enabled, also print the query stack @@ -209,7 +209,6 @@ fn main() { } rustc_args.push("-Zalways-encode-mir".to_owned()); - rustc_args.push("-Zcrate-attr=feature(type_ascription)".to_owned()); rustc_args.push("-Zcrate-attr=feature(stmt_expr_attributes)".to_owned()); rustc_args.push("-Zcrate-attr=feature(register_tool)".to_owned()); rustc_args.push("-Zcrate-attr=register_tool(prusti)".to_owned()); @@ -245,7 +244,7 @@ fn main() { )); } - let mut callbacks = PrustiCompilerCalls::default(); + let mut callbacks = PrustiCompilerCalls; prusti_rustc_interface::driver::RunCompiler::new(&rustc_args, &mut callbacks).run() }); diff --git a/rust-toolchain b/rust-toolchain index dba307748c3..4d24b8445a3 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1,4 +1,4 @@ [toolchain] -channel = "nightly-2023-04-01" +channel = "nightly-2023-06-15" components = [ "rustc-dev", "llvm-tools-preview", "rust-std", "rustfmt", "clippy" ] profile = "minimal" diff --git a/test-crates/Cargo.toml b/test-crates/Cargo.toml index 13af152c40c..a398d68acfd 100644 --- a/test-crates/Cargo.toml +++ b/test-crates/Cargo.toml @@ -8,7 +8,7 @@ edition = "2021" prusti = { path = "../prusti", artifact = "bin" } prusti-launch = { path = "../prusti-launch", artifact = "bin" } color-backtrace = "0.5" -rustwide = "0.15.0" +rustwide = "0.16" env_logger = "0.10" log = "0.4" csv = "1.1.5" @@ -16,4 +16,4 @@ serde = "1.0" toml = "0.7" glob = "0.3.0" clap = { version = "4.0", features = ["derive"] } -failure = "0.1.3" +failure = "0.1" diff --git a/vir/Cargo.toml b/vir/Cargo.toml index 43d4efdab2a..de8d27b92fd 100644 --- a/vir/Cargo.toml +++ b/vir/Cargo.toml @@ -16,7 +16,7 @@ proc-macro2 = { version = "1.0", features = ["span-locations"] } uuid = { version = "1.0", features = ["v4"] } log = { version = "0.4", features = ["release_max_level_info"] } lazy_static = "1.4.0" -itertools = "0.10.3" +itertools = "0.11" derive_more = "0.99.16" rustc-hash = "1.1.0" tracing = { path = "../tracing" }