diff --git a/Cargo.lock b/Cargo.lock index ce8175c6..94036858 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,18 +4,18 @@ version = 4 [[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 = "anstream" -version = "0.6.18" +version = "0.6.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b" +checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a" dependencies = [ "anstyle", "anstyle-parse", @@ -28,54 +28,48 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.10" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9" +checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78" [[package]] name = "anstyle-parse" -version = "0.2.6" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9" +checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" 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", + "windows-sys 0.61.2", ] [[package]] name = "anstyle-wincon" -version = "3.0.7" +version = "3.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3534e77181a9cc07539ad51f2141fe32f6c3ffd4df76db8ad92346b003ae4e" +checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" dependencies = [ "anstyle", - "once_cell", - "windows-sys", + "once_cell_polyfill", + "windows-sys 0.61.2", ] [[package]] name = "archery" -version = "1.2.1" +version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eae2ed21cd55021f05707a807a5fc85695dafb98832921f6cfa06db67ca5b869" +checksum = "70e0a5f99dfebb87bb342d0f53bb92c81842e100bbb915223e38349580e5441d" dependencies = [ "triomphe", ] -[[package]] -name = "autocfg" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" - [[package]] name = "bincode" version = "1.3.3" @@ -91,7 +85,7 @@ version = "0.70.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f49d8fed880d473ea71efb9bf597651e77201bdd4893efe54c9e5d65ae04ce6f" dependencies = [ - "bitflags 2.8.0", + "bitflags 2.10.0", "cexpr", "clang-sys", "itertools 0.13.0", @@ -100,7 +94,7 @@ dependencies = [ "regex", "rustc-hash", "shlex", - "syn 2.0.98", + "syn 2.0.111", ] [[package]] @@ -111,9 +105,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.8.0" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f68f53c83ab957f72c32642f3868eec03eb974d1fb82e453128456482613d36" +checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3" [[package]] name = "byteorder" @@ -123,27 +117,28 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "camino" -version = "1.1.9" +version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b96ec4966b5813e2c0507c1f86115c8c5abaadc3980879c3424042a02fd1ad3" +checksum = "e629a66d692cb9ff1a1c664e41771b3dcaf961985a9774c0eb0bd1b51cf60a48" dependencies = [ - "serde", + "serde_core", ] [[package]] name = "cargo-platform" -version = "0.1.9" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e35af189006b9c0f00a064685c727031e3ed2d8020f7ba284d78cc2671bd36ea" +checksum = "87a0c0e6148f11f01f32650a2ea02d532b2ad4e81d8bd41e6e565b5adc5e6082" dependencies = [ "serde", + "serde_core", ] [[package]] name = "cargo_metadata" -version = "0.19.1" +version = "0.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8769706aad5d996120af43197bf46ef6ad0fda35216b4505f926a365a232d924" +checksum = "ef987d17b0a113becdd19d3d0022d04d7ef41f9efe4f3fb63ac44ba61df3ade9" dependencies = [ "camino", "cargo-platform", @@ -155,10 +150,11 @@ dependencies = [ [[package]] name = "cc" -version = "1.2.12" +version = "1.2.51" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "755717a7de9ec452bf7f3f1a3099085deabd7f2962b861dae91ecd7a365903d2" +checksum = "7a0aeaff4ff1a90589618835a598e545176939b97874f7abc7851caa0618f203" dependencies = [ + "find-msvc-tools", "shlex", ] @@ -173,9 +169,9 @@ 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 = "clang-sys" @@ -190,18 +186,18 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.28" +version = "4.5.53" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e77c3243bd94243c03672cb5154667347c457ca271254724f9f393aee1c05ff" +checksum = "c9e340e012a1bf4935f5282ed1436d1489548e8f72308207ea5df0e23d2d03f8" dependencies = [ "clap_builder", ] [[package]] name = "clap_builder" -version = "4.5.27" +version = "4.5.53" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b26884eb4b57140e4d2d93652abfa49498b938b3c9179f9fc487b0acc3edad7" +checksum = "d76b5d13eaa18c901fd2f7fca939fefe3a0727a953561fefdf3b2922b8569d00" dependencies = [ "anstream", "anstyle", @@ -211,41 +207,41 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6" +checksum = "a1d728cc89cf3aee9ff92b05e62b19ee65a02b5702cff7d5a377e32c6ae29d8d" [[package]] name = "cmake" -version = "0.1.53" +version = "0.1.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e24a03c8b52922d68a1589ad61032f2c1aa5a8158d2aa0d93c6e9534944bbad6" +checksum = "75443c44cd6b379beb8c5b45d85d0773baf31cce901fe7bb252f4eff3008ef7d" dependencies = [ "cc", ] [[package]] name = "colorchoice" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" +checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" [[package]] name = "contracts" -version = "0.6.3" +version = "0.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1d1429e3bd78171c65aa010eabcdf8f863ba3254728dbfb0ad4b1545beac15c" +checksum = "008eb94d541da40512913ef5e0707c3fb0e7280ba1af13f062461e46dd96ef7e" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.111", ] [[package]] name = "crc32fast" -version = "1.4.2" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" +checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511" dependencies = [ "cfg-if", ] @@ -312,15 +308,15 @@ dependencies = [ [[package]] name = "either" -version = "1.13.0" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" +checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" [[package]] name = "env_filter" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "186e05a59d4c50738528153b83b0b0194d3a29507dfec16eccd4b342903397d0" +checksum = "1bf3c259d255ca70051b30e2e95b5446cdb8949ac4cd22c0d7fd634d89f568e2" dependencies = [ "log", "regex", @@ -328,31 +324,31 @@ dependencies = [ [[package]] name = "env_logger" -version = "0.11.6" +version = "0.11.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcaee3d8e3cfc3fd92428d477bc97fc29ec8716d180c0d74c643bb26166660e0" +checksum = "13c863f0904021b108aa8b2f55046443e6b1ebde8fd4a15c399893aae4fa069f" dependencies = [ "anstream", "anstyle", "env_filter", - "humantime", + "jiff", "log", ] [[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 = "errno" -version = "0.3.10" +version = "0.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys", + "windows-sys 0.61.2", ] [[package]] @@ -363,16 +359,22 @@ checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" [[package]] name = "filetime" -version = "0.2.25" +version = "0.2.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35c0522e981e68cbfa8c3f978441a5f34b30b96e146b33cd3359176b50fe8586" +checksum = "bc0505cd1b6fa6580283f6bdf70a73fcf4aba1184038c90902b92b3dd0df63ed" dependencies = [ "cfg-if", "libc", "libredox", - "windows-sys", + "windows-sys 0.60.2", ] +[[package]] +name = "find-msvc-tools" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "645cbb3a84e60b7531617d5ae4e57f7e27308f6445f5abf653209ea76dec8dff" + [[package]] name = "fixedbitset" version = "0.5.7" @@ -385,6 +387,12 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "foldhash" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" + [[package]] name = "fs2" version = "0.4.3" @@ -406,33 +414,36 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.3.1" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43a49c392881ce6d5c3b8cb70f98717b7c07aabbdff06687b9030dbfbe2725f8" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" dependencies = [ "cfg-if", "libc", - "wasi", - "windows-targets", + "r-efi", + "wasip2", ] [[package]] name = "glob" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" +checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280" [[package]] name = "hashbrown" -version = "0.15.2" +version = "0.15.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" +checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" +dependencies = [ + "foldhash", +] [[package]] -name = "humantime" -version = "2.1.0" +name = "hashbrown" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" +checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" [[package]] name = "ident_case" @@ -442,12 +453,12 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" [[package]] name = "indexmap" -version = "2.7.1" +version = "2.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c9c992b02b5b4c94ea26e32fe5bccb7aa7d9f390ab5c1221ff895bc7ea8b652" +checksum = "0ad4bb2b565bca0645f4d68c5c9af97fba094e9791da685bf83cb5f3ce74acf2" dependencies = [ "equivalent", - "hashbrown", + "hashbrown 0.16.1", ] [[package]] @@ -461,9 +472,9 @@ dependencies = [ [[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" @@ -485,9 +496,33 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.14" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2" + +[[package]] +name = "jiff" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" +checksum = "a87d9b8105c23642f50cbbae03d1f75d8422c5cb98ce7ee9271f7ff7505be6b8" +dependencies = [ + "jiff-static", + "log", + "portable-atomic", + "portable-atomic-util", + "serde_core", +] + +[[package]] +name = "jiff-static" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b787bebb543f8969132630c51fd0afab173a86c6abae56ff3b9e5e3e3f9f6e58" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.111", +] [[package]] name = "lazy_static" @@ -497,52 +532,51 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.169" +version = "0.2.178" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a" +checksum = "37c93d8daa9d8a012fd8ab92f088405fb202ea0b6ab73ee2482ae66af4f42091" [[package]] name = "libloading" -version = "0.8.6" +version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34" +checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55" dependencies = [ "cfg-if", - "windows-targets", + "windows-link", ] [[package]] name = "libredox" -version = "0.1.3" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" +checksum = "3d0b95e02c851351f877147b7deea7b1afb1df71b63aa5f8270716e0c5720616" dependencies = [ - "bitflags 2.8.0", + "bitflags 2.10.0", "libc", - "redox_syscall 0.5.8", + "redox_syscall 0.7.0", ] [[package]] name = "linux-raw-sys" -version = "0.4.15" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" +checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039" [[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.25" +version = "0.4.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04cbf5b083de1c7e0222a7a51dbfdba1cbe1c6ab0b15e29fff3f6c077fd9cd9f" +checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" [[package]] name = "log-derive" @@ -558,9 +592,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.7.4" +version = "2.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" +checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" [[package]] name = "minimal-lexical" @@ -570,7 +604,7 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "mirai" -version = "1.1.10" +version = "1.1.12" dependencies = [ "bincode", "cargo_metadata", @@ -623,9 +657,15 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.20.3" +version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "945462a4b81e43c4e3ba96bd7b49d834c6f61198356aa858733bc4acf3cbe62e" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" + +[[package]] +name = "once_cell_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" [[package]] name = "parking_lot" @@ -654,56 +694,78 @@ dependencies = [ [[package]] name = "petgraph" -version = "0.7.1" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3672b37090dbd86368a4145bc067582552b29c27377cad4e0a306c97f9bd7772" +checksum = "8701b58ea97060d5e5b155d383a69952a60943f0e6dfe30b04c287beb0b27455" dependencies = [ "fixedbitset", + "hashbrown 0.15.5", "indexmap", + "serde", ] [[package]] name = "pkg-config" -version = "0.3.31" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" + +[[package]] +name = "portable-atomic" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" +checksum = "f89776e4d69bb58bc6993e99ffa1d11f228b839984854c7daeb5d37f87cbe950" + +[[package]] +name = "portable-atomic-util" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507" +dependencies = [ + "portable-atomic", +] [[package]] name = "ppv-lite86" -version = "0.2.20" +version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" dependencies = [ - "zerocopy 0.7.35", + "zerocopy", ] [[package]] name = "proc-macro2" -version = "1.0.93" +version = "1.0.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60946a68e5f9d28b0dc1c21bb8a97ee7d018a8b322fa57838ba31cc878e22d99" +checksum = "9695f8df41bb4f3d222c95a67532365f569318332d03d5f3f67f37b20e6ebdf0" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.38" +version = "1.0.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc" +checksum = "a338cc41d27e6cc6dce6cefc13a0729dfbb81c262b1f519331575dd80ef3067f" 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 = "rand" -version = "0.9.0" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3779b94aeb87e8bd4e834cee3650289ee9e0d5677f976ecdb6d219e5f4f6cd94" +checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" dependencies = [ "rand_chacha", "rand_core", - "zerocopy 0.8.17", ] [[package]] @@ -718,19 +780,18 @@ dependencies = [ [[package]] name = "rand_core" -version = "0.9.0" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b08f3c9802962f7e1b25113931d94f43ed9725bebc59db9d0c3e9a23b67e15ff" +checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" dependencies = [ "getrandom", - "zerocopy 0.8.17", ] [[package]] name = "rayon" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" +checksum = "368f01d005bf8fd9b1206fb6fa653e6c4a81ceb1466406b81792d87c5677a58f" dependencies = [ "either", "rayon-core", @@ -738,9 +799,9 @@ dependencies = [ [[package]] name = "rayon-core" -version = "1.12.1" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" +checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91" dependencies = [ "crossbeam-deque", "crossbeam-utils", @@ -757,18 +818,18 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.5.8" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03a862b389f93e68874fbf580b9de08dd02facb9a788ebadaf4a3fd33cf58834" +checksum = "49f3fe0889e69e2ae9e41f4d6c4c0181701d00e4697b356fb1f74173a5e0ee27" dependencies = [ - "bitflags 2.8.0", + "bitflags 2.10.0", ] [[package]] name = "regex" -version = "1.11.1" +version = "1.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" +checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4" dependencies = [ "aho-corasick", "memchr", @@ -778,9 +839,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.9" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" +checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c" dependencies = [ "aho-corasick", "memchr", @@ -789,15 +850,15 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.5" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" +checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58" [[package]] name = "rpds" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0e15515d3ce3313324d842629ea4905c25a13f81953eadb88f85516f59290a4" +checksum = "9e75f485e819d4d3015e6c0d55d02a4fd3db47c1993d9e603e0361fba2bffb34" dependencies = [ "archery", "serde", @@ -811,29 +872,23 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] name = "rustc_tools_util" -version = "0.4.0" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3316159ab19e19d1065ecc49278e87f767a9dae9fae80348d2b4d4fa4ae02d4d" +checksum = "a3b75158011a63889ba12084cf1224baad7bcad50f6ee7c842f772b74aa148ed" [[package]] name = "rustix" -version = "0.38.44" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" +checksum = "146c9e247ccc180c1f61615433868c99f3de3ae256a30a43b49f67c2d9171f34" dependencies = [ - "bitflags 2.8.0", + "bitflags 2.10.0", "errno", "libc", "linux-raw-sys", - "windows-sys", + "windows-sys 0.61.2", ] -[[package]] -name = "ryu" -version = "1.0.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ea1a2d0a644769cc99faa24c3ad26b379b786fe7c36fd3c546254801650e6dd" - [[package]] name = "same-file" version = "1.0.6" @@ -851,43 +906,55 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "semver" -version = "1.0.25" +version = "1.0.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f79dfe2d285b0488816f30e700a7438c5a73d816b5b7d3ac72fbc48b0d185e03" +checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2" dependencies = [ "serde", + "serde_core", ] [[package]] name = "serde" -version = "1.0.217" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02fc4265df13d6fa1d00ecff087228cc0a2b5f3c0e87e258d8b94a156e984c70" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.217" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a9bf7cf98d04a2b28aead066b7496853d4779c9cc183c440dbac457641e19a0" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", - "syn 2.0.98", + "syn 2.0.111", ] [[package]] name = "serde_json" -version = "1.0.138" +version = "1.0.148" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d434192e7da787e94a6ea7e9670b26a036d0ca41e0b7efb2676dd32bae872949" +checksum = "3084b546a1dd6289475996f182a22aba973866ea8e8b02c51d9f46b1336a22da" dependencies = [ "itoa", "memchr", - "ryu", "serde", + "serde_core", + "zmij", ] [[package]] @@ -932,9 +999,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.13.2" +version = "1.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" +checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" [[package]] name = "strsim" @@ -961,9 +1028,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.98" +version = "2.0.111" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36147f1a48ae0ec2b5b3bc5b537d267457555a10dc06f3dbc8cb11ba3006d3b1" +checksum = "390cc9a294ab71bdb1aa2e99d13be9c753cd2d7bd6560c77118597410c4d2e87" dependencies = [ "proc-macro2", "quote", @@ -986,9 +1053,9 @@ dependencies = [ [[package]] name = "tar" -version = "0.4.43" +version = "0.4.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c65998313f8e17d0d553d28f91a0df93e4dbbbf770279c7bc21ca0f09ea1a1f6" +checksum = "1d863878d212c87a19c1a610eb53bb01fe12951c0501cf5a0d65f724914a667a" dependencies = [ "filetime", "libc", @@ -997,36 +1064,35 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.16.0" +version = "3.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38c246215d7d24f48ae091a2902398798e05d978b24315d6efbc00ede9a8bb91" +checksum = "655da9c7eb6305c55742045d5a8d2037996d61d8de95806335c7c86ce0f82e9c" dependencies = [ - "cfg-if", "fastrand", "getrandom", "once_cell", "rustix", - "windows-sys", + "windows-sys 0.61.2", ] [[package]] name = "thiserror" -version = "2.0.11" +version = "2.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d452f284b73e6d76dd36758a0c8684b1d5be31f92b89d07fd5822175732206fc" +checksum = "f63587ca0f12b72a0600bcba1d40081f830876000bb46dd2337a3051618f4fc8" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "2.0.11" +version = "2.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26afc1baea8a989337eeb52b6e72a039780ce45c3edfcc9c5b9d112feeb173c2" +checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913" dependencies = [ "proc-macro2", "quote", - "syn 2.0.98", + "syn 2.0.111", ] [[package]] @@ -1046,15 +1112,15 @@ dependencies = [ [[package]] name = "triomphe" -version = "0.1.14" +version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef8f7726da4807b58ea5c96fdc122f80702030edc33b35aff9190a51148ccc85" +checksum = "dd69c5aa8f924c7519d6372789a74eac5b94fb0f8fcf0d4a97eb0bfc3e785f39" [[package]] name = "unicode-ident" -version = "1.0.16" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a210d160f08b701c8721ba1c726c11662f877ea6b7094007e1ca9a1041945034" +checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5" [[package]] name = "untrustworthy_inputs" @@ -1093,12 +1159,12 @@ dependencies = [ ] [[package]] -name = "wasi" -version = "0.13.3+wasi-0.2.2" +name = "wasip2" +version = "1.0.1+wasi-0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26816d2e1a4a36a2940b96c5296ce403917633dff8f3440e9b236ed6f6bacad2" +checksum = "0562428422c63773dad2c345a1882263bbf4d65cf3f42e90921f787ef5ad58e7" dependencies = [ - "wit-bindgen-rt", + "wit-bindgen", ] [[package]] @@ -1119,11 +1185,11 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.9" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" +checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys", + "windows-sys 0.61.2", ] [[package]] @@ -1132,21 +1198,37 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + [[package]] name = "windows-sys" -version = "0.59.0" +version = "0.60.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" dependencies = [ "windows-targets", ] +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "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-link", "windows_aarch64_gnullvm", "windows_aarch64_msvc", "windows_i686_gnu", @@ -1159,69 +1241,65 @@ dependencies = [ [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.6" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" +checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53" [[package]] name = "windows_aarch64_msvc" -version = "0.52.6" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" +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.52.6" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" +checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2" [[package]] name = "windows_x86_64_gnu" -version = "0.52.6" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" +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.52.6" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" +checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" [[package]] -name = "wit-bindgen-rt" -version = "0.33.0" +name = "wit-bindgen" +version = "0.46.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3268f3d866458b787f390cf61f4bbb563b922d091359f9608842999eaee3943c" -dependencies = [ - "bitflags 2.8.0", -] +checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59" [[package]] name = "xattr" -version = "1.4.0" +version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e105d177a3871454f754b33bb0ee637ecaaac997446375fd3e5d43a2ed00c909" +checksum = "32e45ad4206f6d2479085147f02bc2ef834ac85886624a23575ae137c8aa8156" dependencies = [ "libc", - "linux-raw-sys", "rustix", ] @@ -1238,41 +1316,26 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.7.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" -dependencies = [ - "byteorder", - "zerocopy-derive 0.7.35", -] - -[[package]] -name = "zerocopy" -version = "0.8.17" +version = "0.8.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa91407dacce3a68c56de03abe2760159582b846c6a4acd2f456618087f12713" +checksum = "fd74ec98b9250adb3ca554bdde269adf631549f51d8a8f8f0a10b50f1cb298c3" dependencies = [ - "zerocopy-derive 0.8.17", + "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.35" +version = "0.8.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +checksum = "d8a8d209fdf45cf5138cbb5a506f6b52522a25afccc534d1475dad8e31105c6a" dependencies = [ "proc-macro2", "quote", - "syn 2.0.98", + "syn 2.0.111", ] [[package]] -name = "zerocopy-derive" -version = "0.8.17" +name = "zmij" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06718a168365cad3d5ff0bb133aad346959a2074bd4a85c121255a11304a8626" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.98", -] +checksum = "e9747e91771f56fd7893e1164abd78febd14a670ceec257caad15e051de35f06" diff --git a/binaries/summary_store.tar b/binaries/summary_store.tar index a1c9150f..fd74ca6a 100644 Binary files a/binaries/summary_store.tar and b/binaries/summary_store.tar differ diff --git a/checker/src/abstract_value.rs b/checker/src/abstract_value.rs index 9ee0d149..c73488b3 100644 --- a/checker/src/abstract_value.rs +++ b/checker/src/abstract_value.rs @@ -197,11 +197,11 @@ impl AbstractValue { // The overall expression is going to overflow, so pre-compute the simpler domains from // the larger expression and then replace its expression with TOP. if left.expression_size < right.expression_size { - debug!("binary expression right operand abstracted: {:?}", right); + debug!("binary expression right operand abstracted: {right:?}"); right = AbstractValue::make_from(right.expression.clone(), u64::MAX); expression_size = left.expression_size + 1; } else { - debug!("binary expression left operand abstracted: {:?}", left); + debug!("binary expression left operand abstracted: {left:?}"); left = AbstractValue::make_from(left.expression.clone(), u64::MAX); expression_size = right.expression_size + 1; } @@ -228,11 +228,11 @@ impl AbstractValue { // The overall expression is going to overflow, so pre-compute the simpler domains from // the larger expression and then replace its expression with TOP. if left.expression_size < right.expression_size { - debug!("binary expression right operand abstracted: {:?}", right); + debug!("binary expression right operand abstracted: {right:?}"); right = AbstractValue::make_from(right.expression.clone(), u64::MAX); expression_size = left.expression_size + 1; } else { - debug!("binary expression left operand abstracted: {:?}", left); + debug!("binary expression left operand abstracted: {left:?}"); left = AbstractValue::make_from(left.expression.clone(), u64::MAX); expression_size = right.expression_size + 1; } @@ -668,7 +668,7 @@ impl AbstractValue { pub fn make_from(expression: Expression, expression_size: u64) -> Rc { if expression_size > k_limits::MAX_EXPRESSION_SIZE { if expression_size < u64::MAX { - debug!("expression abstracted: {:?}", expression); + debug!("expression abstracted: {expression:?}"); } // If the expression gets too large, refining it gets expensive and composing it // into other expressions leads to exponential growth. We therefore need to abstract @@ -1737,7 +1737,7 @@ impl AbstractValueTrait for Rc { if let Some(trimmed) = self .trim_prefix_conjuncts(k_limits::MAX_EXPRESSION_SIZE - other.expression_size) { - debug!("and expression prefix trimmed, self: {:?}", self); + debug!("and expression prefix trimmed, self: {self:?}"); trimmed_self = trimmed; } else { return other; @@ -2024,7 +2024,6 @@ impl AbstractValueTrait for Rc { /// Returns an element that is "self.cmp(other)". #[logfn_inputs(TRACE)] - #[must_use] fn compare(&self, other: Self) -> Self { let zero = Rc::new(ConstantDomain::I128(0).into()); let one = Rc::new(ConstantDomain::I128(1).into()); @@ -2456,8 +2455,7 @@ impl AbstractValueTrait for Rc { && !(consequent.is_top() || alternate.is_top()) { debug!( - "conditional with mismatched types {:?}: {:?} {:?}: {:?}", - consequent_type, consequent, alternate_type, alternate + "conditional with mismatched types {consequent_type:?}: {consequent:?} {alternate_type:?}: {alternate:?}" ); return Rc::new(TOP); } @@ -2467,7 +2465,7 @@ impl AbstractValueTrait for Rc { .expression_size .saturating_add(consequent.expression_size); if condition_plus_consequent < k_limits::MAX_EXPRESSION_SIZE - 1 { - debug!("alternate abstracted: {:?}", alternate); + debug!("alternate abstracted: {alternate:?}"); alternate = AbstractValue::make_from(alternate.expression.clone(), u64::MAX); expression_size = condition_plus_consequent + 1; } else { @@ -2475,7 +2473,7 @@ impl AbstractValueTrait for Rc { .expression_size .saturating_add(alternate.expression_size); if condition_plus_alternate < k_limits::MAX_EXPRESSION_SIZE - 1 { - debug!("consequent abstracted: {:?}", consequent); + debug!("consequent abstracted: {consequent:?}"); consequent = AbstractValue::make_from(consequent.expression.clone(), u64::MAX); expression_size = condition_plus_alternate + 1; } else { @@ -2483,7 +2481,7 @@ impl AbstractValueTrait for Rc { .expression_size .saturating_add(alternate.expression_size); if consequent_plus_alternate < k_limits::MAX_EXPRESSION_SIZE - 1 { - debug!("condition abstracted: {:?}", condition); + debug!("condition abstracted: {condition:?}"); condition = AbstractValue::make_from(condition.expression.clone(), u64::MAX); expression_size = consequent_plus_alternate + 1; @@ -2827,10 +2825,33 @@ impl AbstractValueTrait for Rc { operand, target_type, }, - ) => { - if *val == 0 && *target_type == ExpressionType::ThinPointer { - return self.equals(operand.clone()); - } + ) if *val == 0 && *target_type == ExpressionType::ThinPointer => { + return self.equals(operand.clone()); + } + + // [0 == cast(x, integer)] -> 0 == x + ( + Expression::CompileTimeConstant(ConstantDomain::U128(val)), + Expression::Cast { + operand, + target_type, + }, + ) if *val == 0 && target_type.is_integer() => { + return self.equals(operand.clone()); + } + + // [0 == transmute(x, integer)] -> 0 == x + ( + Expression::CompileTimeConstant(ConstantDomain::U128(val)), + Expression::Transmute { + operand, + target_type, + }, + ) if *val == 0 + && target_type.is_integer() + && target_type.bit_length() == operand.expression.infer_type().bit_length() => + { + return self.equals(operand.clone()); } // [0 == !x] -> x when x is Boolean. Canonicalize it to the latter. @@ -6858,8 +6879,7 @@ impl AbstractValueTrait for Rc { return self.clone(); } info!( - "replacing embedded path root of {:?}, old_root {:?}, new_root {:?}", - self, old_root, new_root + "replacing embedded path root of {self:?}, old_root {old_root:?}, new_root {new_root:?}" ); self.clone() } diff --git a/checker/src/block_visitor.rs b/checker/src/block_visitor.rs index 73892481..d47d81db 100644 --- a/checker/src/block_visitor.rs +++ b/checker/src/block_visitor.rs @@ -11,6 +11,7 @@ use std::rc::Rc; use log_derive::*; use mirai_annotations::*; +use rustc_abi::{FieldIdx, Primitive, TagEncoding, VariantIdx, Variants}; use rustc_hir::def_id::DefId; use rustc_index::{Idx, IndexVec}; use rustc_middle::mir; @@ -20,11 +21,10 @@ use rustc_middle::ty::adjustment::PointerCoercion; use rustc_middle::ty::TypingMode; use rustc_middle::ty::{ Const, CoroutineArgsExt, FloatTy, IntTy, ParamConst, ScalarInt, Ty, TyKind, UintTy, ValTree, - VariantDef, + ValTreeKind, VariantDef, }; use rustc_middle::ty::{GenericArg, GenericArgsRef}; use rustc_span::source_map::Spanned; -use rustc_target::abi::{FieldIdx, Primitive, TagEncoding, VariantIdx, Variants}; use rustc_trait_selection::infer::TyCtxtInferExt; use crate::abstract_value::{self, AbstractValue, AbstractValueTrait, BOTTOM}; @@ -208,7 +208,7 @@ impl<'block, 'analysis, 'compilation, 'tcx> BlockVisitor<'block, 'analysis, 'com fn visit_set_discriminant( &mut self, place: &mir::Place<'tcx>, - variant_index: rustc_target::abi::VariantIdx, + variant_index: rustc_abi::VariantIdx, ) { let target_path = Path::new_discriminant(self.visit_rh_place(place)); let ty = self @@ -300,6 +300,7 @@ impl<'block, 'analysis, 'compilation, 'tcx> BlockVisitor<'block, 'analysis, 'com target, unwind, replace, + .. } => self.visit_drop(place, *target, *unwind, *replace), mir::TerminatorKind::Call { func, @@ -496,7 +497,7 @@ impl<'block, 'analysis, 'compilation, 'tcx> BlockVisitor<'block, 'analysis, 'com ty = self .type_visitor() .get_rustc_place_type(place, self.bv.current_span); - debug!("ty {:?}", ty); + debug!("ty {ty:?}"); } self.type_visitor_mut() .set_path_rustc_type(path.clone(), ty); @@ -606,9 +607,9 @@ impl<'block, 'analysis, 'compilation, 'tcx> BlockVisitor<'block, 'analysis, 'com // a million local variables. self.bv.fresh_variable_offset += 1_000_000; - trace!("source location {:?}", fn_span); + trace!("source location {fn_span:?}"); trace!("call stack {:?}", self.bv.active_calls_map); - trace!("visit_call {:?} {:?}", func, args); + trace!("visit_call {func:?} {args:?}"); trace!( "self.generic_argument_map {:?}", self.type_visitor().generic_argument_map @@ -1659,6 +1660,17 @@ impl<'block, 'analysis, 'compilation, 'tcx> BlockVisitor<'block, 'analysis, 'com ResumedAfterPanic(CoroutineKind::Desugared(CoroutineDesugaring::Gen, _)) => { "`gen fn` should just keep returning `None` after panicking" } + ResumedAfterDrop(CoroutineKind::Coroutine(_)) => "coroutine resumed after drop", + ResumedAfterDrop(CoroutineKind::Desugared(CoroutineDesugaring::Async, _)) => { + "`async fn` resumed after drop" + } + ResumedAfterDrop(CoroutineKind::Desugared(CoroutineDesugaring::AsyncGen, _)) => { + "`async gen fn` resumed after drop" + } + ResumedAfterDrop(CoroutineKind::Desugared(CoroutineDesugaring::Gen, _)) => { + "`gen fn` should just keep returning `None` after drop" + } + NullPointerDereference => "null pointer dereference", } } } @@ -1733,6 +1745,9 @@ impl<'block, 'analysis, 'compilation, 'tcx> BlockVisitor<'block, 'analysis, 'com mir::Rvalue::ThreadLocalRef(def_id) => { self.visit_thread_local_ref(path, *def_id); } + mir::Rvalue::Len(place) => { + self.visit_len(path, place); + } mir::Rvalue::Cast(cast_kind, operand, ty) => { let specialized_ty = self .type_visitor() @@ -1767,6 +1782,9 @@ impl<'block, 'analysis, 'compilation, 'tcx> BlockVisitor<'block, 'analysis, 'com mir::Rvalue::CopyForDeref(place) => { self.visit_used_copy(path, place); } + mir::Rvalue::WrapUnsafeBinder(operand, ty) => { + self.visit_wrap_unsafe_binder(path, operand, *ty); + } } } @@ -1827,10 +1845,7 @@ impl<'block, 'analysis, 'compilation, 'tcx> BlockVisitor<'block, 'analysis, 'com .type_visitor() .get_path_rustc_type(&rpath, self.bv.current_span); if utils::is_concrete(source_type.kind()) { - debug!( - "changing {:?} from {:?} to {:?}", - target_path, target_type, source_type - ); + debug!("changing {target_path:?} from {target_type:?} to {source_type:?}"); self.type_visitor_mut() .set_path_rustc_type(target_path.clone(), source_type); } @@ -1856,10 +1871,7 @@ impl<'block, 'analysis, 'compilation, 'tcx> BlockVisitor<'block, 'analysis, 'com .type_visitor() .get_path_rustc_type(&rpath, self.bv.current_span); if utils::is_concrete(source_type.kind()) { - debug!( - "changing {:?} from {:?} to {:?}", - target_path, target_type, source_type - ); + debug!("changing {target_path:?} from {target_type:?} to {source_type:?}"); self.type_visitor_mut() .set_path_rustc_type(target_path.clone(), source_type); } @@ -2025,6 +2037,36 @@ impl<'block, 'analysis, 'compilation, 'tcx> BlockVisitor<'block, 'analysis, 'com self.bv.update_value_at(path, value); } + /// path = array or slice (i.e. `[T]`, not `&[T]`) length as `usize`. + #[logfn_inputs(TRACE)] + fn visit_len(&mut self, path: Rc, place: &mir::Place<'tcx>) { + let source_type = self + .type_visitor() + .get_rustc_place_type(place, self.bv.current_span); + let value = match source_type.kind() { + TyKind::Array(_, len) => { + let len = self.bv.get_array_length(len); + self.get_u128_const_val(len as u128) + } + TyKind::Slice(_) => { + // For slices, the length is stored as the metadata for the place. + let slice_path = self.visit_rh_place(place); + self.bv.lookup_path_and_refine_result( + Path::new_length(slice_path), + self.bv.tcx.types.usize, + ) + } + _ => { + // This operation is "ill-formed for places of other types". + assume_unreachable!( + "length operation on non array or slice type {:?}", + source_type + ); + } + }; + self.bv.update_value_at(path, value); + } + /// Accessing a thread local static. This is inherently a runtime operation, even if llvm /// treats it as an access to a static. This `Rvalue` yields a reference to the thread local /// static. @@ -2096,7 +2138,7 @@ impl<'block, 'analysis, 'compilation, 'tcx> BlockVisitor<'block, 'analysis, 'com .type_visitor() .get_path_rustc_type(&source_path, self.bv.current_span); if utils::is_concrete(source_type.kind()) { - debug!("changing {:?} from {:?} to {:?}", path, ty, source_type); + debug!("changing {path:?} from {ty:?} to {source_type:?}"); self.type_visitor_mut() .set_path_rustc_type(path.clone(), source_type); } @@ -2287,6 +2329,7 @@ impl<'block, 'analysis, 'compilation, 'tcx> BlockVisitor<'block, 'analysis, 'com }; if let Expression::BitAnd { left, right } = &result.expression { if right.expression.is_memory_reference() { + // Handles misaligned pointer checks. let alignment = match &left.expression { Expression::CompileTimeConstant(ConstantDomain::U128(1)) => 2u128, Expression::CompileTimeConstant(ConstantDomain::U128(3)) => 4u128, @@ -2299,6 +2342,12 @@ impl<'block, 'analysis, 'compilation, 'tcx> BlockVisitor<'block, 'analysis, 'com } } } + if let Expression::Equals { left, right } = &result.expression { + // Handles null pointer checks. + if left.is_zero() && self.is_memory_safe_reference(right) { + result = Rc::new(false.into()); + } + } self.bv.update_value_at(path, result); } @@ -2331,7 +2380,7 @@ impl<'block, 'analysis, 'compilation, 'tcx> BlockVisitor<'block, 'analysis, 'com { return *alignment >= desired_alignment; } - debug!("{:?}", alignment); + debug!("{alignment:?}"); } } false @@ -2346,7 +2395,7 @@ impl<'block, 'analysis, 'compilation, 'tcx> BlockVisitor<'block, 'analysis, 'com .bv .type_visitor() .get_path_rustc_type(path, self.bv.current_span); - debug!("{:?}", ty); + debug!("{ty:?}"); let (_, type_alignment) = self.bv.type_visitor().get_type_size_and_alignment(ty); type_alignment >= desired_alignment @@ -2361,6 +2410,123 @@ impl<'block, 'analysis, 'compilation, 'tcx> BlockVisitor<'block, 'analysis, 'com } } + // Checks if abstract value is a memory safe reference + // (i.e. a reference, non-null pointer or smart pointer that wraps a non-null pointer). + #[logfn_inputs(TRACE)] + fn is_memory_safe_reference(&mut self, value: &Rc) -> bool { + match &value.expression { + Expression::Reference(_) => true, + Expression::Cast { + operand, + target_type, + } + | Expression::Transmute { + operand, + target_type, + } if *target_type == ExpressionType::Usize => self.is_memory_safe_reference(operand), + Expression::ConditionalExpression { + consequent, + alternate, + .. + } => { + self.is_memory_safe_reference(consequent) + && self.is_memory_safe_reference(alternate) + } + Expression::Join { left, right } => { + self.is_memory_safe_reference(left) && self.is_memory_safe_reference(right) + } + Expression::WidenedJoin { operand, .. } => self.is_memory_safe_reference(operand), + Expression::InitialParameterValue { path, var_type } + | Expression::Variable { path, var_type } + if *var_type == ExpressionType::ThinPointer => + { + // Expression types don't currently differentiate between references and raw pointers, + // so this checks the path rustc type instead. + if self.is_memory_safe_reference_path(path) { + return true; + } + + // Checks if the presumably raw pointer is derived from a memory safe reference. + let inner_value = self.bv.current_environment.value_at(path); + if inner_value.is_some() && inner_value != Some(value) { + let inner_value = inner_value.unwrap().clone(); + return self.is_memory_safe_reference(&inner_value); + } + false + } + Expression::Offset { .. } => self.bv.try_check_offset(value).unwrap_or(false), + _ => false, + } + } + + // Checks if path is a memory safe reference + // (i.e. either a reference, non-null pointer or smart pointer that wraps a non-null pointer). + #[logfn_inputs(TRACE)] + fn is_memory_safe_reference_path(&mut self, path: &Rc) -> bool { + let ty = self + .bv + .type_visitor() + .get_path_rustc_type(path, self.bv.current_span); + if ty.is_ref() { + return true; + } + + if let Some(ty_def_id) = ty.ty_adt_def().map(|adt_def| adt_def.did()) { + let tcx = self.bv.tcx; + let get_field_type = |def_id: DefId, field_name: &str| { + let ty = tcx.type_of(def_id).skip_binder(); + match ty.kind() { + TyKind::Adt(adt_def, args) => { + let field = adt_def + .all_fields() + .find(|field| field.name.as_str() == field_name); + field.and_then(|field| { + field + .ty(tcx, args) + .ty_adt_def() + .map(|adt_def| adt_def.did()) + }) + } + _ => None, + } + }; + + // Handles `core::ptr::Unique`. + let ptr_unique_def_id = tcx.lang_items().ptr_unique().or_else(|| { + // Fallback to extracting from Box. + self.bv + .tcx + .lang_items() + .owned_box() + .and_then(|def_id| get_field_type(def_id, "0")) + }); + if ptr_unique_def_id == Some(ty_def_id) { + return true; + } + + // Handles `core::ptr::NonNull`. + let ptr_non_null_def_id = + ptr_unique_def_id.and_then(|def_id| get_field_type(def_id, "pointer")); + if ptr_non_null_def_id == Some(ty_def_id) { + return true; + } + } + + // Handles smart pointers that wrap non-null pointers (e.g. `Box`, `Vec` and `String`). + if let PathEnum::QualifiedPath { + qualifier, + selector, + .. + } = &path.value + { + if *selector.as_ref() == PathSelector::Field(0) { + return self.is_memory_safe_reference_path(qualifier); + } + } + + false + } + /// Apply the given binary operator to the two operands, with overflow checking where appropriate /// and assign the result to path. #[logfn_inputs(TRACE)] @@ -2474,6 +2640,17 @@ impl<'block, 'analysis, 'compilation, 'tcx> BlockVisitor<'block, 'analysis, 'com let val = self.bv.tcx.sess.opts.debug_assertions; Rc::new(val.into()) } + mir::NullOp::ContractChecks => { + let val = self + .bv + .tcx + .sess + .opts + .unstable_opts + .contract_checks + .unwrap_or(false); + Rc::new(val.into()) + } }; self.bv.update_value_at(path, value); } @@ -2589,7 +2766,7 @@ impl<'block, 'analysis, 'compilation, 'tcx> BlockVisitor<'block, 'analysis, 'com let field_ty = field.ty(self.bv.tcx, args); self.type_visitor_mut() .set_path_rustc_type(field_path.clone(), field_ty); - self.visit_use(field_path, &operands[0usize.into()]); + self.visit_use(field_path, &operands[FieldIdx::ZERO]); return; } if variant_def.fields.is_empty() { @@ -2601,13 +2778,10 @@ impl<'block, 'analysis, 'compilation, 'tcx> BlockVisitor<'block, 'analysis, 'com let field_ty = field.ty(self.bv.tcx, args); self.type_visitor_mut() .set_path_rustc_type(field_path.clone(), field_ty); - if let Some(operand) = operands.get(i.into()) { + if let Some(operand) = operands.get::(i.into()) { self.visit_use(field_path, operand); } else { - debug!( - "variant has more fields than was serialized {:?}", - variant_def - ); + debug!("variant has more fields than was serialized {variant_def:?}"); } } } @@ -2649,9 +2823,9 @@ impl<'block, 'analysis, 'compilation, 'tcx> BlockVisitor<'block, 'analysis, 'com let pointer_type = Ty::new_ptr(self.bv.tcx, *ty, *mutbl); self.type_visitor_mut() .set_path_rustc_type(thin_pointer_path.clone(), pointer_type); - self.visit_use(thin_pointer_path, &operands[0usize.into()]); + self.visit_use(thin_pointer_path, &operands[FieldIdx::ZERO]); let metadata_path = Path::new_field(path, 1); - self.visit_use(metadata_path, &operands[1usize.into()]); + self.visit_use(metadata_path, &operands[FieldIdx::from_usize(1)]); } } } @@ -2776,8 +2950,8 @@ impl<'block, 'analysis, 'compilation, 'tcx> BlockVisitor<'block, 'analysis, 'com None => { if !args.is_empty() { let typing_env = rustc_middle::ty::TypingEnv::fully_monomorphized(); - trace!("devirtualize resolving def_id {:?}: {:?}", def_id, def_ty); - trace!("args {:?}", args); + trace!("devirtualize resolving def_id {def_id:?}: {def_ty:?}"); + trace!("args {args:?}"); if let Ok(Some(instance)) = rustc_middle::ty::Instance::try_resolve( self.bv.tcx, typing_env, @@ -2786,8 +2960,8 @@ impl<'block, 'analysis, 'compilation, 'tcx> BlockVisitor<'block, 'analysis, 'com ) { def_id = instance.def.def_id(); args = instance.args; - trace!("resolved it to {:?}", def_id); - trace!("resolved args {:?}", args); + trace!("resolved it to {def_id:?}"); + trace!("resolved args {args:?}"); self.bv.cv.generic_args_cache.insert(def_id, args); } } @@ -2867,24 +3041,28 @@ impl<'block, 'analysis, 'compilation, 'tcx> BlockVisitor<'block, 'analysis, 'com self.bv.current_span ); } - // ZSTs, integers, `bool`, `char` and small structs are represented as scalars. - // See the `ScalarInt` documentation for how `ScalarInt` guarantees that equal values - // of these types have the same representation. - rustc_middle::ty::ConstKind::Value(lty, ValTree::Leaf(scalar_int)) => { - let (data, size) = Self::get_scalar_int_data(scalar_int); - self.get_constant_value_from_scalar(*lty, data, size) - } - // The fields of any kind of aggregate. Structs, tuples and arrays are represented by - // listing their fields' values in order. - // Enums are represented by storing their discriminant as a field, followed by all - // the fields of the variant. - rustc_middle::ty::ConstKind::Value(lty, val_tree) => { - let (heap_block, heap_path) = self.get_heap_block_and_path(*lty, val_tree); - self.deserialize_val_tree(val_tree, heap_path, *lty); - heap_block + rustc_middle::ty::ConstKind::Value(rustc_middle::ty::Value { ty, valtree }) => { + match **valtree { + // ZSTs, integers, `bool`, `char` and small structs are represented as scalars. + // See the `ScalarInt` documentation for how `ScalarInt` guarantees that equal values + // of these types have the same representation. + ValTreeKind::Leaf(scalar_int) => { + let (data, size) = Self::get_scalar_int_data(scalar_int); + self.get_constant_value_from_scalar(*ty, data, size) + } + // The fields of any kind of aggregate. Structs, tuples and arrays are represented by + // listing their fields' values in order. + // Enums are represented by storing their discriminant as a field, followed by all + // the fields of the variant. + ValTreeKind::Branch(_) => { + let (heap_block, heap_path) = self.get_heap_block_and_path(*ty, valtree); + self.deserialize_val_tree(valtree, heap_path, *ty); + heap_block + } + } } _ => { - debug!("kind {:?}", kind); + debug!("kind {kind:?}"); Rc::new(ConstantDomain::Unimplemented.into()) } } @@ -2918,7 +3096,7 @@ impl<'block, 'analysis, 'compilation, 'tcx> BlockVisitor<'block, 'analysis, 'com if let Some(val_tree) = val_tree_iter.next() { self.deserialize_val_tree(val_tree, field_path, field_ty); } else { - debug!("variant has more fields than was serialized {:?}", variant); + debug!("variant has more fields than was serialized {variant:?}"); } } } @@ -2929,29 +3107,30 @@ impl<'block, 'analysis, 'compilation, 'tcx> BlockVisitor<'block, 'analysis, 'com target_path: Rc, ty: Ty<'tcx>, ) { - match val_tree { - ValTree::Leaf(scalar_int) => { + match **val_tree { + ValTreeKind::Leaf(scalar_int) => { let (data, size) = Self::get_scalar_int_data(scalar_int); let const_value = self.get_constant_value_from_scalar(ty, data, size); self.bv.update_value_at(target_path, const_value); } - ValTree::Branch(val_trees) => match ty.kind() { + ValTreeKind::Branch(val_trees) => match ty.kind() { TyKind::Adt(def, args) if def.is_enum() => { let mut val_tree_iter = val_trees.iter(); - let variant_index = - if let Some(ValTree::Leaf(scalar_int)) = val_tree_iter.next() { - self.get_enum_variant_index(scalar_int, ty, &target_path) - } else { - unreachable!( - "serialized enum value without a discriminant value {:?} {:?}", - def, val_trees - ); - }; + let variant_index = if let Some(ValTreeKind::Leaf(scalar_int)) = + val_tree_iter.next().map(|val_tree| **val_tree) + { + self.get_enum_variant_index(scalar_int, ty, &target_path) + } else { + unreachable!( + "serialized enum value without a discriminant value {:?} {:?}", + def, val_trees + ); + }; let variant = &def.variants()[variant_index]; self.deserialize_fields(args, val_tree_iter, target_path, variant); } TyKind::Adt(def, _) if def.is_union() => { - debug!("Did not expect to a serialized union value {:?}", def); + debug!("Did not expect to a serialized union value {def:?}"); } TyKind::Adt(def, args) => { let val_tree_iter = val_trees.iter(); @@ -2965,7 +3144,7 @@ impl<'block, 'analysis, 'compilation, 'tcx> BlockVisitor<'block, 'analysis, 'com if let Some(val_tree) = val_tree_iter.next() { self.deserialize_val_tree(val_tree, field_path, field_ty); } else { - debug!("tuple has more fields than was serialized {:?}", ty); + debug!("tuple has more fields than was serialized {ty:?}"); } } } @@ -2983,12 +3162,12 @@ impl<'block, 'analysis, 'compilation, 'tcx> BlockVisitor<'block, 'analysis, 'com if let Some(val_tree) = val_tree_iter.next() { self.deserialize_val_tree(val_tree, elem_path, *elem_type); } else { - debug!("array has more elements than was serialized {:?}", ty); + debug!("array has more elements than was serialized {ty:?}"); } } } _ => { - debug!("did not expect a value tree branch for this type {:?}", ty); + debug!("did not expect a value tree branch for this type {ty:?}"); } }, } @@ -3028,10 +3207,8 @@ impl<'block, 'analysis, 'compilation, 'tcx> BlockVisitor<'block, 'analysis, 'com // The Rust compiler should ensure this. assume!(alloc_len > offset_bytes); let size = alloc_len - offset_bytes; - let range = alloc_range( - ptr.into_parts().1, - rustc_target::abi::Size::from_bytes(size), - ); + let range = + alloc_range(ptr.into_parts().1, rustc_abi::Size::from_bytes(size)); let bytes = if size > 0 && alloc.inner().provenance().range_empty(range, &self.bv.tcx) { @@ -3046,8 +3223,8 @@ impl<'block, 'analysis, 'compilation, 'tcx> BlockVisitor<'block, 'analysis, 'com Some(GlobalAlloc::Memory(alloc)) => { let size = alloc.inner().len() as u64; let range = alloc_range( - rustc_target::abi::Size::from_bytes(0), - rustc_target::abi::Size::from_bytes(size), + rustc_abi::Size::from_bytes(0), + rustc_abi::Size::from_bytes(size), ); bytes = alloc .inner() @@ -3098,8 +3275,7 @@ impl<'block, 'analysis, 'compilation, 'tcx> BlockVisitor<'block, 'analysis, 'com debug!("span: {:?}", self.bv.current_span); debug!("type kind {:?}", lty.kind()); debug!( - "constant value did not serialize correctly {:?}", - val + "constant value did not serialize correctly {val:?}" ); } AbstractValue::make_reference(heap_path) @@ -3127,7 +3303,7 @@ impl<'block, 'analysis, 'compilation, 'tcx> BlockVisitor<'block, 'analysis, 'com if !bytes_left_to_deserialize.is_empty() { debug!("span: {:?}", self.bv.current_span); debug!("type kind {:?}", lty.kind()); - debug!("constant value did not serialize correctly {:?}", val); + debug!("constant value did not serialize correctly {val:?}"); } heap_val } @@ -3193,12 +3369,12 @@ impl<'block, 'analysis, 'compilation, 'tcx> BlockVisitor<'block, 'analysis, 'com // Used only for `&[u8]` and `&str` ConstValue::Slice { data, meta } => { - let size = rustc_target::abi::Size::from_bytes(meta); + let size = rustc_abi::Size::from_bytes(meta); let bytes = data .inner() .get_bytes_strip_provenance( &self.bv.tcx, - alloc_range(rustc_target::abi::Size::ZERO, size), + alloc_range(rustc_abi::Size::ZERO, size), ) .unwrap(); let slice = &bytes[0..]; @@ -3273,7 +3449,7 @@ impl<'block, 'analysis, 'compilation, 'tcx> BlockVisitor<'block, 'analysis, 'com if !bytes_left_to_deserialize.is_empty() { debug!("span: {:?}", self.bv.current_span); debug!("type kind {:?}", lty.kind()); - debug!("constant value did not serialize correctly {:?}", val); + debug!("constant value did not serialize correctly {val:?}"); } heap_val } @@ -3294,11 +3470,11 @@ impl<'block, 'analysis, 'compilation, 'tcx> BlockVisitor<'block, 'analysis, 'com .set_path_rustc_type(target_path.clone(), ty); match ty.kind() { TyKind::Adt(def, args) if def.is_enum() => { - trace!("deserializing {:?} {:?}", def, args); + trace!("deserializing {def:?} {args:?}"); trace!("def.repr() {:?}", def.repr()); let mut bytes_left_to_deserialize = bytes; if let Ok(enum_ty_layout) = self.type_visitor().layout_of(ty) { - trace!("enum_ty_layout {:?}", enum_ty_layout); + trace!("enum_ty_layout {enum_ty_layout:?}"); let len = enum_ty_layout.size.bytes_usize(); let tag_length; let data = if len == 0 { @@ -3334,10 +3510,10 @@ impl<'block, 'analysis, 'compilation, 'tcx> BlockVisitor<'block, 'analysis, 'com self.bv.update_value_at(discr_path, discr_data); if discr_has_data { let variant = &def.variants()[discr_index]; - trace!("deserializing variant {:?}", variant); + trace!("deserializing variant {variant:?}"); for (i, field) in variant.fields.iter().enumerate() { - trace!("deserializing field({}) {:?}", i, field); - trace!("bytes_left_deserialize {:?}", bytes_left_to_deserialize); + trace!("deserializing field({i}) {field:?}"); + trace!("bytes_left_deserialize {bytes_left_to_deserialize:?}"); let field_path = Path::new_field(target_path.clone(), i); let field_ty = field.ty(self.bv.tcx, args); trace!( @@ -3355,14 +3531,14 @@ impl<'block, 'analysis, 'compilation, 'tcx> BlockVisitor<'block, 'analysis, 'com bytes_left_to_deserialize } TyKind::Adt(def, args) => { - trace!("deserializing {:?} {:?}", def, args); + trace!("deserializing {def:?} {args:?}"); let mut bytes_left_to_deserialize = bytes; for variant in def.variants().iter() { - trace!("deserializing variant {:?}", variant); + trace!("deserializing variant {variant:?}"); bytes_left_to_deserialize = bytes; for (i, field) in variant.fields.iter().enumerate() { - trace!("deserializing field({}) {:?}", i, field); - trace!("bytes_left_deserialize {:?}", bytes_left_to_deserialize); + trace!("deserializing field({i}) {field:?}"); + trace!("bytes_left_deserialize {bytes_left_to_deserialize:?}"); let field_path = Path::new_field(target_path.clone(), i); let field_ty = field.ty(self.bv.tcx, args); trace!( @@ -3641,12 +3817,7 @@ impl<'block, 'analysis, 'compilation, 'tcx> BlockVisitor<'block, 'analysis, 'com // Get the structure of the discriminant tag let (discr_signed, discr_bits, discr_index, discr_has_data) = self.get_discriminator_info(data, &ty_and_layout); - trace!( - "discr tag {:?} index {:?} dataful {:?}", - discr_bits, - discr_index, - discr_has_data - ); + trace!("discr tag {discr_bits:?} index {discr_index:?} dataful {discr_has_data:?}"); let discr_path = Path::new_discriminant(target_path.clone()); let discr_data = if discr_signed { self.get_i128_const_val(discr_bits as i128) @@ -3663,7 +3834,7 @@ impl<'block, 'analysis, 'compilation, 'tcx> BlockVisitor<'block, 'analysis, 'com variant_def.ident(self.bv.tcx) }; let name_str = name.as_str(); - trace!("discr name {:?}", name_str); + trace!("discr name {name_str:?}"); // Obtains the path to store the data. For example, for Option, // the path should be `(x as Some).0`. @@ -3704,9 +3875,9 @@ impl<'block, 'analysis, 'compilation, 'tcx> BlockVisitor<'block, 'analysis, 'com trace!("enum_ty_layout.ty {:?}", enum_ty_layout.ty); let discr_ty = enum_ty_layout.ty.discriminant_ty(self.bv.tcx); - trace!("discr_ty {:?}", discr_ty); + trace!("discr_ty {discr_ty:?}"); let discr_ty_layout = self.type_visitor().layout_of(discr_ty).unwrap(); - trace!("discr_ty_layout {:?}", discr_ty_layout); + trace!("discr_ty_layout {discr_ty_layout:?}"); match enum_ty_layout.variants { Variants::Empty => { discr_signed = false; @@ -3788,21 +3959,21 @@ impl<'block, 'analysis, 'compilation, 'tcx> BlockVisitor<'block, 'analysis, 'com // For example, `Option<(usize, &T)>` is represented such that // `None` has a null pointer for the second tuple field, and // `Some` is the identity function (with a non-null reference). - trace!("untagged_variant {:?}", untagged_variant); - trace!("niche_start {:?}", niche_start); + trace!("untagged_variant {untagged_variant:?}"); + trace!("niche_start {niche_start:?}"); let variants_start = niche_variants.start().as_u32(); let variants_end = niche_variants.end().as_u32(); let variant = if data >= niche_start && variants_end >= variants_start && (data - niche_start) <= (variants_end - variants_start).into() { - trace!("data {:?}", data); + trace!("data {data:?}"); discr_has_data = false; let variant_index_relative = (data - niche_start) as u32; let variant_index = variants_start + variant_index_relative; VariantIdx::from_u32(variant_index) } else { - trace!("data {:?}", data); + trace!("data {data:?}"); discr_has_data = true; let fields = &variants[untagged_variant].fields; checked_assume!( @@ -3912,10 +4083,7 @@ impl<'block, 'analysis, 'compilation, 'tcx> BlockVisitor<'block, 'analysis, 'com if !bytes_left_to_deserialize.is_empty() { debug!("span: {:?}", self.bv.current_span); debug!("type kind {:?}", ty.kind()); - debug!( - "constant value did not serialize correctly {:?} {:?}", - data, size - ); + debug!("constant value did not serialize correctly {data:?} {size:?}"); } return heap_val; } @@ -3973,7 +4141,7 @@ impl<'block, 'analysis, 'compilation, 'tcx> BlockVisitor<'block, 'analysis, 'com ty = self .type_visitor() .get_rustc_place_type(place, self.bv.current_span); - debug!("ty {:?}", ty); + debug!("ty {ty:?}"); } else if ty.is_ptr_sized_integral() { let place_ty = self .type_visitor() @@ -4154,6 +4322,11 @@ impl<'block, 'analysis, 'compilation, 'tcx> BlockVisitor<'block, 'analysis, 'com continue; } mir::ProjectionElem::Subslice { .. } => {} + mir::ProjectionElem::UnwrapUnsafeBinder(inner_ty) => { + ty = self + .type_visitor() + .specialize_type(*inner_ty, &self.type_visitor().generic_argument_map); + } } result = Path::new_qualified(result, Rc::new(selector)); self.type_visitor_mut() @@ -4177,7 +4350,7 @@ impl<'block, 'analysis, 'compilation, 'tcx> BlockVisitor<'block, 'analysis, 'com if def.is_union() { let variants = &def.variants(); assume!(variants.len() == 1); // only enums have more than one variant - let variant = &variants[0usize.into()]; + let variant = &variants[VariantIdx::ZERO]; return PathSelector::UnionField { case_index: field.index(), num_cases: variant.fields.len(), @@ -4241,6 +4414,23 @@ impl<'block, 'analysis, 'compilation, 'tcx> BlockVisitor<'block, 'analysis, 'com // Dummy selector that will be ignored by caller. PathSelector::Deref } + mir::ProjectionElem::UnwrapUnsafeBinder(_) => PathSelector::Field(0), } } + + /// Wrap the operand in an unsafe binder and assign to path. + #[logfn_inputs(TRACE)] + fn visit_wrap_unsafe_binder( + &mut self, + path: Rc, + operand: &mir::Operand<'tcx>, + ty: rustc_middle::ty::Ty<'tcx>, + ) { + // Essentially modeled as a aggregate value with a single field. + // See https://github.com/rust-lang/rust/pull/130514 + let inner_path = Path::new_field(path, 0); + self.type_visitor_mut() + .set_path_rustc_type(inner_path.clone(), ty); + self.visit_use(inner_path, operand); + } } diff --git a/checker/src/body_visitor.rs b/checker/src/body_visitor.rs index 053feecc..8b587d7d 100644 --- a/checker/src/body_visitor.rs +++ b/checker/src/body_visitor.rs @@ -284,6 +284,13 @@ impl<'analysis, 'compilation, 'tcx> BodyVisitor<'analysis, 'compilation, 'tcx> { self.tcx, ); } + } else { + let entry = self.active_calls_map.entry(self.def_id).or_insert(0); + if *entry <= 1 { + self.active_calls_map.remove(&self.def_id); + } else { + *entry -= 1; + } } self.cv .constant_value_cache @@ -340,7 +347,7 @@ impl<'analysis, 'compilation, 'tcx> BodyVisitor<'analysis, 'compilation, 'tcx> { // unlikely that the end user of the diagnostic will be able to anything about it. if let [span] = &diagnostic_builder.span.primary_spans() { if span.in_derive_expansion() { - info!("derive macro has warning: {:?}", diagnostic_builder); + info!("derive macro has warning: {diagnostic_builder:?}"); diagnostic_builder.cancel(); return; } @@ -1102,6 +1109,17 @@ impl<'analysis, 'compilation, 'tcx> BodyVisitor<'analysis, 'compilation, 'tcx> { /// Checks that the offset is either in bounds or one byte past the end of an allocated object. #[logfn_inputs(TRACE)] pub fn check_offset(&mut self, offset: &AbstractValue) { + if let Some(false) = self.try_check_offset(offset) { + let span = self.current_span; + let message = "[MIRAI] effective offset is outside allocated range"; + let warning = self.cv.session.dcx().struct_span_warn(span, message); + self.emit_diagnostic(warning); + } + } + + /// Checks that the offset is either in bounds or one byte past the end of an allocated object. + #[logfn_inputs(TRACE)] + pub fn try_check_offset(&mut self, offset: &AbstractValue) -> Option { if let Expression::Offset { left, right, .. } = &offset.expression { let ge_zero = right.greater_or_equal(Rc::new(ConstantDomain::I128(0).into())); let mut len = left.clone(); @@ -1125,12 +1143,9 @@ impl<'analysis, 'compilation, 'tcx> BodyVisitor<'analysis, 'compilation, 'tcx> { let (in_range_as_bool, entry_cond_as_bool) = self.check_condition_value_and_reachability(&in_range); //todo: eventually give a warning if in_range_as_bool is unknown. For now, that is too noisy. - if entry_cond_as_bool.unwrap_or(true) && !in_range_as_bool.unwrap_or(true) { - let span = self.current_span; - let message = "[MIRAI] effective offset is outside allocated range"; - let warning = self.cv.session.dcx().struct_span_warn(span, message); - self.emit_diagnostic(warning); - } + Some(in_range_as_bool.unwrap_or(true) || !entry_cond_as_bool.unwrap_or(true)) + } else { + None } } @@ -1165,7 +1180,7 @@ impl<'analysis, 'compilation, 'tcx> BodyVisitor<'analysis, 'compilation, 'tcx> { .iter() .filter(|(p, _)| (*p) == *source_path || p.is_rooted_by(source_path)) { - trace!("effect {:?} {:?}", path, value); + trace!("effect {path:?} {value:?}"); let dummy_root = Path::new_local(999_999, 0); let refined_dummy_root = Path::new_local(self.fresh_variable_offset + 999_999, 0); let mut tpath = path @@ -1178,7 +1193,7 @@ impl<'analysis, 'compilation, 'tcx> BodyVisitor<'analysis, 'compilation, 'tcx> { self.fresh_variable_offset, ) .replace_root(&refined_dummy_root, target_path.clone()); - trace!("parameter refined tpath {:?}", tpath); + trace!("parameter refined tpath {tpath:?}"); check_for_early_return!(self); match &tpath.value { PathEnum::PhantomData => { @@ -1213,7 +1228,7 @@ impl<'analysis, 'compilation, 'tcx> BodyVisitor<'analysis, 'compilation, 'tcx> { pre_environment, self.fresh_variable_offset, ); - trace!("refined effect {:?} {:?}", tpath, rvalue); + trace!("refined effect {tpath:?} {rvalue:?}"); check_for_early_return!(self); let rtype = rvalue.expression.infer_type(); match &rvalue.expression { @@ -1816,8 +1831,11 @@ impl<'analysis, 'compilation, 'tcx> BodyVisitor<'analysis, 'compilation, 'tcx> { let variant = def.variants().iter().next().expect("at least one variant"); for (i, field) in variant.fields.iter().enumerate() { let field_path = Path::new_field(path.clone(), i); - let field_ty = field.ty(tcx, args); - debug!("field_path: {:?}, field_ty: {:?}", field_path, field_ty); + let field_ty = self.type_visitor().specialize_type( + field.ty(tcx, args), + &self.type_visitor().generic_argument_map, + ); + debug!("field_path: {field_path:?}, field_ty: {field_ty:?}"); if let TyKind::Adt(def, args) = field_ty.kind() { self.add_leaf_fields_for(field_path, def, args, tcx, accumulator) } else if self.type_visitor().is_slice_pointer(field_ty.kind()) { @@ -2163,10 +2181,7 @@ impl<'analysis, 'compilation, 'tcx> BodyVisitor<'analysis, 'compilation, 'tcx> { F: Fn(&mut Self, Rc, Rc, Ty<'tcx>), { trace!( - "try_expand_source_pattern(target_path {:?}, source_path {:?}, root_rustc_ty {:?},)", - target_path, - source_path, - root_rustc_ty + "try_expand_source_pattern(target_path {target_path:?}, source_path {source_path:?}, root_rustc_ty {root_rustc_ty:?},)" ); if let PathEnum::QualifiedPath { ref qualifier, @@ -2251,10 +2266,7 @@ impl<'analysis, 'compilation, 'tcx> BodyVisitor<'analysis, 'compilation, 'tcx> { F: Fn(&mut Self, Rc, Rc, Ty<'tcx>), { trace!( - "expand_slice(target_path {:?}, source_path {:?}, root_rustc_type {:?},)", - target_path, - source_path, - root_rustc_type + "expand_slice(target_path {target_path:?}, source_path {source_path:?}, root_rustc_type {root_rustc_type:?},)" ); let mut elem_ty = self.type_visitor().get_element_type(root_rustc_type); if elem_ty == root_rustc_type { @@ -2280,10 +2292,7 @@ impl<'analysis, 'compilation, 'tcx> BodyVisitor<'analysis, 'compilation, 'tcx> { let indexed_target = Path::new_index(target_path.clone(), target_index_val) .canonicalize(&self.current_environment); trace!( - "indexed_target {:?} indexed_source {:?} elem_ty {:?}", - indexed_target, - indexed_source, - elem_ty + "indexed_target {indexed_target:?} indexed_source {indexed_source:?} elem_ty {elem_ty:?}" ); update(self, indexed_target, indexed_source, elem_ty); } @@ -2305,11 +2314,7 @@ impl<'analysis, 'compilation, 'tcx> BodyVisitor<'analysis, 'compilation, 'tcx> { F: Fn(&mut Self, Rc, Rc, Ty<'tcx>), { debug!( - "conditionally_expand_slice(target_path {:?}, source_path {:?}, count {:?} root_rustc_type {:?},)", - target_path, - source_path, - count, - root_rustc_type + "conditionally_expand_slice(target_path {target_path:?}, source_path {source_path:?}, count {count:?} root_rustc_type {root_rustc_type:?},)" ); let mut elem_ty = self.type_visitor().get_element_type(root_rustc_type); if elem_ty == root_rustc_type { @@ -2382,10 +2387,7 @@ impl<'analysis, 'compilation, 'tcx> BodyVisitor<'analysis, 'compilation, 'tcx> { F: Fn(&mut Self, Rc, Rc, Ty<'tcx>), { trace!( - "try_expand_target_pattern(target_path {:?}, source_path {:?}, root_rustc_type {:?},)", - target_path, - source_path, - root_rustc_type + "try_expand_target_pattern(target_path {target_path:?}, source_path {source_path:?}, root_rustc_type {root_rustc_type:?},)" ); if let PathEnum::QualifiedPath { ref qualifier, @@ -2466,7 +2468,7 @@ impl<'analysis, 'compilation, 'tcx> BodyVisitor<'analysis, 'compilation, 'tcx> { ) where F: Fn(&mut Self, Rc, Rc), { - trace!("non_patterned_copy_or_move_elements(target_path {:?}, source_path {:?}, root_rustc_type {:?})", target_path, source_path, root_rustc_type); + trace!("non_patterned_copy_or_move_elements(target_path {target_path:?}, source_path {source_path:?}, root_rustc_type {root_rustc_type:?})"); let value = self.lookup_path_and_refine_result(source_path.clone(), root_rustc_type); if let Expression::Variable { path, .. } = &value.expression { if path.eq(&source_path) { @@ -2539,11 +2541,11 @@ impl<'analysis, 'compilation, 'tcx> BodyVisitor<'analysis, 'compilation, 'tcx> { .replace_root(&source_path, target_path.clone()) .canonicalize(&env); if move_elements && !path.contains_deref() { - trace!("moving child {:?} to {:?}", value, qualified_path); + trace!("moving child {value:?} to {qualified_path:?}"); self.current_environment.value_map = self.current_environment.value_map.remove(path); } else { - trace!("copying child {:?} to {:?}", value, qualified_path); + trace!("copying child {value:?} to {qualified_path:?}"); }; update(self, qualified_path, value.clone()); no_children = false; @@ -2568,11 +2570,11 @@ impl<'analysis, 'compilation, 'tcx> BodyVisitor<'analysis, 'compilation, 'tcx> { if target_type != ExpressionType::NonPrimitive || no_children { // Just copy/move (rpath, value) itself. if move_elements { - trace!("moving {:?} to {:?}", value, target_path); + trace!("moving {value:?} to {target_path:?}"); self.current_environment.value_map = self.current_environment.value_map.remove(&source_path); } else { - trace!("copying {:?} to {:?}", value, target_path); + trace!("copying {value:?} to {target_path:?}"); } update(self, target_path, value); } @@ -2947,7 +2949,7 @@ impl<'analysis, 'compilation, 'tcx> BodyVisitor<'analysis, 'compilation, 'tcx> { ) where F: Fn(Rc) -> Rc, { - trace!("propagate_tag_to_tag_fields(root_path: {:?})", root_path); + trace!("propagate_tag_to_tag_fields(root_path: {root_path:?})"); let old_value_map = self.current_environment.value_map.clone(); for (path, val) in old_value_map diff --git a/checker/src/call_visitor.rs b/checker/src/call_visitor.rs index a9ba433f..7c444fee 100644 --- a/checker/src/call_visitor.rs +++ b/checker/src/call_visitor.rs @@ -12,11 +12,11 @@ use std::{f16, f64}; use log_derive::*; use mirai_annotations::*; +use rustc_abi::VariantIdx; use rustc_hir::def_id::DefId; use rustc_middle::mir; use rustc_middle::ty::ConstKind; use rustc_middle::ty::{GenericArg, GenericArgKind, GenericArgsRef, Ty, TyKind, UintTy}; -use rustc_target::abi::VariantIdx; use crate::abstract_value::{AbstractValue, AbstractValueTrait}; use crate::block_visitor::BlockVisitor; @@ -204,7 +204,7 @@ impl<'call, 'block, 'analysis, 'compilation, 'tcx> tcx.type_of(self.callee_def_id).skip_binder() ); trace!("devirtualize resolving func_ref {:?}", self.callee_func_ref,); - trace!("gen_args {:?}", gen_args); + trace!("gen_args {gen_args:?}"); if let Some(arg0_ty) = gen_args.types().next() { if matches!(arg0_ty.kind(), TyKind::Dynamic(..)) { // Instance::resolve panics if it can't find a vtable entry for the given def_id @@ -218,7 +218,7 @@ impl<'call, 'block, 'analysis, 'compilation, 'tcx> .skip_binder() .fn_sig(tcx) .abi(); - let resolved_instance = if abi == rustc_target::spec::abi::Abi::Rust { + let resolved_instance = if abi == rustc_abi::ExternAbi::Rust { Some(rustc_middle::ty::Instance::try_resolve( tcx, typing_env, @@ -245,9 +245,7 @@ impl<'call, 'block, 'analysis, 'compilation, 'tcx> .type_visitor() .specialize_type(resolved_ty, &resolved_map); trace!( - "devirtualize resolved def_id {:?}: {:?}", - resolved_def_id, - specialized_resolved_ty + "devirtualize resolved def_id {resolved_def_id:?}: {specialized_resolved_ty:?}" ); let func_const = self .block_visitor @@ -1146,14 +1144,10 @@ impl<'call, 'block, 'analysis, 'compilation, 'tcx> | KnownNames::StdIntrinsicsLogf32 | KnownNames::StdIntrinsicsLogf64 | KnownNames::StdIntrinsicsLogf128 - | KnownNames::StdIntrinsicsNearbyintf16 - | KnownNames::StdIntrinsicsNearbyintf32 - | KnownNames::StdIntrinsicsNearbyintf64 - | KnownNames::StdIntrinsicsNearbyintf128 - | KnownNames::StdIntrinsicsRintf16 - | KnownNames::StdIntrinsicsRintf32 - | KnownNames::StdIntrinsicsRintf64 - | KnownNames::StdIntrinsicsRintf128 + | KnownNames::StdIntrinsicsRoundTiesEvenf16 + | KnownNames::StdIntrinsicsRoundTiesEvenf32 + | KnownNames::StdIntrinsicsRoundTiesEvenf64 + | KnownNames::StdIntrinsicsRoundTiesEvenf128 | KnownNames::StdIntrinsicsRoundf16 | KnownNames::StdIntrinsicsRoundf32 | KnownNames::StdIntrinsicsRoundf64 @@ -1399,7 +1393,7 @@ impl<'call, 'block, 'analysis, 'compilation, 'tcx> .already_reported_errors_for_call_to .insert(callee.clone()) { - debug!("unknown callee {:?}", callee); + debug!("unknown callee {callee:?}"); self.block_visitor.report_missing_summary(); } } @@ -1439,7 +1433,7 @@ impl<'call, 'block, 'analysis, 'compilation, 'tcx> if let Some(tag) = self.extract_tag_kind_and_propagation_set() { let (source_path, source_rustc_type) = self.deref_tag_source(); - trace!("MiraiAddTag: tagging {:?} with {:?}", source_path, tag); + trace!("MiraiAddTag: tagging {source_path:?} with {tag:?}"); // Check if the tagged value has a pointer type (e.g., a reference). // Emit an warning message if so. @@ -1592,7 +1586,7 @@ impl<'call, 'block, 'analysis, 'compilation, 'tcx> if tag.is_propagated_by(TagPropagation::SubComponent) { let mut path_prefix = &tag_field_path; while let PathEnum::QualifiedPath { qualifier, .. } = &path_prefix.value { - debug!("qualifier {:?}", qualifier); + debug!("qualifier {qualifier:?}"); path_prefix = qualifier; let path_prefix_rustc_type = self @@ -2609,9 +2603,9 @@ impl<'call, 'block, 'analysis, 'compilation, 'tcx> "unhandled call to write_bytes at {:?}", self.block_visitor.bv.current_span ); - info!("elem_type {:?}", elem_type); + info!("elem_type {elem_type:?}"); info!("dest {:?}", self.actual_args[0]); - info!("dest_type {:?}", dest_type); + info!("dest_type {dest_type:?}"); info!("val {:?}", self.actual_args[1]); info!("count {:?}", self.actual_args[2]); } @@ -2703,7 +2697,7 @@ impl<'call, 'block, 'analysis, 'compilation, 'tcx> #[logfn_inputs(TRACE)] pub fn transfer_and_refine_into_current_environment(&mut self, function_summary: &Summary) { debug!("def_id {:?}", self.callee_def_id); - debug!("summary {:?}", function_summary); + debug!("summary {function_summary:?}"); debug!("pre env {:?}", self.block_visitor.bv.current_environment); debug!( "target {:?} arguments {:?}", @@ -2797,7 +2791,7 @@ impl<'call, 'block, 'analysis, 'compilation, 'tcx> if refined_condition.is_bottom() { // The precondition has no value, assume it is unreachable after all. - debug!("precondition refines to BOTTOM {:?}", precondition); + debug!("precondition refines to BOTTOM {precondition:?}"); continue; } @@ -3122,9 +3116,9 @@ impl<'call, 'block, 'analysis, 'compilation, 'tcx> &self.block_visitor.bv.current_environment, self.block_visitor.bv.fresh_variable_offset, ); - trace!("refined post condition {:?}", refined_post_condition); + trace!("refined post condition {refined_post_condition:?}"); exit_condition = exit_condition.and(refined_post_condition); - trace!("post exit conditions {:?}", exit_condition); + trace!("post exit conditions {exit_condition:?}"); } } @@ -3210,7 +3204,7 @@ impl<'call, 'block, 'analysis, 'compilation, 'tcx> // The tag type should be a generic ADT whose first parameter is a constant. let tag_adt_def; let tag_substs_ref = match tag_rustc_type.kind() { - TyKind::Adt(adt_def, substs_ref) if substs_ref.len() > 0 => { + TyKind::Adt(adt_def, substs_ref) if !substs_ref.is_empty() => { tag_adt_def = adt_def; substs_ref } @@ -3227,7 +3221,7 @@ impl<'call, 'block, 'analysis, 'compilation, 'tcx> }; let is_u128 = |kind: ConstKind| { - if let ConstKind::Value(ty, _) = kind { + if let ConstKind::Value(rustc_middle::ty::Value { ty, .. }) = kind { *ty.kind() == TyKind::Uint(UintTy::U128) } else { false diff --git a/checker/src/callbacks.rs b/checker/src/callbacks.rs index 71c748ad..a58c95cd 100644 --- a/checker/src/callbacks.rs +++ b/checker/src/callbacks.rs @@ -130,7 +130,7 @@ impl MiraiCallbacks { #[logfn(TRACE)] fn analyze_with_mirai<'tcx>(&mut self, compiler: &interface::Compiler, tcx: TyCtxt<'tcx>) { if self.options.print_function_names { - for local_def_id in tcx.hir().body_owners() { + for local_def_id in tcx.hir_body_owners() { let def_id = local_def_id.to_def_id(); let span = tcx.def_span(def_id); eprint!("{span:?}: "); @@ -144,7 +144,7 @@ impl MiraiCallbacks { output_dir } else { let temp_dir = TempDir::new().expect("failed to create a temp dir"); - String::from(temp_dir.into_path().to_str().expect("valid string")) + String::from(temp_dir.keep().to_str().expect("valid string")) }; info!( "storing summaries for {} at {}/.summary_store.sled", diff --git a/checker/src/constant_domain.rs b/checker/src/constant_domain.rs index 5942348d..6aa70dfb 100644 --- a/checker/src/constant_domain.rs +++ b/checker/src/constant_domain.rs @@ -762,7 +762,7 @@ impl ConstantDomain { _ => assume_unreachable!("invalid bit length for intrinsic {:?}", name), }, _ => { - debug!("invalid argument {:?} for intrinsic {:?}", self, name); + debug!("invalid argument {self:?} for intrinsic {name:?}"); ConstantDomain::Bottom } } @@ -825,7 +825,7 @@ impl ConstantDomain { _ => assume_unreachable!("invalid bit length for intrinsic {:?}", name), }, _ => { - debug!("invalid argument {:?} for intrinsic {:?}", self, name); + debug!("invalid argument {self:?} for intrinsic {name:?}"); ConstantDomain::Bottom } } @@ -862,14 +862,8 @@ impl ConstantDomain { KnownNames::StdIntrinsicsLog10f16 => val.log10(), KnownNames::StdIntrinsicsLog2f16 => val.log2(), KnownNames::StdIntrinsicsLogf16 => val.ln(), - KnownNames::StdIntrinsicsNearbyintf16 => unsafe { - std::intrinsics::nearbyintf16(val) - }, - KnownNames::StdIntrinsicsRintf16 => unsafe { - std::intrinsics::rintf16(val) - }, KnownNames::StdIntrinsicsRoundf16 => val.round(), - KnownNames::StdIntrinsicsRevenf16 => f16::round_ties_even(val), + KnownNames::StdIntrinsicsRoundTiesEvenf16 => f16::round_ties_even(val), KnownNames::StdIntrinsicsSinf16 => val.sin(), KnownNames::StdIntrinsicsSqrtf16 => val.sqrt(), KnownNames::StdIntrinsicsTruncf16 => val.trunc(), @@ -891,14 +885,8 @@ impl ConstantDomain { KnownNames::StdIntrinsicsLog10f32 => val.log10(), KnownNames::StdIntrinsicsLog2f32 => val.log2(), KnownNames::StdIntrinsicsLogf32 => val.ln(), - KnownNames::StdIntrinsicsNearbyintf32 => unsafe { - std::intrinsics::nearbyintf32(val) - }, - KnownNames::StdIntrinsicsRintf32 => unsafe { - std::intrinsics::rintf32(val) - }, KnownNames::StdIntrinsicsRoundf32 => val.round(), - KnownNames::StdIntrinsicsRevenf32 => f32::round_ties_even(val), + KnownNames::StdIntrinsicsRoundTiesEvenf32 => f32::round_ties_even(val), KnownNames::StdIntrinsicsSinf32 => val.sin(), KnownNames::StdIntrinsicsSqrtf32 => val.sqrt(), KnownNames::StdIntrinsicsTruncf32 => val.trunc(), @@ -920,14 +908,8 @@ impl ConstantDomain { KnownNames::StdIntrinsicsLog10f64 => val.log10(), KnownNames::StdIntrinsicsLog2f64 => val.log2(), KnownNames::StdIntrinsicsLogf64 => val.ln(), - KnownNames::StdIntrinsicsNearbyintf64 => unsafe { - std::intrinsics::nearbyintf64(val) - }, - KnownNames::StdIntrinsicsRintf64 => unsafe { - std::intrinsics::rintf64(val) - }, KnownNames::StdIntrinsicsRoundf64 => val.round(), - KnownNames::StdIntrinsicsRevenf64 => f64::round_ties_even(val), + KnownNames::StdIntrinsicsRoundTiesEvenf64 => f64::round_ties_even(val), KnownNames::StdIntrinsicsSinf64 => val.sin(), KnownNames::StdIntrinsicsSqrtf64 => val.sqrt(), KnownNames::StdIntrinsicsTruncf64 => val.trunc(), @@ -949,14 +931,8 @@ impl ConstantDomain { // KnownNames::StdIntrinsicsLog10f128 => val.log10(), // KnownNames::StdIntrinsicsLog2f128 => val.log2(), // KnownNames::StdIntrinsicsLogf128 => val.ln(), - // KnownNames::StdIntrinsicsNearbyintf128 => unsafe { - // std::intrinsics::nearbyintf128(val) - // }, - // KnownNames::StdIntrinsicsRintf128 => unsafe { - // std::intrinsics::rintf128(val) - // }, // KnownNames::StdIntrinsicsRoundf128 => val.round(), - // KnownNames::StdIntrinsicsRevenf128 => f128::round_ties_even(val), + // KnownNames::StdIntrinsicsRoundTiesEvenf128 => f128::round_ties_even(val), // KnownNames::StdIntrinsicsSinf128 => val.sin(), // KnownNames::StdIntrinsicsSqrtf128 => val.sqrt(), // KnownNames::StdIntrinsicsTruncf128 => val.trunc(), @@ -1441,7 +1417,7 @@ impl ConstantDomain { if let ConstantDomain::U128(val) = self_as_u128 { match target_type { ExpressionType::Char => unsafe { - ConstantDomain::Char(std::mem::transmute::(val as u32)) + ConstantDomain::Char(char::from_u32_unchecked(val as u32)) }, ExpressionType::U8 => ConstantDomain::U128((val as u8) as u128), ExpressionType::U16 => ConstantDomain::U128((val as u16) as u128), diff --git a/checker/src/crate_visitor.rs b/checker/src/crate_visitor.rs index 25530ffa..526b956b 100644 --- a/checker/src/crate_visitor.rs +++ b/checker/src/crate_visitor.rs @@ -82,45 +82,39 @@ impl<'compilation> CrateVisitor<'compilation, '_> { // Analyze all functions that are whitelisted or public let building_standard_summaries = std::env::var("MIRAI_START_FRESH").is_ok(); - for local_def_id in self.tcx.hir().body_owners() { + for local_def_id in self.tcx.hir_body_owners() { let def_id = local_def_id.to_def_id(); let name = utils::summary_key_str(self.tcx, def_id); if let Some(selections) = &selected_functions { if !self.included_in(selections.as_ref(), name.as_ref(), def_id) { if self.options.single_func.is_none() { - debug!( - "skipping function {} as it is not selected for analysis", - name - ); + debug!("skipping function {name} as it is not selected for analysis",); } continue; } - info!("analyzing selected function {}", name); + info!("analyzing selected function {name}"); } else if !building_standard_summaries { if !utils::is_public(def_id, self.tcx) && def_id != entry_fn_def_id { - debug!("skipping function {} as it is not public", name); + debug!("skipping function {name} as it is not public"); continue; } else if self .tcx .generics_of(def_id) .requires_monomorphization(self.tcx) { - debug!("skipping function {} as it is generic", name); + debug!("skipping function {name} as it is generic"); continue; } else if self.tcx.is_const_fn(def_id) { - debug!("skipping function {} as it is a constant function", name); + debug!("skipping function {name} as it is a constant function"); continue; } else if utils::is_higher_order_function(def_id, self.tcx) { - debug!( - "skipping function {} as it is a higher order function", - name - ); + debug!("skipping function {name} as it is a higher order function"); continue; } else { - info!("analyzing function {}", name); + info!("analyzing function {name}"); } } else { - info!("analyzing function {}", name); + info!("analyzing function {name}"); } self.call_graph.add_croot(def_id); self.analyze_body(def_id); @@ -145,7 +139,7 @@ impl<'compilation> CrateVisitor<'compilation, '_> { if fns.is_empty() { info!("Could not extract any tests from main entry point"); } else { - info!("analyzing functions: {:?}", fns); + info!("analyzing functions: {fns:?}"); } Some(fns) } else { @@ -252,7 +246,7 @@ impl<'compilation> CrateVisitor<'compilation, '_> { db.cancel(); } } - print!("{}, analyzed, {}", self.file_name, num_diags); + print!("{}, analyzed, {num_diags}", self.file_name); } else if self.test_run { let mut expected_errors = expected_errors::ExpectedErrors::new(self.file_name); let mut diags = vec![]; diff --git a/checker/src/environment.rs b/checker/src/environment.rs index 194e90a0..881ca6b0 100644 --- a/checker/src/environment.rs +++ b/checker/src/environment.rs @@ -622,7 +622,7 @@ impl Environment { for (path, val1) in value_map1.iter().filter(|(_, v)| !v.is_bottom()) { if let Some(val2) = value_map2.get(path) { if !(val1.subset(val2)) { - trace!("self at {:?} is {:?} other is {:?}", path, val1, val2); + trace!("self at {path:?} is {val1:?} other is {val2:?}"); return false; } } diff --git a/checker/src/expression.rs b/checker/src/expression.rs index 031e8ea9..1bc3e835 100644 --- a/checker/src/expression.rs +++ b/checker/src/expression.rs @@ -1099,10 +1099,8 @@ impl Expression { | KnownNames::StdIntrinsicsLog10f16 | KnownNames::StdIntrinsicsLog2f16 | KnownNames::StdIntrinsicsLogf16 - | KnownNames::StdIntrinsicsNearbyintf16 - | KnownNames::StdIntrinsicsRintf16 | KnownNames::StdIntrinsicsRoundf16 - | KnownNames::StdIntrinsicsRevenf16 + | KnownNames::StdIntrinsicsRoundTiesEvenf16 | KnownNames::StdIntrinsicsSinf16 | KnownNames::StdIntrinsicsSqrtf16 | KnownNames::StdIntrinsicsTruncf16 => ExpressionType::F16, @@ -1115,10 +1113,8 @@ impl Expression { | KnownNames::StdIntrinsicsLog10f32 | KnownNames::StdIntrinsicsLog2f32 | KnownNames::StdIntrinsicsLogf32 - | KnownNames::StdIntrinsicsNearbyintf32 - | KnownNames::StdIntrinsicsRintf32 | KnownNames::StdIntrinsicsRoundf32 - | KnownNames::StdIntrinsicsRevenf32 + | KnownNames::StdIntrinsicsRoundTiesEvenf32 | KnownNames::StdIntrinsicsSinf32 | KnownNames::StdIntrinsicsSqrtf32 | KnownNames::StdIntrinsicsTruncf32 => ExpressionType::F32, @@ -1131,10 +1127,8 @@ impl Expression { | KnownNames::StdIntrinsicsLog10f64 | KnownNames::StdIntrinsicsLog2f64 | KnownNames::StdIntrinsicsLogf64 - | KnownNames::StdIntrinsicsNearbyintf64 - | KnownNames::StdIntrinsicsRintf64 | KnownNames::StdIntrinsicsRoundf64 - | KnownNames::StdIntrinsicsRevenf64 + | KnownNames::StdIntrinsicsRoundTiesEvenf64 | KnownNames::StdIntrinsicsSinf64 | KnownNames::StdIntrinsicsSqrtf64 | KnownNames::StdIntrinsicsTruncf64 => ExpressionType::F64, @@ -1147,8 +1141,6 @@ impl Expression { // | KnownNames::StdIntrinsicsLog10f128 // | KnownNames::StdIntrinsicsLog2f128 // | KnownNames::StdIntrinsicsLogf128 - // | KnownNames::StdIntrinsicsNearbyintf128 - // | KnownNames::StdIntrinsicsRintf128 // | KnownNames::StdIntrinsicsRoundf128 // | KnownNames::StdIntrinsicsRevenf128 // | KnownNames::StdIntrinsicsSinf128 diff --git a/checker/src/fixed_point_visitor.rs b/checker/src/fixed_point_visitor.rs index afdc5f9c..67dd23cd 100644 --- a/checker/src/fixed_point_visitor.rs +++ b/checker/src/fixed_point_visitor.rs @@ -268,10 +268,7 @@ impl<'fixed, 'analysis, 'compilation, 'tcx> if let Some(pred_exit_condition) = pred_state.exit_conditions.get(&bb) { if pred_exit_condition.as_bool_if_known().unwrap_or(true) { trace!( - "pred {:?} exits on condition {:?} with {:?}", - pred_bb, - pred_exit_condition, - pred_state + "pred {pred_bb:?} exits on condition {pred_exit_condition:?} with {pred_state:?}" ); Some((pred_state.clone(), pred_exit_condition.clone())) } else { @@ -319,7 +316,7 @@ impl<'fixed, 'analysis, 'compilation, 'tcx> .map(|(_, c)| c.clone()) .reduce(|c1, c2| c1.or(c2)) .unwrap(); - trace!("entry_condition {:?}", entry_condition); + trace!("entry_condition {entry_condition:?}"); let mut state = predecessor_states_and_conditions .into_iter() .reduce(|(state1, cond1), (state2, cond2)| { diff --git a/checker/src/known_names.rs b/checker/src/known_names.rs index 31269668..b7401af1 100644 --- a/checker/src/known_names.rs +++ b/checker/src/known_names.rs @@ -110,10 +110,6 @@ pub enum KnownNames { StdIntrinsicsMinnumf64, StdIntrinsicsMinnumf128, StdIntrinsicsMulWithOverflow, - StdIntrinsicsNearbyintf16, - StdIntrinsicsNearbyintf32, - StdIntrinsicsNearbyintf64, - StdIntrinsicsNearbyintf128, StdIntrinsicsNeedsDrop, StdIntrinsicsOffset, StdIntrinsicsPowf16, @@ -126,18 +122,14 @@ pub enum KnownNames { StdIntrinsicsPowif128, StdIntrinsicsPrefAlignOfVal, StdIntrinsicsRawEq, - StdIntrinsicsRintf16, - StdIntrinsicsRintf32, - StdIntrinsicsRintf64, - StdIntrinsicsRintf128, StdIntrinsicsRoundf16, StdIntrinsicsRoundf32, StdIntrinsicsRoundf64, StdIntrinsicsRoundf128, - StdIntrinsicsRevenf16, - StdIntrinsicsRevenf32, - StdIntrinsicsRevenf64, - StdIntrinsicsRevenf128, + StdIntrinsicsRoundTiesEvenf16, + StdIntrinsicsRoundTiesEvenf32, + StdIntrinsicsRoundTiesEvenf64, + StdIntrinsicsRoundTiesEvenf128, StdIntrinsicsSinf16, StdIntrinsicsSinf32, StdIntrinsicsSinf64, @@ -408,10 +400,6 @@ fn known_name_for_intrinsics_namespace( "minnumf64" => KnownNames::StdIntrinsicsMinnumf64, "minnumf128" => KnownNames::StdIntrinsicsMinnumf128, "mul_with_overflow" => KnownNames::StdIntrinsicsMulWithOverflow, - "nearbyintf16" => KnownNames::StdIntrinsicsNearbyintf16, - "nearbyintf32" => KnownNames::StdIntrinsicsNearbyintf32, - "nearbyintf64" => KnownNames::StdIntrinsicsNearbyintf64, - "nearbyintf128" => KnownNames::StdIntrinsicsNearbyintf128, "needs_drop" => KnownNames::StdIntrinsicsNeedsDrop, "offset" => KnownNames::StdIntrinsicsOffset, "powf16" => KnownNames::StdIntrinsicsPowf16, @@ -424,18 +412,14 @@ fn known_name_for_intrinsics_namespace( "powif128" => KnownNames::StdIntrinsicsPowif128, "pref_align_of_val" => KnownNames::StdIntrinsicsPrefAlignOfVal, "raw_eq" => KnownNames::StdIntrinsicsRawEq, - "rintf16" => KnownNames::StdIntrinsicsRintf16, - "rintf32" => KnownNames::StdIntrinsicsRintf32, - "rintf64" => KnownNames::StdIntrinsicsRintf64, - "rintf128" => KnownNames::StdIntrinsicsRintf128, "roundf16" => KnownNames::StdIntrinsicsRoundf16, "roundf32" => KnownNames::StdIntrinsicsRoundf32, "roundf64" => KnownNames::StdIntrinsicsRoundf64, "roundf128" => KnownNames::StdIntrinsicsRoundf128, - "roundevenf16" => KnownNames::StdIntrinsicsRevenf16, - "roundevenf32" => KnownNames::StdIntrinsicsRevenf32, - "roundevenf64" => KnownNames::StdIntrinsicsRevenf64, - "roundevenf128" => KnownNames::StdIntrinsicsRevenf128, + "round_ties_even_f16" => KnownNames::StdIntrinsicsRoundTiesEvenf16, + "round_ties_even_f32" => KnownNames::StdIntrinsicsRoundTiesEvenf32, + "round_ties_even_f64" => KnownNames::StdIntrinsicsRoundTiesEvenf64, + "round_ties_even_f128" => KnownNames::StdIntrinsicsRoundTiesEvenf128, "sinf16" => KnownNames::StdIntrinsicsSinf16, "sinf32" => KnownNames::StdIntrinsicsSinf32, "sinf64" => KnownNames::StdIntrinsicsSinf64, diff --git a/checker/src/main.rs b/checker/src/main.rs index ea906853..456c669c 100644 --- a/checker/src/main.rs +++ b/checker/src/main.rs @@ -52,7 +52,7 @@ fn main() { &early_error_handler, false, ); - info!("MIRAI options from environment: {:?}", options); + info!("MIRAI options from environment: {options:?}"); // Let arguments supplied on the command line override the environment variable. let mut args = env::args_os() @@ -73,7 +73,7 @@ fn main() { } let mut rustc_command_line_arguments = options.parse(&args[1..], &early_error_handler, false); - info!("MIRAI options modified by command line: {:?}", options); + info!("MIRAI options modified by command line: {options:?}"); rustc_driver::install_ice_hook(rustc_driver::DEFAULT_BUG_REPORT_URL, |_| ()); let result = rustc_driver::catch_fatal_errors(|| { @@ -130,13 +130,8 @@ fn main() { } let mut callbacks = callbacks::MiraiCallbacks::new(options); - debug!( - "rustc_command_line_arguments {:?}", - rustc_command_line_arguments - ); - let compiler = - rustc_driver::RunCompiler::new(&rustc_command_line_arguments, &mut callbacks); - compiler.run() + debug!("rustc_command_line_arguments {rustc_command_line_arguments:?}"); + rustc_driver::run_compiler(&rustc_command_line_arguments, &mut callbacks) }); let exit_code = match result { Ok(_) => rustc_driver::EXIT_SUCCESS, diff --git a/checker/src/summaries.rs b/checker/src/summaries.rs index cbb2fcae..73f1e3de 100644 --- a/checker/src/summaries.rs +++ b/checker/src/summaries.rs @@ -226,12 +226,7 @@ pub fn summarize( return_type_index: usize, tcx: TyCtxt<'_>, ) -> Summary { - trace!( - "summarize env {:?} pre {:?} post {:?}", - exit_environment, - preconditions, - post_condition, - ); + trace!("summarize env {exit_environment:?} pre {preconditions:?} post {post_condition:?}"); let mut preconditions: Vec = add_provenance(preconditions, tcx); let mut side_effects = if let Some(exit_environment) = exit_environment { extract_side_effects(exit_environment, argument_count) @@ -448,12 +443,12 @@ impl<'tcx> SummaryCache<'tcx> { if result.is_ok() { break; } - debug!("opening db failed {:?}", result); + debug!("opening db failed {result:?}"); let num_millis = rng.random_range(100..200); thread::sleep(Duration::from_millis(num_millis)); } let db = result.unwrap_or_else(|err| { - debug!("{} ", err); + debug!("{err} "); assume_unreachable!(); }); SummaryCache { diff --git a/checker/src/type_visitor.rs b/checker/src/type_visitor.rs index 85834138..601f70c2 100644 --- a/checker/src/type_visitor.rs +++ b/checker/src/type_visitor.rs @@ -12,6 +12,7 @@ use std::rc::Rc; use log_derive::*; use mirai_annotations::*; +use rustc_abi::{FieldIdx, VariantIdx}; use rustc_hir::def_id::DefId; use rustc_index::Idx; use rustc_middle::mir; @@ -20,7 +21,6 @@ use rustc_middle::ty::{ ExistentialTraitRef, FnSig, GenericArg, GenericArgKind, GenericArgs, GenericArgsRef, ParamTy, Ty, TyCtxt, TyKind, }; -use rustc_target::abi::VariantIdx; use crate::abstract_value::AbstractValue; use crate::constant_domain::ConstantDomain; @@ -475,7 +475,7 @@ impl<'tcx> TypeVisitor<'tcx> { let map = self.get_generic_arguments_map(*def_id, args, &[]); t = self.specialize_type(self.tcx.type_of(*def_id).skip_binder(), &map); trace!("opaque type_of {:?}", t.kind()); - trace!("opaque type_of {:?}", t); + trace!("opaque type_of {t:?}"); } match t.kind() { TyKind::Adt(def, args) => { @@ -501,7 +501,7 @@ impl<'tcx> TypeVisitor<'tcx> { let closure_substs = args.as_closure(); return *closure_substs.upvar_tys().get(*ordinal).unwrap_or_else( || { - info!("closure field not found {:?} {:?}", def_id, ordinal); + info!("closure field not found {def_id:?} {ordinal:?}"); &self.tcx.types.never }, ); @@ -512,7 +512,7 @@ impl<'tcx> TypeVisitor<'tcx> { if let Some(field_tys) = tuple_types.nth(*ordinal) { return Ty::new_tup_from_iter(self.tcx, field_tys); } - info!("generator field not found {:?} {:?}", def_id, ordinal); + info!("generator field not found {def_id:?} {ordinal:?}"); return self.tcx.types.never; } TyKind::Ref(_, t, _) if matches!(t.kind(), TyKind::Closure(..)) => { @@ -528,8 +528,7 @@ impl<'tcx> TypeVisitor<'tcx> { .get(*ordinal) .unwrap_or_else(|| { info!( - "closure field not found {:?} {:?}", - def_id, ordinal + "closure field not found {def_id:?} {ordinal:?}" ); &self.tcx.types.never }); @@ -657,15 +656,15 @@ impl<'tcx> TypeVisitor<'tcx> { } _ => {} } - info!("current span is {:?}", current_span); + info!("current span is {current_span:?}"); info!( "cache key is {:?}", utils::summary_key_str(self.tcx, self.def_id) ); - info!("path is {:?}", path); - info!("t is {:?}", t); - info!("qualifier is {:?}", qualifier); - info!("selector is {:?}", selector); + info!("path is {path:?}"); + info!("t is {t:?}"); + info!("qualifier is {qualifier:?}"); + info!("selector is {selector:?}"); self.tcx.types.never } PathEnum::StaticVariable { def_id, .. } => { @@ -724,13 +723,13 @@ impl<'tcx> TypeVisitor<'tcx> { ) -> Ty<'tcx> { for variant in def.variants().iter() { if ordinal < variant.fields.len() { - let field = &variant.fields[ordinal.into()]; + let field = &variant.fields[FieldIdx::from_usize(ordinal)]; let ft = field.ty(self.tcx, args); - trace!("field {:?} type is {:?}", ordinal, ft); + trace!("field {ordinal:?} type is {ft:?}"); return ft; } } - debug!("adt def does not have a field with ordinal {}", ordinal); + debug!("adt def does not have a field with ordinal {ordinal}"); self.tcx.types.never } @@ -798,7 +797,7 @@ impl<'tcx> TypeVisitor<'tcx> { } map.insert(param_def.name, specialized_gen_arg); } else { - debug!("unmapped generic param def {:?}", param_def); + debug!("unmapped generic param def {param_def:?}"); } self.tcx.mk_param_from_def(param_def) // not used }); @@ -905,8 +904,7 @@ impl<'tcx> TypeVisitor<'tcx> { TyKind::Ref(_, ty, _) => *ty, _ => { info!( - "bad deref projection span: {:?}\nelem: {:?} type: {:?}", - current_span, projection_elem, base_ty + "bad deref projection span: {current_span:?}\nelem: {projection_elem:?} type: {base_ty:?}" ); self.tcx.types.never } @@ -923,8 +921,7 @@ impl<'tcx> TypeVisitor<'tcx> { TyKind::Slice(ty) => *ty, _ => { debug!( - "span: {:?}\nelem: {:?} type: {:?}", - current_span, projection_elem, base_ty + "span: {current_span:?}\nelem: {projection_elem:?} type: {base_ty:?}" ); assume_unreachable!(); } @@ -954,16 +951,15 @@ impl<'tcx> TypeVisitor<'tcx> { return Ty::new_tup_from_iter(self.tcx, field_tys); } debug!( - "illegally down casting to index {} of {:?} at {:?}", + "illegally down casting to index {} of {base_ty:?} at {current_span:?}", ordinal.index(), - base_ty, - current_span ); } else { - info!("unexpected type for downcast {:?}", base_ty); + info!("unexpected type for downcast {base_ty:?}"); } base_ty } + mir::ProjectionElem::UnwrapUnsafeBinder(ty) => *ty, }) } @@ -1067,41 +1063,30 @@ impl<'tcx> TypeVisitor<'tcx> { let typing_env = self.get_typing_env_for( self.tcx.associated_item(item_def_id).container_id(self.tcx), ); - if let Ok(Some(instance)) = rustc_middle::ty::Instance::try_resolve( - self.tcx, - typing_env, - item_def_id, - specialized_substs, - ) { - let instance_item_def_id = instance.def.def_id(); - if item_def_id == instance_item_def_id { - return Ty::new_projection(self.tcx, projection.def_id, specialized_substs); + let projection_map = + self.get_generic_arguments_map(projection.def_id, projection.args, &[]); + if let Ok(normalized_ty) = self.tcx.try_normalize_erasing_regions(typing_env, ty) { + if ty != normalized_ty { + return self.specialize_type(normalized_ty, &projection_map); } - let item_type = self.tcx.type_of(instance_item_def_id).skip_binder(); - let map = - self.get_generic_arguments_map(instance_item_def_id, instance.args, &[]); - if item_type == ty && map.is_none() { - // Can happen if the projection just adds a life time - item_type - } else { - self.specialize_type(item_type, &map) + } + + let projection_trait = Some(self.tcx.parent(item_def_id)); + if projection_trait == self.tcx.lang_items().pointee_trait() { + assume!(!specialized_substs.is_empty()); + if let GenericArgKind::Type(ty) = specialized_substs[0].unpack() { + return ty.ptr_metadata_ty(self.tcx, |ty| ty); } - } else { - let projection_trait = Some(self.tcx.parent(item_def_id)); - if projection_trait == self.tcx.lang_items().pointee_trait() { - assume!(!specialized_substs.is_empty()); - if let GenericArgKind::Type(ty) = specialized_substs[0].unpack() { - return ty.ptr_metadata_ty(self.tcx, |ty| ty); - } - } else if projection_trait == self.tcx.lang_items().discriminant_kind_trait() { - assume!(!specialized_substs.is_empty()); - if let GenericArgKind::Type(enum_ty) = specialized_substs[0].unpack() { - return enum_ty.discriminant_ty(self.tcx); - } + } else if projection_trait == self.tcx.lang_items().discriminant_kind_trait() { + assume!(!specialized_substs.is_empty()); + if let GenericArgKind::Type(enum_ty) = specialized_substs[0].unpack() { + return enum_ty.discriminant_ty(self.tcx); } - debug!("could not resolve an associated type with concrete type arguments"); - ty } + self.specialize_type( + Ty::new_projection(self.tcx, projection.def_id, specialized_substs), + &projection_map, + ) } else { Ty::new_projection(self.tcx, projection.def_id, specialized_substs) }; diff --git a/checker/src/utils.rs b/checker/src/utils.rs index 14304102..0bd1c72e 100644 --- a/checker/src/utils.rs +++ b/checker/src/utils.rs @@ -92,7 +92,7 @@ pub fn contains_function<'tcx>(ty: Ty<'tcx>, tcx: TyCtxt<'tcx>) -> bool { pub fn is_public(def_id: DefId, tcx: TyCtxt<'_>) -> bool { use rustc_hir::def_id::LocalDefId; - if tcx.hir().get_if_local(def_id).is_some() { + if tcx.hir_get_if_local(def_id).is_some() { let def_id = def_id.expect_local(); match tcx .resolutions(()) @@ -117,7 +117,7 @@ pub fn is_public(def_id: DefId, tcx: TyCtxt<'_>) -> bool { .is_public() } Node::ImplItem(..) => { - let parent_def_id: LocalDefId = tcx.hir().get_parent_item(hir_id).def_id; + let parent_def_id: LocalDefId = tcx.hir_get_parent_item(hir_id).def_id; match tcx.hir_node_by_def_id(parent_def_id) { Node::Item(rustc_hir::Item { kind: @@ -344,7 +344,7 @@ fn append_mangled_type<'tcx>(str: &mut String, ty: Ty<'tcx>, tcx: TyCtxt<'tcx>) } _ => { //todo: add cases as the need arises, meanwhile make the need obvious. - debug!("{:?}", ty); + debug!("{ty:?}"); debug!("{:?}", ty.kind()); write!(str, "default formatted {ty:?}").expect("enough space"); } @@ -401,7 +401,7 @@ pub fn summary_key_str(tcx: TyCtxt<'_>, def_id: DefId) -> Rc { | DefKind::Union | DefKind::Enum | DefKind::Variant - | DefKind::TyAlias { .. } + | DefKind::TyAlias | DefKind::Impl { .. }, ) { name.push('_'); @@ -432,6 +432,14 @@ fn push_component_name(component_data: DefPathData, target: &mut String) { TypeNs(name) | ValueNs(name) | MacroNs(name) | LifetimeNs(name) => { target.push_str(name.as_str()); } + AnonAssocTy(name) => { + target.push_str("anon_assoc_"); + target.push_str(name.as_str()); + } + OpaqueLifetime(name) => { + target.push_str("opaque_"); + target.push_str(name.as_str()); + } _ => target.push_str(match component_data { CrateRoot => "crate_root", Impl => "implement", @@ -442,6 +450,8 @@ fn push_component_name(component_data: DefPathData, target: &mut String) { Ctor => "ctor", AnonConst => "constant", OpaqueTy => "opaque", + SyntheticCoroutineBody => "coroutine", + NestedStatic => "static", _ => assume_unreachable!(), }), }; diff --git a/checker/src/z3_solver.rs b/checker/src/z3_solver.rs index 5b7f85c0..3fa94e71 100644 --- a/checker/src/z3_solver.rs +++ b/checker/src/z3_solver.rs @@ -360,7 +360,7 @@ impl Z3Solver { } Expression::Join { left, right, .. } => self.general_join(left, right), _ => unsafe { - debug!("uninterpreted expression: {:?}", expression); + debug!("uninterpreted expression: {expression:?}"); let sym = self.get_symbol_for(expression); let sort = self.get_sort_for(expression.infer_type()); z3_sys::Z3_mk_const(self.z3_context, sym, sort) @@ -382,7 +382,7 @@ impl Z3Solver { let left_ast = self.get_as_bool_z3_ast(&left.expression); let right_ast = self.get_as_bool_z3_ast(&right.expression); unsafe { - let tmp = vec![left_ast, right_ast]; + let tmp = [left_ast, right_ast]; operation(self.z3_context, 2, tmp.as_ptr()) } } @@ -480,7 +480,7 @@ impl Z3Solver { let (lf, left_ast) = self.get_as_numeric_z3_ast(&left.expression); let (rf, right_ast) = self.get_as_numeric_z3_ast(&right.expression); if lf != rf { - warn!("can't encode {:?} relational op {:?}", left, right); + warn!("can't encode {left:?} relational op {right:?}"); return self .general_variable(&Path::get_as_path(left.clone()), ExpressionType::Bool); } @@ -524,7 +524,7 @@ impl Z3Solver { let (lf, left_ast) = self.get_as_numeric_z3_ast(&left.expression); let (rf, right_ast) = self.get_as_numeric_z3_ast(&right.expression); if lf != rf { - warn!("can't encode {:?} != {:?}", left, right); + warn!("can't encode {left:?} != {right:?}"); return self .general_variable(&Path::get_as_path(left.clone()), ExpressionType::Bool); } @@ -534,7 +534,7 @@ impl Z3Solver { let r = z3_sys::Z3_mk_fpa_is_nan(self.z3_context, right_ast); let eq = z3_sys::Z3_mk_fpa_eq(self.z3_context, left_ast, right_ast); let ne = z3_sys::Z3_mk_not(self.z3_context, eq); - let tmp = vec![l, r, ne]; + let tmp = [l, r, ne]; z3_sys::Z3_mk_or(self.z3_context, 3, tmp.as_ptr()) } else { z3_sys::Z3_mk_not( @@ -613,10 +613,7 @@ impl Z3Solver { F: FnOnce(&Expression) -> z3_sys::Z3_ast + Copy, { trace!( - "general_switch(discriminator {:?}, cases: {:?}, default {:?})", - discriminator, - cases, - default + "general_switch(discriminator {discriminator:?}, cases: {cases:?}, default {default:?})" ); if discriminator.expression.is_bit_vector() { return self.switch_with_bv_discriminator( @@ -1020,7 +1017,7 @@ impl Z3Solver { unsafe { let min_is_le = z3_sys::Z3_mk_le(self.z3_context, min_ast, operand_ast); let max_is_ge = z3_sys::Z3_mk_ge(self.z3_context, max_ast, operand_ast); - let tmp = vec![min_is_le, max_is_ge]; + let tmp = [min_is_le, max_is_ge]; z3_sys::Z3_mk_and(self.z3_context, 2, tmp.as_ptr()) } } @@ -1176,7 +1173,7 @@ impl Z3Solver { }, Expression::WidenedJoin { path, operand } => self.numeric_widen(path, operand), _ => unsafe { - debug!("uninterpreted expression: {:?}", expression); + debug!("uninterpreted expression: {expression:?}"); let sym = self.get_symbol_for(expression); ( false, @@ -1206,7 +1203,7 @@ impl Z3Solver { let (lf, left_ast) = self.get_as_numeric_z3_ast(&left.expression); let (rf, right_ast) = self.get_as_numeric_z3_ast(&right.expression); if lf != rf { - warn!("can't encode {:?} numeric var arg op {:?}", left, right); + warn!("can't encode {left:?} numeric var arg op {right:?}"); let vt = left.expression.infer_type(); return ( vt.is_floating_point_number(), @@ -1220,7 +1217,7 @@ impl Z3Solver { float_op(self.z3_context, self.nearest_even, left_ast, right_ast), ) } else { - let tmp = vec![left_ast, right_ast]; + let tmp = [left_ast, right_ast]; (false, int_op(self.z3_context, 2, tmp.as_ptr())) } } @@ -1242,17 +1239,17 @@ impl Z3Solver { let (rf, right_ast) = self.get_as_numeric_z3_ast(&right.expression); checked_assume!(!(lf || rf)); unsafe { - let tmp = vec![left_ast, right_ast]; + let tmp = [left_ast, right_ast]; let result = int_op(self.z3_context, 2, tmp.as_ptr()); let min_ast = self.get_constant_as_ast(&result_type.min_value()); let min_is_gt = z3_sys::Z3_mk_gt(self.z3_context, min_ast, result); let max_ast = self.get_constant_as_ast(&result_type.max_value()); let max_is_lt = z3_sys::Z3_mk_lt(self.z3_context, max_ast, result); - let tmp = vec![min_is_gt, max_is_lt]; + let tmp = [min_is_gt, max_is_lt]; let result_overflows = z3_sys::Z3_mk_or(self.z3_context, 2, tmp.as_ptr()); let left_in_range = self.get_range_check(left_ast, min_ast, max_ast); let right_in_range = self.get_range_check(right_ast, min_ast, max_ast); - let tmp = vec![left_in_range, right_in_range, result_overflows]; + let tmp = [left_in_range, right_in_range, result_overflows]; (false, z3_sys::Z3_mk_and(self.z3_context, 3, tmp.as_ptr())) } } @@ -1266,7 +1263,7 @@ impl Z3Solver { let (lf, left_ast) = self.get_as_numeric_z3_ast(&left.expression); let (rf, right_ast) = self.get_as_numeric_z3_ast(&right.expression); if lf != rf { - warn!("can't encode {:?} rem {:?}", left, right); + warn!("can't encode {left:?} rem {right:?}"); let vt = left.expression.infer_type(); return ( vt.is_floating_point_number(), @@ -1290,7 +1287,7 @@ impl Z3Solver { (false, { let cond = z3_sys::Z3_mk_lt(self.z3_context, left_ast, self.zero); let rem = z3_sys::Z3_mk_rem(self.z3_context, left_ast, right_ast); - let tmp = vec![self.zero, rem]; + let tmp = [self.zero, rem]; let neg_rem = z3_sys::Z3_mk_sub(self.z3_context, 2, tmp.as_ptr()); z3_sys::Z3_mk_ite(self.z3_context, cond, neg_rem, rem) }) @@ -1319,7 +1316,7 @@ impl Z3Solver { let (lf, left_ast) = self.get_as_numeric_z3_ast(&left.expression); let (rf, right_ast) = self.get_as_numeric_z3_ast(&right.expression); if lf != rf { - warn!("can't encode {:?} numeric op {:?}", left, right); + warn!("can't encode {left:?} numeric op {right:?}"); let vt = left.expression.infer_type(); return ( vt.is_floating_point_number(), @@ -1348,7 +1345,7 @@ impl Z3Solver { let (lf, left_ast) = self.get_as_numeric_z3_ast(&left.expression); let (rf, right_ast) = self.get_as_numeric_z3_ast(&right.expression); if lf != rf { - warn!("can't encode {:?} join {:?}", left, right); + warn!("can't encode {left:?} join {right:?}"); let vt = left.expression.infer_type(); return ( vt.is_floating_point_number(), @@ -1391,13 +1388,13 @@ impl Z3Solver { if result_type.is_signed_integer() { let (fp, neg) = self.numeric_neg(operand); checked_assume!(!fp); // The Rust type system should prevent this - let tmp = vec![neg, self.one]; + let tmp = [neg, self.one]; (false, z3_sys::Z3_mk_sub(self.z3_context, 2, tmp.as_ptr())) } else { let (fp, ast) = self.get_as_numeric_z3_ast(&operand.expression); checked_assume!(!fp); // The Rust type system should prevent this let max_ast = self.get_constant_as_ast(&result_type.max_value()); - let tmp = vec![max_ast, ast]; + let tmp = [max_ast, ast]; (false, z3_sys::Z3_mk_sub(self.z3_context, 2, tmp.as_ptr())) } } @@ -1441,7 +1438,7 @@ impl Z3Solver { } else { self.get_constant_as_ast(&modulo_constant) }; - let args = vec![expr_ast, modulo_ast]; + let args = [expr_ast, modulo_ast]; let complement = z3_sys::Z3_mk_add(self.z3_context, 2, args.as_ptr()); let is_negative = z3_sys::Z3_mk_lt(self.z3_context, expr_ast, self.zero); @@ -1502,8 +1499,7 @@ impl Z3Solver { // target type is not numeric and not a pointer, but the result of the // cast is expected to be numeric. This probably a mistake. info!( - "non numeric cast to {:?} found in numeric context {:?}", - target_type, expression + "non numeric cast to {target_type:?} found in numeric context {expression:?}" ); } self.get_as_numeric_z3_ast(expression) @@ -1558,10 +1554,7 @@ impl Z3Solver { (false, z3_sys::Z3_mk_int(self.z3_context, 1, self.int_sort)) }, _ => unsafe { - debug!( - "non numeric constant in numeric context: {:?}", - const_domain - ); + debug!("non numeric constant in numeric context: {const_domain:?}"); let sym = self.get_symbol_for(const_domain); ( false, @@ -1632,7 +1625,7 @@ impl Z3Solver { checked_assume!(!(lf || rf)); unsafe { let right_power = z3_sys::Z3_mk_power(self.z3_context, self.two, right_ast); - let tmp = vec![left_ast, right_power]; + let tmp = [left_ast, right_power]; (false, z3_sys::Z3_mk_mul(self.z3_context, 2, tmp.as_ptr())) } } @@ -1767,7 +1760,7 @@ impl Z3Solver { | Expression::InitialParameterValue { path, var_type } | Expression::Variable { path, var_type } => { if *var_type != ExpressionType::Bool { - debug!("path {:?}, type {:?}", path, var_type); + debug!("path {path:?}, type {var_type:?}"); } unsafe { let path_symbol = self.get_symbol_for(path); @@ -1977,7 +1970,7 @@ impl Z3Solver { let does_not_overflow = no_overflow(self.z3_context, left_bv, right_bv, is_signed); let overflows = if is_signed { let does_not_underflow = no_underflow(self.z3_context, left_bv, right_bv); - let tmp = vec![does_not_overflow, does_not_underflow]; + let tmp = [does_not_overflow, does_not_underflow]; let stays_in_range = z3_sys::Z3_mk_and(self.z3_context, 2, tmp.as_ptr()); z3_sys::Z3_mk_not(self.z3_context, stays_in_range) } else { @@ -2139,10 +2132,7 @@ impl Z3Solver { F: FnOnce(&Expression) -> z3_sys::Z3_ast + Copy, { trace!( - "switch_with_bv_discriminator(discriminator {:?}, cases: {:?}, default {:?})", - discriminator, - cases, - default + "switch_with_bv_discriminator(discriminator {discriminator:?}, cases: {cases:?}, default {default:?})" ); let ty = discriminator.expression.infer_type(); let num_bits = u32::from(ty.bit_length()); diff --git a/checker/tests/call_graph/fnptr.rs b/checker/tests/call_graph/fnptr.rs index 6063ebf5..a62e5e2b 100644 --- a/checker/tests/call_graph/fnptr.rs +++ b/checker/tests/call_graph/fnptr.rs @@ -69,7 +69,7 @@ commit; ], "callables": [ { - "name": "/fnptr/fn1(u32,&'^0.Named(DefId(0:7 ~ fnptr[bde8]::fn1::'_), \"'_\") Binder { value: fn(u32) -> u32, bound_vars: [] })->u32", + "name": "/fnptr/fn1(u32,&'^0.Named(DefId(0:7 ~ fnptr[985e]::fn1::'_), \"'_\") Binder { value: fn(u32) -> u32, bound_vars: [] })->u32", "file_index": 0, "first_line": 9, "local": true diff --git a/checker/tests/call_graph/fnptr_clean.rs b/checker/tests/call_graph/fnptr_clean.rs index 32ea4d45..17993fa6 100644 --- a/checker/tests/call_graph/fnptr_clean.rs +++ b/checker/tests/call_graph/fnptr_clean.rs @@ -74,7 +74,7 @@ commit; ], "callables": [ { - "name": "/fnptr_clean/fn1(u32,&'^0.Named(DefId(0:8 ~ fnptr_clean[9455]::fn1::'_), \"'_\") Binder { value: fn(u32) -> u32, bound_vars: [] })->u32", + "name": "/fnptr_clean/fn1(u32,&'^0.Named(DefId(0:8 ~ fnptr_clean[2ac7]::fn1::'_), \"'_\") Binder { value: fn(u32) -> u32, bound_vars: [] })->u32", "file_index": 0, "first_line": 14, "local": true diff --git a/checker/tests/call_graph/fnptr_deduplicate.rs b/checker/tests/call_graph/fnptr_deduplicate.rs index bf637f47..9f1c4122 100644 --- a/checker/tests/call_graph/fnptr_deduplicate.rs +++ b/checker/tests/call_graph/fnptr_deduplicate.rs @@ -66,7 +66,7 @@ commit; ], "callables": [ { - "name": "/fnptr_deduplicate/fn1(u32,&'^0.Named(DefId(0:7 ~ fnptr_deduplicate[e242]::fn1::'_), \"'_\") Binder { value: fn(u32) -> u32, bound_vars: [] })->u32", + "name": "/fnptr_deduplicate/fn1(u32,&'^0.Named(DefId(0:7 ~ fnptr_deduplicate[5ea9]::fn1::'_), \"'_\") Binder { value: fn(u32) -> u32, bound_vars: [] })->u32", "file_index": 0, "first_line": 10, "local": true diff --git a/checker/tests/call_graph/fnptr_dom.rs b/checker/tests/call_graph/fnptr_dom.rs index ffbee64c..b2ca33af 100644 --- a/checker/tests/call_graph/fnptr_dom.rs +++ b/checker/tests/call_graph/fnptr_dom.rs @@ -71,7 +71,7 @@ commit; ], "callables": [ { - "name": "/fnptr_dom/fn1(u32,&'^0.Named(DefId(0:7 ~ fnptr_dom[0574]::fn1::'_), \"'_\") Binder { value: fn(u32) -> u32, bound_vars: [] },&'^1.Named(DefId(0:8 ~ fnptr_dom[0574]::fn1::'_#1), \"'_\") Binder { value: fn(u32) -> u32, bound_vars: [] })->u32", + "name": "/fnptr_dom/fn1(u32,&'^0.Named(DefId(0:7 ~ fnptr_dom[7051]::fn1::'_), \"'_\") Binder { value: fn(u32) -> u32, bound_vars: [] },&'^1.Named(DefId(0:8 ~ fnptr_dom[7051]::fn1::'_#1), \"'_\") Binder { value: fn(u32) -> u32, bound_vars: [] })->u32", "file_index": 0, "first_line": 9, "local": true diff --git a/checker/tests/call_graph/fnptr_dom_loop.rs b/checker/tests/call_graph/fnptr_dom_loop.rs index 98773005..7bb54184 100644 --- a/checker/tests/call_graph/fnptr_dom_loop.rs +++ b/checker/tests/call_graph/fnptr_dom_loop.rs @@ -85,7 +85,7 @@ commit; ], "callables": [ { - "name": "/fnptr_dom_loop/fn1(u32,&'^0.Named(DefId(0:8 ~ fnptr_dom_loop[74da]::fn1::'_), \"'_\") Binder { value: fn(u32) -> u32, bound_vars: [] },&'^1.Named(DefId(0:9 ~ fnptr_dom_loop[74da]::fn1::'_#1), \"'_\") Binder { value: fn(u32) -> u32, bound_vars: [] })->u32", + "name": "/fnptr_dom_loop/fn1(u32,&'^0.Named(DefId(0:8 ~ fnptr_dom_loop[d0b3]::fn1::'_), \"'_\") Binder { value: fn(u32) -> u32, bound_vars: [] },&'^1.Named(DefId(0:9 ~ fnptr_dom_loop[d0b3]::fn1::'_#1), \"'_\") Binder { value: fn(u32) -> u32, bound_vars: [] })->u32", "file_index": 0, "first_line": 9, "local": true diff --git a/checker/tests/call_graph/fnptr_dom_loop_souffle.rs b/checker/tests/call_graph/fnptr_dom_loop_souffle.rs index b692b734..0cdfa392 100644 --- a/checker/tests/call_graph/fnptr_dom_loop_souffle.rs +++ b/checker/tests/call_graph/fnptr_dom_loop_souffle.rs @@ -82,7 +82,7 @@ digraph { ], "callables": [ { - "name": "/fnptr_dom_loop_souffle/fn1(u32,&'^0.Named(DefId(0:8 ~ fnptr_dom_loop_souffle[3113]::fn1::'_), \"'_\") Binder { value: fn(u32) -> u32, bound_vars: [] },&'^1.Named(DefId(0:9 ~ fnptr_dom_loop_souffle[3113]::fn1::'_#1), \"'_\") Binder { value: fn(u32) -> u32, bound_vars: [] })->u32", + "name": "/fnptr_dom_loop_souffle/fn1(u32,&'^0.Named(DefId(0:8 ~ fnptr_dom_loop_souffle[23d6]::fn1::'_), \"'_\") Binder { value: fn(u32) -> u32, bound_vars: [] },&'^1.Named(DefId(0:9 ~ fnptr_dom_loop_souffle[23d6]::fn1::'_#1), \"'_\") Binder { value: fn(u32) -> u32, bound_vars: [] })->u32", "file_index": 0, "first_line": 10, "local": true diff --git a/checker/tests/call_graph/fnptr_fold.rs b/checker/tests/call_graph/fnptr_fold.rs index 4e202b49..c98efc71 100644 --- a/checker/tests/call_graph/fnptr_fold.rs +++ b/checker/tests/call_graph/fnptr_fold.rs @@ -69,11 +69,11 @@ commit; "files": [ "tests/call_graph/fnptr_fold.rs", "/rust/library/std/src/io/stdio.rs", - "/rust/library/core/src/fmt/mod.rs" + "/rust/library/core/src/fmt/rt.rs" ], "callables": [ { - "name": "/fnptr_fold/fn1(u32,&'^0.Named(DefId(0:7 ~ fnptr_fold[7f17]::fn1::'_), \"'_\") Binder { value: fn(u32) -> u32, bound_vars: [] })->u32", + "name": "/fnptr_fold/fn1(u32,&'^0.Named(DefId(0:7 ~ fnptr_fold[bb33]::fn1::'_), \"'_\") Binder { value: fn(u32) -> u32, bound_vars: [] })->u32", "file_index": 0, "first_line": 10, "local": true @@ -97,15 +97,15 @@ commit; "local": true }, { - "name": "/std/std::io::_print(std::fmt::Arguments<'^0.Named(DefId(1:14103 ~ std[8b2b]::io::stdio::_print::'_), \"'_\")>)->()", + "name": "/std/std::io::_print(std::fmt::Arguments<'^0.Named(DefId(1:14320 ~ std[8161]::io::stdio::_print::'_), \"'_\")>)->()", "file_index": 1, - "first_line": 1232, + "first_line": 1274, "local": false }, { - "name": "/core/std::fmt::Arguments::<'a>::new_const(&'a/#0 [&'static str; N/#1])->std::fmt::Arguments<'a/#0>", + "name": "/core/core::fmt::rt::>::new_const(&'a/#0 [&'static str; N/#1])->std::fmt::Arguments<'a/#0>", "file_index": 2, - "first_line": 591, + "first_line": 234, "local": true } ], diff --git a/checker/tests/call_graph/fnptr_loop.rs b/checker/tests/call_graph/fnptr_loop.rs index 119b616f..d665897a 100644 --- a/checker/tests/call_graph/fnptr_loop.rs +++ b/checker/tests/call_graph/fnptr_loop.rs @@ -82,7 +82,7 @@ commit; "local": true }, { - "name": "/fnptr_loop/fn2(u32,&'^0.Named(DefId(0:7 ~ fnptr_loop[39bd]::fn2::'_), \"'_\") Binder { value: fn(u32) -> u32, bound_vars: [] })->u32", + "name": "/fnptr_loop/fn2(u32,&'^0.Named(DefId(0:7 ~ fnptr_loop[be7d]::fn2::'_), \"'_\") Binder { value: fn(u32) -> u32, bound_vars: [] })->u32", "file_index": 0, "first_line": 12, "local": true diff --git a/checker/tests/call_graph/fnptr_slice.rs b/checker/tests/call_graph/fnptr_slice.rs index 06659479..9157e9f4 100644 --- a/checker/tests/call_graph/fnptr_slice.rs +++ b/checker/tests/call_graph/fnptr_slice.rs @@ -62,7 +62,7 @@ commit; ], "callables": [ { - "name": "/fnptr_slice/fn1(u32,&'^0.Named(DefId(0:7 ~ fnptr_slice[1b4f]::fn1::'_), \"'_\") Binder { value: fn(u32) -> u32, bound_vars: [] })->u32", + "name": "/fnptr_slice/fn1(u32,&'^0.Named(DefId(0:7 ~ fnptr_slice[404f]::fn1::'_), \"'_\") Binder { value: fn(u32) -> u32, bound_vars: [] })->u32", "file_index": 0, "first_line": 10, "local": true diff --git a/checker/tests/call_graph/generic.rs b/checker/tests/call_graph/generic.rs index 2e3ae26e..531ea9c0 100644 --- a/checker/tests/call_graph/generic.rs +++ b/checker/tests/call_graph/generic.rs @@ -74,7 +74,7 @@ commit; "local": true }, { - "name": "/generic/Gen::::bar(&'^0.Named(DefId(0:12 ~ generic[fc3c]::{impl#0}::bar::'_), \"'_\") Gen,T/#0)->()", + "name": "/generic/Gen::::bar(&'^0.Named(DefId(0:12 ~ generic[eded]::{impl#0}::bar::'_), \"'_\") Gen,T/#0)->()", "file_index": 0, "first_line": 14, "local": true diff --git a/checker/tests/call_graph/static_deduplicate.rs b/checker/tests/call_graph/static_deduplicate.rs index 4edd79cd..67eb16bd 100644 --- a/checker/tests/call_graph/static_deduplicate.rs +++ b/checker/tests/call_graph/static_deduplicate.rs @@ -66,19 +66,19 @@ commit; ], "callables": [ { - "name": "/static_deduplicate/fn1(u32,&'^0.Named(DefId(0:7 ~ static_deduplicate[de51]::fn1::'_), \"'_\") str)->(u32, &'^0.Named(DefId(0:7 ~ static_deduplicate[de51]::fn1::'_), \"'_\") str)", + "name": "/static_deduplicate/fn1(u32,&'^0.Named(DefId(0:7 ~ static_deduplicate[b0b6]::fn1::'_), \"'_\") str)->(u32, &'^0.Named(DefId(0:7 ~ static_deduplicate[b0b6]::fn1::'_), \"'_\") str)", "file_index": 0, "first_line": 10, "local": true }, { - "name": "/static_deduplicate/fn2(u32,&'^0.Named(DefId(0:8 ~ static_deduplicate[de51]::fn2::'_), \"'_\") str)->(u32, &'^0.Named(DefId(0:8 ~ static_deduplicate[de51]::fn2::'_), \"'_\") str)", + "name": "/static_deduplicate/fn2(u32,&'^0.Named(DefId(0:8 ~ static_deduplicate[b0b6]::fn2::'_), \"'_\") str)->(u32, &'^0.Named(DefId(0:8 ~ static_deduplicate[b0b6]::fn2::'_), \"'_\") str)", "file_index": 0, "first_line": 13, "local": true }, { - "name": "/static_deduplicate/fn3(u32,&'^0.Named(DefId(0:9 ~ static_deduplicate[de51]::fn3::'_), \"'_\") str)->(u32, &'^0.Named(DefId(0:9 ~ static_deduplicate[de51]::fn3::'_), \"'_\") str)", + "name": "/static_deduplicate/fn3(u32,&'^0.Named(DefId(0:9 ~ static_deduplicate[b0b6]::fn3::'_), \"'_\") str)->(u32, &'^0.Named(DefId(0:9 ~ static_deduplicate[b0b6]::fn3::'_), \"'_\") str)", "file_index": 0, "first_line": 16, "local": true diff --git a/checker/tests/call_graph/static_fold.rs b/checker/tests/call_graph/static_fold.rs index dcc9d278..d75bc622 100644 --- a/checker/tests/call_graph/static_fold.rs +++ b/checker/tests/call_graph/static_fold.rs @@ -65,7 +65,7 @@ commit; "files": [ "tests/call_graph/static_fold.rs", "/rust/library/std/src/io/stdio.rs", - "/rust/library/core/src/fmt/mod.rs" + "/rust/library/core/src/fmt/rt.rs" ], "callables": [ { @@ -93,15 +93,15 @@ commit; "local": true }, { - "name": "/std/std::io::_print(std::fmt::Arguments<'^0.Named(DefId(1:14103 ~ std[8b2b]::io::stdio::_print::'_), \"'_\")>)->()", + "name": "/std/std::io::_print(std::fmt::Arguments<'^0.Named(DefId(1:14320 ~ std[8161]::io::stdio::_print::'_), \"'_\")>)->()", "file_index": 1, - "first_line": 1232, + "first_line": 1274, "local": false }, { - "name": "/core/std::fmt::Arguments::<'a>::new_const(&'a/#0 [&'static str; N/#1])->std::fmt::Arguments<'a/#0>", + "name": "/core/core::fmt::rt::>::new_const(&'a/#0 [&'static str; N/#1])->std::fmt::Arguments<'a/#0>", "file_index": 2, - "first_line": 591, + "first_line": 234, "local": false } ], diff --git a/checker/tests/call_graph/trait.rs b/checker/tests/call_graph/trait.rs index 09ffcdf9..665d13bf 100644 --- a/checker/tests/call_graph/trait.rs +++ b/checker/tests/call_graph/trait.rs @@ -74,7 +74,7 @@ commit; "local": true }, { - "name": "/trait/::bar(&'^0.Named(DefId(0:13 ~ trait[51f9]::{impl#0}::bar::'_), \"'_\") Bar)->i32", + "name": "/trait/::bar(&'^0.Named(DefId(0:13 ~ trait[99d0]::{impl#0}::bar::'_), \"'_\") Bar)->i32", "file_index": 0, "first_line": 14, "local": true diff --git a/checker/tests/integration_tests.rs b/checker/tests/integration_tests.rs index 1092ae04..443990e8 100644 --- a/checker/tests/integration_tests.rs +++ b/checker/tests/integration_tests.rs @@ -139,7 +139,7 @@ fn run_directory(directory_path: PathBuf) -> Vec<(String, String)> { continue; } let temp_dir = TempDir::new().expect("failed to create a temp dir"); - let temp_dir_path_buf = temp_dir.into_path(); + let temp_dir_path_buf = temp_dir.keep(); let output_dir_path_buf = temp_dir_path_buf.join(file_name.into_string().unwrap()); fs::create_dir(output_dir_path_buf.as_path()).expect("failed to create test output dir"); files_and_temp_dirs.push(( @@ -303,8 +303,7 @@ fn invoke_driver( let mut call_backs = callbacks::MiraiCallbacks::test_runner(options); let result = std::panic::catch_unwind(move || { - let compiler = rustc_driver::RunCompiler::new(&command_line_arguments, &mut call_backs); - compiler.run() + rustc_driver::run_compiler(&command_line_arguments, &mut call_backs) }); match result { Ok(_) => 0, diff --git a/checker/tests/run-pass/offset.rs b/checker/tests/run-pass/offset.rs index 8c96e228..361c9065 100644 --- a/checker/tests/run-pass/offset.rs +++ b/checker/tests/run-pass/offset.rs @@ -14,7 +14,7 @@ pub fn t1() -> u8 { unsafe { let a = std::alloc::alloc(std::alloc::Layout::from_size_align(4, 2).unwrap()); let b = std::intrinsics::offset(a, -1isize); //~ effective offset is outside allocated range - *b + *b //~ possible null pointer dereference } } @@ -32,7 +32,7 @@ pub fn t3() -> u8 { let a = std::alloc::alloc(std::alloc::Layout::from_size_align(4, 2).unwrap()); let b = std::intrinsics::arith_offset(a, -2); let c = std::intrinsics::offset(b, 1isize); //~ effective offset is outside allocated range - *c + *c //~ possible null pointer dereference } } @@ -40,7 +40,7 @@ pub fn t4() -> u8 { unsafe { let a = std::alloc::alloc(std::alloc::Layout::from_size_align(4, 2).unwrap()); let b = std::intrinsics::offset(a, 6isize); //~ effective offset is outside allocated range - *b + *b //~ possible null pointer dereference } } diff --git a/checker/tests/run-pass/trait_call.rs b/checker/tests/run-pass/trait_call.rs index c49f0bc4..314e4b76 100644 --- a/checker/tests/run-pass/trait_call.rs +++ b/checker/tests/run-pass/trait_call.rs @@ -47,7 +47,7 @@ pub fn t1() { let foo = Foo { bx: Box::new(bar) as Box, }; - let bi = foo.bx.bar(); //~ the called function did not resolve to an implementation with a MIR body + let bi = foo.bx.bar(); verify!(bi == 1); } @@ -89,8 +89,7 @@ pub fn t4a() -> i32 { } fn t4c(foo: Foo) -> i32 { - // todo: fix this - foo.bx.bar() //~ the called function did not resolve to an implementation with a MIR body + foo.bx.bar() } impl Clone for Box { diff --git a/checker/tests/run-pass/transmute.rs b/checker/tests/run-pass/transmute.rs index 77b78d86..12061602 100644 --- a/checker/tests/run-pass/transmute.rs +++ b/checker/tests/run-pass/transmute.rs @@ -12,14 +12,14 @@ use mirai_annotations::*; pub unsafe fn t1(ptr: *mut i32) { - *ptr = 123; + *ptr = 123; //~possible null pointer dereference let non_null_ptr = std::ptr::NonNull::new_unchecked(ptr); let ptr2 = std::mem::transmute::, *const i32>(non_null_ptr); verify!(*ptr2 == 123); } pub unsafe fn t2(ptr: *mut i32) { - *ptr = 123; + *ptr = 123; //~possible null pointer dereference let non_null_ptr = std::mem::transmute::<*const i32, std::ptr::NonNull>(ptr); verify!(*non_null_ptr.as_ptr() == 123); } diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 859da512..c5ac22b5 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] -channel = "nightly-2025-01-10" +channel = "nightly-2025-05-09" components = ["clippy", "rustfmt", "rustc-dev", "rust-src", "rust-std", "llvm-tools-preview"] diff --git a/standard_contracts/src/foreign_contracts.rs b/standard_contracts/src/foreign_contracts.rs index edd90478..0ba39291 100644 --- a/standard_contracts/src/foreign_contracts.rs +++ b/standard_contracts/src/foreign_contracts.rs @@ -1235,7 +1235,7 @@ pub mod core { pub mod implement { pub mod to_bits { pub fn ct_f64_to_u64(ct: f64) -> u64 { - unsafe { std::mem::transmute::(ct) } + f64::to_bits(ct) } } }