diff --git a/Cargo.lock b/Cargo.lock index a30f8e9..63c8de7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,1245 +1,1359 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +version = 3 + [[package]] name = "adler32" version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d2e7343e7fc9de883d1b0341e0b13970f764c14101234857d2ddafa1cb1cac2" [[package]] name = "aho-corasick" version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58fb5e95d83b38284460a5fda7d6470aa0b8844d283a0b614b8535e880800d2d" dependencies = [ - "memchr 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "ansi_term" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr", ] [[package]] name = "anyhow" -version = "1.0.32" +version = "1.0.57" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08f9b8508dccb7687a1d6c4ce66b2b0ecef467c94667de27d8d7fe1f8d2a9cdc" [[package]] name = "atty" version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ - "hermit-abi 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "hermit-abi", + "libc", + "winapi", ] [[package]] name = "autocfg" version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2" + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "bitflags" version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" [[package]] name = "bitmaps" version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "031043d04099746d8db04daf1fa424b2bc8bd69d92b25962dcde24da39ab64a2" dependencies = [ - "typenum 1.11.2 (registry+https://github.com/rust-lang/crates.io-index)", + "typenum", ] [[package]] name = "bstr" version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ede750122d9d1f87919570cb2cccee38c84fbc8c5599b25c289af40625b7030" dependencies = [ - "memchr 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static", + "memchr", + "regex-automata", ] +[[package]] +name = "bytes" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8" + [[package]] name = "bytesize" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "716960a18f978640f25101b5cbf1c6f6b0d3192fab36a2d98ca96f0ecbe41010" [[package]] name = "c2-chacha" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "214238caa1bf3a496ec3392968969cab8549f96ff30652c9e56885329315f6bb" dependencies = [ - "ppv-lite86 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "ppv-lite86", +] + +[[package]] +name = "camino" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "869119e97797867fd90f5e22af7d0bd274bd4635ebb9eb68c04f3f513ae6c412" +dependencies = [ + "serde", ] [[package]] name = "cargo" -version = "0.43.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "anyhow 1.0.32 (registry+https://github.com/rust-lang/crates.io-index)", - "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "bytesize 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cargo-platform 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", - "core-foundation 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "crates-io 0.31.1 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "crypto-hash 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "curl 0.4.25 (registry+https://github.com/rust-lang/crates.io-index)", - "curl-sys 0.4.25 (registry+https://github.com/rust-lang/crates.io-index)", - "env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "filetime 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "flate2 1.0.13 (registry+https://github.com/rust-lang/crates.io-index)", - "fs2 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "fwdansi 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "git2 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "git2-curl 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "hex 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "home 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "humantime 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "ignore 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", - "im-rc 14.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "jobserver 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", - "libgit2-sys 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "miow 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.11.1 (registry+https://github.com/rust-lang/crates.io-index)", - "opener 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl 0.10.26 (registry+https://github.com/rust-lang/crates.io-index)", - "percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "remove_dir_all 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-workspace-hack 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustfix 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "same-file 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_ignored 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", - "shell-escape 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "strip-ansi-escapes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tar 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)", - "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "termcolor 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "toml 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "url 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", +version = "0.62.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79bc435c2de37f164b5c36420d9e1dd65cd5acbd41b2df10fdc02dbf75ed9efc" +dependencies = [ + "anyhow", + "atty", + "bytesize", + "cargo-platform", + "cargo-util", + "clap", + "crates-io", + "crossbeam-utils 0.8.8", + "curl", + "curl-sys", + "env_logger", + "filetime", + "flate2", + "fwdansi", + "git2", + "git2-curl", + "glob", + "hex 0.4.3", + "home", + "humantime", + "ignore", + "im-rc", + "itertools", + "jobserver", + "lazy_static", + "lazycell", + "libc", + "libgit2-sys", + "log", + "memchr", + "opener", + "openssl", + "os_info", + "percent-encoding", + "rustc-workspace-hack", + "rustfix", + "semver", + "serde", + "serde_ignored", + "serde_json", + "shell-escape", + "strip-ansi-escapes", + "tar", + "tempfile", + "termcolor", + "toml_edit", + "unicode-width", + "unicode-xid", + "url", + "walkdir", + "winapi", ] [[package]] name = "cargo-platform" -version = "0.1.1" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cbdb825da8a5df079a43676dbe042702f1707b1109f713a01420fbb4cc71fa27" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo-util" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a51c783163bdf4549820b80968d386c94ed45ed23819c93f59cca7ebd97fe0eb" dependencies = [ - "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", + "anyhow", + "core-foundation", + "crypto-hash", + "filetime", + "hex 0.4.3", + "jobserver", + "libc", + "log", + "miow", + "same-file", + "shell-escape", + "tempfile", + "walkdir", + "winapi", ] [[package]] name = "cargo_metadata" -version = "0.2.3" +version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4acbb09d9ee8e23699b9634375c72795d095bf268439da88562cf9b501f181fa" dependencies = [ - "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", + "camino", + "cargo-platform", + "semver", + "serde", + "serde_json", ] [[package]] name = "cc" version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95e28fa049fda1c330bcf9d723be7663a899c4679724b34c81e9f5a326aab8cd" dependencies = [ - "jobserver 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", + "jobserver", ] [[package]] name = "cfg-if" version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clap" -version = "2.33.0" +version = "3.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2dbdf4bdacb33466e854ce889eee8dfd5729abf7ccd7664d0a2d60cd384440b" +dependencies = [ + "atty", + "bitflags", + "clap_lex", + "indexmap", + "strsim", + "termcolor", + "textwrap", +] + +[[package]] +name = "clap_lex" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a37c35f1112dad5e6e0b1adaff798507497a18fceeb30cceb3bae7d1427b9213" +dependencies = [ + "os_str_bytes", +] + +[[package]] +name = "combine" +version = "4.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a604e93b79d1808327a6fca85a6f2d69de66461e7620f5a4cbf5fb4d1d7c948" dependencies = [ - "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes", + "memchr", ] [[package]] name = "commoncrypto" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d056a8586ba25a1e4d61cb090900e495952c7886786fc55f909ab2f819b69007" dependencies = [ - "commoncrypto-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "commoncrypto-sys", ] [[package]] name = "commoncrypto-sys" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fed34f46747aa73dfaa578069fd8279d2818ade2b55f38f22a9401c7f4083e2" dependencies = [ - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", ] [[package]] name = "core-foundation" -version = "0.7.0" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" dependencies = [ - "core-foundation-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", + "core-foundation-sys", + "libc", ] [[package]] name = "core-foundation-sys" -version = "0.7.0" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" [[package]] name = "crates-io" -version = "0.31.1" +version = "0.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b4a87459133b2e708195eaab34be55039bc30e0d120658bd40794bb00b6328d" dependencies = [ - "anyhow 1.0.32 (registry+https://github.com/rust-lang/crates.io-index)", - "curl 0.4.25 (registry+https://github.com/rust-lang/crates.io-index)", - "percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", - "url 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "anyhow", + "curl", + "percent-encoding", + "serde", + "serde_json", + "url", ] [[package]] name = "crc32fast" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1" dependencies = [ - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.10", ] [[package]] name = "crossbeam-channel" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acec9a3b0b3559f15aee4f90746c4e5e293b701c0f7d3925d24e01645267b68c" dependencies = [ - "crossbeam-utils 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.7.0", ] [[package]] name = "crossbeam-utils" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce446db02cdc3165b94ae73111e570793400d0794e46125cc4056c81cbb039f4" dependencies = [ - "autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.7", + "cfg-if 0.1.10", + "lazy_static", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf124c720b7686e3c2663cf54062ab0f68a88af2fb6a030e87e30bf721fcb38" +dependencies = [ + "cfg-if 1.0.0", + "lazy_static", ] [[package]] name = "crypto-hash" version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a77162240fd97248d19a564a565eb563a3f592b386e4136fb300909e67dddca" dependencies = [ - "commoncrypto 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl 0.10.26 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "commoncrypto", + "hex 0.3.2", + "openssl", + "winapi", ] [[package]] name = "curl" -version = "0.4.25" +version = "0.4.43" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37d855aeef205b43f65a5001e0997d81f8efca7badad4fad7d897aa7f0d0651f" dependencies = [ - "curl-sys 0.4.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.9.53 (registry+https://github.com/rust-lang/crates.io-index)", - "schannel 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", - "socket2 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "curl-sys", + "libc", + "openssl-probe", + "openssl-sys", + "schannel", + "socket2", + "winapi", ] [[package]] name = "curl-sys" -version = "0.4.25" +version = "0.4.55+curl-7.83.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23734ec77368ec583c2e61dd3f0b0e5c98b93abe6d2a004ca06b91dd7e3e2762" dependencies = [ - "cc 1.0.50 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", - "libnghttp2-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libz-sys 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.9.53 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)", - "vcpkg 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "cc", + "libc", + "libnghttp2-sys", + "libz-sys", + "openssl-sys", + "pkg-config", + "vcpkg", + "winapi", ] +[[package]] +name = "either" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" + [[package]] name = "env_logger" -version = "0.7.1" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b2cf0344971ee6c64c31be0d530793fba457d322dfec2810c453d0ef228f9c3" dependencies = [ - "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "humantime 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "termcolor 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "atty", + "humantime", + "log", + "regex", + "termcolor", ] [[package]] name = "filetime" -version = "0.2.8" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0408e2626025178a6a7f7ffc05a25bc47103229f19c113755de7bf63816290c" dependencies = [ - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0", + "libc", + "redox_syscall 0.2.13", + "winapi", ] [[package]] name = "flate2" version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6bd6d6f4752952feb71363cffc9ebac9411b75b87c6ab6058c40c8900cf43c0f" dependencies = [ - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", - "libz-sys 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", - "miniz_oxide 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.10", + "crc32fast", + "libc", + "libz-sys", + "miniz_oxide", ] [[package]] name = "fnv" version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" [[package]] name = "foreign-types" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" dependencies = [ - "foreign-types-shared 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "foreign-types-shared", ] [[package]] name = "foreign-types-shared" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" [[package]] -name = "fs2" -version = "0.4.3" +name = "form_urlencoded" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" dependencies = [ - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "matches", + "percent-encoding", ] [[package]] name = "fwdansi" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08c1f5787fe85505d1f7777268db5103d80a7a374d2316a7ce262e57baf8f208" dependencies = [ - "memchr 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "termcolor 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr", + "termcolor", ] [[package]] name = "getrandom" version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb" dependencies = [ - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", - "wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.10", + "libc", + "wasi", ] [[package]] name = "git2" -version = "0.11.0" +version = "0.14.4" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0155506aab710a86160ddb504a480d2964d7ab5b9e62419be69e0032bc5931c" dependencies = [ - "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", - "libgit2-sys 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.9.53 (registry+https://github.com/rust-lang/crates.io-index)", - "url 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags", + "libc", + "libgit2-sys", + "log", + "openssl-probe", + "openssl-sys", + "url", ] [[package]] name = "git2-curl" -version = "0.12.0" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ee51709364c341fbb6fe2a385a290fb9196753bdde2fc45447d27cd31b11b13" dependencies = [ - "curl 0.4.25 (registry+https://github.com/rust-lang/crates.io-index)", - "git2 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "url 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "curl", + "git2", + "log", + "url", ] [[package]] name = "glob" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" [[package]] name = "globset" version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "925aa2cac82d8834e2b2a4415b6f6879757fb5c0928fc445ae76461a12eed8f2" dependencies = [ - "aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)", - "bstr 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)", - "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "aho-corasick", + "bstr", + "fnv", + "log", + "regex", ] [[package]] name = "half" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ff54597ea139063f4225f1ec47011b03c9de4a486957ff3fc506881dac951d0" + +[[package]] +name = "hashbrown" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" [[package]] name = "hermit-abi" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eff2656d88f158ce120947499e971d743c05dbcbed62e5bd2f38f1698bbc3772" dependencies = [ - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", ] [[package]] name = "hex" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "805026a5d0141ffc30abb3be3173848ad46a1b1664fe632428479619a3644d77" [[package]] name = "hex" -version = "0.4.0" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] name = "home" version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2456aef2e6b6a9784192ae780c0f15bc57df0e918585282325e8c8ac27737654" dependencies = [ - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "humantime" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi", ] [[package]] name = "humantime" version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c1ad908cc71012b7bea4d0c53ba96a8cba9962f048fa68d143376143d863b7a" [[package]] name = "idna" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02e2673c30ee86b5b96a9cb52ad15718aa1f966f5ab9ad54a8b95d5ca33120a9" dependencies = [ - "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-normalization 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "matches", + "unicode-bidi", + "unicode-normalization", ] [[package]] name = "ignore" version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "522daefc3b69036f80c7d2990b28ff9e0471c683bad05ca258e0a01dd22c5a1e" dependencies = [ - "crossbeam-channel 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "globset 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "same-file 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "thread_local 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-channel", + "globset", + "lazy_static", + "log", + "memchr", + "regex", + "same-file", + "thread_local", + "walkdir", + "winapi-util", ] [[package]] name = "im-rc" -version = "14.3.0" +version = "15.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af1955a75fa080c677d3972822ec4bad316169ab1cfc6c257a942c2265dbe5fe" dependencies = [ - "bitmaps 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_xoshiro 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sized-chunks 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "typenum 1.11.2 (registry+https://github.com/rust-lang/crates.io-index)", - "version_check 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", + "bitmaps", + "rand_core 0.6.3", + "rand_xoshiro", + "sized-chunks", + "typenum", + "version_check", +] + +[[package]] +name = "indexmap" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6012d540c5baa3589337a98ce73408de9b5a25ec9fc2c6fd6be8f0d39e0ca5a" +dependencies = [ + "autocfg 1.1.0", + "hashbrown", +] + +[[package]] +name = "itertools" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9a9d19fa1e79b6215ff29b9d6880b706147f16e9b1dbb1e4e5947b5b02bc5e3" +dependencies = [ + "either", ] [[package]] name = "itoa" -version = "0.4.3" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "112c678d4050afce233f4f2852bb2eb519230b3cf12f33585275537d7e41578d" [[package]] name = "jobserver" -version = "0.1.19" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af25a77299a7f711a01975c35a6a424eb6862092cc2d6c72c4ed6cbc56dfc1fa" dependencies = [ - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", +] + +[[package]] +name = "kstring" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b310ccceade8121d7d77fee406160e457c2f4e7c7982d589da3499bc7ea4526" +dependencies = [ + "serde", ] [[package]] name = "lazy_static" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "lazycell" version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f" [[package]] name = "libc" -version = "0.2.65" +version = "0.2.126" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836" [[package]] name = "libgit2-sys" -version = "0.10.0" +version = "0.13.4+1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0fa6563431ede25f5cc7f6d803c6afbc1c5d3ad3d4925d12c882bf2b526f5d1" dependencies = [ - "cc 1.0.50 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", - "libssh2-sys 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "libz-sys 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.9.53 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)", + "cc", + "libc", + "libssh2-sys", + "libz-sys", + "openssl-sys", + "pkg-config", ] [[package]] name = "libnghttp2-sys" -version = "0.1.2" +version = "0.1.7+1.45.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57ed28aba195b38d5ff02b9170cbff627e336a20925e43b4945390401c5dc93f" dependencies = [ - "cc 1.0.50 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", + "cc", + "libc", ] [[package]] name = "libssh2-sys" -version = "0.2.14" +version = "0.2.23" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b094a36eb4b8b8c8a7b4b8ae43b2944502be3e59cd87687595cf6b0a71b3f4ca" dependencies = [ - "cc 1.0.50 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", - "libz-sys 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.9.53 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)", - "vcpkg 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "cc", + "libc", + "libz-sys", + "openssl-sys", + "pkg-config", + "vcpkg", ] [[package]] name = "libz-sys" -version = "1.0.25" +version = "1.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9702761c3935f8cc2f101793272e202c72b99da8f4224a19ddcf1279a6450bbf" dependencies = [ - "cc 1.0.50 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)", - "vcpkg 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "cc", + "libc", + "pkg-config", + "vcpkg", ] [[package]] name = "log" version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7" dependencies = [ - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.10", ] [[package]] name = "matches" version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" [[package]] name = "memchr" version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3197e20c7edb283f87c071ddfc7a2cca8f8e0b888c242959846a6fce03c72223" [[package]] name = "miniz_oxide" version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f3f74f726ae935c3f514300cc6773a0c9492abc5e972d42ba0c0ebb88757625" dependencies = [ - "adler32 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "adler32", ] [[package]] name = "miow" -version = "0.3.3" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21" dependencies = [ - "socket2 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi", ] [[package]] name = "mir-json" version = "0.1.0" dependencies = [ - "cargo 0.43.1 (registry+https://github.com/rust-lang/crates.io-index)", - "cargo_metadata 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_cbor 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", - "tar 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)", - "toml 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "num_cpus" -version = "1.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "hermit-abi 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", + "cargo", + "cargo_metadata", + "clap", + "serde", + "serde_cbor", + "serde_derive", + "serde_json", + "tar", + "toml_edit", ] [[package]] name = "opener" -version = "0.4.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ea3ebcd72a54701f56345f16785a6d3ac2df7e986d273eb4395c0b01db17952" dependencies = [ - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "bstr", + "winapi", ] [[package]] name = "openssl" version = "0.10.26" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a3cc5799d98e1088141b8e01ff760112bbd9f19d850c124500566ca6901a585" dependencies = [ - "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.9.53 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags", + "cfg-if 0.1.10", + "foreign-types", + "lazy_static", + "libc", + "openssl-sys", ] [[package]] name = "openssl-probe" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de" [[package]] name = "openssl-src" version = "111.6.1+1.1.1d" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c91b04cb43c1a8a90e934e0cd612e2a5715d976d2d6cff4490278a0cddf35005" dependencies = [ - "cc 1.0.50 (registry+https://github.com/rust-lang/crates.io-index)", + "cc", ] [[package]] name = "openssl-sys" version = "0.9.53" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "465d16ae7fc0e313318f7de5cecf57b2fbe7511fd213978b457e1c96ff46736f" +dependencies = [ + "autocfg 0.1.7", + "cc", + "libc", + "openssl-src", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "os_info" +version = "3.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eca3ecae1481e12c3d9379ec541b238a16f0b75c9a409942daa8ec20dbfdb62" dependencies = [ - "autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "cc 1.0.50 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-src 111.6.1+1.1.1d (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)", - "vcpkg 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "log", + "serde", + "winapi", ] +[[package]] +name = "os_str_bytes" +version = "6.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21326818e99cfe6ce1e524c2a805c189a99b5ae555a35d19f9a284b427d86afa" + [[package]] name = "percent-encoding" version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" [[package]] name = "pkg-config" version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05da548ad6865900e60eaba7f589cc0783590a92e940c26953ff81ddbab2d677" [[package]] name = "ppv-lite86" version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74490b50b9fbe561ac330df47c08f3f33073d2d00c150f719147d7c54522fa1b" [[package]] name = "proc-macro2" -version = "1.0.7" +version = "1.0.39" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c54b25569025b7fc9651de43004ae593a75ad88543b17178aa5e1b9c4f15f56f" dependencies = [ - "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-ident", ] -[[package]] -name = "quick-error" -version = "1.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "quote" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe" dependencies = [ - "proc-macro2 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", ] [[package]] name = "rand" version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" dependencies = [ - "getrandom 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_chacha 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "getrandom", + "libc", + "rand_chacha", + "rand_core 0.5.1", + "rand_hc", ] [[package]] name = "rand_chacha" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03a2a90da8c7523f554344f921aa97283eadf6ac484a6d2a7d0212fa7f8d6853" dependencies = [ - "c2-chacha 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "c2-chacha", + "rand_core 0.5.1", ] [[package]] name = "rand_core" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" dependencies = [ - "getrandom 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", + "getrandom", ] +[[package]] +name = "rand_core" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" + [[package]] name = "rand_hc" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" dependencies = [ - "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.5.1", ] [[package]] name = "rand_xoshiro" -version = "0.4.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f97cdb2a36ed4183de61b2f824cc45c9f1037f28afe0a322e9fff4c108b5aaa" dependencies = [ - "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.6.3", ] [[package]] name = "redox_syscall" version = "0.1.56" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84" + +[[package]] +name = "redox_syscall" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42" +dependencies = [ + "bitflags", +] [[package]] name = "regex" version = "1.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5508c1941e4e7cb19965abef075d35a9a8b5cdf0846f30b4050e9b55dc55e87" dependencies = [ - "aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "thread_local 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "aho-corasick", + "memchr", + "regex-syntax", + "thread_local", ] +[[package]] +name = "regex-automata" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" + [[package]] name = "regex-syntax" version = "0.6.13" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e734e891f5b408a29efbf8309e656876276f49ab6a6ac208600b4419bd893d90" [[package]] name = "remove_dir_all" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a83fa3702a688b9359eccba92d153ac33fd2e8462f9e0e3fdf155239ea7792e" dependencies = [ - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi", ] [[package]] name = "rustc-workspace-hack" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc71d2faa173b74b232dedc235e3ee1696581bb132fc116fa3626d6151a1a8fb" [[package]] name = "rustfix" -version = "0.5.1" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecd2853d9e26988467753bd9912c3a126f642d05d229a4b53f5752ee36c56481" dependencies = [ - "anyhow 1.0.32 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", + "anyhow", + "log", + "serde", + "serde_json", ] [[package]] name = "ryu" -version = "0.2.7" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3f6f92acf49d1b98f7a81226834412ada05458b7364277387724a237f062695" [[package]] name = "same-file" version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" dependencies = [ - "winapi-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-util", ] [[package]] name = "schannel" version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87f550b06b6cba9c8b8be3ee73f391990116bf527450d2556e9b9ce263b9a021" dependencies = [ - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static", + "winapi", ] [[package]] name = "semver" -version = "0.9.0" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a41d061efea015927ac527063765e73601444cdc344ba855bc7bd44578b25e1c" dependencies = [ - "semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", + "serde", ] -[[package]] -name = "semver-parser" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "serde" -version = "1.0.104" +version = "1.0.137" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61ea8d54c77f8315140a05f4c7237403bf38b72704d031543aa1d16abbf517d1" dependencies = [ - "serde_derive 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive", ] [[package]] name = "serde_cbor" version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e18acfa2f90e8b735b2836ab8d538de304cbb6729a7360729ea5a895d15a622" dependencies = [ - "half 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", + "half", + "serde", ] [[package]] name = "serde_derive" -version = "1.0.104" +version = "1.0.137" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f26faba0c3959972377d3b2d306ee9f71faee9714294e41bb777f83f88578be" dependencies = [ - "proc-macro2 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.13 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", + "quote", + "syn", ] [[package]] name = "serde_ignored" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7248fdcbd17d3f2604fc2a02d0ecc844d9a7bf52bf95fc196d9f0a38f6da6a0e" dependencies = [ - "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", + "serde", ] [[package]] name = "serde_json" -version = "1.0.39" +version = "1.0.81" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b7ce2b32a1aed03c558dc61a5cd328f15aff2dbc17daad8fb8af04d2100e15c" dependencies = [ - "itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", + "itoa", + "ryu", + "serde", ] [[package]] name = "shell-escape" version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "170a13e64f2a51b77a45702ba77287f5c6829375b04a69cf2222acd17d0cfab9" [[package]] name = "sized-chunks" -version = "0.5.3" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16d69225bde7a69b235da73377861095455d298f2b970996eec25ddbb42b3d1e" dependencies = [ - "bitmaps 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "typenum 1.11.2 (registry+https://github.com/rust-lang/crates.io-index)", + "bitmaps", + "typenum", ] [[package]] name = "smallvec" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44e59e0c9fa00817912ae6e4e6e3c4fe04455e75699d06eedc7d85917ed8e8f4" [[package]] name = "socket2" -version = "0.3.11" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66d72b759436ae32898a2af0a14218dbf55efde3feeb170eb623637db85ee1e0" dependencies = [ - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", + "winapi", ] [[package]] name = "strip-ansi-escapes" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d63676e2abafa709460982ddc02a3bb586b6d15a49b75c212e06edd3933acee" dependencies = [ - "vte 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "vte", ] [[package]] name = "strsim" -version = "0.8.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "syn" -version = "1.0.13" +version = "1.0.96" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0748dd251e24453cb8717f0354206b91557e4ec8703673a4b30208f2abaf1ebf" dependencies = [ - "proc-macro2 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", + "quote", + "unicode-ident", ] [[package]] name = "tar" -version = "0.4.26" +version = "0.4.38" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b55807c0344e1e6c04d7c965f5289c39a8d94ae23ed5c0b57aabac549f871c6" dependencies = [ - "filetime 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", - "xattr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "filetime", + "libc", + "xattr", ] [[package]] name = "tempfile" version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" dependencies = [ - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", - "remove_dir_all 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.10", + "libc", + "rand", + "redox_syscall 0.1.56", + "remove_dir_all", + "winapi", ] [[package]] name = "termcolor" -version = "1.1.0" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" dependencies = [ - "winapi-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-util", ] [[package]] name = "textwrap" -version = "0.11.0" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "unicode-width 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", -] +checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb" [[package]] name = "thread_local" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14" dependencies = [ - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static", ] [[package]] -name = "toml" -version = "0.5.5" +name = "toml_edit" +version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "744e9ed5b352340aa47ce033716991b5589e23781acb97cad37d4ea70560f55b" dependencies = [ - "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", + "combine", + "indexmap", + "itertools", + "kstring", + "serde", ] [[package]] name = "typenum" -version = "1.11.2" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" [[package]] name = "unicode-bidi" version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" dependencies = [ - "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "matches", ] +[[package]] +name = "unicode-ident" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d22af068fba1eb5edcb4aea19d382b2a3deb4c8f9d475c589b6ada9e0fd493ee" + [[package]] name = "unicode-normalization" version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b561e267b2326bb4cebfc0ef9e68355c7abe6c6f522aeac2f5bf95d56c59bdcf" dependencies = [ - "smallvec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec", ] [[package]] name = "unicode-width" version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "caaa9d531767d1ff2150b9332433f32a24622147e5ebb1f26409d5da67afd479" [[package]] name = "unicode-xid" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" [[package]] name = "url" -version = "2.1.1" +version = "2.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c" dependencies = [ - "idna 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "form_urlencoded", + "idna", + "matches", + "percent-encoding", ] [[package]] name = "utf8parse" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8772a4ccbb4e89959023bc5b7cb8623a795caa7092d99f3aa9501b9484d4557d" [[package]] name = "vcpkg" version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "vec_map" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fc439f2794e98976c88a2a2dafce96b930fe8010b0a256b3c2199a773933168" [[package]] name = "version_check" version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed" [[package]] name = "vte" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f42f536e22f7fcbb407639765c8fd78707a33109301f834a594758bedd6e8cf" dependencies = [ - "utf8parse 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "utf8parse", ] [[package]] name = "walkdir" version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "777182bc735b6424e1a57516d35ed72cb8019d85c8c9bf536dccb3445c1a2f7d" dependencies = [ - "same-file 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "same-file", + "winapi", + "winapi-util", ] [[package]] name = "wasi" version = "0.9.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" [[package]] name = "winapi" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" dependencies = [ - "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", ] [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ccfbf554c6ad11084fb7517daca16cfdcaccbdadba4fc336f032a8b12c2ad80" dependencies = [ - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi", ] [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "xattr" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "244c3741f4240ef46274860397c7c74e50eb23624996930e484c16679633a54c" dependencies = [ - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[metadata] -"checksum adler32 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "5d2e7343e7fc9de883d1b0341e0b13970f764c14101234857d2ddafa1cb1cac2" -"checksum aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "58fb5e95d83b38284460a5fda7d6470aa0b8844d283a0b614b8535e880800d2d" -"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" -"checksum anyhow 1.0.32 (registry+https://github.com/rust-lang/crates.io-index)" = "6b602bfe940d21c130f3895acd65221e8a61270debe89d628b9cb4e3ccb8569b" -"checksum atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -"checksum autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2" -"checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" -"checksum bitmaps 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "031043d04099746d8db04daf1fa424b2bc8bd69d92b25962dcde24da39ab64a2" -"checksum bstr 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)" = "3ede750122d9d1f87919570cb2cccee38c84fbc8c5599b25c289af40625b7030" -"checksum bytesize 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "716960a18f978640f25101b5cbf1c6f6b0d3192fab36a2d98ca96f0ecbe41010" -"checksum c2-chacha 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "214238caa1bf3a496ec3392968969cab8549f96ff30652c9e56885329315f6bb" -"checksum cargo 0.43.1 (registry+https://github.com/rust-lang/crates.io-index)" = "91de5749ddcea3c283a042b67b77e2bdf68f28374cdcbfbe54e91368810d92e5" -"checksum cargo-platform 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0226944a63d1bf35a3b5f948dd7c59e263db83695c9e8bffc4037de02e30f1d7" -"checksum cargo_metadata 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "be1057b8462184f634c3a208ee35b0f935cfd94b694b26deadccd98732088d7b" -"checksum cc 1.0.50 (registry+https://github.com/rust-lang/crates.io-index)" = "95e28fa049fda1c330bcf9d723be7663a899c4679724b34c81e9f5a326aab8cd" -"checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" -"checksum clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9" -"checksum commoncrypto 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d056a8586ba25a1e4d61cb090900e495952c7886786fc55f909ab2f819b69007" -"checksum commoncrypto-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1fed34f46747aa73dfaa578069fd8279d2818ade2b55f38f22a9401c7f4083e2" -"checksum core-foundation 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "57d24c7a13c43e870e37c1556b74555437870a04514f7685f5b354e090567171" -"checksum core-foundation-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b3a71ab494c0b5b860bdc8407ae08978052417070c2ced38573a9157ad75b8ac" -"checksum crates-io 0.31.1 (registry+https://github.com/rust-lang/crates.io-index)" = "09f977948a46e9edf93eb3dc2d7a8dd4ce3105d36de63300befed37cdf051d4a" -"checksum crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1" -"checksum crossbeam-channel 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "acec9a3b0b3559f15aee4f90746c4e5e293b701c0f7d3925d24e01645267b68c" -"checksum crossbeam-utils 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ce446db02cdc3165b94ae73111e570793400d0794e46125cc4056c81cbb039f4" -"checksum crypto-hash 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8a77162240fd97248d19a564a565eb563a3f592b386e4136fb300909e67dddca" -"checksum curl 0.4.25 (registry+https://github.com/rust-lang/crates.io-index)" = "06aa71e9208a54def20792d877bc663d6aae0732b9852e612c4a933177c31283" -"checksum curl-sys 0.4.25 (registry+https://github.com/rust-lang/crates.io-index)" = "0c38ca47d60b86d0cc9d42caa90a0885669c2abc9791f871c81f58cdf39e979b" -"checksum env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" -"checksum filetime 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "1ff6d4dab0aa0c8e6346d46052e93b13a16cf847b54ed357087c35011048cc7d" -"checksum flate2 1.0.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6bd6d6f4752952feb71363cffc9ebac9411b75b87c6ab6058c40c8900cf43c0f" -"checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" -"checksum foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" -"checksum foreign-types-shared 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" -"checksum fs2 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "9564fc758e15025b46aa6643b1b77d047d1a56a1aea6e01002ac0c7026876213" -"checksum fwdansi 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "08c1f5787fe85505d1f7777268db5103d80a7a374d2316a7ce262e57baf8f208" -"checksum getrandom 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb" -"checksum git2 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "77519ef7c5beee314d0804d4534f01e0f9e8d9acdee2b7a48627e590b27e0ec4" -"checksum git2-curl 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d2559abb1d87d27668d31bd868a000f0e2e0065d10e78961b62da95d7a7f1cc7" -"checksum glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" -"checksum globset 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "925aa2cac82d8834e2b2a4415b6f6879757fb5c0928fc445ae76461a12eed8f2" -"checksum half 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9ff54597ea139063f4225f1ec47011b03c9de4a486957ff3fc506881dac951d0" -"checksum hermit-abi 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "eff2656d88f158ce120947499e971d743c05dbcbed62e5bd2f38f1698bbc3772" -"checksum hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "805026a5d0141ffc30abb3be3173848ad46a1b1664fe632428479619a3644d77" -"checksum hex 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "023b39be39e3a2da62a94feb433e91e8bcd37676fbc8bea371daf52b7a769a3e" -"checksum home 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2456aef2e6b6a9784192ae780c0f15bc57df0e918585282325e8c8ac27737654" -"checksum humantime 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f" -"checksum humantime 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3c1ad908cc71012b7bea4d0c53ba96a8cba9962f048fa68d143376143d863b7a" -"checksum idna 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "02e2673c30ee86b5b96a9cb52ad15718aa1f966f5ab9ad54a8b95d5ca33120a9" -"checksum ignore 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "522daefc3b69036f80c7d2990b28ff9e0471c683bad05ca258e0a01dd22c5a1e" -"checksum im-rc 14.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "303f7e6256d546e01979071417432425f15c1891fb309a5f2d724ee908fabd6e" -"checksum itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1306f3464951f30e30d12373d31c79fbd52d236e5e896fd92f96ec7babbbe60b" -"checksum jobserver 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)" = "67b06c1b455f1cf4269a8cfc320ab930a810e2375a42af5075eb8a8b36405ce0" -"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" -"checksum lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f" -"checksum libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)" = "1a31a0627fdf1f6a39ec0dd577e101440b7db22672c0901fe00a9a6fbb5c24e8" -"checksum libgit2-sys 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d9ec6bca50549d34a392611dde775123086acbd994e3fff64954777ce2dc2e51" -"checksum libnghttp2-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "02254d44f4435dd79e695f2c2b83cd06a47919adea30216ceaf0c57ca0a72463" -"checksum libssh2-sys 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "36aa6e813339d3a063292b77091dfbbb6152ff9006a459895fa5bebed7d34f10" -"checksum libz-sys 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)" = "2eb5e43362e38e2bca2fd5f5134c4d4564a23a5c28e9b95411652021a8675ebe" -"checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7" -"checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" -"checksum memchr 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3197e20c7edb283f87c071ddfc7a2cca8f8e0b888c242959846a6fce03c72223" -"checksum miniz_oxide 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6f3f74f726ae935c3f514300cc6773a0c9492abc5e972d42ba0c0ebb88757625" -"checksum miow 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "396aa0f2003d7df8395cb93e09871561ccc3e785f0acb369170e8cc74ddf9226" -"checksum num_cpus 1.11.1 (registry+https://github.com/rust-lang/crates.io-index)" = "76dac5ed2a876980778b8b85f75a71b6cbf0db0b1232ee12f826bccb00d09d72" -"checksum opener 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "13117407ca9d0caf3a0e74f97b490a7e64c0ae3aa90a8b7085544d0c37b6f3ae" -"checksum openssl 0.10.26 (registry+https://github.com/rust-lang/crates.io-index)" = "3a3cc5799d98e1088141b8e01ff760112bbd9f19d850c124500566ca6901a585" -"checksum openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de" -"checksum openssl-src 111.6.1+1.1.1d (registry+https://github.com/rust-lang/crates.io-index)" = "c91b04cb43c1a8a90e934e0cd612e2a5715d976d2d6cff4490278a0cddf35005" -"checksum openssl-sys 0.9.53 (registry+https://github.com/rust-lang/crates.io-index)" = "465d16ae7fc0e313318f7de5cecf57b2fbe7511fd213978b457e1c96ff46736f" -"checksum percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" -"checksum pkg-config 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)" = "05da548ad6865900e60eaba7f589cc0783590a92e940c26953ff81ddbab2d677" -"checksum ppv-lite86 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "74490b50b9fbe561ac330df47c08f3f33073d2d00c150f719147d7c54522fa1b" -"checksum proc-macro2 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "0319972dcae462681daf4da1adeeaa066e3ebd29c69be96c6abb1259d2ee2bcc" -"checksum quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" -"checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe" -"checksum rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" -"checksum rand_chacha 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "03a2a90da8c7523f554344f921aa97283eadf6ac484a6d2a7d0212fa7f8d6853" -"checksum rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" -"checksum rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" -"checksum rand_xoshiro 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a9fcdd2e881d02f1d9390ae47ad8e5696a9e4be7b547a1da2afbc61973217004" -"checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84" -"checksum regex 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b5508c1941e4e7cb19965abef075d35a9a8b5cdf0846f30b4050e9b55dc55e87" -"checksum regex-syntax 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "e734e891f5b408a29efbf8309e656876276f49ab6a6ac208600b4419bd893d90" -"checksum remove_dir_all 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4a83fa3702a688b9359eccba92d153ac33fd2e8462f9e0e3fdf155239ea7792e" -"checksum rustc-workspace-hack 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc71d2faa173b74b232dedc235e3ee1696581bb132fc116fa3626d6151a1a8fb" -"checksum rustfix 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f2c50b74badcddeb8f7652fa8323ce440b95286f8e4b64ebfd871c609672704e" -"checksum ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "eb9e9b8cde282a9fe6a42dd4681319bfb63f121b8a8ee9439c6f4107e58a46f7" -"checksum same-file 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" -"checksum schannel 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "87f550b06b6cba9c8b8be3ee73f391990116bf527450d2556e9b9ce263b9a021" -"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" -"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" -"checksum serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)" = "414115f25f818d7dfccec8ee535d76949ae78584fc4f79a6f45a904bf8ab4449" -"checksum serde_cbor 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1e18acfa2f90e8b735b2836ab8d538de304cbb6729a7360729ea5a895d15a622" -"checksum serde_derive 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)" = "128f9e303a5a29922045a830221b8f78ec74a5f544944f3d5984f8ec3895ef64" -"checksum serde_ignored 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7248fdcbd17d3f2604fc2a02d0ecc844d9a7bf52bf95fc196d9f0a38f6da6a0e" -"checksum serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)" = "5a23aa71d4a4d43fdbfaac00eff68ba8a06a51759a89ac3304323e800c4dd40d" -"checksum shell-escape 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "170a13e64f2a51b77a45702ba77287f5c6829375b04a69cf2222acd17d0cfab9" -"checksum sized-chunks 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d59044ea371ad781ff976f7b06480b9f0180e834eda94114f2afb4afc12b7718" -"checksum smallvec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "44e59e0c9fa00817912ae6e4e6e3c4fe04455e75699d06eedc7d85917ed8e8f4" -"checksum socket2 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)" = "e8b74de517221a2cb01a53349cf54182acdc31a074727d3079068448c0676d85" -"checksum strip-ansi-escapes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9d63676e2abafa709460982ddc02a3bb586b6d15a49b75c212e06edd3933acee" -"checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" -"checksum syn 1.0.13 (registry+https://github.com/rust-lang/crates.io-index)" = "1e4ff033220a41d1a57d8125eab57bf5263783dfdcc18688b1dacc6ce9651ef8" -"checksum tar 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)" = "b3196bfbffbba3e57481b6ea32249fbaf590396a52505a2615adbb79d9d826d3" -"checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" -"checksum termcolor 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb6bfa289a4d7c5766392812c0a1f4c1ba45afa1ad47803c11e1f407d846d75f" -"checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" -"checksum thread_local 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14" -"checksum toml 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "01d1404644c8b12b16bfcffa4322403a91a451584daaaa7c28d3152e6cbc98cf" -"checksum typenum 1.11.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6d2783fe2d6b8c1101136184eb41be8b1ad379e4657050b8aaff0c79ee7575f9" -"checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" -"checksum unicode-normalization 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "b561e267b2326bb4cebfc0ef9e68355c7abe6c6f522aeac2f5bf95d56c59bdcf" -"checksum unicode-width 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "caaa9d531767d1ff2150b9332433f32a24622147e5ebb1f26409d5da67afd479" -"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" -"checksum url 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "829d4a8476c35c9bf0bbce5a3b23f4106f79728039b726d292bb93bc106787cb" -"checksum utf8parse 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8772a4ccbb4e89959023bc5b7cb8623a795caa7092d99f3aa9501b9484d4557d" -"checksum vcpkg 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3fc439f2794e98976c88a2a2dafce96b930fe8010b0a256b3c2199a773933168" -"checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" -"checksum version_check 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed" -"checksum vte 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4f42f536e22f7fcbb407639765c8fd78707a33109301f834a594758bedd6e8cf" -"checksum walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "777182bc735b6424e1a57516d35ed72cb8019d85c8c9bf536dccb3445c1a2f7d" -"checksum wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)" = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" -"checksum winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6" -"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" -"checksum winapi-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4ccfbf554c6ad11084fb7517daca16cfdcaccbdadba4fc336f032a8b12c2ad80" -"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -"checksum xattr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "244c3741f4240ef46274860397c7c74e50eb23624996930e484c16679633a54c" + "libc", +] diff --git a/Cargo.toml b/Cargo.toml index 96b5c5d..b38a295 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,16 +5,19 @@ authors = ["Joshua Gancher "] repository = "https://github.com/GaloisInc/mir-json.git" license = "MIT/Apache-2.0" +[package.metadata.rust-analyzer] +rustc_private=true + [dependencies] serde = "1.0" serde_derive = "1.0" serde_json = "1.0" serde_cbor = "0.11" tar = "0.4" -cargo_metadata = { version = "0.2" } -cargo = { version = "0.43", features = [ "vendored-openssl" ] } -toml = "0.5" -clap = "2.33" +cargo_metadata = { version = "0.14.2" } +cargo = { version = "0.62", features = [ "vendored-openssl" ] } +toml_edit = { version = "0.13.4", features = [ "easy" ] } +clap = "3.1.0" [[bin]] name = "cargo-crux-test" diff --git a/README.md b/README.md index 8b8ce01..e7ca6e4 100644 --- a/README.md +++ b/README.md @@ -15,9 +15,9 @@ book](https://doc.rust-lang.org/book/2018-edition/ch01-01-installation.html)). 2. Next, install a version of `rustc` that works with mir-json. - $ rustup toolchain install nightly-2020-03-22 --force - $ rustup component add --toolchain nightly-2020-03-22 rustc-dev - $ rustup default nightly-2020-03-22 + $ rustup toolchain install nightly-2023-01-23 --force + $ rustup component add --toolchain nightly-2023-01-23 rustc-dev + $ rustup default nightly-2023-01-23 diff --git a/build.rs b/build.rs new file mode 100644 index 0000000..ef32190 --- /dev/null +++ b/build.rs @@ -0,0 +1,15 @@ +use std::path::Path; +use std::process::Command; +use std::str; + +fn main() { + // Add the toolchain lib/ directory to `-L`. This fixes the linker error "cannot find + // -lLLVM-13-rust-1.60.0-nightly". + let out = Command::new("rustup") + .args(&["which", "rustc"]) + .output().unwrap(); + assert!(out.status.success()); + let rustc_path = Path::new(str::from_utf8(&out.stdout).unwrap().trim_end()); + let lib_dir = rustc_path.parent().unwrap().parent().unwrap().join("lib"); + println!("cargo:rustc-link-search={}", lib_dir.display()); +} diff --git a/doc/rustc.md b/doc/rustc.md index d1c93ec..863cdf9 100644 --- a/doc/rustc.md +++ b/doc/rustc.md @@ -72,7 +72,7 @@ internal environment variables, which most users will not need to care about: overrides should be used. * `EXPORT_ALL`: If this environment variable is set, then the MIR JSON file will export all top-level functions. Otherwise, it will only export those - functions with a `#[crux_test]` attribute. + functions with a `#[crux::test]` attribute. ## Other binaries @@ -125,7 +125,7 @@ in the following ways: representation required by the `crux-mir` backend. * Miscellaneous: `has_attr` for identifying symbolic tests (marked with the - `#[crux_test]` attribute); `all_crate_nums` and related queries to identify + `#[crux::test]` attribute); `all_crate_nums` and related queries to identify dependencies; `output_filenames` to get the path of the normal `rustc` output (`mir-json` stores the `.mir` files it generates alongside the normal `.rlib` library output). diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 0000000..35f3e1c --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,2 @@ +[toolchain] +channel = "nightly-2023-01-23" \ No newline at end of file diff --git a/src/analyz/mod.rs b/src/analyz/mod.rs index 7766bd1..dbaef1d 100644 --- a/src/analyz/mod.rs +++ b/src/analyz/mod.rs @@ -1,20 +1,19 @@ #![macro_use] -use rustc::ty::{self, TyCtxt, List}; -use rustc::mir::{self, Body}; -use rustc_ast::{ast, token, tokenstream, visit}; +use rustc_ast::{ast, token, tokenstream, visit, ptr, Crate}; use rustc_hir::def::DefKind; -use rustc_hir::def_id::{self, DefId, LOCAL_CRATE}; -use rustc::mir::mono::MonoItem; -use rustc_session::config::OutputType; -use rustc_session; +use rustc_hir::def_id::{DefId, LOCAL_CRATE}; use rustc_index::vec::Idx; use rustc_interface::Queries; -use rustc_mir::monomorphize::collector::{self, MonoItemCollectionMode}; -use rustc_target::spec::abi; -use rustc_session::Session; -use rustc_span::symbol::Symbol; +use rustc_middle::ty::{self, TyCtxt, List}; +use rustc_middle::mir::{self, Body}; +use rustc_middle::mir::mono::MonoItem; +use rustc_session::{self, Session}; +use rustc_session::config::OutputType; use rustc_span::Span; +use rustc_span::symbol::{Symbol, Ident}; +use rustc_target::abi; +use rustc_target::spec; use std::cell::RefCell; use std::collections::HashMap; use std::fmt::Write as FmtWrite; @@ -39,7 +38,7 @@ basic_json_enum_impl!(mir::BinOp); basic_json_enum_impl!(mir::NullOp); basic_json_enum_impl!(mir::UnOp); -impl<'tcx> ToJson<'tcx> for ty::layout::VariantIdx { +impl<'tcx> ToJson<'tcx> for abi::VariantIdx { fn to_json(&self, _: &mut MirState) -> serde_json::Value { self.as_usize().into() } @@ -94,12 +93,12 @@ fn vtable_descriptor_for_cast<'tcx>( } // Relevant code: rustc_codegen_ssa::base::unsized_info, and other functions in that file. - let old_pointee = match old_ty.kind { + let old_pointee = match *old_ty.kind() { ty::TyKind::Ref(_, ty, _) => ty, ty::TyKind::RawPtr(ref tm) => tm.ty, _ => return None, }; - let new_pointee = match new_ty.kind { + let new_pointee = match *new_ty.kind() { ty::TyKind::Ref(_, ty, _) => ty, ty::TyKind::RawPtr(ref tm) => tm.ty, _ => return None, @@ -111,8 +110,8 @@ fn vtable_descriptor_for_cast<'tcx>( } // Relevant code: rustc_codegen_ssa::meth::get_vtable - let trait_ref = match new_pointee.kind { - ty::TyKind::Dynamic(ref preds, _) => + let trait_ref = match *new_pointee.kind() { + ty::TyKind::Dynamic(ref preds, _, _) => preds.principal().map(|pred| pred.with_self_ty(tcx, old_pointee)), _ => return None, }; @@ -139,7 +138,7 @@ impl<'tcx> ToJson<'tcx> for mir::Rvalue<'tcx> { json!({ "kind": "Repeat", "op": op.to_json(mir), - "len": s + "len": get_const_usize(mir.state.tcx, s) }) } &mir::Rvalue::Ref(_, ref bk, ref l) => { @@ -150,6 +149,13 @@ impl<'tcx> ToJson<'tcx> for mir::Rvalue<'tcx> { "refvar": l.to_json(mir) }) } + &mir::Rvalue::ThreadLocalRef(did) => { + json!({ + "kind": "ThreadLocalRef", + "def_id": did.to_json(mir), + "ty": mir.state.tcx.static_ptr_ty(did).to_json(mir), + }) + } &mir::Rvalue::AddressOf(mutbl, ref l) => { json!({ "kind": "AddressOf", @@ -160,7 +166,7 @@ impl<'tcx> ToJson<'tcx> for mir::Rvalue<'tcx> { &mir::Rvalue::Len(ref l) => { json!({"kind": "Len", "lv": l.to_json(mir)}) } - &mir::Rvalue::Cast(ref ck, ref op, ref ty) => { + &mir::Rvalue::Cast(ref ck, ref op, ty) => { let mut j = json!({ "kind": "Cast", "type": ck.to_json(mir), @@ -178,20 +184,20 @@ impl<'tcx> ToJson<'tcx> for mir::Rvalue<'tcx> { } j } - &mir::Rvalue::BinaryOp(ref binop, ref op1, ref op2) => { + &mir::Rvalue::BinaryOp(ref binop, ref ops) => { json!({ "kind": "BinaryOp", "op": binop.to_json(mir), - "L": op1.to_json(mir), - "R": op2.to_json(mir) + "L": ops.0.to_json(mir), + "R": ops.1.to_json(mir) }) } - &mir::Rvalue::CheckedBinaryOp(ref binop, ref op1, ref op2) => { + &mir::Rvalue::CheckedBinaryOp(ref binop, ref ops) => { json!({ "kind": "CheckedBinaryOp", "op": binop.to_json(mir), - "L": op1.to_json(mir), - "R": op2.to_json(mir) + "L": ops.0.to_json(mir), + "R": ops.1.to_json(mir) }) } &mir::Rvalue::NullaryOp(ref no, ref t) => { @@ -209,7 +215,14 @@ impl<'tcx> ToJson<'tcx> for mir::Rvalue<'tcx> { }) } &mir::Rvalue::Discriminant(ref lv) => { - json!({"kind": "Discriminant", "val": lv.to_json(mir)}) + json!({ + "kind": "Discriminant", + "val": lv.to_json(mir), + "ty": lv.ty(mir.mir.unwrap(), mir.state.tcx) + .ty + .discriminant_ty(mir.state.tcx) + .to_json(mir), + }) } &mir::Rvalue::Aggregate(ref ak, ref opv) => { if ty_json::is_adt_ak(ak) { @@ -225,6 +238,19 @@ impl<'tcx> ToJson<'tcx> for mir::Rvalue<'tcx> { }) } } + &mir::Rvalue::ShallowInitBox(ref op, ty) => { + json!({ + "kind": "ShallowInitBox", + "ptr": op.to_json(mir), + "ty": ty.to_json(mir) + }) + } + &mir::Rvalue::CopyForDeref(ref l) => { + json!({ + "kind": "CopyForDeref", + "place": l.to_json(mir) + }) + } } } } @@ -277,6 +303,9 @@ impl<'tcx> ToJson<'tcx> for mir::PlaceElem<'tcx> { &mir::ProjectionElem::Downcast(ref _adt, ref variant) => { json!({"kind": "Downcast", "variant": variant.to_json(mir)}) } + &mir::ProjectionElem::OpaqueCast(ref ty) => { + json!({"kind": "OpaqueCast", "variant": ty.to_json(mir) }) + } } } } @@ -309,7 +338,7 @@ impl<'tcx> ToJson<'tcx> for mir::Operand<'tcx> { impl<'tcx> ToJson<'tcx> for mir::Constant<'tcx> { fn to_json(&self, mir: &mut MirState<'_, 'tcx>) -> serde_json::Value { - self.literal.to_json(mir) + (eval_mir_constant(mir.state.tcx, self), self.ty()).to_json(mir) } } @@ -340,6 +369,10 @@ impl<'tcx> ToJson<'tcx> for mir::Statement<'tcx> { // TODO json!({"kind": "FakeRead"}) } + &mir::StatementKind::Deinit { .. } => { + // TODO + json!({"kind": "Deinit"}) + } &mir::StatementKind::SetDiscriminant { ref place, ref variant_index, @@ -356,10 +389,6 @@ impl<'tcx> ToJson<'tcx> for mir::Statement<'tcx> { &mir::StatementKind::StorageDead(l) => { json!({"kind": "StorageDead", "sdvar": local_json(mir, l)}) } - &mir::StatementKind::InlineAsm { .. } => { - // TODO - json!({"kind": "InlineAsm"}) - } &mir::StatementKind::Retag { .. } => { // TODO json!({"kind": "Retag"}) @@ -368,9 +397,33 @@ impl<'tcx> ToJson<'tcx> for mir::Statement<'tcx> { // TODO json!({"kind": "AscribeUserType"}) } + &mir::StatementKind::Coverage { .. } => { + // TODO + json!({"kind": "Coverage"}) + } &mir::StatementKind::Nop => { json!({"kind": "Nop"}) } + &mir::StatementKind::Intrinsic(ref ndi) => { + match **ndi { + mir::NonDivergingIntrinsic::Assume(ref a) => + json!({ + "kind": "Intrinsic", + "intrinsic_kind": "Assume", + "operand": a.to_json(mir), + }), + mir::NonDivergingIntrinsic::CopyNonOverlapping(ref cno) => + json!({ + "kind": "Intrinsic", + "intrinsic_kind": "CopyNonOverlapping", + "src": cno.src.to_json(mir), + "dst": cno.dst.to_json(mir), + "count": cno.count.to_json(mir), + }) + } + // TODO + //json!({"kind": "Intrinsic" }) + } }; j["pos"] = self.source_info.span.to_json(mir); j @@ -387,12 +440,13 @@ impl ToJson<'_> for Span { let source_map = mir.state.session.source_map(); let callsite = self.source_callsite(); let s = if callsite == *self { - source_map.span_to_string(*self) + // Use `span_to_diagnostic_string` to get a string with full file paths. + source_map.span_to_diagnostic_string(*self) } else { format!( "{} !{}", - source_map.span_to_string(*self), - source_map.span_to_string(callsite), + source_map.span_to_diagnostic_string(*self), + source_map.span_to_diagnostic_string(callsite), ) }; s.into() @@ -407,12 +461,10 @@ impl<'tcx> ToJson<'tcx> for mir::Terminator<'tcx> { } &mir::TerminatorKind::SwitchInt { ref discr, - ref switch_ty, - ref values, ref targets, } => { let vals: Vec = - values.iter().map(|&c| c.to_string()).collect(); + targets.iter().map(|(c, _)| c.to_string()).collect(); let discr_span = mir.match_span_map.get(&self.source_info.span).cloned() .or_else(|| operand_span(mir, discr)) .unwrap_or(self.source_info.span); @@ -420,9 +472,10 @@ impl<'tcx> ToJson<'tcx> for mir::Terminator<'tcx> { "kind": "SwitchInt", "discr": discr.to_json(mir), "discr_span": discr_span.to_json(mir), - "switch_ty": switch_ty.to_json(mir), "values": vals, - "targets": targets.to_json(mir) + "targets": targets.all_targets().iter().map(|x| x.to_json(mir)) + .collect::>(), + "switch_ty": discr.ty(mir.mir.unwrap(), mir.state.tcx).to_json(mir) }) } &mir::TerminatorKind::Resume => { @@ -435,7 +488,7 @@ impl<'tcx> ToJson<'tcx> for mir::Terminator<'tcx> { json!({"kind": "Unreachable"}) } &mir::TerminatorKind::Drop { - ref location, + place: ref location, ref target, ref unwind, } => { @@ -449,7 +502,7 @@ impl<'tcx> ToJson<'tcx> for mir::Terminator<'tcx> { }) } &mir::TerminatorKind::DropAndReplace { - ref location, + place: ref location, ref value, ref target, ref unwind, @@ -467,15 +520,23 @@ impl<'tcx> ToJson<'tcx> for mir::Terminator<'tcx> { &mir::TerminatorKind::Call { ref func, ref args, - ref destination, + destination: ref dest_place, + target: ref dest_block, ref cleanup, - ref from_hir_call + ref from_hir_call, + fn_span: _, } => { + let destination = dest_block.as_ref().map(|dest_block| { + json!([ + dest_place.to_json(mir), + dest_block.to_json(mir), + ]) + }); json!({ "kind": "Call", "func": func.to_json(mir), "args": args.to_json(mir), - "destination": destination.to_json(mir), + "destination": destination, "cleanup": cleanup.to_json(mir), "from_hir_call": from_hir_call }) @@ -505,10 +566,10 @@ impl<'tcx> ToJson<'tcx> for mir::Terminator<'tcx> { "kind": "Yield" }) } - &mir::TerminatorKind::FalseEdges { .. } => { + &mir::TerminatorKind::FalseEdge { .. } => { // TODO json!({ - "kind": "FalseEdges" + "kind": "FalseEdge" }) } &mir::TerminatorKind::FalseUnwind { .. } => { @@ -520,6 +581,10 @@ impl<'tcx> ToJson<'tcx> for mir::Terminator<'tcx> { &mir::TerminatorKind::GeneratorDrop => { json!({ "kind": "GeneratorDrop" }) } + &mir::TerminatorKind::InlineAsm { .. } => { + // TODO + json!({"kind": "InlineAsm"}) + } }; j["pos"] = self.source_info.span.to_json(mir); j @@ -560,7 +625,7 @@ fn mir_body( } let mut blocks = Vec::new(); - for bb in mir.basic_blocks().indices() { + for bb in mir.basic_blocks.indices() { blocks.push( json!({ "blockid": bb.to_json(ms), @@ -582,7 +647,7 @@ fn emit_trait<'tcx>( ) -> io::Result<()> { let tcx = ms.state.tcx; let methods = if let Some(tref) = ti.concrete_trait_ref(tcx) { - tcx.vtable_methods(ty::Binder::dummy(tref)) + tcx.vtable_entries(ty::Binder::dummy(tref)) } else { &[] }; @@ -591,12 +656,12 @@ fn emit_trait<'tcx>( // `m` is `None` for methods with `where Self: Sized`. We omit these from the vtable, and // adjust `InstanceDef::Virtual` indices accordingly. let (def_id, substs) = match m { - Some(x) => x, - None => continue, + ty::vtable::VtblEntry::Method(inst) => (inst.def.def_id(), inst.substs), + _ => continue, }; let sig = tcx.subst_and_normalize_erasing_regions( - substs, ty::ParamEnv::reveal_all(), &tcx.fn_sig(def_id)); - let sig = tcx.erase_late_bound_regions(&sig); + substs, ty::ParamEnv::reveal_all(), tcx.fn_sig(def_id)); + let sig = tcx.erase_late_bound_regions(sig); items.push(json!({ "kind": "Method", @@ -612,20 +677,21 @@ fn emit_trait<'tcx>( "name": trait_inst_id_str(ms.state.tcx, &ti), "items": items, }))?; - emit_new_types(ms, out)?; + emit_new_defs(ms, out)?; Ok(()) } /// Emit all statics defined in the current crate. fn emit_statics(ms: &mut MirState, out: &mut impl JsonOutput) -> io::Result<()> { - let tcx = ms.state.tcx; - let (mono_items, _) = collector::collect_crate_mono_items(tcx, MonoItemCollectionMode::Lazy); - for mono_item in mono_items { - match mono_item { - MonoItem::Static(def_id) => emit_static(ms, out, def_id)?, - MonoItem::Fn(_) | - MonoItem::GlobalAsm(_) => {}, + let (_, cgus) = ms.state.tcx.collect_and_partition_mono_items(()); + for cgu in cgus { + for mono_item in cgu.items().keys() { + match *mono_item { + MonoItem::Static(def_id) => emit_static(ms, out, def_id)?, + MonoItem::Fn(_) | + MonoItem::GlobalAsm(_) => {}, + } } } Ok(()) @@ -635,7 +701,8 @@ fn emit_static(ms: &mut MirState, out: &mut impl JsonOutput, def_id: DefId) -> i let tcx = ms.state.tcx; let name = def_id_str(tcx, def_id); - let mir = tcx.optimized_mir(def_id); + // let mir = tcx.optimized_mir(def_id); + let mir = tcx.mir_for_ctfe(def_id); emit_fn(ms, out, &name, None, mir)?; emit_static_decl(ms, out, &name, mir.return_ty(), tcx.is_mutable_static(def_id))?; @@ -658,14 +725,32 @@ fn emit_static_decl<'tcx>( "name": name, "ty": ty.to_json(ms), "mutable": mutable, + "kind": "body", }); out.emit(EntryKind::Static, j)?; - emit_new_types(ms, out) + emit_new_defs(ms, out) } fn has_test_attr(tcx: TyCtxt, def_id: DefId) -> bool { - def_id.is_local() && tcx.has_attr(def_id, Symbol::intern("crux_test")) + if !def_id.is_local() { + return false; + } + + let crux = Symbol::intern("crux"); + let test = Symbol::intern("test"); + for attr in tcx.get_attrs_unchecked(def_id) { + match &attr.kind { + rustc_ast::AttrKind::Normal(na) => { + let segs = &na.item.path.segments; + if segs.len() == 2 && segs[0].ident.name == crux && segs[1].ident.name == test { + return true; + } + } + _ => { } + } + } + return false; } /// Process the initial/root instances in the current crate. This adds entries to `ms.used`, and @@ -683,13 +768,14 @@ fn init_instances(ms: &mut MirState, out: &mut impl JsonOutput) -> io::Result<() /// Add every `MonoItem::Fn` to `ms.used.instances`. fn init_instances_from_mono_items(ms: &mut MirState) -> io::Result<()> { - let tcx = ms.state.tcx; - let (mono_items, _) = collector::collect_crate_mono_items(tcx, MonoItemCollectionMode::Lazy); - for mono_item in mono_items { - match mono_item { - MonoItem::Fn(inst) => ms.used.instances.insert(inst), - MonoItem::Static(_) | - MonoItem::GlobalAsm(_) => {}, + let (_, cgus) = ms.state.tcx.collect_and_partition_mono_items(()); + for cgu in cgus { + for mono_item in cgu.items().keys() { + match *mono_item { + MonoItem::Fn(inst) => ms.used.instances.insert(inst), + MonoItem::Static(_) | + MonoItem::GlobalAsm(_) => {}, + } } } Ok(()) @@ -698,12 +784,13 @@ fn init_instances_from_mono_items(ms: &mut MirState) -> io::Result<()> { /// Initialize the set of needed instances. Returns a list of root instances. fn init_instances_from_tests(ms: &mut MirState, out: &mut impl JsonOutput) -> io::Result<()> { let tcx = ms.state.tcx; - for &def_id in tcx.mir_keys(def_id::LOCAL_CRATE) { + for &local_def_id in tcx.mir_keys(()) { + let def_id = local_def_id.to_def_id(); if ms.export_style == ExportStyle::ExportCruxTests && !has_test_attr(tcx, def_id) { continue; } - if tcx.def_kind(def_id) != Some(DefKind::Fn) { + if !([DefKind::Fn, DefKind::AnonConst].contains(&tcx.def_kind(def_id))) { tcx.sess.span_err( tcx.def_span(def_id), "#[test] can only be applied to functions", @@ -719,8 +806,11 @@ fn init_instances_from_tests(ms: &mut MirState, out: &mut impl JsonOutput) -> io } let inst = ty::Instance::resolve(tcx, ty::ParamEnv::reveal_all(), def_id, List::empty()) - .unwrap_or_else(|| { + .unwrap_or_else(|_| { panic!("Instance::resolve failed to find test function {:?}?", def_id); + }) + .unwrap_or_else(|| { + panic!("ambiguous Instance::resolve for find test function {:?}?", def_id); }); ms.used.instances.insert(inst); @@ -747,11 +837,12 @@ fn emit_instance<'tcx>( "name": &name, "inst": inst.to_json(ms), }))?; - emit_new_types(ms, out)?; + emit_new_defs(ms, out)?; match inst.def { ty::InstanceDef::Item(def_id) => { // Foreign items and non-generics have no MIR available. + let def_id = def_id.did; if tcx.is_foreign_item(def_id) { return Ok(()); } @@ -776,14 +867,15 @@ fn emit_instance<'tcx>( // Look up and monomorphize the MIR for this instance. let mir = tcx.instance_mir(inst.def); let mir: Body = tcx.subst_and_normalize_erasing_regions( - inst.substs, ty::ParamEnv::reveal_all(), &mir as &Body); - let mir = tcx.arena.alloc(mir::BodyAndCache::new(mir)); + inst.substs, ty::ParamEnv::reveal_all(), mir.clone()); + let mir = tcx.arena.alloc(mir); emit_fn(ms, out, &name, Some(inst), mir)?; if let ty::InstanceDef::Item(def_id) = inst.def { + let def_id = def_id.did; for (idx, mir) in tcx.promoted_mir(def_id).iter_enumerated() { let mir = tcx.subst_and_normalize_erasing_regions( - inst.substs, ty::ParamEnv::reveal_all(), mir); + inst.substs, ty::ParamEnv::reveal_all(), mir.clone()); let mir = tcx.arena.alloc(mir); emit_promoted(ms, out, &name, idx, mir)?; } @@ -809,15 +901,16 @@ fn emit_promoted<'tcx>( fn emit_vtable<'tcx>( ms: &mut MirState<'_, 'tcx>, out: &mut impl JsonOutput, - trait_ref: ty::PolyTraitRef<'tcx>, + poly_trait_ref: ty::PolyTraitRef<'tcx>, ) -> io::Result<()> { - let ti = TraitInst::from_trait_ref(ms.state.tcx, *trait_ref.skip_binder()); + let trait_ref = ms.state.tcx.erase_late_bound_regions(poly_trait_ref); + let ti = TraitInst::from_trait_ref(ms.state.tcx, trait_ref); out.emit(EntryKind::Vtable, json!({ "trait_id": trait_inst_id_str(ms.state.tcx, &ti), - "name": vtable_name(ms, trait_ref), - "items": build_vtable_items(ms, trait_ref), + "name": vtable_name(ms, poly_trait_ref), + "items": build_vtable_items(ms, poly_trait_ref), }))?; - emit_new_types(ms, out) + emit_new_defs(ms, out) } fn vtable_name<'tcx>( @@ -832,15 +925,15 @@ fn build_vtable_items<'tcx>( trait_ref: ty::PolyTraitRef<'tcx>, ) -> serde_json::Value { let tcx = mir.state.tcx; - let methods = tcx.vtable_methods(trait_ref); + let methods = tcx.vtable_entries(trait_ref); let mut parts = Vec::with_capacity(methods.len()); for &m in methods { // `m` is `None` for methods with `where Self: Sized`. We omit these from the vtable, and // adjust `InstanceDef::Virtual` indices accordingly. let (def_id, substs) = match m { - Some(x) => x, - None => continue, + ty::vtable::VtblEntry::Method(inst) => (inst.def.def_id(), inst.substs), + _ => continue, }; parts.push(json!({ "item_id": def_id.to_json(mir), @@ -863,7 +956,7 @@ fn emit_adt<'tcx>( tcx.sess.note_without_error( format!("Emitting ADT definition for {}", adt_name).as_str()); out.emit(EntryKind::Adt, ai.to_json(ms))?; - emit_new_types(ms, out)?; + emit_new_defs(ms, out)?; Ok(()) } @@ -884,11 +977,12 @@ fn emit_fn<'tcx>( state: ms.state, tys: ms.tys, match_span_map: ms.match_span_map, + allocs: ms.allocs, export_style: ms.export_style, }; let ms = &mut ms; - let abi = inst.map(|i| inst_abi(ms.state.tcx, i)).unwrap_or(abi::Abi::Rust); + let abi = inst.map(|i| inst_abi(ms.state.tcx, i)).unwrap_or(spec::abi::Abi::Rust); out.emit(EntryKind::Fn, json!({ "name": &name, @@ -898,16 +992,19 @@ fn emit_fn<'tcx>( "abi": abi.to_json(ms), "spread_arg": mir.spread_arg.map(|x| x.as_usize()), }))?; - emit_new_types(ms, out) + emit_new_defs(ms, out) } -fn emit_new_types( +fn emit_new_defs( ms: &mut MirState, out: &mut impl JsonOutput, ) -> io::Result<()> { for j in ms.tys.take_new_types() { out.emit(EntryKind::Ty, j)?; } + for j in ms.allocs.take_new_allocs() { + out.emit(EntryKind::Static, j)?; + } assert!(ms.tys.take_new_types().is_empty()); Ok(()) } @@ -915,20 +1012,21 @@ fn emit_new_types( fn inst_abi<'tcx>( tcx: TyCtxt<'tcx>, inst: ty::Instance<'tcx>, -) -> abi::Abi { +) -> spec::abi::Abi { match inst.def { ty::InstanceDef::Item(def_id) => { + let def_id = def_id.did; let ty = tcx.type_of(def_id); - match ty.kind { + match *ty.kind() { ty::TyKind::FnDef(_, _) => ty.fn_sig(tcx).skip_binder().abi, - ty::TyKind::Closure(_, _) => abi::Abi::RustCall, - _ => abi::Abi::Rust, + ty::TyKind::Closure(_, _) => spec::abi::Abi::RustCall, + _ => spec::abi::Abi::Rust, } }, - ty::InstanceDef::Intrinsic(_) => abi::Abi::RustIntrinsic, - ty::InstanceDef::ClosureOnceShim { .. } => abi::Abi::RustCall, - _ => abi::Abi::Rust, + ty::InstanceDef::Intrinsic(_) => spec::abi::Abi::RustIntrinsic, + ty::InstanceDef::ClosureOnceShim { .. } => spec::abi::Abi::RustCall, + _ => spec::abi::Abi::Rust, } } @@ -952,21 +1050,21 @@ fn analyze_inner<'tcx, O: JsonOutput, F: FnOnce(&Path) -> io::Result>( let mut mir_path = None; let mut extern_mir_paths = Vec::new(); - let output = queries.global_ctxt().unwrap().peek_mut().enter(|tcx| -> io::Result<_> { - let outputs = tcx.output_filenames(LOCAL_CRATE); + let output = queries.global_ctxt().unwrap().enter(|tcx| -> io::Result<_> { + let outputs = tcx.output_filenames(()); if !outputs.outputs.contains_key(&OutputType::Exe) { return Ok(None); } let mir_path_ = rustc_session::output::out_filename( sess, - sess.crate_types.get().first().unwrap().clone(), + sess.crate_types().first().unwrap().clone(), &outputs, - &tcx.crate_name.to_string(), + tcx.crate_name(LOCAL_CRATE), ).with_extension("mir"); let mut out = mk_output(&mir_path_)?; mir_path = Some(mir_path_); - for &cnum in tcx.all_crate_nums(LOCAL_CRATE) { + for &cnum in tcx.crates(()) { let src = tcx.used_crate_source(cnum); let it = src.dylib.iter() .chain(src.rlib.iter()) @@ -985,6 +1083,7 @@ fn analyze_inner<'tcx, O: JsonOutput, F: FnOnce(&Path) -> io::Result>( let mut used = Used::default(); let mut tys = TyIntern::default(); + let mut allocs = AllocIntern::default(); let state = CompileState { session: sess, tcx, @@ -995,6 +1094,7 @@ fn analyze_inner<'tcx, O: JsonOutput, F: FnOnce(&Path) -> io::Result>( state: &state, tys: &mut tys, match_span_map: &get_match_spans(), + allocs: &mut allocs, export_style: export_style, }; @@ -1022,7 +1122,7 @@ fn analyze_inner<'tcx, O: JsonOutput, F: FnOnce(&Path) -> io::Result>( // Any referenced types should normally be emitted immediately after the entry that // references them, but we check again here just in case. - emit_new_types(&mut ms, &mut out)?; + emit_new_defs(&mut ms, &mut out)?; Ok(Some(out)) })?; @@ -1087,19 +1187,25 @@ pub use analyz::to_json::ExportStyle; fn make_attr(key: &str, value: &str) -> ast::Attribute { ast::Attribute { - kind: ast::AttrKind::Normal(ast::AttrItem { - path: ast::Path::from_ident(ast::Ident::from_str(key)), - args: ast::MacArgs::Delimited( - tokenstream::DelimSpan::dummy(), - ast::MacDelimiter::Parenthesis, - iter::once( - tokenstream::TokenTree::token( - token::TokenKind::Ident(ast::Name::intern(value), false), - Span::default(), - ), - ).collect(), - ), - }), + kind: ast::AttrKind::Normal( + ptr::P(ast::NormalAttr { + item: ast::AttrItem { + path: ast::Path::from_ident(Ident::from_str(key)), + args: ast::AttrArgs::Delimited( + ast::DelimArgs { + dspan: tokenstream::DelimSpan::dummy(), + delim: ast::MacDelimiter::Parenthesis, + tokens: iter::once( + tokenstream::TokenTree::token_alone( + token::TokenKind::Ident(Symbol::intern(value), false), + Span::default(), + ), + ).collect(), + }), + tokens: None, + }, + tokens: None, + })), id: ast::AttrId::new(0), style: ast::AttrStyle::Inner, span: Span::default(), @@ -1107,9 +1213,10 @@ fn make_attr(key: &str, value: &str) -> ast::Attribute { } pub fn inject_attrs<'tcx>(queries: &'tcx Queries<'tcx>) { - let mut krate = queries.parse().unwrap().peek_mut(); - krate.attrs.push(make_attr("feature", "register_attr")); - krate.attrs.push(make_attr("register_attr", "crux_test")); + let mut k = queries.parse().unwrap(); + let krate: &mut Crate = k.get_mut(); + krate.attrs.push(make_attr("feature", "register_tool")); + krate.attrs.push(make_attr("register_tool", "crux")); } #[derive(Default)] @@ -1177,10 +1284,13 @@ thread_local! { } pub fn gather_match_spans<'tcx>(queries: &'tcx Queries<'tcx>) { - let krate = &queries.expansion().unwrap().peek().0; - let mut v = GatherMatchSpans::default(); - visit::walk_crate(&mut v, krate); - MATCH_SPAN_MAP.with(|m| m.replace(Some(Rc::new(v.match_span_map)))); + queries.global_ctxt().unwrap().enter(|tcx| { + let resolver = tcx.resolver_for_lowering(()); + let krate = &resolver.borrow().1; + let mut v = GatherMatchSpans::default(); + visit::walk_crate(&mut v, krate); + MATCH_SPAN_MAP.with(|m| m.replace(Some(Rc::new(v.match_span_map)))); + }); } fn get_match_spans() -> Rc> { diff --git a/src/analyz/to_json.rs b/src/analyz/to_json.rs index 56d21b4..b4c1cd6 100644 --- a/src/analyz/to_json.rs +++ b/src/analyz/to_json.rs @@ -1,7 +1,7 @@ -use rustc_hir::def_id::DefId; -use rustc::mir::Body; +use rustc_hir::def_id::{DefId, LOCAL_CRATE}; +use rustc_middle::mir::{Body, interpret}; +use rustc_middle::ty::{self, TyCtxt, DynKind}; use rustc_session::Session; -use rustc::ty::{self, TyCtxt}; use rustc_span::Span; use rustc_span::symbol::Symbol; use serde_json; @@ -89,12 +89,13 @@ pub struct TraitInst<'tcx> { impl<'tcx> TraitInst<'tcx> { pub fn from_dynamic_predicates( tcx: TyCtxt<'tcx>, - preds: ty::Binder<&'tcx ty::List>>, + preds: &'tcx ty::List>>, ) -> TraitInst<'tcx> { - let preds = tcx.erase_late_bound_regions(&preds); - let trait_ref = preds.principal(); - let mut projs = preds.projection_bounds().collect::>(); - projs.sort_by_key(|p| p.item_def_id); + let trait_ref = preds.principal().map(|tr| tcx.erase_late_bound_regions(tr)); + let mut projs = preds.projection_bounds() + .map(|proj| tcx.erase_late_bound_regions(proj)) + .collect::>(); + projs.sort_by_key(|p| p.def_id); TraitInst { trait_ref, projs } } @@ -107,22 +108,43 @@ impl<'tcx> TraitInst<'tcx> { ) -> TraitInst<'tcx> { let ex_trait_ref = ty::ExistentialTraitRef::erase_self_ty(tcx, trait_ref); + let mut all_super_traits = HashSet::new(); + let mut pending = vec![trait_ref.def_id]; + all_super_traits.insert(trait_ref.def_id); + while let Some(def_id) = pending.pop() { + let super_preds = tcx.super_predicates_of(def_id); + for &(ref pred, _) in super_preds.predicates { + let tpred = match tcx.erase_late_bound_regions(pred.kind()) { + ty::PredicateKind::Clause(ty::Clause::Trait(x)) => x, + ty::PredicateKind::Clause(ty::Clause::TypeOutlives(..)) => continue, + _ => panic!("unexpected predicate kind: {:?}", pred), + }; + assert_eq!(tpred.polarity, ty::ImplPolarity::Positive); + if all_super_traits.insert(tpred.trait_ref.def_id) { + pending.push(tpred.trait_ref.def_id); + } + } + } + let mut all_super_traits = all_super_traits.into_iter().collect::>(); + all_super_traits.sort(); + let mut projs = Vec::new(); - // FIXME: build projs for supertrait trait_refs as well - for ai in tcx.associated_items(trait_ref.def_id).in_definition_order() { - match ai.kind { - ty::AssocKind::Type | ty::AssocKind::OpaqueTy => {}, - _ => continue, + for super_trait_def_id in all_super_traits { + for ai in tcx.associated_items(super_trait_def_id).in_definition_order() { + match ai.kind { + ty::AssocKind::Type => {}, + _ => continue, + } + let proj_ty = tcx.mk_projection(ai.def_id, trait_ref.substs); + let actual_ty = tcx.normalize_erasing_regions(ty::ParamEnv::reveal_all(), proj_ty); + projs.push(ty::ExistentialProjection { + def_id: ai.def_id, + substs: ex_trait_ref.substs, + term: actual_ty.into(), + }); } - let proj_ty = tcx.mk_projection(ai.def_id, trait_ref.substs); - let actual_ty = tcx.normalize_erasing_regions(ty::ParamEnv::reveal_all(), proj_ty); - projs.push(ty::ExistentialProjection { - item_def_id: ai.def_id, - substs: ex_trait_ref.substs, - ty: actual_ty, - }); } - projs.sort_by_key(|p| p.item_def_id); + projs.sort_by_key(|p| p.def_id); TraitInst { trait_ref: Some(ex_trait_ref), @@ -133,10 +155,13 @@ impl<'tcx> TraitInst<'tcx> { pub fn dyn_ty(&self, tcx: TyCtxt<'tcx>) -> Option> { let trait_ref = self.trait_ref?; let mut preds = Vec::with_capacity(self.projs.len() + 1); - preds.push(ty::ExistentialPredicate::Trait(trait_ref)); - preds.extend(self.projs.iter().map(|p| ty::ExistentialPredicate::Projection(*p))); - let preds = tcx.intern_existential_predicates(&preds); - Some(tcx.mk_dynamic(ty::Binder::bind(preds), tcx.mk_region(ty::RegionKind::ReErased))) + preds.push(ty::Binder::dummy(ty::ExistentialPredicate::Trait(trait_ref))); + preds.extend( + self.projs.iter().map(|p| ty::Binder::dummy(ty::ExistentialPredicate::Projection(*p))), + ); + let preds = tcx.intern_poly_existential_predicates(&preds); + // Always emit `DynKind::Dyn`. We don't support `dyn*` (`DynKind::DynStar`) yet. + Some(tcx.mk_dynamic(preds, tcx.mk_region(ty::RegionKind::ReErased), DynKind::Dyn)) } /// Build a concrete, non-existential TraitRef, filling in the `Self` parameter with the `dyn` @@ -154,17 +179,17 @@ impl<'tcx> TraitInst<'tcx> { #[derive(Clone, Copy, PartialEq, Eq, Debug, Hash)] pub struct AdtInst<'tcx> { - pub adt: &'tcx ty::AdtDef, + pub adt: ty::AdtDef<'tcx>, pub substs: ty::subst::SubstsRef<'tcx>, } impl<'tcx> AdtInst<'tcx> { - pub fn new(adt: &'tcx ty::AdtDef, substs: ty::subst::SubstsRef<'tcx>) -> AdtInst<'tcx> { + pub fn new(adt: ty::AdtDef<'tcx>, substs: ty::subst::SubstsRef<'tcx>) -> AdtInst<'tcx> { AdtInst { adt, substs } } pub fn def_id(&self) -> DefId { - self.adt.did + self.adt.did() } } @@ -178,7 +203,7 @@ pub struct TyIntern<'tcx> { /// Info for describing a type. The `String` indicates (at minimum) the `TyKind`, and the `bool` /// is `true` if a hash of the type should be included when forming the type's unique ID. fn ty_desc(ty: ty::Ty) -> (String, bool) { - let kind_str = match ty.kind { + let kind_str = match *ty.kind() { // Special case: primitive types print as themselves and don't require a hash. ty::TyKind::Bool | ty::TyKind::Char | @@ -187,9 +212,6 @@ fn ty_desc(ty: ty::Ty) -> (String, bool) { ty::TyKind::Float(_) | ty::TyKind::Str => return (format!("{:?}", ty), false), - ty::TyKind::Never | - ty::TyKind::Error => return (format!("{:?}", ty.kind), false), - ty::TyKind::Adt(..) => "Adt", ty::TyKind::Foreign(..) => "Foreign", ty::TyKind::Array(..) => "Array", @@ -202,14 +224,14 @@ fn ty_desc(ty: ty::Ty) -> (String, bool) { ty::TyKind::Closure(..) => "Closure", ty::TyKind::Generator(..) => "Generator", ty::TyKind::GeneratorWitness(..) => "GeneratorWitness", + ty::TyKind::Never => "Never", ty::TyKind::Tuple(..) => "Tuple", - ty::TyKind::Projection(..) => "Projection", - ty::TyKind::UnnormalizedProjection(..) => "UnnormalizedProjection", - ty::TyKind::Opaque(..) => "Opaque", + ty::TyKind::Alias(..) => "Alias", ty::TyKind::Param(..) => "Param", ty::TyKind::Bound(..) => "Bound", ty::TyKind::Placeholder(..) => "Placeholder", ty::TyKind::Infer(..) => "Infer", + ty::TyKind::Error(..) => "Error", }; (kind_str.to_owned(), true) } @@ -250,7 +272,7 @@ impl<'tcx> TyIntern<'tcx> { /// How many functions should be exported in the JSON output? #[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] pub enum ExportStyle { - /// Only export functions annotated with the `#[crux_test]` attribute. + /// Only export functions annotated with the `#[crux::test]` attribute. ExportCruxTests, /// Export all functions. ExportAll @@ -262,6 +284,42 @@ impl Default for ExportStyle { } } +#[derive(Default, Debug)] +pub struct AllocIntern<'tcx> { + /// We key this map on both ConstAllocations and their Tys. Keying the map + /// on ConstAllocations alone is not sufficient, as two ConstAllocations + /// with different types can share the same underlying memory representation + /// (e.g., `0: u8` and `Ok(()) : Result<(), ()>`). + map: HashMap<(interpret::ConstAllocation<'tcx>, ty::Ty<'tcx>), String>, + new_vals: Vec, +} + +impl<'tcx> AllocIntern<'tcx> { + pub fn get(&self, alloc: interpret::ConstAllocation<'tcx>, ty: ty::Ty<'tcx>) -> Option<&str> { + self.map.get(&(alloc, ty)).map(|x| x as &str) + } + + pub fn insert(&mut self, tcx: TyCtxt<'tcx>, + alloc: interpret::ConstAllocation<'tcx>, ty: ty::Ty<'tcx>, + mut static_def: serde_json::Value) -> String { + let crate_name = tcx.crate_name(LOCAL_CRATE); + let disambig = tcx.crate_hash(LOCAL_CRATE); + // NB: The use of :: here is important, as mir-json's dead + // code elimination relies on it. + // See https://github.com/GaloisInc/mir-json/issues/36. + let id = format!("{}/{}::{{{{alloc}}}}[{}]", crate_name, disambig, self.map.len()); + static_def["name"] = id.clone().into(); + self.new_vals.push(static_def); + let old = self.map.insert((alloc, ty), id.clone()); + assert!(old.is_none(), "duplicate insert for type {:?}", alloc); + id + } + + pub fn take_new_allocs(&mut self) -> Vec { + mem::replace(&mut self.new_vals, Vec::new()) + } +} + pub struct MirState<'a, 'tcx : 'a> { pub mir: Option<&'tcx Body<'tcx>>, pub used: &'a mut Used<'tcx>, @@ -278,6 +336,7 @@ pub struct MirState<'a, 'tcx : 'a> { /// rewritten. This seems okay for now since the user is mostly interested in coverage in /// their own top-level crate anyway. pub match_span_map: &'a HashMap, + pub allocs: &'a mut AllocIntern<'tcx>, pub export_style: ExportStyle, } diff --git a/src/analyz/ty_json.rs b/src/analyz/ty_json.rs index 1971de2..3617846 100644 --- a/src/analyz/ty_json.rs +++ b/src/analyz/ty_json.rs @@ -1,14 +1,18 @@ +use std::convert::TryFrom; +use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_hir as hir; use rustc_hir::def_id::DefId; -use rustc::mir; -use rustc_mir::interpret; -use rustc::ty; -use rustc::ty::{TyCtxt, TypeFoldable}; -use rustc::ich::StableHashingContext; use rustc_index::vec::{IndexVec, Idx}; -use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; +use rustc_middle::mir; +use rustc_const_eval::interpret::{self, InterpCx, InterpResult, MPlaceTy, Provenance}; +use rustc_const_eval::const_eval::CheckAlignment; +use rustc_middle::bug; +use rustc_middle::ty; +use rustc_middle::ty::{AdtKind, DynKind, TyCtxt, TypeFoldable, TypeVisitable}; +use rustc_middle::ty::util::{IntTypeExt}; +use rustc_query_system::ich::StableHashingContext; use rustc_target::spec::abi; -use rustc_ast::ast; +use rustc_target::abi::{Align, FieldsShape, HasDataLayout, Size}; use rustc_span::DUMMY_SP; use serde_json; use std::fmt::Write as FmtWrite; @@ -22,16 +26,16 @@ impl<'tcx, T> ToJson<'tcx> for ty::List { fn to_json(&self, mir: &mut MirState<'_, 'tcx>) -> serde_json::Value { let mut j = Vec::new(); - for v in self { + for v in self.iter() { j.push(v.to_json(mir)); } json!(j) } } -basic_json_enum_impl!(ast::FloatTy); -basic_json_enum_impl!(ast::IntTy); -basic_json_enum_impl!(ast::UintTy); +basic_json_enum_impl!(ty::FloatTy); +basic_json_enum_impl!(ty::IntTy); +basic_json_enum_impl!(ty::UintTy); basic_json_enum_impl!(hir::Mutability); basic_json_enum_impl!(hir::def::CtorKind); basic_json_enum_impl!(mir::CastKind); @@ -66,18 +70,15 @@ impl ToJson<'_> for ty::VariantDiscr { pub fn def_id_str(tcx: TyCtxt, def_id: hir::def_id::DefId) -> String { // Based on rustc/ty/context.rs.html TyCtxt::def_path_debug_str - let crate_name = if def_id.is_local() { - tcx.crate_name.clone() - } else { - tcx.crate_name(def_id.krate) - }; - let disambig = if def_id.is_local() { - tcx.sess.local_crate_disambiguator() - } else { - tcx.crate_disambiguator(def_id.krate) - }; + let crate_name = tcx.crate_name(def_id.krate); + let disambig = tcx.crate_hash(def_id.krate); let defpath = tcx.def_path(def_id); - format!("{}/{}{}", crate_name, &disambig.to_string()[..8], defpath.to_string_no_crate()) + format!( + "{}/{}{}", + crate_name, + &disambig.to_string()[..8], + defpath.to_string_no_crate_verbose(), + ) } pub fn ext_def_id_str<'tcx, T>( @@ -86,15 +87,15 @@ pub fn ext_def_id_str<'tcx, T>( prefix: &str, extra: T, ) -> String -where T: HashStable> { +where T: for<'a> HashStable> { let base = def_id_str(tcx, def_id); // Based on librustc_codegen_utils/symbol_names/legacy.rs get_symbol_hash - let mut hasher = StableHasher::new(); - let mut hcx = tcx.create_stable_hashing_context(); - extra.hash_stable(&mut hcx, &mut hasher); - let hash: u64 = hasher.finish(); - + let hash: u64 = tcx.with_stable_hashing_context(|mut hcx| { + let mut hasher = StableHasher::new(); + extra.hash_stable(&mut hcx, &mut hasher); + hasher.finish() + }); format!("{}::{}{:016x}[0]", base, prefix, hash) } @@ -103,7 +104,7 @@ pub fn adt_inst_id_str<'tcx>( ai: AdtInst<'tcx>, ) -> String { // Erase all early-bound regions. - let substs = tcx.erase_regions(&ai.substs); + let substs = tcx.erase_regions(ai.substs); ext_def_id_str(tcx, ai.def_id(), "_adt", substs) } @@ -119,7 +120,7 @@ pub fn inst_id_str<'tcx>( assert!(!substs.needs_subst()); match inst.def { - ty::InstanceDef::Item(def_id) | + ty::InstanceDef::Item(ty::WithOptConstParam { did: def_id, .. }) | ty::InstanceDef::Intrinsic(def_id) => { if substs.len() == 0 { def_id_str(tcx, def_id) @@ -127,7 +128,7 @@ pub fn inst_id_str<'tcx>( ext_def_id_str(tcx, def_id, "_inst", substs) } }, - ty::InstanceDef::VtableShim(def_id) => + ty::InstanceDef::VTableShim(def_id) => ext_def_id_str(tcx, def_id, "_vtshim", substs), ty::InstanceDef::ReifyShim(def_id) => ext_def_id_str(tcx, def_id, "_reify", substs), @@ -136,7 +137,7 @@ pub fn inst_id_str<'tcx>( ty::InstanceDef::DropGlue(def_id, _) => ext_def_id_str(tcx, def_id, "_drop", substs), ty::InstanceDef::FnPtrShim(def_id, _) | - ty::InstanceDef::ClosureOnceShim { call_once: def_id } => + ty::InstanceDef::ClosureOnceShim { call_once: def_id, .. } => ext_def_id_str(tcx, def_id, "_callonce", substs), ty::InstanceDef::CloneShim(def_id, _) => ext_def_id_str(tcx, def_id, "_shim", substs), @@ -171,7 +172,7 @@ pub fn get_fn_def_name<'tcx>( ); // Compute the mangled name of the monomorphized instance being called. - if let Some(inst) = inst { + if let Ok(Some(inst)) = inst { mir.used.instances.insert(inst); inst_id_str(mir.state.tcx, inst) } else { @@ -221,11 +222,13 @@ impl ToJson<'_> for hir::def_id::DefId { /// of counting to ours. fn adjust_method_index<'tcx>( tcx: TyCtxt<'tcx>, - tref: ty::Binder>, + tref: ty::Binder<'tcx, ty::TraitRef<'tcx>>, raw_idx: usize, ) -> usize { - let methods = tcx.vtable_methods(tref); - methods.iter().take(raw_idx).filter(|m| m.is_some()).count() + let methods = tcx.vtable_entries(tref); + methods.iter().take(raw_idx) + .filter(|m| matches!(m, ty::vtable::VtblEntry::Method(_))) + .count() } impl<'tcx> ToJson<'tcx> for ty::Instance<'tcx> { @@ -238,7 +241,7 @@ impl<'tcx> ToJson<'tcx> for ty::Instance<'tcx> { match self.def { ty::InstanceDef::Item(did) => json!({ "kind": "Item", - "def_id": did.to_json(mir), + "def_id": did.did.to_json(mir), "substs": substs.to_json(mir), }), ty::InstanceDef::Intrinsic(did) => json!({ @@ -246,8 +249,8 @@ impl<'tcx> ToJson<'tcx> for ty::Instance<'tcx> { "def_id": did.to_json(mir), "substs": substs.to_json(mir), }), - ty::InstanceDef::VtableShim(did) => json!({ - "kind": "VtableShim", + ty::InstanceDef::VTableShim(did) => json!({ + "kind": "VTableShim", "def_id": did.to_json(mir), "substs": substs.to_json(mir), }), @@ -265,8 +268,8 @@ impl<'tcx> ToJson<'tcx> for ty::Instance<'tcx> { ty::InstanceDef::Virtual(did, idx) => { let self_ty = substs.types().next() .unwrap_or_else(|| panic!("expected self type in substs for {:?}", self)); - let preds = match self_ty.kind { - ty::TyKind::Dynamic(ref preds, _region) => preds, + let preds = match *self_ty.kind() { + ty::TyKind::Dynamic(ref preds, _region, _dynkind) => preds, _ => panic!("expected `dyn` self type, but got {:?}", self_ty), }; let ex_tref = match preds.principal() { @@ -275,7 +278,7 @@ impl<'tcx> ToJson<'tcx> for ty::Instance<'tcx> { }; let tref = ex_tref.with_self_ty(mir.state.tcx, self_ty); - let erased_tref = mir.state.tcx.erase_late_bound_regions(&tref); + let erased_tref = mir.state.tcx.erase_late_bound_regions(tref); let ti = TraitInst::from_trait_ref(mir.state.tcx, erased_tref); let trait_name = trait_inst_id_str(mir.state.tcx, &ti); mir.used.traits.insert(ti); @@ -287,7 +290,7 @@ impl<'tcx> ToJson<'tcx> for ty::Instance<'tcx> { "index": adjust_method_index(mir.state.tcx, tref, idx), }) }, - ty::InstanceDef::ClosureOnceShim { call_once } => json!({ + ty::InstanceDef::ClosureOnceShim { call_once, .. } => json!({ "kind": "ClosureOnceShim", "call_once": call_once.to_json(mir), "substs": substs.to_json(mir), @@ -299,11 +302,11 @@ impl<'tcx> ToJson<'tcx> for ty::Instance<'tcx> { "ty": ty.to_json(mir), }), ty::InstanceDef::CloneShim(did, ty) => { - let sub_tys = match ty.kind { + let sub_tys = match *ty.kind() { ty::TyKind::Array(t, _) => vec![t], - ty::TyKind::Tuple(substs) => substs.types().collect(), + ty::TyKind::Tuple(ts) => ts[..].to_owned(), ty::TyKind::Closure(closure_did, substs) => - substs.as_closure().upvar_tys(closure_did, mir.state.tcx).collect(), + substs.as_closure().upvar_tys().collect(), _ => { eprintln!("warning: don't know how to build clone shim for {:?}", ty); vec![] @@ -316,7 +319,9 @@ impl<'tcx> ToJson<'tcx> for ty::Instance<'tcx> { ty::ParamEnv::reveal_all(), did, mir.state.tcx.intern_substs(&[ty.into()]), - ); + ).unwrap_or_else(|_| { + panic!("failed to resolve instance: {:?}, {:?}", did, ty); + }); if let Some(inst) = inst { // Add the callee to `used.insances`, so we'll emit code for it even if // it's otherwise unused. If `inst` is itself a `CloneShim`, its own @@ -341,23 +346,25 @@ impl<'tcx> ToJson<'tcx> for ty::Instance<'tcx> { // For type _references_. To translate ADT defintions, do it explicitly. impl<'tcx> ToJson<'tcx> for ty::Ty<'tcx> { fn to_json(&self, mir: &mut MirState<'_, 'tcx>) -> serde_json::Value { + let tcx = mir.state.tcx; + // If this type has already been interned, just return its ID. if let Some(id) = mir.tys.get(*self) { return json!(id); } // Otherwise, convert the type to JSON and add the new entry to the interning table. - let j = match &self.kind { + let j = match self.kind() { &ty::TyKind::Bool => { json!({"kind": "Bool"}) } &ty::TyKind::Char => { json!({"kind": "Char"}) } - &ty::TyKind::Int(ref t) => { + &ty::TyKind::Int(t) => { json!({"kind": "Int", "intkind": t.to_json(mir)}) } - &ty::TyKind::Uint(ref t) => { + &ty::TyKind::Uint(t) => { json!({"kind": "Uint", "uintkind": t.to_json(mir)}) } &ty::TyKind::Tuple(ref sl) => { @@ -369,7 +376,7 @@ impl<'tcx> ToJson<'tcx> for ty::Ty<'tcx> { &ty::TyKind::Str => { json!({"kind": "Str"}) } - &ty::TyKind::Float(ref sz) => { + &ty::TyKind::Float(sz) => { json!({"kind": "Float", "size": sz.to_json(mir)}) } &ty::TyKind::Array(ref t, ref size) => { @@ -395,7 +402,7 @@ impl<'tcx> ToJson<'tcx> for ty::Ty<'tcx> { json!({ "kind": "Adt", "name": adt_inst_id_str(mir.state.tcx, ai), - "orig_def_id": adtdef.did.to_json(mir), + "orig_def_id": adtdef.did().to_json(mir), "substs": substs.to_json(mir), }) } @@ -412,27 +419,35 @@ impl<'tcx> ToJson<'tcx> for ty::Ty<'tcx> { &ty::TyKind::Closure(defid, ref substs) => { json!({ "kind": "Closure", - "upvar_tys": substs.as_closure().upvar_tys(defid, mir.state.tcx) + "upvar_tys": substs.as_closure().upvar_tys() .collect::>().to_json(mir), // crucible-mir uses the same representation for closures as it does for // tuples, so no additional information is needed. }) } - &ty::TyKind::Dynamic(ref preds, _region) => { - let ti = TraitInst::from_dynamic_predicates(mir.state.tcx, *preds); - let trait_name = trait_inst_id_str(mir.state.tcx, &ti); - mir.used.traits.insert(ti); - json!({ - "kind": "Dynamic", - "trait_id": trait_name, - "predicates": preds.skip_binder().to_json(mir), - }) + &ty::TyKind::Dynamic(preds, _region, dynkind) => { + match dynkind { + DynKind::Dyn => { + let ti = TraitInst::from_dynamic_predicates(mir.state.tcx, preds); + let trait_name = trait_inst_id_str(mir.state.tcx, &ti); + mir.used.traits.insert(ti); + json!({ + "kind": "Dynamic", + "trait_id": trait_name, + "predicates": preds.iter().map(|p|{ + let p = tcx.erase_late_bound_regions(p); + p.to_json(mir) + }).collect::>(), + }) + }, + DynKind::DynStar => + json!({ + "kind": "DynamicStar", + }), + } } - &ty::TyKind::Projection(..) => unreachable!( - "no TyKind::Projection should remain after monomorphization" - ), - &ty::TyKind::UnnormalizedProjection(..) => unreachable!( - "no TyKind::UnnormalizedProjection should remain after monomorphization" + &ty::TyKind::Alias(ty::AliasKind::Projection, _) => unreachable!( + "no TyKind::Alias with AliasKind Projection should remain after monomorphization" ), &ty::TyKind::FnPtr(ref sig) => { json!({"kind": "FnPtr", "signature": sig.to_json(mir)}) @@ -440,7 +455,7 @@ impl<'tcx> ToJson<'tcx> for ty::Ty<'tcx> { &ty::TyKind::Never => { json!({"kind": "Never"}) } - &ty::TyKind::Error => { + &ty::TyKind::Error(_) => { json!({"kind": "Error"}) } &ty::TyKind::Infer(_) => { @@ -467,9 +482,9 @@ impl<'tcx> ToJson<'tcx> for ty::Ty<'tcx> { // TODO json!({"kind": "GeneratorWitness"}) } - &ty::TyKind::Opaque(_, _) => { + &ty::TyKind::Alias(ty::AliasKind::Opaque, _) => { // TODO - json!({"kind": "Opaque"}) + json!({"kind": "Alias"}) } }; @@ -486,7 +501,7 @@ impl ToJson<'_> for ty::ParamTy { impl<'tcx> ToJson<'tcx> for ty::PolyFnSig<'tcx> { fn to_json(&self, ms: &mut MirState<'_, 'tcx>) -> serde_json::Value { - let sig = ms.state.tcx.erase_late_bound_regions(self); + let sig = ms.state.tcx.erase_late_bound_regions(*self); sig.to_json(ms) } } @@ -512,11 +527,11 @@ impl<'tcx> ToJson<'tcx> for ty::TraitRef<'tcx> { } } -impl<'tcx> ToJson<'tcx> for ty::ProjectionTy<'tcx> { +impl<'tcx> ToJson<'tcx> for ty::AliasTy<'tcx> { fn to_json(&self, ms: &mut MirState<'_, 'tcx>) -> serde_json::Value { json!({ "substs": self.substs.to_json(ms), - "item_def_id": self.item_def_id.to_json(ms) + "def_id": self.def_id.to_json(ms) }) } } @@ -525,16 +540,18 @@ impl<'tcx> ToJson<'tcx> for ty::ProjectionTy<'tcx> { impl<'tcx> ToJson<'tcx> for ty::Predicate<'tcx> { fn to_json(&self, ms: &mut MirState<'_, 'tcx>) -> serde_json::Value { - match self { - &ty::Predicate::Trait(ref ptp, _constness) => { + match self.kind().skip_binder() { + ty::PredicateKind::Clause(ty::Clause::Trait(tp)) => { json!({ - "trait_pred": ptp.to_json(ms) + "trait_pred": tp.trait_ref.to_json(ms) }) } - &ty::Predicate::Projection(ref ppp) => { - json!({ - "trait_proj": ppp.skip_binder().to_json(ms) - }) + ty::PredicateKind::Clause(ty::Clause::Projection(pp)) => match pp.term.unpack() { + ty::TermKind::Ty(ty) => json!({ + "projection_ty": pp.projection_ty.to_json(ms), + "ty": ty.to_json(ms), + }), + ty::TermKind::Const(_) => json!("unknown_const_projection"), } _ => { json!("unknown_pred") @@ -543,22 +560,6 @@ impl<'tcx> ToJson<'tcx> for ty::Predicate<'tcx> { } } -impl<'tcx> ToJson<'tcx> for ty::PolyTraitPredicate<'tcx> { - fn to_json(&self, ms: &mut MirState<'_, 'tcx>) -> serde_json::Value { - let pred = ms.state.tcx.erase_late_bound_regions(self); - pred.trait_ref.to_json(ms) - } -} - -impl<'tcx> ToJson<'tcx> for ty::ProjectionPredicate<'tcx> { - fn to_json(&self, ms: &mut MirState<'_, 'tcx>) -> serde_json::Value { - json!({ - "projection_ty": self.projection_ty.to_json(ms), - "ty": self.ty.to_json(ms) - }) - } -} - // Existential predicate (dynamic / trait object version of `ty::Predicate`) impl<'tcx> ToJson<'tcx> for ty::ExistentialPredicate<'tcx> { @@ -571,13 +572,16 @@ impl<'tcx> ToJson<'tcx> for ty::ExistentialPredicate<'tcx> { "substs": trait_ref.substs.to_json(ms), }) }, - &ty::ExistentialPredicate::Projection(ref proj) => { - json!({ + &ty::ExistentialPredicate::Projection(ref proj) => match proj.term.unpack() { + ty::TermKind::Ty(ty) => json!({ "kind": "Projection", - "proj": proj.item_def_id.to_json(ms), + "proj": proj.def_id.to_json(ms), "substs": proj.substs.to_json(ms), - "rhs_ty": proj.ty.to_json(ms), - }) + "rhs_ty": ty.to_json(ms), + }), + ty::TermKind::Const(_) => json!({ + "kind": "Projection_Const", + }), }, &ty::ExistentialPredicate::AutoTrait(ref did) => { json!({ @@ -662,329 +666,92 @@ impl<'tcx> ToJson<'tcx> for ty::subst::GenericArg<'tcx> { } } -fn do_const_eval<'tcx>( - tcx: TyCtxt<'tcx>, - def_id: DefId, - substs: ty::subst::SubstsRef<'tcx>, - promoted: Option, -) -> mir::interpret::ConstValue<'tcx> { - let param_env = ty::ParamEnv::reveal_all(); - let instance = ty::Instance::resolve(tcx, param_env, def_id, substs).unwrap(); - let cid = interpret::GlobalId { - instance, - promoted, - }; - tcx.const_eval_validated(param_env.and(cid)).unwrap() -} - fn eval_array_len<'tcx>( tcx: TyCtxt<'tcx>, - c: &'tcx ty::Const<'tcx>, + c: ty::Const<'tcx>, ) -> usize { - let evaluated = match c.val { - ty::ConstKind::Unevaluated(def_id, substs, promoted) => { - do_const_eval(tcx, def_id, substs, promoted) - }, - ty::ConstKind::Value(val) => val, - _ => panic!("don't know how to translate ConstKind::{:?}", c.val), - }; - match evaluated { - interpret::ConstValue::Scalar(interpret::Scalar::Raw { size: _, data }) => { - assert!(data <= usize::MAX as u128); - data as usize - }, - _ => panic!("impossible: array size is not a scalar?"), + match c.kind() { + // ty::ConstKind::Unevaluated(un) => { + // tcx.const_eval_resolve(ty::ParamEnv::reveal_all(), un.expand(), None).unwrap() + // }, + // NB: the type of "val" changed to valtree - try to get the size out of that + ty::ConstKind::Value(ty::ValTree::Leaf(val)) => + val.try_to_machine_usize(tcx).expect("expecting usize value from constant") as usize, + ref val => panic!("don't know how to translate ConstKind::{:?}", val), } } -fn read_static_memory<'tcx>( - alloc: &'tcx mir::interpret::Allocation, - start: usize, - end: usize, -) -> &'tcx [u8] { - assert!(alloc.relocations().len() == 0); - alloc.inspect_with_undef_and_ptr_outside_interpreter(start .. end) -} - -fn render_constant_scalar<'tcx>( - mir: &mut MirState<'_, 'tcx>, - ty: ty::Ty<'tcx>, - s: interpret::Scalar, -) -> Option { - match s { - interpret::Scalar::Raw { size, data } => { - render_constant(mir, ty, Some(s), Some((size, data)), None) - }, - interpret::Scalar::Ptr(ptr) => { - match mir.state.tcx.alloc_map.lock().get(ptr.alloc_id) { - Some(ga) => match ga { - interpret::GlobalAlloc::Static(def_id) => Some(json!({ - "kind": "static_ref", - "def_id": def_id.to_json(mir), - })), - interpret::GlobalAlloc::Memory(alloc) => { - let start = ptr.offset.bytes() as usize; - render_constant( - mir, - ty, - Some(s), - None, - Some((alloc, start, start)), - ) - }, - _ => None, - }, - None => None, - } - }, +use self::machine::RenderConstMachine; +mod machine { + use std::borrow::Cow; + use super::*; + use rustc_const_eval::interpret::*; + use rustc_data_structures::fx::FxIndexMap; + use rustc_middle::ty::*; + use rustc_target::abi::Size; + use rustc_target::spec::abi::Abi; + pub struct RenderConstMachine<'mir, 'tcx> { + stack: Vec>, } -} - -// TODO: migrate all constant rendering to use InterpCx + OpTy. This should reduce special cases -// and let us handle both in-memory and immediate constants. -fn render_constant<'tcx>( - mir: &mut MirState<'_, 'tcx>, - ty: ty::Ty<'tcx>, - scalar: Option, - scalar_bits: Option<(u8, u128)>, - slice: Option<(&'tcx mir::interpret::Allocation, usize, usize)>, -) -> Option { - Some(match ty.kind { - ty::TyKind::Int(_) => { - let (size, bits) = scalar_bits.expect("int const had non-scalar value?"); - let mut val = bits as i128; - if bits & (1 << (size * 8 - 1)) != 0 && size < 128 / 8 { - // Sign-extend to 128 bits - val |= -1_i128 << (size * 8); - } - json!({ - "kind": match ty.kind { - ty::TyKind::Int(ast::IntTy::Isize) => "isize", - ty::TyKind::Int(_) => "int", - _ => unreachable!(), - }, - "size": size, - "val": val.to_string(), - }) - }, - ty::TyKind::Bool | - ty::TyKind::Char | - ty::TyKind::Uint(_) => { - let (size, bits) = scalar_bits.expect("uint const had non-scalar value?"); - json!({ - "kind": match ty.kind { - ty::TyKind::Bool => "bool", - ty::TyKind::Char => "char", - ty::TyKind::Uint(ast::UintTy::Usize) => "usize", - ty::TyKind::Uint(_) => "uint", - _ => unreachable!(), - }, - "size": size, - "val": bits.to_string(), - }) - }, - ty::TyKind::Float(ast::FloatTy::F32) => { - let (size, bits) = scalar_bits.expect("f32 const had non-scalar value?"); - let val = f32::from_bits(bits as u32); - json!({ - "kind": "float", - "size": size, - "val": val.to_string(), - }) - }, - ty::TyKind::Float(ast::FloatTy::F64) => { - let (size, bits) = scalar_bits.expect("f64 const had non-scalar value?"); - let val = f64::from_bits(bits as u64); - json!({ - "kind": "float", - "size": size, - "val": val.to_string(), - }) - }, - - // &str - for string literals - ty::TyKind::Ref(_, &ty::TyS { - kind: ty::TyKind::Str, - .. - }, hir::Mutability::Not) => { - let (alloc, start, end) = slice.expect("string const had non-slice value"); - let mem = read_static_memory(alloc, start, end); - json!({ - "kind": "str", - "val": mem, - }) - }, - - // &[u8; _] - for bytestring literals - ty::TyKind::Ref(_, &ty::TyS { - kind: ty::TyKind::Array(&ty::TyS { - kind: ty::TyKind::Uint(ast::UintTy::U8), - .. - }, len_const), - .. - }, hir::Mutability::Not) => { - let len = eval_array_len(mir.state.tcx, len_const); - let (alloc, start, _) = slice.expect("string const had non-slice value"); - let end = start + len; - let mem = read_static_memory(alloc, start, end); - json!({ - "kind": "bstr", - "val": mem, - }) - }, - - ty::TyKind::RawPtr(_) => { - let (_size, bits) = scalar_bits.expect("raw_ptr const had non-scalar value?"); - json!({ - "kind": "raw_ptr", - "val": bits.to_string(), - }) - }, - - ty::TyKind::FnDef(defid, ref substs) => { - json!({ - "kind": "fndef", - "def_id": get_fn_def_name(mir, defid, substs), - }) - }, - ty::TyKind::Adt(adt_def, _substs) if adt_def.is_struct() => { - let tyl = mir.state.tcx.layout_of(ty::ParamEnv::reveal_all().and(ty)) - .unwrap_or_else(|e| panic!("failed to get layout of {:?}: {}", ty, e)); - let scalar = scalar.expect("adt had non-scalar value (NYI)"); - let variant = adt_def.non_enum_variant(); - json!({ - "kind": "struct", - "fields": render_constant_variant( - mir, - variant, - interpret::ImmTy::from_scalar(scalar, tyl).into(), - ), - }) - }, - - ty::TyKind::Adt(adt_def, _substs) if adt_def.is_enum() => { - let tyl = mir.state.tcx.layout_of(ty::ParamEnv::reveal_all().and(ty)) - .unwrap_or_else(|e| panic!("failed to get layout of {:?}: {}", ty, e)); - let scalar = scalar.expect("adt had non-scalar value (NYI)"); - - let icx = interpret::InterpCx::new( - mir.state.tcx.at(DUMMY_SP), - ty::ParamEnv::reveal_all(), - RenderConstMachine, - (), - ); - let op_ty = interpret::ImmTy::from_scalar(scalar, tyl).into(); - let (_discr, variant_idx) = icx.read_discriminant(op_ty).unwrap_or_else(|e| { - panic!("failed to access discriminant of {:?}: {}", op_ty.layout.ty, e) - }); - - let variant = &adt_def.variants[variant_idx]; - json!({ - "kind": "enum", - "variant": variant_idx.as_u32(), - "fields": render_constant_variant( - mir, - variant, - icx.operand_downcast(op_ty, variant_idx).unwrap_or_else(|e| { - panic!("failed to downcast {:?} to variant {:?}: {}", - op_ty.layout.ty, variant_idx, e) - }), - ), - }) - }, - - _ => { - if let Some((0, _)) = scalar_bits { - json!({ - "kind": "zst", - }) - } else { - return None; + impl<'mir, 'tcx> RenderConstMachine<'mir, 'tcx> { + pub fn new() -> RenderConstMachine<'mir, 'tcx> { + RenderConstMachine { + stack: Vec::new() } - }, - }) -} - -fn render_constant_variant<'tcx>( - mir: &mut MirState<'_, 'tcx>, - variant: &'tcx ty::VariantDef, - op_ty: interpret::OpTy<'tcx>, -) -> Option { - let icx = interpret::InterpCx::new( - mir.state.tcx.at(DUMMY_SP), - ty::ParamEnv::reveal_all(), - RenderConstMachine, - (), - ); - let mut vals = Vec::with_capacity(variant.fields.len()); - for i in 0 .. variant.fields.len() { - let field = icx.operand_field(op_ty, i as u64).unwrap_or_else(|e| { - panic!("failed to access field {} of {:?}: {}", i, op_ty.layout.ty, e) - }); - - // `try_as_mplace` always "succeeds" (returns an `MPlace`, dangling) for ZSTs. We want it - // to be an immediate instead. - if field.layout.is_zst() { - vals.push(render_constant_scalar(mir, field.layout.ty, interpret::Scalar::zst())?); - continue; } - - let val = match field.try_as_mplace(&icx) { - Ok(_mpl) => None, - Err(imm) => match *imm { - interpret::Immediate::Scalar(maybe_scalar) => match maybe_scalar { - interpret::ScalarMaybeUndef::Scalar(s) => { - render_constant_scalar(mir, field.layout.ty, s) - }, - _ => None, - }, - _ => None, - }, - }?; - vals.push(val); } - Some(vals.into()) -} - -struct RenderConstMachine; -mod machine { - use std::borrow::Cow; - use super::*; - use rustc_mir::interpret::*; - use rustc::ty::*; - use rustc::mir::*; - use rustc_data_structures::fx::FxHashMap; - use rustc_span::Span; - - impl<'mir, 'tcx> Machine<'mir, 'tcx> for RenderConstMachine { - type MemoryKinds = !; - type PointerTag = (); + impl<'mir, 'tcx> Machine<'mir, 'tcx> for RenderConstMachine<'mir, 'tcx> { + type MemoryKind = !; + type Provenance = AllocId; + type ProvenanceExtra = (); type ExtraFnVal = !; type FrameExtra = (); - type MemoryExtra = (); type AllocExtra = (); - type MemoryMap = FxHashMap< + type MemoryMap = FxIndexMap< AllocId, (MemoryKind, Allocation), >; - const STATIC_KIND: Option = None; - const CHECK_ALIGN: bool = false; + const GLOBAL_KIND: Option = None; + const PANIC_ON_ALLOC_FAIL: bool = false; + + fn enforce_alignment(ecx: &InterpCx<'mir, 'tcx, Self>) -> CheckAlignment { + CheckAlignment::No + } - fn enforce_validity(_ecx: &InterpCx<'mir, 'tcx, Self>) -> bool { + fn alignment_check_failed( + ecx: &InterpCx<'mir, 'tcx, Self>, + has: Align, + required: Align, + check: CheckAlignment, + ) -> InterpResult<'tcx, ()> { + panic!("not implemented: alignment_check_failed"); + } + + fn use_addr_for_alignment_check(ecx: &InterpCx<'mir, 'tcx, Self>) -> bool { + false + } + + #[inline(always)] + fn checked_binop_checks_overflow(_ecx: &InterpCx<'mir, 'tcx, Self>) -> bool { + true + } + + fn enforce_validity(ecx: &InterpCx<'mir, 'tcx, Self>) -> bool { false } fn find_mir_or_eval_fn( - _ecx: &mut InterpCx<'mir, 'tcx, Self>, - _span: Span, - _instance: Instance<'tcx>, - _args: &[OpTy<'tcx>], - _ret: Option<(PlaceTy<'tcx>, BasicBlock)>, - _unwind: Option, // unwinding is not supported in consts - ) -> InterpResult<'tcx, Option<&'mir Body<'tcx>>> { + ecx: &mut InterpCx<'mir, 'tcx, Self>, + instance: ty::Instance<'tcx>, + abi: Abi, + args: &[OpTy<'tcx, Self::Provenance>], + destination: &PlaceTy<'tcx, Self::Provenance>, + target: Option, + unwind: StackPopUnwind, + ) -> InterpResult<'tcx, Option<(&'mir mir::Body<'tcx>, ty::Instance<'tcx>)>> { Err(InterpError::Unsupported( UnsupportedOpInfo::Unsupported( "find_mir_or_eval_fn".into(), @@ -993,11 +760,13 @@ mod machine { } fn call_extra_fn( - _ecx: &mut InterpCx<'mir, 'tcx, Self>, - _fn_val: Self::ExtraFnVal, - _args: &[OpTy<'tcx, Self::PointerTag>], - _ret: Option<(PlaceTy<'tcx, Self::PointerTag>, BasicBlock)>, - _unwind: Option + ecx: &mut InterpCx<'mir, 'tcx, Self>, + fn_val: Self::ExtraFnVal, + abi: Abi, + args: &[OpTy<'tcx, Self::Provenance>], + destination: &PlaceTy<'tcx, Self::Provenance>, + target: Option, + unwind: StackPopUnwind, ) -> InterpResult<'tcx> { Err(InterpError::Unsupported( UnsupportedOpInfo::Unsupported( @@ -1007,12 +776,12 @@ mod machine { } fn call_intrinsic( - _ecx: &mut InterpCx<'mir, 'tcx, Self>, - _span: Span, - _instance: Instance<'tcx>, - _args: &[OpTy<'tcx, Self::PointerTag>], - _ret: Option<(PlaceTy<'tcx, Self::PointerTag>, BasicBlock)>, - _unwind: Option + ecx: &mut InterpCx<'mir, 'tcx, Self>, + instance: ty::Instance<'tcx>, + args: &[OpTy<'tcx, Self::Provenance>], + destination: &PlaceTy<'tcx, Self::Provenance>, + target: Option, + unwind: StackPopUnwind, ) -> InterpResult<'tcx> { Err(InterpError::Unsupported( UnsupportedOpInfo::Unsupported( @@ -1022,9 +791,9 @@ mod machine { } fn assert_panic( - _ecx: &mut InterpCx<'mir, 'tcx, Self>, - _msg: &AssertMessage<'tcx>, - _unwind: Option + ecx: &mut InterpCx<'mir, 'tcx, Self>, + msg: &mir::AssertMessage<'tcx>, + unwind: Option, ) -> InterpResult<'tcx> { Err(InterpError::Unsupported( UnsupportedOpInfo::Unsupported( @@ -1034,11 +803,11 @@ mod machine { } fn binary_ptr_op( - _ecx: &InterpCx<'mir, 'tcx, Self>, - _bin_op: BinOp, - _left: ImmTy<'tcx, Self::PointerTag>, - _right: ImmTy<'tcx, Self::PointerTag> - ) -> InterpResult<'tcx, (Scalar, bool, Ty<'tcx>)> { + ecx: &InterpCx<'mir, 'tcx, Self>, + bin_op: mir::BinOp, + left: &ImmTy<'tcx, Self::Provenance>, + right: &ImmTy<'tcx, Self::Provenance>, + ) -> InterpResult<'tcx, (Scalar, bool, Ty<'tcx>)> { Err(InterpError::Unsupported( UnsupportedOpInfo::Unsupported( "binary_ptr_op".into(), @@ -1046,86 +815,110 @@ mod machine { ).into()) } - fn tag_static_base_pointer( - _memory_extra: &Self::MemoryExtra, - _id: AllocId, - ) -> Self::PointerTag { - () - } - - fn box_alloc( - _ecx: &mut InterpCx<'mir, 'tcx, Self>, - _dest: PlaceTy<'tcx, Self::PointerTag> - ) -> InterpResult<'tcx> { + fn extern_static_base_pointer( + ecx: &InterpCx<'mir, 'tcx, Self>, + def_id: DefId, + ) -> InterpResult<'tcx, Pointer> { Err(InterpError::Unsupported( UnsupportedOpInfo::Unsupported( - "box_alloc".into(), + "extern_static_base_pointer".into(), ), ).into()) } - fn init_allocation_extra<'b>( - _memory_extra: &Self::MemoryExtra, - _id: AllocId, - alloc: Cow<'b, Allocation>, - _kind: Option> - ) -> (Cow<'b, Allocation>, Self::PointerTag) { - (alloc, ()) + fn adjust_alloc_base_pointer( + ecx: &InterpCx<'mir, 'tcx, Self>, + ptr: Pointer, + ) -> Pointer { + ptr + } + + fn ptr_from_addr_cast( + ecx: &InterpCx<'mir, 'tcx, Self>, + addr: u64, + ) -> InterpResult<'tcx, Pointer>> { + unimplemented!("ptr_from_addr_cast") } - fn stack_push( - _ecx: &mut InterpCx<'mir, 'tcx, Self> - ) -> InterpResult<'tcx, Self::FrameExtra> { + fn expose_ptr( + ecx: &mut InterpCx<'mir, 'tcx, Self>, + ptr: Pointer, + ) -> InterpResult<'tcx> { Err(InterpError::Unsupported( UnsupportedOpInfo::Unsupported( - "stack_push".into(), + "expose_ptr".into(), ), ).into()) } - fn ptr_to_int( - _mem: &Memory<'mir, 'tcx, Self>, - _ptr: Pointer - ) -> InterpResult<'tcx, u64> { + fn ptr_get_alloc( + ecx: &InterpCx<'mir, 'tcx, Self>, + ptr: Pointer, + ) -> Option<(AllocId, Size, Self::ProvenanceExtra)> { + let (prov, offset) = ptr.into_parts(); + Some((prov, offset, ())) + } + + fn adjust_allocation<'b>( + ecx: &InterpCx<'mir, 'tcx, Self>, + id: AllocId, + alloc: Cow<'b, Allocation>, + kind: Option>, + ) -> InterpResult<'tcx, Cow<'b, Allocation>> { + Ok(alloc) + } + + fn init_frame_extra( + ecx: &mut InterpCx<'mir, 'tcx, Self>, + frame: Frame<'mir, 'tcx, Self::Provenance>, + ) -> InterpResult<'tcx, Frame<'mir, 'tcx, Self::Provenance, Self::FrameExtra>> { Err(InterpError::Unsupported( UnsupportedOpInfo::Unsupported( - "ptr_to_int".into(), + "init_frame_extra".into(), ), ).into()) } + + fn stack<'a>( + ecx: &'a InterpCx<'mir, 'tcx, Self>, + ) -> &'a [Frame<'mir, 'tcx, Self::Provenance, Self::FrameExtra>] { + &ecx.machine.stack + // unimplemented!("stack") + } + + fn stack_mut<'a>( + ecx: &'a mut InterpCx<'mir, 'tcx, Self>, + ) -> &'a mut Vec> { + unimplemented!("stack_mut") + } } } impl<'tcx> ToJson<'tcx> for ty::Const<'tcx> { fn to_json(&self, mir: &mut MirState<'_, 'tcx>) -> serde_json::Value { let mut map = serde_json::Map::new(); - map.insert("ty".to_owned(), self.ty.to_json(mir)); + map.insert("ty".to_owned(), self.ty().to_json(mir)); - match self.val { - ty::ConstKind::Unevaluated(def_id, substs, promoted) => { + match self.kind() { + // remove? should probably not show up? + ty::ConstKind::Unevaluated(un) => { map.insert("initializer".to_owned(), json!({ - "def_id": get_promoted_name(mir, def_id, substs, promoted), + "def_id": get_fn_def_name(mir, un.def.did, un.substs), })); }, _ => {}, } - let evaluated = match self.val { - ty::ConstKind::Unevaluated(def_id, substs, promoted) => { - do_const_eval(mir.state.tcx, def_id, substs, promoted) - }, - ty::ConstKind::Value(val) => val, - _ => panic!("don't know how to translate ConstKind::{:?}", self.val), - }; - - let rendered = match evaluated { - interpret::ConstValue::Scalar(s) => { - render_constant_scalar(mir, self.ty, s) - }, - interpret::ConstValue::Slice { data, start, end } => { - render_constant(mir, self.ty, None, None, Some((data, start, end))) - }, - _ => None, + let rendered = match self.kind() { + ty::ConstKind::Value(ty::ValTree::Leaf(val)) => { + let sz = val.size(); + Some(json!({ + "kind": "usize", + "size": sz.bytes(), + "val": get_const_usize(mir.state.tcx, *self).to_string(), + })) + } + _ => panic!("don't know how to translate ConstKind::{:?}", self.kind()) }; if let Some(rendered) = rendered { map.insert("rendered".to_owned(), rendered); @@ -1135,6 +928,397 @@ impl<'tcx> ToJson<'tcx> for ty::Const<'tcx> { } } +impl<'tcx> ToJson<'tcx> for (interpret::ConstValue<'tcx>, ty::Ty<'tcx>) { + fn to_json(&self, mir: &mut MirState<'_, 'tcx>) -> serde_json::Value { + let (val, ty) = *self; + let op_ty = as_opty(mir.state.tcx, val, ty); + let mut icx = interpret::InterpCx::new( + mir.state.tcx, + DUMMY_SP, + ty::ParamEnv::reveal_all(), + RenderConstMachine::new(), + ); + + json!({ + "ty": ty.to_json(mir), + "rendered": render_opty(mir, &mut icx, &op_ty), + }) + } +} + +pub fn get_const_usize<'tcx>(tcx: ty::TyCtxt<'tcx>, c: ty::Const<'tcx>) -> usize { + match c.kind() { + ty::ConstKind::Value(ty::ValTree::Leaf(val)) => { + let v = val.try_to_machine_usize(tcx).unwrap(); + v as usize + } + _ => panic!("don't know how to translate ConstKind::{:?}", c.kind()) + } +} + +pub fn render_opty<'mir, 'tcx>( + mir: &mut MirState<'_, 'tcx>, + icx: &mut interpret::InterpCx<'mir, 'tcx, RenderConstMachine<'mir, 'tcx>>, + op_ty: &interpret::OpTy<'tcx>, +) -> serde_json::Value { + try_render_opty(mir, icx, op_ty).unwrap_or_else(|| { + json!({ + "kind": "unsupported_const", + "debug_val": format!("{:?}", op_ty), + }) + }) +} + +pub fn try_render_opty<'mir, 'tcx>( + mir: &mut MirState<'_, 'tcx>, + icx: &mut interpret::InterpCx<'mir, 'tcx, RenderConstMachine<'mir, 'tcx>>, + op_ty: &interpret::OpTy<'tcx>, +) -> Option { + let ty = op_ty.layout.ty; + let layout = op_ty.layout.layout; + let tcx = mir.state.tcx; + + Some(match *ty.kind() { + ty::TyKind::Bool | + ty::TyKind::Char | + ty::TyKind::Uint(_) => + { + let s = icx.read_immediate(op_ty).unwrap().to_scalar(); + let size = layout.size(); + let bits = s.to_bits(size).unwrap(); + + json!({ + "kind": match *ty.kind() { + ty::TyKind::Bool => "bool", + ty::TyKind::Char => "char", + ty::TyKind::Uint(ty::UintTy::Usize) => "usize", + ty::TyKind::Uint(_) => "uint", + _ => unreachable!(), + }, + "size": size.bytes(), + "val": bits.to_string(), + }) + } + ty::TyKind::Int(i) => { + let s = icx.read_immediate(op_ty).unwrap().to_scalar(); + let size = layout.size(); + let bits = s.to_bits(size).unwrap(); + let mut val = bits as i128; + if bits & (1 << (size.bits() - 1)) != 0 && size.bits() < 128 { + // Sign-extend to 128 bits + val |= -1_i128 << size.bits(); + } + + json!({ + "kind": match *ty.kind() { + ty::TyKind::Int(ty::IntTy::Isize) => "isize", + ty::TyKind::Int(_) => "int", + _ => unreachable!(), + }, + "size": size.bytes(), + "val": val.to_string(), + }) + } + ty::TyKind::Float(fty) => { + let s = icx.read_immediate(op_ty).unwrap().to_scalar(); + let size = layout.size(); + let val_str = match fty { + ty::FloatTy::F32 => s.to_f32().unwrap().to_string(), + ty::FloatTy::F64 => s.to_f64().unwrap().to_string(), + }; + + json!({ + "kind": "float", + "size": size.bytes(), + "val": val_str, + }) + } + ty::TyKind::Adt(adt_def, _substs) if adt_def.is_struct() => { + let variant = adt_def.non_enum_variant(); + let mut field_vals = Vec::new(); + for field_idx in 0..variant.fields.len() { + let field = icx.operand_field(&op_ty, field_idx).unwrap(); + field_vals.push(try_render_opty(mir, icx, &field)?) + } + + let val: serde_json::Value = field_vals.into(); + + json!({ + "kind": "struct", + "fields": val, + }) + }, + ty::TyKind::Adt(adt_def, _substs) if adt_def.is_enum() => { + let (_, variant_idx) = icx.read_discriminant(&op_ty).unwrap(); + let val = icx.operand_downcast(op_ty, variant_idx).unwrap(); + let mut field_vals = Vec::with_capacity(val.layout.fields.count()); + for idx in 0 .. val.layout.fields.count() { + let field_opty = icx.operand_field(&val, idx).unwrap(); + field_vals.push(try_render_opty(mir, icx, &field_opty)?); + } + + json!({ + "kind": "enum", + "variant": variant_idx.as_u32(), + "fields": field_vals, + }) + }, + + ty::TyKind::Adt(_, _) => { + panic!("Adt is not enum or struct!") + }, + + ty::TyKind::Foreign(_) => todo!("foreign is unimplemented"), // can't do this + ty::TyKind::Str => unreachable!("str type should not occur here"), + ty::TyKind::Array(ety, sz) => { + let sz = get_const_usize(tcx, sz); + let mut vals = Vec::with_capacity(sz); + for field in icx.operand_array_fields(op_ty).unwrap() { + let f_json = try_render_opty(mir, icx, &field.unwrap()); + vals.push(f_json); + } + + json!({ + "kind": "array", + "element_ty": ety.to_json(mir), + "elements": vals + }) + + } + ty::TyKind::Slice(_) => unreachable!("slice type should not occur here"), + + // similar to ref in some ways + ty::TyKind::RawPtr(m_ty) => + try_render_ref_opty(mir, icx, op_ty, m_ty.ty, m_ty.mutbl)?, + + ty::TyKind::Ref(_, rty, mutability) => + try_render_ref_opty(mir, icx, op_ty, rty, mutability)?, + + ty::TyKind::FnDef(_, _) => json!({"kind": "zst"}), + ty::TyKind::FnPtr(_sig) => { + let ptr = icx.read_pointer(op_ty).unwrap(); + let (prov, _offset) = ptr.into_parts(); + let alloc = tcx.try_get_global_alloc(prov?)?; + match alloc { + interpret::GlobalAlloc::Function(i) => { + mir.used.instances.insert(i); + json!({ + "kind": "fn_ptr", + "instance": i.to_json(mir), + + }) + }, + _ => unreachable!("Function pointer doesn't point to a function"), + } + } + ty::TyKind::Dynamic(_, _, _) => unreachable!("dynamic should not occur here"), + + ty::TyKind::Closure(_defid, substs) => { + let upvars_count = substs.as_closure().upvar_tys().count(); + let mut upvar_vals = Vec::with_capacity(upvars_count); + for idx in 0 .. upvars_count { + let upvar_opty = icx.operand_field(&op_ty, idx).unwrap(); + upvar_vals.push(try_render_opty(mir, icx, &upvar_opty)?); + } + + json!({ + "kind": "closure", + "upvars": upvar_vals, + }) + } + ty::TyKind::Generator(_, _, _) => todo!("generator not supported yet"), // not supported in haskell + ty::TyKind::GeneratorWitness(_) => todo!("generatorwitness not supported yet"), // not supported in haskell + ty::TyKind::Never => unreachable!("never type should be uninhabited"), + + ty::TyKind::Tuple(elts) => { + let mut vals = Vec::with_capacity(elts.len()); + for i in 0..elts.len() { + let fld: interpret::OpTy<'tcx> = icx.operand_field(&op_ty, i).unwrap(); + vals.push(render_opty(mir, icx, &fld)); + } + json!({ + "kind": "tuple", + "elements": vals + }) + } + + // should go away during monomorphiszation but could in theory be resolvable to a real type + ty::TyKind::Alias(_, _) => unreachable!("alias should not occur after monomorphization"), + ty::TyKind::Param(_) => unreachable!("param should not occur after monomorphization"), + + ty::TyKind::Bound(_, _) => unreachable!("bound is not a real type?"), + ty::TyKind::Placeholder(_) => unreachable!("placeholder is not a real type?"), + ty::TyKind::Infer(_) => unreachable!("infer is not a real type?"), + ty::TyKind::Error(_) => unreachable!("error is not a real type?"), + }) +} + +fn try_render_ref_opty<'mir, 'tcx>( + mir: &mut MirState<'_, 'tcx>, + icx: &mut interpret::InterpCx<'mir, 'tcx, RenderConstMachine<'mir, 'tcx>>, + op_ty: &interpret::OpTy<'tcx>, + rty: ty::Ty<'tcx>, + mutability: hir::Mutability, +) -> Option { + let tcx = mir.state.tcx; + + // Special case for nullptr + let val = icx.read_immediate(op_ty).unwrap(); + let mplace = icx.ref_to_mplace(&val).unwrap(); + let (prov, offset) = mplace.ptr.into_parts(); + if prov.is_none() { + assert!(!mplace.meta.has_meta(), "not expecting meta for nullptr"); + + return Some(json!({ + "kind": "raw_ptr", + "val": offset.bytes().to_string(), + })); + } + + let d = icx.deref_operand(op_ty).unwrap(); + let is_mut = mutability == hir::Mutability::Mut; + + if !is_mut { + match *rty.kind() { + // Special case for &str + ty::TyKind::Str => { + let len = mplace_ty_len(&d, icx).unwrap(); + let mem = icx.read_bytes_ptr_strip_provenance(d.ptr, Size::from_bytes(len)).unwrap(); + return Some(json!({ + "kind": "str", + "val": mem + })) + }, + // Special case for &[u8; N] + ty::TyKind::Array(elem_ty, _) => { + if let ty::TyKind::Uint(ty::UintTy::U8) = *elem_ty.kind() { + let mem = icx.read_bytes_ptr_strip_provenance(d.ptr, d.layout.size).unwrap(); + return Some(json!({ + "kind": "bstr", + "val": mem, + })) + } else { + () + } + }, + // Special case for &[T] + ty::TyKind::Slice(slice_ty) => { + eprintln!("slice op_ty: {:?}", op_ty); + let slice_len = mplace_ty_len(&d, icx).unwrap(); + let mut elt_values = Vec::with_capacity(slice_len as usize); + for idx in 0..slice_len { + let elt = icx.operand_index(&d.into(), idx).unwrap(); + elt_values.push(try_render_opty(mir, icx, &elt)); + } + + return Some(json!({ + "kind": "slice", + "element_ty": slice_ty.to_json(mir), + "elements": elt_values + })) + }, + _ => () + } + } + + let (prov, _offset) = d.ptr.into_parts(); + let alloc = tcx.try_get_global_alloc(prov?)?; + match alloc { + interpret::GlobalAlloc::Static(def_id) => + return Some(json!({ + "kind": "static_ref", + "def_id": def_id.to_json(mir), + })), + interpret::GlobalAlloc::Memory(ca) => { + let ty = op_ty.layout.ty; + let aid = match mir.allocs.get(ca, ty) { + Some(alloc_id) => alloc_id.to_owned(), + None => { + let ma = tcx.create_memory_alloc(ca); + let rlayout = tcx.layout_of(ty::ParamEnv::reveal_all().and(rty)).unwrap(); + let ptr = interpret::Pointer::new(Some(ma), Size::ZERO); + + let mpty = interpret::MPlaceTy::from_aligned_ptr_with_meta(ptr, rlayout, d.meta); + let rendered = try_render_opty(mir, icx, &mpty.into()); + + let static_ref = json!({ + "kind": "constant", + "mutable": false, + "ty": rty.to_json(mir), + "rendered": rendered, + }); + + mir.allocs.insert(tcx, ca, ty, static_ref) + } + }; + + return Some(json!({ + "kind": "static_ref", + "def_id": aid, + })); + } + _ => return None + } +} + +// A copied version of MPlaceTy::len, which (sadly) isn't exported. See +// https://github.com/rust-lang/rust/blob/56ee85274e5a3a4dda92f3bf73d1664c74ff9c15/compiler/rustc_const_eval/src/interpret/place.rs#L227C5-L243 +#[inline] +pub fn mplace_ty_len<'tcx, Tag: Provenance>(mplace_ty: &MPlaceTy<'tcx, Tag>, cx: &impl HasDataLayout) -> InterpResult<'tcx, u64> { + if mplace_ty.layout.is_unsized() { + // We need to consult `meta` metadata + match mplace_ty.layout.ty.kind() { + ty::Slice(..) | ty::Str => mplace_ty.meta.unwrap_meta().to_machine_usize(cx), + _ => bug!("len not supported on unsized type {:?}", mplace_ty.layout.ty), + } + } else { + // Go through the layout. There are lots of types that support a length, + // e.g., SIMD types. (But not all repr(simd) types even have FieldsShape::Array!) + match mplace_ty.layout.fields { + FieldsShape::Array { count, .. } => Ok(count), + _ => bug!("len not supported on sized type {:?}", mplace_ty.layout.ty), + } + } +} + +pub fn as_opty<'tcx>(tcx: TyCtxt<'tcx>, cv: interpret::ConstValue<'tcx>, ty: ty::Ty<'tcx>) + -> interpret::OpTy<'tcx, interpret::AllocId> +{ + use rustc_const_eval::interpret::{Operand, Pointer, MemPlace, ConstValue, Immediate, Scalar, OpTy, ImmTy, MPlaceTy}; + use rustc_target::abi::Size; + let op = match cv { + ConstValue::ByRef { alloc, offset } => { + let id = tcx.create_memory_alloc(alloc); + // We rely on mutability being set correctly in that allocation to prevent writes + // where none should happen. + let ptr = Pointer::new(id, offset); + Operand::Indirect(MemPlace::from_ptr(ptr.into())) + } + ConstValue::Scalar(x) => Operand::Immediate(x.into()), + ConstValue::ZeroSized => Operand::Immediate(Immediate::Uninit), + ConstValue::Slice { data, start, end } => { + // We rely on mutability being set correctly in `data` to prevent writes + // where none should happen. + let ptr = Pointer::new( + tcx.create_memory_alloc(data), + Size::from_bytes(start), // offset: `start` + ); + Operand::Immediate(Immediate::new_slice( + Scalar::from_pointer(ptr, &tcx), + u64::try_from(end.checked_sub(start).unwrap()).unwrap(), // len: `end - start` + &tcx, + )) + } + }; + + let layout = tcx.layout_of(ty::ParamEnv::reveal_all().and(ty)).unwrap(); + + match op { + Operand::Immediate(imm) => ImmTy::from_immediate(imm, layout).into() , + Operand::Indirect(ind) => MPlaceTy::from_aligned_ptr(ind.ptr, layout).into(), + } +} + fn iter_tojson<'a, 'tcx, I, V: 'a>( it: I, mir: &mut MirState<'_, 'tcx>, @@ -1203,31 +1387,77 @@ impl<'tcx> ToJson<'tcx> for AdtInst<'tcx> { let ty = mir.state.tcx.mk_adt(self.adt, self.substs); let tyl = mir.state.tcx.layout_of(ty::ParamEnv::reveal_all().and(ty)) .unwrap_or_else(|e| panic!("failed to get layout of {:?}: {}", ty, e)); + + let kind = match self.adt.adt_kind() { + AdtKind::Struct => json!({"kind": "Struct"}), + AdtKind::Enum => + json!({ + "kind": "Enum", + "discr_ty": self.adt + .repr() + .discr_type() + .to_ty(mir.state.tcx) + .to_json(mir) + }), + AdtKind::Union => json!({"kind": "Union"}), + }; + + let variants = + if self.adt.is_enum() { + render_enum_variants(mir, &self) + } else { + self.adt.variants() + .iter() + .map(|v| render_variant(mir, &self, v, &None)) + .collect::>() + .into() + }; + json!({ "name": adt_inst_id_str(mir.state.tcx, *self), - "kind": format!("{:?}", self.adt.adt_kind()), - "variants": self.adt.variants.tojson(mir, self.substs), + "kind": kind, + "variants": variants, "size": tyl.size.bytes(), - "repr_transparent": self.adt.repr.transparent(), - "orig_def_id": self.adt.did.to_json(mir), + "repr_transparent": self.adt.repr().transparent(), + "orig_def_id": self.adt.did().to_json(mir), "orig_substs": self.substs.to_json(mir), }) } } -impl ToJsonAg for ty::VariantDef { - fn tojson<'tcx>( - &self, - mir: &mut MirState<'_, 'tcx>, - substs: ty::subst::SubstsRef<'tcx>, - ) -> serde_json::Value { - json!({ - "name": self.def_id.to_json(mir), - "discr": self.discr.to_json(mir), - "fields": self.fields.tojson(mir, substs), - "ctor_kind": self.ctor_kind.to_json(mir) - }) +fn render_enum_variants<'tcx>( + mir: &mut MirState<'_, 'tcx>, + adt: &AdtInst<'tcx>, +) -> serde_json::Value { + let mut variants = Vec::with_capacity(adt.adt.variants().len()); + for (idx, d_value) in adt.adt.discriminants(mir.state.tcx) { + let v = adt.adt.variant(idx); + let rendered = render_variant(mir, adt, v, &Some(d_value.to_string())); + variants.push(rendered); } + + variants.into() +} + +fn render_variant<'tcx>( + mir: &mut MirState<'_, 'tcx>, + adt: &AdtInst<'tcx>, + v: &ty::VariantDef, + mb_discr: &Option +) -> serde_json::Value { + let tcx = mir.state.tcx; + let inhabited = v.inhabited_predicate(tcx, adt.adt) + .subst(tcx, adt.substs) + .apply_ignore_module(tcx, ty::ParamEnv::reveal_all()); + + json!({ + "name": v.def_id.to_json(mir), + "discr": v.discr.to_json(mir), + "fields": v.fields.tojson(mir, adt.substs), + "ctor_kind": v.ctor_kind().to_json(mir), + "discr_value": mb_discr, + "inhabited": inhabited, + }) } impl ToJsonAg for ty::FieldDef { @@ -1238,7 +1468,7 @@ impl ToJsonAg for ty::FieldDef { ) -> serde_json::Value { let unsubst_ty = mir.state.tcx.type_of(self.did); let ty = mir.state.tcx.subst_and_normalize_erasing_regions( - substs, ty::ParamEnv::reveal_all(), &unsubst_ty); + substs, ty::ParamEnv::reveal_all(), unsubst_ty); json!({ "name": self.did.to_json(mir), "ty": ty.to_json(mir), @@ -1252,7 +1482,8 @@ pub fn handle_adt_ag<'tcx>( opv: &Vec>, ) -> serde_json::Value { match ak { - &mir::AggregateKind::Adt(ref adt, variant, substs, _, _) => { + &mir::AggregateKind::Adt(adt_did, variant, substs, _, _) => { + let adt = mir.state.tcx.adt_def(adt_did); json!({ "adt": AdtInst::new(adt, substs).to_json(mir), "variant": variant.to_json(mir), @@ -1262,3 +1493,35 @@ pub fn handle_adt_ag<'tcx>( _ => unreachable!("bad"), } } + +pub fn eval_mir_constant2<'mir, 'tcx>( + icx: &InterpCx<'mir, 'tcx, RenderConstMachine<'mir, 'tcx>>, + tcx: ty::TyCtxt<'tcx>, + constant: &mir::Constant<'tcx>, +) -> interpret::OpTy<'tcx> { + let layout = tcx.layout_of(ty::ParamEnv::reveal_all().and(constant.ty())).unwrap(); + icx.eval_mir_constant(&constant.literal, Some(constant.span), Some(layout)).unwrap() +} + +// Based on `rustc_codegen_ssa::mir::FunctionCx::eval_mir_constant` +pub fn eval_mir_constant<'tcx>( + tcx: TyCtxt<'tcx>, + constant: &mir::Constant<'tcx>, +) -> interpret::ConstValue<'tcx> { + let uv = match constant.literal { + mir::ConstantKind::Ty(ct) => match ct.kind() { + ty::ConstKind::Unevaluated(uv) => uv.expand(), + ty::ConstKind::Value(val) => { + return tcx.valtree_to_const_val((ct.ty(), val)); + } + err => panic!( + "encountered bad ConstKind after monomorphizing: {:?} span:{:?}", + err, constant.span + ), + }, + mir::ConstantKind::Unevaluated(uv, _) => uv, + mir::ConstantKind::Val(val, _) => return val, + }; + + tcx.const_eval_resolve(ty::ParamEnv::reveal_all(), uv, None).unwrap() +} diff --git a/src/bin/cargo-crux-test.rs b/src/bin/cargo-crux-test.rs index 2629bf4..49fb7f6 100644 --- a/src/bin/cargo-crux-test.rs +++ b/src/bin/cargo-crux-test.rs @@ -1,6 +1,6 @@ //! `cargo crux-test`: Run symbolic tests of the current crate. //! -//! Symbolic tests are identified by the `#[crux_test]` attribute, analogous to the `#[test]` +//! Symbolic tests are identified by the `#[crux::test]` attribute, analogous to the `#[test]` //! attribute used with `cargo test`. Symbolic tests often need to use the `crucible` crate, which //! is unavailable when building normally, and thus should be conditionally compiled using //! `#[cfg(crux)]`. @@ -15,9 +15,10 @@ #![feature(rustc_private)] extern crate cargo; extern crate clap; -extern crate rustc; +extern crate rustc_driver; extern crate rustc_session; extern crate serde_json; +extern crate toml_edit; mod cargo_test_common; use cargo_test_common::*; @@ -27,4 +28,4 @@ fn main() { "Execute all symbolic unit tests of a local package", &Vec::new(), &Vec::new()); -} \ No newline at end of file +} diff --git a/src/bin/cargo-mir-json.rs b/src/bin/cargo-mir-json.rs index 21c77c8..717d28c 100644 --- a/src/bin/cargo-mir-json.rs +++ b/src/bin/cargo-mir-json.rs @@ -47,11 +47,15 @@ fn main() { let manifest_path_arg = env::args().skip(skip).find(|val| { val.starts_with("--manifest-path=") }); + let manifest_path = manifest_path_arg.map(|arg| { + PathBuf::from(Path::new(&arg["--manifest-path=".len()..])) + }); - let mut metadata = if let Ok(metadata) = cargo_metadata::metadata( - manifest_path_arg.as_ref().map(AsRef::as_ref), - ) - { + let mut metadata_command = cargo_metadata::MetadataCommand::new(); + if let Some(manifest_path) = manifest_path.as_ref() { + metadata_command.manifest_path(manifest_path); + } + let mut metadata = if let Ok(metadata) = metadata_command.exec() { metadata } else { let _ = std::io::stderr().write_fmt(format_args!( @@ -60,10 +64,6 @@ fn main() { process::exit(101); }; - let manifest_path = manifest_path_arg.map(|arg| { - PathBuf::from(Path::new(&arg["--manifest-path=".len()..])) - }); - let current_dir = std::env::current_dir(); let package_index = metadata diff --git a/src/bin/cargo-saw-build.rs b/src/bin/cargo-saw-build.rs index ce11349..8d028d3 100644 --- a/src/bin/cargo-saw-build.rs +++ b/src/bin/cargo-saw-build.rs @@ -15,9 +15,10 @@ #![feature(rustc_private)] extern crate cargo; extern crate clap; -extern crate rustc; +extern crate rustc_driver; extern crate rustc_session; extern crate serde_json; +extern crate toml_edit; mod cargo_test_common; use cargo_test_common::*; @@ -27,4 +28,4 @@ fn main() { "Build a MIR JSON file for SAW verification purposes", &vec!["--no-run".to_owned()], &vec![("EXPORT_ALL".to_owned(), "true".to_owned())]); -} \ No newline at end of file +} diff --git a/src/bin/cargo_test_common.rs b/src/bin/cargo_test_common.rs index fa68a5a..a07ec5e 100644 --- a/src/bin/cargo_test_common.rs +++ b/src/bin/cargo_test_common.rs @@ -5,22 +5,25 @@ use std::path::PathBuf; use std::process::{self, Command}; use rustc_session::config::host_triple; use cargo::util::command_prelude::*; +use toml_edit::easy::value::Value as TomlValue; fn cli(subcmd_name: &'static str, subcmd_descr: &'static str) -> App { // Copy-pasted from - // https://github.com/rust-lang/cargo/blob/aa80a984c0121d0808442e2f565171b1bffda3d0/src/bin/cargo/commands/test.rs, + // https://github.com/rust-lang/cargo/blob/ba45764a2c0101a7bac8168f8ea8ba408e9ac6e9/src/bin/cargo/commands/test.rs, // with minor edits to the text. subcommand(subcmd_name) - .setting(AppSettings::TrailingVarArg) + // Subcommand aliases are handled in `aliased_command()`. + // .alias("t") + .trailing_var_arg(true) .about(subcmd_descr) .arg( - Arg::with_name("TESTNAME") + Arg::new("TESTNAME") .help("If specified, only run tests containing this string in their names"), ) .arg( - Arg::with_name("args") + Arg::new("args") .help("Arguments for the test binary") - .multiple(true) + .multiple_values(true) .last(true), ) .arg( @@ -28,7 +31,7 @@ fn cli(subcmd_name: &'static str, subcmd_descr: &'static str) -> App { "quiet", "Display one character per test instead of one line", ) - .short("q"), + .short('q'), ) .arg_targets_all( "Test only this package's library unit tests", @@ -57,7 +60,11 @@ fn cli(subcmd_name: &'static str, subcmd_descr: &'static str) -> App { .arg_target_triple("Build for the target triple") .arg_target_dir() .arg_manifest_path() + .arg_ignore_rust_version() .arg_message_format() + .arg_unit_graph() + .arg_future_incompat_report() + .arg_timings() .after_help("See `cargo test --help` for more information on these options.") } @@ -71,7 +78,7 @@ fn get_override_crates(subcmd_name: &'static str, subcmd_descr: &'static str) -> // test. let config = cargo::Config::default() .unwrap_or_else(|e| panic!("error initializing cargo config: {}", e)); - let app = clap::App::new(format!("cargo-{}", subcmd_name)).subcommand(cli(subcmd_name, subcmd_descr)); + let app = App::new(format!("cargo-{}", subcmd_name)).subcommand(cli(subcmd_name, subcmd_descr)); let args = app.get_matches(); let args = args.subcommand_matches(subcmd_name) .unwrap_or_else(|| panic!(format!("expected {} subcommand", subcmd_name))); @@ -81,7 +88,7 @@ fn get_override_crates(subcmd_name: &'static str, subcmd_descr: &'static str) -> &config, CompileMode::Test, Some(&ws), - ProfileChecking::Unchecked, + ProfileChecking::Custom, ).unwrap_or_else(|e| panic!("error reading compile options: {}", e)); let pkgs = opts.spec.get_packages(&ws) .unwrap_or_else(|e| panic!("error listing packages: {}", e)); @@ -113,12 +120,12 @@ fn get_override_crates(subcmd_name: &'static str, subcmd_descr: &'static str) -> overrides } -fn get_package_override_crates(v: Option<&toml::Value>) -> String { +fn get_package_override_crates(v: Option<&TomlValue>) -> String { get_package_override_crates_opt(v) .unwrap_or_else(String::new) } -fn get_package_override_crates_opt(v: Option<&toml::Value>) -> Option { +fn get_package_override_crates_opt(v: Option<&TomlValue>) -> Option { // The `crux` key is allowed to be missing, but if present, it must be an object. let crux = v?.get("crux")?; assert!(crux.is_table(), "expected `package.metadata.crux` to be an object"); @@ -171,4 +178,4 @@ pub fn cargo_test_common(subcmd_name: &'static str, subcmd_descr: &'static str, // `code` can return `None` if the process was terminated by a signal. We return nonzero // ourselves in that case. process::exit(status.code().unwrap_or(1)); -} \ No newline at end of file +} diff --git a/src/bin/crux-rustc.rs b/src/bin/crux-rustc.rs index b0befcc..35be75e 100644 --- a/src/bin/crux-rustc.rs +++ b/src/bin/crux-rustc.rs @@ -2,6 +2,7 @@ //! crux-test`. Useful for testing a single file, with `crux-rustc --test foo.rs`. #![feature(rustc_private)] +extern crate rustc_driver; extern crate rustc_session; use std::env; diff --git a/src/bin/mir-json-callgraph.rs b/src/bin/mir-json-callgraph.rs index d0c30e5..3a2e307 100644 --- a/src/bin/mir-json-callgraph.rs +++ b/src/bin/mir-json-callgraph.rs @@ -8,7 +8,6 @@ extern crate serde; extern crate serde_cbor; #[macro_use] extern crate serde_json; -extern crate env_logger; extern crate mir_json; use std::collections::{HashMap, HashSet}; @@ -30,11 +29,6 @@ fn main() { if a == b { continue; } - // Don't trace outgoing edges from `ty` nodes to non-`ty` nodes. We still keep the - // incoming edges, so it's possible to trace back all uses of a particular type. - if it.name(a).starts_with("ty::") && !it.name(b).starts_with("ty::") { - continue; - } map.entry(b).or_insert_with(HashSet::new).insert(a); } diff --git a/src/bin/mir-json-dce.rs b/src/bin/mir-json-dce.rs index fbf6eb2..3deafd3 100644 --- a/src/bin/mir-json-dce.rs +++ b/src/bin/mir-json-dce.rs @@ -1,7 +1,7 @@ //! Crude dead code elimination for .mir JSON files. //! //! This program takes in several .mir files, combines them, then runs dead code elimination with -//! `#[crux_test]`s as the roots. This is useful because library .mir files contain entries for +//! `#[crux::test]`s as the roots. This is useful because library .mir files contain entries for //! all "reachable non-generic" items in the library crate, but some of those items are not //! actually used by the top-level crate. We run this pass on the raw JSON in hopes of removing //! constructs that `crucible-mir` can't yet parse. @@ -9,9 +9,9 @@ extern crate serde; extern crate serde_cbor; -extern crate env_logger; #[macro_use] extern crate log; extern crate mir_json; +extern crate rustc_log; use std::env; use std::fs::File; @@ -22,7 +22,7 @@ use mir_json::link; fn main() { - env_logger::init(); + rustc_log::init_env_logger("RUST_LOG").unwrap(); let mut last_time = Instant::now(); let mut measure = || { diff --git a/src/bin/mir-json-rustc-wrapper.rs b/src/bin/mir-json-rustc-wrapper.rs index 9dc15bd..ae8850c 100644 --- a/src/bin/mir-json-rustc-wrapper.rs +++ b/src/bin/mir-json-rustc-wrapper.rs @@ -3,7 +3,6 @@ //! as specified by `--extern` and/or `#![no_std]` and run `crux-mir` on the result. #![feature(rustc_private)] -extern crate rustc; extern crate rustc_codegen_ssa; extern crate rustc_driver; extern crate rustc_interface; @@ -25,7 +24,8 @@ use rustc_interface::Queries; use rustc_session::config::ExternLocation; use std::collections::HashSet; use std::env; -use std::fs::{File, OpenOptions}; +use std::ffi::OsStr; +use std::fs::{File, OpenOptions, read_dir}; use std::io::{self, Write}; use std::iter; use std::os::unix::fs::OpenOptionsExt; @@ -49,28 +49,29 @@ impl rustc_driver::Callbacks for GetOutputPathCallbacks { fn after_parsing<'tcx>( &mut self, - _compiler: &Compiler, + compiler: &Compiler, queries: &'tcx Queries<'tcx>, ) -> Compilation { - // This phase runs with `--cfg crux`, so some `#[crux_test]` attrs may be visible. Even + // This phase runs with `--cfg crux`, so some `#[crux::test]` attrs may be visible. Even // the limited amount of compilation we do will fail without the injected `register_attr`. analyz::inject_attrs(queries); - Compilation::Continue - } - fn after_analysis<'tcx>( - &mut self, - compiler: &Compiler, - queries: &'tcx Queries<'tcx>, - ) -> Compilation { let sess = compiler.session(); - let crate_name = queries.crate_name().unwrap().peek(); - let outputs = queries.prepare_outputs().unwrap().peek(); + let (crate_name, outputs) = { + // rustc_session::find_crate_name - get the crate with queries.expansion? + let krate = queries.parse().unwrap(); + let krate = krate.borrow(); + let crate_name = rustc_session::output::find_crate_name(&sess, &krate.attrs); + let outputs = compiler.build_output_filenames(&sess, &krate.attrs); + (crate_name, outputs) + }; + // Advance the state slightly further, initializing crate_types() + queries.register_plugins(); self.output_path = Some(rustc_session::output::out_filename( sess, - sess.crate_types.get().first().unwrap().clone(), + sess.crate_types().first().unwrap().clone(), &outputs, - &crate_name, + crate_name, )); Compilation::Stop } @@ -81,12 +82,7 @@ fn get_output_path(args: &[String], use_override_crates: &HashSet) -> Pa output_path: None, use_override_crates: use_override_crates.clone(), }; - rustc_driver::run_compiler( - &args, - &mut callbacks, - None, - None, - ).unwrap(); + rustc_driver::RunCompiler::new(&args, &mut callbacks).run().unwrap(); callbacks.output_path.unwrap() } @@ -187,7 +183,10 @@ fn go() { if let Ok(s) = env::var("CRUX_RUST_LIBRARY_PATH").or(env::var("SAW_RUST_LIBRARY_PATH")) { args.push("-L".into()); - args.push(s); + args.push(s.clone()); + + args.push("--sysroot".into()); + args.push(s.clone()); } let mut use_override_crates = HashSet::new(); @@ -209,16 +208,14 @@ fn go() { eprintln!("normal build - {:?}", args); // This is a normal, non-test build. Just run the build, generating a `.mir` file // alongside the normal output. - rustc_driver::run_compiler( + rustc_driver::RunCompiler::new( &args, &mut MirJsonCallbacks { analysis_data: None, use_override_crates: use_override_crates.clone(), export_style, }, - None, - None, - ).unwrap(); + ).run().unwrap(); return; }, Some(x) => x, @@ -252,12 +249,7 @@ fn go() { use_override_crates: use_override_crates.clone(), export_style, }; - rustc_driver::run_compiler( - &args, - &mut callbacks, - None, - None, - ).unwrap(); + rustc_driver::RunCompiler::new(&args, &mut callbacks).run().unwrap(); let data = callbacks.analysis_data .expect("failed to find main MIR path"); diff --git a/src/bin/mir-json.rs b/src/bin/mir-json.rs index 119b044..b5a89ae 100644 --- a/src/bin/mir-json.rs +++ b/src/bin/mir-json.rs @@ -1,6 +1,5 @@ #![feature(rustc_private)] -extern crate rustc; extern crate rustc_codegen_ssa; extern crate rustc_driver; extern crate rustc_interface; @@ -15,8 +14,8 @@ extern crate mir_json; use mir_json::analyz; use rustc_driver::Compilation; -use rustc_interface::interface::Compiler; use rustc_interface::Queries; +use rustc_interface::interface::Compiler; use std::env; struct MirJsonCallbacks { @@ -63,12 +62,7 @@ fn go() { analyz::ExportStyle::ExportCruxTests }; - rustc_driver::run_compiler( - &args, // args: &[String] - &mut MirJsonCallbacks { export_style }, - None, - None, - ).unwrap(); + rustc_driver::RunCompiler::new(&args, &mut MirJsonCallbacks { export_style }).run().unwrap(); } fn main() { diff --git a/src/bin/saw-rustc.rs b/src/bin/saw-rustc.rs index 74af53d..120ef8c 100644 --- a/src/bin/saw-rustc.rs +++ b/src/bin/saw-rustc.rs @@ -2,6 +2,7 @@ //! saw-build`. Useful for building a single file, with `saw-rustc foo.rs`. #![feature(rustc_private)] +extern crate rustc_driver; extern crate rustc_session; use std::env; diff --git a/src/bin/wrapper.rs b/src/bin/wrapper.rs index a593384..1b86c7b 100644 --- a/src/bin/wrapper.rs +++ b/src/bin/wrapper.rs @@ -26,7 +26,7 @@ const LIB_PATH_VAR: &str = "LD_LIBRARY_PATH"; #[cfg(target_os = "macos")] const LIB_PATH_VAR: &str = "DYLD_LIBRARY_PATH"; -const TOOLCHAIN: &str = "nightly-2020-03-22"; +const TOOLCHAIN: &str = "nightly-2023-01-23"; fn find_lib_dir() -> PathBuf { let output = Command::new("rustc") diff --git a/src/lib.rs b/src/lib.rs index 4423b80..220ecb3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -7,19 +7,19 @@ extern crate serde_cbor; #[macro_use] extern crate serde_derive; extern crate tar; -extern crate rustc; extern crate rustc_ast; -//extern crate rustc_codegen_utils; +extern crate rustc_const_eval; extern crate rustc_driver; extern crate rustc_data_structures; extern crate rustc_hir; extern crate rustc_index; extern crate rustc_interface; -extern crate rustc_mir; +extern crate rustc_middle; +extern crate rustc_monomorphize; +extern crate rustc_query_system; extern crate rustc_session; extern crate rustc_span; extern crate rustc_target; -//extern crate syntax; pub mod analyz; pub mod lib_util;