diff --git a/Cargo.lock b/Cargo.lock index 431e6ca473..19460cc027 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,31 +1,33 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "addr2line" -version = "0.21.0" +version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" dependencies = [ "gimli", ] [[package]] -name = "adler" -version = "1.0.2" +name = "adler2" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" [[package]] name = "ahash" -version = "0.7.7" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a824f2aa7e75a0c98c5a504fceb80649e9c35265d44525b5f94de4771a395cd" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" dependencies = [ + "cfg-if", "getrandom", "once_cell", "version_check", + "zerocopy", ] [[package]] @@ -37,6 +39,12 @@ dependencies = [ "memchr", ] +[[package]] +name = "allocator-api2" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" + [[package]] name = "android-tzdata" version = "0.1.1" @@ -54,82 +62,58 @@ dependencies = [ [[package]] name = "anstream" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ca84f3628370c59db74ee214b3263d58f9aadd9b4fe7e711fd87dc452b7f163" -dependencies = [ - "anstyle", - "anstyle-parse", - "anstyle-query", - "anstyle-wincon 1.0.2", - "colorchoice", - "is-terminal", - "utf8parse", -] - -[[package]] -name = "anstream" -version = "0.6.13" +version = "0.6.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d96bd03f33fe50a863e394ee9718a706f988b9079b20c3784fb726e7678b62fb" +checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b" dependencies = [ "anstyle", "anstyle-parse", "anstyle-query", - "anstyle-wincon 3.0.2", + "anstyle-wincon", "colorchoice", + "is_terminal_polyfill", "utf8parse", ] [[package]] name = "anstyle" -version = "1.0.6" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8901269c6307e8d93993578286ac0edf7f195079ffff5ebdeea6a59ffb7e36bc" +checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9" [[package]] name = "anstyle-parse" -version = "0.2.2" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "317b9a89c1868f5ea6ff1d9539a69f45dffc21ce321ac1fd1160dfa48c8e2140" +checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" -dependencies = [ - "windows-sys 0.48.0", -] - -[[package]] -name = "anstyle-wincon" -version = "1.0.2" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c677ab05e09154296dd37acecd46420c17b9713e8366facafa8fc0885167cf4c" +checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c" dependencies = [ - "anstyle", - "windows-sys 0.48.0", + "windows-sys 0.59.0", ] [[package]] name = "anstyle-wincon" -version = "3.0.2" +version = "3.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cd54b81ec8d6180e24654d0b371ad22fc3dd083b6ff8ba325b72e00c87660a7" +checksum = "2109dbce0e72be3ec00bed26e6a7479ca384ad226efdd66db8fa2e3a38c83125" dependencies = [ "anstyle", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] name = "anyhow" -version = "1.0.75" +version = "1.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" +checksum = "34ac096ce696dc2fcabef30516bb13c0a68a11d30131d3df6f04711467681b04" dependencies = [ "backtrace", ] @@ -140,36 +124,25 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi 0.1.19", - "libc", - "winapi", -] - [[package]] name = "autocfg" -version = "1.1.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "backtrace" -version = "0.3.69" +version = "0.3.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" +checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" dependencies = [ "addr2line", - "cc", "cfg-if", "libc", "miniz_oxide", "object", "rustc-demangle", + "windows-targets 0.52.6", ] [[package]] @@ -183,15 +156,9 @@ dependencies = [ [[package]] name = "bitflags" -version = "1.3.2" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "bitflags" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "bitvec" @@ -207,9 +174,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.14.0" +version = "3.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" +checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" [[package]] name = "byteorder" @@ -219,18 +186,18 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "camino" -version = "1.0.9" +version = "1.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "869119e97797867fd90f5e22af7d0bd274bd4635ebb9eb68c04f3f513ae6c412" +checksum = "8b96ec4966b5813e2c0507c1f86115c8c5abaadc3980879c3424042a02fd1ad3" dependencies = [ "serde", ] [[package]] name = "cargo-platform" -version = "0.1.4" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12024c4645c97566567129c204f65d5815a8c9aecf30fcbe682b2fe034996d36" +checksum = "e35af189006b9c0f00a064685c727031e3ed2d8020f7ba284d78cc2671bd36ea" dependencies = [ "serde", ] @@ -250,11 +217,11 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.83" +version = "1.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +checksum = "c31a0499c1dc64f458ad13872de75c0eb7e3fdb0e67964610c914b034fc5956e" dependencies = [ - "libc", + "shlex", ] [[package]] @@ -265,49 +232,47 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.31" +version = "0.4.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" +checksum = "7e36cc9d416881d2e24f9a963be5fb1cd90966419ac844274161d10488b3e825" dependencies = [ "android-tzdata", "iana-time-zone", "js-sys", "num-traits", "wasm-bindgen", - "windows-targets 0.48.5", + "windows-targets 0.52.6", ] [[package]] name = "clap" -version = "4.3.24" +version = "4.5.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb690e81c7840c0d7aade59f242ea3b41b9bc27bcd5997890e7702ae4b32e487" +checksum = "3135e7ec2ef7b10c6ed8950f0f792ed96ee093fa088608f1c76e569722700c84" dependencies = [ "clap_builder", "clap_derive", - "once_cell", ] [[package]] name = "clap_builder" -version = "4.3.24" +version = "4.5.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ed2e96bc16d8d740f6f48d663eddf4b8a0983e79210fd55479b7bcd0a69860e" +checksum = "30582fc632330df2bd26877bde0c1f4470d57c582bbc070376afcd04d8cb4838" dependencies = [ - "anstream 0.3.2", + "anstream", "anstyle", "clap_lex", - "once_cell", "strsim", ] [[package]] name = "clap_derive" -version = "4.3.12" +version = "4.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54a9bb5758fc5dfe728d1019941681eccaf0cf8a4189b692a0ee2f2ecf90a050" +checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab" dependencies = [ - "heck", + "heck 0.5.0", "proc-macro2", "quote", "syn", @@ -315,43 +280,31 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.5.1" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd7cc57abe963c6d3b9d8be5b06ba7c8957a930305ca90304f24ef040aa6f961" +checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6" [[package]] name = "colorchoice" -version = "1.0.0" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" +checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" [[package]] name = "colored" -version = "1.9.4" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a5f741c91823341bebf717d4c71bda820630ce065443b58bd1b7451af008355" +checksum = "117725a109d387c937a1533ce01b450cbde6b88abceea8473c4d7a85853cda3c" dependencies = [ - "is-terminal", "lazy_static", - "winapi", -] - -[[package]] -name = "colored" -version = "2.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2674ec482fbc38012cf31e6c42ba0177b431a0cb6f15fe40efa5aab1bda516f6" -dependencies = [ - "is-terminal", - "lazy_static", - "windows-sys 0.48.0", + "windows-sys 0.59.0", ] [[package]] name = "core-foundation-sys" -version = "0.8.4" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "dashmap" @@ -360,7 +313,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" dependencies = [ "cfg-if", - "hashbrown 0.14.2", + "hashbrown 0.14.5", "lock_api", "once_cell", "parking_lot_core", @@ -368,9 +321,9 @@ dependencies = [ [[package]] name = "deranged" -version = "0.3.9" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f32d04922c60427da6f9fef14d042d9edddef64cb9d4ce0d64d0685fbeb1fd3" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" dependencies = [ "powerfmt", ] @@ -382,9 +335,9 @@ source = "git+https://github.com/JustusAdam/dot-rust?rev=ff2b42ceda98c639c8ea3cb [[package]] name = "either" -version = "1.9.0" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" +checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" [[package]] name = "enum-map" @@ -408,9 +361,9 @@ dependencies = [ [[package]] name = "env_filter" -version = "0.1.0" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a009aa4810eb158359dda09d0c87378e4bbb89b5a801f016885a4707ba24f7ea" +checksum = "186e05a59d4c50738528153b83b0b0194d3a29507dfec16eccd4b342903397d0" dependencies = [ "log", "regex", @@ -418,11 +371,11 @@ dependencies = [ [[package]] name = "env_logger" -version = "0.11.3" +version = "0.11.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38b35839ba51819680ba087cd351788c9a3c476841207e0b8cee0b04722343b9" +checksum = "dcaee3d8e3cfc3fd92428d477bc97fc29ec8716d180c0d74c643bb26166660e0" dependencies = [ - "anstream 0.6.13", + "anstream", "anstyle", "env_filter", "humantime", @@ -435,16 +388,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" -[[package]] -name = "errno" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3e13f66a2f95e32a39eaa81f6b95d42878ca0e1db0c7543723dfe12557e860" -dependencies = [ - "libc", - "windows-sys 0.48.0", -] - [[package]] name = "fixedbitset" version = "0.4.2" @@ -453,16 +396,16 @@ checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" [[package]] name = "flowistry" -version = "0.5.41" -source = "git+https://github.com/brownsys/flowistry?rev=57627ed24802cb76c745118bbc46f83f402a1e88#57627ed24802cb76c745118bbc46f83f402a1e88" +version = "0.5.43" +source = "git+https://github.com/brownsys/flowistry?rev=f271637d65a21a2785b87ef52ede8bdeb560948c#f271637d65a21a2785b87ef52ede8bdeb560948c" dependencies = [ "anyhow", "cfg-if", "fluid-let", - "indexical", - "itertools 0.12.0", + "indexical 0.3.1", + "itertools 0.12.1", "log", - "rustc_utils 0.7.4-nightly-2023-08-25 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_utils 0.12.0-nightly-2024-12-15 (registry+https://github.com/rust-lang/crates.io-index)", "serde", ] @@ -471,7 +414,7 @@ name = "flowistry_pdg" version = "0.1.0" dependencies = [ "cfg-if", - "internment", + "internment 0.7.5", "serde", "strum", ] @@ -486,12 +429,12 @@ dependencies = [ "flowistry", "flowistry_pdg", "fluid-let", - "indexical", - "internment", - "itertools 0.12.0", + "indexical 0.6.1", + "internment 0.8.6", + "itertools 0.13.0", "log", "petgraph", - "rustc_utils 0.7.4-nightly-2023-08-25 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_utils 0.12.0-nightly-2024-12-15 (registry+https://github.com/rust-lang/crates.io-index)", "serde", "strum", ] @@ -502,6 +445,12 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "749cff877dc1af878a0b31a41dd221a753634401ea0ef2f87b62d3171522485a" +[[package]] +name = "foldhash" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0d2fde1f7b3d48b8395d5f2de76c18a528bd6a9cdde438df747bfcba3e05d6f" + [[package]] name = "funty" version = "2.0.0" @@ -510,9 +459,9 @@ checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" [[package]] name = "futures" -version = "0.3.29" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0290714b38af9b4a7b094b8a37086d1b4e61f2df9122c3cad2577669145335" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" dependencies = [ "futures-channel", "futures-core", @@ -525,9 +474,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.29" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" dependencies = [ "futures-core", "futures-sink", @@ -535,15 +484,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.29" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" [[package]] name = "futures-executor" -version = "0.3.29" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f4fb8693db0cf099eadcca0efe2a5a22e4550f98ed16aba6c48700da29597bc" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" dependencies = [ "futures-core", "futures-task", @@ -552,27 +501,27 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.29" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" [[package]] name = "futures-sink" -version = "0.3.29" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" [[package]] name = "futures-task" -version = "0.3.29" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" [[package]] name = "futures-util" -version = "0.3.29" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" dependencies = [ "futures-channel", "futures-core", @@ -596,9 +545,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.10" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "libc", @@ -607,24 +556,30 @@ dependencies = [ [[package]] name = "gimli" -version = "0.28.0" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" +checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" [[package]] name = "hashbrown" -version = "0.12.3" +version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" dependencies = [ "ahash", + "allocator-api2", ] [[package]] name = "hashbrown" -version = "0.14.2" +version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156" +checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" +dependencies = [ + "allocator-api2", + "equivalent", + "foldhash", +] [[package]] name = "heck" @@ -633,19 +588,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] -name = "hermit-abi" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] - -[[package]] -name = "hermit-abi" -version = "0.3.3" +name = "heck" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] name = "humantime" @@ -655,9 +601,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "iana-time-zone" -version = "0.1.58" +version = "0.1.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8326b86b6cff230b97d0d312a6c40a60726df3332e721f72a1b035f451663b20" +checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -678,9 +624,9 @@ dependencies = [ [[package]] name = "index_vec" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74086667896a940438f2118212f313abba4aff3831fef6f4b17d02add5c8bb60" +checksum = "44faf5bb8861a9c72e20d3fb0fdbd59233e43056e2b80475ab0aacdc2e781355" [[package]] name = "indexical" @@ -688,34 +634,55 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "467e4f95baab3c675f5e42553f822b34e176aa13c322ec8c258743825deaafb6" dependencies = [ - "bitvec", "fxhash", "index_vec", "splitmut", +] + +[[package]] +name = "indexical" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "549dc3e190943cebb4f2588444a067130cfbf2c9c6d6dda3212f4fa3993833c2" +dependencies = [ + "ahash", + "bitvec", + "index_vec", + "splitmut", "take_mut", ] [[package]] name = "indexmap" -version = "2.2.6" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" +checksum = "62f822373a4fe84d4bb149bf54e584a7f4abec90e072ed49cda0edea5b95471f" dependencies = [ "equivalent", - "hashbrown 0.14.2", + "hashbrown 0.15.2", ] [[package]] name = "internment" -version = "0.7.4" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e976188335292f66a1533fd41d5c2ce24b32dc2c000569b8dccf4e57f489806" +checksum = "04e8e537b529b8674e97e9fb82c10ff168a290ac3867a0295f112061ffbca1ef" dependencies = [ - "hashbrown 0.12.3", + "hashbrown 0.14.5", "parking_lot", "serde", ] +[[package]] +name = "internment" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "636d4b0f6a39fd684effe2a73f5310df16a3fa7954c26d36833e98f44d1977a2" +dependencies = [ + "hashbrown 0.15.2", + "serde", +] + [[package]] name = "intervaltree" version = "0.2.7" @@ -726,72 +693,62 @@ dependencies = [ ] [[package]] -name = "is-terminal" -version = "0.4.9" +name = "is_terminal_polyfill" +version = "1.70.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" -dependencies = [ - "hermit-abi 0.3.3", - "rustix", - "windows-sys 0.48.0", -] +checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" [[package]] name = "itertools" -version = "0.11.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" dependencies = [ "either", ] [[package]] name = "itertools" -version = "0.12.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25db6b064527c5d482d0423354fcd07a89a2dfe07b67892e62411946db7f07b0" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" dependencies = [ "either", ] [[package]] name = "itoa" -version = "1.0.9" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" +checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" [[package]] name = "js-sys" -version = "0.3.64" +version = "0.3.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" +checksum = "6717b6b5b077764fb5966237269cb3c64edddde4b14ce42647430a78ced9e7b7" dependencies = [ + "once_cell", "wasm-bindgen", ] [[package]] name = "lazy_static" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.149" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" - -[[package]] -name = "linux-raw-sys" -version = "0.4.10" +version = "0.2.169" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da2479e8c062e40bf0066ffa0bc823de0a9368974af99c9f6df941d2c231e03f" +checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a" [[package]] name = "lock_api" -version = "0.4.11" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" dependencies = [ "autocfg", "scopeguard", @@ -799,18 +756,18 @@ dependencies = [ [[package]] name = "log" -version = "0.4.21" +version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" dependencies = [ "serde", ] [[package]] name = "memchr" -version = "2.6.4" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "minimal-lexical" @@ -820,11 +777,11 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.7.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +checksum = "4ffbe83022cedc1d264172192511ae958937694cd57ce297164951b8b3568394" dependencies = [ - "adler", + "adler2", ] [[package]] @@ -837,11 +794,17 @@ dependencies = [ "minimal-lexical", ] +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + [[package]] name = "num-derive" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfb77679af88f8b125209d354a202862602672222e7f2313fdd6dc349bad4712" +checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", @@ -850,42 +813,45 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.17" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] [[package]] name = "num_threads" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2819ce041d2ee131036f4fc9d6ae7ae125a3a40e97ba64d04fe799ad9dabbb44" +checksum = "5c7398b9c8b70908f6371f47ed36737907c87c52af34c268fed0bf0ceb92ead9" dependencies = [ "libc", ] [[package]] name = "object" -version = "0.32.1" +version = "0.36.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" +checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87" dependencies = [ "memchr", ] [[package]] name = "once_cell" -version = "1.18.0" +version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" +checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" [[package]] name = "ordermap" -version = "0.3.5" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a86ed3f5f244b372d6b1a00b72ef7f8876d0bc6a78a4c9985c53614041512063" +checksum = "f80a48eb68b6a7da9829b8b0429011708f775af80676a91063d023a66a656106" +dependencies = [ + "indexmap", +] [[package]] name = "paralegal" @@ -901,7 +867,6 @@ name = "paralegal-flow" version = "0.0.1" dependencies = [ "anyhow", - "camino", "chrono", "clap", "dot", @@ -910,8 +875,8 @@ dependencies = [ "flowistry_pdg", "flowistry_pdg_construction", "humantime", - "indexical", - "itertools 0.12.0", + "indexical 0.3.1", + "itertools 0.13.0", "lazy_static", "log", "nom", @@ -922,8 +887,8 @@ dependencies = [ "paralegal-spdg", "petgraph", "pretty", - "rustc_plugin 0.7.4-nightly-2023-08-25 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_utils 0.7.4-nightly-2023-08-25 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_plugin 0.12.0-nightly-2024-12-15 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_utils 0.12.0-nightly-2024-12-15 (registry+https://github.com/rust-lang/crates.io-index)", "serde", "serde_bare", "serde_json", @@ -931,7 +896,7 @@ dependencies = [ "simple_logger", "strum", "thiserror", - "toml", + "toml 0.8.19", "trait_enum", ] @@ -942,10 +907,10 @@ dependencies = [ "anyhow", "autocfg", "bitvec", - "colored 1.9.4", - "indexical", + "colored", + "indexical 0.6.1", "indexmap", - "itertools 0.12.0", + "itertools 0.12.1", "lazy_static", "log", "paralegal-flow", @@ -966,9 +931,9 @@ dependencies = [ "cfg-if", "dot", "flowistry_pdg", - "indexical", - "internment", - "itertools 0.11.0", + "indexical 0.6.1", + "internment 0.8.6", + "itertools 0.13.0", "log", "petgraph", "serde", @@ -979,9 +944,9 @@ dependencies = [ [[package]] name = "parking_lot" -version = "0.12.1" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" dependencies = [ "lock_api", "parking_lot_core", @@ -989,22 +954,22 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.9" +version = "0.9.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" +checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" dependencies = [ "cfg-if", "libc", "redox_syscall", "smallvec", - "windows-targets 0.48.5", + "windows-targets 0.52.6", ] [[package]] name = "petgraph" -version = "0.6.4" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" +checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" dependencies = [ "fixedbitset", "indexmap", @@ -1014,9 +979,9 @@ dependencies = [ [[package]] name = "pin-project-lite" -version = "0.2.13" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" +checksum = "915a1e146535de9163f3987b8944ed8cf49a18bb0056bcebcdcece385cece4ff" [[package]] name = "pin-utils" @@ -1032,36 +997,38 @@ checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" [[package]] name = "ppv-lite86" -version = "0.2.17" +version = "0.2.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" +dependencies = [ + "zerocopy", +] [[package]] name = "pretty" -version = "0.11.3" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83f3aa1e3ca87d3b124db7461265ac176b40c277f37e503eaa29c9c75c037846" +checksum = "b55c4d17d994b637e2f4daf6e5dc5d660d209d5642377d675d7a1c3ab69fa579" dependencies = [ "arrayvec", - "log", "typed-arena", - "unicode-segmentation", + "unicode-width", ] [[package]] name = "proc-macro2" -version = "1.0.69" +version = "1.0.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" +checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.33" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -1104,18 +1071,18 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.4.1" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +checksum = "03a862b389f93e68874fbf580b9de08dd02facb9a788ebadaf4a3fd33cf58834" dependencies = [ - "bitflags 1.3.2", + "bitflags", ] [[package]] name = "regex" -version = "1.10.4" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" +checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" dependencies = [ "aho-corasick", "memchr", @@ -1125,9 +1092,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.6" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" +checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" dependencies = [ "aho-corasick", "memchr", @@ -1136,34 +1103,34 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.3" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "rustc-demangle" -version = "0.1.23" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" [[package]] name = "rustc_plugin" -version = "0.7.4-nightly-2023-08-25" +version = "0.12.0-nightly-2024-12-15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1348edfa020dbe4807a4d99272332dadcbbedff6b587accb95faefe20d2c7129" -replace = "rustc_plugin 0.7.4-nightly-2023-08-25 (git+https://github.com/JustusAdam/rustc_plugin?rev=e413907b2ae9a03d2c8e9aca3b72dd451a16b1db)" +checksum = "351d0edb6bb7f15aa21d83c29604cdc3bdcec506e12233868b369ee6d3328da3" +replace = "rustc_plugin 0.12.0-nightly-2024-12-15 (git+https://github.com/JustusAdam/rustc_plugin?rev=901641910d536f00f1a6b6b2766778ac0a5bad64)" [[package]] name = "rustc_plugin" -version = "0.7.4-nightly-2023-08-25" -source = "git+https://github.com/JustusAdam/rustc_plugin?rev=e413907b2ae9a03d2c8e9aca3b72dd451a16b1db#e413907b2ae9a03d2c8e9aca3b72dd451a16b1db" +version = "0.12.0-nightly-2024-12-15" +source = "git+https://github.com/JustusAdam/rustc_plugin?rev=901641910d536f00f1a6b6b2766778ac0a5bad64#901641910d536f00f1a6b6b2766778ac0a5bad64" dependencies = [ "cargo_metadata", "log", "rustc_tools_util", "serde", "serde_json", - "toml", + "toml 0.7.8", ] [[package]] @@ -1174,49 +1141,36 @@ checksum = "b3c5a95edfa0c893236ae4778bb7c4752760e4c0d245e19b5eff33c5aa5eb9dc" [[package]] name = "rustc_utils" -version = "0.7.4-nightly-2023-08-25" +version = "0.12.0-nightly-2024-12-15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09428c7086894369685cca54a516acc0f0ab6d0e5a628c094ba83bfddaf1aedf" -replace = "rustc_utils 0.7.4-nightly-2023-08-25 (git+https://github.com/JustusAdam/rustc_plugin?rev=e413907b2ae9a03d2c8e9aca3b72dd451a16b1db)" +checksum = "8a82a375e5df4530b4c5e94ab8251c754c92c3e593efaf8214e572ea422bf3a0" +replace = "rustc_utils 0.12.0-nightly-2024-12-15 (git+https://github.com/JustusAdam/rustc_plugin?rev=901641910d536f00f1a6b6b2766778ac0a5bad64)" [[package]] name = "rustc_utils" -version = "0.7.4-nightly-2023-08-25" -source = "git+https://github.com/JustusAdam/rustc_plugin?rev=e413907b2ae9a03d2c8e9aca3b72dd451a16b1db#e413907b2ae9a03d2c8e9aca3b72dd451a16b1db" +version = "0.12.0-nightly-2024-12-15" +source = "git+https://github.com/JustusAdam/rustc_plugin?rev=901641910d536f00f1a6b6b2766778ac0a5bad64#901641910d536f00f1a6b6b2766778ac0a5bad64" dependencies = [ "anyhow", "cfg-if", - "indexical", + "indexical 0.3.1", "intervaltree", "log", "rand", "textwrap", ] -[[package]] -name = "rustix" -version = "0.38.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b426b0506e5d50a7d8dafcf2e81471400deb602392c7dd110815afb4eaf02a3" -dependencies = [ - "bitflags 2.4.1", - "errno", - "libc", - "linux-raw-sys", - "windows-sys 0.48.0", -] - [[package]] name = "rustversion" -version = "1.0.14" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" +checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248" [[package]] name = "ryu" -version = "1.0.15" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" [[package]] name = "scopeguard" @@ -1226,18 +1180,18 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "semver" -version = "1.0.20" +version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090" +checksum = "3cb6eb87a131f756572d7fb904f6e7b68633f09cca868c5df1c4b8d1a694bbba" dependencies = [ "serde", ] [[package]] name = "serde" -version = "1.0.193" +version = "1.0.216" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89" +checksum = "0b9781016e935a97e8beecf0c933758c97a5520d32930e460142b4cd80c6338e" dependencies = [ "serde_derive", ] @@ -1253,9 +1207,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.193" +version = "1.0.216" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" +checksum = "46f859dbbf73865c6627ed570e78961cd3ac92407a2d117204c49232485da55e" dependencies = [ "proc-macro2", "quote", @@ -1264,20 +1218,21 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.107" +version = "1.0.134" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b420ce6e3d8bd882e9b243c6eed35dbc9a6110c9769e74b584e0d68d1f20c65" +checksum = "d00f4175c42ee48b15416f6193a959ba3a0d67fc699a0db9ad12df9f83991c7d" dependencies = [ "itoa", + "memchr", "ryu", "serde", ] [[package]] name = "serde_spanned" -version = "0.6.4" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12022b835073e5b11e90a14f86838ceb1c8fb0325b72416845c487ac0fa95e80" +checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1" dependencies = [ "serde", ] @@ -1307,17 +1262,22 @@ dependencies = [ "syn", ] +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + [[package]] name = "simple_logger" -version = "2.3.0" +version = "5.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48047e77b528151aaf841a10a9025f9459da80ba820e425ff7eb005708a76dc7" +checksum = "e8c5dfa5e08767553704aa0ffd9d9794d527103c736aba9854773851fd7497eb" dependencies = [ - "atty", - "colored 2.0.4", + "colored", "log", "time", - "winapi", + "windows-sys 0.48.0", ] [[package]] @@ -1331,9 +1291,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.1" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "smawk" @@ -1355,9 +1315,9 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "strsim" -version = "0.10.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "strum" @@ -1374,7 +1334,7 @@ version = "0.25.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0" dependencies = [ - "heck", + "heck 0.4.1", "proc-macro2", "quote", "rustversion", @@ -1383,9 +1343,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.38" +version = "2.0.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b" +checksum = "d53cbcb5a243bd33b7858b1d7f4aca2153490815872d86d955d6ea29f743c035" dependencies = [ "proc-macro2", "quote", @@ -1417,18 +1377,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.50" +version = "2.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" +checksum = "f072643fd0190df67a8bab670c20ef5d8737177d6ac6b2e9a236cb096206b2cc" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.50" +version = "2.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" +checksum = "7b50fa271071aae2e6ee85f842e2e28ba8cd2c5fb67f11fcb1fd70b276f9e7d4" dependencies = [ "proc-macro2", "quote", @@ -1437,13 +1397,14 @@ dependencies = [ [[package]] name = "time" -version = "0.3.30" +version = "0.3.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a34ab300f2dee6e562c10a046fc05e358b29f9bf92277f30c3c8d82275f6f5" +checksum = "35e7868883861bd0e56d9ac6efcaaca0d6d5d82a2a7ec8209ff492c07cf37b21" dependencies = [ "deranged", "itoa", "libc", + "num-conv", "num_threads", "powerfmt", "serde", @@ -1459,10 +1420,11 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.15" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ad70d68dba9e1f8aceda7aa6711965dfec1cac869f311a51bd08b3a2ccbce20" +checksum = "2834e6017e3e5e4b9834939793b282bc03b37a3336245fa820e35e233e2a85de" dependencies = [ + "num-conv", "time-core", ] @@ -1475,14 +1437,26 @@ dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit", + "toml_edit 0.19.15", +] + +[[package]] +name = "toml" +version = "0.8.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit 0.22.22", ] [[package]] name = "toml_datetime" -version = "0.6.5" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" +checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" dependencies = [ "serde", ] @@ -1497,7 +1471,20 @@ dependencies = [ "serde", "serde_spanned", "toml_datetime", - "winnow", + "winnow 0.5.40", +] + +[[package]] +name = "toml_edit" +version = "0.22.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" +dependencies = [ + "indexmap", + "serde", + "serde_spanned", + "toml_datetime", + "winnow 0.6.20", ] [[package]] @@ -1514,9 +1501,9 @@ checksum = "6af6ae20167a9ece4bcb41af5b80f8a1f1df981f6391189ce00fd257af04126a" [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" [[package]] name = "unicode-linebreak" @@ -1524,29 +1511,23 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3b09c83c3c29d37506a3e260c08c03743a6bb66a9cd432c6934ab501a190571f" -[[package]] -name = "unicode-segmentation" -version = "1.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" - [[package]] name = "unicode-width" -version = "0.1.11" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" +checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" [[package]] name = "utf8parse" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "version_check" -version = "0.9.4" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] name = "wasi" @@ -1556,23 +1537,23 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.87" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" +checksum = "a474f6281d1d70c17ae7aa6a613c87fce69a127e2624002df63dcb39d6cf6396" dependencies = [ "cfg-if", + "once_cell", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.87" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" +checksum = "5f89bb38646b4f81674e8f5c3fb81b562be1fd936d84320f3264486418519c79" dependencies = [ "bumpalo", "log", - "once_cell", "proc-macro2", "quote", "syn", @@ -1581,9 +1562,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.87" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" +checksum = "2cc6181fd9a7492eef6fef1f33961e3695e4579b9872a6f7c83aee556666d4fe" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -1591,9 +1572,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.87" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" +checksum = "30d7a95b763d3c45903ed6c81f156801839e5ee968bb07e534c44df0fcd330c2" dependencies = [ "proc-macro2", "quote", @@ -1604,39 +1585,17 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.87" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +checksum = "943aab3fdaaa029a6e0271b35ea10b72b943135afe9bffca82384098ad0e06a6" [[package]] name = "windows-core" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64" +checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" dependencies = [ - "windows-targets 0.48.5", + "windows-targets 0.52.6", ] [[package]] @@ -1650,11 +1609,11 @@ dependencies = [ [[package]] name = "windows-sys" -version = "0.52.0" +version = "0.59.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" dependencies = [ - "windows-targets 0.52.5", + "windows-targets 0.52.6", ] [[package]] @@ -1674,18 +1633,18 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows_aarch64_gnullvm 0.52.5", - "windows_aarch64_msvc 0.52.5", - "windows_i686_gnu 0.52.5", + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", "windows_i686_gnullvm", - "windows_i686_msvc 0.52.5", - "windows_x86_64_gnu 0.52.5", - "windows_x86_64_gnullvm 0.52.5", - "windows_x86_64_msvc 0.52.5", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", ] [[package]] @@ -1696,9 +1655,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" [[package]] name = "windows_aarch64_msvc" @@ -1708,9 +1667,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_aarch64_msvc" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" [[package]] name = "windows_i686_gnu" @@ -1720,15 +1679,15 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_gnu" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" [[package]] name = "windows_i686_gnullvm" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" [[package]] name = "windows_i686_msvc" @@ -1738,9 +1697,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_i686_msvc" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" [[package]] name = "windows_x86_64_gnu" @@ -1750,9 +1709,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnu" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" [[package]] name = "windows_x86_64_gnullvm" @@ -1762,9 +1721,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" [[package]] name = "windows_x86_64_msvc" @@ -1774,15 +1733,24 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "windows_x86_64_msvc" -version = "0.52.5" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "winnow" +version = "0.5.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" +checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" +dependencies = [ + "memchr", +] [[package]] name = "winnow" -version = "0.5.17" +version = "0.6.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3b801d0e0a6726477cc207f60162da452f3a95adb368399bef20a946e06f65c" +checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" dependencies = [ "memchr", ] @@ -1795,3 +1763,24 @@ checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" dependencies = [ "tap", ] + +[[package]] +name = "zerocopy" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +dependencies = [ + "byteorder", + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] diff --git a/Cargo.toml b/Cargo.toml index 7b57d72319..dd5039e7ef 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,22 +9,21 @@ exclude = [ resolver = "2" [workspace.dependencies] -indexical = "0.3.1" -serde = "1.0.188" +indexical = "0.6.1" +serde = "1.0.216" petgraph = { version = "0.6", features = ["serde-1"] } strum = { version = "0.25", features = ["derive"] } anyhow = { version = "1.0.72", features = ["backtrace"] } -rustc_utils = { version = "=0.7.4-nightly-2023-08-25", features = [ +rustc_utils = { version = "=0.12.0-nightly-2024-12-15", features = [ "indexical", ] } -rustc_plugin = "=0.7.4-nightly-2023-08-25" -#flowistry = { path = "../flowistry/crates/flowistry", default-features = false } +rustc_plugin = "=0.12.0-nightly-2024-12-15" [workspace.dependencies.flowistry] # path = "../flowistry/crates/flowistry" git = "https://github.com/brownsys/flowistry" -rev = "57627ed24802cb76c745118bbc46f83f402a1e88" +rev = "f271637d65a21a2785b87ef52ede8bdeb560948c" default-features = false @@ -32,12 +31,12 @@ default-features = false debug = true -[replace."rustc_utils:0.7.4-nightly-2023-08-25"] +[replace."rustc_utils:0.12.0-nightly-2024-12-15"] # path = "../rustc_plugin/crates/rustc_utils" git = "https://github.com/JustusAdam/rustc_plugin" -rev = "e413907b2ae9a03d2c8e9aca3b72dd451a16b1db" +rev = "901641910d536f00f1a6b6b2766778ac0a5bad64" -[replace."rustc_plugin:0.7.4-nightly-2023-08-25"] +[replace."rustc_plugin:0.12.0-nightly-2024-12-15"] # path = "../rustc_plugin/crates/rustc_plugin" git = "https://github.com/JustusAdam/rustc_plugin" -rev = "e413907b2ae9a03d2c8e9aca3b72dd451a16b1db" +rev = "901641910d536f00f1a6b6b2766778ac0a5bad64" diff --git a/Makefile.toml b/Makefile.toml index 905c0ed142..ce502ec48a 100644 --- a/Makefile.toml +++ b/Makefile.toml @@ -132,7 +132,7 @@ description = """\ This is bit ugly, because we want to reuse this tasks - In different directories (controlled by the `FORMAT_WD` env variable) -- With different base comamnds (`cargo clippy` vs `cargo fmt`) +- With different base commands (`cargo clippy` vs `cargo fmt`) - With different goals (check vs fix) The last two are both done via the `FORMAT_ARGS` command. @@ -175,6 +175,16 @@ run_task = "format-base" [tasks.format-tests] private = true condition = { env_set = ["INCLUDE_TESTS"] } +env = { COMMAND = "cargo", COMMAND_ARGS = "${FORMAT_ARGS}" } +run_task = "run-for-tests" + +[tasks.clean-tests] +env = { COMMAND = "cargo", COMMAND_ARGS = "clean" } +run_task = "run-for-tests" + +[tasks.run-for-tests] +private = true +description = "A basic helper that lets you run a COMMAND with COMMAND_ARGS for each crate we use for tests" script_runner = "@duckscript" script = ''' wd = pwd @@ -184,12 +194,12 @@ for dir in ${test_dirs} cargo_toml_path = concat ${dir} /Cargo.toml if is_path_exists ${cargo_toml_path} cd ${dir} - exec --fail-on-error cargo %{FORMAT_ARGS} + exec --fail-on-error %{COMMAND} %{COMMAND_ARGS} cd ${wd} end end cd crates/paralegal-policy/tests/test-crate -exec cargo %{FORMAT_ARGS} +exec --fail-on-error %{COMMAND} %{COMMAND_ARGS} ''' [tasks.populate-doc-dir] diff --git a/crates/flowistry_pdg_construction/Cargo.toml b/crates/flowistry_pdg_construction/Cargo.toml index a5320feb31..be35652285 100644 --- a/crates/flowistry_pdg_construction/Cargo.toml +++ b/crates/flowistry_pdg_construction/Cargo.toml @@ -15,9 +15,9 @@ fluid-let = "1.0" cfg-if = "1.0" rustc_utils = { workspace = true, features = ["indexical"] } indexical = { workspace = true } -itertools = "0.12.0" +itertools = "0.13.0" petgraph = { version = "0.6.4" } -internment = { version = "0.7.4" } +internment = { version = "0.8.6" } flowistry_pdg = { version = "0.1.0", path = "../flowistry_pdg", features = [ "rustc", ] } @@ -25,6 +25,7 @@ flowistry_pdg = { version = "0.1.0", path = "../flowistry_pdg", features = [ flowistry = { workspace = true } serde = { workspace = true, features = ["derive"] } strum = { workspace = true } +#rustc-hash = { version = "=2.1.0" } [dev-dependencies] rustc_utils = { workspace = true, features = ["indexical", "test"] } diff --git a/crates/flowistry_pdg_construction/src/approximation.rs b/crates/flowistry_pdg_construction/src/approximation.rs index 4fda090bc1..afaa1c49b6 100644 --- a/crates/flowistry_pdg_construction/src/approximation.rs +++ b/crates/flowistry_pdg_construction/src/approximation.rs @@ -5,14 +5,14 @@ use rustc_abi::VariantIdx; use rustc_hir::def_id::DefId; use rustc_index::IndexVec; use rustc_middle::{ - mir::{visit::Visitor, AggregateKind, Location, Operand, Place, Rvalue}, + mir::{visit::Visitor, AggregateKind, Location, Place, Rvalue}, ty::TyKind, }; -use crate::local_analysis::LocalAnalysis; +use crate::{local_analysis::LocalAnalysis, utils::ArgSlice}; pub(crate) type ApproximationHandler<'tcx, 'a> = - fn(&LocalAnalysis<'tcx, 'a>, &mut dyn Visitor<'tcx>, &[Operand<'tcx>], Place<'tcx>, Location); + fn(&LocalAnalysis<'tcx, 'a>, &mut dyn Visitor<'tcx>, ArgSlice<'a, 'tcx>, Place<'tcx>, Location); impl<'tcx, 'a> LocalAnalysis<'tcx, 'a> { /// Special case behavior for calls to functions used in desugaring async functions. @@ -38,7 +38,7 @@ impl<'tcx, 'a> LocalAnalysis<'tcx, 'a> { fn approximate_into_future( &self, vis: &mut dyn Visitor<'tcx>, - args: &[Operand<'tcx>], + args: ArgSlice<'_, 'tcx>, destination: Place<'tcx>, location: Location, ) { @@ -46,13 +46,13 @@ impl<'tcx, 'a> LocalAnalysis<'tcx, 'a> { let [op] = args else { unreachable!(); }; - vis.visit_assign(&destination, &Rvalue::Use(op.clone()), location); + vis.visit_assign(&destination, &Rvalue::Use(op.node.clone()), location); } fn approximate_new_unchecked( &self, vis: &mut dyn Visitor<'tcx>, - args: &[Operand<'tcx>], + args: ArgSlice<'_, 'tcx>, destination: Place<'tcx>, location: Location, ) { @@ -61,7 +61,7 @@ impl<'tcx, 'a> LocalAnalysis<'tcx, 'a> { unreachable!(); }; let mut operands = IndexVec::new(); - operands.push(op.clone()); + operands.push(op.node.clone()); let TyKind::Adt(adt_id, generics) = destination.ty(&self.mono_body, self.tcx()).ty.kind() else { unreachable!() diff --git a/crates/flowistry_pdg_construction/src/async_support.rs b/crates/flowistry_pdg_construction/src/async_support.rs index a639839b51..ffbd4de72a 100644 --- a/crates/flowistry_pdg_construction/src/async_support.rs +++ b/crates/flowistry_pdg_construction/src/async_support.rs @@ -12,7 +12,7 @@ use rustc_middle::{ ty::{GenericArgsRef, Instance, TyCtxt}, }; -use crate::utils::is_async; +use crate::utils::{is_async, ArgSlice}; use super::{ local_analysis::{CallKind, LocalAnalysis}, @@ -98,7 +98,7 @@ pub fn match_async_trait_assign<'tcx>( match &statement.kind { StatementKind::Assign(box ( _, - Rvalue::Aggregate(box AggregateKind::Generator(def_id, generic_args, _), _args), + Rvalue::Aggregate(box AggregateKind::Coroutine(def_id, generic_args), _args), )) => Some((*def_id, *generic_args)), _ => None, } @@ -112,7 +112,7 @@ pub fn is_async_trait_fn(tcx: TyCtxt, def_id: DefId, body: &Body<'_>) -> bool { fn has_async_trait_signature(tcx: TyCtxt, def_id: DefId) -> bool { if let Some(assoc_item) = tcx.opt_associated_item(def_id) { let sig = tcx.fn_sig(def_id).skip_binder(); - assoc_item.container == ty::AssocItemContainer::ImplContainer + assoc_item.container == ty::AssocItemContainer::Impl && assoc_item.trait_item_def_id.is_some() && match_pin_box_dyn_ty(tcx.lang_items(), sig.output().skip_binder()) } else { @@ -132,10 +132,10 @@ fn match_pin_box_dyn_ty(lang_items: &rustc_hir::LanguageItems, t: ty::Ty) -> boo let Some(t_a) = arg.as_type() else { return false; }; - if !t_a.is_box() { + let Some(box_t) = t_a.boxed_ty() else { return false; }; - let ty::TyKind::Dynamic(pred, _, ty::DynKind::Dyn) = t_a.boxed_ty().kind() else { + let ty::TyKind::Dynamic(pred, _, ty::DynKind::Dyn) = box_t.kind() else { return false; }; pred.iter().any(|p| { @@ -157,7 +157,7 @@ fn get_async_generator<'tcx>(body: &Body<'tcx>) -> (DefId, GenericArgsRef<'tcx>, .expect_left("Async fn should have a statement"); let StatementKind::Assign(box ( _, - Rvalue::Aggregate(box AggregateKind::Generator(def_id, generic_args, _), _args), + Rvalue::Aggregate(box AggregateKind::Coroutine(def_id, generic_args), _args), )) = &stmt.kind else { panic!("Async fn should assign to a generator") @@ -183,8 +183,8 @@ pub fn determine_async<'tcx>( AsyncType::Trait, ) }; - let param_env = tcx.param_env_reveal_all_normalized(def_id); - let generator_fn = utils::try_resolve_function(tcx, generator_def_id, param_env, args)?; + let typing_env = body.typing_env(tcx).with_post_analysis_normalized(tcx); + let generator_fn = utils::try_resolve_function(tcx, generator_def_id, typing_env, args)?; Some((generator_fn, loc, asyncness)) } @@ -201,10 +201,10 @@ fn is_async_fn_or_block(tcx: TyCtxt, instance: Instance) -> bool { // impl for an `async fn` or async block is the same as the `DefId` of the // generator itself. That means after resolution (e.g. on the `Instance`) we // only need to call `tcx.generator_is_async`. - tcx.generator_is_async(instance.def_id()) + tcx.coroutine_is_async(instance.def_id()) } -impl<'tcx, 'mir> LocalAnalysis<'tcx, 'mir> { +impl<'tcx> LocalAnalysis<'tcx, '_> { /// Checks whether the function call, described by the unresolved `def_id` /// and the resolved instance `resolved_fn` is a call to [`::poll`](std::future::Future::poll) where `T` is the type of an @@ -215,7 +215,7 @@ impl<'tcx, 'mir> LocalAnalysis<'tcx, 'mir> { &'a self, def_id: DefId, resolved_fn: Instance<'tcx>, - original_args: &'a [Operand<'tcx>], + original_args: ArgSlice<'a, 'tcx>, ) -> AsyncDeterminationResult> { let lang_items = self.tcx().lang_items(); if lang_items.future_poll_fn() == Some(def_id) @@ -233,7 +233,7 @@ impl<'tcx, 'mir> LocalAnalysis<'tcx, 'mir> { /// body to find the original future being polled, and get the arguments to the future. fn find_async_args<'a>( &'a self, - args: &'a [Operand<'tcx>], + args: ArgSlice<'a, 'tcx>, ) -> Result, String> { macro_rules! let_assert { ($p:pat = $e:expr, $($arg:tt)*) => { @@ -270,13 +270,16 @@ impl<'tcx, 'mir> LocalAnalysis<'tcx, 'mir> { .. }, .. - }) = &self.mono_body.stmt_at(get_def_for_op(&args[0])?), + }) = &self.mono_body.stmt_at(get_def_for_op(&args[0].node)?), "Pinned assignment is not a call" ); debug_assert!(new_pin_args.len() == 1); let future_aliases = self - .aliases(self.tcx().mk_place_deref(new_pin_args[0].place().unwrap())) + .aliases( + self.tcx() + .mk_place_deref(new_pin_args[0].node.place().unwrap()), + ) .collect_vec(); debug_assert!(future_aliases.len() == 1); let future = *future_aliases.first().unwrap(); @@ -301,7 +304,7 @@ impl<'tcx, 'mir> LocalAnalysis<'tcx, 'mir> { ); let target = &into_future_args[0]; - let creation_loc = get_def_for_op(target)?; + let creation_loc = get_def_for_op(&target.node)?; let stmt = &self.mono_body.stmt_at(creation_loc); let (op, generics, generator_data) = match stmt { Either::Right(Terminator { @@ -317,9 +320,9 @@ impl<'tcx, 'mir> LocalAnalysis<'tcx, 'mir> { Either::Left(Statement { kind, .. }) => match kind { StatementKind::Assign(box ( lhs, - Rvalue::Aggregate(box AggregateKind::Generator(def_id, generic_args, _), _args), + Rvalue::Aggregate(box AggregateKind::Coroutine(def_id, generic_args), _args), )) => { - assert!(self.tcx().generator_is_async(*def_id)); + assert!(self.tcx().coroutine_is_async(*def_id)); (None, *generic_args, *lhs) } StatementKind::Assign(box (_, Rvalue::Use(target))) => { @@ -343,7 +346,9 @@ impl<'tcx, 'mir> LocalAnalysis<'tcx, 'mir> { utils::try_resolve_function( self.tcx(), def_id, - self.tcx().param_env_reveal_all_normalized(self.def_id), + self.mono_body + .typing_env(self.tcx()) + .with_post_analysis_normalized(self.tcx()), generics, ) .ok_or_else(|| "Instance resolution failed".to_string()) diff --git a/crates/flowistry_pdg_construction/src/body_cache.rs b/crates/flowistry_pdg_construction/src/body_cache.rs index bff59cb0ba..e533d37dc5 100644 --- a/crates/flowistry_pdg_construction/src/body_cache.rs +++ b/crates/flowistry_pdg_construction/src/body_cache.rs @@ -20,6 +20,7 @@ use rustc_middle::{ ty::TyCtxt, }; +use rustc_type_ir::RegionVid; use rustc_utils::cache::Cache; use crate::encoder::{decode_from_file, encode_to_file}; @@ -41,7 +42,7 @@ impl<'tcx> CachedBody<'tcx> { let mut body_with_facts = rustc_borrowck::consumers::get_body_with_borrowck_facts( tcx, local_def_id, - ConsumerOptions::RegionInferenceContext, + ConsumerOptions::PoloniusInputFacts, ); clean_undecodable_data_from_body(&mut body_with_facts.body); @@ -50,9 +51,11 @@ impl<'tcx> CachedBody<'tcx> { body: body_with_facts.body, input_facts: FlowistryFacts { subset_base: body_with_facts - .region_inference_context - .outlives_constraints() - .map(|constraint| (constraint.sup, constraint.sub)) + .input_facts + .expect("polonius input must exist") + .subset_base + .iter() + .map(|&(v1, v2, _)| (v1.into(), v2.into())) .collect(), }, } @@ -64,16 +67,7 @@ impl<'tcx> FlowistryInput<'tcx, 'tcx> for &'tcx CachedBody<'tcx> { &self.body } - fn input_facts_subset_base( - self, - ) -> Box< - dyn Iterator< - Item = ( - ::Origin, - ::Origin, - ), - > + 'tcx, - > { + fn input_facts_subset_base(self) -> Box + 'tcx> { Box::new(self.input_facts.subset_base.iter().copied()) } } @@ -82,10 +76,7 @@ impl<'tcx> FlowistryInput<'tcx, 'tcx> for &'tcx CachedBody<'tcx> { /// needs. #[derive(Debug, Encodable, Decodable)] pub struct FlowistryFacts { - pub subset_base: Vec<( - ::Origin, - ::Origin, - )>, + pub subset_base: Vec<(RegionVid, RegionVid)>, } pub type LocationIndex = ::Point; @@ -122,7 +113,7 @@ impl<'tcx> BodyCache<'tcx> { /// Returns `None` if the policy forbids loading from this crate. pub fn get(&self, key: DefId) -> &'tcx CachedBody<'tcx> { let body = if let Some(local) = key.as_local() { - self.local_cache.get(local.local_def_index, |_| { + self.local_cache.get(&local.local_def_index, |_| { let start = Instant::now(); let res = CachedBody::retrieve(self.tcx, local); *self.timer.borrow_mut() += start.elapsed(); @@ -130,7 +121,7 @@ impl<'tcx> BodyCache<'tcx> { }) } else { self.cache - .get(key.krate, |_| load_body_and_facts(self.tcx, key.krate)) + .get(&key.krate, |_| load_body_and_facts(self.tcx, key.krate)) .get(&key.index) .expect("Invariant broken, body for this is should exist") }; diff --git a/crates/flowistry_pdg_construction/src/callback.rs b/crates/flowistry_pdg_construction/src/callback.rs index 11a868bbf1..db70265665 100644 --- a/crates/flowistry_pdg_construction/src/callback.rs +++ b/crates/flowistry_pdg_construction/src/callback.rs @@ -3,12 +3,12 @@ use flowistry_pdg::{rustc_portable::Location, CallString}; use rustc_middle::{ - mir::{self, Operand}, - ty::{Instance, ParamEnv}, + mir, + ty::{Instance, TypingEnv}, }; use rustc_span::Span; -use crate::calling_convention::CallingConvention; +use crate::{calling_convention::CallingConvention, utils::ArgSlice}; pub trait CallChangeCallback<'tcx> { fn on_inline(&self, info: CallInfo<'tcx, '_>) -> CallChanges<'tcx>; @@ -16,7 +16,7 @@ pub trait CallChangeCallback<'tcx> { fn on_inline_miss( &self, _resolution: Instance<'tcx>, - _param_env: ParamEnv<'tcx>, + _param_env: TypingEnv<'tcx>, _loc: Location, _under_analysis: Instance<'tcx>, _reason: InlineMissReason, @@ -47,7 +47,7 @@ pub enum InlineMissReason { TraitMethod, } -impl<'tcx> Default for CallChanges<'tcx> { +impl Default for CallChanges<'_> { fn default() -> Self { CallChanges { skip: SkipCall::NoSkip, @@ -72,10 +72,10 @@ pub struct CallInfo<'tcx, 'mir> { pub span: Span, - pub arguments: &'mir [Operand<'tcx>], + pub arguments: ArgSlice<'mir, 'tcx>, pub caller_body: &'mir mir::Body<'tcx>, - pub param_env: ParamEnv<'tcx>, + pub param_env: TypingEnv<'tcx>, } /// User-provided changes to the default PDG construction behavior for function calls. diff --git a/crates/flowistry_pdg_construction/src/calling_convention.rs b/crates/flowistry_pdg_construction/src/calling_convention.rs index db1b17cbbb..32112dd0af 100644 --- a/crates/flowistry_pdg_construction/src/calling_convention.rs +++ b/crates/flowistry_pdg_construction/src/calling_convention.rs @@ -8,6 +8,7 @@ use rustc_middle::{ mir::{Body, HasLocalDecls, Operand, Place, PlaceElem, RETURN_PLACE}, ty::TyCtxt, }; +use rustc_span::source_map::Spanned; use crate::{ async_support::AsyncInfo, @@ -20,14 +21,14 @@ use crate::{ #[derive(Debug)] pub enum CallingConvention<'tcx> { /// 1 to 1 mapping - Direct(Box<[Operand<'tcx>]>), + Direct(Box<[Spanned>]>), /// First argument is the closed-over environment, second argument is a /// tuple that contains the actual argument to the call of the closure /// function. Indirect { shim: Option, - closure_arg: Operand<'tcx>, - tupled_arguments: Operand<'tcx>, + closure_arg: Spanned>, + tupled_arguments: Spanned>, }, /// An async generator, only has one argument which is the generator state. Async(Place<'tcx>), @@ -47,7 +48,7 @@ pub struct PlaceTranslation<'a, 'tcx> { scope: &'a PlaceTranslator<'a, 'tcx>, } -impl<'a, 'tcx> PlaceTranslation<'a, 'tcx> { +impl<'tcx> PlaceTranslation<'_, 'tcx> { /// Complete the translation and return a precise parent place. pub fn make_translated_place(&self) -> Place<'tcx> { let base_place_projected = self @@ -71,7 +72,7 @@ impl<'a, 'tcx> PlaceTranslation<'a, 'tcx> { impl<'tcx> CallingConvention<'tcx> { pub fn from_call_kind( kind: &CallKind<'tcx>, - args: Cow<'_, [Operand<'tcx>]>, + args: Cow<'_, [Spanned>]>, ) -> CallingConvention<'tcx> { match kind { CallKind::AsyncPoll(poll) => CallingConvention::Async(poll.generator_data), @@ -174,7 +175,7 @@ impl<'a, 'tcx> PlaceTranslator<'a, 'tcx> { _ if child.local == RETURN_PLACE => (self.destination, &child.projection[..]), // Map arguments to the argument array CallingConvention::Direct(args) => ( - args[child.local.as_usize() - 1].place()?, + args[child.local.as_usize() - 1].node.place()?, &child.projection[..], ), // Map arguments to projections of the future, the poll's first argument @@ -225,9 +226,9 @@ impl<'a, 'tcx> PlaceTranslator<'a, 'tcx> { } else { 0 }; - (closure_arg.place()?, &child.projection[next_idx..]) + (closure_arg.node.place()?, &child.projection[next_idx..]) } else { - let tuple_arg = tupled_arguments.place()?; + let tuple_arg = tupled_arguments.node.place()?; let _projection = child.projection.to_vec(); let field = FieldIdx::from_usize(local.as_usize() - 2); let field_ty = tuple_arg diff --git a/crates/flowistry_pdg_construction/src/construct.rs b/crates/flowistry_pdg_construction/src/construct.rs index b6986e6cc7..67e37b1f38 100644 --- a/crates/flowistry_pdg_construction/src/construct.rs +++ b/crates/flowistry_pdg_construction/src/construct.rs @@ -7,15 +7,15 @@ use petgraph::graph::DiGraph; use flowistry_pdg::{CallString, GlobalLocation}; -use df::{AnalysisDomain, Results, ResultsVisitor}; +use df::{Results, ResultsVisitor}; use rustc_hash::FxHashMap; use rustc_hir::def_id::{DefId, LocalDefId}; use rustc_index::IndexVec; use rustc_middle::{ mir::{visit::Visitor, AggregateKind, Location, Place, Rvalue, Terminator, TerminatorKind}, - ty::{Instance, TyCtxt}, + ty::{Instance, TyCtxt, TypingEnv}, }; -use rustc_mir_dataflow::{self as df}; +use rustc_mir_dataflow as df; use rustc_utils::cache::Cache; @@ -95,7 +95,7 @@ impl<'tcx> MemoPdgConstructor<'tcx> { let resolution = try_resolve_function( self.tcx, function.to_def_id(), - self.tcx.param_env_reveal_all_normalized(function), + TypingEnv::post_analysis(self.tcx, function.to_def_id()), generics, ) .unwrap(); @@ -111,7 +111,7 @@ impl<'tcx> MemoPdgConstructor<'tcx> { &'a self, resolution: Instance<'tcx>, ) -> Option<&'a PartialGraph<'tcx>> { - self.pdg_cache.get_maybe_recursive(resolution, |_| { + self.pdg_cache.get_maybe_recursive(&resolution, |_| { let g = LocalAnalysis::new(self, resolution).construct_partial(); trace!("Computed new for {resolution:?}"); g.check_invariants(); @@ -172,15 +172,13 @@ impl<'tcx> MemoPdgConstructor<'tcx> { type LocalAnalysisResults<'tcx, 'mir> = Results<'tcx, &'mir LocalAnalysis<'tcx, 'mir>>; -impl<'mir, 'tcx> ResultsVisitor<'mir, 'tcx, LocalAnalysisResults<'tcx, 'mir>> +impl<'mir, 'tcx> ResultsVisitor<'mir, 'tcx, &'mir LocalAnalysis<'tcx, 'mir>> for PartialGraph<'tcx> { - type FlowState = <&'mir LocalAnalysis<'tcx, 'mir> as AnalysisDomain<'tcx>>::Domain; - - fn visit_statement_before_primary_effect( + fn visit_after_early_statement_effect( &mut self, - results: &LocalAnalysisResults<'tcx, 'mir>, - state: &Self::FlowState, + results: &mut LocalAnalysisResults<'tcx, 'mir>, + state: &InstructionState<'tcx>, statement: &'mir rustc_middle::mir::Statement<'tcx>, location: Location, ) { @@ -205,10 +203,10 @@ impl<'mir, 'tcx> ResultsVisitor<'mir, 'tcx, LocalAnalysisResults<'tcx, 'mir>> /// with the reachable places yet. So this ordering means we can reuse the /// same logic but just have to run it twice for every non-inlined function /// call site. - fn visit_terminator_before_primary_effect( + fn visit_after_early_terminator_effect( &mut self, - results: &LocalAnalysisResults<'tcx, 'mir>, - state: &Self::FlowState, + results: &mut LocalAnalysisResults<'tcx, 'mir>, + state: &InstructionState<'tcx>, terminator: &'mir rustc_middle::mir::Terminator<'tcx>, location: Location, ) { @@ -249,10 +247,10 @@ impl<'mir, 'tcx> ResultsVisitor<'mir, 'tcx, LocalAnalysisResults<'tcx, 'mir>> arg_vis.visit_terminator(terminator, location); } - fn visit_terminator_after_primary_effect( + fn visit_after_primary_terminator_effect( &mut self, - results: &LocalAnalysisResults<'tcx, 'mir>, - state: &Self::FlowState, + results: &mut LocalAnalysisResults<'tcx, 'mir>, + state: &InstructionState<'tcx>, terminator: &'mir rustc_middle::mir::Terminator<'tcx>, location: Location, ) { @@ -296,7 +294,8 @@ impl<'tcx> PartialGraph<'tcx> { &'a mut self, results: &'a LocalAnalysisResults<'tcx, 'mir>, state: &'a InstructionState<'tcx>, - ) -> ModularMutationVisitor<'a, 'tcx, impl FnMut(Location, Mutation<'tcx>) + 'a> { + ) -> ModularMutationVisitor<'a, 'tcx, impl FnMut(Location, Mutation<'tcx>) + use<'a, 'tcx, 'mir>> + { ModularMutationVisitor::new(&results.analysis.place_info, move |location, mutation| { self.register_mutation( results, @@ -315,7 +314,7 @@ impl<'tcx> PartialGraph<'tcx> { fn handle_as_inline<'a>( &mut self, results: &LocalAnalysisResults<'tcx, 'a>, - state: &'a InstructionState<'tcx>, + state: &InstructionState<'tcx>, terminator: &Terminator<'tcx>, location: Location, ) -> bool { @@ -353,7 +352,7 @@ impl<'tcx> PartialGraph<'tcx> { // Register a synthetic assignment of `future = (arg0, arg1, ...)`. let rvalue = Rvalue::Aggregate( Box::new(AggregateKind::Tuple), - IndexVec::from_iter(args.iter().cloned()), + IndexVec::from_iter(args.iter().map(|op| op.node.clone())), ); self.modular_mutation_visitor(results, state).visit_assign( destination, diff --git a/crates/flowistry_pdg_construction/src/encoder.rs b/crates/flowistry_pdg_construction/src/encoder.rs index c270ab88f1..836230e54d 100644 --- a/crates/flowistry_pdg_construction/src/encoder.rs +++ b/crates/flowistry_pdg_construction/src/encoder.rs @@ -12,32 +12,28 @@ //! replying on `CrateMetadataRef`, which we can construct but not use (relevant //! functions are hidden). //! -//! The encoding of [`SpanData`] (and thus [`Span`]) is quite heavyweight. We -//! store the full filename for each span and resolve them with a linear scan -//! over the `SourceMap`. If we notice this being too slow we can always use a -//! similar shorthand technique that is used for types. -//! //! Note that we encode `AllocId`s simply as themselves. This is possibly //! incorrect but we're not really relying on this information at the moment so //! we are not investing in it. use std::fs::File; use std::io::{self, Read}; use std::path::Path; -use std::rc::Rc; +use std::sync::Arc; use std::{num::NonZeroU64, path::PathBuf}; use rustc_const_eval::interpret::AllocId; -use rustc_hash::FxHashMap; -use rustc_hir::def_id::{CrateNum, DefIndex}; +use rustc_data_structures::fx::FxHashMap; +use rustc_hir::def_id::{CrateNum, DefId, DefIndex}; use rustc_middle::ty::{self, Ty, TyCtxt}; use rustc_serialize::{ opaque::{FileEncoder, MemDecoder}, Decodable, Decoder, Encodable, Encoder, }; use rustc_span::{ - BytePos, FileName, RealFileName, SourceFile, Span, SpanData, SyntaxContext, DUMMY_SP, + AttrId, BytePos, ExpnId, FileName, RealFileName, SourceFile, Span, SpanData, SpanDecoder, + SpanEncoder, Symbol, SyntaxContext, DUMMY_SP, }; -use rustc_type_ir::{TyDecoder, TyEncoder}; +use rustc_type_ir::{PredicateKind, TyDecoder, TyEncoder}; macro_rules! encoder_methods { ($($name:ident($ty:ty);)*) => { @@ -68,7 +64,7 @@ impl<'tcx> ParalegalEncoder<'tcx> { } } - pub fn finish(self) { + pub fn finish(mut self) { self.file_encoder.finish().unwrap(); } } @@ -87,7 +83,7 @@ pub fn encode_to_file<'tcx, V: Encodable>>( /// Whatever can't survive the crossing we need to live without. const CLEAR_CROSS_CRATE: bool = true; -impl<'tcx> Encoder for ParalegalEncoder<'tcx> { +impl Encoder for ParalegalEncoder<'_> { encoder_methods! { emit_usize(usize); emit_u128(u128); @@ -120,9 +116,7 @@ impl<'tcx> TyEncoder for ParalegalEncoder<'tcx> { &mut self.type_shorthands } - fn predicate_shorthands( - &mut self, - ) -> &mut FxHashMap<::PredicateKind, usize> { + fn predicate_shorthands(&mut self) -> &mut FxHashMap, usize> { &mut self.predicate_shorthands } @@ -131,18 +125,12 @@ impl<'tcx> TyEncoder for ParalegalEncoder<'tcx> { } } -impl<'tcx> Encodable> for CrateNum { - fn encode(&self, s: &mut ParalegalEncoder<'tcx>) { - s.tcx.stable_crate_id(*self).encode(s) - } -} - /// Something that implements `TyDecoder`. pub struct ParalegalDecoder<'tcx, 'a> { tcx: TyCtxt<'tcx>, mem_decoder: MemDecoder<'a>, shorthand_map: FxHashMap>, - file_shorthands: FxHashMap>, + file_shorthands: FxHashMap>, } impl<'tcx, 'a> ParalegalDecoder<'tcx, 'a> { @@ -150,7 +138,7 @@ impl<'tcx, 'a> ParalegalDecoder<'tcx, 'a> { pub fn new(tcx: TyCtxt<'tcx>, buf: &'a [u8]) -> Self { Self { tcx, - mem_decoder: MemDecoder::new(buf, 0), + mem_decoder: MemDecoder::new(buf, 0).unwrap(), shorthand_map: Default::default(), file_shorthands: Default::default(), } @@ -169,7 +157,7 @@ pub fn decode_from_file<'tcx, V: for<'a> Decodable>>( Ok(V::decode(&mut decoder)) } -impl<'tcx, 'a> TyDecoder for ParalegalDecoder<'tcx, 'a> { +impl<'tcx> TyDecoder for ParalegalDecoder<'tcx, '_> { const CLEAR_CROSS_CRATE: bool = CLEAR_CROSS_CRATE; type I = TyCtxt<'tcx>; @@ -202,7 +190,9 @@ impl<'tcx, 'a> TyDecoder for ParalegalDecoder<'tcx, 'a> { where F: FnOnce(&mut Self) -> R, { - let new_opaque = MemDecoder::new(self.mem_decoder.data(), pos); + debug_assert!(pos < self.mem_decoder.len()); + + let new_opaque = self.mem_decoder.split_at(pos); let old_opaque = std::mem::replace(&mut self.mem_decoder, new_opaque); let r = f(self); self.mem_decoder = old_opaque; @@ -218,7 +208,7 @@ macro_rules! decoder_methods { } } -impl<'tcx, 'a> Decoder for ParalegalDecoder<'tcx, 'a> { +impl Decoder for ParalegalDecoder<'_, '_> { decoder_methods! { read_usize(usize); read_u128(u128); @@ -243,34 +233,69 @@ impl<'tcx, 'a> Decoder for ParalegalDecoder<'tcx, 'a> { } } -impl<'tcx, 'a> Decodable> for CrateNum { - fn decode(d: &mut ParalegalDecoder<'tcx, 'a>) -> Self { - d.tcx.stable_crate_id_to_crate_num(Decodable::decode(d)) +impl SpanDecoder for ParalegalDecoder<'_, '_> { + fn decode_crate_num(&mut self) -> CrateNum { + self.tcx + .stable_crate_id_to_crate_num(Decodable::decode(self)) + } + fn decode_def_index(&mut self) -> DefIndex { + DefIndex::from_u32(u32::decode(self)) + } + fn decode_span(&mut self) -> Span { + SpanData::decode(self).span() } -} -impl<'tcx> Encodable> for DefIndex { - fn encode(&self, s: &mut ParalegalEncoder<'tcx>) { - self.as_u32().encode(s) + fn decode_syntax_context(&mut self) -> SyntaxContext { + SyntaxContext::root() } -} -impl<'tcx, 'a> Decodable> for DefIndex { - fn decode(d: &mut ParalegalDecoder<'tcx, 'a>) -> Self { - Self::from_u32(u32::decode(d)) + fn decode_def_id(&mut self) -> DefId { + DefId { + krate: self.decode_crate_num(), + index: self.decode_def_index(), + } + } + + fn decode_expn_id(&mut self) -> ExpnId { + unimplemented!() + } + + fn decode_symbol(&mut self) -> Symbol { + Symbol::intern(&String::decode(self)) + } + + fn decode_attr_id(&mut self) -> AttrId { + unimplemented!() } } -const TAG_PARTIAL_SPAN: u8 = 0; -const TAG_VALID_SPAN_FULL: u8 = 1; +impl SpanEncoder for ParalegalEncoder<'_> { + fn encode_def_index(&mut self, def_index: DefIndex) { + def_index.as_u32().encode(self) + } + fn encode_span(&mut self, span: Span) { + span.data().encode(self) + } + fn encode_syntax_context(&mut self, _syntax_context: SyntaxContext) {} -/// We need to overwrite this, because we need it to dispatch to `SpanData`. -impl<'tcx> Encodable> for Span { - fn encode(&self, s: &mut ParalegalEncoder<'tcx>) { - self.data().encode(s) + fn encode_crate_num(&mut self, crate_num: CrateNum) { + self.tcx.stable_crate_id(crate_num).encode(self) + } + fn encode_def_id(&mut self, def_id: DefId) { + self.encode_crate_num(def_id.krate); + self.encode_def_index(def_id.index); + } + fn encode_expn_id(&mut self, _expn_id: ExpnId) { + unimplemented!() + } + fn encode_symbol(&mut self, symbol: Symbol) { + symbol.as_str().encode(self) } } +const TAG_PARTIAL_SPAN: u8 = 0; +const TAG_VALID_SPAN_FULL: u8 = 1; + /// Some of this code is lifted from `EncodeContext`. /// /// However we directly encode file names because that's easier. @@ -301,7 +326,7 @@ impl<'tcx> Encodable> for SpanData { } } -impl<'tcx> ParalegalEncoder<'tcx> { +impl ParalegalEncoder<'_> { fn encode_file_name(&mut self, n: &FileName) { if let Some(&idx) = self.filepath_shorthands.get(n) { TAG_ENCODE_REMOTE.encode(self); @@ -315,8 +340,8 @@ impl<'tcx> ParalegalEncoder<'tcx> { } } -impl<'tcx, 'a> ParalegalDecoder<'tcx, 'a> { - fn decode_file_name(&mut self, crate_num: CrateNum) -> Rc { +impl ParalegalDecoder<'_, '_> { + fn decode_file_name(&mut self, crate_num: CrateNum) -> Arc { let tag = u8::decode(self); let pos = if tag == TAG_ENCODE_REMOTE { let index = usize::decode(self); @@ -342,7 +367,7 @@ impl<'tcx, 'a> ParalegalDecoder<'tcx, 'a> { file } - fn decode_filename_local(&mut self, crate_num: CrateNum) -> Rc { + fn decode_filename_local(&mut self, crate_num: CrateNum) -> Arc { let file_name = FileName::decode(self); let source_map = self.tcx.sess.source_map(); let matching_source_files = source_map @@ -376,19 +401,6 @@ impl<'tcx, 'a> ParalegalDecoder<'tcx, 'a> { const TAG_ENCODE_REMOTE: u8 = 0; const TAG_ENCODE_LOCAL: u8 = 1; -/// For now this does nothing, simply dropping the context. We don't use it -/// anyway in our errors. -impl<'tcx> Encodable> for SyntaxContext { - fn encode(&self, _: &mut ParalegalEncoder<'tcx>) {} -} - -/// Same as for the [`Encodable`] impl, we need to dispatch to [`SpanData`]. -impl<'tcx, 'a> Decodable> for Span { - fn decode(d: &mut ParalegalDecoder<'tcx, 'a>) -> Self { - SpanData::decode(d).span() - } -} - /// Which path in a [`RealFileName`] do we care about? fn path_in_real_path(r: &RealFileName) -> &PathBuf { match r { @@ -425,10 +437,3 @@ impl<'tcx, 'a> Decodable> for SpanData { } } } - -/// Always returns [`SyntaxContext::root()`] at the moment. -impl<'tcx, 'a> Decodable> for SyntaxContext { - fn decode(_: &mut ParalegalDecoder<'tcx, 'a>) -> Self { - SyntaxContext::root() - } -} diff --git a/crates/flowistry_pdg_construction/src/graph.rs b/crates/flowistry_pdg_construction/src/graph.rs index 153df157e9..61fb560384 100644 --- a/crates/flowistry_pdg_construction/src/graph.rs +++ b/crates/flowistry_pdg_construction/src/graph.rs @@ -215,7 +215,7 @@ impl<'tcx> DepGraph<'tcx> { } } -impl<'tcx> DepGraph<'tcx> { +impl DepGraph<'_> { /// Generates a graphviz visualization of the PDG and saves it to `path`. pub fn generate_graphviz(&self, path: impl AsRef) -> anyhow::Result<()> { let graph_dot = format!( @@ -227,7 +227,7 @@ impl<'tcx> DepGraph<'tcx> { &|_, (_, _)| "fontname=\"Courier New\",shape=box".to_string(), ) ); - rustc_utils::mir::body::run_dot(path.as_ref(), graph_dot.into_bytes()) + rustc_utils::mir::body::run_dot(path.as_ref(), &graph_dot.into_bytes()) } } diff --git a/crates/flowistry_pdg_construction/src/lib.rs b/crates/flowistry_pdg_construction/src/lib.rs index 577302762e..7d4ee5de90 100644 --- a/crates/flowistry_pdg_construction/src/lib.rs +++ b/crates/flowistry_pdg_construction/src/lib.rs @@ -7,6 +7,7 @@ extern crate rustc_abi; extern crate rustc_borrowck; extern crate rustc_const_eval; extern crate rustc_data_structures; +extern crate rustc_errors; extern crate rustc_hash; extern crate rustc_hir; extern crate rustc_index; diff --git a/crates/flowistry_pdg_construction/src/local_analysis.rs b/crates/flowistry_pdg_construction/src/local_analysis.rs index 9b0ccddf8e..8e1f7d351d 100644 --- a/crates/flowistry_pdg_construction/src/local_analysis.rs +++ b/crates/flowistry_pdg_construction/src/local_analysis.rs @@ -6,6 +6,7 @@ use itertools::Itertools; use log::{debug, log_enabled, trace, Level}; use rustc_borrowck::consumers::{places_conflict, PlaceConflictBias}; +use rustc_errors::DiagCtxtHandle; use rustc_hash::{FxHashMap, FxHashSet}; use rustc_hir::def_id::DefId; use rustc_index::IndexVec; @@ -17,7 +18,7 @@ use rustc_middle::{ ty::{GenericArgKind, GenericArgsRef, Instance, TyCtxt, TyKind}, }; use rustc_mir_dataflow::{self as df, fmt::DebugWithContext, Analysis}; -use rustc_span::{DesugaringKind, Span}; +use rustc_span::{source_map::Spanned, DesugaringKind, Span}; use rustc_utils::{mir::control_dependencies::ControlDependencies, BodyExt, PlaceExt}; use crate::{ @@ -38,7 +39,7 @@ pub(crate) struct InstructionState<'tcx> { impl DebugWithContext for InstructionState<'_> {} -impl<'tcx> df::JoinSemiLattice for InstructionState<'tcx> { +impl df::JoinSemiLattice for InstructionState<'_> { fn join(&mut self, other: &Self) -> bool { utils::hashmap_join( &mut self.last_mutation, @@ -51,6 +52,9 @@ impl<'tcx> df::JoinSemiLattice for InstructionState<'tcx> { pub(crate) struct LocalAnalysis<'tcx, 'a> { pub(crate) memo: &'a MemoPdgConstructor<'tcx>, pub(super) root: Instance<'tcx>, + // TODO: We should generally be using mono_body, this one is only used in + // retyping. Try and find out if I can use mono_body there too or + // encapsulate this away so we don't accidentally use this polymorphic one. body_with_facts: &'tcx CachedBody<'tcx>, pub(crate) mono_body: Body<'tcx>, pub(crate) def_id: DefId, @@ -72,7 +76,11 @@ impl<'tcx, 'a> LocalAnalysis<'tcx, 'a> { let tcx = memo.tcx; let def_id = root.def_id(); let body_with_facts = memo.body_cache.get(def_id); - let param_env = tcx.param_env_reveal_all_normalized(def_id); + let param_env = body_with_facts + .body() + .typing_env(tcx) + .with_post_analysis_normalized(tcx); + //let param_env = TypingEnv::post_analysis(tcx, def_id).with_post_analysis_normalized(tcx); let body = try_monomorphize( root, tcx, @@ -221,6 +229,10 @@ impl<'tcx, 'a> LocalAnalysis<'tcx, 'a> { self.memo.tcx } + pub(crate) fn dcx(&self) -> DiagCtxtHandle<'tcx> { + self.tcx().dcx() + } + /// Returns all nodes `src` such that `src` is: /// 1. Part of the value of `input` /// 2. The most-recently modified location for `src` @@ -364,7 +376,7 @@ impl<'tcx, 'a> LocalAnalysis<'tcx, 'a> { &'b self, location: Location, func: Cow<'_, Operand<'tcx>>, - args: Cow<'b, [Operand<'tcx>]>, + args: Cow<'b, [Spanned>]>, span: Span, ) -> Option> { let tcx = self.tcx(); @@ -375,16 +387,22 @@ impl<'tcx, 'a> LocalAnalysis<'tcx, 'a> { ); let Some((called_def_id, generic_args)) = self.operand_to_def_id(&func) else { - tcx.sess + self.dcx() .span_err(span, "Operand is cannot be interpreted as function"); return None; }; - trace!("Resolved call to function: {}", self.fmt_fn(called_def_id)); + trace!( + "Resolved call to function: {} with generic args {generic_args:?}", + self.fmt_fn(called_def_id) + ); // Monomorphize the called function with the known generic_args. - let param_env = tcx.param_env(self.def_id); + let typing_env = self + .mono_body + .typing_env(tcx) + .with_post_analysis_normalized(tcx); let Some(mut resolved_fn) = - utils::try_resolve_function(self.tcx(), called_def_id, param_env, generic_args) + utils::try_resolve_function(self.tcx(), called_def_id, typing_env, generic_args) else { let dynamics = generic_args.iter() .flat_map(|g| g.walk()) @@ -416,22 +434,23 @@ impl<'tcx, 'a> LocalAnalysis<'tcx, 'a> { trait definition and no refutation (`?Sized` constraint) is present." ) .unwrap(); - self.tcx().sess.span_warn(span, msg); + self.dcx().span_warn(span, msg); } else { - self.tcx().sess.span_err(span, msg); + self.dcx().span_err(span, msg); } return None; }; - let call_kind = - if let Some((instance, shim_type)) = handle_shims(resolved_fn, self.tcx(), param_env) { - resolved_fn = instance; - CallKind::Indirect { - shim: Some(shim_type), - } - } else { - self.classify_call_kind(called_def_id, resolved_fn, &args, span) - }; + let call_kind = if let Some((instance, shim_type)) = + handle_shims(resolved_fn, self.tcx(), typing_env, span) + { + resolved_fn = instance; + CallKind::Indirect { + shim: Some(shim_type), + } + } else { + self.classify_call_kind(called_def_id, resolved_fn, &args, span) + }; let resolved_def_id = resolved_fn.def_id(); if log_enabled!(Level::Trace) && called_def_id != resolved_def_id { let (called, resolved) = (self.fmt_fn(called_def_id), self.fmt_fn(resolved_def_id)); @@ -470,7 +489,7 @@ impl<'tcx, 'a> LocalAnalysis<'tcx, 'a> { span, arguments: &args, caller_body: &self.mono_body, - param_env, + param_env: typing_env, }; callback.on_inline(info) }); @@ -517,7 +536,7 @@ impl<'tcx, 'a> LocalAnalysis<'tcx, 'a> { if let Some(callback) = self.call_change_callback() { callback.on_inline_miss( resolved_fn, - param_env, + typing_env, location, self.root, InlineMissReason::TraitMethod, @@ -546,7 +565,7 @@ impl<'tcx, 'a> LocalAnalysis<'tcx, 'a> { state: &mut InstructionState<'tcx>, location: Location, func: &Operand<'tcx>, - args: &[Operand<'tcx>], + args: &[Spanned>], destination: Place<'tcx>, span: Span, ) -> bool { @@ -571,7 +590,7 @@ impl<'tcx, 'a> LocalAnalysis<'tcx, 'a> { // Register a synthetic assignment of `future = (arg0, arg1, ...)`. let rvalue = Rvalue::Aggregate( Box::new(AggregateKind::Tuple), - IndexVec::from_iter(args.iter().cloned()), + IndexVec::from_iter(args.iter().map(|o| o.node.clone())), ); self.modular_mutation_visitor(state) .visit_assign(&destination, &rvalue, location); @@ -634,9 +653,7 @@ impl<'tcx, 'a> LocalAnalysis<'tcx, 'a> { } pub(crate) fn construct_partial(&'a self) -> PartialGraph<'tcx> { - let mut analysis = self - .into_engine(self.tcx(), &self.mono_body) - .iterate_to_fixpoint(); + let mut analysis = self.iterate_to_fixpoint(self.tcx(), &self.mono_body, None); let mut final_state = PartialGraph::new( self.generic_args(), @@ -689,7 +706,7 @@ impl<'tcx, 'a> LocalAnalysis<'tcx, 'a> { &'b self, def_id: DefId, resolved_fn: Instance<'tcx>, - original_args: &'b [Operand<'tcx>], + original_args: &'b [Spanned>], span: Span, ) -> CallKind<'tcx> { match self.try_poll_call_kind(def_id, resolved_fn, original_args) { @@ -697,15 +714,13 @@ impl<'tcx, 'a> LocalAnalysis<'tcx, 'a> { AsyncDeterminationResult::NotAsync => self .try_indirect_call_kind(resolved_fn.def_id()) .unwrap_or(CallKind::Direct), - AsyncDeterminationResult::Unresolvable(reason) => { - self.tcx().sess.span_fatal(span, reason) - } + AsyncDeterminationResult::Unresolvable(reason) => self.dcx().span_fatal(span, reason), } } fn try_indirect_call_kind(&self, def_id: DefId) -> Option> { self.tcx() - .is_closure(def_id) + .is_closure_like(def_id) .then_some(CallKind::Indirect { shim: None }) } @@ -720,7 +735,7 @@ impl<'tcx, 'a> LocalAnalysis<'tcx, 'a> { } } -impl<'tcx, 'a> LocalAnalysis<'tcx, 'a> { +impl<'tcx> LocalAnalysis<'tcx, '_> { fn handle_terminator( &self, terminator: &Terminator<'tcx>, @@ -752,7 +767,7 @@ impl<'tcx, 'a> LocalAnalysis<'tcx, 'a> { } } -impl<'tcx, 'a> df::AnalysisDomain<'tcx> for &'a LocalAnalysis<'tcx, 'a> { +impl<'a, 'tcx> df::Analysis<'tcx> for &'a LocalAnalysis<'tcx, 'a> { type Domain = InstructionState<'tcx>; const NAME: &'static str = "LocalPdgConstruction"; @@ -762,10 +777,7 @@ impl<'tcx, 'a> df::AnalysisDomain<'tcx> for &'a LocalAnalysis<'tcx, 'a> { } fn initialize_start_block(&self, _body: &Body<'tcx>, _state: &mut Self::Domain) {} -} - -impl<'a, 'tcx> df::Analysis<'tcx> for &'a LocalAnalysis<'tcx, 'a> { - fn apply_statement_effect( + fn apply_primary_statement_effect( &mut self, state: &mut Self::Domain, statement: &Statement<'tcx>, @@ -775,7 +787,7 @@ impl<'a, 'tcx> df::Analysis<'tcx> for &'a LocalAnalysis<'tcx, 'a> { .visit_statement(statement, location) } - fn apply_terminator_effect<'mir>( + fn apply_primary_terminator_effect<'mir>( &mut self, state: &mut Self::Domain, terminator: &'mir Terminator<'tcx>, diff --git a/crates/flowistry_pdg_construction/src/mutation.rs b/crates/flowistry_pdg_construction/src/mutation.rs index 46ae966e76..5cd74dcc38 100644 --- a/crates/flowistry_pdg_construction/src/mutation.rs +++ b/crates/flowistry_pdg_construction/src/mutation.rs @@ -5,7 +5,7 @@ use itertools::Itertools; use log::debug; use rustc_middle::{ mir::{visit::Visitor, *}, - ty::{AdtKind, TyKind}, + ty::{AdtKind, CoroutineArgsExt, TyKind}, }; use rustc_target::abi::FieldIdx; @@ -41,6 +41,7 @@ pub struct Mutation<'tcx> { /// The set of inputs to the mutating operation. pub inputs: Vec<(Place<'tcx>, Option)>, + #[allow(dead_code)] /// The certainty of whether the mutation is happening. pub status: MutationStatus, } @@ -193,8 +194,8 @@ where }) .collect_vec() } - TyKind::Generator(_, args, _) => { - let ty = args.as_generator().prefix_tys(); + TyKind::Coroutine(_, args) => { + let ty = args.as_coroutine().prefix_tys(); ty.iter() .enumerate() .map(|(i, ty)| PlaceElem::Field(FieldIdx::from_usize(i), ty)) diff --git a/crates/flowistry_pdg_construction/src/utils.rs b/crates/flowistry_pdg_construction/src/utils.rs index 38a12bb2c7..cd0f615096 100644 --- a/crates/flowistry_pdg_construction/src/utils.rs +++ b/crates/flowistry_pdg_construction/src/utils.rs @@ -9,35 +9,37 @@ use rustc_hash::{FxHashMap, FxHashSet}; use rustc_hir::{def_id::DefId, Defaultness}; use rustc_middle::{ mir::{ - tcx::PlaceTy, Body, HasLocalDecls, Local, Location, Place, ProjectionElem, Statement, - StatementKind, Terminator, TerminatorKind, + tcx::PlaceTy, Body, HasLocalDecls, Local, Location, Operand, Place, ProjectionElem, + Statement, StatementKind, Terminator, TerminatorKind, }, ty::{ - AssocItemContainer, Binder, EarlyBinder, GenericArg, GenericArgsRef, Instance, InstanceDef, - List, ParamEnv, Region, Ty, TyCtxt, TyKind, + AssocItemContainer, Binder, EarlyBinder, GenericArg, GenericArgsRef, Instance, + InstanceKind, Region, Ty, TyCtxt, TyKind, TypingEnv, }, }; -use rustc_span::{ErrorGuaranteed, Span}; -use rustc_type_ir::{fold::TypeFoldable, AliasKind}; +use rustc_span::{source_map::Spanned, ErrorGuaranteed, Span}; +use rustc_type_ir::{fold::TypeFoldable, AliasTyKind, PredicatePolarity, RegionKind}; use rustc_utils::{BodyExt, PlaceExt}; pub trait Captures<'a> {} -impl<'a, T: ?Sized> Captures<'a> for T {} +impl Captures<'_> for T {} /// An async check that does not crash if called on closures. pub fn is_async(tcx: TyCtxt<'_>, def_id: DefId) -> bool { - !tcx.is_closure(def_id) && tcx.asyncness(def_id).is_async() + !tcx.is_closure_like(def_id) && tcx.asyncness(def_id).is_async() } +pub type ArgSlice<'a, 'tcx> = &'a [Spanned>]; + /// Resolve the `def_id` item to an instance. pub fn try_resolve_function<'tcx>( tcx: TyCtxt<'tcx>, def_id: DefId, - param_env: ParamEnv<'tcx>, + typing_env: TypingEnv<'tcx>, args: GenericArgsRef<'tcx>, ) -> Option> { - let param_env = param_env.with_reveal_all_normalized(tcx); - Instance::resolve(tcx, param_env, def_id, args).unwrap() + let typing_env = typing_env.with_post_analysis_normalized(tcx); + Instance::try_resolve(tcx, typing_env, def_id, args).unwrap() } /// Returns whether this method is expected to have a body we can analyze. @@ -48,36 +50,35 @@ pub fn try_resolve_function<'tcx>( /// Note: While you are supposed to call this whit a `function` that refers to a /// function, it will not crash if it refers to a type or constant instead. pub fn is_virtual(tcx: TyCtxt, function: DefId) -> bool { - tcx.opt_associated_item(function) - .map_or(false, |assoc_item| { - matches!( - assoc_item.container, - AssocItemContainer::TraitContainer - if !matches!( - assoc_item.defaultness(tcx), - Defaultness::Default { has_value: true }) - ) - }) + tcx.opt_associated_item(function).is_some_and(|assoc_item| { + matches!( + assoc_item.container, + AssocItemContainer::Trait + if !matches!( + assoc_item.defaultness(tcx), + Defaultness::Default { has_value: true }) + ) + }) } /// The "canonical" way we monomorphize pub fn try_monomorphize<'tcx, 'a, T>( inst: Instance<'tcx>, tcx: TyCtxt<'tcx>, - param_env: ParamEnv<'tcx>, + typing_env: TypingEnv<'tcx>, t: &'a T, span: Span, ) -> Result where T: TypeFoldable> + Clone + std::fmt::Debug, { - inst.try_subst_mir_and_normalize_erasing_regions( + inst.try_instantiate_mir_and_normalize_erasing_regions( tcx, - param_env, + typing_env, EarlyBinder::bind(tcx.erase_regions(t.clone())), ) .map_err(|e| { - tcx.sess.span_err( + tcx.dcx().span_err( span, format!("failed to monomorphize with instance {inst:?} due to {e:?}"), ) @@ -90,7 +91,7 @@ pub fn type_as_fn<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> Option<(DefId, Gener let ty = ty_resolve(ty, tcx); match ty.kind() { TyKind::FnDef(def_id, generic_args) - | TyKind::Generator(def_id, generic_args, _) + | TyKind::Coroutine(def_id, generic_args) | TyKind::Closure(def_id, generic_args) => Some((*def_id, generic_args)), ty => { trace!("Bailing from handle_call because func is literal with type: {ty:?}"); @@ -109,7 +110,6 @@ pub fn retype_place<'tcx>( let mut new_projection = Vec::new(); let mut ty = PlaceTy::from_ty(body.local_decls()[orig.local].ty); - let param_env = tcx.param_env_reveal_all_normalized(def_id); for elem in orig.projection.iter() { if matches!( ty.ty.kind(), @@ -140,15 +140,14 @@ pub fn retype_place<'tcx>( ); ty = ty.projection_ty_core( tcx, - param_env, &elem, |_, field, _| match ty.ty.kind() { TyKind::Closure(_, args) => { let upvar_tys = args.as_closure().upvar_tys(); upvar_tys.iter().nth(field.as_usize()).unwrap() } - TyKind::Generator(_, args, _) => { - let upvar_tys = args.as_generator().upvar_tys(); + TyKind::Coroutine(_, args) => { + let upvar_tys = args.as_coroutine().upvar_tys(); upvar_tys.iter().nth(field.as_usize()).unwrap() } _ => ty.field_ty(tcx, field), @@ -218,7 +217,7 @@ pub fn find_body_assignments(body: &Body<'_>) -> BodyAssignments { pub fn ty_resolve<'tcx>(ty: Ty<'tcx>, tcx: TyCtxt<'tcx>) -> Ty<'tcx> { match ty.kind() { - TyKind::Alias(AliasKind::Opaque, alias_ty) => tcx.type_of(alias_ty.def_id).skip_binder(), + TyKind::Alias(AliasTyKind::Opaque, alias_ty) => tcx.type_of(alias_ty.def_id).skip_binder(), _ => ty, } } @@ -228,8 +227,8 @@ pub fn manufacture_substs_for( function: DefId, ) -> Result, ErrorGuaranteed> { use rustc_middle::ty::{ - BoundRegionKind, DynKind, ExistentialPredicate, ExistentialProjection, ExistentialTraitRef, - GenericParamDefKind, ImplPolarity, ParamTy, TraitPredicate, + DynKind, ExistentialPredicate, ExistentialProjection, ExistentialTraitRef, + GenericParamDefKind, ParamTy, TraitPredicate, }; trace!("Manufacturing for {function:?}"); @@ -247,14 +246,13 @@ pub fn manufacture_substs_for( match param.kind { // I'm not sure this is correct. We could probably return also "erased" or "static" here. GenericParamDefKind::Lifetime => { - return Ok(GenericArg::from(Region::new_free( + return Ok(GenericArg::from(Region::new_from_kind( tcx, - function, - BoundRegionKind::BrAnon(None), + RegionKind::ReErased, ))) } GenericParamDefKind::Const { .. } => { - return Err(tcx.sess.span_err( + return Err(tcx.dcx().span_err( tcx.def_span(param.def_id), "Cannot use constants as generic parameters in controllers", )) @@ -265,11 +263,11 @@ pub fn manufacture_substs_for( let param_as_ty = ParamTy::for_def(param); let constraints = predicates.predicates.iter().filter_map(|clause| { let pred = if let Some(trait_ref) = clause.as_trait_clause() { - if trait_ref.polarity() != ImplPolarity::Positive { + if trait_ref.polarity() != PredicatePolarity::Positive { return None; }; let Some(TraitPredicate { trait_ref, .. }) = trait_ref.no_bound_vars() else { - return Some(Err(tcx.sess.span_err( + return Some(Err(tcx.dcx().span_err( tcx.def_span(param.def_id), format!("Trait ref had binder {trait_ref:?}"), ))); @@ -289,7 +287,7 @@ pub fn manufacture_substs_for( } else if let Some(pred) = clause.as_projection_clause() { trace!(" is projection clause"); let Some(pred) = pred.no_bound_vars() else { - return Some(Err(tcx.sess.span_err( + return Some(Err(tcx.dcx().span_err( tcx.def_span(param.def_id), "Predicate has a bound variable", ))); @@ -308,18 +306,19 @@ pub fn manufacture_substs_for( }); let mut predicates = constraints.collect::, _>>()?; trace!(" collected predicates {predicates:?}"); + let no_args: [GenericArg; 0] = []; match predicates.len() { 0 => predicates.push(Binder::dummy(ExistentialPredicate::Trait( - ExistentialTraitRef { - def_id: tcx - .get_diagnostic_item(rustc_span::sym::Any) + ExistentialTraitRef::new( + tcx, + tcx.get_diagnostic_item(rustc_span::sym::Any) .expect("The `Any` item is not defined."), - args: List::empty(), - }, + no_args, + ), ))), 1 => (), _ => { - return Err(tcx.sess.span_err( + return Err(tcx.dcx().span_err( tcx.def_span(param.def_id), format!( "can only synthesize a trait object for one non-auto trait, got {}", @@ -333,7 +332,7 @@ pub fn manufacture_substs_for( let ty = Ty::new_dynamic( tcx, poly_predicate, - Region::new_free(tcx, function, BoundRegionKind::BrAnon(None)), + Region::new_from_kind(tcx, RegionKind::ReErased), DynKind::Dyn, ); Ok(GenericArg::from(ty)) @@ -351,10 +350,11 @@ pub enum ShimType { pub fn handle_shims<'tcx>( resolved_fn: Instance<'tcx>, tcx: TyCtxt<'tcx>, - param_env: ParamEnv<'tcx>, + typing_env: TypingEnv<'tcx>, + span: Span, ) -> Option<(Instance<'tcx>, ShimType)> { match resolved_fn.def { - InstanceDef::ClosureOnceShim { .. } => { + InstanceKind::ClosureOnceShim { .. } => { // Rustc has inserted a call to the shim that maps `Fn` and `FnMut` // instances to an `FnOnce`. This shim has no body itself so we // can't just inline, we must explicitly simulate it's effects by @@ -369,17 +369,17 @@ pub fn handle_shims<'tcx>( let Some((func_t, g)) = type_as_fn(tcx, func_a.expect_ty()) else { unreachable!() }; - let instance = Instance::expect_resolve(tcx, param_env, func_t, g); + let instance = Instance::expect_resolve(tcx, typing_env, func_t, g, span); Some((instance, ShimType::Once)) } - InstanceDef::FnPtrShim { .. } => { + InstanceKind::FnPtrShim { .. } => { let Some((func_a, _rest)) = resolved_fn.args.split_first() else { unreachable!() }; let Some((func_t, g)) = type_as_fn(tcx, func_a.expect_ty()) else { unreachable!() }; - let instance = Instance::expect_resolve(tcx, param_env, func_t, g); + let instance = Instance::expect_resolve(tcx, typing_env, func_t, g, span); Some((instance, ShimType::FnPtr)) } diff --git a/crates/flowistry_pdg_construction/tests/pdg.rs b/crates/flowistry_pdg_construction/tests/pdg.rs index c5023dc3d6..066555ef96 100644 --- a/crates/flowistry_pdg_construction/tests/pdg.rs +++ b/crates/flowistry_pdg_construction/tests/pdg.rs @@ -10,7 +10,7 @@ use std::{collections::HashSet, rc::Rc}; use either::Either; use flowistry::mir::FlowistryInput; use flowistry_pdg_construction::{ - body_cache::{dump_mir_and_borrowck_facts, BodyCache}, + body_cache::BodyCache, graph::{DepEdge, DepGraph}, CallChangeCallback, CallChangeCallbackFn, CallChanges, MemoPdgConstructor, SkipCall, }; @@ -56,10 +56,8 @@ fn pdg( tests: impl for<'tcx> FnOnce(TyCtxt<'tcx>, &BodyCache<'tcx>, DepGraph<'tcx>) + Send, ) { let _ = env_logger::try_init(); - rustc_utils::test_utils::CompileBuilder::new(input) - .with_query_override(None) - .expect_compile(move |CompileResult { tcx, .. }| { - dump_mir_and_borrowck_facts(tcx); + rustc_utils::test_utils::CompileBuilder::new(input).expect_compile( + move |CompileResult { tcx, .. }| { let def_id = get_main(tcx); let mut memo = MemoPdgConstructor::new(tcx); configure(tcx, &mut memo); @@ -67,7 +65,8 @@ fn pdg( memo.with_call_change_callback(LocalLoadingOnly(policy)); let pdg = memo.construct_graph(def_id); tests(tcx, memo.body_cache(), pdg) - }) + }, + ) } #[allow(unused)] @@ -852,7 +851,7 @@ pdg_test! { params.with_call_change_callback(CallChangeCallbackFn::new(move |info| { let name = tcx.opt_item_name(info.callee.def_id()); let name2 = tcx.opt_parent(info.callee.def_id()).and_then(|c| tcx.opt_item_name(c)); - let is_spawn = |name: Option<&Symbol>| name.map_or(false, |n| n.as_str().contains("spawn")); + let is_spawn = |name: Option<&Symbol>| name.is_some_and(|n| n.as_str().contains("spawn")); let mut changes = CallChanges::default(); if is_spawn(name.as_ref()) || is_spawn(name2.as_ref()) { diff --git a/crates/paralegal-flow/Cargo.toml b/crates/paralegal-flow/Cargo.toml index fbae415946..15a21858ec 100644 --- a/crates/paralegal-flow/Cargo.toml +++ b/crates/paralegal-flow/Cargo.toml @@ -25,15 +25,15 @@ indexical = { version = "0.3.1", default-features = false, features = [ ] } -clap = { version = "=4.3.24", features = ["derive", "cargo", "env"] } +clap = { version = "4.5.23", features = ["derive", "cargo", "env"] } serde = { workspace = true, features = ["derive"] } lazy_static = "1" -ordermap = "0.3" +ordermap = "0.5.4" trait_enum = "0.5" -pretty = "0.11" +pretty = "0.12" nom = "7" log = { version = "0.4", features = ["serde"] } -simple_logger = "2" +simple_logger = "5" num-derive = "0.4" num-traits = "0.2" petgraph = { workspace = true } @@ -41,19 +41,14 @@ humantime = "2" strum = { workspace = true } enum-map = "2.7" serial_test = "2.0.0" -itertools = "0.12" +itertools = "0.13" anyhow = "1.0.72" -thiserror = "1" +thiserror = "2" serde_bare = "0.5.0" -toml = "0.7" +toml = "0.8" serde_json = "1" -#dot = "0.1" dot = { git = "https://github.com/JustusAdam/dot-rust", rev = "ff2b42ceda98c639c8ea3cbfc56b83d6e06e8106" } -#dot = {path = "../../clones/dot-rust" } - -# This is just for pinning this dependency -camino = "= 1.0.9" [build-dependencies] chrono = "0.4" diff --git a/crates/paralegal-flow/src/ana/graph_converter.rs b/crates/paralegal-flow/src/ana/graph_converter.rs index b9d706da09..02156fdfd7 100644 --- a/crates/paralegal-flow/src/ana/graph_converter.rs +++ b/crates/paralegal-flow/src/ana/graph_converter.rs @@ -15,13 +15,10 @@ use flowistry_pdg_construction::{ }; use paralegal_spdg::{Node, SPDGStats}; -use rustc_hir::{ - def, - def_id::{DefId, LocalDefId}, -}; +use rustc_hir::def_id::{DefId, LocalDefId}; use rustc_middle::{ mir, - ty::{self, TyCtxt}, + ty::{self, TyCtxt, TypingEnv}, }; use anyhow::Result; @@ -178,7 +175,7 @@ impl<'a, 'tcx, C: Extend> GraphConverter<'tcx, 'a, C> { let crate::Either::Right( term @ mir::Terminator { kind: mir::TerminatorKind::Call { func, .. }, - .. + source_info, }, ) = body.stmt_at(loc) else { @@ -186,19 +183,21 @@ impl<'a, 'tcx, C: Extend> GraphConverter<'tcx, 'a, C> { }; debug!("Assigning markers to {:?}", term.kind); let res = self.call_string_resolver.resolve(weight.at); - let param_env = self.tcx().param_env(res.def_id()); + let param_env = TypingEnv::post_analysis(self.tcx(), res.def_id()); let func = - try_monomorphize(res, self.tcx(), param_env, func, term.source_info.span) - .unwrap(); + try_monomorphize(res, self.tcx(), param_env, func, source_info.span).unwrap(); let (inst, args) = type_as_fn(self.tcx(), ty_of_const(func.constant().unwrap())).unwrap(); let mres = try_resolve_function( self.tcx(), inst, - self.tcx().param_env(leaf_loc.function), + TypingEnv::post_analysis(self.tcx(), leaf_loc.function), args, ) - .map(|inst| handle_shims(inst, self.tcx(), param_env).map_or(inst, |t| t.0)); + .map(|inst| { + handle_shims(inst, self.tcx(), param_env, source_info.span) + .map_or(inst, |t| t.0) + }); if mres.is_none() { debug!("Could not resolve {inst:?} properly during marker assignment"); @@ -292,7 +291,16 @@ impl<'a, 'tcx, C: Extend> GraphConverter<'tcx, 'a, C> { // Thread through each caller to recover generic arguments let body = self.body_cache().get(last.function); let raw_ty = place.ty(body.body(), tcx); - Some(try_monomorphize(resolution, tcx, ty::ParamEnv::reveal_all(), &raw_ty, span).unwrap()) + Some( + try_monomorphize( + resolution, + tcx, + TypingEnv::fully_monomorphized(), + &raw_ty, + span, + ) + .unwrap(), + ) } /// Fetch annotations item identified by this `id`. @@ -334,6 +342,7 @@ impl<'a, 'tcx, C: Extend> GraphConverter<'tcx, 'a, C> { else { return; }; + trace!("Node {:?} has place type {:?}", weight.place, place_ty); // Restore after fixing https://github.com/brownsys/paralegal/issues/138 //let deep = !weight.is_split; let deep = true; @@ -346,14 +355,16 @@ impl<'a, 'tcx, C: Extend> GraphConverter<'tcx, 'a, C> { self.known_def_ids.extend(node_types.iter().copied()); let tcx = self.tcx(); if !node_types.is_empty() { - self.types - .entry(i) - .or_default() - .extend(node_types.iter().filter(|t| match tcx.def_kind(*t) { - def::DefKind::Generator => false, - kind => !kind.is_fn_like(), - })) + self.types.entry(i).or_default().extend( + node_types + .iter() + .filter(|t| !tcx.is_coroutine(**t) && !tcx.def_kind(*t).is_fn_like()), + ) } + trace!( + "For node {:?} found marked node types {node_types:?}", + weight.place + ); } /// Create an initial flowistry graph for the function identified by @@ -543,7 +554,7 @@ fn assert_edge_location_invariant<'tcx>( return; } } - let mut msg = tcx.sess.struct_span_fatal( + let mut msg = tcx.dcx().struct_span_fatal( (body, at.leaf().location).span(tcx), format!( "This operation is performed in a different location: {}", @@ -602,20 +613,25 @@ mod call_string_resolver { //! This is a separate mod so that we can use encapsulation to preserve the //! internal invariants of the resolver. + use std::cell::OnceCell; + use flowistry_pdg::CallString; use flowistry_pdg_construction::{ body_cache::BodyCache, utils::{manufacture_substs_for, try_monomorphize, try_resolve_function}, }; use paralegal_spdg::Endpoint; - use rustc_middle::{mir::TerminatorKind, ty::Instance}; + use rustc_middle::{ + mir::TerminatorKind, + ty::{Instance, TypingEnv}, + }; use rustc_utils::cache::Cache; use crate::{Either, MarkerCtx, TyCtxt}; use super::{func_of_term, map_either, match_async_trait_assign, AsFnAndArgs}; - /// Cached resolution of [`CallString`]s to [`FnResolution`]s. + /// Cached resolution of [`CallString`]s to [`Instance`]s. /// /// Only valid for a single controller. Each controller should initialize a /// new resolver. @@ -625,6 +641,7 @@ mod call_string_resolver { entrypoint_is_async: bool, body_cache: &'a BodyCache<'tcx>, marker_context: MarkerCtx<'tcx>, + base: OnceCell>, } impl<'tcx, 'a> CallStringResolver<'tcx, 'a> { @@ -642,13 +659,15 @@ mod call_string_resolver { } } let def_id = this.function; - try_resolve_function( - self.tcx, - def_id, - self.tcx.param_env(def_id), - manufacture_substs_for(self.tcx, def_id).unwrap(), - ) - .unwrap() + *self.base.get_or_init(|| { + try_resolve_function( + self.tcx, + def_id, + TypingEnv::post_analysis(self.tcx, def_id), + manufacture_substs_for(self.tcx, def_id).unwrap(), + ) + .unwrap() + }) } pub fn new( @@ -663,6 +682,7 @@ mod call_string_resolver { entrypoint_is_async: super::entrypoint_is_async(body_cache, tcx, entrypoint), body_cache, marker_context, + base: Default::default(), } } @@ -673,14 +693,15 @@ mod call_string_resolver { /// is not either a function call or a statement where an async closure /// is created and assigned. fn resolve_internal(&self, cs: CallString) -> Instance<'tcx> { - *self.cache.get(cs, |_| { + *self.cache.get(&cs, |_| { let this = cs.leaf(); let prior = self.resolve(cs); let tcx = self.tcx; let base_stmt = super::expect_stmt_at(self.body_cache, this); - let param_env = tcx.param_env_reveal_all_normalized(prior.def_id()); + let param_env = TypingEnv::post_analysis(tcx, prior.def_id()) + .with_post_analysis_normalized(tcx); let normalized = map_either( base_stmt, |stmt| { @@ -695,7 +716,13 @@ mod call_string_resolver { let res = match normalized { Either::Right(term) => { let (def_id, args) = func_of_term(tcx, &term).unwrap(); - let instance = Instance::expect_resolve(tcx, param_env, def_id, args); + let instance = Instance::expect_resolve( + tcx, + param_env, + def_id, + args, + term.source_info.span, + ); if let Some(model) = self.marker_context.has_stub(def_id) { let TerminatorKind::Call { args, .. } = &term.kind else { unreachable!() diff --git a/crates/paralegal-flow/src/ana/inline_judge.rs b/crates/paralegal-flow/src/ana/inline_judge.rs index 78964b6b96..ae2754ee3e 100644 --- a/crates/paralegal-flow/src/ana/inline_judge.rs +++ b/crates/paralegal-flow/src/ana/inline_judge.rs @@ -2,14 +2,14 @@ use std::{fmt::Display, rc::Rc}; use flowistry_pdg_construction::{body_cache::BodyCache, CallInfo}; use paralegal_spdg::{utils::write_sep, Identifier}; -use rustc_hash::FxHashSet; +use rustc_data_structures::fx::FxHashSet; use rustc_hir::def_id::{CrateNum, DefId, LOCAL_CRATE}; use rustc_middle::ty::{ - AssocKind, BoundVariableKind, Clause, ClauseKind, ImplPolarity, Instance, ParamEnv, - ProjectionPredicate, TraitPredicate, + AssocKind, BoundVariableKind, Clause, ClauseKind, Instance, ProjectionPredicate, + TraitPredicate, TypingEnv, }; use rustc_span::{Span, Symbol}; -use rustc_type_ir::TyKind; +use rustc_type_ir::{PredicatePolarity, TyKind}; use crate::{ ana::Print, @@ -137,7 +137,7 @@ impl<'tcx> InlineJudge<'tcx> { pub fn ensure_is_safe_to_approximate( &self, - param_env: ParamEnv<'tcx>, + typing_env: TypingEnv<'tcx>, resolved: Instance<'tcx>, call_span: Span, emit_err: bool, @@ -146,7 +146,7 @@ impl<'tcx> InlineJudge<'tcx> { SafetyChecker { tcx: self.tcx(), emit_err, - param_env, + typing_env, resolved, call_span, marker_ctx: self.marker_ctx.clone(), @@ -168,7 +168,7 @@ struct SafetyChecker<'tcx> { tcx: TyCtxt<'tcx>, /// Emit errors if `true`, otherwise emit warnings emit_err: bool, - param_env: ParamEnv<'tcx>, + typing_env: TypingEnv<'tcx>, /// Instance under scrutiny resolved: Instance<'tcx>, call_span: Span, @@ -180,7 +180,7 @@ struct SafetyChecker<'tcx> { impl<'tcx> SafetyChecker<'tcx> { /// Emit an error or a warning with some preformatted messaging. fn err(&self, s: &str, span: Span) { - let sess = self.tcx.sess; + let sess = self.tcx.dcx(); let msg = format!( "the call to {:?} is not safe to abstract as demanded by '{}', because of: {s}", self.resolved, self.reason @@ -210,8 +210,8 @@ impl<'tcx> SafetyChecker<'tcx> { } fn check_projection_predicate(&self, predicate: &ProjectionPredicate<'tcx>, span: Span) { - if let Some(t) = predicate.term.ty() { - let t = self.tcx.normalize_erasing_regions(self.param_env, t); + if let Some(t) = predicate.term.as_type() { + let t = self.tcx.normalize_erasing_regions(self.typing_env, t); let markers = self.marker_ctx.deep_type_markers(t); if !markers.is_empty() { let markers = markers.iter().map(|t| t.1).collect::>(); @@ -226,7 +226,7 @@ impl<'tcx> SafetyChecker<'tcx> { fn check_trait_predicate(&self, predicate: &TraitPredicate<'tcx>, span: Span) { let TraitPredicate { - polarity: ImplPolarity::Positive, + polarity: PredicatePolarity::Positive, trait_ref, } = predicate else { @@ -244,10 +244,14 @@ impl<'tcx> SafetyChecker<'tcx> { if self.tcx.is_fn_trait(trait_ref.def_id) { let instance = match self_ty.kind() { - TyKind::Closure(id, args) | TyKind::FnDef(id, args) => { - Instance::resolve(self.tcx, ParamEnv::reveal_all(), *id, args) - } - TyKind::FnPtr(_) => { + TyKind::Closure(id, args) | TyKind::FnDef(id, args) => Instance::expect_resolve( + self.tcx, + TypingEnv::fully_monomorphized(), + *id, + args, + span, + ), + TyKind::FnPtr(..) => { self.err(&format!("unresolvable function pointer {self_ty:?}"), span); return; } @@ -260,9 +264,7 @@ impl<'tcx> SafetyChecker<'tcx> { ); return; } - } - .unwrap() - .unwrap(); + }; let markers = self.marker_ctx.get_reachable_markers(instance); if !markers.is_empty() { self.err_markers( @@ -311,6 +313,7 @@ impl<'tcx> SafetyChecker<'tcx> { | ClauseKind::WellFormed(_) | ClauseKind::ConstArgHasType(..) | ClauseKind::ConstEvaluatable(_) + | ClauseKind::HostEffect(_) | ClauseKind::RegionOutlives(_) => { // These predicates do not allow for "code injection" since they do not concern things that can be marked. } diff --git a/crates/paralegal-flow/src/ana/mod.rs b/crates/paralegal-flow/src/ana/mod.rs index 56acd979da..5da9b8f5af 100644 --- a/crates/paralegal-flow/src/ana/mod.rs +++ b/crates/paralegal-flow/src/ana/mod.rs @@ -22,7 +22,7 @@ use flowistry::mir::FlowistryInput; use flowistry_pdg_construction::{ body_cache::{local_or_remote_paths, BodyCache}, calling_convention::CallingConvention, - utils::is_async, + utils::{is_async, ArgSlice}, CallChangeCallback, CallChanges, CallInfo, InlineMissReason, MemoPdgConstructor, SkipCall, }; use inline_judge::InlineJudgement; @@ -34,8 +34,8 @@ use rustc_hir::{ def_id::{DefId, LOCAL_CRATE}, }; use rustc_middle::{ - mir::{Location, Operand}, - ty::{Instance, ParamEnv, TyCtxt}, + mir::Location, + ty::{Instance, TyCtxt, TypingEnv}, }; use rustc_span::{ErrorGuaranteed, FileNameDisplayPreference, Span as RustSpan, Symbol}; @@ -472,8 +472,8 @@ fn type_info_sanity_check(controllers: &ControllerMap, types: &TypeInfoMap) { fn def_kind_for_item(id: DefId, tcx: TyCtxt) -> DefKind { match tcx.def_kind(id) { + _ if tcx.is_coroutine(id) => DefKind::Generator, def::DefKind::Closure => DefKind::Closure, - def::DefKind::Generator => DefKind::Generator, kind if kind.is_fn_like() => DefKind::Fn, def::DefKind::Struct | def::DefKind::AssocTy @@ -539,7 +539,7 @@ impl Stub { &self, tcx: TyCtxt<'tcx>, function: Instance<'tcx>, - param_env: ParamEnv<'tcx>, + param_env: TypingEnv<'tcx>, at: RustSpan, ) -> Result, ErrorGuaranteed> { match self { @@ -550,7 +550,7 @@ impl Stub { let param = generics.param_at(idx, tcx); param.name == name }) else { - return Err(tcx.sess.span_err( + return Err(tcx.dcx().span_err( at, format!("Function has no parameter named {generic_name}"), )); @@ -558,9 +558,7 @@ impl Stub { let ty = function.args[param_index].expect_ty(); let (def_id, args) = flowistry_pdg_construction::utils::type_as_fn(tcx, ty).unwrap(); - Ok(Instance::resolve(tcx, param_env, def_id, args) - .unwrap() - .unwrap()) + Ok(Instance::expect_resolve(tcx, param_env, def_id, args, at)) } } } @@ -578,7 +576,7 @@ impl Stub { DefKind::Closure => true, DefKind::Fn => false, kind => { - return Err(tcx.sess.span_err( + return Err(tcx.dcx().span_err( at, format!("Expected `fn` or `closure` def kind, got {kind:?}"), )) @@ -586,7 +584,7 @@ impl Stub { } } Stub::SubFuture { .. } => { - assert!(tcx.generator_is_async(def_id)); + assert!(tcx.coroutine_is_async(def_id)); true } }; @@ -603,8 +601,8 @@ impl Stub { &self, tcx: TyCtxt<'tcx>, function: Instance<'tcx>, - param_env: ParamEnv<'tcx>, - arguments: &[Operand<'tcx>], + param_env: TypingEnv<'tcx>, + arguments: ArgSlice<'_, 'tcx>, at: RustSpan, ) -> Result<(Instance<'tcx>, CallingConvention<'tcx>), ErrorGuaranteed> { let instance = self.resolve_alternate_instance(tcx, function, param_env, at)?; @@ -622,7 +620,7 @@ impl Stub { gen } _ => { - return Err(tcx.sess.span_err( + return Err(tcx.dcx().span_err( at, format!( "this function ({:?}) should have only one argument but it has {}", @@ -680,7 +678,7 @@ impl<'tcx> CallChangeCallback<'tcx> for MyCallback<'tcx> { fn on_inline_miss( &self, resolution: Instance<'tcx>, - param_env: ParamEnv<'tcx>, + param_env: TypingEnv<'tcx>, _loc: Location, _parent: Instance<'tcx>, reason: InlineMissReason, diff --git a/crates/paralegal-flow/src/ann/db.rs b/crates/paralegal-flow/src/ann/db.rs index a31c3553c3..2dac6a4c9c 100644 --- a/crates/paralegal-flow/src/ann/db.rs +++ b/crates/paralegal-flow/src/ann/db.rs @@ -28,13 +28,13 @@ use flowistry_pdg_construction::{ }; use paralegal_spdg::Identifier; -use rustc_errors::DiagnosticMessage; -use rustc_hash::{FxHashMap, FxHashSet}; +use rustc_data_structures::fx::{FxHashMap, FxHashSet}; +use rustc_errors::DiagMessage; use rustc_hir::def_id::DefId; use rustc_hir::{def::DefKind, def_id::CrateNum}; use rustc_middle::{ mir, - ty::{self, GenericArgsRef, Instance, TyCtxt}, + ty::{self, GenericArgsRef, Instance, TyCtxt, TypingEnv}, }; use rustc_serialize::Decodable; @@ -112,8 +112,7 @@ impl<'tcx> MarkerCtx<'tcx> { /// For async handling. If this id corresponds to an async closure we try to /// resolve its parent item which the markers would actually be placed on. fn defid_rewrite(&self, def_id: DefId) -> DefId { - let def_kind = self.tcx().def_kind(def_id); - if matches!(def_kind, DefKind::Generator) { + if self.tcx().is_coroutine(def_id) { if let Some(parent) = self.tcx().opt_parent(def_id) { if matches!(self.tcx().def_kind(parent), DefKind::AssocFn | DefKind::Fn) && self.tcx().asyncness(parent).is_async() @@ -198,7 +197,7 @@ impl<'tcx> MarkerCtx<'tcx> { } self.db() .reachable_markers - .get_maybe_recursive(res, |_| self.compute_reachable_markers(res)) + .get_maybe_recursive(&res, |_| self.compute_reachable_markers(res)) .map_or(&[], Box::as_ref) } @@ -229,7 +228,8 @@ impl<'tcx> MarkerCtx<'tcx> { try_monomorphize( res, self.tcx(), - self.tcx().param_env_reveal_all_normalized(res.def_id()), + TypingEnv::post_analysis(self.tcx(), res.def_id()) + .with_post_analysis_normalized(self.tcx()), body.body(), self.tcx().def_span(res.def_id()), ) @@ -262,11 +262,11 @@ impl<'tcx> MarkerCtx<'tcx> { .collect() } - fn span_err(&self, span: Span, msg: impl Into) { + fn span_err(&self, span: Span, msg: impl Into) { if self.0.config.relaxed() { - self.tcx().sess.span_warn(span, msg.into()); + self.tcx().dcx().span_warn(span, msg.into()); } else { - self.tcx().sess.span_err(span, msg.into()); + self.tcx().dcx().span_err(span, msg.into()); } } @@ -277,7 +277,7 @@ impl<'tcx> MarkerCtx<'tcx> { terminator: &mir::Terminator<'tcx>, expect_resolve: bool, ) -> impl Iterator + '_ { - let param_env = ty::ParamEnv::reveal_all(); + let param_env = TypingEnv::fully_monomorphized(); let mut v = vec![]; trace!( " Finding reachable markers for terminator {:?}", @@ -287,7 +287,8 @@ impl<'tcx> MarkerCtx<'tcx> { return v.into_iter(); }; let mut res = if expect_resolve { - let Some(instance) = Instance::resolve(self.tcx(), param_env, def_id, gargs).unwrap() + let Some(instance) = + Instance::try_resolve(self.tcx(), param_env, def_id, gargs).unwrap() else { self.span_err( terminator.source_info.span, @@ -296,7 +297,7 @@ impl<'tcx> MarkerCtx<'tcx> { return v.into_iter(); }; MaybeMonomorphized::Monomorphized( - handle_shims(instance, self.tcx(), param_env) + handle_shims(instance, self.tcx(), param_env, terminator.source_info.span) .map_or(instance, |(shimmed, _)| shimmed), ) } else { @@ -333,14 +334,23 @@ impl<'tcx> MarkerCtx<'tcx> { // we are provided the id of the function that creates the // future. As such we can't just monomorphize and traverse, // we have to find the generator first. - if let ty::TyKind::Alias(ty::AliasKind::Opaque, alias) = - local_decls[mir::RETURN_PLACE].ty.kind() - && let ty::TyKind::Generator(closure_fn, substs, _) = self.tcx().type_of(alias.def_id).skip_binder().kind() { + if let ty::TyKind::Alias(ty::AliasTyKind::Opaque, alias) = + local_decls[mir::RETURN_PLACE].ty.kind() + && let ty::TyKind::Coroutine(closure_fn, substs) = + self.tcx().type_of(alias.def_id).skip_binder().kind() + { trace!(" fits opaque type"); v.extend( - self.get_reachable_and_self_markers( - try_resolve_function(self.tcx(), *closure_fn, ty::ParamEnv::reveal_all(), substs).unwrap() - )) + self.get_reachable_and_self_markers( + try_resolve_function( + self.tcx(), + *closure_fn, + TypingEnv::fully_monomorphized(), + substs, + ) + .unwrap(), + ), + ) }; v.into_iter() } @@ -384,9 +394,10 @@ impl<'tcx> MarkerCtx<'tcx> { pub fn deep_type_markers<'a>(&'a self, key: ty::Ty<'tcx>) -> &'a TypeMarkers { self.0 .type_markers - .get_maybe_recursive(key, |key| { + .get_maybe_recursive(&key, |key| { use ty::*; let mut markers = self.shallow_type_markers(key).collect::>(); + let dcx = self.tcx().dcx(); match key.kind() { Bool | Char @@ -398,9 +409,9 @@ impl<'tcx> MarkerCtx<'tcx> { | FnDef { .. } | FnPtr { .. } | Closure { .. } - | Generator { .. } - | GeneratorWitness { .. } - | GeneratorWitnessMIR { .. } + | Coroutine(..) + | CoroutineWitness(..) + | CoroutineClosure(..) | Never | Bound { .. } | Error(_) => (), @@ -409,24 +420,23 @@ impl<'tcx> MarkerCtx<'tcx> { markers.extend(tys.iter().flat_map(|ty| self.deep_type_markers(ty))) } Alias(_, _) => { - trace!("Alias type {key:?} remains. Was not normalized."); + dcx.warn(format!("Alias type {key:?} remains. Was not normalized.")); return Box::new([]); } + Pat(ty, _) => { + return self.deep_type_markers(*ty).into(); + } // We can't track indices so we simply overtaint to the entire array Array(inner, _) | Slice(inner) => { markers.extend(self.deep_type_markers(*inner)) } - RawPtr(ty::TypeAndMut { ty, .. }) | Ref(_, ty, _) => { - markers.extend(self.deep_type_markers(*ty)) + RawPtr(ty, _) | Ref(_, ty, _) => markers.extend(self.deep_type_markers(*ty)), + Param(_) | Dynamic { .. } => { + dcx.warn(format!("Cannot determine markers for type {key:?}")) + } + Placeholder(_) | Infer(_) => { + dcx.fatal(format!("Did not expect this type here {key:?}")) } - Param(_) | Dynamic { .. } => self - .tcx() - .sess - .warn(format!("Cannot determine markers for type {key:?}")), - Placeholder(_) | Infer(_) => self - .tcx() - .sess - .fatal(format!("Did not expect this type here {key:?}")), } markers.into_iter().collect() }) @@ -437,18 +447,26 @@ impl<'tcx> MarkerCtx<'tcx> { &'a self, adt: &'a ty::AdtDef<'tcx>, generics: &'tcx ty::List>, - ) -> impl Iterator { - let tcx = self.tcx(); - adt.variants() - .iter_enumerated() - .flat_map(move |(_, vdef)| { - vdef.fields.iter_enumerated().flat_map(move |(_, fdef)| { - let f_ty = fdef.ty(tcx, generics); - self.deep_type_markers(f_ty) - }) - }) - .collect::>() - .into_iter() + ) -> impl Iterator + use<'tcx, 'a> { + if adt.is_phantom_data() { + Either::Left( + generics + .iter() + .filter_map(|g| g.as_type()) + .flat_map(|t| self.deep_type_markers(t)), + ) + } else { + let tcx = self.tcx(); + Either::Right( + adt.variants().iter_enumerated().flat_map(move |(_, vdef)| { + vdef.fields.iter_enumerated().flat_map(move |(_, fdef)| { + let f_ty = fdef.ty(tcx, generics); + self.deep_type_markers(f_ty) + }) + }), //.collect::>(), //.into_iter(), + ) + } + .into_iter() } pub fn type_has_surface_markers(&self, ty: ty::Ty) -> Option { @@ -484,7 +502,7 @@ impl<'tcx> MarkerCtx<'tcx> { // XXX I'm not entirely sure this is how we should do // this. For now I'm calling this "okay" because it's // basically the old behavior - if output.is_closure() || output.is_generator() { + if output.is_closure() || output.is_coroutine() { return None; } Some( @@ -687,10 +705,10 @@ impl ExternalAnnotationEntry { None }; if let Some(complaint) = merror { - tcx.sess.err(format!("External marker annotation should specify either a 'marker' or a 'markers' field, found {complaint} for {}", tcx.def_path_str(element))); + tcx.dcx().err(format!("External marker annotation should specify either a 'marker' or a 'markers' field, found {complaint} for {}", tcx.def_path_str(element))); } if !self.refinement.on_self() && !self.refinements.is_empty() { - tcx.sess.err(format!("External marker annotation should specify either a single refinement or the 'refinements' field, found both for {}", tcx.def_path_str(element))); + tcx.dcx().err(format!("External marker annotation should specify either a single refinement or the 'refinements' field, found both for {}", tcx.def_path_str(element))); } } } diff --git a/crates/paralegal-flow/src/ann/mod.rs b/crates/paralegal-flow/src/ann/mod.rs index fbb7013ee1..e8fecdc0bb 100644 --- a/crates/paralegal-flow/src/ann/mod.rs +++ b/crates/paralegal-flow/src/ann/mod.rs @@ -31,17 +31,7 @@ use crate::{discover::AttrMatchT, sym_vec, utils::MetaItemMatch}; /// and [`Self::as_exception`] are provided. These are particularly useful in /// conjunction with e.g. [`Iterator::filter_map`] #[derive( - PartialEq, - Eq, - PartialOrd, - Ord, - Debug, - Clone, - Deserialize, - Serialize, - strum::EnumIs, - Encodable, - Decodable, + PartialEq, Eq, Debug, Clone, Deserialize, Serialize, strum::EnumIs, Encodable, Decodable, )] pub enum Annotation { Marker(MarkerAnnotation), @@ -269,7 +259,7 @@ impl<'tcx> intravisit::Visitor<'tcx> for DumpingVisitor<'tcx> { } } -impl<'tcx> DumpingVisitor<'tcx> { +impl DumpingVisitor<'_> { fn try_parse_annotation( &self, a: &Attribute, diff --git a/crates/paralegal-flow/src/ann/parse.rs b/crates/paralegal-flow/src/ann/parse.rs index 3c6a074ec7..0ace117c85 100644 --- a/crates/paralegal-flow/src/ann/parse.rs +++ b/crates/paralegal-flow/src/ann/parse.rs @@ -72,7 +72,7 @@ impl<'a> I<'a> { } } -impl<'a> std::fmt::Debug for I<'a> { +impl std::fmt::Debug for I<'_> { /// This only exists so we can use the standard `nom::Err`. A better /// solution would be to make our own error type that does not rely on this /// being printable. @@ -85,7 +85,7 @@ impl<'a> std::fmt::Debug for I<'a> { } } -impl<'a> nom::InputLength for I<'a> { +impl nom::InputLength for I<'_> { fn input_len(&self) -> usize { // Cloning is cheap, because this is just a pointer + a count self.clone().0.count() @@ -177,7 +177,7 @@ pub fn delimited<'a, A, P: Parser, A, Error>> + 'a>( nom::combinator::map_res( nom::combinator::map_res( nom::combinator::map_res(one, move |t| match t { - TokenTree::Delimited(_, d, s) if *d == delim => Ok(s), + TokenTree::Delimited(_, _, d, s) if *d == delim => Ok(s), _ => Result::Err(""), }), move |s| p.parse(I::from_stream(s)), @@ -240,8 +240,7 @@ pub fn tiny_bitset(i: I) -> R { pub(crate) fn otype_ann_match(ann: &ast::AttrArgs, tcx: TyCtxt) -> Result, String> { match ann { ast::AttrArgs::Delimited(dargs) => { - let mut parser = - rustc_parser::Parser::new(&tcx.sess.parse_sess, dargs.tokens.clone(), None); + let mut parser = rustc_parser::Parser::new(&tcx.sess.psess, dargs.tokens.clone(), None); std::iter::from_fn(|| { if parser.token.kind == TokenKind::Eof { return None; diff --git a/crates/paralegal-flow/src/args.rs b/crates/paralegal-flow/src/args.rs index 93d48df7e1..05ba5b475d 100644 --- a/crates/paralegal-flow/src/args.rs +++ b/crates/paralegal-flow/src/args.rs @@ -9,6 +9,10 @@ //! allow us to change the name and default value of the argument without having //! to migrate the code using that argument. +// Unfortunately we have to do this, because num-traits::FromPrimitive generates +// code that triggers this lint +#![allow(non_local_definitions)] + use anyhow::Error; use clap::ValueEnum; use std::collections::HashMap; diff --git a/crates/paralegal-flow/src/bin/cargo-paralegal-flow.rs b/crates/paralegal-flow/src/bin/cargo-paralegal-flow.rs index 3d920d708c..5c8345b540 100644 --- a/crates/paralegal-flow/src/bin/cargo-paralegal-flow.rs +++ b/crates/paralegal-flow/src/bin/cargo-paralegal-flow.rs @@ -1,3 +1,5 @@ +#![feature(rustc_private)] + extern crate rustc_plugin; fn main() { rustc_plugin::cli_main(paralegal_flow::DfppPlugin); diff --git a/crates/paralegal-flow/src/bin/paralegal-flow.rs b/crates/paralegal-flow/src/bin/paralegal-flow.rs index bb4de87d1f..1703c243e2 100644 --- a/crates/paralegal-flow/src/bin/paralegal-flow.rs +++ b/crates/paralegal-flow/src/bin/paralegal-flow.rs @@ -1,3 +1,5 @@ +#![feature(rustc_private)] + extern crate rustc_plugin; fn main() { diff --git a/crates/paralegal-flow/src/discover.rs b/crates/paralegal-flow/src/discover.rs index c63616de9b..c4943cfff1 100644 --- a/crates/paralegal-flow/src/discover.rs +++ b/crates/paralegal-flow/src/discover.rs @@ -77,7 +77,7 @@ impl<'tcx> CollectingVisitor<'tcx> { .filter_map(|path| { let def_id = expect_resolve_string_to_def_id(tcx, path, opts.relaxed())?; if !def_id.is_local() { - tcx.sess.span_err(tcx.def_span(def_id), format!("found an external function {def_id:?} as analysis target. Analysis targets are required to be local.")); + tcx.dcx().span_err(tcx.def_span(def_id), format!("found an external function {def_id:?} as analysis target. Analysis targets are required to be local.")); return None; } Some(FnToAnalyze { diff --git a/crates/paralegal-flow/src/lib.rs b/crates/paralegal-flow/src/lib.rs index 44203d876c..03d2d4af5d 100644 --- a/crates/paralegal-flow/src/lib.rs +++ b/crates/paralegal-flow/src/lib.rs @@ -30,7 +30,6 @@ extern crate rustc_borrowck; extern crate rustc_data_structures; extern crate rustc_driver; extern crate rustc_errors; -extern crate rustc_hash; extern crate rustc_hir; extern crate rustc_index; extern crate rustc_interface; @@ -195,32 +194,30 @@ fn dump_mir_and_update_stats(tcx: TyCtxt, timer: &mut DumpStats) { timer.tycheck_time = tycheck_time; } -impl<'a> rustc_driver::Callbacks for DumpOnlyCallbacks<'a> { - fn after_expansion<'tcx>( +impl rustc_driver::Callbacks for DumpOnlyCallbacks<'_> { + fn after_expansion( &mut self, _compiler: &rustc_interface::interface::Compiler, - queries: &'tcx rustc_interface::Queries<'tcx>, + tcx: TyCtxt<'_>, ) -> rustc_driver::Compilation { - queries.global_ctxt().unwrap().enter(|tcx| { - dump_mir_and_update_stats(tcx, self.time); - assert!(self - .output_location - .replace(intermediate_out_dir(tcx, INTERMEDIATE_STAT_EXT)) - .is_none()); - }); + dump_mir_and_update_stats(tcx, self.time); + assert!(self + .output_location + .replace(intermediate_out_dir(tcx, INTERMEDIATE_STAT_EXT)) + .is_none()); rustc_driver::Compilation::Continue } } -impl<'a> rustc_driver::Callbacks for Callbacks<'a> { - fn after_expansion<'tcx>( +impl rustc_driver::Callbacks for Callbacks<'_> { + fn after_expansion( &mut self, _compiler: &rustc_interface::interface::Compiler, - queries: &'tcx rustc_interface::Queries<'tcx>, + tcx: TyCtxt<'_>, ) -> rustc_driver::Compilation { self.stats .record_timed(TimedStat::Rustc, self.stats.elapsed()); - let compilation = self.run_the_analyzer(queries); + let compilation = self.run_the_analyzer(tcx); self.rustc_second_timer = Some(Instant::now()); compilation } @@ -230,11 +227,10 @@ impl<'a> rustc_driver::Callbacks for Callbacks<'a> { // `after_expansion` and so far that doesn't seem to break anything, but I'm // explaining this here in case that flowistry has some sort of issue with // that (when retrieving the MIR bodies for instance) - fn after_analysis<'tcx>( + fn after_analysis( &mut self, - _handler: &rustc_session::EarlyErrorHandler, _compiler: &rustc_interface::interface::Compiler, - _queries: &'tcx rustc_interface::Queries<'tcx>, + _tcx: TyCtxt<'_>, ) -> rustc_driver::Compilation { self.stats .record_timed(TimedStat::Rustc, self.rustc_second_timer.unwrap().elapsed()); @@ -242,52 +238,42 @@ impl<'a> rustc_driver::Callbacks for Callbacks<'a> { } } -impl<'a> Callbacks<'a> { - fn run_the_analyzer<'tcx>( - &mut self, - queries: &'tcx rustc_interface::Queries<'tcx>, - ) -> rustc_driver::Compilation { - let abort = queries - .global_ctxt() - .unwrap() - .enter(|tcx| { - dump_markers(tcx); - tcx.sess.abort_if_errors(); - let (desc, mut stats) = - discover::CollectingVisitor::new(tcx, self.opts, self.stats.clone()).run()?; - info!("All elems walked"); - tcx.sess.abort_if_errors(); - - if self.opts.dbg().dump_spdg() { - let out = std::fs::File::create("call-only-flow.gv").unwrap(); - paralegal_spdg::dot::dump(&desc, out).unwrap(); - } +impl Callbacks<'_> { + fn run_the_analyzer(&mut self, tcx: TyCtxt<'_>) -> rustc_driver::Compilation { + dump_markers(tcx); + tcx.dcx().abort_if_errors(); + let (desc, mut stats) = + discover::CollectingVisitor::new(tcx, self.opts, self.stats.clone()) + .run() + .unwrap(); + info!("All elems walked"); + tcx.dcx().abort_if_errors(); + + if self.opts.dbg().dump_spdg() { + let out = std::fs::File::create("call-only-flow.gv").unwrap(); + paralegal_spdg::dot::dump(&desc, out).unwrap(); + } - self.stats.measure(TimedStat::Serialization, || { - desc.canonical_write(self.opts.result_path()).unwrap() - }); + self.stats.measure(TimedStat::Serialization, || { + desc.canonical_write(self.opts.result_path()).unwrap() + }); - stats.serialization_time = self.stats.get_timed(TimedStat::Serialization); + stats.serialization_time = self.stats.get_timed(TimedStat::Serialization); - println!("Analysis finished with timing: {}", self.stats); + println!("Analysis finished with timing: {}", self.stats); - assert!(self.stat_ref.replace(stats).is_none()); + assert!(self.stat_ref.replace(stats).is_none()); - assert!(self - .output_location - .replace(intermediate_out_dir(tcx, INTERMEDIATE_STAT_EXT)) - .is_none()); - anyhow::Ok(self.opts.abort_after_analysis()) - }) - .unwrap(); + assert!(self + .output_location + .replace(intermediate_out_dir(tcx, INTERMEDIATE_STAT_EXT)) + .is_none()); - if abort { + if self.opts.abort_after_analysis() { rustc_driver::Compilation::Stop } else { - queries.global_ctxt().unwrap().enter(|tcx| { - self.stats.measure(TimedStat::MirEmission, || { - dump_mir_and_update_stats(tcx, self.time); - }) + self.stats.measure(TimedStat::MirEmission, || { + dump_mir_and_update_stats(tcx, self.time); }); rustc_driver::Compilation::Continue } @@ -331,6 +317,12 @@ struct CrateInfo { is_build_script: bool, } +impl CrateInfo { + pub fn name_or_default(&self) -> &str { + self.name.as_deref().unwrap_or("unnamed") + } +} + /// Also adds and additional features required by the Paralegal build config fn how_to_handle_this_crate(plugin_args: &Args, compiler_args: &mut Vec) -> CrateInfo { let crate_name = compiler_args @@ -489,12 +481,12 @@ impl rustc_plugin::RustcPlugin for DfppPlugin { let out_path = plugin_args.result_path().to_owned(); let info = how_to_handle_this_crate(&plugin_args, &mut compiler_args); - println!( + debug!( "Handling crate {} as {}", - info.name.as_ref().map_or("unnamed", String::as_str), + info.name_or_default(), info.handling.as_ref() ); - let result = { + { let mut callbacks = match info.handling { CrateHandling::JustCompile => { Box::new(NoopCallbacks) as Box @@ -544,7 +536,7 @@ impl rustc_plugin::RustcPlugin for DfppPlugin { } }; - rustc_driver::RunCompiler::new(&compiler_args, callbacks.as_mut()).run() + rustc_driver::RunCompiler::new(&compiler_args, callbacks.as_mut()).run(); }; if info.handling != CrateHandling::JustCompile { let filepath = output_path_location @@ -566,7 +558,8 @@ impl rustc_plugin::RustcPlugin for DfppPlugin { stat.self_time = self_time; serde_json::to_writer(out, &stat).unwrap(); } - result + debug!("Finished with crate {}", info.name_or_default()); + Ok(()) } } diff --git a/crates/paralegal-flow/src/test_utils.rs b/crates/paralegal-flow/src/test_utils.rs index b512f6d7e4..cacd3b2f7f 100644 --- a/crates/paralegal-flow/src/test_utils.rs +++ b/crates/paralegal-flow/src/test_utils.rs @@ -5,7 +5,7 @@ extern crate rustc_middle; extern crate rustc_span; use hir::def_id::DefId; -use rustc_interface::interface; +use rustc_errors::FatalError; use crate::{ ann::dump_markers, @@ -63,7 +63,7 @@ pub fn with_current_directory< /// Be aware that any [`Symbol`] created in `F` will **not** compare equal to /// [`Symbol`]s created after `F` and may cause dereference errors. pub fn use_rustc A>(f: F) -> A { - rustc_span::create_default_session_if_not_set_then(|_| f()) + rustc_span::create_session_if_not_set_then(rustc_span::edition::DEFAULT_EDITION, |_| f()) } /// Crates a basic invocation of `cargo paralegal-flow`, ensuring that the `cargo-paralegal-flow` @@ -239,7 +239,7 @@ impl InlineTestBuilder { .unwrap() } - pub fn run(&self, f: impl FnOnce(PreFrg) + Send) -> interface::Result<()> { + pub fn run(&self, f: impl FnOnce(PreFrg) + Send) -> Result<(), FatalError> { use clap::Parser; #[derive(clap::Parser)] @@ -259,7 +259,6 @@ impl InlineTestBuilder { rustc_utils::test_utils::CompileBuilder::new(&self.input) .with_args(EXTRA_RUSTC_ARGS.iter().copied().map(ToOwned::to_owned)) - .with_query_override(None) .compile(move |result| { let args: &'static _ = Box::leak(Box::new(args)); dump_markers(result.tcx); @@ -300,7 +299,7 @@ pub trait HasGraph<'g>: Sized + Copy { let name = Identifier::new_intern(name.as_ref()); let id = match self.graph().name_map.get(&name).map(Vec::as_slice) { Some([one]) => *one, - Some([]) | None => panic!("Did not find name {name}"), + Some([]) | None => panic!("Did not find name {name}",), _ => panic!("Found too many function matching name {name}"), }; FnRef { @@ -310,7 +309,7 @@ pub trait HasGraph<'g>: Sized + Copy { } fn async_function(self, name: impl AsRef) -> FnRef<'g> { - self.function(format!("{}_generator", name.as_ref())) + self.function(format!("{}_coroutine", name.as_ref())) } fn info_for(self, id: DefId) -> &'g DefInfo { @@ -407,7 +406,7 @@ pub struct CtrlRef<'g> { ctrl: &'g SPDG, } -impl<'g> Debug for CtrlRef<'g> { +impl Debug for CtrlRef<'_> { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { f.debug_struct("CtrlRef") .field("ident", &self.ctrl.name) @@ -415,7 +414,7 @@ impl<'g> Debug for CtrlRef<'g> { } } -impl<'g> PartialEq for CtrlRef<'g> { +impl PartialEq for CtrlRef<'_> { fn eq(&self, other: &Self) -> bool { self.id == other.id } @@ -471,7 +470,7 @@ impl<'g> CtrlRef<'g> { instruction_info[&m.leaf()] .kind .as_function_call() - .map_or(false, |i| i.id == fun.ident) + .is_some_and(|i| i.id == fun.ident) }) .map(|call_site| CallStringRef { ctrl: self, @@ -492,7 +491,7 @@ impl<'g> CtrlRef<'g> { cs.pop().unwrap() } - pub fn types_for(&'g self, target: Node) -> &[DefId] { + pub fn types_for(&'g self, target: Node) -> &'g [DefId] { self.ctrl .type_assigns .get(&target) @@ -548,7 +547,7 @@ impl PartialEq for CallStringRef<'_> { impl Eq for CallStringRef<'_> {} -impl<'g> PartialEq for CallStringRef<'g> { +impl PartialEq for CallStringRef<'_> { fn eq(&self, other: &CallString) -> bool { self.call_site == *other } @@ -658,7 +657,7 @@ impl<'g> HasGraph<'g> for &NodeRef<'g> { } } -impl<'g> NodeRef<'g> { +impl NodeRef<'_> { pub fn node(&self) -> Node { self.node } diff --git a/crates/paralegal-flow/src/utils/mod.rs b/crates/paralegal-flow/src/utils/mod.rs index cf38d73e09..511c00181a 100644 --- a/crates/paralegal-flow/src/utils/mod.rs +++ b/crates/paralegal-flow/src/utils/mod.rs @@ -19,13 +19,13 @@ use rustc_hir::{ BodyId, }; use rustc_middle::{ - mir::{self, Constant, Location, Place, ProjectionElem, Terminator}, - ty::{self, GenericArgsRef, Instance, Ty}, + mir::{self, ConstOperand, Location, Place, ProjectionElem, Terminator}, + ty::{self, GenericArgsRef, Instance, Ty, TypingEnv}, }; use rustc_span::{symbol::Ident, Span as RustSpan, Span}; use rustc_target::spec::abi::Abi; -use std::{cmp::Ordering, hash::Hash}; +use std::cmp::Ordering; mod print; pub mod resolve; @@ -156,14 +156,14 @@ pub trait TyExt: Sized { fn defid_ref(&self) -> Option<&DefId>; } -impl<'tcx> TyExt for ty::Ty<'tcx> { +impl TyExt for ty::Ty<'_> { fn defid_ref(&self) -> Option<&DefId> { match self.kind() { ty::TyKind::Adt(ty::AdtDef(Interned(ty::AdtDefData { did, .. }, _)), _) => Some(did), ty::TyKind::Foreign(did) | ty::TyKind::FnDef(did, _) | ty::TyKind::Closure(did, _) - | ty::TyKind::Generator(did, _, _) => Some(did), + | ty::TyKind::Coroutine(did, _) => Some(did), _ => None, } } @@ -245,32 +245,23 @@ pub trait InstanceExt<'tcx> { impl<'tcx> InstanceExt<'tcx> for Instance<'tcx> { fn sig(self, tcx: TyCtxt<'tcx>) -> Result, ErrorGuaranteed> { - let sess = tcx.sess; let def_id = self.def_id(); - let def_span = tcx.def_span(def_id); let fn_kind = FunctionKind::for_def_id(tcx, def_id)?; + let typing_env = TypingEnv::fully_monomorphized(); let late_bound_sig = match fn_kind { FunctionKind::Generator => { - let gen = self.args.as_generator(); + let gen = self.args.as_coroutine(); ty::Binder::dummy(ty::FnSig { inputs_and_output: tcx.mk_type_list(&[gen.resume_ty(), gen.return_ty()]), c_variadic: false, - unsafety: hir::Unsafety::Normal, abi: Abi::Rust, + safety: hir::Safety::Safe, }) } FunctionKind::Closure => self.args.as_closure().sig(), - FunctionKind::Plain => self.ty(tcx, ty::ParamEnv::reveal_all()).fn_sig(tcx), + FunctionKind::Plain => self.ty(tcx, typing_env).fn_sig(tcx), }; - Ok(tcx - .try_normalize_erasing_late_bound_regions(ty::ParamEnv::reveal_all(), late_bound_sig) - .unwrap_or_else(|e| { - sess.span_warn( - def_span, - format!("Could not erase regions in {late_bound_sig:?}: {e:?}"), - ); - late_bound_sig.skip_binder() - })) + Ok(tcx.normalize_erasing_late_bound_regions(typing_env, late_bound_sig)) } } @@ -290,15 +281,15 @@ pub enum FunctionKind { impl FunctionKind { pub fn for_def_id(tcx: TyCtxt, def_id: DefId) -> Result { - if tcx.generator_kind(def_id).is_some() { + if tcx.coroutine_kind(def_id).is_some() { Ok(Self::Generator) - } else if tcx.is_closure(def_id) { + } else if tcx.is_closure_like(def_id) { Ok(Self::Closure) } else if tcx.def_kind(def_id).is_fn_like() { Ok(Self::Plain) } else { Err(tcx - .sess + .dcx() .span_err(tcx.def_span(def_id), "Expected this item to be a function.")) } } @@ -372,11 +363,11 @@ pub enum AsFnAndArgsErr<'tcx> { InstanceTooUnspecific, } -pub fn ty_of_const<'tcx>(c: &Constant<'tcx>) -> Ty<'tcx> { - match c.literal { - mir::ConstantKind::Val(_, ty) => ty, - mir::ConstantKind::Ty(cst) => cst.ty(), - mir::ConstantKind::Unevaluated { .. } => unreachable!(), +pub fn ty_of_const<'tcx>(c: &ConstOperand<'tcx>) -> Ty<'tcx> { + match c.const_ { + mir::Const::Val(_, ty) => ty, + mir::Const::Ty(cst, _) => cst, + mir::Const::Unevaluated { .. } => unreachable!(), } } @@ -397,16 +388,17 @@ impl<'tcx> AsFnAndArgs<'tcx> for mir::Terminator<'tcx> { }; let ty = ty_of_const(func.constant().ok_or(AsFnAndArgsErr::NotAConstant)?); let Some((def_id, gargs)) = type_as_fn(tcx, ty) else { - return Err(AsFnAndArgsErr::NotFunctionType(ty.kind().clone())); + return Err(AsFnAndArgsErr::NotFunctionType(*ty.kind())); }; test_generics_normalization(tcx, gargs) .map_err(|e| AsFnAndArgsErr::NormalizationError(format!("{e:?}")))?; - let instance = ty::Instance::resolve(tcx, ty::ParamEnv::reveal_all(), def_id, gargs) - .map_err(|_| AsFnAndArgsErr::InstanceResolutionErr)? - .ok_or(AsFnAndArgsErr::InstanceTooUnspecific)?; + let instance = + ty::Instance::try_resolve(tcx, TypingEnv::fully_monomorphized(), def_id, gargs) + .map_err(|_| AsFnAndArgsErr::InstanceResolutionErr)? + .ok_or(AsFnAndArgsErr::InstanceTooUnspecific)?; Ok(( instance, - args.iter().map(|a| a.place()).collect(), + args.iter().map(|a| a.node.place()).collect(), *destination, )) } @@ -424,7 +416,7 @@ fn test_generics_normalization<'tcx>( tcx: TyCtxt<'tcx>, args: &'tcx ty::List>, ) -> Result<(), ty::normalize_erasing_regions::NormalizationError<'tcx>> { - tcx.try_normalize_erasing_regions(ty::ParamEnv::reveal_all(), args) + tcx.try_normalize_erasing_regions(TypingEnv::fully_monomorphized(), args) .map(|_| ()) } @@ -451,7 +443,7 @@ pub enum Overlap<'tcx> { Child(&'tcx [mir::PlaceElem<'tcx>]), } -impl<'tcx> Overlap<'tcx> { +impl Overlap<'_> { pub fn contains_other(self) -> bool { matches!(self, Overlap::Equal | Overlap::Parent(_)) } @@ -622,26 +614,9 @@ impl IntoDefId for Res { } } -pub trait IntoHirId: std::marker::Sized { - fn into_hir_id(self, tcx: TyCtxt) -> Option; - - #[inline] - fn force_into_hir_id(self, tcx: TyCtxt) -> HirId { - self.into_hir_id(tcx).unwrap() - } -} - -impl IntoHirId for LocalDefId { - #[inline] - fn into_hir_id(self, tcx: TyCtxt) -> Option { - Some(tcx.hir().local_def_id_to_hir_id(self)) - } -} - /// Get a reasonable, but not guaranteed unique name for this item -pub fn identifier_for_item(tcx: TyCtxt, did: D) -> Identifier { +pub fn identifier_for_item(tcx: TyCtxt, did: DefId) -> Identifier { // TODO Make a generic version instead of just copying `unique_identifier_for_item` - let did = did.into_def_id(tcx); let get_parent = || identifier_for_item(tcx, tcx.parent(did)); Identifier::new_intern( &tcx.opt_item_name(did) @@ -650,8 +625,14 @@ pub fn identifier_for_item(tcx: TyCtxt, did: D) -> I use hir::def::DefKind::*; match tcx.def_kind(did) { OpaqueTy => Some("Opaque".to_string()), - Closure => Some(format!("{}_closure", get_parent())), - Generator => Some(format!("{}_generator", get_parent())), + Closure => { + let suffix = if tcx.is_coroutine(did) { + "coroutine" + } else { + "closure" + }; + Some(format!("{}_{}", get_parent(), suffix)) + } _ => None, } }) @@ -691,34 +672,6 @@ pub fn time R>(msg: &str, f: F) -> R { r } -pub trait IntoBodyId: Copy { - fn into_body_id(self, tcx: TyCtxt) -> Option; -} - -impl IntoBodyId for BodyId { - fn into_body_id(self, _tcx: TyCtxt) -> Option { - Some(self) - } -} - -impl IntoBodyId for HirId { - fn into_body_id(self, tcx: TyCtxt) -> Option { - self.as_owner()?.def_id.into_body_id(tcx) - } -} - -impl IntoBodyId for LocalDefId { - fn into_body_id(self, tcx: TyCtxt) -> Option { - tcx.hir().maybe_body_owned_by(self) - } -} - -impl IntoBodyId for DefId { - fn into_body_id(self, tcx: TyCtxt) -> Option { - self.as_local()?.into_body_id(tcx) - } -} - pub trait Spanned<'tcx> { fn span(&self, tcx: TyCtxt<'tcx>) -> Span; } diff --git a/crates/paralegal-flow/src/utils/resolve.rs b/crates/paralegal-flow/src/utils/resolve.rs index 39fd797944..e26f697c57 100644 --- a/crates/paralegal-flow/src/utils/resolve.rs +++ b/crates/paralegal-flow/src/utils/resolve.rs @@ -104,21 +104,22 @@ fn find_primitive_impls(tcx: TyCtxt<'_>, name: Symbol) -> impl Iterator Option { let report_err = if relaxed { |tcx: TyCtxt<'_>, err: String| { - tcx.sess.warn(err); + tcx.dcx().warn(err); } } else { |tcx: TyCtxt<'_>, err| { - tcx.sess.err(err); + tcx.dcx().err(err); } }; let mut hasher = StableHasher::new(); path.hash(&mut hasher); let mut parser = new_parser_from_source_str( - &tcx.sess.parse_sess, + &tcx.sess.psess, rustc_span::FileName::Anon(hasher.finish()), path.to_string(), - ); - let qpath = parser.parse_expr().map_err(|mut e| e.emit()).ok()?; + ) + .unwrap(); + let qpath = parser.parse_expr().map_err(|e| e.emit()).ok()?; if parser.token.kind != TokenKind::Eof { report_err(tcx, format!("Tokens left over after parsing path {path}")); return None; @@ -176,15 +177,16 @@ fn local_item_children_by_name( local_id: LocalDefId, name: Symbol, ) -> Option> { + use crate::rustc_hir::intravisit::Map; let hir = tcx.hir(); let root_mod; - let item_kind = match hir.find_by_def_id(local_id) { - Some(Node::Crate(r#mod)) => { + let item_kind = match hir.hir_node_by_def_id(local_id) { + Node::Crate(r#mod) => { root_mod = ItemKind::Mod(r#mod); &root_mod } - Some(Node::Item(item)) => &item.kind, + Node::Item(item) => &item.kind, _ => return None, }; @@ -258,7 +260,7 @@ fn resolve_ty<'tcx>(tcx: TyCtxt<'tcx>, t: &Ty) -> Result> { pub fn def_path_res(tcx: TyCtxt, qself: Option<&QSelf>, path: &[PathSegment]) -> Result { let no_generics_supported = |segment: &PathSegment| { if segment.args.is_some() { - tcx.sess.err(format!( + tcx.dcx().err(format!( "Generics are not supported in this position: {segment:?}" )); } diff --git a/crates/paralegal-flow/tests/clone-test.rs b/crates/paralegal-flow/tests/clone-test.rs index adcefc43ff..50859b8258 100644 --- a/crates/paralegal-flow/tests/clone-test.rs +++ b/crates/paralegal-flow/tests/clone-test.rs @@ -1,3 +1,5 @@ +#![feature(rustc_private)] + use paralegal_flow::test_utils::InlineTestBuilder; #[test] diff --git a/crates/paralegal-flow/tests/external_resolution_tests.rs b/crates/paralegal-flow/tests/external_resolution_tests.rs index 72e937eeee..0b3ae90469 100644 --- a/crates/paralegal-flow/tests/external_resolution_tests.rs +++ b/crates/paralegal-flow/tests/external_resolution_tests.rs @@ -1,3 +1,5 @@ +#![feature(rustc_private)] + use paralegal_flow::test_utils::InlineTestBuilder; #[test] diff --git a/crates/paralegal-flow/tests/marker-tests/src/main.rs b/crates/paralegal-flow/tests/marker-tests/src/main.rs index 39e23df1cb..e2cfff4ff8 100644 --- a/crates/paralegal-flow/tests/marker-tests/src/main.rs +++ b/crates/paralegal-flow/tests/marker-tests/src/main.rs @@ -11,11 +11,6 @@ fn consume_any(w: T) { unimplemented!() } -#[paralegal::analyze] -fn use_wrapper() { - consume_any(make_wrapper()) -} - trait Test { #[paralegal::marker(find_me, arguments = [0])] fn method(self); diff --git a/crates/paralegal-flow/tests/marker_tests.rs b/crates/paralegal-flow/tests/marker_tests.rs index 8ae77b08f9..84cda25820 100644 --- a/crates/paralegal-flow/tests/marker_tests.rs +++ b/crates/paralegal-flow/tests/marker_tests.rs @@ -7,12 +7,11 @@ use paralegal_flow::{define_flow_test_template, test_utils::*}; use paralegal_spdg::{Identifier, InstructionKind}; const TEST_CRATE_NAME: &str = "tests/marker-tests"; +const EXTRA_ARGS: &[&str] = &["--no-cross-function-analysis"]; lazy_static! { - static ref TEST_CRATE_ANALYZED: bool = run_paralegal_flow_with_flow_graph_dump_and( - TEST_CRATE_NAME, - ["--no-cross-function-analysis"] - ); + static ref TEST_CRATE_ANALYZED: bool = + run_paralegal_flow_with_flow_graph_dump_and(TEST_CRATE_NAME, EXTRA_ARGS); } macro_rules! define_test { @@ -21,17 +20,39 @@ macro_rules! define_test { }; } -define_test!(use_wrapper: ctrl -> { - let uwf = ctrl.function("make_wrapper"); - let cs = ctrl.call_site(&uwf); - println!("{:?}", &ctrl.graph().desc.type_info); - let tp = cs.output().as_singles().any(|n| - dbg!(ctrl.types_for(n.node())).iter().any(|t| - ctrl.graph().desc.type_info[t].rendering.contains("::Wrapper") - ) - ); - assert!(tp, "Type not found on method"); -}); +#[test] +fn use_wrapper() { + InlineTestBuilder::new(stringify! { + #[paralegal_flow::marker(wrapper)] + pub struct Wrapper(T); + + fn make_wrapper() -> Result>, String> { + unimplemented!() + } + + fn consume_any(w: T) { + unimplemented!() + } + fn main() { + consume_any(make_wrapper()) + } + }) + .with_extra_args(EXTRA_ARGS.iter().map(|s| s.to_string())) + .check_ctrl(|ctrl| { + let uwf = ctrl.function("make_wrapper"); + let cs = ctrl.call_site(&uwf); + println!("{:?}", &ctrl.graph().desc.type_info); + println!("{:?}", ctrl.spdg().type_assigns); + let tp = cs.output().as_singles().any(|n| { + dbg!(ctrl.types_for(n.node())).iter().any(|t| { + ctrl.graph().desc.type_info[t] + .rendering + .contains("::Wrapper") + }) + }); + assert!(tp, "Type not found on method"); + }); +} define_test!(trait_method_marker: ctrl -> { let marker = Identifier::new_intern("find_me"); diff --git a/crates/paralegal-flow/tests/rebuttal-tests.rs b/crates/paralegal-flow/tests/rebuttal-tests.rs index 7134d75acc..2b7f1d4def 100644 --- a/crates/paralegal-flow/tests/rebuttal-tests.rs +++ b/crates/paralegal-flow/tests/rebuttal-tests.rs @@ -1,3 +1,5 @@ +#![feature(rustc_private)] + use paralegal_flow::test_utils::{CtrlRef, FlowsTo, HasGraph, InlineTestBuilder, NodeRefs}; use paralegal_spdg::Identifier; @@ -108,7 +110,7 @@ fn plume_policy_exists_quantifier() { let result = policy(ctrl, |srcs, snks| srcs.flows_to_data(snks)); if expect_success { if let Err(e) = result { - panic!("Failed {e} {msg}") + panic!("Failed {e} in '{msg}' configuration") } } else { assert!(result.is_err(), "Expected fail on {msg}"); @@ -135,7 +137,7 @@ fn plume_policy_forall_quantifier() { }); if expect_success { if let Err(e) = result { - panic!("Failed {e} {msg}") + panic!("Failed {e} in '{msg}' configuration") } } else { assert!(result.is_err(), "Expected fail {msg}"); diff --git a/crates/paralegal-flow/tests/rejection.rs b/crates/paralegal-flow/tests/rejection.rs index f760e2d124..35f1cbf016 100644 --- a/crates/paralegal-flow/tests/rejection.rs +++ b/crates/paralegal-flow/tests/rejection.rs @@ -6,6 +6,7 @@ //! that trait have no reachable markers. //! //! It also checks that we allow approximation if no such markers are reachable. +#![feature(rustc_private)] use paralegal_flow::test_utils::InlineTestBuilder; diff --git a/crates/paralegal-policy/Cargo.toml b/crates/paralegal-policy/Cargo.toml index a7a0d30486..309e760e2c 100644 --- a/crates/paralegal-policy/Cargo.toml +++ b/crates/paralegal-policy/Cargo.toml @@ -12,11 +12,11 @@ anyhow = { workspace = true } itertools = "0.12" indexical = { workspace = true } serde_json = "1" -simple_logger = "2" +simple_logger = "5" lazy_static = "1" bitvec = "1" petgraph = { workspace = true } -colored = "1" +colored = "2" strum = { workspace = true } indexmap = "2.2.6" diff --git a/crates/paralegal-policy/build.rs b/crates/paralegal-policy/build.rs index a34a592f0b..da2107066e 100644 --- a/crates/paralegal-policy/build.rs +++ b/crates/paralegal-policy/build.rs @@ -22,6 +22,6 @@ fn main() { } let autocfg = autocfg::AutoCfg::new().unwrap(); - + println!("cargo::rustc-check-cfg=cfg(rustc_1_75)"); autocfg.emit_rustc_version(1, 75); } diff --git a/crates/paralegal-policy/src/algo/ahb.rs b/crates/paralegal-policy/src/algo/ahb.rs index 863f79666e..0164e97762 100644 --- a/crates/paralegal-policy/src/algo/ahb.rs +++ b/crates/paralegal-policy/src/algo/ahb.rs @@ -149,7 +149,7 @@ impl crate::RootContext { let select_data = |e: <&SPDGImpl as IntoEdgeReferences>::EdgeRef| e.weight().is_data(); for (ctrl_id, starts) in &start_map { - let spdg = &self.desc().controllers[&ctrl_id]; + let spdg = &self.desc().controllers[ctrl_id]; let g = EdgeFiltered::from_fn(&spdg.graph, select_data); let mut tracer = Tracer::new(&mut trace, g.node_bound(), starts.iter().copied(), *ctrl_id); diff --git a/crates/paralegal-policy/src/algo/flows_to.rs b/crates/paralegal-policy/src/algo/flows_to.rs index 196548f232..bd102de65e 100644 --- a/crates/paralegal-policy/src/algo/flows_to.rs +++ b/crates/paralegal-policy/src/algo/flows_to.rs @@ -95,7 +95,7 @@ impl<'a> DataAndControlInfluencees<'a> { } } -impl<'a> Iterator for DataAndControlInfluencees<'a> { +impl Iterator for DataAndControlInfluencees<'_> { type Item = SPDGNode; fn next(&mut self) -> Option { self.walker.next() diff --git a/crates/paralegal-policy/src/context.rs b/crates/paralegal-policy/src/context.rs index 214c456788..a7c1f7088f 100644 --- a/crates/paralegal-policy/src/context.rs +++ b/crates/paralegal-policy/src/context.rs @@ -343,8 +343,8 @@ impl RootContext { /// `some n where self.flows_to(influencer, n, EdgeSelection::Data) && self.flows_to(n, target, EdgeSelection::Control)`. pub fn has_ctrl_influence( &self, - influencer: impl IntoIterGlobalNodes + Sized + Copy, - target: impl IntoIterGlobalNodes + Sized + Copy, + influencer: impl IntoIterGlobalNodes, + target: impl IntoIterGlobalNodes, ) -> bool { influencer.has_ctrl_influence(target, self) } @@ -354,7 +354,7 @@ impl RootContext { /// Does not return the input node. A CallSite sink will return all of the associated CallArgument nodes. pub fn influencers( &self, - sink: impl IntoIterGlobalNodes + Sized, + sink: impl IntoIterGlobalNodes, edge_type: EdgeSelection, ) -> impl Iterator + '_ { sink.influencers(self, edge_type).into_iter() @@ -365,7 +365,7 @@ impl RootContext { /// Does not return the input node. A CallArgument src will return the associated CallSite. pub fn influencees( &self, - src: impl IntoIterGlobalNodes + Sized, + src: impl IntoIterGlobalNodes, edge_type: EdgeSelection, ) -> impl Iterator + '_ { src.influencees(self, edge_type).into_iter() @@ -546,11 +546,12 @@ impl RootContext { node.predecessors(self) } + /// Returns all nodes n steps removed from this one #[cfg(test)] pub fn nth_successors( &self, n: usize, - src: impl IntoIterGlobalNodes + Sized, + src: impl IntoIterGlobalNodes, ) -> paralegal_spdg::NodeCluster { let mut start: Vec<_> = src.iter_nodes().collect(); let ctrl = &self.desc.controllers[&src.controller_id()].graph; @@ -779,11 +780,7 @@ where /// Returns whether there is direct control flow influence from influencer to sink, or there is some node which is data-flow influenced by `influencer` and has direct control flow influence on `target`. Or as expressed in code: /// /// `some n where self.flows_to(influencer, n, EdgeSelection::Data) && self.flows_to(n, target, EdgeSelection::Control)`. - fn has_ctrl_influence( - self, - target: impl IntoIterGlobalNodes + Sized + Copy, - ctx: &RootContext, - ) -> bool { + fn has_ctrl_influence(self, target: impl IntoIterGlobalNodes, ctx: &RootContext) -> bool { self.flows_to(target, ctx, EdgeSelection::Control) || NodeCluster::try_from_iter(self.influencees(ctx, EdgeSelection::Data)) .unwrap() @@ -874,7 +871,7 @@ impl NodeExt for GlobalNode { ctx.desc().controllers[&self.controller_id()] .type_assigns .get(&self.local_node()) - .map_or(false, |tys| tys.0.contains(&t)) + .is_some_and(|tys| tys.0.contains(&t)) } fn associated_call_site(self, ctx: &RootContext) -> CallString { ctx.desc.controllers[&self.controller_id()] @@ -1036,7 +1033,7 @@ pub struct DisplayDef<'a> { pub ctx: &'a RootContext, } -impl<'a> std::fmt::Display for DisplayDef<'a> { +impl std::fmt::Display for DisplayDef<'_> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { use std::fmt::Write; let info = &self.ctx.desc().def_info[&self.def_id]; @@ -1071,7 +1068,7 @@ fn test_context() { .desc .def_info .get(id) - .map_or(false, |info| info.name.as_str().starts_with("Foo")))); + .is_some_and(|info| info.name.as_str().starts_with("Foo")))); let controller = ctx .controller_by_name(Identifier::new_intern("controller")) diff --git a/crates/paralegal-policy/src/diagnostics.rs b/crates/paralegal-policy/src/diagnostics.rs index bf8222fa91..1ee9fbea56 100644 --- a/crates/paralegal-policy/src/diagnostics.rs +++ b/crates/paralegal-policy/src/diagnostics.rs @@ -300,12 +300,7 @@ impl DiagnosticPart { } else { line_length_while(&line_content, char::is_whitespace) }; - let highlight_len = if end < start { - // TODO figure out how this happens - 0 - } else { - end - start - }; + let highlight_len = end.saturating_sub(start); write!(s, "{tab} {} {:start$}", "|".blue(), "")?; for _ in 0..highlight_len { write!(s, "{}", "^".color(coloring))?; @@ -377,7 +372,7 @@ impl<'a, A: ?Sized> DiagnosticBuilder<'a, A> { } } -impl<'a, A: HasDiagnosticsBase + ?Sized> DiagnosticBuilder<'a, A> { +impl DiagnosticBuilder<'_, A> { /// Queue the diagnostic for display to the user. pub fn emit(self) { self.base.record(self.diagnostic) @@ -1040,7 +1035,7 @@ pub(crate) struct DiagnosticsRecorder(std::sync::Mutex> struct DisplayDiagnostic<'a>(&'a Diagnostic); -impl<'a> std::fmt::Display for DisplayDiagnostic<'a> { +impl std::fmt::Display for DisplayDiagnostic<'_> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { self.0.write(f) } diff --git a/crates/paralegal-policy/src/lib.rs b/crates/paralegal-policy/src/lib.rs index b8a557da7f..908846b558 100644 --- a/crates/paralegal-policy/src/lib.rs +++ b/crates/paralegal-policy/src/lib.rs @@ -49,6 +49,7 @@ #![warn(missing_docs)] #![cfg_attr(not(rustc_1_75), feature(return_position_impl_trait_in_trait))] +#![cfg_attr(test, feature(rustc_private))] extern crate core; diff --git a/crates/paralegal-policy/tests/adaptive-depth.rs b/crates/paralegal-policy/tests/adaptive-depth.rs index e7903fd5f6..03c95d74f1 100644 --- a/crates/paralegal-policy/tests/adaptive-depth.rs +++ b/crates/paralegal-policy/tests/adaptive-depth.rs @@ -1,3 +1,5 @@ +#![feature(rustc_private)] + use anyhow::Result; use helpers::Test; use paralegal_policy::{assert_error, Context, EdgeSelection}; diff --git a/crates/paralegal-policy/tests/atomic.rs b/crates/paralegal-policy/tests/atomic.rs index 20ca22a762..30359c901f 100644 --- a/crates/paralegal-policy/tests/atomic.rs +++ b/crates/paralegal-policy/tests/atomic.rs @@ -1,3 +1,5 @@ +#![feature(rustc_private)] + mod helpers; use std::{collections::HashSet, sync::Arc}; @@ -8,8 +10,7 @@ use anyhow::Result; use paralegal_policy::{ assert_error, Context, Diagnostics as _, EdgeSelection, NodeExt as _, RootContext, }; -use paralegal_spdg::{GlobalNode, Identifier, NodeCluster, SourceUse}; -use petgraph::Outgoing; +use paralegal_spdg::{Identifier, NodeCluster}; macro_rules! marker { ($name:ident) => {{ @@ -20,18 +21,6 @@ macro_rules! marker { }}; } -trait NodeExt: Sized { - fn is_argument(self, ctx: &RootContext, num: u8) -> bool; -} -impl NodeExt for GlobalNode { - fn is_argument(self, ctx: &RootContext, num: u8) -> bool { - ctx.desc().controllers[&self.controller_id()] - .graph - .edges_directed(self.local_node(), Outgoing) - .any(|e| matches!(e.weight().source_use, SourceUse::Argument(n) if n == num)) - } -} - const ATOMIC_CODE_SHARED: &str = stringify!( #![allow(warnings, unused)] diff --git a/crates/paralegal-policy/tests/box.rs b/crates/paralegal-policy/tests/box.rs index b27dd86e24..7e50ca9843 100644 --- a/crates/paralegal-policy/tests/box.rs +++ b/crates/paralegal-policy/tests/box.rs @@ -1,3 +1,5 @@ +#![feature(rustc_private)] + use std::sync::Arc; use anyhow::Result; diff --git a/crates/paralegal-policy/tests/contile.rs b/crates/paralegal-policy/tests/contile.rs index 2354347b45..4ca2b9580b 100644 --- a/crates/paralegal-policy/tests/contile.rs +++ b/crates/paralegal-policy/tests/contile.rs @@ -1,3 +1,5 @@ +#![feature(rustc_private)] + use std::sync::Arc; use anyhow::{Ok, Result}; diff --git a/crates/paralegal-policy/tests/debug-ctrl-influence.rs b/crates/paralegal-policy/tests/debug-ctrl-influence.rs index 4eb1024ea8..2779dff3ad 100644 --- a/crates/paralegal-policy/tests/debug-ctrl-influence.rs +++ b/crates/paralegal-policy/tests/debug-ctrl-influence.rs @@ -1,3 +1,5 @@ +#![feature(rustc_private)] + mod helpers; use helpers::{Result, Test}; diff --git a/crates/paralegal-policy/tests/depth-manip-tests.rs b/crates/paralegal-policy/tests/depth-manip-tests.rs index 30e5d31dfa..48dd07a216 100644 --- a/crates/paralegal-policy/tests/depth-manip-tests.rs +++ b/crates/paralegal-policy/tests/depth-manip-tests.rs @@ -1,3 +1,5 @@ +#![feature(rustc_private)] + mod helpers; use anyhow::Result; diff --git a/crates/paralegal-policy/tests/entrypoint-generics.rs b/crates/paralegal-policy/tests/entrypoint-generics.rs index a0b80863c6..235e90e71c 100644 --- a/crates/paralegal-policy/tests/entrypoint-generics.rs +++ b/crates/paralegal-policy/tests/entrypoint-generics.rs @@ -1,3 +1,5 @@ +#![feature(rustc_private)] + use std::sync::Arc; use anyhow::Result; diff --git a/crates/paralegal-policy/tests/freedit.rs b/crates/paralegal-policy/tests/freedit.rs index 309ef22684..73e651439a 100644 --- a/crates/paralegal-policy/tests/freedit.rs +++ b/crates/paralegal-policy/tests/freedit.rs @@ -1,3 +1,5 @@ +#![feature(rustc_private)] + mod helpers; use anyhow::Result; diff --git a/crates/paralegal-policy/tests/lemmy.rs b/crates/paralegal-policy/tests/lemmy.rs index d8cddbaebf..9f71536f17 100644 --- a/crates/paralegal-policy/tests/lemmy.rs +++ b/crates/paralegal-policy/tests/lemmy.rs @@ -1,3 +1,5 @@ +#![feature(rustc_private)] + mod helpers; use std::{collections::hash_map::RandomState, sync::Arc}; diff --git a/crates/paralegal-policy/tests/markers.rs b/crates/paralegal-policy/tests/markers.rs index b7f5e96b4a..693b1a3244 100644 --- a/crates/paralegal-policy/tests/markers.rs +++ b/crates/paralegal-policy/tests/markers.rs @@ -1,3 +1,5 @@ +#![feature(rustc_private)] + use anyhow::Result; use helpers::Test; use paralegal_policy::{assert_error, Context, Diagnostics, EdgeSelection, NodeExt, RootContext}; diff --git a/crates/paralegal-policy/tests/misc_async.rs b/crates/paralegal-policy/tests/misc_async.rs index 5ad26cb74f..26fc37e98a 100644 --- a/crates/paralegal-policy/tests/misc_async.rs +++ b/crates/paralegal-policy/tests/misc_async.rs @@ -1,3 +1,5 @@ +#![feature(rustc_private)] + use anyhow::Result; use helpers::Test; use paralegal_policy::{assert_error, Context, EdgeSelection}; diff --git a/crates/paralegal-policy/tests/plume.rs b/crates/paralegal-policy/tests/plume.rs index 39a2796ccd..cc1bc12310 100644 --- a/crates/paralegal-policy/tests/plume.rs +++ b/crates/paralegal-policy/tests/plume.rs @@ -1,3 +1,5 @@ +#![feature(rustc_private)] + mod helpers; use helpers::Test; diff --git a/crates/paralegal-policy/tests/websubmit.rs b/crates/paralegal-policy/tests/websubmit.rs index 9d939edfb4..cb495aeebd 100644 --- a/crates/paralegal-policy/tests/websubmit.rs +++ b/crates/paralegal-policy/tests/websubmit.rs @@ -1,3 +1,5 @@ +#![feature(rustc_private)] + mod helpers; use helpers::{Result, Test}; diff --git a/crates/paralegal-spdg/Cargo.toml b/crates/paralegal-spdg/Cargo.toml index 3b542ed572..73dadbf704 100644 --- a/crates/paralegal-spdg/Cargo.toml +++ b/crates/paralegal-spdg/Cargo.toml @@ -15,14 +15,11 @@ default = ["binenc"] [dependencies] serde = { workspace = true, features = ["derive"] } log = "0.4" -internment = { version = "0.7.1", features = ["serde"] } +internment = { version = "0.8.6", features = ["serde"] } indexical = { workspace = true } -itertools = "0.11.0" +itertools = "0.13.0" strum = { workspace = true } cfg-if = "1" -#flowistry_pdg = { path = "../../../flowistry/crates/flowistry_pdg" } -#flowistry_pdg = { git = "https://github.com/brownsys/flowistry", rev = "d1fcc76509032dd94f5255fd03c0ad0397efe834" } -#flowistry_pdg = { git = "https://github.com/willcrichton/flowistry", rev = "3b0a12668894220010d715092bb6e9fb2cefb5ba" } flowistry_pdg = { path = "../flowistry_pdg" } petgraph = { workspace = true } static_assertions = "1" diff --git a/crates/paralegal-spdg/build.rs b/crates/paralegal-spdg/build.rs index a5a93b4836..9cc9c3798a 100644 --- a/crates/paralegal-spdg/build.rs +++ b/crates/paralegal-spdg/build.rs @@ -31,7 +31,7 @@ fn visit_dirs(dir: &Path, hasher: &mut DefaultHasher) -> Result<()> { let path = entry.path(); if path.is_dir() { visit_dirs(&path, hasher)?; - } else if path.extension().map_or(false, |ext| ext == "rs") { + } else if path.extension().is_some_and(|ext| ext == "rs") { let metadata = entry.metadata()?; let modified = metadata.modified()?; diff --git a/crates/paralegal-spdg/src/dot.rs b/crates/paralegal-spdg/src/dot.rs index 00901e68da..1c0f40b1f6 100644 --- a/crates/paralegal-spdg/src/dot.rs +++ b/crates/paralegal-spdg/src/dot.rs @@ -62,7 +62,7 @@ impl<'d> DotPrintableProgramDescription<'d> { } } -impl<'a, 'd> dot::GraphWalk<'a, CallString, GlobalEdge> for DotPrintableProgramDescription<'d> { +impl<'a> dot::GraphWalk<'a, CallString, GlobalEdge> for DotPrintableProgramDescription<'_> { fn nodes(&'a self) -> Nodes<'a, CallString> { self.call_sites.keys().copied().collect::>().into() } @@ -93,7 +93,7 @@ impl<'a, 'd> dot::GraphWalk<'a, CallString, GlobalEdge> for DotPrintableProgramD } } -impl<'a, 'd> dot::Labeller<'a, CallString, GlobalEdge> for DotPrintableProgramDescription<'d> { +impl<'a> dot::Labeller<'a, CallString, GlobalEdge> for DotPrintableProgramDescription<'_> { fn graph_id(&'a self) -> Id<'a> { Id::new("g").unwrap() } diff --git a/crates/paralegal-spdg/src/lib.rs b/crates/paralegal-spdg/src/lib.rs index 201e6e344a..4cc54c8324 100644 --- a/crates/paralegal-spdg/src/lib.rs +++ b/crates/paralegal-spdg/src/lib.rs @@ -15,14 +15,14 @@ pub(crate) mod rustc { pub extern crate rustc_index as index; pub extern crate rustc_middle as middle; pub extern crate rustc_span as span; - pub use hir::def_id; - pub use middle::mir; } #[cfg(feature = "rustc")] extern crate rustc_macros; #[cfg(feature = "rustc")] extern crate rustc_serialize; +#[cfg(feature = "rustc")] +extern crate rustc_span; extern crate strum; @@ -271,7 +271,7 @@ impl Span { } /// Metadata on a function call. -#[derive(Debug, Clone, Copy, Serialize, Deserialize, Eq, Ord, PartialOrd, PartialEq)] +#[derive(Debug, Clone, Copy, Serialize, Deserialize, Eq, PartialEq)] pub struct FunctionCallInfo { /// Has this call been inlined pub is_inlined: bool, @@ -281,9 +281,7 @@ pub struct FunctionCallInfo { } /// The type of instructions we may encounter -#[derive( - Debug, Clone, Copy, Serialize, Deserialize, Eq, Ord, PartialOrd, PartialEq, strum::EnumIs, -)] +#[derive(Debug, Clone, Copy, Serialize, Deserialize, Eq, PartialEq, strum::EnumIs)] pub enum InstructionKind { /// Some type of statement Statement, @@ -418,14 +416,22 @@ mod ser_defid_seq { struct DefIdWrap(#[serde(with = "rustc_proxies::DefId")] crate::DefId); pub fn serialize(v: &[crate::DefId], serializer: S) -> Result { - unsafe { <[DefIdWrap]>::serialize(std::mem::transmute(v), serializer) } + unsafe { + <[DefIdWrap]>::serialize( + std::mem::transmute::<&[rustc_span::def_id::DefId], &[DefIdWrap]>(v), + serializer, + ) + } } pub fn deserialize<'de, D: Deserializer<'de>>( deserializer: D, ) -> Result, D::Error> { unsafe { - Ok(std::mem::transmute(Box::<[DefIdWrap]>::deserialize( + Ok(std::mem::transmute::< + std::boxed::Box<[DefIdWrap]>, + std::boxed::Box<[rustc_span::def_id::DefId]>, + >(Box::<[DefIdWrap]>::deserialize( deserializer, )?)) } @@ -981,7 +987,7 @@ impl<'a> DisplayNode<'a> { } } -impl<'a> Display for DisplayNode<'a> { +impl Display for DisplayNode<'_> { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { let weight = self.graph.graph.node_weight(self.node).unwrap(); if self.detailed { diff --git a/crates/paralegal-spdg/src/traverse.rs b/crates/paralegal-spdg/src/traverse.rs index 6fffd52f34..d47f2b9f88 100644 --- a/crates/paralegal-spdg/src/traverse.rs +++ b/crates/paralegal-spdg/src/traverse.rs @@ -112,48 +112,6 @@ fn bfs_iter::new(); - let a = g.add_node(()); - let b = g.add_node(()); - let c = g.add_node(()); - let d = g.add_node(()); - - g.add_edge(a, b, ()); - g.add_edge(b, c, ()); - - let seen = bfs_iter(&g, [a]).collect::>(); - assert!(seen.contains(&b)); - assert!(seen.contains(&c)); - assert!(!seen.contains(&d)); - assert!(!seen.contains(&a)); - } - - #[test] - fn iter_sees_cycle() { - let mut g = DiGraph::<(), ()>::new(); - let a = g.add_node(()); - let b = g.add_node(()); - let c = g.add_node(()); - - g.add_edge(a, b, ()); - g.add_edge(b, c, ()); - g.add_edge(c, a, ()); - - let seen = bfs_iter(&g, [a]).collect::>(); - assert!(seen.contains(&b)); - assert!(seen.contains(&c)); - assert!(seen.contains(&a)); - } -} - /// Base function for implementing influencers pub fn generic_influencers< G: IntoEdgesDirected @@ -205,3 +163,45 @@ pub fn generic_influencees< EdgeSelection::Both => bfs_iter(g, nodes).collect::>(), } } + +#[cfg(test)] +mod test { + use petgraph::graph::DiGraph; + + use super::bfs_iter; + + #[test] + fn iter_sees_nested() { + let mut g = DiGraph::<(), ()>::new(); + let a = g.add_node(()); + let b = g.add_node(()); + let c = g.add_node(()); + let d = g.add_node(()); + + g.add_edge(a, b, ()); + g.add_edge(b, c, ()); + + let seen = bfs_iter(&g, [a]).collect::>(); + assert!(seen.contains(&b)); + assert!(seen.contains(&c)); + assert!(!seen.contains(&d)); + assert!(!seen.contains(&a)); + } + + #[test] + fn iter_sees_cycle() { + let mut g = DiGraph::<(), ()>::new(); + let a = g.add_node(()); + let b = g.add_node(()); + let c = g.add_node(()); + + g.add_edge(a, b, ()); + g.add_edge(b, c, ()); + g.add_edge(c, a, ()); + + let seen = bfs_iter(&g, [a]).collect::>(); + assert!(seen.contains(&b)); + assert!(seen.contains(&c)); + assert!(seen.contains(&a)); + } +} diff --git a/crates/paralegal/Cargo.toml b/crates/paralegal/Cargo.toml index 59bd0d0b8b..e86e628521 100644 --- a/crates/paralegal/Cargo.toml +++ b/crates/paralegal/Cargo.toml @@ -11,4 +11,7 @@ proc-macro = true [dependencies] quote = "1" proc-macro2 = "1" -cfg-if = "1" \ No newline at end of file +cfg-if = "1" + +[lints.rust] +unexpected_cfgs = { level = "warn", check-cfg = ['cfg(paralegal)'] } diff --git a/guide/deletion-policy/Cargo.lock b/guide/deletion-policy/Cargo.lock index b7707e8acb..44ae1d0e27 100644 --- a/guide/deletion-policy/Cargo.lock +++ b/guide/deletion-policy/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "addr2line" @@ -19,15 +19,21 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "ahash" -version = "0.7.6" +version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" +checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9" dependencies = [ "getrandom", "once_cell", "version_check", ] +[[package]] +name = "allocator-api2" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" + [[package]] name = "anyhow" version = "1.0.75" @@ -155,9 +161,12 @@ dependencies = [ [[package]] name = "deranged" -version = "0.3.8" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2696e8a945f658fd14dc3b87242e6b80cd0f36ff04ea560fa39082368847946" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" +dependencies = [ + "powerfmt", +] [[package]] name = "dot" @@ -208,11 +217,17 @@ name = "flowistry_pdg" version = "0.1.0" dependencies = [ "cfg-if", - "internment", + "internment 0.7.4", "serde", "strum", ] +[[package]] +name = "foldhash" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0d2fde1f7b3d48b8395d5f2de76c18a528bd6a9cdde438df747bfcba3e05d6f" + [[package]] name = "funty" version = "2.0.0" @@ -260,6 +275,17 @@ version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" +[[package]] +name = "hashbrown" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" +dependencies = [ + "allocator-api2", + "equivalent", + "foldhash", +] + [[package]] name = "heck" version = "0.4.1" @@ -321,6 +347,16 @@ dependencies = [ "serde", ] +[[package]] +name = "internment" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "636d4b0f6a39fd684effe2a73f5310df16a3fa7954c26d36833e98f44d1977a2" +dependencies = [ + "hashbrown 0.15.2", + "serde", +] + [[package]] name = "is-terminal" version = "0.4.9" @@ -405,6 +441,12 @@ dependencies = [ "adler", ] +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + [[package]] name = "num_threads" version = "0.1.6" @@ -459,7 +501,7 @@ dependencies = [ "dot", "flowistry_pdg", "indexical", - "internment", + "internment 0.8.6", "itertools 0.11.0", "log", "petgraph", @@ -504,6 +546,12 @@ dependencies = [ "serde_derive", ] +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + [[package]] name = "proc-macro2" version = "1.0.78" @@ -683,14 +731,16 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "time" -version = "0.3.29" +version = "0.3.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "426f806f4089c493dcac0d24c29c01e2c38baf8e30f1b716ee37e83d200b18fe" +checksum = "ef89ece63debf11bc32d1ed8d078ac870cbeb44da02afb02a9ff135ae7ca0582" dependencies = [ "deranged", "itoa", "libc", + "num-conv", "num_threads", + "powerfmt", "serde", "time-core", "time-macros", @@ -704,10 +754,11 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.15" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ad70d68dba9e1f8aceda7aa6711965dfec1cac869f311a51bd08b3a2ccbce20" +checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" dependencies = [ + "num-conv", "time-core", ] diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 2f93e65757..f25f5594a0 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,4 +1,3 @@ [toolchain] -channel = "nightly-2023-08-25" +channel = "nightly-2024-12-15" components = ["rustc-dev", "rust-src", "rustfmt", "clippy"] -