diff --git a/.vscode/dictionaries/rust.txt b/.vscode/dictionaries/rust.txt index 4082490c..0eec2643 100644 --- a/.vscode/dictionaries/rust.txt +++ b/.vscode/dictionaries/rust.txt @@ -2,6 +2,7 @@ alloc bitreverse bitvector bswap +carryless chrono clippy ctlz diff --git a/.vscode/dictionaries/rustc.txt b/.vscode/dictionaries/rustc.txt index 14cfdfb0..c2c6481e 100644 --- a/.vscode/dictionaries/rustc.txt +++ b/.vscode/dictionaries/rustc.txt @@ -11,6 +11,8 @@ krate monomorphized nullary pointee +reborrow +Retag rlib RPATH rustc diff --git a/Cargo.lock b/Cargo.lock index bcb3554e..d8fef675 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,29 +2,14 @@ # It is not intended for manual editing. version = 4 -[[package]] -name = "addr2line" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" -dependencies = [ - "gimli", -] - -[[package]] -name = "adler2" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" - [[package]] name = "ahash" -version = "0.8.11" +version = "0.8.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" +checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" dependencies = [ "cfg-if", - "getrandom", + "getrandom 0.3.4", "once_cell", "version_check", "zerocopy", @@ -32,25 +17,13 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "1.1.3" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301" dependencies = [ "memchr", ] -[[package]] -name = "allocator-api2" -version = "0.2.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45862d1c77f2228b9e10bc609d5bc203d86ebc9b87ad8d5d5167a6c9abf739d9" - -[[package]] -name = "android-tzdata" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" - [[package]] name = "android_system_properties" version = "0.1.5" @@ -62,9 +35,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.18" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b" +checksum = "824a212faf96e9acacdbd09febd34438f8f711fb84e09a8916013cd7815ca28d" dependencies = [ "anstyle", "anstyle-parse", @@ -77,36 +50,37 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.10" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9" +checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000" [[package]] name = "anstyle-parse" -version = "0.2.6" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9" +checksum = "52ce7f38b242319f7cabaa6813055467063ecdc9d355bbb4ce0c68908cd8130e" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.1.2" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c" +checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] name = "anstyle-wincon" -version = "3.0.6" +version = "3.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2109dbce0e72be3ec00bed26e6a7479ca384ad226efdd66db8fa2e3a38c83125" +checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" dependencies = [ "anstyle", - "windows-sys 0.59.0", + "once_cell_polyfill", + "windows-sys 0.61.2", ] [[package]] @@ -117,15 +91,15 @@ checksum = "7d902e3d592a523def97af8f317b08ce16b7ab854c1985a0c671e6f15cebc236" [[package]] name = "arrayvec" -version = "0.7.6" +version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" +checksum = "d3fb67a6e08acf24fdeccbac2cb6ac4305825bd1f117462e0e6f2f193345ad56" [[package]] name = "async-trait" -version = "0.1.74" +version = "0.1.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" +checksum = "9035ad2d096bed7955a320ee7e2230574d28fd3c3a0f186cbea1ff3c7eed5dbb" dependencies = [ "proc-macro2", "quote", @@ -134,24 +108,9 @@ dependencies = [ [[package]] name = "autocfg" -version = "1.3.0" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" - -[[package]] -name = "backtrace" -version = "0.3.74" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" -dependencies = [ - "addr2line", - "cfg-if", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", - "windows-targets 0.52.6", -] +checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53" [[package]] name = "base64" @@ -191,7 +150,7 @@ version = "0.70.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f49d8fed880d473ea71efb9bf597651e77201bdd4893efe54c9e5d65ae04ce6f" dependencies = [ - "bitflags 2.8.0", + "bitflags", "cexpr", "clang-sys", "itertools 0.13.0", @@ -199,23 +158,17 @@ dependencies = [ "quote", "regex", "rustc-hash", - "shlex", + "shlex 1.3.0", "syn", ] [[package]] name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "bitflags" -version = "2.8.0" +version = "2.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f68f53c83ab957f72c32642f3868eec03eb974d1fb82e453128456482613d36" +checksum = "b4388bee8683e3d04af747c73422af53102d2bd24d9eadb6cbc100baef4b43f8" dependencies = [ - "serde", + "serde_core", ] [[package]] @@ -229,25 +182,25 @@ dependencies = [ [[package]] name = "bstr" -version = "1.7.0" +version = "1.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c79ad7fb2dd38f3dabd76b09c6a5a20c038fc0213ef1e9afd30eb777f120f019" +checksum = "5cee35f73844aa3014bb606320a6c1f010249dbdf43342fe54b5a4f6a8ed4b79" dependencies = [ "memchr", - "serde", + "serde_core", ] [[package]] name = "bumpalo" -version = "3.16.0" +version = "3.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" +checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649" [[package]] name = "bytecheck" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50690fb3370fb9fe3550372746084c46f2ac8c9685c583d2be10eefd89d3d1a3" +checksum = "0caa33a2c0edca0419d15ac723dff03f1956f7978329b1e3b5fdaaaed9d3ca8b" dependencies = [ "bytecheck_derive", "ptr_meta", @@ -257,9 +210,9 @@ dependencies = [ [[package]] name = "bytecheck_derive" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efb7846e0cb180355c2dec69e721edafa36919850f1a9f52ffba4ebc0393cb71" +checksum = "89385e82b5d1821d2219e0b095efa2cc1f246cbf99080f3be46a1a85c0d392d9" dependencies = [ "proc-macro2", "quote", @@ -268,17 +221,18 @@ dependencies = [ [[package]] name = "bytes" -version = "1.10.1" +version = "1.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" +checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04" [[package]] name = "cc" -version = "1.2.5" +version = "1.2.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c31a0499c1dc64f458ad13872de75c0eb7e3fdb0e67964610c914b034fc5956e" +checksum = "e17dd265a7d0f31ef544e1b20e03add05d3b45b491b633b10d67145d2acc1a38" dependencies = [ - "shlex", + "find-msvc-tools", + "shlex 2.0.1", ] [[package]] @@ -292,29 +246,28 @@ dependencies = [ [[package]] name = "cfg-if" -version = "1.0.0" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" [[package]] name = "chrono" -version = "0.4.38" +version = "0.4.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" +checksum = "1aa79e62e7697b8e29b513a68abacf485adcd1fe8284a4316c5ae868e6633327" dependencies = [ - "android-tzdata", "iana-time-zone", "js-sys", "num-traits", "wasm-bindgen", - "windows-targets 0.52.6", + "windows-link", ] [[package]] name = "clang-sys" -version = "1.6.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77ed9a53e5d4d9c573ae844bfac6872b159cb1d1585a83b29e7a64b7eef7332a" +checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4" dependencies = [ "glob", "libc", @@ -323,9 +276,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.21" +version = "4.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb3b4b9e5a7c7514dfa52869339ee98b3156b0bfb4e8a77c4ff4babb64b1604f" +checksum = "1ddb117e43bbf7dacf0a4190fef4d345b9bad68dfc649cb349e7d17d28428e51" dependencies = [ "clap_builder", "clap_derive", @@ -333,9 +286,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.21" +version = "4.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b17a95aa67cc7b5ebd32aa5370189aa0d79069ef1c64ce893bd30fb24bff20ec" +checksum = "714a53001bf66416adb0e2ef5ac857140e7dc3a0c48fb28b2f10762fc4b5069f" dependencies = [ "anstream", "anstyle", @@ -345,9 +298,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.18" +version = "4.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab" +checksum = "f2ce8604710f6733aa641a2b3731eaa1e8b3d9973d5e3565da11800813f997a9" dependencies = [ "heck", "proc-macro2", @@ -357,9 +310,9 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.7.3" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afb84c814227b90d6895e01398aee0d8033c00e7466aca416fb6a8e0eb19d8a7" +checksum = "c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9" [[package]] name = "clippy-tracing-attributes" @@ -369,9 +322,9 @@ checksum = "4cc1f3bbafdf6613bd4a8d8a37970632074798bb892ef8f57c2c09854e3c3afa" [[package]] name = "colorchoice" -version = "1.0.3" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" +checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570" [[package]] name = "common" @@ -396,7 +349,7 @@ name = "compiler" version = "0.2.0" dependencies = [ "bimap", - "bitflags 2.8.0", + "bitflags", "common", "config", "const_format", @@ -404,11 +357,11 @@ dependencies = [ "derive_more", "glob", "ignore", - "itertools 0.14.0", + "itertools 0.15.0", "macros", "paste", "regex-lite", - "ron", + "ron 0.8.1", "runtime_noop", "runtime_symex_li", "runtime_symex_li_no_implicit", @@ -421,41 +374,41 @@ dependencies = [ [[package]] name = "config" -version = "0.15.7" +version = "0.15.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e26695492a475c4a091cfda61446d5ba01aac2e1dfbcd27a12fdd11aa2e32596" +checksum = "b85f248a4de22d204ceabc6299d89d2c70fbd7f09fea53c06c852369652d8139" dependencies = [ "async-trait", - "convert_case", + "convert_case 0.6.0", "json5", "pathdiff", - "ron", + "ron 0.12.2", "rust-ini", - "serde", + "serde-untagged", + "serde_core", "serde_json", "toml", - "winnow 0.7.0", + "winnow", "yaml-rust2", ] [[package]] name = "console" -version = "0.15.11" +version = "0.16.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "054ccb5b10f9f2cbf51eb355ca1d05c2d279ce1804688d0db74b4733a5aeafd8" +checksum = "4fe5f465a4f6fee88fad41b85d990f84c835335e85b5d9e6e63e0d06d28cba7c" dependencies = [ "encode_unicode", "libc", - "once_cell", - "unicode-width 0.2.0", - "windows-sys 0.59.0", + "unicode-width", + "windows-sys 0.61.2", ] [[package]] name = "const-random" -version = "0.1.17" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aaf16c9c2c612020bcfd042e170f6e32de9b9d75adb5277cdbbd2e2c8c8299a" +checksum = "87e00182fe74b066627d63b85fd550ac2998d4b0bd86bfed477a0ae4c7c71359" dependencies = [ "const-random-macro", ] @@ -466,18 +419,19 @@ version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f9d839f2a20b0aee515dc581a6172f2321f96cab76c1a38a4c584a194955390e" dependencies = [ - "getrandom", + "getrandom 0.2.17", "once_cell", "tiny-keccak", ] [[package]] name = "const_format" -version = "0.2.34" +version = "0.2.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "126f97965c8ad46d6d9163268ff28432e8f6a1196a55578867832e3049df63dd" +checksum = "4481a617ad9a412be3b97c5d403fef8ed023103368908b9c50af598ff467cc1e" dependencies = [ "const_format_proc_macros", + "konst", ] [[package]] @@ -500,35 +454,44 @@ dependencies = [ "unicode-segmentation", ] +[[package]] +name = "convert_case" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "633458d4ef8c78b72454de2d54fd6ab2e60f9e02be22f3c6104cdc8a4e0fceb9" +dependencies = [ + "unicode-segmentation", +] + [[package]] name = "core-foundation-sys" -version = "0.8.6" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "cpufeatures" -version = "0.2.11" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce420fe07aecd3e67c5f910618fe65e94158f6dcc0adf44e00d69ce2bdfe0fd0" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" dependencies = [ "libc", ] [[package]] name = "crossbeam-channel" -version = "0.5.15" +version = "0.5.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82b8f8f868b36967f9606790d1903570de9ceaf870a7bf9fbbd3016d636a2cb2" +checksum = "d85363c37faeca707aef026efa9f3b34d077bce547e48f770770625c6013679e" dependencies = [ "crossbeam-utils", ] [[package]] name = "crossbeam-deque" -version = "0.8.5" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" +checksum = "5181e0de7b61eb03a81e347d6dd8797bae9da5146707b51077e2d71a54ec0ceb" dependencies = [ "crossbeam-epoch", "crossbeam-utils", @@ -536,30 +499,30 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.18" +version = "0.9.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +checksum = "2d6914041f254d6e9176c01941b21115dcfb7089e55135a35411081bd106ef3f" dependencies = [ "crossbeam-utils", ] [[package]] name = "crossbeam-utils" -version = "0.8.20" +version = "0.8.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" +checksum = "61803da095bee82a81bb1a452ecc25d3b2f1416d1897eb86430c6159ef717c17" [[package]] name = "crunchy" -version = "0.2.2" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" +checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" [[package]] name = "crypto-common" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" dependencies = [ "generic-array", "typenum", @@ -567,30 +530,30 @@ dependencies = [ [[package]] name = "csv" -version = "1.3.1" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acdc4883a9c96732e4733212c01447ebd805833b7275a73ca3ee080fd77afdaf" +checksum = "52cd9d68cf7efc6ddfaaee42e7288d3a99d613d4b50f76ce9827ae0c6e14f938" dependencies = [ "csv-core", "itoa", "ryu", - "serde", + "serde_core", ] [[package]] name = "csv-core" -version = "0.1.12" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d02f3b0da4c6504f86e9cd789d8dbafab48c2321be74e9987593de5a894d93d" +checksum = "704a3c26996a80471189265814dbc2c257598b96b8a7feae2d31ace646bb9782" dependencies = [ "memchr", ] [[package]] name = "delegate" -version = "0.13.2" +version = "0.13.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "297806318ef30ad066b15792a8372858020ae3ca2e414ee6c2133b1eb9e9e945" +checksum = "780eb241654bf097afb00fc5f054a09b687dad862e485fdcf8399bb056565370" dependencies = [ "proc-macro2", "quote", @@ -599,31 +562,29 @@ dependencies = [ [[package]] name = "deranged" -version = "0.4.0" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c9e6a11ca8224451684bc0d7d5a7adbf8f2fd6887261a1cfc3c0432f9d4068e" -dependencies = [ - "powerfmt", -] +checksum = "7cd812cc2bc1d69d4764bd80df88b4317eaef9e773c75226407d9bc0876b211c" [[package]] name = "derive_more" -version = "1.0.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a9b99b9cbbe49445b21764dc0625032a89b145a2642e67603e1c936f5458d05" +checksum = "d751e9e49156b02b44f9c1815bcb94b984cdcc4396ecc32521c739452808b134" dependencies = [ "derive_more-impl", ] [[package]] name = "derive_more-impl" -version = "1.0.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb7330aeadfbe296029522e6c40f315320aba36fc43a5b3632f3795348f3bd22" +checksum = "799a97264921d8623a957f6c3b9011f3b5492f557bbb7a5a19b7fa6d06ba8dcb" dependencies = [ - "convert_case", + "convert_case 0.10.0", "proc-macro2", "quote", + "rustc_version", "syn", "unicode-xid", ] @@ -655,9 +616,9 @@ dependencies = [ [[package]] name = "either" -version = "1.13.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" +checksum = "91622ff5e7162018101f2fea40d6ebf4a78bbe5a49736a2020649edf9693679e" [[package]] name = "encode_unicode" @@ -676,22 +637,43 @@ dependencies = [ [[package]] name = "equivalent" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" [[package]] -name = "filetime" -version = "0.2.25" +name = "erased-serde" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35c0522e981e68cbfa8c3f978441a5f34b30b96e146b33cd3359176b50fe8586" +checksum = "d2add8a07dd6a8d93ff627029c51de145e12686fbc36ecb298ac22e74cf02dec" +dependencies = [ + "serde", + "serde_core", + "typeid", +] + +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ - "cfg-if", "libc", - "libredox", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] +[[package]] +name = "find-msvc-tools" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" + +[[package]] +name = "foldhash" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" + [[package]] name = "fsevent-sys" version = "4.1.0" @@ -703,9 +685,9 @@ dependencies = [ [[package]] name = "futures" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" +checksum = "8b147ee9d1f6d097cef9ce628cd2ee62288d963e16fb287bd9286455b241382d" dependencies = [ "futures-channel", "futures-core", @@ -718,9 +700,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" +checksum = "07bbe89c50d7a535e539b8c17bc0b49bdb77747034daa8087407d655f3f7cc1d" dependencies = [ "futures-core", "futures-sink", @@ -728,15 +710,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" +checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d" [[package]] name = "futures-executor" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" +checksum = "baf29c38818342a3b26b5b923639e7b1f4a61fc5e76102d4b1981c6dc7a7579d" dependencies = [ "futures-core", "futures-task", @@ -745,15 +727,15 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" +checksum = "cecba35d7ad927e23624b22ad55235f2239cfa44fd10428eecbeba6d6a717718" [[package]] name = "futures-macro" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" +checksum = "e835b70203e41293343137df5c0664546da5745f82ec9b84d40be8336958447b" dependencies = [ "proc-macro2", "quote", @@ -762,21 +744,21 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" +checksum = "c39754e157331b013978ec91992bde1ac089843443c49cbc7f46150b0fad0893" [[package]] name = "futures-task" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" +checksum = "037711b3d59c33004d3856fbdc83b99d4ff37a24768fa1be9ce3538a1cde4393" [[package]] name = "futures-util" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" +checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6" dependencies = [ "futures-channel", "futures-core", @@ -786,21 +768,22 @@ dependencies = [ "futures-task", "memchr", "pin-project-lite", - "pin-utils", "slab", ] [[package]] name = "generator" -version = "0.8.2" +version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "979f00864edc7516466d6b3157706e06c032f22715700ddd878228a91d02bc56" +checksum = "b3b854b0e584ead1a33f18b2fcad7cf7be18b3875c78816b753639aa501513ae" dependencies = [ + "cc", "cfg-if", "libc", "log", "rustversion", - "windows", + "windows-link", + "windows-result", ] [[package]] @@ -815,9 +798,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.11" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" dependencies = [ "cfg-if", "libc", @@ -825,28 +808,45 @@ dependencies = [ ] [[package]] -name = "gimli" -version = "0.31.1" +name = "getrandom" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +dependencies = [ + "cfg-if", + "libc", + "r-efi 5.3.0", + "wasip2", +] + +[[package]] +name = "getrandom" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" +checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099" +dependencies = [ + "cfg-if", + "libc", + "r-efi 6.0.0", +] [[package]] name = "glob" -version = "0.3.1" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" +checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280" [[package]] name = "globset" -version = "0.4.14" +version = "0.4.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57da3b9b5b85bd66f31093f8c408b90a74431672542466497dcbdfdc02034be1" +checksum = "52dfc19153a48bde0cbd630453615c8151bce3a5adfac7a0aebfbf0a1e1f57e3" dependencies = [ "aho-corasick", "bstr", "log", - "regex-automata 0.4.7", - "regex-syntax 0.8.2", + "regex-automata", + "regex-syntax", ] [[package]] @@ -854,24 +854,29 @@ name = "hashbrown" version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" + +[[package]] +name = "hashbrown" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" dependencies = [ - "ahash", - "allocator-api2", + "foldhash", ] [[package]] name = "hashbrown" -version = "0.15.2" +version = "0.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" +checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" [[package]] name = "hashlink" -version = "0.8.4" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8094feaf31ff591f651a2664fb9cfd92bba7a60ce3197265e9482ebe753c8f7" +checksum = "824e001ac4f3012dd16a264bec811403a67ca9deb6c102fc5049b32c4574b35f" dependencies = [ - "hashbrown 0.14.5", + "hashbrown 0.16.1", ] [[package]] @@ -882,16 +887,17 @@ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] name = "iana-time-zone" -version = "0.1.60" +version = "0.1.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" +checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" dependencies = [ "android_system_properties", "core-foundation-sys", "iana-time-zone-haiku", "js-sys", + "log", "wasm-bindgen", - "windows-core 0.52.0", + "windows-core", ] [[package]] @@ -905,15 +911,15 @@ dependencies = [ [[package]] name = "ignore" -version = "0.4.22" +version = "0.4.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b46810df39e66e925525d6e38ce1e7f6e1d208f72dc39757880fcb66e2c58af1" +checksum = "2adf14691c72bcfc1058740436a35bdd3ae9c07d1a941ef00b749e9ea16aefa7" dependencies = [ "crossbeam-deque", "globset", "log", "memchr", - "regex-automata 0.4.7", + "regex-automata", "same-file", "walkdir", "winapi-util", @@ -921,53 +927,53 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.7.0" +version = "2.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62f822373a4fe84d4bb149bf54e584a7f4abec90e072ed49cda0edea5b95471f" +checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9" dependencies = [ "equivalent", - "hashbrown 0.15.2", + "hashbrown 0.17.1", ] [[package]] name = "indicatif" -version = "0.17.11" +version = "0.18.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "183b3088984b400f4cfac3620d5e076c84da5364016b4f49473de574b2586235" +checksum = "9433806cd6b4ec1aba79c021c7e4c58fb4c3b9977c085062e611ac929998fb0c" dependencies = [ "console", - "number_prefix", "portable-atomic", - "unicode-width 0.2.0", + "unicode-width", + "unit-prefix", "vt100", "web-time", ] [[package]] name = "inotify" -version = "0.11.0" +version = "0.11.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f37dccff2791ab604f9babef0ba14fbe0be30bd368dc541e2b08d07c8aa908f3" +checksum = "153be1941a183ec9ccd095ddbe17a8b8d435ef6c76e9e02451b933c3999af2c8" dependencies = [ - "bitflags 2.8.0", + "bitflags", "inotify-sys", "libc", ] [[package]] name = "inotify-sys" -version = "0.1.5" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e05c02b5e89bff3b946cedeca278abc628fe811e604f027c45a8aa3cf793d0eb" +checksum = "c033f80b2c113cdf91ab7a33faa9cbc014726dcad99880c8609af2a370edf37d" dependencies = [ "libc", ] [[package]] name = "is_terminal_polyfill" -version = "1.70.1" +version = "1.70.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" +checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" [[package]] name = "itertools" @@ -980,39 +986,41 @@ dependencies = [ [[package]] name = "itertools" -version = "0.14.0" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285" +checksum = "8b4baf93f58d4425749ca49a51c50ebab072c5df6994d08fed93541c331481dc" dependencies = [ "either", ] [[package]] name = "itoa" -version = "1.0.9" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" +checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" [[package]] name = "js-sys" -version = "0.3.69" +version = "0.3.103" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" +checksum = "53b44bfcdb3f8d5837a46dae1ca9660a837176eee74a28b229bc626816589102" dependencies = [ + "cfg-if", + "futures-util", "wasm-bindgen", ] [[package]] name = "json-subscriber" -version = "0.2.7" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6456771bcb3511e2afa6a6a8c9ce2730be80803116a2839931476740ab3b86bc" +checksum = "b1a3442048fd2d18bf39b182881bea8de640062f86cbacf6d949478af61651d6" dependencies = [ "serde", "serde_json", "tracing", "tracing-core", - "tracing-serde 0.2.0", + "tracing-serde", "tracing-subscriber", "uuid", ] @@ -1028,11 +1036,26 @@ dependencies = [ "serde", ] +[[package]] +name = "konst" +version = "0.2.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "128133ed7824fcd73d6e7b17957c5eb7bacb885649bd8c69708b2331a10bcefb" +dependencies = [ + "konst_macro_rules", +] + +[[package]] +name = "konst_macro_rules" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4933f3f57a8e9d9da04db23fb153356ecaf00cbd14aee46279c33dc80925c37" + [[package]] name = "kqueue" -version = "1.0.8" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7447f1ca1b7b563588a205fe93dea8df60fd981423a768bc1c0ded35ed147d0c" +checksum = "273c0752728918e0ac4976f2b275b6fefb9ecd400585dec929419f3844cd87b5" dependencies = [ "kqueue-sys", "libc", @@ -1040,62 +1063,50 @@ dependencies = [ [[package]] name = "kqueue-sys" -version = "1.0.4" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed9625ffda8729b85e45cf04090035ac368927b8cebc34898e7c120f52e4838b" +checksum = "07293a4e297ac234359b510362495713f75ea345d5307140414f20c69ffeb087" dependencies = [ - "bitflags 1.3.2", + "bitflags", "libc", ] [[package]] name = "lazy_static" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.168" +version = "0.2.186" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aaeb2981e0606ca11d79718f8bb01164f1d6ed75080182d3abf017e6d244b6d" +checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66" [[package]] name = "libloading" -version = "0.7.4" +version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" +checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55" dependencies = [ "cfg-if", - "winapi", -] - -[[package]] -name = "libredox" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" -dependencies = [ - "bitflags 2.8.0", - "libc", - "redox_syscall", + "windows-link", ] [[package]] name = "lock_api" -version = "0.4.12" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" dependencies = [ - "autocfg", "scopeguard", ] [[package]] name = "log" -version = "0.4.22" +version = "0.4.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" +checksum = "0ceec5bc11778974d1bcb055b18002eba7f4b3518b6a0081b3af5f21666da9ad" [[package]] name = "loom" @@ -1123,18 +1134,18 @@ dependencies = [ [[package]] name = "matchers" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" +checksum = "d1525a2a28c7f4fa0fc98bb91ae755d1e2d1505079e05539e35bc876b5d65ae9" dependencies = [ - "regex-automata 0.1.10", + "regex-automata", ] [[package]] name = "memchr" -version = "2.6.4" +version = "2.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" +checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" [[package]] name = "minimal-lexical" @@ -1142,41 +1153,32 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" -[[package]] -name = "miniz_oxide" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ffbe83022cedc1d264172192511ae958937694cd57ce297164951b8b3568394" -dependencies = [ - "adler2", -] - [[package]] name = "mio" -version = "1.0.3" +version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd" +checksum = "30d65c71f1ce40ab09135ce117d742b9f8a19ff91a41a8b57ed50bc2de59c427" dependencies = [ "libc", "log", "wasi", - "windows-sys 0.52.0", + "windows-sys 0.61.2", ] [[package]] name = "munge" -version = "0.4.3" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0091202c98cf06da46c279fdf50cccb6b1c43b4521abdf6a27b4c7e71d5d9d7" +checksum = "5e17401f259eba956ca16491461b6e8f72913a0a114e39736ce404410f915a0c" dependencies = [ "munge_macro", ] [[package]] name = "munge_macro" -version = "0.4.3" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "734799cf91479720b2f970c61a22850940dd91e27d4f02b1c6fc792778df2459" +checksum = "4568f25ccbd45ab5d5603dc34318c1ec56b117531781260002151b8530a9f931" dependencies = [ "proc-macro2", "quote", @@ -1195,12 +1197,11 @@ dependencies = [ [[package]] name = "notify" -version = "8.0.0" +version = "8.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fee8403b3d66ac7b26aee6e40a897d85dc5ce26f44da36b8b73e987cc52e943" +checksum = "4d3d07927151ff8575b7087f245456e549fea62edf0ec4e565a5ee50c8402bc3" dependencies = [ - "bitflags 2.8.0", - "filetime", + "bitflags", "fsevent-sys", "inotify", "kqueue", @@ -1209,32 +1210,25 @@ dependencies = [ "mio", "notify-types", "walkdir", - "windows-sys 0.59.0", + "windows-sys 0.60.2", ] [[package]] name = "notify-types" -version = "2.0.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e0826a989adedc2a244799e823aece04662b66609d96af8dff7ac6df9a8925d" - -[[package]] -name = "nu-ansi-term" -version = "0.46.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +checksum = "42b8cfee0e339a0337359f3c88165702ac6e600dc01c0cc9579a92d62b08477a" dependencies = [ - "overload", - "winapi", + "bitflags", ] [[package]] name = "nu-ansi-term" -version = "0.50.0" +version = "0.50.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd2800e1520bdc966782168a627aa5d1ad92e33b984bf7c7615d31280c83ff14" +checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.61.2", ] [[package]] @@ -1253,9 +1247,9 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.4.6" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" +checksum = "c89e69e7e0f03bea5ef08013795c25018e101932225a656383bd384495ecc367" dependencies = [ "num-integer", "num-traits", @@ -1272,9 +1266,9 @@ dependencies = [ [[package]] name = "num-conv" -version = "0.1.0" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" +checksum = "521739c6d2bac4aa25192232afe6841231376b2b26d4d9fae5ecf8ca5772e441" [[package]] name = "num-integer" @@ -1287,11 +1281,10 @@ dependencies = [ [[package]] name = "num-iter" -version = "0.1.45" +version = "0.1.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" +checksum = "c92800bd69a1eac91786bcfe9da64a897eb72911b8dc3095decbd07429e8048b" dependencies = [ - "autocfg", "num-integer", "num-traits", ] @@ -1326,34 +1319,25 @@ dependencies = [ ] [[package]] -name = "number_prefix" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" - -[[package]] -name = "object" -version = "0.36.7" +name = "once_cell" +version = "1.21.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87" -dependencies = [ - "memchr", -] +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" [[package]] -name = "once_cell" -version = "1.19.0" +name = "once_cell_polyfill" +version = "1.70.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" [[package]] name = "once_map" -version = "0.4.21" +version = "0.4.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7bd2cae3bec3936bbed1ccc5a3343b3738858182419f9c0522c7260c80c430b0" +checksum = "b685c8311c9171d1bd2895222965d25616b2de2cb5819dd3504ed9250df9fecd" dependencies = [ "ahash", - "hashbrown 0.15.2", + "hashbrown 0.17.1", "parking_lot", "stable_deref_trait", ] @@ -1370,7 +1354,7 @@ dependencies = [ "disjoint", "futures", "glob", - "itertools 0.14.0", + "itertools 0.15.0", "notify", "rkyv", "serde", @@ -1394,17 +1378,11 @@ dependencies = [ "hashbrown 0.14.5", ] -[[package]] -name = "overload" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" - [[package]] name = "parking_lot" -version = "0.12.3" +version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" dependencies = [ "lock_api", "parking_lot_core", @@ -1412,45 +1390,44 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.10" +version = "0.9.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" dependencies = [ "cfg-if", "libc", "redox_syscall", "smallvec", - "windows-targets 0.52.6", + "windows-link", ] [[package]] name = "paste" -version = "1.0.14" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" [[package]] name = "pathdiff" -version = "0.2.1" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" +checksum = "df94ce210e5bc13cb6651479fa48d14f601d9858cfe0467f43ae157023b938d3" [[package]] name = "pest" -version = "2.7.5" +version = "2.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae9cee2a55a544be8b89dc6848072af97a20f2422603c10865be2a42b580fff5" +checksum = "47627dd7305c6a2d6c8c6bcd24c5a4c17dbbf425f4f9c5313e724b38fc9782e9" dependencies = [ "memchr", - "thiserror 1.0.50", "ucd-trie", ] [[package]] name = "pest_derive" -version = "2.7.5" +version = "2.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81d78524685f5ef2a3b3bd1cafbc9fcabb036253d9b1463e726a91cd16e2dfc2" +checksum = "4b4254325ecad416ab689e27ba51da03ba01a9632bc6e108f5fe7c3c4ad29d58" dependencies = [ "pest", "pest_generator", @@ -1458,9 +1435,9 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.7.5" +version = "2.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68bd1206e71118b5356dae5ddc61c8b11e28b09ef6a31acbd15ea48a28e0c227" +checksum = "6c4c0e91ead7a8f7acecbca6f003fc2e8282b1dbe2dd9c9d2f16aba42995e0a7" dependencies = [ "pest", "pest_meta", @@ -1471,38 +1448,30 @@ dependencies = [ [[package]] name = "pest_meta" -version = "2.7.5" +version = "2.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c747191d4ad9e4a4ab9c8798f1e82a39affe7ef9648390b7e5548d18e099de6" +checksum = "f9744bc48116fee06334924bb5f2bad41eed5e89bd26e29b0b799f9a3f82c210" dependencies = [ - "once_cell", "pest", - "sha2", ] [[package]] name = "pin-project-lite" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" - -[[package]] -name = "pin-utils" -version = "0.1.0" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" [[package]] name = "pkg-config" -version = "0.3.31" +version = "0.3.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" +checksum = "19f132c84eca552bf34cab8ec81f1c1dcc229b811638f9d283dceabe58c5569e" [[package]] name = "portable-atomic" -version = "1.11.0" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "350e9b48cbc6b0e028b0473b114454c6316e57336ee184ceab6e53f72c178b3e" +checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49" [[package]] name = "powerfmt" @@ -1512,27 +1481,27 @@ checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" [[package]] name = "proc-macro2" -version = "1.0.92" +version = "1.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" +checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" dependencies = [ "unicode-ident", ] [[package]] name = "ptr_meta" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe9e76f66d3f9606f44e45598d155cb13ecf09f4a28199e48daf8c8fc937ea90" +checksum = "0b9a0cf95a1196af61d4f1cbdab967179516d9a4a4312af1f31948f8f6224a79" dependencies = [ "ptr_meta_derive", ] [[package]] name = "ptr_meta_derive" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca414edb151b4c8d125c12566ab0d74dc9cdba36fb80eb7b848c15f495fd32d1" +checksum = "7347867d0a7e1208d93b46767be83e2b8f978c3dad35f775ac8d8847551d6fe1" dependencies = [ "proc-macro2", "quote", @@ -1541,99 +1510,96 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.37" +version = "1.0.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" +checksum = "dfbc457d0c7a0759a614551b11a6409e5951f6c7537be1f1b7682b9ae9230368" dependencies = [ "proc-macro2", ] +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "r-efi" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" + [[package]] name = "rancor" -version = "0.1.0" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "caf5f7161924b9d1cea0e4cabc97c372cea92b5f927fc13c6bca67157a0ad947" +checksum = "daff8b7b3ccf5f7ba270b3e7a0a4d4c701c5797e38dec27c7e2c3dbb830fed1c" dependencies = [ "ptr_meta", ] [[package]] name = "redox_syscall" -version = "0.5.8" +version = "0.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03a862b389f93e68874fbf580b9de08dd02facb9a788ebadaf4a3fd33cf58834" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" dependencies = [ - "bitflags 2.8.0", + "bitflags", ] [[package]] name = "regex" -version = "1.10.6" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" +checksum = "2a0e75113e14dc5acb068cd0786884f214f1312650a3d36d269f5c4f3cdee8a2" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.7", - "regex-syntax 0.8.2", + "regex-automata", + "regex-syntax", ] [[package]] name = "regex-automata" -version = "0.1.10" +version = "0.4.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" -dependencies = [ - "regex-syntax 0.6.29", -] - -[[package]] -name = "regex-automata" -version = "0.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" +checksum = "1f388202e4b80542a0921078cc23b6333bcf1409c1e3f86404cae4766a6131db" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.2", + "regex-syntax", ] [[package]] name = "regex-lite" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53a49587ad06b26609c52e423de037e7f57f20d53535d66e08c695f347df952a" - -[[package]] -name = "regex-syntax" -version = "0.6.29" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" +checksum = "cab834c73d247e67f4fae452806d17d3c7501756d98c8808d7c9c7aa7d18f973" [[package]] name = "regex-syntax" -version = "0.8.2" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" +checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4" [[package]] name = "rend" -version = "0.5.2" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a35e8a6bf28cd121053a66aa2e6a2e3eaffad4a60012179f0e864aa5ffeff215" +checksum = "663ba70707f96e871406fe10d68128412e619b06d1d47cb91c3a4c6501176240" dependencies = [ "bytecheck", ] [[package]] name = "rkyv" -version = "0.8.10" +version = "0.8.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e147371c75553e1e2fcdb483944a8540b8438c31426279553b9a8182a9b7b65" +checksum = "815cc8a37159a463064825246cadb07961e25cd9885908606f6d08a98d8f8874" dependencies = [ "bytecheck", "bytes", - "hashbrown 0.15.2", + "hashbrown 0.17.1", "indexmap", "munge", "ptr_meta", @@ -1646,9 +1612,9 @@ dependencies = [ [[package]] name = "rkyv_derive" -version = "0.8.10" +version = "0.8.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "246b40ac189af6c675d124b802e8ef6d5246c53e17367ce9501f8f66a81abb7a" +checksum = "c0ed1a78a1b19d184b0daa629dd9a024573173ec7d485b287cb369fb3607cc1c" dependencies = [ "proc-macro2", "quote", @@ -1662,9 +1628,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b91f7eff05f748767f183df4320a63d6936e9c6107d97c9e6bdd9784f4289c94" dependencies = [ "base64", - "bitflags 2.8.0", + "bitflags", + "serde", + "serde_derive", +] + +[[package]] +name = "ron" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81116b9531d61eabc41aeb228e4b6b2435bcca3233b98cf3b3077d4e6e9debb3" +dependencies = [ + "bitflags", + "once_cell", "serde", "serde_derive", + "typeid", + "unicode-ident", ] [[package]] @@ -1679,7 +1659,7 @@ dependencies = [ "const_format", "delegate", "derive_more", - "itertools 0.14.0", + "itertools 0.15.0", "json-subscriber", "macros", "paste", @@ -1749,38 +1729,40 @@ dependencies = [ [[package]] name = "rust-ini" -version = "0.21.1" +version = "0.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e310ef0e1b6eeb79169a1171daf9abcb87a2e17c03bee2c4bb100b55c75409f" +checksum = "796e8d2b6696392a43bea58116b667fb4c29727dc5abd27d6acf338bb4f688c7" dependencies = [ "cfg-if", "ordered-multimap", - "trim-in-place", ] -[[package]] -name = "rustc-demangle" -version = "0.1.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" - [[package]] name = "rustc-hash" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + [[package]] name = "rustversion" -version = "1.0.17" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" +checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f" [[package]] name = "ryu" -version = "1.0.15" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" +checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" [[package]] name = "same-file" @@ -1803,6 +1785,12 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "semver" +version = "1.0.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" + [[package]] name = "serde" version = "1.0.228" @@ -1813,6 +1801,18 @@ dependencies = [ "serde_derive", ] +[[package]] +name = "serde-untagged" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9faf48a4a2d2693be24c6289dbe26552776eb7737074e6722891fadbe6c5058" +dependencies = [ + "erased-serde", + "serde", + "serde_core", + "typeid", +] + [[package]] name = "serde_core" version = "1.0.228" @@ -1835,30 +1835,31 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.133" +version = "1.0.150" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7fceb2473b9166b2294ef05efcb65a3db80803f0b03ef86a5fc88a2b85ee377" +checksum = "e8014e44b4736ed0538adeecded0fce2a272f22dc9578a7eb6b2d9993c74cfb9" dependencies = [ "itoa", "memchr", - "ryu", "serde", + "serde_core", + "zmij", ] [[package]] name = "serde_spanned" -version = "0.6.8" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1" +checksum = "6662b5879511e06e8999a8a235d848113e942c9124f211511b16466ee2995f26" dependencies = [ - "serde", + "serde_core", ] [[package]] name = "sha2" -version = "0.10.8" +version = "0.10.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" dependencies = [ "cfg-if", "cpufeatures", @@ -1880,12 +1881,19 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" +[[package]] +name = "shlex" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba" + [[package]] name = "signal-hook-registry" -version = "1.4.2" +version = "1.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" +checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" dependencies = [ + "errno", "libc", ] @@ -1897,24 +1905,21 @@ checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" [[package]] name = "slab" -version = "0.4.9" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" -dependencies = [ - "autocfg", -] +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" [[package]] name = "smallvec" -version = "1.15.0" +version = "1.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8917285742e9f3e1683f0a9c4e6b57960b7314d0b08d30d1ecd426713ee2eee9" +checksum = "8ed6a63f02c8539c91a8685a86f4099661ba3da017932f6ebbea6de3f0fa7c90" [[package]] name = "stable_deref_trait" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" [[package]] name = "strsim" @@ -1922,44 +1927,30 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" +[[package]] +name = "symlink" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7973cce6668464ea31f176d85b13c7ab3bba2cb3b77a2ed26abd7801688010a" + [[package]] name = "syn" -version = "2.0.91" +version = "2.0.118" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d53cbcb5a243bd33b7858b1d7f4aca2153490815872d86d955d6ea29f743c035" +checksum = "1b9ae57f904213ebb649ce6895b8a66c66f0203b9319718f69a5612a065b1422" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] -[[package]] -name = "thiserror" -version = "1.0.50" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" -dependencies = [ - "thiserror-impl 1.0.50", -] - [[package]] name = "thiserror" version = "2.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4" dependencies = [ - "thiserror-impl 2.0.18", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.50" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" -dependencies = [ - "proc-macro2", - "quote", - "syn", + "thiserror-impl", ] [[package]] @@ -1975,42 +1966,40 @@ dependencies = [ [[package]] name = "thread_local" -version = "1.1.8" +version = "1.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" +checksum = "1ad99c4c6d32803332c548b1af0540b357b3f5fc0be8f6c6bfe8b2e6ae784070" dependencies = [ "cfg-if", - "once_cell", ] [[package]] name = "time" -version = "0.3.41" +version = "0.3.53" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a7619e19bc266e0f9c5e6686659d394bc57973859340060a69221e57dbc0c40" +checksum = "18dfaaeddcb932337b5e7866ee7d0ce9b76d2fd092997146f187ec09b4558a50" dependencies = [ "deranged", - "itoa", "libc", "num-conv", "num_threads", "powerfmt", - "serde", + "serde_core", "time-core", "time-macros", ] [[package]] name = "time-core" -version = "0.1.4" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9e9a38711f559d9e3ce1cdb06dd7c5b8ea546bc90052da6d06bb76da74bb07c" +checksum = "9e1c906769ad99c88eaa54e728060edef082f8e358ff32030cb7c7d315e81109" [[package]] name = "time-macros" -version = "0.2.22" +version = "0.2.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3526739392ec93fd8b359c8e98514cb3e8e021beb4e5f597b00a0221f8ed8a49" +checksum = "c431b87111666e491a90baa837f914fb45cd5dc3c268591b0220ff5057f2085f" dependencies = [ "num-conv", "time-core", @@ -2027,9 +2016,9 @@ dependencies = [ [[package]] name = "tinyvec" -version = "1.9.0" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09b3661f17e86524eccd4371ab0429194e0d7c008abb45f7a7495b1719463c71" +checksum = "bb4ebadaa0af04fab11ae01eb5f9fdb5f9c5b875506e210e71c07873528baa7f" dependencies = [ "tinyvec_macros", ] @@ -2042,58 +2031,54 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.44.2" +version = "1.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6b88822cbe49de4185e3a4cbf8321dd487cf5fe0c5c65695fef6346371e9c48" +checksum = "8fc7f01b389ac15039e4dc9531aa973a135d7a4135281b12d7c1bc79fd57fffe" dependencies = [ - "backtrace", "bytes", "libc", "mio", "pin-project-lite", "signal-hook-registry", - "windows-sys 0.52.0", + "windows-sys 0.61.2", ] [[package]] name = "toml" -version = "0.8.19" +version = "1.1.2+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e" +checksum = "81f3d15e84cbcd896376e6730314d59fb5a87f31e4b038454184435cd57defee" dependencies = [ - "serde", + "serde_core", "serde_spanned", "toml_datetime", - "toml_edit", + "toml_parser", + "winnow", ] [[package]] name = "toml_datetime" -version = "0.6.8" +version = "1.1.1+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" +checksum = "3165f65f62e28e0115a00b2ebdd37eb6f3b641855f9d636d3cd4103767159ad7" dependencies = [ - "serde", + "serde_core", ] [[package]] -name = "toml_edit" -version = "0.22.22" +name = "toml_parser" +version = "1.1.2+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" +checksum = "a2abe9b86193656635d2411dc43050282ca48aa31c2451210f4202550afb7526" dependencies = [ - "indexmap", - "serde", - "serde_spanned", - "toml_datetime", - "winnow 0.6.20", + "winnow", ] [[package]] name = "tracing" -version = "0.1.40" +version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" dependencies = [ "pin-project-lite", "tracing-attributes", @@ -2102,21 +2087,22 @@ dependencies = [ [[package]] name = "tracing-appender" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "786d480bce6247ab75f005b14ae1624ad978d3029d9113f0a22fa1ac773faeaf" +checksum = "050686193eb999b4bb3bc2acfa891a13da00f79734704c4b8b4ef1a10b368a3c" dependencies = [ "crossbeam-channel", - "thiserror 2.0.18", + "symlink", + "thiserror", "time", "tracing-subscriber", ] [[package]] name = "tracing-attributes" -version = "0.1.27" +version = "0.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" dependencies = [ "proc-macro2", "quote", @@ -2125,9 +2111,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.32" +version = "0.1.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" dependencies = [ "once_cell", "valuable", @@ -2146,9 +2132,9 @@ dependencies = [ [[package]] name = "tracing-indicatif" -version = "0.3.9" +version = "0.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8201ca430e0cd893ef978226fd3516c06d9c494181c8bf4e5b32e30ed4b40aa1" +checksum = "e1ef6990e0438749f0080573248e96631171a0b5ddfddde119aa5ba8c3a9c47e" dependencies = [ "indicatif", "tracing", @@ -2167,16 +2153,6 @@ dependencies = [ "tracing-core", ] -[[package]] -name = "tracing-serde" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc6b213177105856957181934e4920de57730fc69bf42c37ee5bb664d406d9e1" -dependencies = [ - "serde", - "tracing-core", -] - [[package]] name = "tracing-serde" version = "0.2.0" @@ -2189,14 +2165,14 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.3.18" +version = "0.3.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" +checksum = "cb7f578e5945fb242538965c2d0b04418d38ec25c79d160cd279bf0731c8d319" dependencies = [ "matchers", - "nu-ansi-term 0.46.0", + "nu-ansi-term", "once_cell", - "regex", + "regex-automata", "serde", "serde_json", "sharded-slab", @@ -2205,7 +2181,7 @@ dependencies = [ "tracing", "tracing-core", "tracing-log", - "tracing-serde 0.1.3", + "tracing-serde", ] [[package]] @@ -2221,11 +2197,11 @@ dependencies = [ [[package]] name = "tracing-tree" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f459ca79f1b0d5f71c54ddfde6debfc59c8b6eeb46808ae492077f739dc7b49c" +checksum = "ac87aa03b6a4d5a7e4810d1a80c19601dbe0f8a837e9177f23af721c7ba7beec" dependencies = [ - "nu-ansi-term 0.50.0", + "nu-ansi-term", "time", "tracing-core", "tracing-log", @@ -2253,52 +2229,52 @@ dependencies = [ ] [[package]] -name = "trim-in-place" -version = "0.1.7" +name = "typeid" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "343e926fc669bc8cde4fa3129ab681c63671bae288b1f1081ceee6d9d37904fc" +checksum = "bc7d623258602320d5c55d1bc22793b57daff0ec7efc270ea7d55ce1d5f5471c" [[package]] name = "typenum" -version = "1.17.0" +version = "1.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" +checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20" [[package]] name = "ucd-trie" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9" +checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" [[package]] name = "unicode-segmentation" -version = "1.11.0" +version = "1.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" +checksum = "c6f5d3c3b1bf09027a88a6bc961fc00497d651009560b5463668dc81b0fa87a8" [[package]] name = "unicode-width" -version = "0.1.14" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" +checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254" [[package]] -name = "unicode-width" -version = "0.2.0" +name = "unicode-xid" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fc81956842c57dac11422a97c3b8195a1ff727f06e85c84ed2e8aa277c9a0fd" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" [[package]] -name = "unicode-xid" -version = "0.2.5" +name = "unit-prefix" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "229730647fbc343e3a80e463c1db7f78f3855d3f3739bee0dda773c9a037c90a" +checksum = "81e544489bf3d8ef66c953931f56617f423cd4b5494be343d9b9d3dda037b9a3" [[package]] name = "unty" @@ -2314,11 +2290,13 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "uuid" -version = "1.11.0" +version = "1.23.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8c5f0a0af699448548ad1a2fbf920fb4bee257eae39953ba95cb84891a0446a" +checksum = "ea5fab0d6c3c01ae70085a09cb03d4c7a1d6314e2b3e075392783396d724ca0a" dependencies = [ - "getrandom", + "getrandom 0.4.3", + "js-sys", + "wasm-bindgen", ] [[package]] @@ -2353,9 +2331,9 @@ dependencies = [ [[package]] name = "version_check" -version = "0.9.4" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] name = "virtue" @@ -2365,42 +2343,30 @@ checksum = "051eb1abcf10076295e815102942cc58f9d5e3b4560e46e53c21e8ff6f3af7b1" [[package]] name = "vt100" -version = "0.15.2" +version = "0.16.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84cd863bf0db7e392ba3bd04994be3473491b31e66340672af5d11943c6274de" +checksum = "054ff75fb8fa83e609e685106df4faeffdf3a735d3c74ebce97ec557d5d36fd9" dependencies = [ "itoa", - "log", - "unicode-width 0.1.14", + "unicode-width", "vte", ] [[package]] name = "vte" -version = "0.11.1" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5022b5fbf9407086c180e9557be968742d839e68346af7792b8592489732197" +checksum = "a5924018406ce0063cd67f8e008104968b74b563ee1b85dde3ed1f7cb87d3dbd" dependencies = [ "arrayvec", - "utf8parse", - "vte_generate_state_changes", -] - -[[package]] -name = "vte_generate_state_changes" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e369bee1b05d510a7b4ed645f5faa90619e05437111783ea5848f28d97d3c2e" -dependencies = [ - "proc-macro2", - "quote", + "memchr", ] [[package]] name = "walkdir" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" dependencies = [ "same-file", "winapi-util", @@ -2408,40 +2374,37 @@ dependencies = [ [[package]] name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" +version = "0.11.1+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" [[package]] -name = "wasm-bindgen" -version = "0.2.92" +name = "wasip2" +version = "1.0.4+wasi-0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" +checksum = "b67efb37e106e55ce722a510d6b5f9c17f083e5fc79afc2badeb12cc313d9487" dependencies = [ - "cfg-if", - "wasm-bindgen-macro", + "wit-bindgen", ] [[package]] -name = "wasm-bindgen-backend" -version = "0.2.92" +name = "wasm-bindgen" +version = "0.2.126" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" +checksum = "4b067c0c11094aef6b7a801c1e34a26affafdf3d051dba08456b868789aaf9a4" dependencies = [ - "bumpalo", - "log", + "cfg-if", "once_cell", - "proc-macro2", - "quote", - "syn", + "rustversion", + "wasm-bindgen-macro", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.92" +version = "0.2.126" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" +checksum = "167ce5e579f6bcf889c4f7175a8a5a585de84e8ff93976ce393efa5f2837aab1" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2449,22 +2412,25 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.92" +version = "0.2.126" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" +checksum = "f3997c7839262f4ef12cf90b818d6340c18e80f263f1a94bf157d0ec4420380e" dependencies = [ + "bumpalo", "proc-macro2", "quote", "syn", - "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.92" +version = "0.2.126" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" +checksum = "dc1b4cb0cc549fcf58d7dfc081778139b3d283a081644e833e84682ad71cea24" +dependencies = [ + "unicode-ident", +] [[package]] name = "web-time" @@ -2476,74 +2442,33 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "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.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" -dependencies = [ - "winapi", -] - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "windows" -version = "0.58.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd04d41d93c4992d421894c18c8b43496aa748dd4c081bac0dc93eb0489272b6" +checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-core 0.58.0", - "windows-targets 0.52.6", + "windows-sys 0.61.2", ] [[package]] name = "windows-core" -version = "0.52.0" +version = "0.62.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" -dependencies = [ - "windows-targets 0.52.6", -] - -[[package]] -name = "windows-core" -version = "0.58.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ba6d44ec8c2591c134257ce647b7ea6b20335bf6379a27dac5f1641fcf59f99" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" dependencies = [ "windows-implement", "windows-interface", + "windows-link", "windows-result", "windows-strings", - "windows-targets 0.52.6", ] [[package]] name = "windows-implement" -version = "0.58.0" +version = "0.60.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bbd5b46c938e506ecbce286b6628a02171d56153ba733b6c741fc627ec9579b" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" dependencies = [ "proc-macro2", "quote", @@ -2552,9 +2477,9 @@ dependencies = [ [[package]] name = "windows-interface" -version = "0.58.0" +version = "0.59.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "053c4c462dc91d3b1504c6fe5a726dd15e216ba718e84a0e46a88fbe5ded3515" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" dependencies = [ "proc-macro2", "quote", @@ -2562,195 +2487,132 @@ dependencies = [ ] [[package]] -name = "windows-result" -version = "0.2.0" +name = "windows-link" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e" -dependencies = [ - "windows-targets 0.52.6", -] +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" [[package]] -name = "windows-strings" -version = "0.1.0" +name = "windows-result" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" dependencies = [ - "windows-result", - "windows-targets 0.52.6", + "windows-link", ] [[package]] -name = "windows-sys" -version = "0.48.0" +name = "windows-strings" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" dependencies = [ - "windows-targets 0.48.5", + "windows-link", ] [[package]] name = "windows-sys" -version = "0.52.0" +version = "0.60.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" dependencies = [ - "windows-targets 0.52.6", + "windows-targets", ] [[package]] name = "windows-sys" -version = "0.59.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" -dependencies = [ - "windows-targets 0.52.6", -] - -[[package]] -name = "windows-targets" -version = "0.48.5" +version = "0.61.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" dependencies = [ - "windows_aarch64_gnullvm 0.48.5", - "windows_aarch64_msvc 0.48.5", - "windows_i686_gnu 0.48.5", - "windows_i686_msvc 0.48.5", - "windows_x86_64_gnu 0.48.5", - "windows_x86_64_gnullvm 0.48.5", - "windows_x86_64_msvc 0.48.5", + "windows-link", ] [[package]] name = "windows-targets" -version = "0.52.6" +version = "0.53.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3" dependencies = [ - "windows_aarch64_gnullvm 0.52.6", - "windows_aarch64_msvc 0.52.6", - "windows_i686_gnu 0.52.6", + "windows-link", + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", "windows_i686_gnullvm", - "windows_i686_msvc 0.52.6", - "windows_x86_64_gnu 0.52.6", - "windows_x86_64_gnullvm 0.52.6", - "windows_x86_64_msvc 0.52.6", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", ] [[package]] name = "windows_aarch64_gnullvm" -version = "0.48.5" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" +checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53" [[package]] name = "windows_aarch64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" - -[[package]] -name = "windows_i686_gnu" -version = "0.48.5" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" +checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006" [[package]] name = "windows_i686_gnu" -version = "0.52.6" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" +checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3" [[package]] name = "windows_i686_gnullvm" -version = "0.52.6" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" +checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c" [[package]] name = "windows_i686_msvc" -version = "0.48.5" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" - -[[package]] -name = "windows_i686_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" +checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2" [[package]] name = "windows_x86_64_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.48.5" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" +checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.6" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" +checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1" [[package]] name = "windows_x86_64_msvc" -version = "0.48.5" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" +checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" [[package]] name = "winnow" -version = "0.6.20" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" +checksum = "23b97319f7b8343df12cc98938e5c3eb436064524c8d2b4e30a1d3a36eecdf81" dependencies = [ "memchr", ] [[package]] -name = "winnow" -version = "0.7.0" +name = "wit-bindgen" +version = "0.57.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e49d2d35d3fad69b39b94139037ecfb4f359f08958b9c11e7315ce770462419" -dependencies = [ - "memchr", -] +checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" [[package]] name = "yaml-rust2" -version = "0.9.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a1a1c0bc9823338a3bdf8c61f994f23ac004c6fa32c08cd152984499b445e8d" +checksum = "631a50d867fafb7093e709d75aaee9e0e0d5deb934021fcea25ac2fe09edc51e" dependencies = [ "arraydeque", "encoding_rs", @@ -2778,20 +2640,26 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.7.35" +version = "0.8.54" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +checksum = "b7cbbc0a705a0fd05cc3676525980d2bf5a9bc4adac6d6475209a7887cf59d19" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.35" +version = "0.8.54" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +checksum = "e2e817b7b52d0c7358d3246da9d69935ebb18116b2b102b4230dac079b4862f5" dependencies = [ "proc-macro2", "quote", "syn", ] + +[[package]] +name = "zmij" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b" diff --git a/Cargo.toml b/Cargo.toml index 113c6cb8..310c6543 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,15 +32,15 @@ runtime_symex_li_no_implicit = { path = "runtime/flavors/symex_li_no_implicit" } runtime_noop = { path = "runtime/flavors/noop" } libafl_leaf = { path = "integration/libafl/lib" } -clap = { version = "4.5", features = ["derive"] } +clap = { version = "4.6.1", features = ["derive"] } config = "0.15.7" const_format = "0.2.34" delegate = "0.13.2" -derive_more = { version = "1.0.0", features = ["full"] } -itertools = "0.14.0" +derive_more = { version = "2.1", features = ["full"] } +itertools = "0.15.0" tracing = { version = "0.1", features = ["release_max_level_info"] } tracing-subscriber = { version = "0.3", features = ["env-filter"] } -tracing-tree = "0.4.0" +tracing-tree = "0.4.1" serde = { version = "1.0", features = ["derive"] } serde_json = { version = "1.0" } rkyv = { version = "0.8" } diff --git a/common/src/pri/defs.rs b/common/src/pri/defs.rs index c972c931..9477b8bc 100644 --- a/common/src/pri/defs.rs +++ b/common/src/pri/defs.rs @@ -213,8 +213,6 @@ pub mod macros { { fn assign_aggregate_coroutine_closure(id: AssignmentId, dest: PlaceRef, upvars: ($slice_ty!(OperandRef))) } { fn assign_aggregate_raw_ptr(id: AssignmentId, dest: PlaceRef, data_ptr: OperandRef, metadata: OperandRef, is_mutable: bool) } - #[allow(unused_parens)] - { fn assign_shallow_init_box(id: AssignmentId, dest: PlaceRef, operand: OperandRef, boxed_type_id: ($type_id_ty)) } #[allow(unused_parens)] { fn assign_wrap_unsafe_binder(id: AssignmentId, dest: PlaceRef, operand: OperandRef, binder_type_id: ($type_id_ty)) } @@ -363,6 +361,12 @@ pub mod macros { { fn intrinsic_assign_saturating_sub(id: AssignmentId, dest: PlaceRef, first: OperandRef, second: OperandRef) } { fn intrinsic_assign_disjoint_bitor(id: AssignmentId, dest: PlaceRef, first: OperandRef, second: OperandRef) } { fn intrinsic_assign_exact_div(id: AssignmentId, dest: PlaceRef, first: OperandRef, second: OperandRef) } + { fn intrinsic_assign_carryless_mul( + id: AssignmentId, + dest: PlaceRef, + first: OperandRef, + second: OperandRef, + ) } { fn intrinsic_assign_bitreverse(id: AssignmentId, dest: PlaceRef, x: OperandRef) } { fn intrinsic_assign_cttz_nonzero(id: AssignmentId, dest: PlaceRef, x: OperandRef) } { fn intrinsic_assign_cttz(id: AssignmentId, dest: PlaceRef, x: OperandRef) } @@ -370,6 +374,35 @@ pub mod macros { { fn intrinsic_assign_ctlz_nonzero(id: AssignmentId, dest: PlaceRef, x: OperandRef) } { fn intrinsic_assign_ctlz(id: AssignmentId, dest: PlaceRef, x: OperandRef) } { fn intrinsic_assign_bswap(id: AssignmentId, dest: PlaceRef, x: OperandRef) } + { fn intrinsic_assign_funnel_shl( + id: AssignmentId, + dest: PlaceRef, + first: OperandRef, + second: OperandRef, + shift: OperandRef, + ) } + { fn intrinsic_assign_funnel_shr( + id: AssignmentId, + dest: PlaceRef, + first: OperandRef, + second: OperandRef, + shift: OperandRef, + ) } + { fn intrinsic_assign_select_unpredictable( + id: AssignmentId, + dest: PlaceRef, + condition: OperandRef, + true_val: OperandRef, + false_val: OperandRef, + ) } + { fn intrinsic_assign_carrying_mul_add( + id: AssignmentId, + dest: PlaceRef, + multiplier: OperandRef, + multiplicand: OperandRef, + addend: OperandRef, + carry: OperandRef, + ) } // ----- Atomic ----- // All atomic operations have an ordering, majority get applied on a pointer. #[allow(unused_parens)] @@ -442,6 +475,31 @@ pub mod macros { second_ptr: OperandRef, conc_second_ptr: RawAddress, ) } + /* NOTE: The arguments does not have a proper order because of the first three operands that are shared. + * while it is easy to fix, it is not currently a serious issue. + */ + #[allow(unused_parens)] + { fn intrinsic_assign_raw_eq( + id: AssignmentId, + first_ref: OperandRef, + conc_first_ptr: RawAddress, + ptr_type_id: ($type_id_ty), + dest: PlaceRef, + second_ref: OperandRef, + conc_second_ptr: RawAddress, + ) } + /* NOTE: The type id is unnecessary but included for the same reason as above. */ + { fn intrinsic_assign_compare_bytes( + id: AssignmentId, + first_ptr: OperandRef, + conc_first_ptr: RawAddress, + ptr_type_id: ($type_id_ty), + dest: PlaceRef, + second_ptr: OperandRef, + conc_second_ptr: RawAddress, + count: OperandRef, + conc_count: usize, + ) } // ----- Atomic (Memory) ----- #[allow(unused_parens)] { fn intrinsic_atomic_load( @@ -740,8 +798,6 @@ pub mod macros { #[allow(unused_parens)]fn assign_aggregate_coroutine_closure(id: AssignmentId,dest: PlaceRef,upvars: ($slice_ty!(OperandRef))); }$modifier!{ fn assign_aggregate_raw_ptr(id: AssignmentId,dest: PlaceRef,data_ptr: OperandRef,metadata: OperandRef,is_mutable: bool); - }$modifier!{ - #[allow(unused_parens)]fn assign_shallow_init_box(id: AssignmentId,dest: PlaceRef,operand: OperandRef,boxed_type_id: ($type_id_ty)); }$modifier!{ #[allow(unused_parens)]fn assign_wrap_unsafe_binder(id: AssignmentId,dest: PlaceRef,operand: OperandRef,binder_type_id: ($type_id_ty)); }$modifier!{ @@ -842,6 +898,8 @@ pub mod macros { fn intrinsic_assign_disjoint_bitor(id: AssignmentId,dest: PlaceRef,first: OperandRef,second: OperandRef); }$modifier!{ fn intrinsic_assign_exact_div(id: AssignmentId,dest: PlaceRef,first: OperandRef,second: OperandRef); + }$modifier!{ + fn intrinsic_assign_carryless_mul(id: AssignmentId,dest: PlaceRef,first: OperandRef,second: OperandRef,); }$modifier!{ fn intrinsic_assign_bitreverse(id: AssignmentId,dest: PlaceRef,x: OperandRef); }$modifier!{ @@ -856,6 +914,14 @@ pub mod macros { fn intrinsic_assign_ctlz(id: AssignmentId,dest: PlaceRef,x: OperandRef); }$modifier!{ fn intrinsic_assign_bswap(id: AssignmentId,dest: PlaceRef,x: OperandRef); + }$modifier!{ + fn intrinsic_assign_funnel_shl(id: AssignmentId,dest: PlaceRef,first: OperandRef,second: OperandRef,shift: OperandRef,); + }$modifier!{ + fn intrinsic_assign_funnel_shr(id: AssignmentId,dest: PlaceRef,first: OperandRef,second: OperandRef,shift: OperandRef,); + }$modifier!{ + fn intrinsic_assign_select_unpredictable(id: AssignmentId,dest: PlaceRef,condition: OperandRef,true_val: OperandRef,false_val: OperandRef,); + }$modifier!{ + fn intrinsic_assign_carrying_mul_add(id: AssignmentId,dest: PlaceRef,multiplier: OperandRef,multiplicand: OperandRef,addend: OperandRef,carry: OperandRef,); }$modifier!{ #[allow(unused_parens)]fn intrinsic_atomic_binary_op(ordering: ($atomic_ord_ty),id: AssignmentId,ptr: OperandRef,conc_ptr: RawAddress,ptr_type_id: ($type_id_ty),operator: ($atomic_bin_op_ty),src: OperandRef,prev_dest: PlaceRef,); }$modifier!{ @@ -870,6 +936,10 @@ pub mod macros { #[allow(unused_parens)]fn intrinsic_memory_set(id: AssignmentId,ptr: OperandRef,conc_ptr: RawAddress,ptr_type_id: ($type_id_ty),val: OperandRef,count: OperandRef,conc_count: usize,is_volatile: bool,); }$modifier!{ #[allow(unused_parens)]fn intrinsic_memory_swap(id: AssignmentId,first_ptr: OperandRef,conc_first_ptr: RawAddress,ptr_type_id: ($type_id_ty),second_ptr: OperandRef,conc_second_ptr: RawAddress,); + }$modifier!{ + #[allow(unused_parens)]fn intrinsic_assign_raw_eq(id: AssignmentId,first_ref: OperandRef,conc_first_ptr: RawAddress,ptr_type_id: ($type_id_ty),dest: PlaceRef,second_ref: OperandRef,conc_second_ptr: RawAddress,); + }$modifier!{ + fn intrinsic_assign_compare_bytes(id: AssignmentId,first_ptr: OperandRef,conc_first_ptr: RawAddress,ptr_type_id: ($type_id_ty),dest: PlaceRef,second_ptr: OperandRef,conc_second_ptr: RawAddress,count: OperandRef,conc_count: usize,); }$modifier!{ #[allow(unused_parens)]fn intrinsic_atomic_load(ordering: ($atomic_ord_ty),id: AssignmentId,ptr: OperandRef,conc_ptr: RawAddress,ptr_type_id: ($type_id_ty),dest: PlaceRef,); }$modifier!{ diff --git a/common/src/pri/types.rs b/common/src/pri/types.rs index 195b1fa1..09d6c690 100644 --- a/common/src/pri/types.rs +++ b/common/src/pri/types.rs @@ -94,6 +94,7 @@ enum_like_type! { SHR_UNCHECKED = BinaryOp::SHR.0 | BinaryOp::UNCHECKED; ROT_L = 11; ROT_R = 12; + CARRYLESS_MUL = 13; EQ = 21; LT = 22; LE = 23; diff --git a/compiler/src/main.rs b/compiler/src/main.rs index 65479e78..b4de4395 100644 --- a/compiler/src/main.rs +++ b/compiler/src/main.rs @@ -5,10 +5,9 @@ #![feature(iter_order_by)] #![feature(macro_metavar_expr)] #![feature(box_into_inner)] -#![feature(assert_matches)] #![feature(core_intrinsics)] -#![feature(if_let_guard)] #![feature(option_into_flat_iter)] +#![feature(exitcode_exit_method)] mod config; mod mir_transform; @@ -34,7 +33,6 @@ extern crate rustc_mir_build; extern crate rustc_mir_dataflow; extern crate rustc_mir_transform; extern crate rustc_monomorphize; -extern crate rustc_query_system; extern crate rustc_session; extern crate rustc_span; extern crate rustc_target; @@ -54,7 +52,7 @@ fn main() { set_up_compiler(); - std::process::exit(run_compiler(env::args())); + run_compiler(env::args()).exit_process() } fn init_logging() { @@ -86,7 +84,7 @@ pub fn set_up_compiler() { rustc_driver::install_ice_hook(URL_BUG_REPORT, |_| ()); } -pub fn run_compiler(args: impl IntoIterator) -> i32 { +pub fn run_compiler(args: impl IntoIterator) -> std::process::ExitCode { let config = config::load_config(); let args = driver_args::set_up_args(args); diff --git a/compiler/src/mir_transform/jump.rs b/compiler/src/mir_transform/jump.rs index 25dcf163..ba0a9492 100644 --- a/compiler/src/mir_transform/jump.rs +++ b/compiler/src/mir_transform/jump.rs @@ -81,7 +81,7 @@ where fn visit_call( &mut self, _func: &mut Operand<'tcx>, - _args: &mut [rustc_span::source_map::Spanned>], + _args: &mut [rustc_span::Spanned>], _destination: &mut Place<'tcx>, target: &mut Option, unwind: &mut UnwindAction, diff --git a/compiler/src/mir_transform/misc.rs b/compiler/src/mir_transform/misc.rs index a9146b2b..a93ec02c 100644 --- a/compiler/src/mir_transform/misc.rs +++ b/compiler/src/mir_transform/misc.rs @@ -52,6 +52,7 @@ impl<'tcx> BasicBlockDataSplitExt<'tcx> for BasicBlockData<'tcx> { new_block.terminator = Some(Terminator { kind: TerminatorKind::Goto { target: NEXT_BLOCK }, source_info: (&statement.source_info).clone(), + attributes: Default::default(), }); result.push(new_block); new_block = empty_block.clone(); diff --git a/compiler/src/passes/codegen.rs b/compiler/src/passes/codegen.rs index 928d9a33..abe74f53 100644 --- a/compiler/src/passes/codegen.rs +++ b/compiler/src/passes/codegen.rs @@ -1,7 +1,7 @@ use rustc_hir::{def::DefKind, def_id::LOCAL_CRATE}; use rustc_middle::{ middle::codegen_fn_attrs::CodegenFnAttrFlags, - mir::mono::{CodegenUnit, MonoItem}, + mono::{CodegenUnit, MonoItem}, ty::TyCtxt, }; @@ -84,7 +84,10 @@ fn should_be_internalized<'tcx>( let def_id = item.def_id(); if matches!(tcx.def_kind(def_id), DefKind::Fn) && matches!( - tcx.fn_sig(def_id).instantiate_identity().abi(), + tcx.fn_sig(def_id) + .instantiate_identity() + .skip_normalization() + .abi(), rustc_abi::ExternAbi::C { .. } ) && tcx.visibility(def_id).is_public() @@ -111,9 +114,7 @@ fn should_be_internalized<'tcx>( * Note: In an ideal workflow, proc-macro crates should not be compiled with leaf, * but we make the compiler robust enough for this case. */ else if item.symbol_name(tcx).name - == tcx - .sess - .generate_proc_macro_decls_symbol(tcx.stable_crate_id(LOCAL_CRATE)) + == rustc_session::generate_proc_macro_decls_symbol(tcx.stable_crate_id(LOCAL_CRATE)) { false } else if let Some(ruled) = rules(item.symbol_name(tcx).name) { diff --git a/compiler/src/passes/gated.rs b/compiler/src/passes/gated.rs index 21d985b8..b027e098 100644 --- a/compiler/src/passes/gated.rs +++ b/compiler/src/passes/gated.rs @@ -129,7 +129,7 @@ where fn visit_codegen_units<'tcx>( tcx: TyCtxt<'tcx>, - units: &mut [mir::mono::CodegenUnit<'tcx>], + units: &mut [rustc_middle::mono::CodegenUnit<'tcx>], storage: &mut dyn Storage, ) { if !is_enabled::(storage) { diff --git a/compiler/src/passes/instr/call/implementation/assign.rs b/compiler/src/passes/instr/call/implementation/assign.rs index 776bc59a..2aa4498e 100644 --- a/compiler/src/passes/instr/call/implementation/assign.rs +++ b/compiler/src/passes/instr/call/implementation/assign.rs @@ -1,4 +1,4 @@ -use std::assert_matches::debug_assert_matches; +use std::debug_assert_matches; use rustc_abi::{FieldIdx, VariantIdx}; use rustc_middle::{ @@ -199,21 +199,6 @@ where ) } - fn by_shallow_init_box(&mut self, operand: OperandRef, ty: &Ty<'tcx>) { - let id_local = { - let (block, id_local) = self.make_type_id_of_bb(*ty); - self.insert_blocks([block]); - id_local - }; - self.add_bb_for_assign_call( - sym::assign_shallow_init_box, - vec![ - operand::copy_for_local(operand.into()), - operand::move_for_local(id_local), - ], - ); - } - fn by_wrap_unsafe_binder(&mut self, operand: OperandRef, ty: &Ty<'tcx>) { let id_local = { let (block, id_local) = self.make_type_id_of_bb(*ty); diff --git a/compiler/src/passes/instr/call/implementation/func.rs b/compiler/src/passes/instr/call/implementation/func.rs index b7663ad7..346dfd04 100644 --- a/compiler/src/passes/instr/call/implementation/func.rs +++ b/compiler/src/passes/instr/call/implementation/func.rs @@ -1,8 +1,8 @@ use rustc_middle::mir::{BasicBlockData, Operand}; -use rustc_span::source_map::Spanned; +use rustc_span::Spanned; use rustc_type_ir::ClosureArgs; -use core::{assert_matches::debug_assert_matches, iter}; +use core::{debug_assert_matches, iter}; use crate::{ passes::instr::{ @@ -58,7 +58,10 @@ where } fn enter_func(&mut self) { - self.debug_info(&format!("{}", utils::body_func_ty(self.tcx(), self.body()))); + self.debug_info(&format!( + "{}", + utils::body_func_ty(self.tcx(), self.body(), self.current_typing_env()) + )); self.enter_func(); @@ -109,7 +112,7 @@ where let func = operand::func( tcx, tcx.lang_items() - .drop_in_place_fn() + .drop_glue_fn() .expect("Lang item required for instrumenting drops"), [place.ty(self, tcx).ty.into()], ); @@ -298,10 +301,11 @@ where operand::move_for_local(argument_places_local), operand::move_for_local(ret_val_place_local), ]; - let mut block = if let TyKind::Closure(_, args) = tcx - .type_of(self.current_func_id()) - .instantiate_identity() + .normalize_erasing_regions( + self.current_typing_env(), + tcx.type_of(self.current_func_id()).instantiate_identity(), + ) .kind() { let (arg_blocks, tupled_args) = self.make_enter_func_tupled_args(args.as_closure()); @@ -418,7 +422,7 @@ where let func_ref = self.reference_operand(drop_in_place_fn); let ptr_pack = self.reference_ptr_for_intrinsic(to_drop); - let (ptr_type_id_block, conc_ptr_assignment, [ptr_ref, ptr_value, ptr_type_id]) = self + let (ptr_type_id_block, conc_ptr_stmts, [ptr_ref, ptr_value, ptr_type_id]) = self .make_ptr_triple_args( ptr_pack.ptr_operand_ref(), ptr_pack.ptr_value().clone(), @@ -436,7 +440,7 @@ where ], ); - block.statements.push(conc_ptr_assignment); + block.statements.extend(conc_ptr_stmts); blocks.push(block); @@ -451,10 +455,10 @@ where mod utils { use rustc_middle::{ - mir::{BasicBlockData, Body, Local, Operand, Place, Rvalue, Statement}, + mir::{BasicBlockData, Body, Local, Operand, Place, Rvalue, Statement, WithRetag}, ty::{ - AssocItem, ClosureArgs, ExistentialPredicateStableCmpExt, GenericArgsRef, Instance, - InstanceKind, PolyFnSig, TraitRef, Ty, TyCtxt, TyKind, TypingEnv, + AssocItem, ClosureArgs, ExistentialPredicateStableCmpExt, InstanceKind, PolyFnSig, + ShimKind, TraitRef, Ty, TyCtxt, TyKind, TypingEnv, }, }; use rustc_span::def_id::DefId; @@ -463,7 +467,7 @@ mod utils { use common::{log_debug, log_info}; use itertools::Itertools; - use core::{assert_matches::debug_assert_matches, iter}; + use core::{debug_assert_matches, iter}; use crate::{ passes::instr::{MirSourceExt, decision::rules::accept_dyn_def_filter_rules}, @@ -645,14 +649,22 @@ mod utils { } } - pub fn body_func_ty<'tcx>(tcx: TyCtxt<'tcx>, body: &Body<'tcx>) -> Ty<'tcx> { + pub fn body_func_ty<'tcx>( + tcx: TyCtxt<'tcx>, + body: &Body<'tcx>, + typing_env: TypingEnv<'tcx>, + ) -> Ty<'tcx> { let source = body.source; log_debug!("Creating type of current function: {}", source.to_log_str()); use InstanceKind::*; + use ShimKind::*; let fn_def_ty = match source.instance { Item(def_id) => { - let ty = tcx.type_of(def_id).instantiate_identity(); + let ty = tcx.normalize_erasing_regions( + typing_env, + tcx.type_of(def_id).instantiate_identity(), + ); match ty.kind() { TyKind::FnDef(..) => ty, TyKind::Closure(..) => ty::fn_def_of_closure_call(tcx, ty), @@ -671,19 +683,20 @@ mod utils { _ => unreachable!("Unexpected type for body instance: {:?}", ty), } } - ReifyShim(def_id, _) => tcx.type_of(def_id).instantiate_identity(), - FnPtrShim(fn_trait_fn_id, fn_ptr_ty) => { + Shim(Reify(def_id, _)) => tcx + .normalize_erasing_regions(typing_env, tcx.type_of(def_id).instantiate_identity()), + Shim(FnPtr(fn_trait_fn_id, fn_ptr_ty)) => { ty::fn_def_of_fn_ptr_shim(tcx, fn_trait_fn_id, fn_ptr_ty) } - ClosureOnceShim { call_once, .. } => { + Shim(ClosureOnce { call_once, .. }) => { let arg_tys = body .args_iter() .map(|local| body.local_decls()[local].ty) .collect::>(); ty::fn_def_of_closure_once_shim(tcx, call_once, &arg_tys) } - CloneShim(clone_fn_id, self_ty) => ty::fn_def_of_clone_shim(tcx, clone_fn_id, self_ty), - DropGlue(def_id, Some(ty)) => Ty::new_fn_def(tcx, def_id, [ty]), + Shim(Clone(def_id, self_ty)) => ty::fn_def_of_clone_shim(tcx, def_id, self_ty), + Shim(DropGlue(def_id, Some(ty))) => Ty::new_fn_def(tcx, def_id, [ty]), instance @ _ => unreachable!("Unsupported instance: {:?}", instance), }; @@ -739,7 +752,7 @@ mod utils { typing_env: TypingEnv<'tcx>, base_args: Vec>, ) -> BasicBlockData<'tcx> { - let fn_def_ty = body_func_ty(tcx, call_adder.body()); + let fn_def_ty = body_func_ty(tcx, call_adder.body(), typing_env); let TyKind::FnDef(def_id, generic_args) = *fn_def_ty.kind() else { unreachable!( "Expected function definition type but received: {}", @@ -749,7 +762,7 @@ mod utils { let fn_value = operand::func(tcx, def_id, generic_args); - if let Some((trait_ref, trait_item)) = as_dyn_compatible_method(tcx, def_id) + if let Some((trait_ref, trait_item)) = as_dyn_compatible_method(tcx, def_id, typing_env) && trait_ref.self_ty().is_sized(tcx, typing_env) { let ruled_out = accept_dyn_def_filter_rules(call_adder.storage(), &(tcx, def_id)) @@ -797,11 +810,13 @@ mod utils { fn as_dyn_compatible_method<'tcx>( tcx: TyCtxt<'tcx>, def_id: DefId, + typing_env: TypingEnv<'tcx>, ) -> Option<(TraitRef<'tcx>, AssocItem)> { let trait_ref = tcx .impl_of_assoc(def_id) .and_then(|impl_id| tcx.impl_opt_trait_ref(impl_id)) .map(|trait_ref| trait_ref.instantiate_identity()) + .map(|trait_ref| tcx.normalize_erasing_regions(typing_env, trait_ref)) .filter(|trait_ref| tcx.is_dyn_compatible(trait_ref.def_id)) .filter(|trait_ref| trait_ref.def_id != tcx.lang_items().deref_trait().unwrap())?; @@ -887,8 +902,13 @@ mod utils { // A1 = X, A2 = Y, ... .chain(associated_types.into_iter().map(|(principal, item)| { // >::A1 - let proj_term = - Ty::new_projection_from_args(tcx, item.def_id, principal.args).into(); + let proj_term = Ty::new_projection_from_args( + tcx, + rustc_type_ir::IsRigid::No, + item.def_id, + principal.args, + ) + .into(); ExistentialPredicate::Projection(ExistentialProjection::new( tcx, item.def_id, @@ -1035,8 +1055,10 @@ mod utils { Operand::Copy(place) | Operand::Move(place) => *place, Operand::Constant(..) => { let local = call_adder.add_local(receiver_ty); - let assignment = - assignment::create(Place::from(local), Rvalue::Use(receiver.clone())); + let assignment = assignment::create( + Place::from(local), + Rvalue::Use(receiver.clone(), WithRetag::No), + ); statements.push(assignment); local.into() } @@ -1101,7 +1123,7 @@ mod utils { let fn_rvalue = if fn_ptr_ty != value_ty { rvalue::cast_to_fn_ptr(tcx, fn_value, value_ty) } else { - Rvalue::Use(fn_value) + Rvalue::Use(fn_value, WithRetag::No) }; let fn_ptr_local = local_manager.add_local(fn_ptr_ty); let fn_ptr_assign = assignment::create(Place::from(fn_ptr_local), fn_rvalue); diff --git a/compiler/src/passes/instr/call/implementation/intrinsics.rs b/compiler/src/passes/instr/call/implementation/intrinsics.rs index 144e36b6..e7748e8b 100644 --- a/compiler/src/passes/instr/call/implementation/intrinsics.rs +++ b/compiler/src/passes/instr/call/implementation/intrinsics.rs @@ -44,6 +44,7 @@ where let arg_num = |def_id| { tcx.fn_sig(def_id) .instantiate_identity() + .skip_normalization() .inputs() .iter() .count() @@ -105,8 +106,8 @@ where let mut stmts = Vec::new(); let conc_dst_ptr_local = { - let (stmt, id_local) = self.make_conc_ptr_assignment(dst_value.clone()); - stmts.push(stmt); + let (ptr_stmts, id_local) = self.make_conc_ptr_assignment(dst_value.to_copy()); + stmts.extend(ptr_stmts); id_local }; @@ -143,8 +144,8 @@ where let mut stmts = Vec::new(); let conc_second_ptr_local = { - let (stmt, id_local) = self.make_conc_ptr_assignment(second_value.clone()); - stmts.push(stmt); + let (ptr_stmts, id_local) = self.make_conc_ptr_assignment(second_value.to_copy()); + stmts.extend(ptr_stmts); id_local }; @@ -158,6 +159,55 @@ where Default::default(), ) } + + fn raw_eq(&mut self, second_ref: OperandRef, second_value: &Operand<'tcx>) { + let mut stmts = Vec::new(); + + let conc_second_ptr_local = { + let (ptr_stmts, id_local) = self.make_conc_ptr_assignment(second_value.to_copy()); + stmts.extend(ptr_stmts); + id_local + }; + + self.add_bb_for_memory_op_intrinsic_call( + sym::intrinsics::memory::intrinsic_assign_raw_eq, + vec![ + operand::move_for_local(self.dest_ref().into()), + operand::move_for_local(second_ref.into()), + operand::move_for_local(conc_second_ptr_local), + ], + stmts, + Default::default(), + ) + } + + fn compare_bytes( + &mut self, + second_ref: OperandRef, + second_value: &Operand<'tcx>, + count_ref: OperandRef, + count_value: &Operand<'tcx>, + ) { + let mut stmts = Vec::new(); + + let conc_second_ptr_local = { + let (ptr_stmts, id_local) = self.make_conc_ptr_assignment(second_value.to_copy()); + stmts.extend(ptr_stmts); + id_local + }; + self.add_bb_for_memory_op_intrinsic_call( + sym::intrinsics::memory::intrinsic_assign_compare_bytes, + vec![ + operand::move_for_local(self.dest_ref().into()), + operand::move_for_local(second_ref.into()), + operand::move_for_local(conc_second_ptr_local), + operand::move_for_local(count_ref.into()), + count_value.to_copy(), + ], + stmts, + Default::default(), + ) + } } impl<'tcx, C> RuntimeCallAdder @@ -176,8 +226,8 @@ where let mut blocks = additional_blocks; let [ptr_ref, ptr_value, ptr_type_id] = { - let (ptr_block, ptr_stmt, args) = self.make_ptr_pack_args(); - stmts.push(ptr_stmt); + let (ptr_block, ptr_stmts, args) = self.make_ptr_pack_args(); + stmts.extend(ptr_stmts); blocks.push(ptr_block); args }; @@ -330,8 +380,8 @@ where let mut blocks = additional_blocks; let [ptr_ref, ptr_value, ptr_type_id] = { - let (ptr_block, ptr_stmt, args) = self.make_ptr_pack_args(); - stmts.push(ptr_stmt); + let (ptr_block, ptr_stmts, args) = self.make_ptr_pack_args(); + stmts.extend(ptr_stmts); blocks.push(ptr_block); args }; @@ -388,7 +438,13 @@ where Self: MirCallAdder<'tcx>, C: Basic<'tcx>, { - fn make_ptr_pack_args(&mut self) -> (BasicBlockData<'tcx>, Statement<'tcx>, [Operand<'tcx>; 3]) + fn make_ptr_pack_args( + &mut self, + ) -> ( + BasicBlockData<'tcx>, + Vec>, + [Operand<'tcx>; 3], + ) where C: PointerInfoProvider<'tcx>, { @@ -411,14 +467,18 @@ where operand_ref: OperandRef, ptr_value: Operand<'tcx>, ptr_ty: Ty<'tcx>, - ) -> (BasicBlockData<'tcx>, Statement<'tcx>, [Operand<'tcx>; 3]) { - let (conc_ptr_assignment, conc_ptr_local) = self.make_conc_ptr_assignment(ptr_value); + ) -> ( + BasicBlockData<'tcx>, + Vec>, + [Operand<'tcx>; 3], + ) { + let (conc_ptr_stmts, conc_ptr_local) = self.make_conc_ptr_assignment(ptr_value); let (ptr_type_id_block, ptr_type_id_local) = self.make_type_id_of_bb(ptr_ty); ( ptr_type_id_block, - conc_ptr_assignment, + conc_ptr_stmts, [ operand::move_for_local(operand_ref.into()), operand::move_for_local(conc_ptr_local), @@ -427,16 +487,52 @@ where ) } - fn make_conc_ptr_assignment(&mut self, ptr_value: Operand<'tcx>) -> (Statement<'tcx>, Local) { + fn make_conc_ptr_assignment( + &mut self, + ptr_or_ref_value: Operand<'tcx>, + ) -> (Vec>, Local) { + let mut stmts = Vec::new(); let tcx = self.tcx(); + + let ty = ptr_or_ref_value.ty(self, tcx); + assert!(ty.is_raw_ptr() || ty.is_ref()); + let ptr_ty = if ty.is_raw_ptr() { + ty + } else { + Ty::new_imm_ptr(tcx, ty.peel_refs()) + }; + + let ptr_or_ref_place = if let Some(place) = ptr_or_ref_value.place() { + place + } else { + // let a = ptr_or_ref_value; + let ptr_or_ref_local = self.add_local(ty); + stmts.push(assignment::create( + Place::from(ptr_or_ref_local), + Rvalue::Use(ptr_or_ref_value, rustc_middle::mir::WithRetag::No), + )); + Place::from(ptr_or_ref_local) + }; + + // let b: *const T = &raw (*a); + let raw_ptr_local = self.add_local(ptr_ty); + stmts.push(assignment::create( + Place::from(raw_ptr_local), + Rvalue::RawPtr( + rustc_middle::mir::RawPtrKind::Const, + ptr_or_ref_place.project_deeper(&[ProjectionElem::Deref], tcx), + ), + )); + + // let c: *const () = b as *const (); let raw_addr_ty = Ty::new_imm_ptr(tcx, tcx.types.unit); - let local = self.add_local(raw_addr_ty); - let assignment = assignment::create( - Place::from(local), - rvalue::cast_ptr_to_ptr(ptr_value, raw_addr_ty), - ); + let raw_addr_local = self.add_local(raw_addr_ty); + stmts.push(assignment::create( + Place::from(raw_addr_local), + rvalue::cast_ptr_to_ptr(operand::move_for_local(raw_ptr_local), raw_addr_ty), + )); - (assignment, local) + (stmts, raw_addr_local) } } diff --git a/compiler/src/passes/instr/call/implementation/mod.rs b/compiler/src/passes/instr/call/implementation/mod.rs index bdfd2344..f9e7026c 100644 --- a/compiler/src/passes/instr/call/implementation/mod.rs +++ b/compiler/src/passes/instr/call/implementation/mod.rs @@ -1,4 +1,4 @@ -use core::assert_matches::debug_assert_matches; +use core::debug_assert_matches; use std::collections::HashMap; use rustc_middle::{ @@ -813,7 +813,7 @@ pub(super) mod utils { use rustc_trait_selection::infer::InferCtxtExt; tcx.infer_ctxt() - .build(typing_env.typing_mode) + .build(typing_env.typing_mode()) .type_implements_trait(trait_def_id, [ty], typing_env.param_env) .must_apply_modulo_regions() } @@ -821,7 +821,7 @@ pub(super) mod utils { pub(super) mod terminator { use rustc_middle::mir::{Terminator, TerminatorKind, UnwindAction}; - use rustc_span::source_map::Spanned; + use rustc_span::Spanned; use super::*; @@ -853,6 +853,7 @@ pub(super) mod utils { call_source: mir::CallSource::Normal, fn_span: DUMMY_SP, }, + attributes: Default::default(), } } @@ -862,6 +863,7 @@ pub(super) mod utils { kind: TerminatorKind::Goto { target: target.unwrap_or(NEXT_BLOCK), }, + attributes: Default::default(), } } } @@ -1032,6 +1034,7 @@ pub(super) mod utils { // FIXME: Check if additional caching can be beneficial tcx.fn_sig(self.def_id) .instantiate(tcx, generic_args) + .skip_normalization() .output() .no_bound_vars() .expect( @@ -1059,7 +1062,7 @@ mod prelude { pub(super) mod mir { pub use rustc_middle::{ - mir::{BasicBlockData, Local, Operand, Place, Rvalue, Statement}, + mir::{BasicBlockData, Local, Operand, Place, ProjectionElem, Rvalue, Statement}, ty::{Ty, TyCtxt, TyKind}, }; pub use rustc_span::def_id::DefId; diff --git a/compiler/src/passes/instr/call/implementation/operand.rs b/compiler/src/passes/instr/call/implementation/operand.rs index 46e04cb3..1fdebd32 100644 --- a/compiler/src/passes/instr/call/implementation/operand.rs +++ b/compiler/src/passes/instr/call/implementation/operand.rs @@ -435,9 +435,9 @@ mod utils { match constant.const_ { Const::Unevaluated(c, _) => Some(c), Const::Ty(_ty, c) => match c.kind() { - ty::ConstKind::Unevaluated(ty::UnevaluatedConst { def, args }) => { + ty::ConstKind::Alias(ty::IsRigid::No, ty::AliasConst { kind, args, .. }) => { Some(mir::UnevaluatedConst { - def, + def: kind.opt_def_id().unwrap(), args, promoted: None, }) diff --git a/compiler/src/passes/instr/call/implementation/storage.rs b/compiler/src/passes/instr/call/implementation/storage.rs index 72b4abda..10ce3d72 100644 --- a/compiler/src/passes/instr/call/implementation/storage.rs +++ b/compiler/src/passes/instr/call/implementation/storage.rs @@ -1,4 +1,4 @@ -use core::assert_matches::debug_assert_matches; +use core::debug_assert_matches; use crate::passes::instr::ctxtreqs::ForStorageMarking; diff --git a/compiler/src/passes/instr/call/mod.rs b/compiler/src/passes/instr/call/mod.rs index 2dd34891..35d54452 100644 --- a/compiler/src/passes/instr/call/mod.rs +++ b/compiler/src/passes/instr/call/mod.rs @@ -7,7 +7,7 @@ use rustc_middle::{ mir::{BasicBlock, BinOp, Body, CastKind, ConstOperand, Local, Operand, Place, UnOp}, ty::{Const, GenericArg, Ty, TyCtxt}, }; -use rustc_span::{def_id::DefId, source_map::Spanned}; +use rustc_span::{Spanned, def_id::DefId}; use core::iter; use std::vec; @@ -127,8 +127,6 @@ pub(crate) trait Assigner<'tcx>: AssignmentInfoProvider<'tcx> { is_mutable: bool, ); - fn by_shallow_init_box(&mut self, operand: OperandRef, ty: &Ty<'tcx>); - fn by_wrap_unsafe_binder(&mut self, operand: OperandRef, ty: &Ty<'tcx>); // Special case for SetDiscriminant StatementType since it is similar to a regular assignment @@ -233,6 +231,16 @@ pub(crate) trait MemoryIntrinsicHandler<'tcx> { fn set(&mut self, val: OperandRef, count_ref: OperandRef, count_value: &Operand<'tcx>); fn swap(&mut self, second_ref: OperandRef, second_value: &Operand<'tcx>); + + fn raw_eq(&mut self, second_ref: OperandRef, second_value: &Operand<'tcx>); + + fn compare_bytes( + &mut self, + second_ref: OperandRef, + second_value: &Operand<'tcx>, + count_ref: OperandRef, + count_value: &Operand<'tcx>, + ); } pub(crate) trait AtomicIntrinsicHandler<'tcx> { diff --git a/compiler/src/passes/instr/config.rs b/compiler/src/passes/instr/config.rs index 7d1a9a9d..e8a6f1f7 100644 --- a/compiler/src/passes/instr/config.rs +++ b/compiler/src/passes/instr/config.rs @@ -147,10 +147,11 @@ pub(crate) enum AssignmentKind { UnaryOp, Discriminant, Aggregate, - ShallowInitBox, WrapUnsafeBinder, - IntrinsicBinaryOp, IntrinsicUnaryOp, + IntrinsicBinaryOp, + IntrinsicTernaryOp, + IntrinsicMiscOp, IntrinsicMemoryOp, AtomicBinaryOp, AtomicMemoryOp, diff --git a/compiler/src/passes/instr/counter.rs b/compiler/src/passes/instr/counter.rs index 95285375..981efad9 100644 --- a/compiler/src/passes/instr/counter.rs +++ b/compiler/src/passes/instr/counter.rs @@ -1,7 +1,7 @@ use std::collections::{HashMap, HashSet}; use rustc_hir::def_id::DefId; -use rustc_middle::mir::{Body, mono::MonoItem}; +use rustc_middle::{mir::Body, mono::MonoItem}; use crate::{ passes::{CompilationPass, Storage, StorageExt}, diff --git a/compiler/src/passes/instr/decision/intrinsics.rs b/compiler/src/passes/instr/decision/intrinsics.rs index 8d22fbad..9decf8eb 100644 --- a/compiler/src/passes/instr/decision/intrinsics.rs +++ b/compiler/src/passes/instr/decision/intrinsics.rs @@ -35,6 +35,8 @@ pub(crate) enum MemoryIntrinsicKind { Copy { is_overlapping: bool }, Set, Swap, + RawEq, + CompareBytes, } macro_rules! of_mir_translated_funcs { @@ -67,6 +69,7 @@ macro_rules! of_mir_translated_funcs { wrapping_sub, write_via_move, read_via_copy, + overflow_checks, ub_checks, ) }; @@ -81,11 +84,15 @@ macro_rules! of_const_evaluated_funcs { type_name, type_id, type_id_eq, + type_id_field_representing_type, + type_id_fields, + type_id_variants, + type_id_vtable, ptr_guaranteed_cmp, needs_drop, align_of_val, // FIXME: These two are probably not intrinsics anymore. - likely, + // likely, unlikely, forget, const_allocate, @@ -96,17 +103,18 @@ macro_rules! of_const_evaluated_funcs { assert_zero_valid, assert_mem_uninitialized_valid, assume, + offset_of, + field_offset, + field_representing_type_actual_type_id, + size_of_type_id, + type_of, ) }; } macro_rules! of_contract_funcs { ($macro:ident) => { - $macro!( - contract_check_requires, - contract_check_ensures, - contract_checks - ) + $macro!(contract_check_requires, contract_check_ensures,) }; } @@ -149,42 +157,42 @@ macro_rules! of_float_arith_funcs { round_ties_even_f32, round_ties_even_f64, round_ties_even_f128, - powif64, - powif128, - powif16, - powif32, - powf32, - powf64, - powf128, - powf16, + log2f16, + log2f32, + log2f64, + log2f128, + log10f32, + log10f16, + log10f64, + log10f128, + logf16, + logf32, + logf64, + logf128, + minimum_number_nsz_f16, + minimum_number_nsz_f32, + minimum_number_nsz_f64, + minimum_number_nsz_f128, minimumf16, minimumf32, minimumf64, minimumf128, - minnumf16, - minnumf32, - minnumf64, - minnumf128, - logf128, - logf64, + maximum_number_nsz_f16, + maximum_number_nsz_f32, + maximum_number_nsz_f64, + maximum_number_nsz_f128, maximumf16, maximumf32, maximumf64, maximumf128, - maxnumf16, - maxnumf32, - maxnumf64, - maxnumf128, - log10f128, - log10f32, - log10f16, - logf16, - log10f64, - logf32, - log2f128, - log2f16, - log2f32, - log2f64, + powif16, + powif32, + powif64, + powif128, + powf16, + powf32, + powf64, + powf128, fsub_fast, frem_fast, frem_algebraic, @@ -206,11 +214,8 @@ macro_rules! of_float_arith_funcs { fdiv_fast, fadd_fast, fdiv_algebraic, - fabsf32, + fabs, fadd_algebraic, - fabsf128, - fabsf64, - fabsf16, expf64, exp2f128, expf32, @@ -313,8 +318,6 @@ macro_rules! of_simd_op_funcs { simd_flog10, simd_floor, simd_fma, - simd_fmax, - simd_fmin, simd_fsin, simd_fsqrt, simd_funnel_shl, @@ -328,6 +331,8 @@ macro_rules! of_simd_op_funcs { simd_lt, simd_masked_load, simd_masked_store, + simd_maximum_number_nsz, + simd_minimum_number_nsz, simd_mul, simd_ne, simd_neg, @@ -378,6 +383,8 @@ macro_rules! of_memory_funcs { write_bytes, volatile_set_memory, typed_swap_nonoverlapping, + raw_eq, + compare_bytes, ) }; } @@ -387,22 +394,20 @@ macro_rules! of_to_be_supported_funcs { $macro!( vtable_size, vtable_align, - select_unpredictable, - raw_eq, ptr_mask, ptr_offset_from_unsigned, ptr_offset_from, - compare_bytes, catch_unwind, abort, size_of_val, is_val_statically_known, arith_offset, - carrying_mul_add, autodiff, va_arg, va_copy, va_end, + offload, + return_address, ) }; } @@ -416,6 +421,7 @@ macro_rules! of_one_to_one_funcs { saturating_add, disjoint_bitor, exact_div, + carryless_mul, bitreverse, cttz_nonzero, cttz, @@ -424,6 +430,10 @@ macro_rules! of_one_to_one_funcs { ctlz, bswap, black_box, + select_unpredictable, + unchecked_funnel_shl, + unchecked_funnel_shr, + carrying_mul_add, ) }; } @@ -469,7 +479,7 @@ mod sanity_check { /* NTOE: This is used as a test to make sure that the list do not contain duplicates. * Do not change the count unless some intrinsics are added or removed to Rust. */ - const EXPECTED_COUNT: usize = 293; + const EXPECTED_COUNT: usize = 303; const _ALL_INTRINSICS: [(); EXPECTED_COUNT] = [(); LISTED_COUNT]; } @@ -506,6 +516,7 @@ fn decide_one_to_one_intrinsic_call(intrinsic: IntrinsicDef) -> IntrinsicDecisio rsym::saturating_sub => psym::intrinsic_assign_saturating_sub, rsym::disjoint_bitor => psym::intrinsic_assign_disjoint_bitor, rsym::exact_div => psym::intrinsic_assign_exact_div, + rsym::carryless_mul => psym::intrinsic_assign_carryless_mul, rsym::bitreverse => psym::intrinsic_assign_bitreverse, rsym::cttz_nonzero => psym::intrinsic_assign_cttz_nonzero, rsym::cttz => psym::intrinsic_assign_cttz, @@ -513,6 +524,10 @@ fn decide_one_to_one_intrinsic_call(intrinsic: IntrinsicDef) -> IntrinsicDecisio rsym::ctlz_nonzero => psym::intrinsic_assign_ctlz_nonzero, rsym::ctlz => psym::intrinsic_assign_ctlz, rsym::bswap => psym::intrinsic_assign_bswap, + rsym::unchecked_funnel_shl => psym::intrinsic_assign_funnel_shl, + rsym::unchecked_funnel_shr => psym::intrinsic_assign_funnel_shr, + rsym::select_unpredictable => psym::intrinsic_assign_select_unpredictable, + rsym::carrying_mul_add => psym::intrinsic_assign_carrying_mul_add, rsym::black_box => psym::intrinsic_assign_identity, _ => unreachable!(), }; @@ -578,6 +593,8 @@ fn decide_memory_intrinsic_call(intrinsic: IntrinsicDef) -> IntrinsicDecision { rsym::write_bytes => (MemoryIntrinsicKind::Set, false), rsym::volatile_set_memory => (MemoryIntrinsicKind::Set, true), rsym::typed_swap_nonoverlapping => (MemoryIntrinsicKind::Swap, false), + rsym::raw_eq => (MemoryIntrinsicKind::RawEq, Default::default()), + rsym::compare_bytes => (MemoryIntrinsicKind::CompareBytes, Default::default()), _ => unreachable!(), }; IntrinsicDecision::Memory { kind, is_volatile } diff --git a/compiler/src/passes/instr/decision/mod.rs b/compiler/src/passes/instr/decision/mod.rs index 426cb007..6fdf3e20 100644 --- a/compiler/src/passes/instr/decision/mod.rs +++ b/compiler/src/passes/instr/decision/mod.rs @@ -6,7 +6,7 @@ use const_format::concatcp; use rustc_hir::{def_id::DefId, definitions::DefPathData}; use rustc_middle::{ mir::Body, - ty::{InstanceKind, TyCtxt}, + ty::{InstanceKind, ShimKind, TyCtxt}, }; use rustc_span::Symbol; @@ -72,23 +72,28 @@ pub(super) fn should_instrument<'tcx>( fn decide_instance_kind(kind: &InstanceKind) -> bool { use InstanceKind::*; + use ShimKind::*; match kind { Item(..) - | FnPtrShim(..) - | ClosureOnceShim { .. } - | CloneShim(..) - | ReifyShim(..) - | DropGlue(_, Some(..)) => true, + | Shim( + ShimKind::FnPtr(..) + | ClosureOnce { .. } + | Clone(..) + | Reify(..) + | DropGlue(_, Some(..)), + ) => true, Intrinsic(..) - | VTableShim(..) | Virtual(..) - | ConstructCoroutineInClosureShim { .. } - | ThreadLocalShim(..) - | FutureDropPollShim(..) - | FnPtrAddrShim(..) - | AsyncDropGlue(..) - | DropGlue(_, None) - | AsyncDropGlueCtorShim(..) => false, + | Shim( + VTable(..) + | ConstructCoroutineInClosure { .. } + | ThreadLocal(..) + | FutureDropPoll(..) + | FnPtrAddr(..) + | AsyncDropGlue(..) + | DropGlue(_, None) + | AsyncDropGlueCtor(..), + ) => false, } } @@ -225,7 +230,7 @@ fn is_lang_start_item(tcx: TyCtxt<'_>, def_id: DefId) -> bool { fn is_drop_fn(tcx: TyCtxt<'_>, def_id: DefId) -> bool { let mut drop_fn_ids = { use rustc_hir::LanguageItems as Items; - [Items::drop_in_place_fn, Items::async_drop_in_place_fn] + [Items::drop_glue_fn, Items::async_drop_in_place_fn] .iter() .filter_map(|item| item(tcx.lang_items())) }; diff --git a/compiler/src/passes/instr/decision/rules.rs b/compiler/src/passes/instr/decision/rules.rs index 07b70a7e..b62a29d7 100644 --- a/compiler/src/passes/instr/decision/rules.rs +++ b/compiler/src/passes/instr/decision/rules.rs @@ -192,10 +192,11 @@ define_filter_rule_group!( UnaryOp => unary_op, Discriminant => discriminant, Aggregate => aggregate, - ShallowInitBox => shallow_init_box, WrapUnsafeBinder => wrap_unsafe_binder, - IntrinsicBinaryOp => intrinsic_binary_op, IntrinsicUnaryOp => intrinsic_unary_op, + IntrinsicBinaryOp => intrinsic_binary_op, + IntrinsicTernaryOp => intrinsic_ternary_op, + IntrinsicMiscOp => intrinsic_misc_op, IntrinsicMemoryOp => intrinsic_memory_op, AtomicBinaryOp => atomic_binary_op, AtomicMemoryOp => atomic_memory_op, @@ -472,7 +473,7 @@ impl ToPredicate> for EntityLocationFilter { EntityLocationFilter::DefPathMatch(pattern) => { let pred = pattern.to_predicate(); Box::new(move |(tcx, def_id)| { - let def_path = tcx.def_path_str(def_id); + let def_path = tcx.def_path_str(*def_id); pred.accept(&def_path) }) } diff --git a/compiler/src/passes/instr/mod.rs b/compiler/src/passes/instr/mod.rs index 45a587b8..e9001499 100644 --- a/compiler/src/passes/instr/mod.rs +++ b/compiler/src/passes/instr/mod.rs @@ -17,7 +17,7 @@ use rustc_middle::{ }, ty::{self as mir_ty, IntrinsicDef, Ty, TyCtxt}, }; -use rustc_span::{Span, def_id::DefId, source_map::Spanned}; +use rustc_span::{Span, Spanned, def_id::DefId}; use std::{ borrow::Cow, @@ -264,16 +264,19 @@ fn make_config<'tcx>(storage: &mut dyn Storage, tcx: TyCtxt<'tcx>, def_id: DefId unary_op: top_level.unary_op.then(|| rules.unary_op), discriminant: top_level.discriminant.then(|| rules.discriminant), aggregate: top_level.aggregate.then(|| rules.aggregate), - shallow_init_box: top_level.shallow_init_box.then(|| rules.shallow_init_box), wrap_unsafe_binder: top_level .wrap_unsafe_binder .then(|| rules.wrap_unsafe_binder), - intrinsic_binary_op: top_level - .intrinsic_binary_op - .then(|| rules.intrinsic_binary_op), intrinsic_unary_op: top_level .intrinsic_unary_op .then(|| rules.intrinsic_unary_op), + intrinsic_binary_op: top_level + .intrinsic_binary_op + .then(|| rules.intrinsic_binary_op), + intrinsic_ternary_op: top_level + .intrinsic_ternary_op + .then(|| rules.intrinsic_ternary_op), + intrinsic_misc_op: top_level.intrinsic_misc_op.then(|| rules.intrinsic_misc_op), intrinsic_memory_op: top_level .intrinsic_memory_op .then(|| rules.intrinsic_memory_op), @@ -769,7 +772,7 @@ where Some(def_id) if tcx .lang_items() - .drop_in_place_fn() + .drop_glue_fn() .is_some_and(|id| id == def_id) => { self.instrument_drop_in_place_call(params) @@ -945,11 +948,10 @@ where ) { let rules = &self.call_adder.config().assignment_filter; let filter = match params.args.len() { - 2 => rules.intrinsic_binary_op, 1 => rules.intrinsic_unary_op, - _ => unreachable!( - "One-to-one intrinsic calls are expected to have either 1 or 2 arguments." - ), + 2 => rules.intrinsic_binary_op, + 3 => rules.intrinsic_ternary_op, + _ => rules.intrinsic_misc_op, }; match filter { @@ -1183,9 +1185,9 @@ where Rvalue::UnaryOp(..) => rules.unary_op, Rvalue::Discriminant(..) => rules.discriminant, Rvalue::Aggregate(..) => rules.aggregate, - Rvalue::ShallowInitBox(..) => rules.shallow_init_box, Rvalue::CopyForDeref(..) => rules.use_, Rvalue::WrapUnsafeBinder(..) => rules.wrap_unsafe_binder, + Rvalue::Reborrow(..) => None, }; match filter { Some(include_info) => { @@ -1217,7 +1219,7 @@ where self.super_rvalue(rvalue) } - fn visit_use(&mut self, operand: &Operand<'tcx>) { + fn visit_use(&mut self, operand: &Operand<'tcx>, _: &mir::WithRetag) { let operand_ref = self.call_adder.reference_operand(operand); self.call_adder.by_use(operand_ref) } @@ -1315,7 +1317,7 @@ where }), Adt(def_id, variant, _, _, None) => { use rustc_hir::def::DefKind; - match self.call_adder.tcx().def_kind(def_id) { + match self.call_adder.tcx().def_kind(*def_id) { DefKind::Enum => Box::new(|fields| {self.call_adder.by_aggregate_enum(fields, *variant)}), DefKind::Struct => Box::new(|fields| { self.call_adder.by_aggregate_struct(fields) @@ -1352,20 +1354,36 @@ where add_call(operands.as_slice()) } - fn visit_shallow_init_box(&mut self, operand: &Operand<'tcx>, ty: &Ty<'tcx>) { - let operand_ref = self.call_adder.reference_operand(operand); - self.call_adder.by_shallow_init_box(operand_ref, ty); - } - fn visit_copy_for_deref(&mut self, place: &Place<'tcx>) { let operand = Operand::Copy(*place); - self.visit_use(&operand) + self.visit_use(&operand, &mir::WithRetag::No) } fn visit_wrap_unsafe_binder(&mut self, operand: &Operand<'tcx>, ty: &Ty<'tcx>) -> () { let operand_ref = self.call_adder.reference_operand(operand); self.call_adder.by_wrap_unsafe_binder(operand_ref, ty); } + + fn visit_reborrow( + &mut self, + target_ty: &Ty<'tcx>, + mutability: &rustc_hir::Mutability, + place: &Place<'tcx>, + ) { + // The GVN pass should replace reborrows with use. + panic!( + concat!( + "Reborrow is not expected to be observed at this point. ", + "It should have been optimized away by the compiler. ", + "({:?}, {:?}, {:?}) ", + "at {:?}" + ), + target_ty, + mutability, + place, + self.call_adder.source_info().span, + ); + } } impl<'tcx, C> LeafAssignmentVisitor @@ -1415,7 +1433,7 @@ impl<'tcx, C: ctxtreqs::ForOperandRef<'tcx>> RuntimeCallAdder { let reference = self.reference_operand_spanned(operand); PointerPackage { reference, - value: operand.node.clone(), + value: operand.node.to_copy(), ty: operand.node.ty(self, self.tcx()), } } @@ -1439,7 +1457,7 @@ fn instrument_memory_intrinsic_call<'tcx, 'a, C>( let tcx = call_adder.tcx(); let mut call_adder = call_adder.before(); - // FIXME: Destination is only used for load operation. But assignment_id is used for all. + // FIXME: Destination is only used for some operations. But assignment_id is used for all. // These dummy values can be avoided by breaking the context into smaller ones. let dest_ref = destination.map_or(PlaceRef::INVALID, |d| call_adder.reference_place(d)); let dest_ty = destination.map_or(tcx.types.unit, |d| d.ty(&call_adder, tcx).ty); @@ -1491,6 +1509,17 @@ fn instrument_memory_intrinsic_call<'tcx, 'a, C>( let second_ref = call_adder.reference_operand_spanned(second); call_adder.swap(second_ref, &second.node); } + RawEq => { + let second: &Spanned> = &args[1]; + let second_ref = call_adder.reference_operand_spanned(second); + call_adder.raw_eq(second_ref, &second.node); + } + CompareBytes => { + let second: &Spanned> = &args[1]; + let second_ref = call_adder.reference_operand_spanned(second); + let count_ref = call_adder.reference_operand_spanned(&args[2]); + call_adder.compare_bytes(second_ref, &second.node, count_ref, &args[2].node); + } } } None => { diff --git a/compiler/src/passes/instr/pri_utils.rs b/compiler/src/passes/instr/pri_utils.rs index 3539fbfe..11e79fe4 100644 --- a/compiler/src/passes/instr/pri_utils.rs +++ b/compiler/src/passes/instr/pri_utils.rs @@ -74,7 +74,7 @@ pub(crate) mod sym { common::pri::pass_func_names_to!(symbols_in_pri, all_comma_separated); - pub(crate) const ALL_MAINS: [LeafSymbol; 135] = + pub(crate) const ALL_MAINS: [LeafSymbol; 141] = common::pri::pass_func_names_to!(bracket, all_comma_separated); pub(crate) mod intrinsics { @@ -104,6 +104,7 @@ pub(crate) mod sym { intrinsic_assign_saturating_sub, intrinsic_assign_disjoint_bitor, intrinsic_assign_exact_div, + intrinsic_assign_carryless_mul, intrinsic_assign_bitreverse, intrinsic_assign_cttz_nonzero, intrinsic_assign_cttz, @@ -111,6 +112,10 @@ pub(crate) mod sym { intrinsic_assign_ctlz_nonzero, intrinsic_assign_ctlz, intrinsic_assign_bswap, + intrinsic_assign_funnel_shl, + intrinsic_assign_funnel_shr, + intrinsic_assign_select_unpredictable, + intrinsic_assign_carrying_mul_add, intrinsic_atomic_load, intrinsic_atomic_store, @@ -124,6 +129,8 @@ pub(crate) mod sym { intrinsic_memory_copy, intrinsic_memory_set, intrinsic_memory_swap, + intrinsic_assign_raw_eq, + intrinsic_assign_compare_bytes, } pub(crate) mod atomic { @@ -178,6 +185,8 @@ pub(crate) mod sym { intrinsic_memory_copy, intrinsic_memory_set, intrinsic_memory_swap, + intrinsic_assign_raw_eq, + intrinsic_assign_compare_bytes, } } } @@ -478,7 +487,7 @@ pub(super) fn filter_main_funcs<'tcx>( all_pri_items: &[DefId], ) -> HashMap { let items = filter_pri_items(tcx, all_pri_items, sym::MODULE_MARKER) - .filter(|def_id| matches!(tcx.def_kind(def_id), DefKind::Fn | DefKind::AssocFn)) + .filter(|def_id| matches!(tcx.def_kind(*def_id), DefKind::Fn | DefKind::AssocFn)) .inspect(|def_id| { log_debug!( target: TAG_DISCOVERY, diff --git a/compiler/src/passes/instr/rec_check.rs b/compiler/src/passes/instr/rec_check.rs index 9a54ecc7..7ceaf96d 100644 --- a/compiler/src/passes/instr/rec_check.rs +++ b/compiler/src/passes/instr/rec_check.rs @@ -1,10 +1,11 @@ use std::collections::{HashMap, HashSet}; use rustc_middle::{ - mir::{TerminatorKind, mono::MonoItem}, + mir::TerminatorKind, + mono::MonoItem, ty::{EarlyBinder, Instance, TyCtxt, TyKind, TypingEnv}, }; -use rustc_span::{Span, source_map::Spanned}; +use rustc_span::{Span, Spanned}; use common::log_info; @@ -114,7 +115,7 @@ fn collect_called_instances<'tcx>( let callee_ty = instance.instantiate_mir_and_normalize_erasing_regions( tcx, TypingEnv::fully_monomorphized(), - EarlyBinder::bind(callee_ty), + EarlyBinder::bind(tcx, callee_ty), ); if let TyKind::FnDef(def_id, args) = *callee_ty.kind() { Instance::try_resolve(tcx, TypingEnv::fully_monomorphized(), def_id, args) diff --git a/compiler/src/passes/logger.rs b/compiler/src/passes/logger.rs index b2246fe7..35cde793 100644 --- a/compiler/src/passes/logger.rs +++ b/compiler/src/passes/logger.rs @@ -136,7 +136,7 @@ where fn visit_codegen_units<'tcx>( tcx: rustc_middle::ty::TyCtxt<'tcx>, - units: &mut [mir::mono::CodegenUnit<'tcx>], + units: &mut [rustc_middle::mono::CodegenUnit<'tcx>], storage: &mut dyn Storage, ) { log_debug!("target: {} Visiting codegen units", target!()); diff --git a/compiler/src/passes/md_types.rs b/compiler/src/passes/md_types.rs index e1ee9170..9870f607 100644 --- a/compiler/src/passes/md_types.rs +++ b/compiler/src/passes/md_types.rs @@ -1,9 +1,12 @@ use itertools::Itertools; -use rustc_middle::mir::{self, visit::Visitor}; use rustc_middle::ty::{ EarlyBinder, GenericArgsRef, Instance, Ty, TyCtxt, TyKind, TypeSuperVisitable, TypeVisitable, TypeVisitableExt, TypeVisitor, TypingEnv, }; +use rustc_middle::{ + mir::{self, visit::Visitor}, + mono, +}; use rustc_type_ir::inherent::AdtDef; use std::collections::{HashMap, HashSet}; @@ -74,7 +77,7 @@ fn scan_all_bodies<'s>(tcx: TyCtxt) -> (HashSet, HashSet, Hash .iter() .for_each(|unit| { unit.items().iter().for_each(|(item, _)| match item { - mir::mono::MonoItem::Fn(instance) => { + mono::MonoItem::Fn(instance) => { let body = tcx.instance_mir(instance.def); log_debug!(target: TAG, "Scanning types in for ManuallyDrop {:?}", instance); @@ -192,10 +195,12 @@ impl<'tcx, 's, 'b> TypeVisitor> for MdCollectorVisitor<'tcx, 's, 'b return; } + let tcx = self.tcx; + let ty = self.tcx.instantiate_and_normalize_erasing_regions( self.args, self.typing_env, - EarlyBinder::bind(ty), + EarlyBinder::bind(tcx, ty), ); if !self.fully_visited_types.insert(ty) { @@ -204,7 +209,7 @@ impl<'tcx, 's, 'b> TypeVisitor> for MdCollectorVisitor<'tcx, 's, 'b } if (IsMdContainerVisitor { - tcx: self.tcx, + tcx, args: self.args, typing_env: self.typing_env, evaluated_types: self.evaluated_types, @@ -220,8 +225,8 @@ impl<'tcx, 's, 'b> TypeVisitor> for MdCollectorVisitor<'tcx, 's, 'b // Additional recursions match ty.kind() { TyKind::Adt(adt, args) => adt - .all_field_tys(self.tcx) - .iter_instantiated(self.tcx, args) + .all_field_tys(tcx) + .iter_instantiated(tcx, args) .for_each(|t| t.visit_with(self)), _ => {} } @@ -247,7 +252,7 @@ impl<'tcx, 's> TypeVisitor> for IsMdContainerVisitor<'tcx, 's> { let ty = self.tcx.instantiate_and_normalize_erasing_regions( self.args, self.typing_env, - EarlyBinder::bind(ty), + EarlyBinder::bind(self.tcx, ty), ); if let Some(&is_container) = self.evaluated_types.get(&ty) { diff --git a/compiler/src/passes/mod.rs b/compiler/src/passes/mod.rs index c4dcc91e..9fec49f2 100644 --- a/compiler/src/passes/mod.rs +++ b/compiler/src/passes/mod.rs @@ -17,7 +17,7 @@ use std::sync::{Arc, Mutex}; use rustc_ast as ast; use rustc_driver::{self as driver, Compilation}; use rustc_interface::interface; -use rustc_middle::{mir, ty as mir_ty}; +use rustc_middle::{mir, mono, ty as mir_ty}; use rustc_session::Session; use paste::paste; @@ -121,7 +121,7 @@ pub(crate) trait CompilationPass { fn visit_codegen_units<'tcx>( tcx: mir_ty::TyCtxt<'tcx>, - units: &mut [mir::mono::CodegenUnit<'tcx>], + units: &mut [mono::CodegenUnit<'tcx>], storage: &mut dyn Storage, ) { Default::default() @@ -205,11 +205,10 @@ pub(crate) trait StorageExt { mod implementation { use super::*; - use mir::mono::{CodegenUnit, MonoItemPartitions}; use mir_ty::TyCtxt; use rustc_driver::Compilation; use rustc_hir::def_id::DefId; - use rustc_middle::query::TyCtxtAt; + use rustc_middle::mono::{CodegenUnit, MonoItemPartitions}; use rustc_span::{Symbol, def_id::LocalDefId}; use std::cell::Cell; @@ -286,7 +285,7 @@ mod implementation { for<'tcx> fn(TyCtxt<'tcx>, DefId) -> &'tcx mir::Body<'tcx> > = Cell::new(|_, _| unreachable!()); static ORIGINAL_MIR_SHIMS: Cell< - for<'tcx> fn(TyCtxt<'tcx>, mir_ty::InstanceKind<'tcx>) -> mir::Body<'tcx> + for<'tcx> fn(TyCtxt<'tcx>, mir_ty::ShimKind<'tcx>) -> mir::Body<'tcx> > = Cell::new(|_, _| unreachable!()); static ORIGINAL_SHOULD_CODEGEN: Cell< for<'tcx> fn(TyCtxt<'tcx>, mir_ty::Instance<'tcx>) -> bool @@ -495,16 +494,13 @@ mod implementation { tcx.arena.alloc(body) } - fn mir_shims<'tcx>( - tcx: TyCtxt<'tcx>, - instance: mir_ty::InstanceKind<'tcx>, - ) -> mir::Body<'tcx> { + fn mir_shims<'tcx>(tcx: TyCtxt<'tcx>, kind: mir_ty::ShimKind<'tcx>) -> mir::Body<'tcx> { // NOTE: It is possible that this function is called before the callbacks. global::set_ctxt_id(tcx); /* NOTE: Currently, it seems that there is no way to deallocate * something from arena. So, we have to clone the body. */ - let mut body = ORIGINAL_MIR_SHIMS.get()(tcx, instance); + let mut body = ORIGINAL_MIR_SHIMS.get()(tcx, kind); let mut storage = global::get_storage(); T::visit_mir_body_before(tcx, &body, &mut storage); T::transform_mir_body(tcx, &mut body, &mut storage); @@ -694,14 +690,14 @@ mod implementation { */ use super::*; - use rustc_codegen_ssa::{CodegenResults, traits::CodegenBackend}; - use rustc_data_structures::fx::FxIndexMap; + use rustc_codegen_ssa::{CompiledModules, CrateInfo, traits::CodegenBackend}; + use rustc_hir::attrs::CrateType; use rustc_metadata::{EncodedMetadata, creader::MetadataLoaderDyn}; + use rustc_middle::dep_graph::WorkProductMap; use rustc_middle::util::Providers; - use rustc_query_system::dep_graph::{WorkProduct, WorkProductId}; use rustc_session::{ Session, - config::{self, OutputFilenames, PrintRequest}, + config::{OutputFilenames, PrintRequest}, }; use delegate::delegate; @@ -714,31 +710,46 @@ mod implementation { impl CodegenBackend for CodegenBackendWrapper { delegate! { to self.backend { - fn locale_resource(&self) -> &'static str; fn name(&self) -> &'static str; fn init(&self, sess: &Session); fn print(&self, req: &PrintRequest, out: &mut String, sess: &Session); + fn target_config(&self, sess: &Session) -> rustc_codegen_ssa::TargetConfig; + fn supported_crate_types(&self, _sess: &Session) -> Vec; fn print_passes(&self); fn print_version(&self); + fn replaced_intrinsics(&self) -> Vec; + fn fallback_intrinsics(&self) -> Vec; + fn thin_lto_supported(&self) -> bool; + fn has_zstd(&self) -> bool; + fn has_mnemonic(&self, _sess: &Session, _mnemonic: &str) -> bool; + fn metadata_loader(&self) -> Box; fn provide(&self, providers: &mut Providers); + fn target_cpu(&self, sess: &Session) -> String; + fn join_codegen( &self, ongoing_codegen: Box, sess: &Session, outputs: &OutputFilenames, - ) -> (CodegenResults, FxIndexMap); + crate_info: &CrateInfo, + ) -> (CompiledModules, WorkProductMap); + + fn print_pass_timings(&self) ; + fn print_statistics(&self) ; + fn print_statistics_json(&self) -> String ; fn link( &self, sess: &Session, - codegen_results: CodegenResults, + compiled_modules: CompiledModules, + crate_info: CrateInfo, metadata: EncodedMetadata, outputs: &OutputFilenames, ); @@ -761,18 +772,15 @@ mod implementation { pub(super) fn get_backend_maker( pass: PassHolder, - ) -> Box< - dyn FnOnce(&config::Options, &rustc_target::spec::Target) -> Box - + Send, - > { - Box::new(|opts, target| { + ) -> Box Box + Send> { + Box::new(|sess| { // This is the default implementation taken from `interface::run_compiler`. - let early_dcx = rustc_session::EarlyDiagCtxt::new(opts.error_format); + let early_dcx = rustc_session::EarlyDiagCtxt::new(sess.opts.error_format); let backend = rustc_interface::util::get_codegen_backend( &early_dcx, - &opts.sysroot, - opts.unstable_opts.codegen_backend.as_deref(), - &target, + &sess.opts.sysroot, + sess.opts.unstable_opts.codegen_backend.as_deref(), + &sess.target, ); Box::new(CodegenBackendWrapper { backend, pass }) }) diff --git a/compiler/src/passes/p_map_exp.rs b/compiler/src/passes/p_map_exp.rs index b2ec5799..717ee60f 100644 --- a/compiler/src/passes/p_map_exp.rs +++ b/compiler/src/passes/p_map_exp.rs @@ -54,7 +54,7 @@ impl CompilationPass for ProgramMapExporter { .iter() .flat_map(|unit| unit.items()) .flat_map(|(item, _)| match item { - rustc_middle::mir::mono::MonoItem::Fn(instance) => Some(instance.def), + rustc_middle::mono::MonoItem::Fn(instance) => Some(instance.def), _ => None, }) .for_each(|instance| { diff --git a/compiler/src/passes/program_dep.rs b/compiler/src/passes/program_dep.rs index 22cbc74c..464f31b6 100644 --- a/compiler/src/passes/program_dep.rs +++ b/compiler/src/passes/program_dep.rs @@ -53,7 +53,7 @@ impl CompilationPass for ProgramDependenceMapExporter { .iter() .flat_map(|unit| unit.items()) .flat_map(|(item, _)| match item { - rustc_middle::mir::mono::MonoItem::Fn(instance) => Some(instance.def), + rustc_middle::mono::MonoItem::Fn(instance) => Some(instance.def), _ => None, }) .for_each(|instance_kind| { diff --git a/compiler/src/passes/type_info.rs b/compiler/src/passes/type_info.rs index 8957ac1a..54a12095 100644 --- a/compiler/src/passes/type_info.rs +++ b/compiler/src/passes/type_info.rs @@ -1,12 +1,13 @@ -use rustc_abi::{ - FieldIdx, FieldsShape, Layout, LayoutData, Scalar, TagEncoding, VariantIdx, Variants, -}; -use rustc_middle::mir::{self, visit::Visitor}; +use rustc_abi::{FieldIdx, FieldsShape, Layout, Scalar, TagEncoding, VariantIdx, Variants}; use rustc_middle::ty::{ EarlyBinder, GenericArgsRef, Ty, TyCtxt, TyKind, TypeSuperVisitable, TypeVisitable, TypeVisitableExt, TypeVisitor, TypingEnv, layout::{HasTyCtxt, HasTypingEnv, LayoutCx, TyAndLayout}, }; +use rustc_middle::{ + mir::{self, visit::Visitor}, + mono, +}; use rustc_type_ir::inherent::AdtDef; use std::collections::HashMap; @@ -104,7 +105,7 @@ fn capture_all_types<'s>(tcx: TyCtxt) -> HashMap { .iter() .for_each(|unit| { unit.items().iter().for_each(|(item, _)| match item { - mir::mono::MonoItem::Fn(instance) => { + mono::MonoItem::Fn(instance) => { let body = tcx.instance_mir(instance.def); log_debug!(target: TAG_TYPE_EXPORT, "Exporting types in {:?}", instance); let mut place_visitor = TyVisitor { @@ -226,7 +227,7 @@ impl<'tcx, 's, 'b> TypeVisitor> for TyVisitor<'tcx, 's, 'b> { let normalized_ty = self.tcx.instantiate_and_normalize_erasing_regions( self.args, self.typing_env, - EarlyBinder::bind(ty), + EarlyBinder::bind(self.tcx, ty), ); if normalized_ty != ty { log_debug!(target: TAG_TYPE_EXPORT, "Normalized ty with param: {} -> {}", ty, normalized_ty); @@ -283,10 +284,10 @@ where TypeInfo::SIZE_UNSIZED }; - let (variants, tag) = match &self.variants { + let (variants, tag) = match self.variants() { Variants::Empty => (vec![], None), - Variants::Single { index, .. } => ( - vec![self.0.to_runtime(cx, ty_layout)], + Variants::Single { index } => ( + vec![index.to_runtime(cx, ty_layout.for_variant(cx, *index))], if ty.is_enum() { Some(TagInfo::Constant { discr_bit_rep: ty.discriminant_for_variant(tcx, *index).unwrap().val, @@ -303,7 +304,7 @@ where } => ( variants .iter_enumerated() - .map(|(i, v)| v.to_runtime(cx, ty_layout.for_variant(cx, i))) + .map(|(i, _)| i.to_runtime(cx, ty_layout.for_variant(cx, i))) .collect(), Some((tag, tag_encoding, tag_field).to_runtime(cx, ty_layout)), ), @@ -322,7 +323,7 @@ where } } -impl<'tcx, Cx> ToRuntimeInfo<'tcx, Cx, VariantInfo> for &LayoutData +impl<'tcx, Cx> ToRuntimeInfo<'tcx, Cx, VariantInfo> for VariantIdx where Cx: HasTyCtxt<'tcx> + HasTypingEnv<'tcx>, { @@ -332,16 +333,9 @@ where where Cx: 'tcx, { - let index = match self.variants { - Variants::Single { index } => index, - Variants::Empty | Variants::Multiple { .. } => { - unreachable!("Empty and recursive variants are not expected") - } - }; - VariantInfo { - index: index.as_u32(), - fields: self.fields.to_runtime(cx, ty_layout), + index: self.as_u32(), + fields: ty_layout.fields.to_runtime(cx, ty_layout), } } } @@ -381,8 +375,8 @@ impl<'tcx, Cx> ToRuntimeInfo<'tcx, Cx, TagEncodingInfo> for &TagEncoding TagEncodingInfo::Niche { // The variant index is implicitly used as the value for the discriminant. non_niche_value: untagged_variant.as_u32() as u128, - niche_value_range: (niche_variants.start().as_u32() as u128) - ..=(niche_variants.end().as_u32() as u128), + niche_value_range: (niche_variants.start.as_u32() as u128) + ..=(niche_variants.last.as_u32() as u128), tag_value_start: *niche_start, }, } diff --git a/compiler/src/utils/mod.rs b/compiler/src/utils/mod.rs index a91c7fb2..222e534e 100644 --- a/compiler/src/utils/mod.rs +++ b/compiler/src/utils/mod.rs @@ -31,7 +31,7 @@ pub(crate) mod mir { use rustc_hir::{def::DefKind, definitions::DisambiguatedDefPathData}; use rustc_middle::{ mir::{Body, Local, Location, Statement, Terminator}, - ty::{GenericArgsRef, Instance, InstanceKind, TyCtxt, TypingEnv, TypingMode}, + ty::{GenericArgsRef, Instance, InstanceKind, ShimKind, TyCtxt, TypingEnv, TypingMode}, }; use rustc_span::def_id::{DefId, LocalDefId}; @@ -70,16 +70,15 @@ pub(crate) mod mir { } fn typing_env_in_body(self, def_id: DefId) -> TypingEnv<'tcx> { - TypingEnv { - typing_mode: if let Some(def_id) = def_id.as_local() { + TypingEnv::new(self.param_env(def_id), { + if let Some(def_id) = def_id.as_local() { self.typing_mode_for_body(def_id) } else { // It looks like that the type will be resolved at the crate level, // so for external bodies they should be already resolved. TypingMode::non_body_analysis() - }, - param_env: self.param_env(def_id), - } + } + }) } // A safe wrapper around `opaque_types_defined_by` @@ -89,8 +88,8 @@ pub(crate) mod mir { DefKind::AssocFn | DefKind::Fn | DefKind::Static { .. } - | DefKind::Const - | DefKind::AssocConst + | DefKind::Const { .. } + | DefKind::AssocConst { .. } | DefKind::AnonConst | DefKind::Closure | DefKind::InlineConst => { @@ -144,7 +143,10 @@ pub(crate) mod mir { let erased = self.erase_and_anonymize_regions(typing_env.as_query_input((def_id, args))); if self - .try_normalize_erasing_regions(erased.typing_env, erased.value.1) + .try_normalize_erasing_regions( + erased.typing_env, + rustc_middle::ty::Unnormalized::new(erased.value.1), + ) .is_err() { return None; @@ -221,43 +223,51 @@ pub(crate) mod mir { impl<'tcx> InstanceKindExt<'tcx> for InstanceKind<'tcx> { fn discriminant(&self) -> InstanceKindDiscr { use InstanceKind::*; + use ShimKind::*; match self { Item(..) => 0, Intrinsic(..) => 1, - VTableShim(..) => 2, - ReifyShim(..) => 3, - FnPtrShim(..) => 4, Virtual(..) => 5, - ClosureOnceShim { .. } => 6, - ConstructCoroutineInClosureShim { .. } => 7, - ThreadLocalShim(..) => 8, - FutureDropPollShim(..) => 9, - DropGlue(..) => 10, - CloneShim(..) => 11, - FnPtrAddrShim(..) => 12, - AsyncDropGlueCtorShim(..) => 13, - AsyncDropGlue(..) => 14, + Shim(kind) => match kind { + VTable(..) => 2, + Reify(..) => 3, + FnPtr(..) => 4, + ClosureOnce { .. } => 6, + ConstructCoroutineInClosure { .. } => 7, + ThreadLocal(..) => 8, + FutureDropPoll(..) => 9, + DropGlue(..) => 10, + Clone(..) => 11, + FnPtrAddr(..) => 12, + AsyncDropGlueCtor(..) => 13, + AsyncDropGlue(..) => 14, + }, } } fn has_identical_polymorphic_body(&self) -> bool { use InstanceKind::*; + use ShimKind::*; match self { Item(..) => true, - Intrinsic(..) => false, // Should not even have a body - VTableShim(..) => false, // Opaque for MIR - ReifyShim(..) => false, // Opaque for MIR - FnPtrShim(..) => false, // Different for different signatures - Virtual(..) => false, // Opaque for MIR - ClosureOnceShim { .. } => true, // Always ::call_mut - ConstructCoroutineInClosureShim { .. } => false, - ThreadLocalShim(..) => true, // Should not even have generic parameters (not sure) - FutureDropPollShim(..) => false, // Different for different types (not sure) - DropGlue(..) => false, // Different for different types - CloneShim(..) => false, // Different for different types - FnPtrAddrShim(..) => false, // Different for different types - AsyncDropGlueCtorShim(..) => false, // Different for different types - AsyncDropGlue(..) => false, // Different for different types + Intrinsic(..) => false, // Should not even have a body + Virtual(..) => false, // Opaque for MIR + Shim( + VTable(..) // Opaque for MIR + | Reify(..) // Opaque for MIR + | FnPtr(..) // Different for different signatures + | ConstructCoroutineInClosure { .. } // Different for different types (not sure) + | FutureDropPoll(..) // Different for different types (not sure) + | DropGlue(..) // Different for different types + | Clone(..) // Different for different types + | FnPtrAddr(..) // Different for different types + | AsyncDropGlueCtor(..) // Different for different types + | AsyncDropGlue(..), // Different for different types + ) => false, + Shim( + ClosureOnce { .. } // Always ::call_mut + | ThreadLocal(..) // Should not even have generic parameters (not sure) + ) => true, } } diff --git a/compiler/src/visit.rs b/compiler/src/visit.rs index d1e8c79a..39a90ffe 100644 --- a/compiler/src/visit.rs +++ b/compiler/src/visit.rs @@ -5,13 +5,13 @@ use rustc_middle::{ mir::{ AggregateKind, AssertMessage, BackwardIncompatibleDropReason, BasicBlock, BinOp, BorrowKind, CallSource, CastKind, FakeReadCause, InlineAsmMacro, InlineAsmOperand, Local, - NonDivergingIntrinsic, Operand, Place, RawPtrKind, RetagKind, Rvalue, StatementKind, - SwitchTargets, TerminatorKind, UnOp, UnwindAction, UnwindTerminateReason, - UserTypeProjection, coverage::CoverageKind, + NonDivergingIntrinsic, Operand, Place, RawPtrKind, Rvalue, StatementKind, SwitchTargets, + TerminatorKind, UnOp, UnwindAction, UnwindTerminateReason, UserTypeProjection, WithRetag, + coverage::CoverageKind, }, ty::{Const, Region, Ty, Variance}, }; -use rustc_span::{Span, source_map::Spanned}; +use rustc_span::{Span, Spanned}; macro_rules! make_statement_kind_visitor { ($visitor_trait_name:ident, $($mutability:ident)?) => { @@ -45,10 +45,6 @@ macro_rules! make_statement_kind_visitor { Default::default() } - fn visit_retag(&mut self, kind: & $($mutability)? RetagKind, place: & $($mutability)? Place<'tcx>) -> T { - Default::default() - } - fn visit_place_mention(&mut self, place: & $($mutability)? Place<'tcx>) -> T { Default::default() } @@ -98,7 +94,6 @@ macro_rules! make_statement_kind_visitor { } => self.visit_set_discriminant(place, variant_index), StatementKind::StorageLive(local) => self.visit_storage_live(local), StatementKind::StorageDead(local) => self.visit_storage_dead(local), - StatementKind::Retag(kind, place) => self.visit_retag(kind, place), StatementKind::PlaceMention(place) => self.visit_place_mention(place), StatementKind::AscribeUserType(box (place, user_type_proj), variance) => { self.visit_ascribe_user_type(place, user_type_proj, variance) @@ -265,7 +260,6 @@ macro_rules! make_terminator_kind_visitor { ref $($mutability)? unwind, ref $($mutability)? replace, ref $($mutability)? drop, - ref $($mutability)? async_fut, } => self.visit_drop(place, target, unwind, replace), & $($mutability)? Call { ref $($mutability)? func, @@ -345,7 +339,11 @@ macro_rules! make_rvalue_visitor { self.super_rvalue(rvalue) } - fn visit_use(&mut self, operand: & $($mutability)? Operand<'tcx>) -> T { + fn visit_use( + &mut self, + operand: & $($mutability)? Operand<'tcx>, + with_retag: & $($mutability)? WithRetag, + ) -> T { Default::default() } @@ -377,10 +375,6 @@ macro_rules! make_rvalue_visitor { Default::default() } - fn visit_len(&mut self, place: & $($mutability)? Place<'tcx>) -> T { - Default::default() - } - fn visit_cast( &mut self, kind: & $($mutability)? CastKind, @@ -414,14 +408,6 @@ macro_rules! make_rvalue_visitor { Default::default() } - fn visit_shallow_init_box( - &mut self, - operand: & $($mutability)? Operand<'tcx>, - ty: & $($mutability)? Ty<'tcx>, - ) -> T { - Default::default() - } - fn visit_copy_for_deref(&mut self, place: & $($mutability)? Place<'tcx>) -> T { Default::default() } @@ -434,9 +420,18 @@ macro_rules! make_rvalue_visitor { Default::default() } + fn visit_reborrow( + &mut self, + target_ty: & $($mutability)? Ty<'tcx>, + mutability: & $($mutability)? rustc_hir::Mutability, + place: & $($mutability)? Place<'tcx> + ) -> T { + Default::default() + } + fn super_rvalue(&mut self, rvalue: & $($mutability)? Rvalue<'tcx>) -> T { match rvalue { - Rvalue::Use(operand) => self.visit_use(operand), + Rvalue::Use(operand, with_retag) => self.visit_use(operand, with_retag), Rvalue::Repeat(operand, count) => self.visit_repeat(operand, count), Rvalue::Ref(region, borrow_kind, place) => { self.visit_ref(region, borrow_kind, place) @@ -448,9 +443,9 @@ macro_rules! make_rvalue_visitor { Rvalue::UnaryOp(op, operand) => self.visit_unary_op(op, operand), Rvalue::Discriminant(place) => self.visit_discriminant(place), Rvalue::Aggregate(kind, operands) => self.visit_aggregate(kind, operands), - Rvalue::ShallowInitBox(operand, ty) => self.visit_shallow_init_box(operand, ty), Rvalue::CopyForDeref(place) => self.visit_copy_for_deref(place), Rvalue::WrapUnsafeBinder(operand, ty) => self.visit_wrap_unsafe_binder(operand, ty), + Rvalue::Reborrow(ty, mutability, place) => self.visit_reborrow(ty, mutability, place), } } } diff --git a/leafc_config.toml b/leafc_config.toml index 27472592..0003e856 100644 --- a/leafc_config.toml +++ b/leafc_config.toml @@ -54,7 +54,7 @@ all = [ # [[instr_rules.exclude]] # entity = "assignment_info" -# kind = { any = [ "shallow_init_box" ] } +# kind = { any = [ "wrap_unsafe_binder" ] } # all = [] # [[instr_rules.exclude]] diff --git a/runtime/lib/Cargo.toml b/runtime/lib/Cargo.toml index e5a2303a..cb9dc8cf 100644 --- a/runtime/lib/Cargo.toml +++ b/runtime/lib/Cargo.toml @@ -36,7 +36,7 @@ tracing = { workspace = true, features = ["valuable"] } valuable = { version = "0.1.1", features = ["derive"] } valuable-serde = "0.1.1" tracing-appender = "0.2" -json-subscriber = "0.2.7" +json-subscriber = "0.3" tracing-flame = { version = "0.2.0", optional = true } # Refer to the compatibility table in their repository. The semantic versioning does not seems to be reliable. tracing-tracy = { version = "=0.11.2", optional = true } diff --git a/runtime/lib/src/abs/expr/chained.rs b/runtime/lib/src/abs/expr/chained.rs index 18176b83..e5ba7075 100644 --- a/runtime/lib/src/abs/expr/chained.rs +++ b/runtime/lib/src/abs/expr/chained.rs @@ -143,6 +143,7 @@ where impl_binary_expr_method!(and or xor); impl_binary_expr_method!(shl shl_unchecked shr shr_unchecked); impl_binary_expr_method!(rotate_left rotate_right); + impl_binary_expr_method!(carryless_mul); impl_binary_expr_method!(eq ne lt le gt ge cmp); impl_binary_expr_method!(offset + pointee_size: TypeSize); } @@ -178,6 +179,7 @@ where impl_ternary_expr_method!(ternary_op + op: TernaryOp); impl_ternary_expr_method!(if_then_else); + impl_ternary_expr_method!(funnel_shl funnel_shr); } impl CastExprBuilder for ChainedExprBuilder diff --git a/runtime/lib/src/abs/expr/composite.rs b/runtime/lib/src/abs/expr/composite.rs index e52eef9c..fd927ac5 100644 --- a/runtime/lib/src/abs/expr/composite.rs +++ b/runtime/lib/src/abs/expr/composite.rs @@ -6,10 +6,10 @@ use super::*; /// binary & unary expression builders. #[derive(Clone, Default)] pub(crate) struct CompositeExprBuilder< - B: BinaryExprBuilder, - U: UnaryExprBuilder, - T: TernaryExprBuilder, - C: CastExprBuilder, + B, /*Binary*/ + U, /*Unary*/ + T, /*Ternary*/ + C, /*Cast*/ > { pub(crate) binary: B, pub(crate) unary: U, @@ -77,9 +77,6 @@ macro_rules_method_with_optional_args!(impl_cast_expr_method { impl BinaryExprBuilder for CompositeExprBuilder where B: BinaryExprBuilder, - U: UnaryExprBuilder, - T: TernaryExprBuilder, - C: CastExprBuilder, { type ExprRefPair<'a> = B::ExprRefPair<'a>; type Expr<'a> = B::Expr<'a>; @@ -101,16 +98,14 @@ where impl_binary_expr_method!(and or xor); impl_binary_expr_method!(shl shl_unchecked shr shr_unchecked); impl_binary_expr_method!(rotate_left rotate_right); + impl_binary_expr_method!(carryless_mul); impl_binary_expr_method!(eq ne lt le gt ge cmp); impl_binary_expr_method!(offset + pointee_size: TypeSize); } impl UnaryExprBuilder for CompositeExprBuilder where - B: BinaryExprBuilder, U: UnaryExprBuilder, - T: TernaryExprBuilder, - C: CastExprBuilder, { type ExprRef<'a> = U::ExprRef<'a>; type Expr<'a> = U::Expr<'a>; @@ -125,10 +120,7 @@ where impl TernaryExprBuilder for CompositeExprBuilder where - B: BinaryExprBuilder, - U: UnaryExprBuilder, T: TernaryExprBuilder, - C: CastExprBuilder, { type ExprRefTriple<'a> = T::ExprRefTriple<'a>; type Expr<'a> = T::Expr<'a>; @@ -136,13 +128,11 @@ where impl_ternary_expr_method!(ternary_op + op: TernaryOp); impl_ternary_expr_method!(if_then_else); + impl_ternary_expr_method!(funnel_shl funnel_shr); } impl CastExprBuilder for CompositeExprBuilder where - B: BinaryExprBuilder, - U: UnaryExprBuilder, - T: TernaryExprBuilder, C: CastExprBuilder, { type ExprRef<'a> = C::ExprRef<'a>; diff --git a/runtime/lib/src/abs/expr/logger.rs b/runtime/lib/src/abs/expr/logger.rs index cb995ea9..a28890ae 100644 --- a/runtime/lib/src/abs/expr/logger.rs +++ b/runtime/lib/src/abs/expr/logger.rs @@ -137,6 +137,7 @@ where impl_binary_expr_method!(and or xor); impl_binary_expr_method!(shl shl_unchecked shr shr_unchecked); impl_binary_expr_method!(rotate_left rotate_right); + impl_binary_expr_method!(carryless_mul); impl_binary_expr_method!(eq ne lt le gt ge cmp); impl_binary_expr_method!(offset + pointee_size: TypeSize); } @@ -170,6 +171,7 @@ where impl_ternary_expr_method!(ternary_op + op: TernaryOp); impl_ternary_expr_method!(if_then_else); + impl_ternary_expr_method!(funnel_shl funnel_shr); } impl CastExprBuilder for LoggerExprBuilder diff --git a/runtime/lib/src/abs/expr/macros.rs b/runtime/lib/src/abs/expr/macros.rs index 14d291f7..cc4859f9 100644 --- a/runtime/lib/src/abs/expr/macros.rs +++ b/runtime/lib/src/abs/expr/macros.rs @@ -38,6 +38,7 @@ macro_rules! impl_general_binary_op_through_singulars { ShrUnchecked => self.shr_unchecked(operands), RotateL => self.rotate_left(operands), RotateR => self.rotate_right(operands), + CarrylessMul => self.carryless_mul(operands), Eq => self.eq(operands), Lt => self.lt(operands), Le => self.le(operands), @@ -90,6 +91,7 @@ macro_rules! impl_singular_binary_ops_through_general { (shr_unchecked = $crate::abs::expr::BinaryOp::ShrUnchecked) (rotate_left = $crate::abs::expr::BinaryOp::RotateL) (rotate_right = $crate::abs::expr::BinaryOp::RotateR) + (carryless_mul = $crate::abs::expr::BinaryOp::CarrylessMul) (eq = $crate::abs::expr::BinaryOp::Eq) (lt = $crate::abs::expr::BinaryOp::Lt) (le = $crate::abs::expr::BinaryOp::Le) @@ -178,6 +180,8 @@ macro_rules! impl_general_ternary_op_through_singulars { use $crate::abs::expr::TernaryOp::*; match op { IfThenElse => self.if_then_else(operands), + FunnelShl => self.funnel_shl(operands), + FunnelShr => self.funnel_shr(operands), } } }; @@ -200,6 +204,8 @@ macro_rules! impl_singular_ternary_ops_through_general { repeat_macro_for!( impl_singular_ternary_op_through_general; (if_then_else = $crate::abs::expr::TernaryOp::IfThenElse) + (funnel_shl = $crate::abs::expr::TernaryOp::FunnelShl) + (funnel_shr = $crate::abs::expr::TernaryOp::FunnelShr) ); }; } diff --git a/runtime/lib/src/abs/expr/mod.rs b/runtime/lib/src/abs/expr/mod.rs index c349c3af..ddb0dd57 100644 --- a/runtime/lib/src/abs/expr/mod.rs +++ b/runtime/lib/src/abs/expr/mod.rs @@ -25,6 +25,7 @@ aug_enum! { BitXor, BitAnd, BitOr, Shl, ShlUnchecked, Shr, ShrUnchecked, RotateL, RotateR, + CarrylessMul, Eq, Lt, Le, Ne, Ge, Gt, Cmp, + Offset(TypeSize), @@ -97,11 +98,7 @@ super_enum! { } } -#[repr(u8)] -#[derive(Clone, Copy, Debug)] -pub(crate) enum TernaryOp { - IfThenElse = 1, -} +pub(crate) use super::TernaryOp; mod fmt { use core::fmt::{Display, Formatter, Result}; @@ -178,6 +175,7 @@ pub(crate) trait BinaryExprBuilder { bin_fn_signature!(and or xor); bin_fn_signature!(shl shl_unchecked shr shr_unchecked); bin_fn_signature!(rotate_left rotate_right); + bin_fn_signature!(carryless_mul); bin_fn_signature!(eq ne lt le gt ge cmp); bin_fn_signature!(offset + pointee_size: TypeSize); } @@ -201,6 +199,7 @@ pub(crate) trait TernaryExprBuilder { tri_fn_signature!(ternary_op + op: TernaryOp); tri_fn_signature!(if_then_else); + tri_fn_signature!(funnel_shl funnel_shr); } pub(crate) trait CastExprBuilder { diff --git a/runtime/lib/src/abs/expr/variance.rs b/runtime/lib/src/abs/expr/variance.rs index fe5c927a..5a47d99e 100644 --- a/runtime/lib/src/abs/expr/variance.rs +++ b/runtime/lib/src/abs/expr/variance.rs @@ -62,6 +62,7 @@ where delegate_binary_op!(and or xor); delegate_binary_op!(shl shl_unchecked shr shr_unchecked); delegate_binary_op!(rotate_left rotate_right); + delegate_binary_op!(carryless_mul); delegate_binary_op!(eq ne lt le gt ge cmp); delegate_binary_op!(offset + pointee_size: TypeSize); } @@ -150,6 +151,7 @@ where delegate_ternary_op!(ternary_op + op: TernaryOp); delegate_ternary_op!(if_then_else); + delegate_ternary_op!(funnel_shl funnel_shr); } pub(crate) trait CastExprBuilderAdapter: DerefMut diff --git a/runtime/lib/src/abs/fmt.rs b/runtime/lib/src/abs/fmt.rs index 32b106eb..f74ba7ef 100644 --- a/runtime/lib/src/abs/fmt.rs +++ b/runtime/lib/src/abs/fmt.rs @@ -116,6 +116,7 @@ impl Display for BinaryOp { BinaryOp::ShrUnchecked => ">>ᵁ", BinaryOp::RotateL => "_<_", BinaryOp::RotateR => "_>_", + BinaryOp::CarrylessMul => "*^", BinaryOp::Eq => "==", BinaryOp::Ne => "!=", BinaryOp::Lt => "<", diff --git a/runtime/lib/src/abs/mod.rs b/runtime/lib/src/abs/mod.rs index 0439c6b8..7bead94b 100644 --- a/runtime/lib/src/abs/mod.rs +++ b/runtime/lib/src/abs/mod.rs @@ -43,6 +43,7 @@ pub enum BinaryOp { ShrUnchecked = common::pri::BinaryOp::SHR_UNCHECKED.to_raw(), RotateL = common::pri::BinaryOp::ROT_L.to_raw(), RotateR = common::pri::BinaryOp::ROT_R.to_raw(), + CarrylessMul = common::pri::BinaryOp::CARRYLESS_MUL.to_raw(), Eq = common::pri::BinaryOp::EQ.to_raw(), Lt = common::pri::BinaryOp::LT.to_raw(), @@ -70,6 +71,14 @@ pub enum UnaryOp { ByteSwap = common::pri::UnaryOp::BSWAP.to_raw(), } +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +#[repr(u8)] +pub enum TernaryOp { + IfThenElse = 1, + FunnelShl = 2, + FunnelShr = 3, +} + #[derive(Clone, Copy, Debug)] #[repr(u8)] pub enum AtomicOrdering { diff --git a/runtime/lib/src/backends/mdsan/raw_mem.rs b/runtime/lib/src/backends/mdsan/raw_mem.rs index 8cbed2a1..4a764fc5 100644 --- a/runtime/lib/src/backends/mdsan/raw_mem.rs +++ b/runtime/lib/src/backends/mdsan/raw_mem.rs @@ -7,7 +7,7 @@ use crate::{ use super::alias::backend; use backend::{ - MdMemoryState, MdSanBackend, MdSanPlaceValue, MdSanValue, + MdMemoryState, MdSanBackend, MdSanPlaceInspector, MdSanPlaceValue, MdSanValue, PlaceInspector, assignment::{self, AssignmentServices}, state::MemoryRegion, }; @@ -131,6 +131,42 @@ impl<'a> RawMemoryHandler for MdSanRawMemoryHandler<'a> { assign!(place_from_first!(PlaceUsage::Write), second_value); assign!(place_from_second!(PlaceUsage::Write), first_value); } + + fn raw_eq( + self, + _first_ref: Self::Operand, + _conc_first_ptr: RawAddress, + _second_ref: Self::Operand, + _conc_second_ptr: RawAddress, + _ptr_type_id: TypeId, + ) -> Self::Operand { + // No inspection required as we the references are already inspected when they are created. + MdSanValue::non_rel() + } + + fn compare_bytes( + self, + _first_ptr: Self::Operand, + conc_first_ptr: RawAddress, + _second_ptr: Self::Operand, + conc_second_ptr: RawAddress, + _count: Self::Operand, + _conc_count: usize, + ptr_type_id: TypeId, + ) -> Self::Operand { + let inspector = MdSanPlaceInspector::new(self.services.vars_state); + for i in 0.._conc_count { + for ptr in [conc_first_ptr, conc_second_ptr] { + inspector.inspect_place_for_access(&self.place_from_ptr_inner( + ptr.wrapping_byte_add(i), + ptr_type_id, + PlaceUsage::Copy, + )); + } + } + + MdSanValue::non_rel() + } } impl<'a> MdSanRawMemoryHandler<'a> { diff --git a/runtime/lib/src/backends/symex/alias.rs b/runtime/lib/src/backends/symex/alias.rs index 02a9115a..2b3bfa4e 100644 --- a/runtime/lib/src/backends/symex/alias.rs +++ b/runtime/lib/src/backends/symex/alias.rs @@ -17,7 +17,10 @@ use super::{ ConstValue, ExeTraceStorage, GenericTraceQuerier, GenericVariablesState, LazyTypeInfo, SymExConstraint, SymExConstraintDecisionCase, SymExPlaceInfo, SymExPlaceValue, SymExValue, TraceIndicesProvider, TraceViewProvider, - expr::{SymBinaryOperands, SymTernaryOperands, SymValueRef, ValueRef}, + expr::{ + SymBinaryOperands, SymTernaryOperands, SymValueRef, ValueRef, + builders::CarryingMulAddBuilderExt, + }, implication::Implied, trace::SymExExeTraceRecorder, }; @@ -38,6 +41,21 @@ where >, { } +impl SymValueRefExprBuilder for EB where + EB: for<'a> BinaryExprBuilder = SymBinaryOperands, Expr<'a> = ValueRef> + + for<'a> UnaryExprBuilder = SymValueRef, Expr<'a> = ValueRef> + + for<'a> TernaryExprBuilder = SymTernaryOperands, Expr<'a> = ValueRef> + + for<'a> CastExprBuilder< + ExprRef<'a> = SymValueRef, + Expr<'a> = ValueRef, + Metadata<'a> = LazyTypeInfo, + IntType = IntType, + FloatType = FloatType, + PtrType = TypeId, + GenericType = TypeId, + > +{ +} pub(super) trait ValueRefExprBuilder where @@ -95,8 +113,25 @@ where { } -pub(super) trait SymExValueExprBuilder: ImpliedValueRefExprBuilder {} -impl SymExValueExprBuilder for T {} +pub(super) trait SymExValueExprBuilder: + ImpliedValueRefExprBuilder + + for<'a> CarryingMulAddBuilderExt< + Operand<'a> = SymExValue, + UnsignedExpr<'a> = SymExValue, + SelfExpr<'a> = SymExValue, + > +{ +} +impl SymExValueExprBuilder for T +where + Self: ImpliedValueRefExprBuilder, + for<'a> Self: CarryingMulAddBuilderExt< + Operand<'a> = SymExValue, + UnsignedExpr<'a> = SymExValue, + SelfExpr<'a> = SymExValue, + >, +{ +} pub(super) trait SymExValueUnaryExprBuilder: ImpliedValueRefUnaryExprBuilder {} impl SymExValueUnaryExprBuilder for T {} diff --git a/runtime/lib/src/backends/symex/assignment.rs b/runtime/lib/src/backends/symex/assignment.rs index 94194889..6f60bc67 100644 --- a/runtime/lib/src/backends/symex/assignment.rs +++ b/runtime/lib/src/backends/symex/assignment.rs @@ -177,6 +177,39 @@ impl AssignmentHandler for SymExAssignmentHandler<'_, self.set(result_value) } + fn ternary_op_between( + mut self, + operator: abs::TernaryOp, + first: Self::Operand, + second: Self::Operand, + third: Self::Operand, + ) { + let result_value = self + .expr_builder() + .ternary_op((first, second, third), operator); + self.set(result_value) + } + + fn carrying_mul_add( + mut self, + multiplier: Self::Operand, + multiplicand: Self::Operand, + addend: Self::Operand, + carry: Self::Operand, + ) { + let result_value = self.expr_builder().carrying_mul_add( + multiplier, + multiplicand, + addend, + carry, + self.type_manager(), + ); + self.set_adt_value( + AdtKind::Struct, + [result_value.0, result_value.1].into_iter().map(Some), + ) + } + fn discriminant_from(mut self, place: Self::DiscriminablePlace) { let discr_value = match place { DiscriminantPossiblePlace::None => { @@ -269,15 +302,6 @@ impl AssignmentHandler for SymExAssignmentHandler<'_, self.set_value(Implied::always(value)) } - fn shallow_init_box_from(self, value: Self::Operand) { - /* According to the Rust MIR documentation: - * https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/mir/enum.Rvalue.html#variant.ShallowInitBox - * > Transmutes a *mut u8 into shallow-initialized Box. - * BTW, very improbable to have a symbolic value here. */ - let dst_ty_id = self.dest.type_id(); - self.cast_of(value, CastKind::Transmute(dst_ty_id)); - } - fn wrap_in_unsafe_binder(self, value: Self::Operand) { let dst_ty_id = self.dest.type_id(); self.cast_of(value, CastKind::Transmute(dst_ty_id)); diff --git a/runtime/lib/src/backends/symex/expr/builders.rs b/runtime/lib/src/backends/symex/expr/builders.rs index 47060878..db25e22b 100644 --- a/runtime/lib/src/backends/symex/expr/builders.rs +++ b/runtime/lib/src/backends/symex/expr/builders.rs @@ -59,13 +59,16 @@ mod toplevel { /// or the ones that are fully based on concrete values. /// NOTE: In an ideal case, fully concrete expressions should not be asked to created. So in /// the future, this top-level builder will be reduced to the symbolic builder. - pub(crate) struct TopLevelBuilder { + pub(crate) struct TopLevelBuilder + where + SymbolicBuilder: SymValueRefExprBuilder, + { sym_builder: SymbolicBuilder, conc_builder: ConcreteBuilder, } impl TopLevelBuilder { - pub(crate) fn new(type_manager: Rc) -> Self { + pub(super) fn new(type_manager: Rc) -> Self { Self { sym_builder: SymbolicBuilder::new(type_manager.clone()), conc_builder: ConcreteBuilder::default(), @@ -79,30 +82,15 @@ mod toplevel { fn binary_op<'a>( &mut self, - (first, second): Self::ExprRefPair<'a>, + operands: Self::ExprRefPair<'a>, op: AbsBinaryOp, ) -> Self::Expr<'a> { - if first.is_symbolic() { - self.sym_builder.binary_op( - BinaryOperands::Orig { - first: SymValueRef::new(first), - second, - }, - op, - ) - } else if second.is_symbolic() { - self.sym_builder.binary_op( - BinaryOperands::Rev { - first, - second: SymValueRef::new(second), - }, - op, - ) - } else { - self.conc_builder.binary_op( + match SymBinaryOperands::try_from(operands) { + Ok(operands) => self.sym_builder.binary_op(operands, op), + Err((first, second)) => self.conc_builder.binary_op( (ConcreteValueRef::new(first), ConcreteValueRef::new(second)), op, - ) + ), } } @@ -195,29 +183,57 @@ mod symbolic { SymValueRefExprBuilder, adapters::{ConstFolder, ConstSimplifier, CoreBuilder, MiscSimplifier}, shift::{ShiftConcreteRhsTypeNormalizer, ShiftRhsMasker}, + translators::FunnelShiftSymbolicTranslator, *, }; type AndBinaryExprBuilder = Chained>; + type BaseSymbolicBinaryBuilder = ShiftConcreteRhsTypeNormalizer< + Chained< + ConstSimplifier, + Chained>, + >, + >; + + type BaseSymbolicCastBuilder = Chained; + + type FunnelShiftBuilder = FunnelShiftSymbolicTranslator< + Composite, + >; + + struct BoundTester + where + FunnelShiftBuilder: + for<'a> TernaryExprBuilder = SymTernaryOperands, Expr<'a> = ValueRef>, + BaseSymbolicBuilder: + for<'a> BinaryExprBuilder = SymBinaryOperands, Expr<'a> = ValueRef>, + BaseSymbolicBuilder: + for<'a> UnaryExprBuilder = SymValueRef, Expr<'a> = ValueRef>, + BaseSymbolicBuilder: + for<'a> TernaryExprBuilder = SymTernaryOperands, Expr<'a> = ValueRef>, + BaseSymbolicBuilder: for<'a> CastExprBuilder< + ExprRef<'a> = SymValueRef, + Expr<'a> = ValueRef, + Metadata<'a> = LazyTypeInfo, + IntType = IntType, + FloatType = FloatType, + PtrType = TypeId, + GenericType = TypeId, + >, + BaseSymbolicBuilder: SymValueRefExprBuilder; + pub(crate) type BaseSymbolicBuilder = Composite< /*Binary:*/ - ShiftConcreteRhsTypeNormalizer< - Chained< - ConstSimplifier, - Chained>, - >, - >, + BaseSymbolicBinaryBuilder, /*Unary:*/ Chained>, /*Ternary:*/ - Chained, + Chained>, /*Cast:*/ - Chained, + BaseSymbolicCastBuilder, >; - impl SymValueRefExprBuilder for Logger {} - pub(crate) type SymbolicBuilder = Logger>, BaseSymbolicBuilder>>; @@ -226,11 +242,21 @@ mod symbolic { let fat_ptr_extractor = FatPtrPorterExtractor { type_manager: type_manager.clone(), }; + let cast_expr_builder = Chained::new(fat_ptr_extractor.clone(), Default::default()); + let funnel_sh_translator = FunnelShiftBuilder::new( + type_manager.clone(), + Composite { + binary: Default::default(), + unary: Default::default(), + ternary: Default::default(), + cast: cast_expr_builder.clone(), + }, + ); let base_builder = BaseSymbolicBuilder { binary: Default::default(), unary: Chained::new(fat_ptr_extractor.clone(), Default::default()), - ternary: Default::default(), - cast: Chained::new(fat_ptr_extractor, Default::default()), + ternary: Chained::new(funnel_sh_translator, Default::default()), + cast: cast_expr_builder, }; let uneval_resolver = UnevaluatedResolver { type_manager, @@ -245,7 +271,7 @@ mod symbolic { } #[derive(Clone)] - pub(crate) struct UnevaluatedResolver { + pub(super) struct UnevaluatedResolver { type_manager: Rc, sym_builder: EB, } @@ -371,6 +397,7 @@ mod symbolic { ) -> Self::Expr<'a> { let expect_scalar = match op { AbsTernaryOp::IfThenElse => (true, false, false), + AbsTernaryOp::FunnelShl | AbsTernaryOp::FunnelShr => (true, true, true), }; self.resolve(&mut operands.0, expect_scalar.0); self.resolve(&mut operands.1, expect_scalar.1); @@ -569,7 +596,8 @@ mod symbolic { } mod adapters { - use derive_more::{Deref, DerefMut}; + use derive_more as dm; + use guards::SymTernaryOperands; use crate::abs::expr::variance::*; @@ -581,7 +609,7 @@ mod adapters { use TernaryExprBuilder as TEB; use UnaryExprBuilder as UEB; - #[derive(Default, Clone, Deref, DerefMut)] + #[derive(Default, Clone, dm::Deref, dm::DerefMut)] pub(crate) struct CoreBuilder(core::CoreBuilder); impl BinaryExprBuilderAdapter for CoreBuilder { @@ -611,7 +639,7 @@ mod adapters { } impl TernaryExprBuilderAdapter for CoreBuilder { - type TargetExprRefTriple<'a> = (SymValueRef, ValueRef, ValueRef); + type TargetExprRefTriple<'a> = SymTernaryOperands; type TargetExpr<'a> = ValueRef; #[inline] @@ -644,7 +672,7 @@ mod adapters { /// /// For example, when generating an expression for `x * 1`, `mul(x, 1)` will be called, /// and ConstSimplifier will return only `x`, not `Expr::Binary { ... }`. - #[derive(Default, Clone, Deref, DerefMut)] + #[derive(Default, Clone, dm::Deref, dm::DerefMut)] pub(crate) struct ConstSimplifier(simp::ConstSimplifier); impl BinaryExprBuilderAdapter for ConstSimplifier { @@ -672,7 +700,7 @@ mod adapters { impl TernaryExprBuilderAdapter for ConstSimplifier { type TargetExprRefTriple<'a> = SymTernaryOperands; - type TargetExpr<'a> = Result; + type TargetExpr<'a> = Result>; fn adapt<'t, F>(operands: Self::TargetExprRefTriple<'t>, build: F) -> Self::TargetExpr<'t> where @@ -681,14 +709,20 @@ mod adapters { ::Expr<'s>, >, { - let SymTernaryOperands(cond, if_target, else_target) = operands; - match cond.as_ref() { - Value::Concrete(cond) => match cond { - ConcreteValue::Const(cond) => Ok(build((cond, if_target, else_target))), - _ => panic!("Unexpected non-constant value for the condition {:?}", cond), - }, - _ => Err((SymValueRef::new(cond), if_target, else_target)), + // FIXME: Specialized to if-then-else + match operands.0.as_ref() { + Value::Concrete(ConcreteValue::Const(first)) => { + match build((first, operands.1, operands.2)) { + Ok(result) => return Ok(result), + Err((_, second, third)) => { + return Err(SymTernaryOperands::new(operands.0, second, third)); + } + } + } + _ => {} } + + Err(operands) } } @@ -698,7 +732,7 @@ mod adapters { /// For example, when generating an expression for `x * 2 * 3`, /// `mul(mul(x, 1), 2)` will be called, and ConstFolder will return the /// result equivalent to `x * 6` instead of ((x * 2) * 3). - #[derive(Default, Clone, Deref, DerefMut)] + #[derive(Default, Clone, dm::Deref, dm::DerefMut)] pub(crate) struct ConstFolder(simp::ConstFolder); impl BinaryExprBuilderAdapter for ConstFolder { @@ -742,7 +776,7 @@ mod adapters { } } - #[derive(Default, Clone, Deref, DerefMut)] + #[derive(Default, Clone, dm::Deref, dm::DerefMut)] pub(crate) struct MiscSimplifier(simp::MiscSimplifier); impl UnaryExprBuilderAdapter for MiscSimplifier { @@ -758,7 +792,7 @@ mod adapters { } } - #[derive(Default, Clone, Deref, DerefMut)] + #[derive(Default, Clone, dm::Deref, dm::DerefMut)] pub(crate) struct SymValueRefExprBuilderAdapter(pub(super) RRef); impl BinaryExprBuilder for SymValueRefExprBuilderAdapter { @@ -825,8 +859,6 @@ mod adapters { impl_singular_casts_through_general!(); } - impl SymValueRefExprBuilder for SymValueRefExprBuilderAdapter {} - mod implied { use backend::{ Implied, Precondition, @@ -836,7 +868,7 @@ mod adapters { use super::*; - #[derive(Default, Clone, Deref, DerefMut)] + #[derive(Default, Clone, dm::Deref, dm::DerefMut)] pub(crate) struct ImpliedValueRefExprBuilderAdapter( pub(in super::super) RRef, ); @@ -911,19 +943,33 @@ mod adapters { target: CastKind, metadata: Self::Metadata<'b>, ) -> Self::Expr<'a> { - operand.map_value(|value| (self.0.borrow_mut().cast(value, target, metadata))) + operand.map_value(|value| self.0.borrow_mut().cast(value, target, metadata)) } impl_singular_casts_through_general!(); } impl ValueRefExprBuilderWrapper for ImpliedValueRefExprBuilderAdapter { - fn inner(&mut self) -> impl DerefMut { + fn inner(&mut self) -> impl ::core::ops::DerefMut { self.0.borrow_mut() } } impl ImpliedValueRefExprBuilder for ImpliedValueRefExprBuilderAdapter {} + + impl From for Implied { + fn from(value: ConstValue) -> Self { + Implied::always(value.to_value_ref()) + } + } + + impl<'a> TryFrom<&'a Implied> for ValueType { + type Error = &'a Implied; + + fn try_from(value: &'a Implied) -> Result { + ValueType::try_from(&value.value).or(Err(value)) + } + } } pub(super) use implied::ImpliedValueRefExprBuilderAdapter; } @@ -935,7 +981,6 @@ mod core { use simp::CastSimplifier; use super::*; - use std::ops::Not; /// This is the base expression builder. It implements the lowest level for /// all the binary and unary functions. At this point all optimizations are @@ -1044,7 +1089,7 @@ mod core { let value = wrapping_value; let value = if let Some(overflow_expr) = make_check_expr_if_possible(true) { let max_value = ConstValue::Int { - bit_rep: min_of_ty.not(), + bit_rep: !min_of_ty, ty, }; Expr::Ite { @@ -1130,17 +1175,29 @@ mod core { } impl TernaryExprBuilder for CoreBuilder { - type ExprRefTriple<'a> = (SymValueRef, ValueRef, ValueRef); + type ExprRefTriple<'a> = SymTernaryOperands; type Expr<'a> = Expr; fn if_then_else<'a>(&mut self, operands: Self::ExprRefTriple<'a>) -> Self::Expr<'a> { + debug_assert!( + operands.0.is_symbolic(), + "An ITE with non-symbolic condition is expected to be simplified at higher levels" + ); Expr::Ite { - condition: operands.0, + condition: SymValueRef::new(operands.0), if_target: operands.1, else_target: operands.2, } } + fn funnel_shl<'a>(&mut self, _operands: Self::ExprRefTriple<'a>) -> Self::Expr<'a> { + unreachable!("Funnel shifts are expected to be translated at higher levels") + } + + fn funnel_shr<'a>(&mut self, _operands: Self::ExprRefTriple<'a>) -> Self::Expr<'a> { + unreachable!("Funnel shifts are expected to be translated at higher levels") + } + impl_general_ternary_op_through_singulars!(); } @@ -1413,14 +1470,15 @@ mod concrete { type Expr<'a> = ValueRef; #[inline] - fn if_then_else<'a>( + fn ternary_op<'a>( &mut self, - (_condition, _if_target, _else_target): Self::ExprRefTriple<'a>, + _operands: Self::ExprRefTriple<'a>, + _op: AbsTernaryOp, ) -> Self::Expr<'a> { UnevalValue::Some.to_value_ref() } - impl_general_ternary_op_through_singulars!(); + impl_singular_ternary_ops_through_general!(); } } @@ -1724,6 +1782,10 @@ mod simp { } } + fn carryless_mul<'a>(&mut self, operands: Self::ExprRefPair<'a>) -> Self::Expr<'a> { + Err(operands) + } + fn eq<'a>(&mut self, operands: Self::ExprRefPair<'a>) -> Self::Expr<'a> { if operands.konst() == &ConstValue::Bool(true) { Ok(operands.other_into()) @@ -1810,7 +1872,7 @@ mod simp { impl TernaryExprBuilder for ConstSimplifier { type ExprRefTriple<'a> = (&'a ConstValue, ValueRef, ValueRef); - type Expr<'a> = ValueRef; + type Expr<'a> = Result>; fn if_then_else<'a>( &mut self, @@ -1819,7 +1881,17 @@ mod simp { let ConstValue::Bool(condition) = condition else { unreachable!("Condition must be a boolean constant. {:?}", condition) }; - if *condition { if_target } else { else_target } + Ok(if *condition { if_target } else { else_target }) + } + + fn funnel_shl<'a>(&mut self, operands: Self::ExprRefTriple<'a>) -> Self::Expr<'a> { + // FIXME: Possible to do some folding + Err(operands) + } + + fn funnel_shr<'a>(&mut self, operands: Self::ExprRefTriple<'a>) -> Self::Expr<'a> { + // FIXME: Possible to do some folding + Err(operands) } impl_general_ternary_op_through_singulars!(); @@ -2201,6 +2273,10 @@ mod simp { Err(operands) } + fn carryless_mul<'a>(&mut self, operands: Self::ExprRefPair<'a>) -> Self::Expr<'a> { + Err(operands) + } + fn eq<'a>(&mut self, operands: Self::ExprRefPair<'a>) -> Self::Expr<'a> { Err(operands) } @@ -2492,68 +2568,63 @@ mod shift { operands: Self::ExprRefPair<'a>, op: AbsBinaryOp, ) -> Self::Expr<'a> { - let operands = match op { - AbsBinaryOp::Shl | AbsBinaryOp::Shr => { - // Source: rustc_codegen_ssa::base::build_shift_expr_rhs - let first_ty = ValueType::try_from(operands.first().as_ref()) - .unwrap() - .expect_int(); - debug_assert_eq!( - ValueType::try_from(operands.first().as_ref()), - ValueType::try_from(operands.second().as_ref()) - ); - - let mask = ConstValue::new_int((1u128 << first_ty.bit_size) - 1, first_ty); - let (x, y, is_reversed) = operands.flatten(); - if is_reversed { - let second = x; - let second = self.mask_expr_builder.and(SymBinaryOperands::Orig { - first: second, - second: mask.to_value_ref(), - }); - if second.is_symbolic() { - SymBinaryOperands::Rev { - first: y, - second: SymValueRef::new(second), - } - } else { - ::core::hint::cold_path(); - if y.is_symbolic() { - SymBinaryOperands::Orig { - first: SymValueRef::new(y), - second, - } - } else { - return UnevalValue::Some.to_value_ref(); - } + let operands = if op.is_shift() { + // Source: rustc_codegen_ssa::base::build_shift_expr_rhs + let first_ty = ValueType::try_from(operands.first().as_ref()) + .unwrap() + .expect_int(); + debug_assert_eq!( + ValueType::try_from(operands.first().as_ref()), + ValueType::try_from(operands.second().as_ref()) + ); + + let mask = ConstValue::new_int((1u128 << first_ty.bit_size) - 1, first_ty); + let (x, y, is_reversed) = operands.flatten(); + if is_reversed { + let second = x; + let second = self.mask_expr_builder.and(SymBinaryOperands::Orig { + first: second, + second: mask.to_value_ref(), + }); + if second.is_symbolic() { + SymBinaryOperands::Rev { + first: y, + second: SymValueRef::new(second), } } else { - let second = y; - let second = match second.as_ref() { - Value::Concrete(ConcreteValue::Const( - second @ ConstValue::Int { .. }, - )) => ConstValue::binary_op_arithmetic( + ::core::hint::cold_path(); + if y.is_symbolic() { + SymBinaryOperands::Orig { + first: SymValueRef::new(y), second, - &mask, - SymExBinaryOp::BitAnd, - ) - .to_value_ref(), - Value::Concrete(..) => { - panic!("Only const integer values are expected: {:?}", second); - } - Value::Symbolic(..) => { - // Const shift amounts (e.g., division) are much more common. - ::core::hint::cold_path(); - self.mask_expr_builder.and(SymBinaryOperands::Orig { - first: SymValueRef::new(second), - second: mask.to_value_ref(), - }) } - }; - SymBinaryOperands::Orig { first: x, second } + } else { + return UnevalValue::Some.to_value_ref(); + } } + } else { + let second = y; + let second = match second.as_ref() { + Value::Concrete(ConcreteValue::Const(second @ ConstValue::Int { .. })) => { + ConstValue::binary_op_arithmetic(second, &mask, SymExBinaryOp::BitAnd) + .to_value_ref() + } + Value::Concrete(..) => { + panic!("Only const integer values are expected: {:?}", second); + } + Value::Symbolic(..) => { + // Const shift amounts (e.g., division) are much more common. + ::core::hint::cold_path(); + self.mask_expr_builder.and(SymBinaryOperands::Orig { + first: SymValueRef::new(second), + second: mask.to_value_ref(), + }) + } + }; + SymBinaryOperands::Orig { first: x, second } } - _ => operands, + } else { + operands }; self.inner.binary_op(operands, op) @@ -2562,3 +2633,360 @@ mod shift { impl_singular_binary_ops_through_general!(); } } + +mod translators { + use super::*; + + mod funnel_shift { + use super::*; + + #[derive(Clone)] + pub(in super::super) struct FunnelShiftSymbolicTranslator { + pub(super) type_manager: Rc, + pub(super) inner: EB, + } + + impl FunnelShiftSymbolicTranslator { + pub(crate) fn new(type_manager: Rc, inner: EB) -> Self + where + EB: FunnelShiftTranslatorBuilderReq, + { + Self { + type_manager, + inner, + } + } + } + + pub(in super::super) trait FunnelShiftTranslatorBuilderReq + where + Self: for<'a> BinaryExprBuilder = SymBinaryOperands, Expr<'a> = ValueRef> + + for<'a> CastExprBuilder< + ExprRef<'a> = SymValueRef, + Expr<'a> = ValueRef, + IntType = IntType, + Metadata<'a> = CastMetadata, + >, + { + } + impl FunnelShiftTranslatorBuilderReq for EB where + EB: for<'a> BinaryExprBuilder = SymBinaryOperands, Expr<'a> = ValueRef> + + for<'a> CastExprBuilder< + ExprRef<'a> = SymValueRef, + Expr<'a> = ValueRef, + IntType = IntType, + Metadata<'a> = CastMetadata, + > + { + } + + impl TernaryExprBuilder for FunnelShiftSymbolicTranslator { + type ExprRefTriple<'a> = SymTernaryOperands; + type Expr<'a> = Result<::Expr<'a>, Self::ExprRefTriple<'a>>; + + fn ternary_op<'a>( + &mut self, + operands: Self::ExprRefTriple<'a>, + op: AbsTernaryOp, + ) -> Self::Expr<'a> { + if !matches!(op, AbsTernaryOp::FunnelShl | AbsTernaryOp::FunnelShr) { + return Err(operands); + } + + let (first, second, shift) = (operands.0, operands.1, operands.2); + + let ty = { + let ty = ValueType::try_from(first.as_ref()) + .or_else(|_| ValueType::try_from(second.as_ref())) + .expect("Could not find the type of funnel shift operands") + .expect_int(); + (ty, self.type_manager.int_type(ty)) + }; + let double_ty: (IntType, LazyTypeInfo) = { + let mut ty = ty.0.clone(); + ty.bit_size *= 2; + (ty, self.type_manager.int_type(ty)) + }; + + let shift = if !shift.is_symbolic() { + let shift_val = *shift + .as_conc() + .and_then(|v| v.as_int()) + .inspect(|(_, shift_ty)| debug_assert_eq!(*shift_ty, &IntType::U32)) + .map(|(val, _)| val) + .unwrap_or_else(|| { + panic!( + "Shift value is expected to be a retrieved scalar: {:?}", + shift + ) + }); + // Optimization + if let Some(value) = + self.optimize_large_shift(op, &first, &second, ty.0, shift_val) + { + return Ok(value); + } + + ConstValue::new_int(shift_val, double_ty.0).to_value_ref() + } else { + self.inner + .to_int(SymValueRef::new(shift), double_ty.0, double_ty.1.clone()) + }; + + let concatenated = concat_left_sides(first, second, ty.0, &double_ty); + + let operands = SymBinaryOperands::try_from((concatenated, shift)).unwrap(); + let shifted = match op { + AbsTernaryOp::FunnelShl => self.inner.shl_unchecked(operands), + AbsTernaryOp::FunnelShr => self.inner.shr_unchecked(operands), + _ => unreachable!(), + }; + + let moved = if op == AbsTernaryOp::FunnelShl { + self.move_to_least_significant_half(shifted, ty.0, double_ty.0) + } else { + shifted + }; + + Ok(self.cast_back(ty, moved)) + } + + impl_singular_ternary_ops_through_general!(); + } + + fn expect_const_value(value: &Value) -> &ConstValue { + value + .as_conc() + .and_then(|v| v.as_const()) + .unwrap_or_else(|| { + panic!( + "Unexpected concrete value in a funnel shift operation: {:?}", + value + ) + }) + } + + fn concat_left_sides( + first: ValueRef, + second: ValueRef, + ty: IntType, + double_ty: &(IntType, LazyTypeInfo), + ) -> ValueRef { + if !first.is_symbolic() && !second.is_symbolic() { + let first = expect_const_value(&first); + let second = expect_const_value(&second); + + ConstValue::binary_op_arithmetic( + &ConstValue::binary_op_shift( + &ConstValue::integer_cast(first, double_ty.0), + &ConstValue::integer_cast(&ConstValue::from(ty.bit_size), double_ty.0), + AbsBinaryOp::Shl, + ), + &ConstValue::integer_cast(second, double_ty.0), + BinaryOp::BitOr, + ) + .to_value_ref() + } else { + // First goes to the most significant half + Expr::Concat(ConcatExpr { + values: vec![first, second], + ty: double_ty.1.clone(), + }) + .to_value_ref() + .into() + } + } + + impl FunnelShiftSymbolicTranslator + where + EB: for<'a> BinaryExprBuilder = SymBinaryOperands, Expr<'a> = ValueRef>, + { + fn optimize_large_shift( + &mut self, + op: AbsTernaryOp, + first: &ValueRef, + second: &ValueRef, + ty: IntType, + shift_val: u128, + ) -> Option { + if shift_val >= ty.bit_size as u128 { + let to_shift = match op { + AbsTernaryOp::FunnelShl => second, + AbsTernaryOp::FunnelShr => first, + _ => unreachable!(), + }; + let shift_amount = + ConstValue::new_int(shift_val - ty.bit_size as u128, ty).to_value_ref(); + let operands = SymBinaryOperands::Orig { + first: SymValueRef::new(to_shift.clone()), + second: shift_amount, + }; + let result = match op { + AbsTernaryOp::FunnelShl => self.inner.shl_unchecked(operands), + AbsTernaryOp::FunnelShr => self.inner.shr_unchecked(operands), + _ => unreachable!(), + }; + return Some(result); + } + + None + } + + fn move_to_least_significant_half( + &mut self, + shifted: ValueRef, + ty: IntType, + double_ty: IntType, + ) -> ValueRef { + if !shifted.is_symbolic() { + let shifted = expect_const_value(&shifted); + + ConstValue::binary_op_shift( + &shifted, + &ConstValue::new_int(ty.bit_size, double_ty), + AbsBinaryOp::ShrUnchecked, + ) + .to_value_ref() + } else { + self.inner.shr_unchecked(SymBinaryOperands::Orig { + first: SymValueRef::new(shifted), + second: ConstValue::new_int(ty.bit_size, double_ty).to_value_ref(), + }) + } + } + } + + impl FunnelShiftSymbolicTranslator + where + EB: for<'a> CastExprBuilder< + ExprRef<'a> = SymValueRef, + Expr<'a> = ValueRef, + IntType = IntType, + Metadata<'a> = CastMetadata, + >, + { + fn cast_back(&mut self, ty: (IntType, LazyTypeInfo), moved: ValueRef) -> ValueRef { + if !moved.is_symbolic() { + let to_extract = expect_const_value(&moved); + ConstValue::integer_cast(to_extract, ty.0).to_value_ref() + } else { + self.inner.to_int(SymValueRef::new(moved), ty.0, ty.1) + } + } + } + } + pub(super) use funnel_shift::FunnelShiftSymbolicTranslator; + + mod carrying_mul { + use common::log_warn; + + use super::*; + + pub(crate) trait CarryingMulAddBuilderExt { + type Operand<'a>; + type UnsignedExpr<'a>; + type SelfExpr<'a>; + + fn carrying_mul_add<'a>( + &mut self, + multiplier: Self::Operand<'a>, + multiplicand: Self::Operand<'a>, + addend: Self::Operand<'a>, + carry: Self::Operand<'a>, + type_manager: &dyn TypeDatabase, + ) -> (Self::UnsignedExpr<'a>, Self::SelfExpr<'a>); + } + + impl CarryingMulAddBuilderExt for EB + where + EB: for<'a> CastExprBuilder = CastMetadata>, + EB: for<'a> BinaryExprBuilder, + // The result of the cast operation will be passed to the binary operations and vice versa. + for<'a> ::ExprRefPair<'a>: From<( + ::Expr<'a>, + ::Expr<'a>, + )>, + for<'a> ::ExprRef<'a>: From<::Expr<'a>>, + // Same for the binary operation itself. + for<'a> ::ExprRefPair<'a>: From<( + ::Expr<'a>, + ::Expr<'a>, + )>, + // For the extraction + for<'a> ::Expr<'a>: Clone, + for<'a> ::Expr<'a>: From, + for<'a, 'b> ValueType: TryFrom<&'b ::ExprRef<'a>>, + for<'a> ::ExprRef<'a>: ::core::fmt::Debug, + { + type Operand<'a> = ::ExprRef<'a>; + type UnsignedExpr<'a> = ::Expr<'a>; + type SelfExpr<'a> = ::Expr<'a>; + + fn carrying_mul_add<'a>( + &mut self, + multiplier: Self::Operand<'a>, + multiplicand: Self::Operand<'a>, + addend: Self::Operand<'a>, + carry: Self::Operand<'a>, + type_manager: &dyn TypeDatabase, + ) -> (Self::UnsignedExpr<'a>, Self::SelfExpr<'a>) { + let ty: (IntType, LazyTypeInfo) = { + let ty = ValueType::try_from(&multiplier) + .or_else(|_| ValueType::try_from(&multiplicand)) + .or_else(|_| ValueType::try_from(&addend)) + .or_else(|_| ValueType::try_from(&carry)) + .unwrap_or_else(|_| { + log_warn!( + concat!( + "Could not find type for carrying mul add operations: {:?}. ", + "Currently, even unevaluated concrete values are expected to carry type. ", + "A dummy type will be used, but this may lead to incorrect results." + ), + (&multiplier, &multiplicand, &addend, &carry), + ); + IntType::USIZE.into() + }) + .expect_int(); + (ty, type_manager.int_type(ty)) + }; + let double_ty: (IntType, LazyTypeInfo) = { + let mut ty = ty.0.clone(); + ty.bit_size *= 2; + (ty, type_manager.int_type(ty)) + }; + let unsigned_ty: (IntType, LazyTypeInfo) = { + let mut ty = ty.0.clone(); + ty.is_signed = false; + (ty, type_manager.int_type(ty)) + }; + + // let wide = (self as $w) * (a as $w) + (b as $w) + (c as $w); + let mul_result = { + let multiplier = self.to_int(multiplier, double_ty.0, double_ty.1.clone()); + let multiplicand = self.to_int(multiplicand, double_ty.0, double_ty.1.clone()); + let addend = self.to_int(addend, double_ty.0, double_ty.1.clone()); + let carry = self.to_int(carry, double_ty.0, double_ty.1.clone()); + + let product = self.mul_unchecked((multiplier, multiplicand).into()); + let sum = self.add_unchecked((product, addend).into()); + let mul_result = self.add_unchecked((sum, carry).into()); + mul_result + }; + // (wide as $u, (wide >> Self::BITS) as $t) + { + let lower_half = + self.to_int(mul_result.clone().into(), unsigned_ty.0, unsigned_ty.1); + let upper_half = { + let shift = ConstValue::new_int(ty.0.bit_size, double_ty.0); + let shift: ::Expr<'a> = shift.into(); + let extracted = self.shr_unchecked((mul_result, shift).into()); + self.to_int(extracted.into(), ty.0, ty.1) + }; + (lower_half, upper_half) + } + } + } + } + pub(crate) use carrying_mul::CarryingMulAddBuilderExt; +} +pub(crate) use translators::CarryingMulAddBuilderExt; diff --git a/runtime/lib/src/backends/symex/expr/mod.rs b/runtime/lib/src/backends/symex/expr/mod.rs index fd215fcd..41cf7d19 100644 --- a/runtime/lib/src/backends/symex/expr/mod.rs +++ b/runtime/lib/src/backends/symex/expr/mod.rs @@ -75,14 +75,6 @@ impl Value { pub(crate) fn is_symbolic(&self) -> bool { self.as_sym().is_some() } - - #[inline] - pub(crate) fn as_sym(&self) -> Option<&SymValue> { - match self { - Value::Symbolic(sym) => Some(sym), - _ => None, - } - } } #[derive(Clone, Debug, PartialEq, Eq, dm::From)] @@ -743,6 +735,7 @@ mod operators { Shr, RotateL, RotateR, + CarrylessMul, Eq, Lt, @@ -955,7 +948,7 @@ mod guards { { pub fn new(value: V) -> Self { #![allow(unused_variables)] - core::assert_matches::assert_matches!( + core::assert_matches!( value.as_ref(), $pattern, concat!("Value should be ", stringify!($guarded_type), ".") @@ -1178,6 +1171,13 @@ mod convert { impl_from_int_type!(false, u8, u16, u32, u64, u128, usize); impl_from_int_type!(true, i8, i16, i32, i64, i128, isize); + impl From for ConstValue { + fn from(value: core::cmp::Ordering) -> Self { + // FIXME: It can be problematic, as in definition they are different types. + Self::from(value as i8) + } + } + macro_rules! impl_conc_to_value_ref { ($($ty: ty),* $(,)?) => { $( @@ -1229,6 +1229,28 @@ mod convert { ConcatExpr, ); + impl TryFrom<(ValueRef, ValueRef)> for SymBinaryOperands { + type Error = (ValueRef, ValueRef); + + #[inline] + fn try_from(value: (ValueRef, ValueRef)) -> Result { + let (first, second) = value; + if first.is_symbolic() { + Ok(Self::Orig { + first: SymValueRef::new(first), + second, + }) + } else if second.is_symbolic() { + Ok(Self::Rev { + first, + second: SymValueRef::new(second), + }) + } else { + Err((first, second)) + } + } + } + impl<'a> TryFrom<&'a Value> for ValueType { type Error = &'a Value; @@ -1240,6 +1262,14 @@ mod convert { } } + impl<'a> TryFrom<&'a ValueRef> for ValueType { + type Error = &'a ValueRef; + + fn try_from(value: &'a ValueRef) -> Result { + ValueType::try_from(value.as_ref()).or(Err(value)) + } + } + impl<'a> TryFrom<&'a SymValue> for ValueType { type Error = &'a SymValue; @@ -1255,7 +1285,7 @@ mod convert { Add | Sub | Mul | Div | Rem | BitXor | BitAnd | BitOr => { ValueType::try_from(operands).map_err(|_| value) } - Shl | Shr | RotateL | RotateR => { + Shl | Shr | RotateL | RotateR | CarrylessMul => { ValueType::try_from(operands.first().as_ref()).map_err(|_| value) } Cmp => { @@ -1349,3 +1379,48 @@ mod convert { } } } + +mod subtype { + use super::*; + + impl Value { + pub(crate) fn as_conc(&self) -> Option<&ConcreteValue> { + match self { + Value::Concrete(conc) => Some(conc), + _ => None, + } + } + + #[inline] + pub(crate) fn as_sym(&self) -> Option<&SymValue> { + match self { + Value::Symbolic(sym) => Some(sym), + _ => None, + } + } + } + + impl ConcreteValue { + #[inline] + pub(crate) fn as_const(&self) -> Option<&ConstValue> { + match self { + ConcreteValue::Const(const_val) => Some(const_val), + _ => None, + } + } + + #[inline] + pub(crate) fn as_int(&self) -> Option<(&u128, &IntType)> { + self.as_const().and_then(|const_val| const_val.as_int()) + } + } + + impl ConstValue { + fn as_int(&self) -> Option<(&u128, &IntType)> { + match self { + Self::Int { bit_rep, ty } => Some((&bit_rep.0, ty)), + _ => None, + } + } + } +} diff --git a/runtime/lib/src/backends/symex/expr/translators.rs b/runtime/lib/src/backends/symex/expr/translators.rs index 77f06ee6..cc4e6d7a 100644 --- a/runtime/lib/src/backends/symex/expr/translators.rs +++ b/runtime/lib/src/backends/symex/expr/translators.rs @@ -470,6 +470,15 @@ pub(crate) mod z3 { let gt = self.translate_ite_expr(gt_check, greater, equal); self.translate_ite_expr(lt_check, less, gt) })), + (BinaryOp::CarrylessMul, _) => { + assert!( + !is_signed, + "Carryless multiplication is only expected for unsigned integers." + ); + Some(Box::new(|left, right| { + self.translate_carryless_mul_expr(left, right, is_signed) + })) + } _ => None, }; f.map(|f| f(left.clone(), right.clone())) @@ -753,6 +762,35 @@ pub(crate) mod z3 { BVNode::new(swapped_bv, bv.is_signed()).into() } + fn translate_carryless_mul_expr( + &mut self, + left: AstNode<'ctx>, + right: AstNode<'ctx>, + is_signed: bool, + ) -> AstNode<'ctx> { + assert!( + !is_signed, + "Carryless multiplication is only expected for unsigned integers." + ); + let left = left.as_bit_vector(); + let right = right.as_bit_vector(); + let size = left.get_size(); + let zero = ast::BV::from_u64(self.context, 0, size); + let one = ast::BV::from_u64(self.context, 1, 1); + + let mut result = zero.clone(); + for i in 0..size { + // Reference: Documentation for uN::carryless_mul + // (rhs >> i) & 1 + let enable = right.extract(i, i)._eq(&one); + // (lhs << i) + let shifted = left.bvshl(&ast::BV::from_u64(self.context, i as u64, size)); + // result ^= (rhs >> i) & 1 ? (lhs << i) : 0 + result = result.bvxor(&enable.ite(&shifted, &zero)); + } + BVNode::new(result, false).into() + } + fn translate_concat_expr( &mut self, values: Vec>, diff --git a/runtime/lib/src/backends/symex/memory.rs b/runtime/lib/src/backends/symex/memory.rs index a72572af..4cea35a5 100644 --- a/runtime/lib/src/backends/symex/memory.rs +++ b/runtime/lib/src/backends/symex/memory.rs @@ -3,7 +3,10 @@ use std::borrow::Cow; use common::log_warn; use crate::{ - abs::{AssignmentId, PlaceUsage, RawAddress, TypeId, TypeSize, expr::BinaryExprBuilder}, + abs::{ + AssignmentId, IntType, PlaceUsage, RawAddress, TypeId, TypeSize, expr::BinaryExprBuilder, + }, + backends::symex::expr::LazyTypeInfo, pri::fluent::backend::{AssignmentHandler, RawMemoryHandler, RuntimeBackend}, }; @@ -209,6 +212,157 @@ impl<'a, EB: SymExValueExprBuilder + 'static> RawMemoryHandler for SymExRawMemor assign!(place_from_first!(PlaceUsage::Write), second_value); assign!(place_from_second!(PlaceUsage::Write), first_value); } + + fn raw_eq( + self, + first_ref: Self::Operand, + conc_first_ptr: RawAddress, + second_ref: Self::Operand, + conc_second_ptr: RawAddress, + ptr_type_id: TypeId, + ) -> Self::Operand { + let size = self.pointee_size(ptr_type_id); + + if size == 0 { + return Implied::always(ConstValue::Bool(true).to_value_ref()); + } + + if size > 1 { + // Just check if we have symbolic values, and warn as an unsupported case. + // FIXME: (Check the real use cases in the standard library before generalizing) + let is_symbolic = |ref_val, conc_ptr| { + let place = + self.place_from_ptr_inner(ref_val, conc_ptr, ptr_type_id, PlaceUsage::Copy); + self.services.vars_state.copy_place(&place).is_symbolic() + }; + + if is_symbolic(first_ref, conc_first_ptr) || is_symbolic(second_ref, conc_second_ptr) { + log_warn!( + concat!( + "Checking equality of multi-byte values byte-by-byte is not supported currently. ", + "Values: @{:p} and @{:p}, Ref type: {}", + ), + conc_first_ptr, + conc_second_ptr, + ptr_type_id, + ); + } + return Implied::always(UnevalValue::Some.to_value_ref()); + } + + let first_values = self + .ptr_at_offsets( + &first_ref, + conc_first_ptr, + Implied::always(size as usize), + 1, + ) + .map(|(first_at_i, conc_first_at_i)| { + let first_place_at_i = self.place_from_ptr_inner( + first_at_i, + conc_first_at_i, + ptr_type_id, + PlaceUsage::Copy, + ); + self.services.vars_state.copy_place(&first_place_at_i) + }); + + let second_values = self + .ptr_at_offsets( + &second_ref, + conc_second_ptr, + Implied::always(size as usize), + 1, + ) + .map(|(second_at_i, conc_second_at_i)| { + let second_place_at_i = self.place_from_ptr_inner( + second_at_i, + conc_second_at_i, + ptr_type_id, + PlaceUsage::Copy, + ); + self.services.vars_state.copy_place(&second_place_at_i) + }); + + let expr_builder = self.services.expr_builder.clone(); + + first_values + .zip(second_values) + .map(|pair| expr_builder.borrow_mut().eq(pair)) + .reduce(|acc, next| expr_builder.borrow_mut().and((acc, next))) + .unwrap() + } + + fn compare_bytes( + mut self, + first_ptr: Self::Operand, + conc_first_ptr: RawAddress, + second_ptr: Self::Operand, + conc_second_ptr: RawAddress, + count: Self::Operand, + conc_count: usize, + ptr_type_id: TypeId, + ) -> Self::Operand { + self.check_count(&count, conc_count); + let count = count.map_value(|_| conc_count); + + if conc_count == 0 { + return Implied::always(ConstValue::from(0i32).to_value_ref()); + } + + let first_values = self + .ptr_at_offsets(&first_ptr, conc_first_ptr, count.clone(), 1) + .map(|(first_at_i, conc_first_at_i)| { + let first_place_at_i = self.place_from_ptr_inner( + first_at_i, + conc_first_at_i, + ptr_type_id, + PlaceUsage::Copy, + ); + self.services.vars_state.copy_place(&first_place_at_i) + }); + let second_values = self + .ptr_at_offsets(&second_ptr, conc_second_ptr, count.clone(), 1) + .map(|(second_at_i, conc_second_at_i)| { + let second_place_at_i = self.place_from_ptr_inner( + second_at_i, + conc_second_at_i, + ptr_type_id, + PlaceUsage::Copy, + ); + self.services.vars_state.copy_place(&second_place_at_i) + }); + + let expr_builder = self.services.expr_builder.clone(); + + let result = first_values + .zip(second_values) + .map(|pair| expr_builder.borrow_mut().cmp(pair)) + .rev() + .reduce(|acc, prev| { + let eq = expr_builder.borrow_mut().eq(( + prev.clone(), + Implied::always(ConstValue::from(core::cmp::Ordering::Equal).to_value_ref()), + )); + expr_builder.borrow_mut().if_then_else((eq, acc, prev)) + }) + .unwrap(); + + let i8_type: LazyTypeInfo = self.services.type_manager.i8(); + let x = self.services.expr_builder.borrow_mut().transmute( + result, + i8_type.id().unwrap(), + i8_type, + ); + self.services.expr_builder.borrow_mut().to_int( + x, + IntType { + bit_size: i32::BITS as _, + is_signed: true, + }, + self.services.type_manager.i32(), + ) + } } impl<'a, EB> SymExRawMemoryHandler<'a, EB> { @@ -250,6 +404,9 @@ impl<'a, EB> SymExRawMemoryHandler<'a, EB> { } } +trait AtOffsetsIterator: ExactSizeIterator + DoubleEndedIterator {} +impl AtOffsetsIterator for T {} + impl<'a, EB: SymExValueExprBuilder + 'static> SymExRawMemoryHandler<'a, EB> { fn ptr_at_offsets( &self, @@ -257,10 +414,10 @@ impl<'a, EB: SymExValueExprBuilder + 'static> SymExRawMemoryHandler<'a, EB> { conc_ptr: RawAddress, count: Implied, size: TypeSize, - ) -> impl Iterator { + ) -> impl AtOffsetsIterator { let precondition = Precondition::merge([ptr.by.clone(), count.by.clone()]); - let values: Box> = match ptr.as_ref() { + let values: Box> = match ptr.as_ref() { Value::Concrete(conc_value) => { let ptr = { if cfg!(debug_assertions) { diff --git a/runtime/lib/src/backends/symex/outgen.rs b/runtime/lib/src/backends/symex/outgen.rs index 3f2b882e..9c77bfc0 100644 --- a/runtime/lib/src/backends/symex/outgen.rs +++ b/runtime/lib/src/backends/symex/outgen.rs @@ -1,4 +1,4 @@ -use std::{assert_matches::debug_assert_matches, collections::HashMap}; +use std::{collections::HashMap, debug_assert_matches}; use common::{ answers::{ diff --git a/runtime/lib/src/backends/symex/trace/query.rs b/runtime/lib/src/backends/symex/trace/query.rs index 1e2c4e21..895e341f 100644 --- a/runtime/lib/src/backends/symex/trace/query.rs +++ b/runtime/lib/src/backends/symex/trace/query.rs @@ -1,4 +1,4 @@ -use std::{assert_matches::debug_assert_matches, borrow::Borrow, ops::Deref}; +use std::{borrow::Borrow, debug_assert_matches, ops::Deref}; use common::{ pri::BasicBlockIndex, diff --git a/runtime/lib/src/lib.rs b/runtime/lib/src/lib.rs index a10b88d8..a87bef19 100644 --- a/runtime/lib/src/lib.rs +++ b/runtime/lib/src/lib.rs @@ -1,7 +1,5 @@ #![feature(associated_type_defaults)] #![feature(box_patterns)] -#![feature(assert_matches)] -#![feature(iterator_try_collect)] #![feature(macro_metavar_expr)] #![feature(unboxed_closures)] #![feature(fn_traits)] @@ -9,8 +7,6 @@ #![feature(core_intrinsics)] #![feature(iter_map_windows)] #![feature(seek_stream_len)] -#![feature(try_trait_v2)] -#![feature(cold_path)] #![feature(more_qualified_paths)] #![feature(likely_unlikely)] #![feature(never_type)] diff --git a/runtime/lib/src/pri/fluent/backend/mod.rs b/runtime/lib/src/pri/fluent/backend/mod.rs index d1d9816c..5c4bddc5 100644 --- a/runtime/lib/src/pri/fluent/backend/mod.rs +++ b/runtime/lib/src/pri/fluent/backend/mod.rs @@ -4,8 +4,8 @@ pub(crate) mod shared; use crate::abs::{ AssertKind, AssignmentId, BasicBlockIndex, BinaryOp, CalleeDef, CastKind, Constant, FieldIndex, - FuncDef, Local, PlaceUsage, Projection, RawAddress, SwitchCaseIndex, SymVariable, Tag, TypeId, - TypeSize, UnaryOp, ValueType, VariantIndex, backend::Shutdown, + FuncDef, Local, PlaceUsage, Projection, RawAddress, SwitchCaseIndex, SymVariable, Tag, + TernaryOp, TypeId, TypeSize, UnaryOp, ValueType, VariantIndex, backend::Shutdown, }; pub(crate) trait RuntimeBackend: Shutdown { @@ -226,6 +226,26 @@ pub(crate) trait AssignmentHandler: Sized { self.some() } + fn ternary_op_between( + self, + _operator: TernaryOp, + _first: Self::Operand, + _second: Self::Operand, + _third: Self::Operand, + ) { + self.some() + } + + fn carrying_mul_add( + self, + _multiplier: Self::Operand, + _multiplicand: Self::Operand, + _addend: Self::Operand, + _carry: Self::Operand, + ) { + self.some() + } + fn discriminant_from(self, _place: Self::DiscriminablePlace) { self.some() } @@ -270,10 +290,6 @@ pub(crate) trait AssignmentHandler: Sized { self.some() } - fn shallow_init_box_from(self, _value: Self::Operand) { - self.some() - } - fn wrap_in_unsafe_binder(self, _value: Self::Operand) { self.some() } @@ -341,6 +357,26 @@ pub(crate) trait RawMemoryHandler { conc_count: usize, ptr_type_id: TypeId, ); + + fn raw_eq( + self, + first_ref: Self::Operand, + conc_first_ptr: RawAddress, + second_ref: Self::Operand, + conc_second_ptr: RawAddress, + ptr_type_id: TypeId, + ) -> Self::Operand; + + fn compare_bytes( + self, + first_ptr: Self::Operand, + conc_first_ptr: RawAddress, + second_ptr: Self::Operand, + conc_second_ptr: RawAddress, + count: Self::Operand, + conc_count: usize, + ptr_type_id: TypeId, + ) -> Self::Operand; } pub(crate) trait ConstraintHandler { diff --git a/runtime/lib/src/pri/fluent/backend/shared.rs b/runtime/lib/src/pri/fluent/backend/shared.rs index 8b1728a9..1b2919a9 100644 --- a/runtime/lib/src/pri/fluent/backend/shared.rs +++ b/runtime/lib/src/pri/fluent/backend/shared.rs @@ -235,6 +235,24 @@ pub(crate) mod noop { fn unary_op_on(self, _operator: UnaryOp, _operand: Self::Operand) {} + fn ternary_op_between( + self, + _operator: TernaryOp, + _first: Self::Operand, + _second: Self::Operand, + _third: Self::Operand, + ) { + } + + fn carrying_mul_add( + self, + _multiplier: Self::Operand, + _multiplicand: Self::Operand, + _addend: Self::Operand, + _carry: Self::Operand, + ) { + } + fn discriminant_from(self, _place: Self::DiscriminablePlace) {} fn array_from(self, _items: impl Iterator) {} @@ -257,8 +275,6 @@ pub(crate) mod noop { fn variant_index(self, _variant_index: VariantIndex) {} - fn shallow_init_box_from(self, _value: Self::Operand) {} - fn wrap_in_unsafe_binder(self, _value: Self::Operand) {} fn use_if_eq( @@ -287,7 +303,7 @@ pub(crate) mod noop { #[derive(Default)] pub(crate) struct NoOpRawMemoryHandler(PhantomData<(P, O)>); - impl RawMemoryHandler for NoOpRawMemoryHandler { + impl RawMemoryHandler for NoOpRawMemoryHandler { type Place = P; type Operand = O; @@ -339,6 +355,30 @@ pub(crate) mod noop { ) { Default::default() } + + fn raw_eq( + self, + _first_ref: Self::Operand, + _conc_first_ptr: RawAddress, + _second_ref: Self::Operand, + _conc_second_ptr: RawAddress, + _ptr_type_id: TypeId, + ) -> Self::Operand { + Default::default() + } + + fn compare_bytes( + self, + _first_ptr: Self::Operand, + _conc_first_ptr: RawAddress, + _second_ptr: Self::Operand, + _conc_second_ptr: RawAddress, + _count: Self::Operand, + _conc_count: usize, + _ptr_type_id: TypeId, + ) -> Self::Operand { + Default::default() + } } pub(crate) struct NoOpConstraintHandler(PhantomData); diff --git a/runtime/lib/src/pri/fluent/mod.rs b/runtime/lib/src/pri/fluent/mod.rs index 0bc88054..41d5a854 100644 --- a/runtime/lib/src/pri/fluent/mod.rs +++ b/runtime/lib/src/pri/fluent/mod.rs @@ -488,16 +488,6 @@ where Self::assign_to(id, dest, |h| h.raw_ptr_from(data_ptr, metadata, is_mutable)) } - fn assign_shallow_init_box( - id: AssignmentId, - dest: PlaceRef, - operand: OperandRef, - _boxed_type_id: Self::TypeId, - ) { - let operand = Self::take_back_operand(operand); - Self::assign_to(id, dest, |h| h.shallow_init_box_from(operand)) - } - fn assign_wrap_unsafe_binder( id: AssignmentId, dest: PlaceRef, @@ -998,6 +988,15 @@ where Self::assign_binary_op(id, dest, Self::BinaryOp::DivExact, first, second); } + fn intrinsic_assign_carryless_mul( + id: AssignmentId, + dest: PlaceRef, + first: OperandRef, + second: OperandRef, + ) { + Self::assign_binary_op(id, dest, Self::BinaryOp::CarrylessMul, first, second); + } + fn intrinsic_assign_bitreverse(id: AssignmentId, dest: PlaceRef, x: OperandRef) { Self::assign_unary_op(id, dest, Self::UnaryOp::BitReverse, x); } @@ -1026,6 +1025,68 @@ where Self::assign_unary_op(id, dest, Self::UnaryOp::ByteSwap, x); } + fn intrinsic_assign_funnel_shl( + id: AssignmentId, + dest: PlaceRef, + first: OperandRef, + second: OperandRef, + shift: OperandRef, + ) { + let first = Self::take_back_operand(first); + let second = Self::take_back_operand(second); + let shift = Self::take_back_operand(shift); + Self::assign_to(id, dest, |h| { + h.ternary_op_between(abs::TernaryOp::FunnelShl, first, second, shift) + }) + } + + fn intrinsic_assign_funnel_shr( + id: AssignmentId, + dest: PlaceRef, + first: OperandRef, + second: OperandRef, + shift: OperandRef, + ) { + let first = Self::take_back_operand(first); + let second = Self::take_back_operand(second); + let shift = Self::take_back_operand(shift); + Self::assign_to(id, dest, |h| { + h.ternary_op_between(abs::TernaryOp::FunnelShr, first, second, shift) + }) + } + + fn intrinsic_assign_select_unpredictable( + id: AssignmentId, + dest: PlaceRef, + condition: OperandRef, + true_val: OperandRef, + false_val: OperandRef, + ) { + let condition = Self::take_back_operand(condition); + let true_val = Self::take_back_operand(true_val); + let false_val = Self::take_back_operand(false_val); + Self::assign_to(id, dest, |h| { + h.ternary_op_between(abs::TernaryOp::IfThenElse, condition, true_val, false_val) + }) + } + + fn intrinsic_assign_carrying_mul_add( + id: AssignmentId, + dest: PlaceRef, + multiplier: OperandRef, + multiplicand: OperandRef, + addend: OperandRef, + carry: OperandRef, + ) { + let multiplier = Self::take_back_operand(multiplier); + let multiplicand = Self::take_back_operand(multiplicand); + let addend = Self::take_back_operand(addend); + let carry = Self::take_back_operand(carry); + Self::assign_to(id, dest, |h| { + h.carrying_mul_add(multiplier, multiplicand, addend, carry) + }) + } + fn intrinsic_atomic_binary_op( _ordering: Self::AtomicOrdering, id: AssignmentId, @@ -1155,6 +1216,57 @@ where }); } + fn intrinsic_assign_raw_eq( + id: AssignmentId, + first_ref: OperandRef, + conc_first_ptr: RawAddress, + ptr_type_id: Self::TypeId, + dest: PlaceRef, + second_ref: OperandRef, + conc_second_ptr: RawAddress, + ) { + let first_ref = Self::take_back_operand(first_ref); + let second_ref = Self::take_back_operand(second_ref); + let result = Self::raw_memory(|h| { + h.raw_eq( + first_ref, + conc_first_ptr, + second_ref, + conc_second_ptr, + ptr_type_id, + ) + }); + Self::assign_to(id, dest, |h| h.use_of(result)) + } + + fn intrinsic_assign_compare_bytes( + id: AssignmentId, + first_ptr: OperandRef, + conc_first_ptr: RawAddress, + ptr_type_id: Self::TypeId, + dest: PlaceRef, + second_ptr: OperandRef, + conc_second_ptr: RawAddress, + count: OperandRef, + conc_count: usize, + ) { + let first_ptr = Self::take_back_operand(first_ptr); + let second_ptr = Self::take_back_operand(second_ptr); + let count = Self::take_back_operand(count); + let result = Self::raw_memory(|h| { + h.compare_bytes( + first_ptr, + conc_first_ptr, + second_ptr, + conc_second_ptr, + count, + conc_count, + ptr_type_id, + ) + }); + Self::assign_to(id, dest, |h| h.use_of(result)) + } + fn intrinsic_atomic_load( _ordering: Self::AtomicOrdering, id: AssignmentId, diff --git a/runtime/shim/src/pri/mod.rs b/runtime/shim/src/pri/mod.rs index 20f0c9b2..d1202b64 100644 --- a/runtime/shim/src/pri/mod.rs +++ b/runtime/shim/src/pri/mod.rs @@ -12,7 +12,7 @@ use common::pri::*; */ #[cfg_attr(core_build, stable(feature = "rust1", since = "1.0.0"))] #[rustc_diagnostic_item = "leaf_module_marker"] -pub static MODULE_MARKER: u8 = 0; +pub const MODULE_MARKER: u8 = 0; mod ffi { use common::ffi::*; diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 2a90036d..d429c615 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] -channel = "nightly-2026-01-19" +channel = "nightly-2026-07-01" components = ["rust-src", "rustc-dev", "llvm-tools", "rustfmt", "clippy"] diff --git a/samples/drop/drop_in_place.rs b/samples/drop/drop_in_place.rs new file mode 100644 index 00000000..0a01ce86 --- /dev/null +++ b/samples/drop/drop_in_place.rs @@ -0,0 +1,5 @@ +fn main() { + let mut a = String::from("Hello"); + unsafe { core::ptr::drop_in_place(&mut a) }; + core::mem::forget(a); +} diff --git a/samples/intrinsics/memory/compare_bytes.rs b/samples/intrinsics/memory/compare_bytes.rs new file mode 100644 index 00000000..29e68886 --- /dev/null +++ b/samples/intrinsics/memory/compare_bytes.rs @@ -0,0 +1,81 @@ +#![feature(core_intrinsics)] + +use core::intrinsics; + +use leaf::annotations::Symbolizable; + +const N: usize = 3; + +fn main() { + sym_content(); + + sym_count(); + sym_left_ptr(); + sym_right_ptr(); +} + +fn sym_count() { + let left = [1u8, 2, 3]; + let mut right = [0u8, 0, 0]; + let count = 1u8.mark_symbolic() as usize; + + let left_ptr = &left as *const u8; + let right_ptr = &mut right as *const u8; + + let result = compare_bytes(left_ptr, right_ptr, count); + use_result(result); +} + +fn sym_left_ptr() { + let left = [1u8, 2, 3]; + let mut right = [0u8, 0, 0]; + let count = N - 1; + + let i = 1u8.mark_symbolic() as usize; + let left_ptr = left[i..].as_ptr(); + let right_ptr = &mut right as *const u8; + + let result = compare_bytes(left_ptr, right_ptr, count); + + use_result(result); +} + +fn sym_right_ptr() { + let left = [1u8, 2, 3]; + let mut right = [0u8, 0, 0]; + let count = N - 1; + + let i = 1u8.mark_symbolic() as usize; + let left_ptr = &left as *const u8; + let right_ptr = right[i..].as_mut_ptr(); + + let result = compare_bytes(left_ptr, right_ptr, count); + use_result(result); +} + +fn sym_content() { + let left: [u8; N] = [ + 10u8.mark_symbolic(), + 20u8.mark_symbolic(), + 30u8.mark_symbolic(), + ]; + + let mut right: [u8; N] = [10u8, 20, 30]; + + let count = left.len(); + let left_ptr = &left as *const u8; + let right_ptr = &mut right as *const u8; + + let result = compare_bytes(left_ptr, right_ptr, count); + use_result(result); +} + +fn compare_bytes(left_ptr: *const u8, right_ptr: *const u8, count: usize) -> i32 { + core::hint::black_box(unsafe { intrinsics::compare_bytes(left_ptr, right_ptr, count) }) +} + +fn use_result(result: i32) { + if result > 0 { + core::hint::black_box(0u8); + } +} diff --git a/samples/intrinsics/memory/raw_eq.rs b/samples/intrinsics/memory/raw_eq.rs new file mode 100644 index 00000000..fb7308fa --- /dev/null +++ b/samples/intrinsics/memory/raw_eq.rs @@ -0,0 +1,18 @@ +#![feature(core_intrinsics)] + +use core::intrinsics; + +use leafrtsh::annotations::*; + +fn main() { + let a = [0xdeadbeefu64.mark_symbolic(), 7u64.mark_symbolic(), 0u64]; + let b = [0xfeedfaceu64.mark_symbolic(), 2u64.mark_symbolic(), 0u64]; + check(&a, &b); +} + +fn check(first: &T, second: &T) { + let eq = unsafe { intrinsics::raw_eq(first, second) }; + if eq { + intrinsics::black_box(0u8); + } +} diff --git a/samples/intrinsics/operators/binary/carryless_mul.rs b/samples/intrinsics/operators/binary/carryless_mul.rs new file mode 100644 index 00000000..91cc6ddf --- /dev/null +++ b/samples/intrinsics/operators/binary/carryless_mul.rs @@ -0,0 +1,15 @@ +#![feature(core_intrinsics)] +#![feature(uint_carryless_mul)] + +use core::intrinsics; + +use leaf::annotations::*; + +fn main() { + let a = 0b00100100u8.mark_symbolic(); + let b = intrinsics::carryless_mul(a, u8::MAX) & !a; + + if (b == 0b00011110u8) & (a.count_ones() == 2) { + intrinsics::black_box(0); + } +} diff --git a/samples/intrinsics/operators/nary/carrying_mul_add.rs b/samples/intrinsics/operators/nary/carrying_mul_add.rs new file mode 100644 index 00000000..6bf8eab0 --- /dev/null +++ b/samples/intrinsics/operators/nary/carrying_mul_add.rs @@ -0,0 +1,22 @@ +#![feature(core_intrinsics)] + +use core::intrinsics; + +use leaf::annotations::*; + +fn main() { + let a = 20u8.mark_symbolic(); + let b = 7u8.mark_symbolic(); + let c = 2u8.mark_symbolic(); + let d = 5u8.mark_symbolic(); + + let (e, f) = intrinsics::carrying_mul_add(a, b, c, d); + use_num(e); + use_num(f); +} + +fn use_num(x: T) { + if x.eq(&T::default()) { + intrinsics::black_box(x); + } +} diff --git a/samples/intrinsics/operators/ternary/funnel_shift.rs b/samples/intrinsics/operators/ternary/funnel_shift.rs new file mode 100644 index 00000000..bf4d1fd1 --- /dev/null +++ b/samples/intrinsics/operators/ternary/funnel_shift.rs @@ -0,0 +1,32 @@ +#![feature(core_intrinsics)] +#![feature(funnel_shifts)] + +use core::intrinsics; + +use leaf::annotations::*; + +fn main() { + let a = 20u8.mark_symbolic(); + let b = 7u8.mark_symbolic(); + + let l = unsafe { intrinsics::unchecked_funnel_shl(a, b, 2) }; + let r = unsafe { intrinsics::unchecked_funnel_shr(a, b, 2) }; + if (a.count_ones() == 1) & (b.count_ones() == 1) & (l == r) { + use_num(0); + } + + let num = 0b11000011u8; + let shift_l = 3.mark_symbolic(); + let shift_r = 2.mark_symbolic(); + let l = unsafe { intrinsics::unchecked_funnel_shl(num, 0b11u8, shift_l) }; + let r = unsafe { intrinsics::unchecked_funnel_shr(num, 0b11u8, shift_r) }; + if (shift_l < 8) & (shift_r < 8) & (l == r) { + use_num(0); + } +} + +fn use_num(x: T) { + if x.eq(&T::default()) { + intrinsics::black_box(x); + } +} diff --git a/samples/intrinsics/operators/ternary/select_unpredictable.rs b/samples/intrinsics/operators/ternary/select_unpredictable.rs new file mode 100644 index 00000000..a1e47f74 --- /dev/null +++ b/samples/intrinsics/operators/ternary/select_unpredictable.rs @@ -0,0 +1,20 @@ +#![feature(core_intrinsics)] + +use core::intrinsics; + +use leaf::annotations::*; + +fn main() { + let a = 20u8.mark_symbolic(); + let b = 7u8.mark_symbolic(); + let cond = a > b + 2; + + let c = unsafe { intrinsics::select_unpredictable(cond, a, b) }; + use_num(c); +} + +fn use_num(x: T) { + if x.eq(&T::default()) { + intrinsics::black_box(x); + } +} diff --git a/samples/misc/intrinsics/field_proj.rs b/samples/misc/intrinsics/field_proj.rs new file mode 100644 index 00000000..10aa2cf0 --- /dev/null +++ b/samples/misc/intrinsics/field_proj.rs @@ -0,0 +1,49 @@ +#![expect(incomplete_features)] +#![feature(field_projections)] + +use std::field::{Field, field_of}; +use std::mem::offset_of; +use std::ptr; + +#[repr(C)] +pub struct Struct { + a: i32, + b: i64, +} + +// FIXME(FRTs): need to mark these fields as used by the `field_of!` macro. +#[expect(dead_code)] +pub union Union { + a: i32, + b: i64, +} + +#[repr(C, i8)] +pub enum Enum { + A { a: i32, b: i64 }, + B { x: i64, y: i32 }, +} + +fn project_ref<'a, T, F: Field>(r: &'a T) -> &'a F::Type { + unsafe { &*ptr::from_ref(r).byte_add(F::OFFSET).cast() } +} + +fn main() { + assert_eq!(::OFFSET, offset_of!(Struct, a)); + assert_eq!(::OFFSET, offset_of!(Struct, b)); + + let _: field_of!(Union, a); + let _: field_of!(Union, b); + + let _: field_of!(Enum, A.a); + let _: field_of!(Enum, A.b); + let _: field_of!(Enum, B.x); + let _: field_of!(Enum, B.y); + + let s = Struct { a: 42, b: 24 }; + let r = &s; + let a = project_ref::(r); + let b = project_ref::(r); + assert_eq!(*a, 42); + assert_eq!(*b, 24); +}