Merge pull request #21143 from rust-lang/rustc-pull

minor: sync from downstream
This commit is contained in:
Laurențiu Nicola
2025-11-27 05:34:29 +00:00
committed by GitHub
717 changed files with 19837 additions and 10908 deletions
+571 -559
View File
@@ -30,9 +30,9 @@ dependencies = [
[[package]]
name = "aho-corasick"
version = "1.1.3"
version = "1.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"
checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301"
dependencies = [
"memchr",
]
@@ -43,12 +43,6 @@ version = "0.2.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923"
[[package]]
name = "android-tzdata"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0"
[[package]]
name = "android_system_properties"
version = "0.1.5"
@@ -85,14 +79,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a44baf24dd94e781f74dfe67ffee75a09a57971ddf0f615a178b4f6d404b48ff"
dependencies = [
"anstyle",
"memchr",
"unicode-width 0.2.2",
]
[[package]]
name = "anstream"
version = "0.6.20"
version = "0.6.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3ae563653d1938f79b1ab1b5e668c87c76a9930414574a6583a7b7e11a8e6192"
checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a"
dependencies = [
"anstyle",
"anstyle-parse",
@@ -129,11 +124,11 @@ dependencies = [
[[package]]
name = "anstyle-query"
version = "1.1.4"
version = "1.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e231f6134f61b71076a3eab506c379d4f36122f2af15a9ff04415ea4c3339e2"
checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc"
dependencies = [
"windows-sys 0.60.2",
"windows-sys 0.61.2",
]
[[package]]
@@ -151,20 +146,20 @@ dependencies = [
[[package]]
name = "anstyle-wincon"
version = "3.0.10"
version = "3.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3e0633414522a32ffaac8ac6cc8f748e090c5717661fddeea04219e2344f5f2a"
checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d"
dependencies = [
"anstyle",
"once_cell_polyfill",
"windows-sys 0.60.2",
"windows-sys 0.61.2",
]
[[package]]
name = "anyhow"
version = "1.0.99"
version = "1.0.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b0674a1ddeecb70197781e945de4b3b8ffb61fa939a5597bcf48503737663100"
checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61"
[[package]]
name = "ar_archive_writer"
@@ -214,7 +209,7 @@ dependencies = [
"rustc-hash 2.1.1",
"serde",
"serde_derive",
"syn 2.0.106",
"syn 2.0.110",
]
[[package]]
@@ -229,6 +224,21 @@ dependencies = [
"winnow 0.7.13",
]
[[package]]
name = "assert_cmd"
version = "2.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bcbb6924530aa9e0432442af08bbcafdad182db80d2e560da42a6d442535bf85"
dependencies = [
"anstyle",
"bstr",
"libc",
"predicates",
"predicates-core",
"predicates-tree",
"wait-timeout",
]
[[package]]
name = "autocfg"
version = "1.5.0"
@@ -276,9 +286,9 @@ dependencies = [
[[package]]
name = "bitflags"
version = "2.9.3"
version = "2.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34efbcccd345379ca2868b2b2c9d3782e9cc58ba87bc7d79d5b53d9c9ae6f25d"
checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3"
[[package]]
name = "blake3"
@@ -303,13 +313,22 @@ dependencies = [
]
[[package]]
name = "bstr"
version = "1.12.0"
name = "block2"
version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "234113d19d0d7d613b40e86fb654acf958910802bcceab913a4f9e7cda03b1a4"
checksum = "cdeb9d870516001442e364c5220d3574d2da8dc765554b4a617230d33fa58ef5"
dependencies = [
"objc2",
]
[[package]]
name = "bstr"
version = "1.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "63044e1ae8e69f3b5a92c736ca6269b8d12fa7efe39bf34ddb06d102cf0e2cab"
dependencies = [
"memchr",
"regex-automata 0.4.9",
"regex-automata",
"serde",
]
@@ -365,11 +384,11 @@ checksum = "175812e0be2bccb6abe50bb8d566126198344f707e304f45c648fd8f2cc0365e"
[[package]]
name = "camino"
version = "1.1.11"
version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5d07aa9a93b00c76f71bc35d598bed923f6d4f3a9ca5c24b7737ae1a292841c0"
checksum = "276a59bf2b2c967788139340c9f0c5b12d7fd6630315c15c217e559de85d2609"
dependencies = [
"serde",
"serde_core",
]
[[package]]
@@ -442,7 +461,7 @@ dependencies = [
"serde",
"serde-untagged",
"serde-value",
"thiserror 2.0.15",
"thiserror 2.0.17",
"toml 0.8.23",
"unicode-xid",
"url",
@@ -474,7 +493,7 @@ dependencies = [
"semver",
"serde",
"serde_json",
"thiserror 2.0.15",
"thiserror 2.0.17",
]
[[package]]
@@ -488,7 +507,7 @@ dependencies = [
"semver",
"serde",
"serde_json",
"thiserror 2.0.15",
"thiserror 2.0.17",
]
[[package]]
@@ -508,9 +527,9 @@ dependencies = [
[[package]]
name = "cfg-if"
version = "1.0.1"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268"
checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
[[package]]
name = "cfg_aliases"
@@ -520,15 +539,14 @@ checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"
[[package]]
name = "chrono"
version = "0.4.41"
version = "0.4.42"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c469d952047f47f91b68d1cba3f10d63c11d73e4636f24f08daf0278abf01c4d"
checksum = "145052bdd345b87320e369255277e3fb5152762ad123a901ef5c262dd38fe8d2"
dependencies = [
"android-tzdata",
"iana-time-zone",
"num-traits",
"serde",
"windows-link 0.1.3",
"windows-link 0.2.1",
]
[[package]]
@@ -553,9 +571,9 @@ dependencies = [
[[package]]
name = "clap"
version = "4.5.45"
version = "4.5.51"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1fc0e74a703892159f5ae7d3aac52c8e6c392f5ae5f359c70b5881d60aaac318"
checksum = "4c26d721170e0295f191a69bd9a1f93efcdb0aff38684b61ab5750468972e5f5"
dependencies = [
"clap_builder",
"clap_derive",
@@ -573,9 +591,9 @@ dependencies = [
[[package]]
name = "clap_builder"
version = "4.5.44"
version = "4.5.51"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b3e7f4214277f3c7aa526a59dd3fbe306a370daee1f8b7b8c987069cd8e888a8"
checksum = "75835f0c7bf681bfd05abe44e965760fea999a5286c6eb2d59883634fd02011a"
dependencies = [
"anstream",
"anstyle",
@@ -585,21 +603,21 @@ dependencies = [
[[package]]
name = "clap_derive"
version = "4.5.45"
version = "4.5.49"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "14cb31bb0a7d536caef2639baa7fad459e15c3144efefa6dbd1c84562c4739f6"
checksum = "2a0b5487afeab2deb2ff4e03a807ad1a03ac532ff5a2cee5d86884440c7f7671"
dependencies = [
"heck 0.5.0",
"proc-macro2",
"quote",
"syn 2.0.106",
"syn 2.0.110",
]
[[package]]
name = "clap_lex"
version = "0.7.5"
version = "0.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b94f61472cee1439c0b966b47e3aca9ae07e45d070759512cd390ea2bebc6675"
checksum = "a1d728cc89cf3aee9ff92b05e62b19ee65a02b5702cff7d5a377e32c6ae29d8d"
[[package]]
name = "clippy"
@@ -623,7 +641,7 @@ dependencies = [
"serde_json",
"tempfile",
"termize",
"toml 0.9.7",
"toml 0.9.8",
"ui_test",
"walkdir",
]
@@ -662,10 +680,10 @@ dependencies = [
"declare_clippy_lint",
"itertools",
"quine-mc_cluskey",
"regex-syntax 0.8.5",
"regex-syntax",
"semver",
"serde",
"toml 0.9.7",
"toml 0.9.8",
"unicode-normalization",
"unicode-script",
"url",
@@ -704,9 +722,9 @@ dependencies = [
[[package]]
name = "codespan-reporting"
version = "0.12.0"
version = "0.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fe6d2e5af09e8c8ad56c969f2157a3d4238cebc7c55f0a517728c38f7b200f81"
checksum = "af491d569909a7e4dee0ad7db7f5341fef5c614d5b8ec8cf765732aba3cff681"
dependencies = [
"serde",
"termcolor",
@@ -735,7 +753,7 @@ dependencies = [
"eyre",
"indenter",
"once_cell",
"owo-colors 4.2.2",
"owo-colors",
"tracing-error",
]
@@ -757,7 +775,7 @@ dependencies = [
"nom",
"proc-macro2",
"quote",
"syn 2.0.106",
"syn 2.0.110",
]
[[package]]
@@ -767,7 +785,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b8b88ea9df13354b55bc7234ebcce36e6ef896aca2e42a15de9e10edce01b427"
dependencies = [
"once_cell",
"owo-colors 4.2.2",
"owo-colors",
"tracing-core",
"tracing-error",
]
@@ -829,7 +847,7 @@ dependencies = [
"tracing-subscriber",
"unified-diff",
"walkdir",
"windows 0.61.3",
"windows",
]
[[package]]
@@ -924,9 +942,9 @@ checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28"
[[package]]
name = "crypto-common"
version = "0.1.6"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3"
checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a"
dependencies = [
"generic-array",
"typenum",
@@ -934,12 +952,13 @@ dependencies = [
[[package]]
name = "ctrlc"
version = "3.4.7"
version = "3.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "46f93780a459b7d656ef7f071fe699c4d3d2cb201c4b24d085b6ddc505276e73"
checksum = "73736a89c4aff73035ba2ed2e565061954da00d4970fc9ac25dcc85a2a20d790"
dependencies = [
"dispatch2",
"nix",
"windows-sys 0.59.0",
"windows-sys 0.61.2",
]
[[package]]
@@ -959,9 +978,9 @@ dependencies = [
[[package]]
name = "curl-sys"
version = "0.4.83+curl-8.15.0"
version = "0.4.84+curl-8.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5830daf304027db10c82632a464879d46a3f7c4ba17a31592657ad16c719b483"
checksum = "abc4294dc41b882eaff37973c2ec3ae203d0091341ee68fbadd1d06e0c18a73b"
dependencies = [
"cc",
"libc",
@@ -974,9 +993,9 @@ dependencies = [
[[package]]
name = "cxx"
version = "1.0.185"
version = "1.0.188"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2f81de88da10862f22b5b3a60f18f6f42bbe7cb8faa24845dd7b1e4e22190e77"
checksum = "47ac4eaf7ebe29e92f1b091ceefec7710a53a6f6154b2460afda626c113b65b9"
dependencies = [
"cc",
"cxx-build",
@@ -989,9 +1008,9 @@ dependencies = [
[[package]]
name = "cxx-build"
version = "1.0.185"
version = "1.0.188"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5edd58bf75c3fdfc80d79806403af626570662f7b6cc782a7fabe156166bd6d6"
checksum = "2abd4c3021eefbac5149f994c117b426852bca3a0aad227698527bca6d4ea657"
dependencies = [
"cc",
"codespan-reporting",
@@ -999,40 +1018,39 @@ dependencies = [
"proc-macro2",
"quote",
"scratch",
"syn 2.0.106",
"syn 2.0.110",
]
[[package]]
name = "cxxbridge-cmd"
version = "1.0.185"
version = "1.0.188"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd46bf2b541a4e0c2d5abba76607379ee05d68e714868e3cb406dc8d591ce2d2"
checksum = "6f12fbc5888b2311f23e52a601e11ad7790d8f0dbb903ec26e2513bf5373ed70"
dependencies = [
"clap",
"codespan-reporting",
"indexmap",
"proc-macro2",
"quote",
"syn 2.0.106",
"syn 2.0.110",
]
[[package]]
name = "cxxbridge-flags"
version = "1.0.185"
version = "1.0.188"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c79b68f6a3a8f809d39b38ae8af61305a6113819b19b262643b9c21353b92d9"
checksum = "83d3dd7870af06e283f3f8ce0418019c96171c9ce122cfb9c8879de3d84388fd"
[[package]]
name = "cxxbridge-macro"
version = "1.0.185"
version = "1.0.188"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "862b7fdb048ff9ef0779a0d0a03affd09746c4c875543746b640756be9cff2af"
checksum = "a26f0d82da663316786791c3d0e9f9edc7d1ee1f04bdad3d2643086a69d6256c"
dependencies = [
"indexmap",
"proc-macro2",
"quote",
"rustversion",
"syn 2.0.106",
"syn 2.0.110",
]
[[package]]
@@ -1056,7 +1074,7 @@ dependencies = [
"proc-macro2",
"quote",
"strsim",
"syn 2.0.106",
"syn 2.0.110",
]
[[package]]
@@ -1067,7 +1085,7 @@ checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead"
dependencies = [
"darling_core",
"quote",
"syn 2.0.106",
"syn 2.0.110",
]
[[package]]
@@ -1078,13 +1096,13 @@ checksum = "a0afaad2b26fa326569eb264b1363e8ae3357618c43982b3f285f0774ce76b69"
[[package]]
name = "dbus"
version = "0.9.7"
version = "0.9.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1bb21987b9fb1613058ba3843121dd18b163b254d8a6e797e144cbac14d96d1b"
checksum = "190b6255e8ab55a7b568df5a883e9497edc3e4821c06396612048b430e5ad1e9"
dependencies = [
"libc",
"libdbus-sys",
"winapi",
"windows-sys 0.59.0",
]
[[package]]
@@ -1099,7 +1117,7 @@ checksum = "ef941ded77d15ca19b40374869ac6000af1c9f2a4c0f3d4c70926287e6364a8f"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.106",
"syn 2.0.110",
]
[[package]]
@@ -1120,7 +1138,7 @@ dependencies = [
"darling",
"proc-macro2",
"quote",
"syn 2.0.106",
"syn 2.0.110",
]
[[package]]
@@ -1130,7 +1148,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab63b0e2bf4d5928aff72e83a7dace85d7bba5fe12dcc3c5a572d78caffd3f3c"
dependencies = [
"derive_builder_core",
"syn 2.0.106",
"syn 2.0.110",
]
[[package]]
@@ -1142,7 +1160,7 @@ dependencies = [
"darling",
"proc-macro2",
"quote",
"syn 2.0.106",
"syn 2.0.110",
]
[[package]]
@@ -1151,6 +1169,12 @@ version = "0.1.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8"
[[package]]
name = "difflib"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6184e33543162437515c2e2b48714794e37845ec9851711914eec9d308f6ebe8"
[[package]]
name = "digest"
version = "0.10.7"
@@ -1212,6 +1236,18 @@ dependencies = [
"winapi",
]
[[package]]
name = "dispatch2"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "89a09f22a6c6069a18470eb92d2298acf25463f14256d24778e1230d789a2aec"
dependencies = [
"bitflags",
"block2",
"libc",
"objc2",
]
[[package]]
name = "displaydoc"
version = "0.2.5"
@@ -1220,7 +1256,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.106",
"syn 2.0.110",
]
[[package]]
@@ -1231,9 +1267,9 @@ checksum = "8975ffdaa0ef3661bfe02dbdcc06c9f829dfafe6a3c474de366a8d5e44276921"
[[package]]
name = "dyn-clone"
version = "1.0.19"
version = "1.0.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1c7a8fb8a9fbf66c1f703fe16184d10ca0ee9d23be5b4436400408ba54a95005"
checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555"
[[package]]
name = "either"
@@ -1267,9 +1303,9 @@ checksum = "34aa73646ffb006b8f5147f3dc182bd4bcb190227ce861fc4a4844bf8e3cb2c0"
[[package]]
name = "env_filter"
version = "0.1.3"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "186e05a59d4c50738528153b83b0b0194d3a29507dfec16eccd4b342903397d0"
checksum = "1bf3c259d255ca70051b30e2e95b5446cdb8949ac4cd22c0d7fd634d89f568e2"
dependencies = [
"log",
"regex",
@@ -1296,22 +1332,23 @@ checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
[[package]]
name = "erased-serde"
version = "0.4.6"
version = "0.4.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e004d887f51fcb9fef17317a2f3525c887d8aa3f4f50fed920816a688284a5b7"
checksum = "89e8918065695684b2b0702da20382d5ae6065cf3327bc2d6436bd49a71ce9f3"
dependencies = [
"serde",
"serde_core",
"typeid",
]
[[package]]
name = "errno"
version = "0.3.13"
version = "0.3.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "778e2ac28f6c47af28e4907f13ffd1e1ddbd400980a9abd7c8df189bf578a5ad"
checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
dependencies = [
"libc",
"windows-sys 0.60.2",
"windows-sys 0.61.2",
]
[[package]]
@@ -1359,27 +1396,27 @@ dependencies = [
[[package]]
name = "filetime"
version = "0.2.25"
version = "0.2.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "35c0522e981e68cbfa8c3f978441a5f34b30b96e146b33cd3359176b50fe8586"
checksum = "bc0505cd1b6fa6580283f6bdf70a73fcf4aba1184038c90902b92b3dd0df63ed"
dependencies = [
"cfg-if",
"libc",
"libredox",
"windows-sys 0.59.0",
"windows-sys 0.60.2",
]
[[package]]
name = "find-msvc-tools"
version = "0.1.2"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ced73b1dacfc750a6db6c0a0c3a3853c8b41997e2e2c563dc90804ae6867959"
checksum = "3a3076410a55c90011c298b04d0cfa770b00fa04e1e3c97d3f6c9de105a03844"
[[package]]
name = "flate2"
version = "1.1.2"
version = "1.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4a3d7db9596fecd151c5f638c0ee5d5bd487b6e0ea232e5dc96d5250f6f94b1d"
checksum = "bfe33edd8e85a12a67454e37f8c75e730830d83e313556ab9ebf9ee7fbeb3bfb"
dependencies = [
"crc32fast",
"miniz_oxide",
@@ -1403,9 +1440,9 @@ dependencies = [
[[package]]
name = "fluent-langneg"
version = "0.13.0"
version = "0.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c4ad0989667548f06ccd0e306ed56b61bd4d35458d54df5ec7587c0e8ed5e94"
checksum = "7eebbe59450baee8282d71676f3bfed5689aeab00b27545e83e5f14b1195e8b0"
dependencies = [
"unic-langid",
]
@@ -1417,7 +1454,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "54f0d287c53ffd184d04d8677f590f4ac5379785529e5e08b1c8083acdd5c198"
dependencies = [
"memchr",
"thiserror 2.0.15",
"thiserror 2.0.17",
]
[[package]]
@@ -1440,9 +1477,9 @@ checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb"
[[package]]
name = "form_urlencoded"
version = "1.2.1"
version = "1.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456"
checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf"
dependencies = [
"percent-encoding",
]
@@ -1557,9 +1594,9 @@ dependencies = [
[[package]]
name = "gimli"
version = "0.32.0"
version = "0.32.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "93563d740bc9ef04104f9ed6f86f1e3275c2cdafb95664e26584b9ca807a8ffe"
checksum = "e629b9b98ef3dd8afe6ca2bd0f89306cec16d43d907889945bc5d6687f2f13c7"
dependencies = [
"fallible-iterator",
"indexmap",
@@ -1589,15 +1626,15 @@ checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280"
[[package]]
name = "globset"
version = "0.4.16"
version = "0.4.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "54a1028dfc5f5df5da8a56a73e6c153c9a9708ec57232470703592a3f18e49f5"
checksum = "52dfc19153a48bde0cbd630453615c8151bce3a5adfac7a0aebfbf0a1e1f57e3"
dependencies = [
"aho-corasick",
"bstr",
"log",
"regex-automata 0.4.9",
"regex-syntax 0.8.5",
"regex-automata",
"regex-syntax",
]
[[package]]
@@ -1621,6 +1658,12 @@ dependencies = [
"serde",
]
[[package]]
name = "hashbrown"
version = "0.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5419bdc4f6a9207fbeba6d11b604d481addf78ecd10c11ad51e76c2f6482748d"
[[package]]
name = "heck"
version = "0.4.1"
@@ -1647,11 +1690,11 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
[[package]]
name = "home"
version = "0.5.11"
version = "0.5.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "589533453244b0995c858700322199b2becb13b627df2851f64a2775d024abcf"
checksum = "cc627f471c528ff0c4a49e1d5e60450c8f6461dd6d10ba9dcd3a61d3dff7728d"
dependencies = [
"windows-sys 0.59.0",
"windows-sys 0.61.2",
]
[[package]]
@@ -1694,15 +1737,15 @@ dependencies = [
[[package]]
name = "humantime"
version = "2.2.0"
version = "2.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b112acc8b3adf4b107a8ec20977da0273a8c386765a3ec0229bd500a1443f9f"
checksum = "135b12329e5e3ce057a9f972339ea52bc954fe1e9358ef27f95e89716fbc5424"
[[package]]
name = "iana-time-zone"
version = "0.1.63"
version = "0.1.64"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b0c919e5debc312ad217002b8048a17b7d83f80703865bbfcfebb0458b0b27d8"
checksum = "33e57f83510bb73707521ebaffa789ec8caf86f9657cad665b092b581d40e9fb"
dependencies = [
"android_system_properties",
"core-foundation-sys",
@@ -1710,7 +1753,7 @@ dependencies = [
"js-sys",
"log",
"wasm-bindgen",
"windows-core 0.61.2",
"windows-core 0.62.2",
]
[[package]]
@@ -1724,9 +1767,9 @@ dependencies = [
[[package]]
name = "icu_collections"
version = "2.0.0"
version = "2.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "200072f5d0e3614556f94a9930d5dc3e0662a652823904c3a75dc3b0af7fee47"
checksum = "4c6b649701667bbe825c3b7e6388cb521c23d88644678e83c0c4d0a621a34b43"
dependencies = [
"displaydoc",
"potential_utf",
@@ -1737,13 +1780,12 @@ dependencies = [
[[package]]
name = "icu_list"
version = "2.0.0"
version = "2.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e26f94ec776bb8b28cedc7dcf91033b822c5cb4c1783cf7a3f796fc168aa0c8b"
checksum = "d3a0b7b126e2fc42777d3c348611553d540bd3683caa39b387c5dd1036bb21a8"
dependencies = [
"displaydoc",
"icu_provider",
"regex-automata 0.4.9",
"regex-automata",
"serde",
"writeable",
"zerovec",
@@ -1751,11 +1793,10 @@ dependencies = [
[[package]]
name = "icu_locale"
version = "2.0.0"
version = "2.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ae5921528335e91da1b6c695dbf1ec37df5ac13faa3f91e5640be93aa2fbefd"
checksum = "532b11722e350ab6bf916ba6eb0efe3ee54b932666afec989465f9243fe6dd60"
dependencies = [
"displaydoc",
"icu_collections",
"icu_locale_core",
"icu_locale_data",
@@ -1767,12 +1808,13 @@ dependencies = [
[[package]]
name = "icu_locale_core"
version = "2.0.0"
version = "2.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0cde2700ccaed3872079a65fb1a78f6c0a36c91570f28755dda67bc8f7d9f00a"
checksum = "edba7861004dd3714265b4db54a3c390e880ab658fec5f7db895fae2046b5bb6"
dependencies = [
"displaydoc",
"litemap",
"serde",
"tinystr",
"writeable",
"zerovec",
@@ -1780,17 +1822,16 @@ dependencies = [
[[package]]
name = "icu_locale_data"
version = "2.0.0"
version = "2.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4fdef0c124749d06a743c69e938350816554eb63ac979166590e2b4ee4252765"
checksum = "f03e2fcaefecdf05619f3d6f91740e79ab969b4dd54f77cbf546b1d0d28e3147"
[[package]]
name = "icu_normalizer"
version = "2.0.0"
version = "2.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "436880e8e18df4d7bbc06d58432329d6458cc84531f7ac5f024e93deadb37979"
checksum = "5f6c8828b67bf8908d82127b2054ea1b4427ff0230ee9141c54251934ab1b599"
dependencies = [
"displaydoc",
"icu_collections",
"icu_normalizer_data",
"icu_properties",
@@ -1801,42 +1842,40 @@ dependencies = [
[[package]]
name = "icu_normalizer_data"
version = "2.0.0"
version = "2.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "00210d6893afc98edb752b664b8890f0ef174c8adbb8d0be9710fa66fbbf72d3"
checksum = "7aedcccd01fc5fe81e6b489c15b247b8b0690feb23304303a9e560f37efc560a"
[[package]]
name = "icu_properties"
version = "2.0.1"
version = "2.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "016c619c1eeb94efb86809b015c58f479963de65bdb6253345c1a1276f22e32b"
checksum = "e93fcd3157766c0c8da2f8cff6ce651a31f0810eaa1c51ec363ef790bbb5fb99"
dependencies = [
"displaydoc",
"icu_collections",
"icu_locale_core",
"icu_properties_data",
"icu_provider",
"potential_utf",
"zerotrie",
"zerovec",
]
[[package]]
name = "icu_properties_data"
version = "2.0.1"
version = "2.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "298459143998310acd25ffe6810ed544932242d3f07083eee1084d83a71bd632"
checksum = "02845b3647bb045f1100ecd6480ff52f34c35f82d9880e029d329c21d1054899"
[[package]]
name = "icu_provider"
version = "2.0.0"
version = "2.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "03c80da27b5f4187909049ee2d72f276f0d9f99a42c306bd0131ecfe04d8e5af"
checksum = "85962cf0ce02e1e0a629cc34e7ca3e373ce20dda4c4d7294bbd0bf1fdb59e614"
dependencies = [
"displaydoc",
"icu_locale_core",
"serde",
"stable_deref_trait",
"tinystr",
"writeable",
"yoke",
"zerofrom",
@@ -1858,9 +1897,9 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
[[package]]
name = "idna"
version = "1.0.3"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e"
checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de"
dependencies = [
"idna_adapter",
"smallvec",
@@ -1879,15 +1918,15 @@ dependencies = [
[[package]]
name = "ignore"
version = "0.4.23"
version = "0.4.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d89fd380afde86567dfba715db065673989d6253f42b88179abd3eae47bda4b"
checksum = "d3d782a365a015e0f5c04902246139249abf769125006fbe7649e2ee88169b4a"
dependencies = [
"crossbeam-deque",
"globset",
"log",
"memchr",
"regex-automata 0.4.9",
"regex-automata",
"same-file",
"walkdir",
"winapi-util",
@@ -1901,12 +1940,12 @@ checksum = "964de6e86d545b246d84badc0fef527924ace5134f30641c203ef52ba83f58d5"
[[package]]
name = "indexmap"
version = "2.11.4"
version = "2.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4b0f83760fb341a774ed326568e19f5a863af4a952def8c39f9ab92fd95b88e5"
checksum = "6717a8d2a5a929a1a2eb43a12812498ed141a0bcfb7e8f7844fbdbe4303bba9f"
dependencies = [
"equivalent",
"hashbrown",
"hashbrown 0.16.0",
"serde",
"serde_core",
]
@@ -1973,9 +2012,9 @@ dependencies = [
[[package]]
name = "ipc-channel"
version = "0.20.1"
version = "0.20.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1700f6b8b9f00cdd675f32fbb3a5be882213140dfe045805273221ca266c43f8"
checksum = "f93600b5616c2d075f8af8dbd23c1d69278c5d24e4913d220cbc60b14c95c180"
dependencies = [
"bincode",
"crossbeam-channel",
@@ -1986,14 +2025,14 @@ dependencies = [
"serde",
"tempfile",
"uuid",
"windows 0.58.0",
"windows",
]
[[package]]
name = "is_terminal_polyfill"
version = "1.70.1"
version = "1.70.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf"
checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695"
[[package]]
name = "itertools"
@@ -2012,33 +2051,33 @@ checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c"
[[package]]
name = "jiff"
version = "0.2.15"
version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be1f93b8b1eb69c77f24bbb0afdf66f54b632ee39af40ca21c4365a1d7347e49"
checksum = "49cce2b81f2098e7e3efc35bc2e0a6b7abec9d34128283d7a26fa8f32a6dbb35"
dependencies = [
"jiff-static",
"log",
"portable-atomic",
"portable-atomic-util",
"serde",
"serde_core",
]
[[package]]
name = "jiff-static"
version = "0.2.15"
version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "03343451ff899767262ec32146f6d559dd759fdadf42ff0e227c7c48f72594b4"
checksum = "980af8b43c3ad5d8d349ace167ec8170839f753a42d233ba19e08afe1850fa69"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.106",
"syn 2.0.110",
]
[[package]]
name = "jobserver"
version = "0.1.33"
version = "0.1.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38f262f097c174adebe41eb73d66ae9c06b2844fb0da69969647bbddd9b0538a"
checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33"
dependencies = [
"getrandom 0.3.3",
"libc",
@@ -2046,9 +2085,9 @@ dependencies = [
[[package]]
name = "js-sys"
version = "0.3.77"
version = "0.3.82"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f"
checksum = "b011eec8cc36da2aab2d5cff675ec18454fad408585853910a202391cf9f8e65"
dependencies = [
"once_cell",
"wasm-bindgen",
@@ -2089,7 +2128,7 @@ dependencies = [
"pest_derive",
"regex",
"serde_json",
"thiserror 2.0.15",
"thiserror 2.0.17",
]
[[package]]
@@ -2130,9 +2169,9 @@ checksum = "2874a2af47a2325c2001a6e6fad9b16a53b802102b528163885171cf92b15976"
[[package]]
name = "libdbus-sys"
version = "0.2.5"
version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06085512b750d640299b79be4bad3d2fa90a9c00b1fd9e1b46364f66f0485c72"
checksum = "5cbe856efeb50e4681f010e9aaa2bf0a644e10139e54cde10fc83a307c23bd9f"
dependencies = [
"cc",
"pkg-config",
@@ -2172,12 +2211,12 @@ dependencies = [
[[package]]
name = "libloading"
version = "0.8.8"
version = "0.8.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "07033963ba89ebaf1584d767badaa2e8fcec21aedea6b8c0346d487d49c28667"
checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55"
dependencies = [
"cfg-if",
"windows-targets 0.53.3",
"windows-link 0.2.1",
]
[[package]]
@@ -2198,9 +2237,9 @@ checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de"
[[package]]
name = "libredox"
version = "0.1.9"
version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "391290121bad3d37fbddad76d8f5d1c1c314cfc646d143d7e07a3086ddff0ce3"
checksum = "416f7e718bdb06000964960ffa43b4335ad4012ae8b99060261aa4a8088d5ccb"
dependencies = [
"bitflags",
"libc",
@@ -2209,9 +2248,9 @@ dependencies = [
[[package]]
name = "libz-sys"
version = "1.1.22"
version = "1.1.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b70e7a7df205e92a1a4cd9aaae7898dac0aa555503cc0a649494d0d60e7651d"
checksum = "15d118bbf3771060e7311cc7bb0545b01d08a8b4a7de949198dec1fa0ca1c0f7"
dependencies = [
"cc",
"libc",
@@ -2255,9 +2294,9 @@ checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039"
[[package]]
name = "litemap"
version = "0.8.0"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "241eaef5fd12c88705a01fc1066c48c4b36e0dd4377dcdc7ec3942cea7a69956"
checksum = "6373607a59f0be73a39b6fe456b8192fcc3585f602af20751600e974dd455e77"
[[package]]
name = "lld-wrapper"
@@ -2276,19 +2315,18 @@ dependencies = [
[[package]]
name = "lock_api"
version = "0.4.13"
version = "0.4.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "96936507f153605bddfcda068dd804796c84324ed2510809e5b2a624c81da765"
checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965"
dependencies = [
"autocfg",
"scopeguard",
]
[[package]]
name = "log"
version = "0.4.27"
version = "0.4.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94"
checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432"
[[package]]
name = "lzma-sys"
@@ -2329,16 +2367,16 @@ checksum = "88a9689d8d44bf9964484516275f5cd4c9b59457a6940c1d5d0ecbb94510a36b"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.106",
"syn 2.0.110",
]
[[package]]
name = "matchers"
version = "0.1.0"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558"
checksum = "d1525a2a28c7f4fa0fc98bb91ae755d1e2d1505079e05539e35bc876b5d65ae9"
dependencies = [
"regex-automata 0.1.10",
"regex-automata",
]
[[package]]
@@ -2399,17 +2437,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316"
dependencies = [
"adler2",
"simd-adler32",
]
[[package]]
name = "mio"
version = "1.0.4"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "78bed444cc8a2160f01cbcf811ef18cac863ad68ae8ca62092e8db51d51c761c"
checksum = "69d83b0086dc8ecf3ce9ae2874b2d1290252e2a30720bea58a5c6639b0092873"
dependencies = [
"libc",
"wasi 0.11.1+wasi-snapshot-preview1",
"windows-sys 0.59.0",
"windows-sys 0.61.2",
]
[[package]]
@@ -2447,7 +2486,6 @@ dependencies = [
"serde_json",
"smallvec",
"tempfile",
"tikv-jemalloc-sys",
"ui_test",
]
@@ -2485,30 +2523,20 @@ dependencies = [
[[package]]
name = "normpath"
version = "1.3.0"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c8911957c4b1549ac0dc74e30db9c8b0e66ddcd6d7acc33098f4c63a64a6d7ed"
checksum = "bf23ab2b905654b4cb177e30b629937b3868311d4e1cba859f899c041046e69b"
dependencies = [
"windows-sys 0.59.0",
"windows-sys 0.61.2",
]
[[package]]
name = "nu-ansi-term"
version = "0.46.0"
version = "0.50.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84"
checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5"
dependencies = [
"overload",
"winapi",
]
[[package]]
name = "nu-ansi-term"
version = "0.50.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d4a28e057d01f97e61255210fcff094d74ed0466038633e95017f5beb68e4399"
dependencies = [
"windows-sys 0.52.0",
"windows-sys 0.61.2",
]
[[package]]
@@ -2601,19 +2629,34 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3"
[[package]]
name = "objc2-core-foundation"
version = "0.3.1"
name = "objc2"
version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1c10c2894a6fed806ade6027bcd50662746363a9589d3ec9d9bef30a4e4bc166"
checksum = "b7c2599ce0ec54857b29ce62166b0ed9b4f6f1a70ccc9a71165b6154caca8c05"
dependencies = [
"objc2-encode",
]
[[package]]
name = "objc2-core-foundation"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536"
dependencies = [
"bitflags",
]
[[package]]
name = "objc2-io-kit"
version = "0.3.1"
name = "objc2-encode"
version = "4.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "71c1c64d6120e51cd86033f67176b1cb66780c2efe34dec55176f77befd93c0a"
checksum = "ef25abbcd74fb2609453eb695bd2f860d389e457f67dc17cafc8b8cbc89d0c33"
[[package]]
name = "objc2-io-kit"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "33fafba39597d6dc1fb709123dfa8289d39406734be322956a69f0931c73bb15"
dependencies = [
"libc",
"objc2-core-foundation",
@@ -2627,7 +2670,7 @@ checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87"
dependencies = [
"crc32fast",
"flate2",
"hashbrown",
"hashbrown 0.15.5",
"indexmap",
"memchr",
"ruzstd 0.7.3",
@@ -2641,10 +2684,10 @@ checksum = "ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe"
dependencies = [
"crc32fast",
"flate2",
"hashbrown",
"hashbrown 0.15.5",
"indexmap",
"memchr",
"ruzstd 0.8.1",
"ruzstd 0.8.2",
"wasmparser 0.236.1",
]
@@ -2665,9 +2708,9 @@ checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
[[package]]
name = "once_cell_polyfill"
version = "1.70.1"
version = "1.70.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4895175b425cb1f87721b59f0f286c2092bd4af812243672510e1ac53e2e0ad"
checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe"
[[package]]
name = "opener"
@@ -2689,9 +2732,9 @@ checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e"
[[package]]
name = "openssl-sys"
version = "0.9.109"
version = "0.9.111"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90096e2e47630d78b7d1c20952dc621f957103f8bc2c8359ec81290d75238571"
checksum = "82cab2d520aa75e3c58898289429321eb788c3106963d0dc886ec7a5f4adc321"
dependencies = [
"cc",
"libc",
@@ -2737,32 +2780,11 @@ dependencies = [
"num-traits",
]
[[package]]
name = "overload"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39"
[[package]]
name = "owo-colors"
version = "3.5.0"
version = "4.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f"
[[package]]
name = "owo-colors"
version = "4.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "48dd4f4a2c8405440fd0462561f0e5806bd0f77e86f51c761481bdd4018b545e"
[[package]]
name = "pad"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2ad9b889f1b12e0b9ee24db044b5129150d5eada288edc800f789928dc8c0e3"
dependencies = [
"unicode-width 0.1.14",
]
checksum = "9c6901729fa79e91a0913333229e9ca5dc725089d1c363b2f4b4760709dc4a52"
[[package]]
name = "papergrid"
@@ -2777,9 +2799,9 @@ dependencies = [
[[package]]
name = "parking_lot"
version = "0.12.4"
version = "0.12.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70d58bf43669b5795d1576d0641cfb6fbb2057bf629506267a92807158584a13"
checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a"
dependencies = [
"lock_api",
"parking_lot_core",
@@ -2787,15 +2809,15 @@ dependencies = [
[[package]]
name = "parking_lot_core"
version = "0.9.11"
version = "0.9.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bc838d2a56b5b1a6c25f55575dfc605fabb63bb2365f6c2353ef9159aa69e4a5"
checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1"
dependencies = [
"cfg-if",
"libc",
"redox_syscall",
"smallvec",
"windows-targets 0.52.6",
"windows-link 0.2.1",
]
[[package]]
@@ -2806,9 +2828,9 @@ checksum = "df94ce210e5bc13cb6651479fa48d14f601d9858cfe0467f43ae157023b938d3"
[[package]]
name = "percent-encoding"
version = "2.3.1"
version = "2.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"
checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220"
[[package]]
name = "perf-event-open-sys"
@@ -2821,20 +2843,19 @@ dependencies = [
[[package]]
name = "pest"
version = "2.8.1"
version = "2.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1db05f56d34358a8b1066f67cbb203ee3e7ed2ba674a6263a1d5ec6db2204323"
checksum = "989e7521a040efde50c3ab6bbadafbe15ab6dc042686926be59ac35d74607df4"
dependencies = [
"memchr",
"thiserror 2.0.15",
"ucd-trie",
]
[[package]]
name = "pest_derive"
version = "2.8.1"
version = "2.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bb056d9e8ea77922845ec74a1c4e8fb17e7c218cc4fc11a15c5d25e189aa40bc"
checksum = "187da9a3030dbafabbbfb20cb323b976dc7b7ce91fcd84f2f74d6e31d378e2de"
dependencies = [
"pest",
"pest_generator",
@@ -2842,22 +2863,22 @@ dependencies = [
[[package]]
name = "pest_generator"
version = "2.8.1"
version = "2.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87e404e638f781eb3202dc82db6760c8ae8a1eeef7fb3fa8264b2ef280504966"
checksum = "49b401d98f5757ebe97a26085998d6c0eecec4995cad6ab7fc30ffdf4b052843"
dependencies = [
"pest",
"pest_meta",
"proc-macro2",
"quote",
"syn 2.0.106",
"syn 2.0.110",
]
[[package]]
name = "pest_meta"
version = "2.8.1"
version = "2.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "edd1101f170f5903fde0914f899bb503d9ff5271d7ba76bbb70bea63690cc0d5"
checksum = "72f27a2cfee9f9039c4d86faa5af122a0ac3851441a34865b8a043b46be0065a"
dependencies = [
"pest",
"sha2",
@@ -2959,11 +2980,12 @@ dependencies = [
[[package]]
name = "potential_utf"
version = "0.1.2"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e5a7c30837279ca13e7c867e9e40053bc68740f988cb07f7ca6df43cc734b585"
checksum = "b73949432f5e2a09657003c25bca5e19a0e9c84f8058ca374f49e0ebe605af77"
dependencies = [
"serde",
"serde_core",
"writeable",
"zerovec",
]
@@ -2983,13 +3005,39 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c"
[[package]]
name = "prettydiff"
version = "0.7.0"
name = "predicates"
version = "3.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "abec3fb083c10660b3854367697da94c674e9e82aa7511014dc958beeb7215e9"
checksum = "a5d19ee57562043d37e82899fade9a22ebab7be9cef5026b07fda9cdd4293573"
dependencies = [
"owo-colors 3.5.0",
"pad",
"anstyle",
"difflib",
"predicates-core",
]
[[package]]
name = "predicates-core"
version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "727e462b119fe9c93fd0eb1429a5f7647394014cf3c04ab2c0350eeb09095ffa"
[[package]]
name = "predicates-tree"
version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72dd2d6d381dfb73a193c7fca536518d7caee39fc8503f74e7dc0be0531b425c"
dependencies = [
"predicates-core",
"termtree",
]
[[package]]
name = "prettydiff"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac17546d82912e64874e3d5b40681ce32eac4e5834344f51efcf689ff1550a65"
dependencies = [
"owo-colors",
]
[[package]]
@@ -3000,9 +3048,9 @@ checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068"
[[package]]
name = "proc-macro2"
version = "1.0.101"
version = "1.0.103"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de"
checksum = "5ee95bc4ef87b8d5ba32e8b7714ccc834865276eab0aed5c9958d00ec45f49e8"
dependencies = [
"unicode-ident",
]
@@ -3048,9 +3096,9 @@ checksum = "07589615d719a60c8dd8a4622e7946465dfef20d1a428f969e3443e7386d5f45"
[[package]]
name = "quote"
version = "1.0.40"
version = "1.0.42"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d"
checksum = "a338cc41d27e6cc6dce6cefc13a0729dfbb81c262b1f519331575dd80ef3067f"
dependencies = [
"proc-macro2",
]
@@ -3160,9 +3208,9 @@ dependencies = [
[[package]]
name = "redox_syscall"
version = "0.5.17"
version = "0.5.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5407465600fb0548f1442edf71dd20683c6ed326200ace4b1ef0763521bb3b77"
checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d"
dependencies = [
"bitflags",
]
@@ -3186,82 +3234,70 @@ checksum = "a4e608c6638b9c18977b00b475ac1f28d14e84b27d8d42f70e0bf1e3dec127ac"
dependencies = [
"getrandom 0.2.16",
"libredox",
"thiserror 2.0.15",
"thiserror 2.0.17",
]
[[package]]
name = "ref-cast"
version = "1.0.24"
version = "1.0.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4a0ae411dbe946a674d89546582cea4ba2bb8defac896622d6496f14c23ba5cf"
checksum = "f354300ae66f76f1c85c5f84693f0ce81d747e2c3f21a45fef496d89c960bf7d"
dependencies = [
"ref-cast-impl",
]
[[package]]
name = "ref-cast-impl"
version = "1.0.24"
version = "1.0.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1165225c21bff1f3bbce98f5a1f889949bc902d3575308cc7b0de30b4f6d27c7"
checksum = "b7186006dcb21920990093f30e3dea63b7d6e977bf1256be20c3563a5db070da"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.106",
"syn 2.0.110",
]
[[package]]
name = "regex"
version = "1.11.1"
version = "1.12.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191"
checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4"
dependencies = [
"aho-corasick",
"memchr",
"regex-automata 0.4.9",
"regex-syntax 0.8.5",
"regex-automata",
"regex-syntax",
]
[[package]]
name = "regex-automata"
version = "0.1.10"
version = "0.4.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132"
dependencies = [
"regex-syntax 0.6.29",
]
[[package]]
name = "regex-automata"
version = "0.4.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908"
checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c"
dependencies = [
"aho-corasick",
"memchr",
"regex-syntax 0.8.5",
"regex-syntax",
]
[[package]]
name = "regex-lite"
version = "0.1.6"
version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "53a49587ad06b26609c52e423de037e7f57f20d53535d66e08c695f347df952a"
checksum = "8d942b98df5e658f56f20d592c7f868833fe38115e65c33003d8cd224b0155da"
[[package]]
name = "regex-syntax"
version = "0.6.29"
version = "0.8.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1"
[[package]]
name = "regex-syntax"
version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58"
[[package]]
name = "remote-test-client"
version = "0.1.0"
dependencies = [
"assert_cmd",
]
[[package]]
name = "remote-test-server"
@@ -3281,10 +3317,11 @@ version = "0.0.0"
dependencies = [
"bstr",
"build_helper",
"gimli 0.32.0",
"gimli 0.32.3",
"libc",
"object 0.37.3",
"regex",
"rustdoc-json-types",
"serde_json",
"similar",
"wasmparser 0.236.1",
@@ -3331,6 +3368,7 @@ checksum = "e4ee29da77c5a54f42697493cd4c9b9f31b74df666a6c04dfc4fde77abe0438b"
name = "rustc-main"
version = "0.0.0"
dependencies = [
"getrandom 0.3.3",
"rustc_codegen_ssa",
"rustc_driver",
"rustc_driver_impl",
@@ -3338,6 +3376,7 @@ dependencies = [
"rustc_public_bridge",
"rustc_windows_rc",
"tikv-jemalloc-sys",
"wasi 0.14.2+wasi-0.2.4",
]
[[package]]
@@ -3646,7 +3685,7 @@ dependencies = [
"thorin-dwp",
"tracing",
"wasm-encoder 0.219.2",
"windows 0.61.3",
"windows",
]
[[package]]
@@ -3682,7 +3721,7 @@ dependencies = [
"either",
"elsa",
"ena",
"hashbrown",
"hashbrown 0.15.5",
"indexmap",
"jobserver",
"libc",
@@ -3704,7 +3743,7 @@ dependencies = [
"tempfile",
"thin-vec",
"tracing",
"windows 0.61.3",
"windows",
]
[[package]]
@@ -3768,7 +3807,7 @@ dependencies = [
"serde_json",
"shlex",
"tracing",
"windows 0.61.3",
"windows",
]
[[package]]
@@ -3820,7 +3859,7 @@ dependencies = [
"serde_json",
"termize",
"tracing",
"windows 0.61.3",
"windows",
]
[[package]]
@@ -3869,7 +3908,7 @@ dependencies = [
"fluent-syntax",
"proc-macro2",
"quote",
"syn 2.0.106",
"syn 2.0.110",
"unic-langid",
]
@@ -4029,7 +4068,7 @@ version = "0.0.0"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.106",
"syn 2.0.110",
]
[[package]]
@@ -4175,7 +4214,7 @@ version = "0.0.0"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.106",
"syn 2.0.110",
"synstructure",
]
@@ -4185,7 +4224,7 @@ version = "0.0.0"
dependencies = [
"bitflags",
"libc",
"libloading 0.8.8",
"libloading 0.8.9",
"odht",
"rustc_abi",
"rustc_ast",
@@ -4298,7 +4337,7 @@ name = "rustc_mir_transform"
version = "0.0.0"
dependencies = [
"either",
"hashbrown",
"hashbrown 0.15.5",
"itertools",
"rustc_abi",
"rustc_arena",
@@ -4472,6 +4511,7 @@ dependencies = [
"rustc_target",
"scoped-tls",
"serde",
"serde_json",
"tracing",
]
@@ -4509,7 +4549,7 @@ dependencies = [
name = "rustc_query_system"
version = "0.0.0"
dependencies = [
"hashbrown",
"hashbrown 0.15.5",
"parking_lot",
"rustc_abi",
"rustc_ast",
@@ -4611,7 +4651,7 @@ dependencies = [
"rustc_target",
"termize",
"tracing",
"windows 0.61.3",
"windows",
]
[[package]]
@@ -4798,7 +4838,7 @@ version = "0.0.0"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.106",
"syn 2.0.110",
"synstructure",
]
@@ -4896,7 +4936,7 @@ dependencies = [
"proc-macro2",
"quote",
"serde",
"syn 2.0.106",
"syn 2.0.110",
]
[[package]]
@@ -4958,11 +4998,11 @@ dependencies = [
[[package]]
name = "ruzstd"
version = "0.8.1"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3640bec8aad418d7d03c72ea2de10d5c646a598f9883c7babc160d91e3c1b26c"
checksum = "e5ff0cc5e135c8870a775d3320910cd9b564ec036b4dc0b8741629020be63f01"
dependencies = [
"twox-hash 2.1.1",
"twox-hash 2.1.2",
]
[[package]]
@@ -4982,18 +5022,18 @@ dependencies = [
[[package]]
name = "schannel"
version = "0.1.27"
version = "0.1.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f29ebaa345f945cec9fbbc532eb307f0fdad8161f281b6369539c8d84876b3d"
checksum = "891d81b926048e76efe18581bf793546b4c0eaf8448d72be8de2bbee5fd166e1"
dependencies = [
"windows-sys 0.59.0",
"windows-sys 0.61.2",
]
[[package]]
name = "schemars"
version = "1.0.4"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "82d20c4491bc164fa2f6c5d44565947a52ad80b9505d8e36f8d54c27c739fcd0"
checksum = "9558e172d4e8533736ba97870c4b2cd63f84b382a3d6eb063da41b91cce17289"
dependencies = [
"dyn-clone",
"ref-cast",
@@ -5004,14 +5044,14 @@ dependencies = [
[[package]]
name = "schemars_derive"
version = "1.0.4"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "33d020396d1d138dc19f1165df7545479dcd58d93810dc5d646a16e55abefa80"
checksum = "301858a4023d78debd2353c7426dc486001bddc91ae31a76fb1f55132f7e2633"
dependencies = [
"proc-macro2",
"quote",
"serde_derive_internals",
"syn 2.0.106",
"syn 2.0.110",
]
[[package]]
@@ -5034,17 +5074,18 @@ checksum = "d68f2ec51b097e4c1a75b681a8bec621909b5e91f15bb7b840c4f2f7b01148b2"
[[package]]
name = "self_cell"
version = "1.2.0"
version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0f7d95a54511e0c7be3f51e8867aa8cf35148d7b9445d44de2f943e2b206e749"
checksum = "16c2f82143577edb4921b71ede051dac62ca3c16084e918bf7b40c96ae10eb33"
[[package]]
name = "semver"
version = "1.0.26"
version = "1.0.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56e6fa9c48d24d85fb3de5ad847117517440f6beceb7798af16b4a87d616b8d0"
checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2"
dependencies = [
"serde",
"serde_core",
]
[[package]]
@@ -5059,12 +5100,13 @@ dependencies = [
[[package]]
name = "serde-untagged"
version = "0.1.8"
version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34836a629bcbc6f1afdf0907a744870039b1e14c0561cb26094fa683b158eff3"
checksum = "f9faf48a4a2d2693be24c6289dbe26552776eb7737074e6722891fadbe6c5058"
dependencies = [
"erased-serde",
"serde",
"serde_core",
"typeid",
]
@@ -5095,7 +5137,7 @@ checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.106",
"syn 2.0.110",
]
[[package]]
@@ -5106,29 +5148,31 @@ checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.106",
"syn 2.0.110",
]
[[package]]
name = "serde_json"
version = "1.0.142"
version = "1.0.145"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "030fedb782600dcbd6f02d479bf0d817ac3bb40d644745b769d6a96bc3afc5a7"
checksum = "402a6f66d8c709116cf22f558eab210f5a50187f702eb4d7e5ef38d9a7f1c79c"
dependencies = [
"itoa",
"memchr",
"ryu",
"serde",
"serde_core",
]
[[package]]
name = "serde_path_to_error"
version = "0.1.17"
version = "0.1.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "59fab13f937fa393d08645bf3a84bdfe86e296747b506ada67bb15f10f218b2a"
checksum = "10a9ff822e371bb5403e391ecd83e182e0e77ba7f6fe0160b795797109d1b457"
dependencies = [
"itoa",
"serde",
"serde_core",
]
[[package]]
@@ -5142,9 +5186,9 @@ dependencies = [
[[package]]
name = "serde_spanned"
version = "1.0.2"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5417783452c2be558477e104686f7de5dae53dba813c28435e0e70f82d9b04ee"
checksum = "e24345aa0fe688594e73770a5f6d1b216508b4f93484c0026d521acd30134392"
dependencies = [
"serde_core",
]
@@ -5186,6 +5230,12 @@ version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
[[package]]
name = "simd-adler32"
version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe"
[[package]]
name = "similar"
version = "2.7.0"
@@ -5206,12 +5256,12 @@ checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03"
[[package]]
name = "socket2"
version = "0.6.0"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "233504af464074f9d066d7b5416c5f9b894a5862a6506e306f7b816cdd6f1807"
checksum = "17129e116933cf371d018bb80ae557e889637989d8638274fb25622827b03881"
dependencies = [
"libc",
"windows-sys 0.59.0",
"windows-sys 0.60.2",
]
[[package]]
@@ -5256,9 +5306,9 @@ dependencies = [
[[package]]
name = "stable_deref_trait"
version = "1.2.0"
version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596"
[[package]]
name = "stacker"
@@ -5351,9 +5401,9 @@ dependencies = [
[[package]]
name = "syn"
version = "2.0.106"
version = "2.0.110"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6"
checksum = "a99801b5bd34ede4cf3fc688c5919368fea4e4814a4664359503e6015b280aea"
dependencies = [
"proc-macro2",
"quote",
@@ -5368,19 +5418,19 @@ checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.106",
"syn 2.0.110",
]
[[package]]
name = "sysinfo"
version = "0.37.0"
version = "0.37.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "07cec4dc2d2e357ca1e610cfb07de2fa7a10fc3e9fe89f72545f3d244ea87753"
checksum = "16607d5caffd1c07ce073528f9ed972d88db15dd44023fa57142963be3feb11f"
dependencies = [
"libc",
"objc2-core-foundation",
"objc2-io-kit",
"windows 0.61.3",
"windows",
]
[[package]]
@@ -5406,15 +5456,15 @@ dependencies = [
[[package]]
name = "tempfile"
version = "3.20.0"
version = "3.23.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8a64e3985349f2441a1a9ef0b853f869006c3855f2cda6862a94d26ebb9d6a1"
checksum = "2d31c77bdf42a745371d260a26ca7163f1e0924b64afa0b688e61b5a9fa02f16"
dependencies = [
"fastrand",
"getrandom 0.3.3",
"once_cell",
"rustix",
"windows-sys 0.59.0",
"windows-sys 0.61.2",
]
[[package]]
@@ -5450,14 +5500,20 @@ dependencies = [
[[package]]
name = "termize"
version = "0.2.0"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a8da106d1a19c5b9c53c03311936568a0439926a7607815bd3461139cbab1cc"
checksum = "61946f539e9ff67cbc8df5b2e9823d84e0d58d74e342707c2dfb85405995827b"
dependencies = [
"libc",
"windows-sys 0.60.2",
"windows-sys 0.61.2",
]
[[package]]
name = "termtree"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f50febec83f5ee1df3015341d8bd429f2d1cc62bcba7ea2076759d315084683"
[[package]]
name = "test-float-parse"
version = "0.1.0"
@@ -5486,11 +5542,11 @@ dependencies = [
[[package]]
name = "thiserror"
version = "2.0.15"
version = "2.0.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "80d76d3f064b981389ecb4b6b7f45a0bf9fdac1d5b9204c7bd6714fecc302850"
checksum = "f63587ca0f12b72a0600bcba1d40081f830876000bb46dd2337a3051618f4fc8"
dependencies = [
"thiserror-impl 2.0.15",
"thiserror-impl 2.0.17",
]
[[package]]
@@ -5501,18 +5557,18 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.106",
"syn 2.0.110",
]
[[package]]
name = "thiserror-impl"
version = "2.0.15"
version = "2.0.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44d29feb33e986b6ea906bd9c3559a856983f92371b3eaa5e83782a351623de0"
checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.106",
"syn 2.0.110",
]
[[package]]
@@ -5522,7 +5578,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e9c1e705f82a260173f3eec93f2ff6d7807f23ad5a8cc2e7316a891733ea7a1"
dependencies = [
"gimli 0.31.1",
"hashbrown",
"hashbrown 0.15.5",
"object 0.36.7",
"tracing",
]
@@ -5570,9 +5626,9 @@ version = "0.1.0"
[[package]]
name = "tikv-jemalloc-sys"
version = "0.6.0+5.3.0-1-ge13ca993e8ccb9ba9847cc330696e02839f328f7"
version = "0.6.1+5.3.0-1-ge13ca993e8ccb9ba9847cc330696e02839f328f7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cd3c60906412afa9c2b5b5a48ca6a5abe5736aec9eb48ad05037a677e52e4e2d"
checksum = "cd8aa5b2ab86a2cefa406d889139c162cbb230092f7d1d7cbc1716405d852a3b"
dependencies = [
"cc",
"libc",
@@ -5580,19 +5636,20 @@ dependencies = [
[[package]]
name = "tinystr"
version = "0.8.1"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5d4f6d1145dcb577acf783d4e601bc1d76a13337bb54e6233add580b07344c8b"
checksum = "42d3e9c45c09de15d06dd8acf5f4e0e399e85927b7f00711024eb7ae10fa4869"
dependencies = [
"displaydoc",
"serde_core",
"zerovec",
]
[[package]]
name = "tinyvec"
version = "1.9.0"
version = "1.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09b3661f17e86524eccd4371ab0429194e0d7c008abb45f7a7495b1719463c71"
checksum = "bfa5fdc3bce6191a1dbc8c02d5c8bffcf557bafa17c124c5264a458f1b0613fa"
dependencies = [
"tinyvec_macros",
]
@@ -5630,14 +5687,14 @@ dependencies = [
[[package]]
name = "toml"
version = "0.9.7"
version = "0.9.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "00e5e5d9bf2475ac9d4f0d9edab68cc573dc2fd644b0dba36b0c30a92dd9eaa0"
checksum = "f0dc8b1fb61449e27716ec0e1bdf0f6b8f3e8f6b05391e8497b8b6d7804ea6d8"
dependencies = [
"indexmap",
"serde_core",
"serde_spanned 1.0.2",
"toml_datetime 0.7.2",
"serde_spanned 1.0.3",
"toml_datetime 0.7.3",
"toml_parser",
"toml_writer",
"winnow 0.7.13",
@@ -5654,9 +5711,9 @@ dependencies = [
[[package]]
name = "toml_datetime"
version = "0.7.2"
version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32f1085dec27c2b6632b04c80b3bb1b4300d6495d1e129693bdda7d91e72eec1"
checksum = "f2cdb639ebbc97961c51720f858597f7f24c4fc295327923af55b74c3c724533"
dependencies = [
"serde_core",
]
@@ -5690,9 +5747,9 @@ dependencies = [
[[package]]
name = "toml_parser"
version = "1.0.3"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4cf893c33be71572e0e9aa6dd15e6677937abd686b066eac3f8cd3531688a627"
checksum = "c0cbe268d35bdb4bb5a56a2de88d0ad0eb70af5384a99d648cd4b3d04039800e"
dependencies = [
"winnow 0.7.13",
]
@@ -5705,9 +5762,9 @@ checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801"
[[package]]
name = "toml_writer"
version = "1.0.3"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d163a63c116ce562a22cda521fcc4d79152e7aba014456fb5eb442f6d6a10109"
checksum = "df8b2b54733674ad286d16267dcfc7a71ed5c776e4ac7aa3c3e2561f7c637bf2"
[[package]]
name = "tracing"
@@ -5728,7 +5785,7 @@ checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.106",
"syn 2.0.110",
]
[[package]]
@@ -5764,15 +5821,15 @@ dependencies = [
[[package]]
name = "tracing-subscriber"
version = "0.3.18"
version = "0.3.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b"
checksum = "2054a14f5307d601f88daf0553e1cbf472acc4f2c51afab632431cdcd72124d5"
dependencies = [
"matchers",
"nu-ansi-term 0.46.0",
"nu-ansi-term",
"once_cell",
"parking_lot",
"regex",
"regex-automata",
"sharded-slab",
"smallvec",
"thread_local",
@@ -5787,7 +5844,7 @@ version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b56c62d2c80033cb36fae448730a2f2ef99410fe3ecbffc916681a32f6807dbe"
dependencies = [
"nu-ansi-term 0.50.1",
"nu-ansi-term",
"tracing-core",
"tracing-log",
"tracing-subscriber",
@@ -5806,9 +5863,9 @@ dependencies = [
[[package]]
name = "twox-hash"
version = "2.1.1"
version = "2.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b907da542cbced5261bd3256de1b3a1bf340a3d37f93425a07362a1d687de56"
checksum = "9ea3136b675547379c4bd395ca6b938e5ad3c3d20fad76e7fe85f9e0d011419c"
[[package]]
name = "type-map"
@@ -5827,9 +5884,9 @@ checksum = "bc7d623258602320d5c55d1bc22793b57daff0ec7efc270ea7d55ce1d5f5471c"
[[package]]
name = "typenum"
version = "1.18.0"
version = "1.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f"
checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb"
[[package]]
name = "ucd-parse"
@@ -5848,9 +5905,9 @@ checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971"
[[package]]
name = "ui_test"
version = "0.30.2"
version = "0.30.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b56a6897cc4bb6f8daf1939b0b39cd9645856997f46f4d0b3e3cb7122dfe9251"
checksum = "44eb652e1a8799d4e47f20851370e86247cbc5270ce677ab1e9409a6d45a9649"
dependencies = [
"annotate-snippets 0.11.5",
"anyhow",
@@ -5858,7 +5915,7 @@ dependencies = [
"cargo-platform 0.1.9",
"cargo_metadata 0.18.1",
"color-eyre",
"colored 2.2.0",
"colored 3.0.0",
"comma",
"crossbeam-channel",
"indicatif",
@@ -5911,7 +5968,7 @@ checksum = "a1249a628de3ad34b821ecb1001355bca3940bcb2f88558f1a8bd82e977f75b5"
dependencies = [
"proc-macro-hack",
"quote",
"syn 2.0.106",
"syn 2.0.110",
"unic-langid-impl",
]
@@ -6008,13 +6065,14 @@ dependencies = [
[[package]]
name = "url"
version = "2.5.4"
version = "2.5.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60"
checksum = "08bc136a29a3d1758e07a9cca267be308aeebf5cfd5a10f3f67ab2097683ef5b"
dependencies = [
"form_urlencoded",
"idna",
"percent-encoding",
"serde",
]
[[package]]
@@ -6049,9 +6107,9 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
[[package]]
name = "uuid"
version = "1.18.0"
version = "1.18.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f33196643e165781c20a5ead5582283a7dacbb87855d867fbc2df3f81eddc1be"
checksum = "2f87b8aa10b915a06587d0dec516c282ff295b475d94abf425d62b57710070a2"
dependencies = [
"getrandom 0.3.3",
"js-sys",
@@ -6076,6 +6134,15 @@ version = "0.9.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
[[package]]
name = "wait-timeout"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09ac3b126d3914f9849036f826e054cbabdc8519970b8998ddaf3b5bd3c65f11"
dependencies = [
"libc",
]
[[package]]
name = "walkdir"
version = "2.5.0"
@@ -6109,35 +6176,22 @@ checksum = "7ec3ef3783e18f2457796ed91b1e6c2adc46f2905f740d1527ab3053fe8e5682"
[[package]]
name = "wasm-bindgen"
version = "0.2.100"
version = "0.2.105"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5"
checksum = "da95793dfc411fbbd93f5be7715b0578ec61fe87cb1a42b12eb625caa5c5ea60"
dependencies = [
"cfg-if",
"once_cell",
"rustversion",
"wasm-bindgen-macro",
]
[[package]]
name = "wasm-bindgen-backend"
version = "0.2.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6"
dependencies = [
"bumpalo",
"log",
"proc-macro2",
"quote",
"syn 2.0.106",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-macro"
version = "0.2.100"
version = "0.2.105"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407"
checksum = "04264334509e04a7bf8690f2384ef5265f05143a4bff3889ab7a3269adab59c2"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
@@ -6145,22 +6199,22 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro-support"
version = "0.2.100"
version = "0.2.105"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de"
checksum = "420bc339d9f322e562942d52e115d57e950d12d88983a14c79b86859ee6c7ebc"
dependencies = [
"bumpalo",
"proc-macro2",
"quote",
"syn 2.0.106",
"wasm-bindgen-backend",
"syn 2.0.110",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-shared"
version = "0.2.100"
version = "0.2.105"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d"
checksum = "76f218a38c84bcb33c25ec7059b07847d465ce0e0a76b995e134a45adcb6af76"
dependencies = [
"unicode-ident",
]
@@ -6251,7 +6305,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "46d90019b1afd4b808c263e428de644f3003691f243387d30d673211ee0cb8e8"
dependencies = [
"bitflags",
"hashbrown",
"hashbrown 0.15.5",
"indexmap",
"semver",
"serde",
@@ -6307,11 +6361,11 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
[[package]]
name = "winapi-util"
version = "0.1.9"
version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb"
checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
dependencies = [
"windows-sys 0.59.0",
"windows-sys 0.61.2",
]
[[package]]
@@ -6320,16 +6374,6 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "windows"
version = "0.58.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd04d41d93c4992d421894c18c8b43496aa748dd4c081bac0dc93eb0489272b6"
dependencies = [
"windows-core 0.58.0",
"windows-targets 0.52.6",
]
[[package]]
name = "windows"
version = "0.61.3"
@@ -6363,32 +6407,32 @@ dependencies = [
"windows-core 0.61.2",
]
[[package]]
name = "windows-core"
version = "0.58.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ba6d44ec8c2591c134257ce647b7ea6b20335bf6379a27dac5f1641fcf59f99"
dependencies = [
"windows-implement 0.58.0",
"windows-interface 0.58.0",
"windows-result 0.2.0",
"windows-strings 0.1.0",
"windows-targets 0.52.6",
]
[[package]]
name = "windows-core"
version = "0.61.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3"
dependencies = [
"windows-implement 0.60.0",
"windows-interface 0.59.1",
"windows-implement",
"windows-interface",
"windows-link 0.1.3",
"windows-result 0.3.4",
"windows-strings 0.4.2",
]
[[package]]
name = "windows-core"
version = "0.62.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb"
dependencies = [
"windows-implement",
"windows-interface",
"windows-link 0.2.1",
"windows-result 0.4.1",
"windows-strings 0.5.1",
]
[[package]]
name = "windows-future"
version = "0.2.1"
@@ -6402,46 +6446,24 @@ dependencies = [
[[package]]
name = "windows-implement"
version = "0.58.0"
version = "0.60.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2bbd5b46c938e506ecbce286b6628a02171d56153ba733b6c741fc627ec9579b"
checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.106",
]
[[package]]
name = "windows-implement"
version = "0.60.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.106",
"syn 2.0.110",
]
[[package]]
name = "windows-interface"
version = "0.58.0"
version = "0.59.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "053c4c462dc91d3b1504c6fe5a726dd15e216ba718e84a0e46a88fbe5ded3515"
checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.106",
]
[[package]]
name = "windows-interface"
version = "0.59.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.106",
"syn 2.0.110",
]
[[package]]
@@ -6466,15 +6488,6 @@ dependencies = [
"windows-link 0.1.3",
]
[[package]]
name = "windows-result"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e"
dependencies = [
"windows-targets 0.52.6",
]
[[package]]
name = "windows-result"
version = "0.3.4"
@@ -6485,13 +6498,12 @@ dependencies = [
]
[[package]]
name = "windows-strings"
version = "0.1.0"
name = "windows-result"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10"
checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5"
dependencies = [
"windows-result 0.2.0",
"windows-targets 0.52.6",
"windows-link 0.2.1",
]
[[package]]
@@ -6504,12 +6516,12 @@ dependencies = [
]
[[package]]
name = "windows-sys"
version = "0.52.0"
name = "windows-strings"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091"
dependencies = [
"windows-targets 0.52.6",
"windows-link 0.2.1",
]
[[package]]
@@ -6527,7 +6539,7 @@ version = "0.60.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb"
dependencies = [
"windows-targets 0.53.3",
"windows-targets 0.53.5",
]
[[package]]
@@ -6557,19 +6569,19 @@ dependencies = [
[[package]]
name = "windows-targets"
version = "0.53.3"
version = "0.53.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d5fe6031c4041849d7c496a8ded650796e7b6ecc19df1a431c1a363342e5dc91"
checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3"
dependencies = [
"windows-link 0.1.3",
"windows_aarch64_gnullvm 0.53.0",
"windows_aarch64_msvc 0.53.0",
"windows_i686_gnu 0.53.0",
"windows_i686_gnullvm 0.53.0",
"windows_i686_msvc 0.53.0",
"windows_x86_64_gnu 0.53.0",
"windows_x86_64_gnullvm 0.53.0",
"windows_x86_64_msvc 0.53.0",
"windows-link 0.2.1",
"windows_aarch64_gnullvm 0.53.1",
"windows_aarch64_msvc 0.53.1",
"windows_i686_gnu 0.53.1",
"windows_i686_gnullvm 0.53.1",
"windows_i686_msvc 0.53.1",
"windows_x86_64_gnu 0.53.1",
"windows_x86_64_gnullvm 0.53.1",
"windows_x86_64_msvc 0.53.1",
]
[[package]]
@@ -6589,9 +6601,9 @@ checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.53.0"
version = "0.53.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764"
checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53"
[[package]]
name = "windows_aarch64_msvc"
@@ -6601,9 +6613,9 @@ checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
[[package]]
name = "windows_aarch64_msvc"
version = "0.53.0"
version = "0.53.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c"
checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006"
[[package]]
name = "windows_i686_gnu"
@@ -6613,9 +6625,9 @@ checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
[[package]]
name = "windows_i686_gnu"
version = "0.53.0"
version = "0.53.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3"
checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3"
[[package]]
name = "windows_i686_gnullvm"
@@ -6625,9 +6637,9 @@ checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
[[package]]
name = "windows_i686_gnullvm"
version = "0.53.0"
version = "0.53.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11"
checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c"
[[package]]
name = "windows_i686_msvc"
@@ -6637,9 +6649,9 @@ checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
[[package]]
name = "windows_i686_msvc"
version = "0.53.0"
version = "0.53.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d"
checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2"
[[package]]
name = "windows_x86_64_gnu"
@@ -6649,9 +6661,9 @@ checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
[[package]]
name = "windows_x86_64_gnu"
version = "0.53.0"
version = "0.53.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba"
checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499"
[[package]]
name = "windows_x86_64_gnullvm"
@@ -6661,9 +6673,9 @@ checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.53.0"
version = "0.53.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57"
checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1"
[[package]]
name = "windows_x86_64_msvc"
@@ -6673,9 +6685,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
[[package]]
name = "windows_x86_64_msvc"
version = "0.53.0"
version = "0.53.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486"
checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650"
[[package]]
name = "winnow"
@@ -6749,9 +6761,9 @@ dependencies = [
[[package]]
name = "writeable"
version = "0.6.1"
version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea2f10b9bb0928dfb1b42b65e1f9e36f7f54dbdf08457afefb38afcdec4fa2bb"
checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9"
[[package]]
name = "x"
@@ -6759,9 +6771,9 @@ version = "0.1.1"
[[package]]
name = "xattr"
version = "1.5.1"
version = "1.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af3a19837351dc82ba89f8a125e22a3c475f05aba604acc023d62b2739ae2909"
checksum = "32e45ad4206f6d2479085147f02bc2ef834ac85886624a23575ae137c8aa8156"
dependencies = [
"libc",
"rustix",
@@ -6787,11 +6799,10 @@ dependencies = [
[[package]]
name = "yoke"
version = "0.8.0"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f41bb01b8226ef4bfd589436a297c53d118f65921786300e427be8d487695cc"
checksum = "72d6e5c6afb84d73944e5cedb052c4680d5657337201555f9f2a16b7406d4954"
dependencies = [
"serde",
"stable_deref_trait",
"yoke-derive",
"zerofrom",
@@ -6799,34 +6810,34 @@ dependencies = [
[[package]]
name = "yoke-derive"
version = "0.8.0"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38da3c9736e16c5d3c8c597a9aaa5d1fa565d0532ae05e27c24aa62fb32c0ab6"
checksum = "b659052874eb698efe5b9e8cf382204678a0086ebf46982b79d6ca3182927e5d"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.106",
"syn 2.0.110",
"synstructure",
]
[[package]]
name = "zerocopy"
version = "0.8.26"
version = "0.8.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1039dd0d3c310cf05de012d8a39ff557cb0d23087fd44cad61df08fc31907a2f"
checksum = "0894878a5fa3edfd6da3f88c4805f4c8558e2b996227a3d864f47fe11e38282c"
dependencies = [
"zerocopy-derive",
]
[[package]]
name = "zerocopy-derive"
version = "0.8.26"
version = "0.8.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ecf5b4cc5364572d7f4c329661bcc82724222973f2cab6f050a4e5c22f75181"
checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.106",
"syn 2.0.110",
]
[[package]]
@@ -6846,15 +6857,15 @@ checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.106",
"syn 2.0.110",
"synstructure",
]
[[package]]
name = "zerotrie"
version = "0.2.2"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "36f0bbd478583f79edad978b407914f61b2972f5af6fa089686016be8f9af595"
checksum = "2a59c17a5562d507e4b54960e8569ebee33bee890c70aa3fe7b97e85a9fd7851"
dependencies = [
"displaydoc",
"yoke",
@@ -6863,10 +6874,11 @@ dependencies = [
[[package]]
name = "zerovec"
version = "0.11.4"
version = "0.11.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e7aa2bd55086f1ab526693ecbe444205da57e25f4489879da80635a46d90e73b"
checksum = "6c28719294829477f525be0186d13efa9a3c602f7ec202ca9e353d310fb9a002"
dependencies = [
"serde",
"yoke",
"zerofrom",
"zerovec-derive",
@@ -6874,11 +6886,11 @@ dependencies = [
[[package]]
name = "zerovec-derive"
version = "0.11.1"
version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b96237efa0c878c64bd89c436f661be4e46b2f3eff1ebb976f7ef2321d2f58f"
checksum = "eadce39539ca5cb3985590102671f2567e659fca9666581ad3411d59207951f3"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.106",
"syn 2.0.110",
]
+12
View File
@@ -708,6 +708,12 @@
# desired in distributions, for example.
#rust.rpath = true
# Additional flags to pass to `rustc`.
# Takes precedence over bootstrap's own flags but not over per target rustflags nor env. vars. like RUSTFLAGS.
# Applies to all stages and targets.
#
#rust.rustflags = []
# Indicates whether symbols should be stripped using `-Cstrip=symbols`.
#rust.strip = false
@@ -1013,6 +1019,12 @@
# and will override the same option under [rust] section. It only works on Unix platforms
#rpath = rust.rpath (bool)
# Additional flags to pass to `rustc`.
# Takes precedence over bootstrap's own flags and `rust.rustflags` but not over env. vars. like RUSTFLAGS.
# Applies to all stages.
#
#rustflags = rust.rustflags
# Force static or dynamic linkage of the standard library for this target. If
# this target is a host for rustc, this will also affect the linkage of the
# compiler itself. This is useful for building rustc on targets that normally
+10 -2
View File
@@ -20,10 +20,17 @@ rustc_public = { path = "../rustc_public" }
rustc_public_bridge = { path = "../rustc_public_bridge" }
# tidy-alphabetical-end
# Pin these to avoid pulling in a package with a binary blob
# <https://github.com/rust-lang/rust/pull/136395#issuecomment-2692769062>
[target.'cfg(target_os = "wasi")'.dependencies]
getrandom = "=0.3.3"
wasi = "=0.14.2"
[dependencies.tikv-jemalloc-sys]
version = "0.6.0"
version = "0.6.1"
optional = true
features = ['unprefixed_malloc_on_supported_platforms']
features = ['override_allocator_on_supported_platforms']
[features]
# tidy-alphabetical-start
@@ -31,6 +38,7 @@ check_only = ['rustc_driver_impl/check_only']
jemalloc = ['dep:tikv-jemalloc-sys']
llvm = ['rustc_driver_impl/llvm']
llvm_enzyme = ['rustc_driver_impl/llvm_enzyme']
llvm_offload = ['rustc_driver_impl/llvm_offload']
max_level_info = ['rustc_driver_impl/max_level_info']
rustc_randomized_layouts = ['rustc_driver_impl/rustc_randomized_layouts']
# tidy-alphabetical-end
+14 -49
View File
@@ -7,26 +7,25 @@
// distribution. The obvious way to do this is with the `#[global_allocator]`
// mechanism. However, for complicated reasons (see
// https://github.com/rust-lang/rust/pull/81782#issuecomment-784438001 for some
// details) that mechanism doesn't work here. Also, we must use a consistent
// allocator across the rustc <-> llvm boundary, and `#[global_allocator]`
// wouldn't provide that.
// details) that mechanism doesn't work here. Also, we'd like to use a
// consistent allocator across the rustc <-> llvm boundary, and
// `#[global_allocator]` wouldn't provide that.
//
// Instead, we use a lower-level mechanism. rustc is linked with jemalloc in a
// way such that jemalloc's implementation of `malloc`, `free`, etc., override
// the libc allocator's implementation. This means that Rust's `System`
// allocator, which calls `libc::malloc()` et al., is actually calling into
// jemalloc.
// Instead, we use a lower-level mechanism, namely the
// `"override_allocator_on_supported_platforms"` Cargo feature of jemalloc-sys.
//
// This makes jemalloc-sys override the libc/system allocator's implementation
// of `malloc`, `free`, etc.. This means that Rust's `System` allocator, which
// calls `libc::malloc()` et al., is actually calling into jemalloc.
//
// A consequence of not using `GlobalAlloc` (and the `tikv-jemallocator` crate
// provides an impl of that trait, which is called `Jemalloc`) is that we
// cannot use the sized deallocation APIs (`sdallocx`) that jemalloc provides.
// It's unclear how much performance is lost because of this.
//
// As for the symbol overrides in `main` below: we're pulling in a static copy
// of jemalloc. We need to actually reference its symbols for it to get linked.
// The two crates we link to here, `std` and `rustc_driver`, are both dynamic
// libraries. So we must reference jemalloc symbols one way or another, because
// this file is the only object code in the rustc executable.
// NOTE: Even though Cargo passes `--extern` with `tikv_jemalloc_sys`, we still need to `use` the
// crate for the compiler to see the `#[used]`, see https://github.com/rust-lang/rust/issues/64402.
// This is similarly required if we used a crate with `#[global_allocator]`.
//
// NOTE: if you are reading this comment because you want to set a custom `global_allocator` for
// benchmarking, consider using the benchmarks in the `rustc-perf` collector suite instead:
@@ -36,43 +35,9 @@
// to compare their performance, see
// https://github.com/rust-lang/rust/commit/b90cfc887c31c3e7a9e6d462e2464db1fe506175#diff-43914724af6e464c1da2171e4a9b6c7e607d5bc1203fa95c0ab85be4122605ef
// for an example of how to do so.
#[cfg(feature = "jemalloc")]
use tikv_jemalloc_sys as _;
fn main() {
// See the comment at the top of this file for an explanation of this.
#[cfg(feature = "jemalloc")]
{
use std::os::raw::{c_int, c_void};
use tikv_jemalloc_sys as jemalloc_sys;
#[used]
static _F1: unsafe extern "C" fn(usize, usize) -> *mut c_void = jemalloc_sys::calloc;
#[used]
static _F2: unsafe extern "C" fn(*mut *mut c_void, usize, usize) -> c_int =
jemalloc_sys::posix_memalign;
#[used]
static _F3: unsafe extern "C" fn(usize, usize) -> *mut c_void = jemalloc_sys::aligned_alloc;
#[used]
static _F4: unsafe extern "C" fn(usize) -> *mut c_void = jemalloc_sys::malloc;
#[used]
static _F5: unsafe extern "C" fn(*mut c_void, usize) -> *mut c_void = jemalloc_sys::realloc;
#[used]
static _F6: unsafe extern "C" fn(*mut c_void) = jemalloc_sys::free;
// On OSX, jemalloc doesn't directly override malloc/free, but instead
// registers itself with the allocator's zone APIs in a ctor. However,
// the linker doesn't seem to consider ctors as "used" when statically
// linking, so we need to explicitly depend on the function.
#[cfg(target_os = "macos")]
{
unsafe extern "C" {
fn _rjem_je_zone_register();
}
#[used]
static _F7: unsafe extern "C" fn() = _rjem_je_zone_register;
}
}
rustc_driver::main()
}
+3 -3
View File
@@ -857,7 +857,7 @@ pub fn prefix_str(self) -> &'static str {
}
}
#[derive(Clone, Encodable, Decodable, Debug, Walkable)]
#[derive(Clone, Copy, Encodable, Decodable, Debug, Walkable)]
pub enum RangeEnd {
/// `..=` or `...`
Included(RangeSyntax),
@@ -865,7 +865,7 @@ pub enum RangeEnd {
Excluded,
}
#[derive(Clone, Encodable, Decodable, Debug, Walkable)]
#[derive(Clone, Copy, Encodable, Decodable, Debug, Walkable)]
pub enum RangeSyntax {
/// `...`
DotDotDot,
@@ -1915,7 +1915,7 @@ pub enum ForLoopKind {
}
/// Used to differentiate between `async {}` blocks and `gen {}` blocks.
#[derive(Clone, Encodable, Decodable, Debug, PartialEq, Eq, Walkable)]
#[derive(Clone, Copy, Encodable, Decodable, Debug, PartialEq, Eq, Walkable)]
pub enum GenBlockKind {
Async,
Gen,
+7 -3
View File
@@ -37,9 +37,10 @@ ast_passes_assoc_type_without_body =
.suggestion = provide a definition for the type
ast_passes_async_fn_in_const_trait_or_trait_impl =
async functions are not allowed in `const` {$in_impl ->
[true] trait impls
*[false] traits
async functions are not allowed in `const` {$context ->
[trait_impl] trait impls
[impl] impls
*[trait] traits
}
.label = associated functions of `const` cannot be declared `async`
@@ -88,6 +89,9 @@ ast_passes_const_and_coroutine = functions cannot be both `const` and `{$corouti
.coroutine = `{$coroutine_kind}` because of this
.label = {""}
ast_passes_const_auto_trait = auto traits cannot be const
.help = remove the `const` keyword
ast_passes_const_bound_trait_object = const trait bounds are not allowed in trait object types
ast_passes_const_without_body =
@@ -312,9 +312,15 @@ fn check_async_fn_in_const_trait_or_impl(&self, sig: &FnSig, parent: &TraitOrImp
return;
};
let context = match parent {
TraitOrImpl::Trait { .. } => "trait",
TraitOrImpl::TraitImpl { .. } => "trait_impl",
TraitOrImpl::Impl { .. } => "impl",
};
self.dcx().emit_err(errors::AsyncFnInConstTraitOrTraitImpl {
async_keyword,
in_impl: matches!(parent, TraitOrImpl::TraitImpl { .. }),
context,
const_keyword,
});
}
@@ -814,6 +820,12 @@ fn check_mod_file_item_asciionly(&self, ident: Ident) {
self.dcx().emit_err(errors::ModuleNonAscii { span: ident.span, name: ident.name });
}
fn deny_const_auto_traits(&self, constness: Const) {
if let Const::Yes(span) = constness {
self.dcx().emit_err(errors::ConstAutoTrait { span });
}
}
fn deny_generic_params(&self, generics: &Generics, ident_span: Span) {
if !generics.params.is_empty() {
self.dcx()
@@ -1251,6 +1263,8 @@ fn visit_item(&mut self, item: &'a Item) {
}) => {
self.visit_attrs_vis_ident(&item.attrs, &item.vis, ident);
if *is_auto == IsAuto::Yes {
// For why we reject `const auto trait`, see rust-lang/rust#149285.
self.deny_const_auto_traits(*constness);
// Auto traits cannot have generics, super traits nor contain items.
self.deny_generic_params(generics, ident.span);
self.deny_super_traits(bounds, ident.span);
@@ -1714,9 +1728,10 @@ fn visit_assoc_item(&mut self, item: &'a AssocItem, ctxt: AssocCtxt) {
self.check_async_fn_in_const_trait_or_impl(sig, parent);
}
}
Some(TraitOrImpl::Impl { constness }) => {
Some(parent @ TraitOrImpl::Impl { constness }) => {
if let AssocItemKind::Fn(box Fn { sig, .. }) = &item.kind {
self.check_impl_fn_not_const(sig.header.constness, *constness);
self.check_async_fn_in_const_trait_or_impl(sig, parent);
}
}
None => {}
+9 -1
View File
@@ -76,7 +76,7 @@ pub(crate) struct TraitFnConst {
pub(crate) struct AsyncFnInConstTraitOrTraitImpl {
#[primary_span]
pub async_keyword: Span,
pub in_impl: bool,
pub context: &'static str,
#[label]
pub const_keyword: Span,
}
@@ -429,6 +429,14 @@ pub(crate) struct AutoTraitItems {
pub ident: Span,
}
#[derive(Diagnostic)]
#[diag(ast_passes_const_auto_trait)]
#[help]
pub(crate) struct ConstAutoTrait {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(ast_passes_generic_before_constraints)]
pub(crate) struct ArgsBeforeConstraint {
@@ -82,7 +82,8 @@ pub fn parse_cfg_entry<S: Stage>(
}
},
a @ (ArgParser::NoArgs | ArgParser::NameValue(_)) => {
let Some(name) = meta.path().word_sym() else {
let Some(name) = meta.path().word_sym().filter(|s| !s.is_path_segment_keyword())
else {
return Err(cx.expected_identifier(meta.path().span()));
};
parse_name_value(name, meta.path().span(), a.name_value(), meta.span(), cx)?
@@ -158,7 +159,7 @@ fn parse_cfg_entry_target<S: Stage>(
};
// Then, parse it as a name-value item
let Some(name) = sub_item.path().word_sym() else {
let Some(name) = sub_item.path().word_sym().filter(|s| !s.is_path_segment_keyword()) else {
return Err(cx.expected_identifier(sub_item.path().span()));
};
let name = Symbol::intern(&format!("target_{name}"));
@@ -220,7 +220,10 @@ pub fn eval_condition(
}
}
}
MetaItemKind::Word | MetaItemKind::NameValue(..) if cfg.path.segments.len() != 1 => {
MetaItemKind::Word | MetaItemKind::NameValue(..)
if cfg.path.segments.len() != 1
|| cfg.path.segments[0].ident.is_path_segment_keyword() =>
{
dcx.emit_err(session_diagnostics::CfgPredicateIdentifier { span: cfg.path.span });
true
}
@@ -38,6 +38,17 @@ impl<S: Stage> NoArgsAttributeParser<S> for PassByValueParser {
const CREATE: fn(Span) -> AttributeKind = AttributeKind::PassByValue;
}
pub(crate) struct RustcShouldNotBeCalledOnConstItems;
impl<S: Stage> NoArgsAttributeParser<S> for RustcShouldNotBeCalledOnConstItems {
const PATH: &[Symbol] = &[sym::rustc_should_not_be_called_on_const_items];
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[
Allow(Target::Method(MethodKind::Inherent)),
Allow(Target::Method(MethodKind::TraitImpl)),
]);
const CREATE: fn(Span) -> AttributeKind = AttributeKind::RustcShouldNotBeCalledOnConstItems;
}
pub(crate) struct AutomaticallyDerivedParser;
impl<S: Stage> NoArgsAttributeParser<S> for AutomaticallyDerivedParser {
const PATH: &[Symbol] = &[sym::automatically_derived];
@@ -39,6 +39,7 @@
};
use crate::attributes::lint_helpers::{
AsPtrParser, AutomaticallyDerivedParser, PassByValueParser, PubTransparentParser,
RustcShouldNotBeCalledOnConstItems,
};
use crate::attributes::loop_match::{ConstContinueParser, LoopMatchParser};
use crate::attributes::macro_attrs::{
@@ -244,6 +245,7 @@ mod late {
Single<WithoutArgs<RustcCoherenceIsCoreParser>>,
Single<WithoutArgs<RustcMainParser>>,
Single<WithoutArgs<RustcPassIndirectlyInNonRusticAbisParser>>,
Single<WithoutArgs<RustcShouldNotBeCalledOnConstItems>>,
Single<WithoutArgs<SpecializationTraitParser>>,
Single<WithoutArgs<StdInternalSymbolParser>>,
Single<WithoutArgs<TrackCallerParser>>,
@@ -3,8 +3,6 @@ builtin_macros_alloc_must_statics = allocators must be statics
builtin_macros_asm_attribute_not_supported =
this attribute is not supported on assembly
builtin_macros_asm_cfg =
the `#[cfg(/* ... */)]` and `#[cfg_attr(/* ... */)]` attributes on assembly are unstable
builtin_macros_asm_clobber_abi = clobber_abi
builtin_macros_asm_clobber_no_reg = asm with `clobber_abi` must specify explicit registers for outputs
+4 -14
View File
@@ -6,14 +6,13 @@
use rustc_index::bit_set::GrowableBitSet;
use rustc_parse::parser::asm::*;
use rustc_session::lint;
use rustc_session::parse::feature_err;
use rustc_span::{ErrorGuaranteed, InnerSpan, Span, Symbol, sym};
use rustc_target::asm::InlineAsmArch;
use smallvec::smallvec;
use {rustc_ast as ast, rustc_parse_format as parse};
use crate::errors;
use crate::util::{ExprToSpannedString, expr_to_spanned_string};
use crate::{errors, fluent_generated as fluent};
/// Validated assembly arguments, ready for macro expansion.
struct ValidatedAsmArgs {
@@ -64,22 +63,13 @@ fn validate_asm_args<'a>(
for arg in args {
for attr in arg.attributes.0.iter() {
match attr.name() {
Some(sym::cfg | sym::cfg_attr) => {
if !ecx.ecfg.features.asm_cfg() {
let span = attr.span();
feature_err(ecx.sess, sym::asm_cfg, span, fluent::builtin_macros_asm_cfg)
.emit();
}
}
_ => {
ecx.dcx().emit_err(errors::AsmAttributeNotSupported { span: attr.span() });
}
if !matches!(attr.name(), Some(sym::cfg | sym::cfg_attr)) {
ecx.dcx().emit_err(errors::AsmAttributeNotSupported { span: attr.span() });
}
}
// Skip arguments that are configured out.
if ecx.ecfg.features.asm_cfg() && strip_unconfigured.configure(arg.attributes).is_none() {
if strip_unconfigured.configure(arg.attributes).is_none() {
continue;
}
+9 -6
View File
@@ -33,11 +33,7 @@ pub(crate) fn global_gcc_features(sess: &Session) -> Vec<String> {
// should be taken in cases like these.
let mut features = vec![];
// Features implied by an implicit or explicit `--target`.
features.extend(sess.target.features.split(',').filter(|v| !v.is_empty()).map(String::from));
// -Ctarget-features
target_features::flag_to_backend_features(sess, |feature, enable| {
let mut extend_backend_features = |feature: &str, enable: bool| {
// We run through `to_gcc_features` when
// passing requests down to GCC. This means that all in-language
// features also work on the command line instead of having two
@@ -48,7 +44,13 @@ pub(crate) fn global_gcc_features(sess: &Session) -> Vec<String> {
.flat_map(|feat| to_gcc_features(sess, feat).into_iter())
.map(|feature| if !enable { format!("-{}", feature) } else { feature.to_string() }),
);
});
};
// Features implied by an implicit or explicit `--target`.
target_features::target_spec_to_backend_features(sess, &mut extend_backend_features);
// -Ctarget-features
target_features::flag_to_backend_features(sess, extend_backend_features);
gcc_features_by_flags(sess, &mut features);
@@ -66,6 +68,7 @@ pub(crate) fn global_gcc_features(sess: &Session) -> Vec<String> {
(&Arch::X86 | &Arch::X86_64, "rdrand") => smallvec!["rdrnd"],
(&Arch::X86 | &Arch::X86_64, "bmi1") => smallvec!["bmi"],
(&Arch::X86 | &Arch::X86_64, "cmpxchg16b") => smallvec!["cx16"],
(&Arch::X86 | &Arch::X86_64, "lahfsahf") => smallvec!["sahf"],
(&Arch::X86 | &Arch::X86_64, "avx512vaes") => smallvec!["vaes"],
(&Arch::X86 | &Arch::X86_64, "avx512gfni") => smallvec!["gfni"],
(&Arch::X86 | &Arch::X86_64, "avx512vpclmulqdq") => smallvec!["vpclmulqdq"],
+1
View File
@@ -47,5 +47,6 @@ tracing = "0.1"
# tidy-alphabetical-start
check_only = ["rustc_llvm/check_only"]
llvm_enzyme = []
llvm_offload = []
# tidy-alphabetical-end
+3
View File
@@ -18,6 +18,9 @@ codegen_llvm_lto_bitcode_from_rlib = failed to get bitcode from object file for
codegen_llvm_mismatch_data_layout =
data-layout for target `{$rustc_target}`, `{$rustc_layout}`, differs from LLVM target's `{$llvm_target}` default layout, `{$llvm_layout}`
codegen_llvm_offload_without_enable = using the offload feature requires -Z offload=Enable
codegen_llvm_offload_without_fat_lto = using the offload feature requires -C lto=fat
codegen_llvm_parse_bitcode = failed to parse bitcode for LTO module
codegen_llvm_parse_bitcode_with_llvm_err = failed to parse bitcode for LTO module: {$llvm_err}
@@ -30,6 +30,14 @@ pub(crate) fn apply_to_callsite(callsite: &Value, idx: AttributePlace, attrs: &[
}
}
pub(crate) fn has_string_attr(llfn: &Value, name: &str) -> bool {
llvm::HasStringAttribute(llfn, name)
}
pub(crate) fn remove_string_attr_from_llfn(llfn: &Value, name: &str) {
llvm::RemoveStringAttrFromFn(llfn, name);
}
/// Get LLVM attribute for the provided inline heuristic.
pub(crate) fn inline_attr<'ll, 'tcx>(
cx: &SimpleCx<'ll>,
@@ -408,6 +416,10 @@ pub(crate) fn llfn_attrs_from_instance<'ll, 'tcx>(
to_add.push(llvm::CreateAttrString(cx.llcx, "no-builtins"));
}
if codegen_fn_attrs.flags.contains(CodegenFnAttrFlags::OFFLOAD_KERNEL) {
to_add.push(llvm::CreateAttrString(cx.llcx, "offload-kernel"))
}
if codegen_fn_attrs.flags.contains(CodegenFnAttrFlags::COLD) {
to_add.push(AttributeKind::Cold.create_attr(cx.llcx));
}
+1 -9
View File
@@ -26,7 +26,7 @@
};
use crate::errors::{LlvmError, LtoBitcodeFromRlib};
use crate::llvm::{self, build_string};
use crate::{LlvmCodegenBackend, ModuleLlvm, SimpleCx};
use crate::{LlvmCodegenBackend, ModuleLlvm};
/// We keep track of the computed LTO cache keys from the previous
/// session to determine which CGUs we can reuse.
@@ -601,7 +601,6 @@ pub(crate) fn run_pass_manager(
// We then run the llvm_optimize function a second time, to optimize the code which we generated
// in the enzyme differentiation pass.
let enable_ad = config.autodiff.contains(&config::AutoDiff::Enable);
let enable_gpu = config.offload.contains(&config::Offload::Enable);
let stage = if thin {
write::AutodiffStage::PreAD
} else {
@@ -616,13 +615,6 @@ pub(crate) fn run_pass_manager(
write::llvm_optimize(cgcx, dcx, module, None, config, opt_level, opt_stage, stage);
}
// Here we only handle the GPU host (=cpu) code.
if enable_gpu && !thin && !cgcx.target_is_like_gpu {
let cx =
SimpleCx::new(module.module_llvm.llmod(), &module.module_llvm.llcx, cgcx.pointer_size);
crate::builder::gpu_offload::handle_gpu_code(cgcx, &cx);
}
if cfg!(feature = "llvm_enzyme") && enable_ad && !thin {
let opt_stage = llvm::OptStage::FatLTO;
let stage = write::AutodiffStage::PostAD;
+24 -10
View File
@@ -9,8 +9,8 @@
use rustc_codegen_ssa::back::link::ensure_removed;
use rustc_codegen_ssa::back::versioned_llvm_target;
use rustc_codegen_ssa::back::write::{
BitcodeSection, CodegenContext, EmitObj, ModuleConfig, TargetMachineFactoryConfig,
TargetMachineFactoryFn,
BitcodeSection, CodegenContext, EmitObj, InlineAsmError, ModuleConfig,
TargetMachineFactoryConfig, TargetMachineFactoryFn,
};
use rustc_codegen_ssa::base::wants_wasm_eh;
use rustc_codegen_ssa::traits::*;
@@ -43,7 +43,7 @@
use crate::llvm::diagnostic::OptimizationDiagnosticKind::*;
use crate::llvm::{self, DiagnosticInfo};
use crate::type_::llvm_type_ptr;
use crate::{LlvmCodegenBackend, ModuleLlvm, SimpleCx, base, common, llvm_util};
use crate::{LlvmCodegenBackend, ModuleLlvm, SimpleCx, attributes, base, common, llvm_util};
pub(crate) fn llvm_err<'a>(dcx: DiagCtxtHandle<'_>, err: LlvmError<'a>) -> ! {
match llvm::last_error() {
@@ -434,7 +434,7 @@ fn report_inline_asm(
level: llvm::DiagnosticLevel,
cookie: u64,
source: Option<(String, Vec<InnerSpan>)>,
) {
) -> InlineAsmError {
// In LTO build we may get srcloc values from other crates which are invalid
// since they use a different source map. To be safe we just suppress these
// in LTO builds.
@@ -454,7 +454,7 @@ fn report_inline_asm(
llvm::DiagnosticLevel::Note | llvm::DiagnosticLevel::Remark => Level::Note,
};
let msg = msg.trim_prefix("error: ").to_string();
cgcx.diag_emitter.inline_asm_error(span, msg, level, source);
InlineAsmError { span, msg, level, source }
}
unsafe extern "C" fn diagnostic_handler(info: &DiagnosticInfo, user: *mut c_void) {
@@ -466,7 +466,13 @@ fn report_inline_asm(
match unsafe { llvm::diagnostic::Diagnostic::unpack(info) } {
llvm::diagnostic::InlineAsm(inline) => {
report_inline_asm(cgcx, inline.message, inline.level, inline.cookie, inline.source);
cgcx.diag_emitter.inline_asm_error(report_inline_asm(
cgcx,
inline.message,
inline.level,
inline.cookie,
inline.source,
));
}
llvm::diagnostic::Optimization(opt) => {
@@ -706,11 +712,12 @@ fn handle_offload<'ll>(cx: &'ll SimpleCx<'_>, old_fn: &llvm::Value) {
SimpleCx::new(module.module_llvm.llmod(), module.module_llvm.llcx, cgcx.pointer_size);
// For now we only support up to 10 kernels named kernel_0 ... kernel_9, a follow-up PR is
// introducing a proper offload intrinsic to solve this limitation.
for num in 0..9 {
let name = format!("kernel_{num}");
if let Some(kernel) = cx.get_function(&name) {
handle_offload(&cx, kernel);
for func in cx.get_functions() {
let offload_kernel = "offload-kernel";
if attributes::has_string_attr(func, offload_kernel) {
handle_offload(&cx, func);
}
attributes::remove_string_attr_from_llfn(func, offload_kernel);
}
}
@@ -765,6 +772,13 @@ fn handle_offload<'ll>(cx: &'ll SimpleCx<'_>, old_fn: &llvm::Value) {
llvm_plugins.len(),
)
};
if cgcx.target_is_like_gpu && config.offload.contains(&config::Offload::Enable) {
unsafe {
llvm::LLVMRustBundleImages(module.module_llvm.llmod(), module.module_llvm.tm.raw());
}
}
result.into_result().unwrap_or_else(|()| llvm_err(dcx, LlvmError::RunLlvmPasses))
}
@@ -2,37 +2,13 @@
use llvm::Linkage::*;
use rustc_abi::Align;
use rustc_codegen_ssa::back::write::CodegenContext;
use rustc_codegen_ssa::traits::BaseTypeCodegenMethods;
use rustc_middle::ty::offload_meta::OffloadMetadata;
use crate::builder::SBuilder;
use crate::common::AsCCharPtr;
use crate::llvm::AttributePlace::Function;
use crate::llvm::{self, Linkage, Type, Value};
use crate::{LlvmCodegenBackend, SimpleCx, attributes};
pub(crate) fn handle_gpu_code<'ll>(
_cgcx: &CodegenContext<LlvmCodegenBackend>,
cx: &'ll SimpleCx<'_>,
) {
// The offload memory transfer type for each kernel
let mut memtransfer_types = vec![];
let mut region_ids = vec![];
let offload_entry_ty = TgtOffloadEntry::new_decl(&cx);
// This is a temporary hack, we only search for kernel_0 to kernel_9 functions.
// There is a draft PR in progress which will introduce a proper offload intrinsic to remove
// this limitation.
for num in 0..9 {
let kernel = cx.get_function(&format!("kernel_{num}"));
if let Some(kernel) = kernel {
let (o, k) = gen_define_handling(&cx, kernel, offload_entry_ty, num);
memtransfer_types.push(o);
region_ids.push(k);
}
}
gen_call_handling(&cx, &memtransfer_types, &region_ids);
}
use crate::llvm::{self, BasicBlock, Linkage, Type, Value};
use crate::{SimpleCx, attributes};
// ; Function Attrs: nounwind
// declare i32 @__tgt_target_kernel(ptr, i64, i32, i32, ptr, ptr) #2
@@ -79,7 +55,7 @@ fn generate_at_one<'ll>(cx: &'ll SimpleCx<'_>) -> &'ll llvm::Value {
at_one
}
struct TgtOffloadEntry {
pub(crate) struct TgtOffloadEntry {
// uint64_t Reserved;
// uint16_t Version;
// uint16_t Kind;
@@ -167,7 +143,7 @@ fn new_decl<'ll>(cx: &'ll SimpleCx<'_>) -> &'ll Type {
fn new<'ll>(
cx: &'ll SimpleCx<'_>,
num_args: u64,
memtransfer_types: &[&'ll Value],
memtransfer_types: &'ll Value,
geps: [&'ll Value; 3],
) -> [(Align, &'ll Value); 13] {
let four = Align::from_bytes(4).expect("4 Byte alignment should work");
@@ -181,7 +157,7 @@ fn new<'ll>(
(eight, geps[0]),
(eight, geps[1]),
(eight, geps[2]),
(eight, memtransfer_types[0]),
(eight, memtransfer_types),
// The next two are debug infos. FIXME(offload): set them
(eight, cx.const_null(cx.type_ptr())), // dbg
(eight, cx.const_null(cx.type_ptr())), // dbg
@@ -194,6 +170,14 @@ fn new<'ll>(
}
}
// Contains LLVM values needed to manage offloading for a single kernel.
pub(crate) struct OffloadKernelData<'ll> {
pub offload_sizes: &'ll llvm::Value,
pub memtransfer_types: &'ll llvm::Value,
pub region_id: &'ll llvm::Value,
pub offload_entry: &'ll llvm::Value,
}
fn gen_tgt_data_mappers<'ll>(
cx: &'ll SimpleCx<'_>,
) -> (&'ll llvm::Value, &'ll llvm::Value, &'ll llvm::Value, &'ll llvm::Type) {
@@ -256,68 +240,68 @@ pub(crate) fn add_global<'ll>(
// This function returns a memtransfer value which encodes how arguments to this kernel shall be
// mapped to/from the gpu. It also returns a region_id with the name of this kernel, to be
// concatenated into the list of region_ids.
fn gen_define_handling<'ll>(
cx: &'ll SimpleCx<'_>,
kernel: &'ll llvm::Value,
pub(crate) fn gen_define_handling<'ll>(
cx: &SimpleCx<'ll>,
offload_entry_ty: &'ll llvm::Type,
num: i64,
) -> (&'ll llvm::Value, &'ll llvm::Value) {
let types = cx.func_params_types(cx.get_type_of_global(kernel));
metadata: &[OffloadMetadata],
types: &[&Type],
symbol: &str,
) -> OffloadKernelData<'ll> {
// It seems like non-pointer values are automatically mapped. So here, we focus on pointer (or
// reference) types.
let num_ptr_types = types
.iter()
.filter(|&x| matches!(cx.type_kind(x), rustc_codegen_ssa::common::TypeKind::Pointer))
.count();
let ptr_meta = types.iter().zip(metadata).filter_map(|(&x, meta)| match cx.type_kind(x) {
rustc_codegen_ssa::common::TypeKind::Pointer => Some(meta),
_ => None,
});
// We do not know their size anymore at this level, so hardcode a placeholder.
// A follow-up pr will track these from the frontend, where we still have Rust types.
// Then, we will be able to figure out that e.g. `&[f32;256]` will result in 4*256 bytes.
// I decided that 1024 bytes is a great placeholder value for now.
add_priv_unnamed_arr(&cx, &format!(".offload_sizes.{num}"), &vec![1024; num_ptr_types]);
// FIXME(Sa4dUs): add `OMP_MAP_TARGET_PARAM = 0x20` only if necessary
let (ptr_sizes, ptr_transfer): (Vec<_>, Vec<_>) =
ptr_meta.map(|m| (m.payload_size, m.mode.bits() | 0x20)).unzip();
let offload_sizes = add_priv_unnamed_arr(&cx, &format!(".offload_sizes.{symbol}"), &ptr_sizes);
// Here we figure out whether something needs to be copied to the gpu (=1), from the gpu (=2),
// or both to and from the gpu (=3). Other values shouldn't affect us for now.
// A non-mutable reference or pointer will be 1, an array that's not read, but fully overwritten
// will be 2. For now, everything is 3, until we have our frontend set up.
// 1+2+32: 1 (MapTo), 2 (MapFrom), 32 (Add one extra input ptr per function, to be used later).
let memtransfer_types = add_priv_unnamed_arr(
&cx,
&format!(".offload_maptypes.{num}"),
&vec![1 + 2 + 32; num_ptr_types],
);
let memtransfer_types =
add_priv_unnamed_arr(&cx, &format!(".offload_maptypes.{symbol}"), &ptr_transfer);
// Next: For each function, generate these three entries. A weak constant,
// the llvm.rodata entry name, and the llvm_offload_entries value
let name = format!(".kernel_{num}.region_id");
let name = format!(".{symbol}.region_id");
let initializer = cx.get_const_i8(0);
let region_id = add_unnamed_global(&cx, &name, initializer, WeakAnyLinkage);
let c_entry_name = CString::new(format!("kernel_{num}")).unwrap();
let c_entry_name = CString::new(symbol).unwrap();
let c_val = c_entry_name.as_bytes_with_nul();
let offload_entry_name = format!(".offloading.entry_name.{num}");
let offload_entry_name = format!(".offloading.entry_name.{symbol}");
let initializer = crate::common::bytes_in_context(cx.llcx, c_val);
let llglobal = add_unnamed_global(&cx, &offload_entry_name, initializer, InternalLinkage);
llvm::set_alignment(llglobal, Align::ONE);
llvm::set_section(llglobal, c".llvm.rodata.offloading");
let name = format!(".offloading.entry.kernel_{num}");
let name = format!(".offloading.entry.{symbol}");
// See the __tgt_offload_entry documentation above.
let elems = TgtOffloadEntry::new(&cx, region_id, llglobal);
let initializer = crate::common::named_struct(offload_entry_ty, &elems);
let c_name = CString::new(name).unwrap();
let llglobal = llvm::add_global(cx.llmod, offload_entry_ty, &c_name);
llvm::set_global_constant(llglobal, true);
llvm::set_linkage(llglobal, WeakAnyLinkage);
llvm::set_initializer(llglobal, initializer);
llvm::set_alignment(llglobal, Align::EIGHT);
let offload_entry = llvm::add_global(cx.llmod, offload_entry_ty, &c_name);
llvm::set_global_constant(offload_entry, true);
llvm::set_linkage(offload_entry, WeakAnyLinkage);
llvm::set_initializer(offload_entry, initializer);
llvm::set_alignment(offload_entry, Align::EIGHT);
let c_section_name = CString::new("llvm_offload_entries").unwrap();
llvm::set_section(llglobal, &c_section_name);
(memtransfer_types, region_id)
llvm::set_section(offload_entry, &c_section_name);
OffloadKernelData { offload_sizes, memtransfer_types, region_id, offload_entry }
}
pub(crate) fn declare_offload_fn<'ll>(
fn declare_offload_fn<'ll>(
cx: &'ll SimpleCx<'_>,
name: &str,
ty: &'ll llvm::Type,
@@ -333,8 +317,7 @@ pub(crate) fn declare_offload_fn<'ll>(
}
// For each kernel *call*, we now use some of our previous declared globals to move data to and from
// the gpu. We don't have a proper frontend yet, so we assume that every call to a kernel function
// from main is intended to run on the GPU. For now, we only handle the data transfer part of it.
// the gpu. For now, we only handle the data transfer part of it.
// If two consecutive kernels use the same memory, we still move it to the host and back to the gpu.
// Since in our frontend users (by default) don't have to specify data transfer, this is something
// we should optimize in the future! We also assume that everything should be copied back and forth,
@@ -352,11 +335,16 @@ pub(crate) fn declare_offload_fn<'ll>(
// 4. set insert point after kernel call.
// 5. generate all the GEPS and stores, to be used in 6)
// 6. generate __tgt_target_data_end calls to move data from the GPU
fn gen_call_handling<'ll>(
cx: &'ll SimpleCx<'_>,
memtransfer_types: &[&'ll llvm::Value],
region_ids: &[&'ll llvm::Value],
pub(crate) fn gen_call_handling<'ll>(
cx: &SimpleCx<'ll>,
bb: &BasicBlock,
offload_data: &OffloadKernelData<'ll>,
args: &[&'ll Value],
types: &[&Type],
metadata: &[OffloadMetadata],
) {
let OffloadKernelData { offload_sizes, offload_entry, memtransfer_types, region_id } =
offload_data;
let (tgt_decl, tgt_target_kernel_ty) = generate_launcher(&cx);
// %struct.__tgt_bin_desc = type { i32, ptr, ptr, ptr }
let tptr = cx.type_ptr();
@@ -368,27 +356,32 @@ fn gen_call_handling<'ll>(
let tgt_kernel_decl = KernelArgsTy::new_decl(&cx);
let (begin_mapper_decl, _, end_mapper_decl, fn_ty) = gen_tgt_data_mappers(&cx);
let main_fn = cx.get_function("main");
let Some(main_fn) = main_fn else { return };
let kernel_name = "kernel_1";
let call = unsafe {
llvm::LLVMRustGetFunctionCall(main_fn, kernel_name.as_c_char_ptr(), kernel_name.len())
};
let Some(kernel_call) = call else {
return;
};
let kernel_call_bb = unsafe { llvm::LLVMGetInstructionParent(kernel_call) };
let called = unsafe { llvm::LLVMGetCalledValue(kernel_call).unwrap() };
let mut builder = SBuilder::build(cx, kernel_call_bb);
let mut builder = SBuilder::build(cx, bb);
let types = cx.func_params_types(cx.get_type_of_global(called));
let num_args = types.len() as u64;
let ip = unsafe { llvm::LLVMRustGetInsertPoint(&builder.llbuilder) };
// FIXME(Sa4dUs): dummy loads are a temp workaround, we should find a proper way to prevent these
// variables from being optimized away
for val in [offload_sizes, offload_entry] {
unsafe {
let dummy = llvm::LLVMBuildLoad2(
&builder.llbuilder,
llvm::LLVMTypeOf(val),
val,
b"dummy\0".as_ptr() as *const _,
);
llvm::LLVMSetVolatile(dummy, llvm::TRUE);
}
}
// Step 0)
// %struct.__tgt_bin_desc = type { i32, ptr, ptr, ptr }
// %6 = alloca %struct.__tgt_bin_desc, align 8
unsafe { llvm::LLVMRustPositionBuilderPastAllocas(builder.llbuilder, main_fn) };
let llfn = unsafe { llvm::LLVMGetBasicBlockParent(bb) };
unsafe {
llvm::LLVMRustPositionBuilderPastAllocas(&builder.llbuilder, llfn);
}
let tgt_bin_desc_alloca = builder.direct_alloca(tgt_bin_desc, Align::EIGHT, "EmptyDesc");
let ty = cx.type_array(cx.type_ptr(), num_args);
@@ -404,15 +397,16 @@ fn gen_call_handling<'ll>(
let a5 = builder.direct_alloca(tgt_kernel_decl, Align::EIGHT, "kernel_args");
// Step 1)
unsafe { llvm::LLVMRustPositionBefore(builder.llbuilder, kernel_call) };
unsafe {
llvm::LLVMRustRestoreInsertPoint(&builder.llbuilder, ip);
}
builder.memset(tgt_bin_desc_alloca, cx.get_const_i8(0), cx.get_const_i64(32), Align::EIGHT);
// Now we allocate once per function param, a copy to be passed to one of our maps.
let mut vals = vec![];
let mut geps = vec![];
let i32_0 = cx.get_const_i32(0);
for index in 0..types.len() {
let v = unsafe { llvm::LLVMGetOperand(kernel_call, index as u32).unwrap() };
for &v in args {
let gep = builder.inbounds_gep(cx.type_f32(), v, &[i32_0]);
vals.push(v);
geps.push(gep);
@@ -437,10 +431,8 @@ fn gen_call_handling<'ll>(
let gep2 = builder.inbounds_gep(ty, a2, &[i32_0, idx]);
builder.store(geps[i as usize], gep2, Align::EIGHT);
let gep3 = builder.inbounds_gep(ty2, a4, &[i32_0, idx]);
// As mentioned above, we don't use Rust type information yet. So for now we will just
// assume that we have 1024 bytes, 256 f32 values.
// FIXME(offload): write an offload frontend and handle arbitrary types.
builder.store(cx.get_const_i64(1024), gep3, Align::EIGHT);
builder.store(cx.get_const_i64(metadata[i as usize].payload_size), gep3, Align::EIGHT);
}
// For now we have a very simplistic indexing scheme into our
@@ -482,9 +474,17 @@ fn generate_mapper_call<'a, 'll>(
// Step 2)
let s_ident_t = generate_at_one(&cx);
let o = memtransfer_types[0];
let geps = get_geps(&mut builder, &cx, ty, ty2, a1, a2, a4);
generate_mapper_call(&mut builder, &cx, geps, o, begin_mapper_decl, fn_ty, num_args, s_ident_t);
generate_mapper_call(
&mut builder,
&cx,
geps,
memtransfer_types,
begin_mapper_decl,
fn_ty,
num_args,
s_ident_t,
);
let values = KernelArgsTy::new(&cx, num_args, memtransfer_types, geps);
// Step 3)
@@ -501,26 +501,26 @@ fn generate_mapper_call<'a, 'll>(
// FIXME(offload): Don't hardcode the numbers of threads in the future.
cx.get_const_i32(2097152),
cx.get_const_i32(256),
region_ids[0],
region_id,
a5,
];
let offload_success = builder.call(tgt_target_kernel_ty, tgt_decl, &args, None);
builder.call(tgt_target_kernel_ty, tgt_decl, &args, None);
// %41 = call i32 @__tgt_target_kernel(ptr @1, i64 -1, i32 2097152, i32 256, ptr @.kernel_1.region_id, ptr %kernel_args)
unsafe {
let next = llvm::LLVMGetNextInstruction(offload_success).unwrap();
llvm::LLVMRustPositionAfter(builder.llbuilder, next);
llvm::LLVMInstructionEraseFromParent(next);
}
// Step 4)
let geps = get_geps(&mut builder, &cx, ty, ty2, a1, a2, a4);
generate_mapper_call(&mut builder, &cx, geps, o, end_mapper_decl, fn_ty, num_args, s_ident_t);
generate_mapper_call(
&mut builder,
&cx,
geps,
memtransfer_types,
end_mapper_decl,
fn_ty,
num_args,
s_ident_t,
);
builder.call(mapper_fn_ty, unregister_lib_decl, &[tgt_bin_desc_alloca], None);
drop(builder);
// FIXME(offload) The issue is that we right now add a call to the gpu version of the function,
// and then delete the call to the CPU version. In the future, we should use an intrinsic which
// directly resolves to a call to the GPU version.
unsafe { llvm::LLVMDeleteFunction(called) };
}
@@ -791,6 +791,16 @@ pub(crate) fn create_metadata(&self, name: &[u8]) -> &'ll Metadata {
llvm::LLVMMDStringInContext2(self.llcx(), name.as_ptr() as *const c_char, name.len())
}
}
pub(crate) fn get_functions(&self) -> Vec<&'ll Value> {
let mut functions = vec![];
let mut func = unsafe { llvm::LLVMGetFirstFunction(self.llmod()) };
while let Some(f) = func {
functions.push(f);
func = unsafe { llvm::LLVMGetNextFunction(f) }
}
functions
}
}
impl<'ll, 'tcx> MiscCodegenMethods<'tcx> for CodegenCx<'ll, 'tcx> {
@@ -40,6 +40,14 @@ fn into_diag(self, dcx: DiagCtxtHandle<'_>, level: Level) -> Diag<'_, G> {
#[diag(codegen_llvm_autodiff_without_enable)]
pub(crate) struct AutoDiffWithoutEnable;
#[derive(Diagnostic)]
#[diag(codegen_llvm_offload_without_enable)]
pub(crate) struct OffloadWithoutEnable;
#[derive(Diagnostic)]
#[diag(codegen_llvm_offload_without_fat_lto)]
pub(crate) struct OffloadWithoutFatLTO;
#[derive(Diagnostic)]
#[diag(codegen_llvm_lto_bitcode_from_rlib)]
pub(crate) struct LtoBitcodeFromRlib {
+91 -3
View File
@@ -13,8 +13,10 @@
use rustc_hir::{self as hir};
use rustc_middle::mir::BinOp;
use rustc_middle::ty::layout::{FnAbiOf, HasTyCtxt, HasTypingEnv, LayoutOf};
use rustc_middle::ty::offload_meta::OffloadMetadata;
use rustc_middle::ty::{self, GenericArgsRef, Instance, SimdAlign, Ty, TyCtxt, TypingEnv};
use rustc_middle::{bug, span_bug};
use rustc_session::config::CrateType;
use rustc_span::{Span, Symbol, sym};
use rustc_symbol_mangling::{mangle_internal_symbol, symbol_name_for_instance_in_crate};
use rustc_target::callconv::PassMode;
@@ -24,8 +26,11 @@
use crate::abi::FnAbiLlvmExt;
use crate::builder::Builder;
use crate::builder::autodiff::{adjust_activity_to_abi, generate_enzyme_call};
use crate::builder::gpu_offload::TgtOffloadEntry;
use crate::context::CodegenCx;
use crate::errors::{AutoDiffWithoutEnable, AutoDiffWithoutLto};
use crate::errors::{
AutoDiffWithoutEnable, AutoDiffWithoutLto, OffloadWithoutEnable, OffloadWithoutFatLTO,
};
use crate::llvm::{self, Metadata, Type, Value};
use crate::type_of::LayoutLlvmExt;
use crate::va_arg::emit_va_arg;
@@ -196,6 +201,24 @@ fn codegen_intrinsic_call(
codegen_autodiff(self, tcx, instance, args, result);
return Ok(());
}
sym::offload => {
if !tcx
.sess
.opts
.unstable_opts
.offload
.contains(&rustc_session::config::Offload::Enable)
{
let _ = tcx.dcx().emit_almost_fatal(OffloadWithoutEnable);
}
if tcx.sess.lto() != rustc_session::config::Lto::Fat {
let _ = tcx.dcx().emit_almost_fatal(OffloadWithoutFatLTO);
}
codegen_offload(self, tcx, instance, args);
return Ok(());
}
sym::is_val_statically_known => {
if let OperandValue::Immediate(imm) = args[0].val {
self.call_intrinsic(
@@ -1136,8 +1159,17 @@ fn codegen_autodiff<'ll, 'tcx>(
if !tcx.sess.opts.unstable_opts.autodiff.contains(&rustc_session::config::AutoDiff::Enable) {
let _ = tcx.dcx().emit_almost_fatal(AutoDiffWithoutEnable);
}
if tcx.sess.lto() != rustc_session::config::Lto::Fat {
let _ = tcx.dcx().emit_almost_fatal(AutoDiffWithoutLto);
let ct = tcx.crate_types();
let lto = tcx.sess.lto();
if ct.len() == 1 && ct.contains(&CrateType::Executable) {
if lto != rustc_session::config::Lto::Fat {
let _ = tcx.dcx().emit_almost_fatal(AutoDiffWithoutLto);
}
} else {
if lto != rustc_session::config::Lto::Fat && !tcx.sess.opts.cg.linker_plugin_lto.enabled() {
let _ = tcx.dcx().emit_almost_fatal(AutoDiffWithoutLto);
}
}
let fn_args = instance.args;
@@ -1221,6 +1253,62 @@ fn codegen_autodiff<'ll, 'tcx>(
);
}
// Generates the LLVM code to offload a Rust function to a target device (e.g., GPU).
// For each kernel call, it generates the necessary globals (including metadata such as
// size and pass mode), manages memory mapping to and from the device, handles all
// data transfers, and launches the kernel on the target device.
fn codegen_offload<'ll, 'tcx>(
bx: &mut Builder<'_, 'll, 'tcx>,
tcx: TyCtxt<'tcx>,
instance: ty::Instance<'tcx>,
args: &[OperandRef<'tcx, &'ll Value>],
) {
let cx = bx.cx;
let fn_args = instance.args;
let (target_id, target_args) = match fn_args.into_type_list(tcx)[0].kind() {
ty::FnDef(def_id, params) => (def_id, params),
_ => bug!("invalid offload intrinsic arg"),
};
let fn_target = match Instance::try_resolve(tcx, cx.typing_env(), *target_id, target_args) {
Ok(Some(instance)) => instance,
Ok(None) => bug!(
"could not resolve ({:?}, {:?}) to a specific offload instance",
target_id,
target_args
),
Err(_) => {
// An error has already been emitted
return;
}
};
let args = get_args_from_tuple(bx, args[1], fn_target);
let target_symbol = symbol_name_for_instance_in_crate(tcx, fn_target, LOCAL_CRATE);
let offload_entry_ty = TgtOffloadEntry::new_decl(&cx);
let sig = tcx.fn_sig(fn_target.def_id()).skip_binder().skip_binder();
let inputs = sig.inputs();
let metadata = inputs.iter().map(|ty| OffloadMetadata::from_ty(tcx, *ty)).collect::<Vec<_>>();
let types = inputs.iter().map(|ty| cx.layout_of(*ty).llvm_type(cx)).collect::<Vec<_>>();
let offload_data = crate::builder::gpu_offload::gen_define_handling(
cx,
offload_entry_ty,
&metadata,
&types,
&target_symbol,
);
// FIXME(Sa4dUs): pass the original builder once we separate kernel launch logic from globals
let bb = unsafe { llvm::LLVMGetInsertBlock(bx.llbuilder) };
crate::builder::gpu_offload::gen_call_handling(cx, bb, &offload_data, &args, &types, &metadata);
}
fn get_args_from_tuple<'ll, 'tcx>(
bx: &mut Builder<'_, 'll, 'tcx>,
tuple_op: OperandRef<'tcx, &'ll Value>,
+33 -5
View File
@@ -1160,13 +1160,9 @@ pub(crate) fn LLVMAppendBasicBlockInContext<'a>(
) -> &'a BasicBlock;
// Operations on instructions
pub(crate) fn LLVMGetInstructionParent(Inst: &Value) -> &BasicBlock;
pub(crate) fn LLVMGetCalledValue(CallInst: &Value) -> Option<&Value>;
pub(crate) fn LLVMIsAInstruction(Val: &Value) -> Option<&Value>;
pub(crate) fn LLVMGetFirstBasicBlock(Fn: &Value) -> &BasicBlock;
pub(crate) fn LLVMGetOperand(Val: &Value, Index: c_uint) -> Option<&Value>;
pub(crate) fn LLVMGetNextInstruction(Val: &Value) -> Option<&Value>;
pub(crate) fn LLVMInstructionEraseFromParent(Val: &Value);
// Operations on call sites
pub(crate) fn LLVMSetInstructionCallConv(Instr: &Value, CC: c_uint);
@@ -1718,6 +1714,37 @@ pub(crate) fn LLVMBuildCallBr<'a>(
) -> &'a Value;
}
#[cfg(feature = "llvm_offload")]
pub(crate) use self::Offload::*;
#[cfg(feature = "llvm_offload")]
mod Offload {
use super::*;
unsafe extern "C" {
/// Processes the module and writes it in an offload compatible way into a "host.out" file.
pub(crate) fn LLVMRustBundleImages<'a>(M: &'a Module, TM: &'a TargetMachine) -> bool;
pub(crate) fn LLVMRustOffloadMapper<'a>(OldFn: &'a Value, NewFn: &'a Value);
}
}
#[cfg(not(feature = "llvm_offload"))]
pub(crate) use self::Offload_fallback::*;
#[cfg(not(feature = "llvm_offload"))]
mod Offload_fallback {
use super::*;
/// Processes the module and writes it in an offload compatible way into a "host.out" file.
/// Marked as unsafe to match the real offload wrapper which is unsafe due to FFI.
#[allow(unused_unsafe)]
pub(crate) unsafe fn LLVMRustBundleImages<'a>(_M: &'a Module, _TM: &'a TargetMachine) -> bool {
unimplemented!("This rustc version was not built with LLVM Offload support!");
}
#[allow(unused_unsafe)]
pub(crate) unsafe fn LLVMRustOffloadMapper<'a>(_OldFn: &'a Value, _NewFn: &'a Value) {
unimplemented!("This rustc version was not built with LLVM Offload support!");
}
}
// FFI bindings for `DIBuilder` functions in the LLVM-C API.
// Try to keep these in the same order as in `llvm/include/llvm-c/DebugInfo.h`.
//
@@ -2025,7 +2052,6 @@ pub(crate) fn LLVMRustCreateRangeAttribute(
) -> &Attribute;
// Operations on functions
pub(crate) fn LLVMRustOffloadMapper<'a>(Fn: &'a Value, Fn: &'a Value);
pub(crate) fn LLVMRustGetOrInsertFunction<'a>(
M: &'a Module,
Name: *const c_char,
@@ -2454,6 +2480,8 @@ pub(crate) fn LLVMRustUnpackSMDiagnostic(
pub(crate) fn LLVMRustPositionBuilderPastAllocas<'a>(B: &Builder<'a>, Fn: &'a Value);
pub(crate) fn LLVMRustPositionBuilderAtStart<'a>(B: &Builder<'a>, BB: &'a BasicBlock);
pub(crate) fn LLVMRustGetInsertPoint<'a>(B: &Builder<'a>) -> &'a Value;
pub(crate) fn LLVMRustRestoreInsertPoint<'a>(B: &Builder<'a>, IP: &'a Value);
pub(crate) fn LLVMRustSetModulePICLevel(M: &Module);
pub(crate) fn LLVMRustSetModulePIELevel(M: &Module);
@@ -43,6 +43,14 @@ pub(crate) fn AddFunctionAttributes<'ll>(
}
}
pub(crate) fn HasStringAttribute<'ll>(llfn: &'ll Value, name: &str) -> bool {
unsafe { LLVMRustHasFnAttribute(llfn, name.as_c_char_ptr(), name.len()) }
}
pub(crate) fn RemoveStringAttrFromFn<'ll>(llfn: &'ll Value, name: &str) {
unsafe { LLVMRustRemoveFnAttribute(llfn, name.as_c_char_ptr(), name.len()) }
}
pub(crate) fn AddCallSiteAttributes<'ll>(
callsite: &'ll Value,
idx: AttributePlace,
+31 -26
View File
@@ -243,6 +243,8 @@ pub(crate) fn to_llvm_features<'a>(sess: &Session, s: &'a str) -> Option<LLVMFea
"fp16" => Some(LLVMFeature::new("fullfp16")),
// Filter out features that are not supported by the current LLVM version
"fpmr" => None, // only existed in 18
// Withdrawn by ARM; removed from LLVM in 22
"tme" if major >= 22 => None,
s => Some(LLVMFeature::new(s)),
}
}
@@ -626,6 +628,10 @@ pub(crate) fn target_cpu(sess: &Session) -> &str {
/// The target features for compiler flags other than `-Ctarget-features`.
fn llvm_features_by_flags(sess: &Session, features: &mut Vec<String>) {
if wants_wasm_eh(sess) && sess.panic_strategy() == PanicStrategy::Unwind {
features.push("+exception-handling".into());
}
target_features::retpoline_features_by_flags(sess, features);
// -Zfixed-x18
@@ -691,36 +697,35 @@ pub(crate) fn global_llvm_features(sess: &Session, only_base_features: bool) ->
Some(_) | None => {}
};
// Features implied by an implicit or explicit `--target`.
features.extend(sess.target.features.split(',').filter(|v| !v.is_empty()).map(String::from));
let mut extend_backend_features = |feature: &str, enable: bool| {
let enable_disable = if enable { '+' } else { '-' };
// We run through `to_llvm_features` when
// passing requests down to LLVM. This means that all in-language
// features also work on the command line instead of having two
// different names when the LLVM name and the Rust name differ.
let Some(llvm_feature) = to_llvm_features(sess, feature) else { return };
if wants_wasm_eh(sess) && sess.panic_strategy() == PanicStrategy::Unwind {
features.push("+exception-handling".into());
}
features.extend(
std::iter::once(format!("{}{}", enable_disable, llvm_feature.llvm_feature_name)).chain(
llvm_feature.dependencies.into_iter().filter_map(move |feat| {
match (enable, feat) {
(_, TargetFeatureFoldStrength::Both(f))
| (true, TargetFeatureFoldStrength::EnableOnly(f)) => {
Some(format!("{enable_disable}{f}"))
}
_ => None,
}
}),
),
);
};
// Features implied by an implicit or explicit `--target`.
target_features::target_spec_to_backend_features(sess, &mut extend_backend_features);
// -Ctarget-features
if !only_base_features {
target_features::flag_to_backend_features(sess, |feature, enable| {
let enable_disable = if enable { '+' } else { '-' };
// We run through `to_llvm_features` when
// passing requests down to LLVM. This means that all in-language
// features also work on the command line instead of having two
// different names when the LLVM name and the Rust name differ.
let Some(llvm_feature) = to_llvm_features(sess, feature) else { return };
features.extend(
std::iter::once(format!("{}{}", enable_disable, llvm_feature.llvm_feature_name))
.chain(llvm_feature.dependencies.into_iter().filter_map(move |feat| {
match (enable, feat) {
(_, TargetFeatureFoldStrength::Both(f))
| (true, TargetFeatureFoldStrength::EnableOnly(f)) => {
Some(format!("{enable_disable}{f}"))
}
_ => None,
}
})),
)
});
target_features::flag_to_backend_features(sess, extend_backend_features);
}
// We add this in the "base target" so that these show up in `sess.unstable_target_features`.
+23 -17
View File
@@ -1208,6 +1208,7 @@ pub(crate) enum ThinLtoMessage {
// - `is_lint`: lints aren't relevant during codegen.
// - `emitted_at`: not used for codegen diagnostics.
struct Diagnostic {
span: Vec<SpanData>,
level: Level,
messages: Vec<(DiagMessage, Style)>,
code: Option<ErrCode>,
@@ -1218,7 +1219,7 @@ struct Diagnostic {
// A cut-down version of `rustc_errors::Subdiag` that impls `Send`. It's
// missing the following fields from `rustc_errors::Subdiag`.
// - `span`: it doesn't impl `Send`.
pub(crate) struct Subdiagnostic {
struct Subdiagnostic {
level: Level,
messages: Vec<(DiagMessage, Style)>,
}
@@ -1897,10 +1898,17 @@ fn spawn_thin_lto_work<'a, B: ExtraBackendMethods>(
enum SharedEmitterMessage {
Diagnostic(Diagnostic),
InlineAsmError(SpanData, String, Level, Option<(String, Vec<InnerSpan>)>),
InlineAsmError(InlineAsmError),
Fatal(String),
}
pub struct InlineAsmError {
pub span: SpanData,
pub msg: String,
pub level: Level,
pub source: Option<(String, Vec<InnerSpan>)>,
}
#[derive(Clone)]
pub struct SharedEmitter {
sender: Sender<SharedEmitterMessage>,
@@ -1917,14 +1925,8 @@ fn new() -> (SharedEmitter, SharedEmitterMain) {
(SharedEmitter { sender }, SharedEmitterMain { receiver })
}
pub fn inline_asm_error(
&self,
span: SpanData,
msg: String,
level: Level,
source: Option<(String, Vec<InnerSpan>)>,
) {
drop(self.sender.send(SharedEmitterMessage::InlineAsmError(span, msg, level, source)));
pub fn inline_asm_error(&self, err: InlineAsmError) {
drop(self.sender.send(SharedEmitterMessage::InlineAsmError(err)));
}
fn fatal(&self, msg: &str) {
@@ -1940,7 +1942,7 @@ fn emit_diagnostic(
) {
// Check that we aren't missing anything interesting when converting to
// the cut-down local `DiagInner`.
assert_eq!(diag.span, MultiSpan::new());
assert!(!diag.span.has_span_labels());
assert_eq!(diag.suggestions, Suggestions::Enabled(vec![]));
assert_eq!(diag.sort_span, rustc_span::DUMMY_SP);
assert_eq!(diag.is_lint, None);
@@ -1949,6 +1951,7 @@ fn emit_diagnostic(
let args = mem::replace(&mut diag.args, DiagArgMap::default());
drop(
self.sender.send(SharedEmitterMessage::Diagnostic(Diagnostic {
span: diag.span.primary_spans().iter().map(|span| span.data()).collect::<Vec<_>>(),
level: diag.level(),
messages: diag.messages,
code: diag.code,
@@ -1993,6 +1996,9 @@ fn check(&self, sess: &Session, blocking: bool) {
let dcx = sess.dcx();
let mut d =
rustc_errors::DiagInner::new_with_messages(diag.level, diag.messages);
d.span = MultiSpan::from_spans(
diag.span.into_iter().map(|span| span.span()).collect(),
);
d.code = diag.code; // may be `None`, that's ok
d.children = diag
.children
@@ -2007,15 +2013,15 @@ fn check(&self, sess: &Session, blocking: bool) {
dcx.emit_diagnostic(d);
sess.dcx().abort_if_errors();
}
Ok(SharedEmitterMessage::InlineAsmError(span, msg, level, source)) => {
assert_matches!(level, Level::Error | Level::Warning | Level::Note);
let mut err = Diag::<()>::new(sess.dcx(), level, msg);
if !span.is_dummy() {
err.span(span.span());
Ok(SharedEmitterMessage::InlineAsmError(inner)) => {
assert_matches!(inner.level, Level::Error | Level::Warning | Level::Note);
let mut err = Diag::<()>::new(sess.dcx(), inner.level, inner.msg);
if !inner.span.is_dummy() {
err.span(inner.span.span());
}
// Point to the generated assembly if it is available.
if let Some((buffer, spans)) = source {
if let Some((buffer, spans)) = inner.source {
let source = sess
.source_map()
.new_source_file(FileName::inline_asm_source_code(&buffer), buffer);
@@ -334,6 +334,9 @@ fn process_builtin_attrs(
codegen_fn_attrs.patchable_function_entry =
parse_patchable_function_entry(tcx, attr);
}
sym::rustc_offload_kernel => {
codegen_fn_attrs.flags |= CodegenFnAttrFlags::OFFLOAD_KERNEL
}
_ => {}
}
}
@@ -24,6 +24,12 @@ pub(crate) fn codegen_rvalue(
) {
match *rvalue {
mir::Rvalue::Use(ref operand) => {
if let mir::Operand::Constant(const_op) = operand {
let val = self.eval_mir_constant(&const_op);
if val.all_bytes_uninit(self.cx.tcx()) {
return;
}
}
let cg_operand = self.codegen_operand(bx, operand);
// Crucially, we do *not* use `OperandValue::Ref` for types with
// `BackendRepr::Scalar | BackendRepr::ScalarPair`. This ensures we match the MIR
@@ -139,11 +139,12 @@ pub(crate) fn check_target_feature_trait_unsafe(tcx: TyCtxt<'_>, id: LocalDefId,
}
}
/// Parse the value of `-Ctarget-feature`, also expanding implied features,
/// and call the closure for each (expanded) Rust feature. If the list contains
/// Parse the value of the target spec `features` field or `-Ctarget-feature`, also expanding
/// implied features, and call the closure for each (expanded) Rust feature. If the list contains
/// a syntactically invalid item (not starting with `+`/`-`), the error callback is invoked.
fn parse_rust_feature_flag<'a>(
fn parse_rust_feature_list<'a>(
sess: &'a Session,
features: &'a str,
err_callback: impl Fn(&'a str),
mut callback: impl FnMut(
/* base_feature */ &'a str,
@@ -154,7 +155,7 @@ fn parse_rust_feature_flag<'a>(
// A cache for the backwards implication map.
let mut inverse_implied_features: Option<FxHashMap<&str, FxHashSet<&str>>> = None;
for feature in sess.opts.cg.target_feature.split(',') {
for feature in features.split(',') {
if let Some(base_feature) = feature.strip_prefix('+') {
// Skip features that are not target features, but rustc features.
if RUSTC_SPECIFIC_FEATURES.contains(&base_feature) {
@@ -244,8 +245,9 @@ pub fn cfg_target_feature<'a, const N: usize>(
let mut enabled_disabled_features = FxHashMap::default();
// Add enabled and remove disabled features.
parse_rust_feature_flag(
parse_rust_feature_list(
sess,
&sess.opts.cg.target_feature,
/* err_callback */
|feature| {
sess.dcx().emit_warn(errors::UnknownCTargetFeaturePrefix { feature });
@@ -366,6 +368,37 @@ pub fn check_tied_features(
None
}
/// Translates the target spec `features` field into a backend target feature list.
///
/// `extend_backend_features` extends the set of backend features (assumed to be in mutable state
/// accessible by that closure) to enable/disable the given Rust feature name.
pub fn target_spec_to_backend_features<'a>(
sess: &'a Session,
mut extend_backend_features: impl FnMut(&'a str, /* enable */ bool),
) {
// Compute implied features
let mut rust_features = vec![];
parse_rust_feature_list(
sess,
&sess.target.features,
/* err_callback */
|feature| {
panic!("Target spec contains invalid feature {feature}");
},
|_base_feature, new_features, enable| {
// FIXME emit an error for unknown features like cfg_target_feature would for -Ctarget-feature
rust_features.extend(
UnordSet::from(new_features).to_sorted_stable_ord().iter().map(|&&s| (enable, s)),
);
},
);
// Add this to the backend features.
for (enable, feature) in rust_features {
extend_backend_features(feature, enable);
}
}
/// Translates the `-Ctarget-feature` flag into a backend target feature list.
///
/// `extend_backend_features` extends the set of backend features (assumed to be in mutable state
@@ -376,8 +409,9 @@ pub fn flag_to_backend_features<'a>(
) {
// Compute implied features
let mut rust_features = vec![];
parse_rust_feature_flag(
parse_rust_feature_list(
sess,
&sess.opts.cg.target_feature,
/* err_callback */
|_feature| {
// Errors are already emitted in `cfg_target_feature`; avoid duplicates.
@@ -522,6 +522,10 @@ impl<'tcx, Prov: Provenance> OpTy<'tcx, Prov> {
pub(super) fn op(&self) -> &Operand<Prov> {
&self.op
}
pub fn is_immediate_uninit(&self) -> bool {
matches!(self.op, Operand::Immediate(Immediate::Uninit))
}
}
impl<'tcx, Prov: Provenance> Projectable<'tcx, Prov> for OpTy<'tcx, Prov> {
+1
View File
@@ -75,6 +75,7 @@ ctrlc = "3.4.4"
check_only = ['rustc_interface/check_only']
llvm = ['rustc_interface/llvm']
llvm_enzyme = ['rustc_interface/llvm_enzyme']
llvm_offload = ['rustc_interface/llvm_offload']
max_level_info = ['rustc_log/max_level_info']
rustc_randomized_layouts = [
'rustc_index/rustc_randomized_layouts',
-4
View File
@@ -455,10 +455,6 @@ pub fn replace(&mut self, before: Span, after: Span) -> bool {
replacements_occurred
}
pub fn pop_span_label(&mut self) -> Option<(Span, DiagMessage)> {
self.span_labels.pop()
}
/// Returns the strings to highlight. We always ensure that there
/// is an entry for each of the primary spans -- for each primary
/// span `P`, if there is at least one label with span `P`, we return
+1 -1
View File
@@ -5,7 +5,7 @@ edition = "2024"
[dependencies]
# tidy-alphabetical-start
annotate-snippets = "0.12.9"
annotate-snippets = { version = "0.12.9", features = ["simd"] }
anstream = "0.6.20"
anstyle = "1.0.13"
derive_setters = "0.1.6"
@@ -213,6 +213,7 @@ fn emit_messages_default(
file_ann.swap(0, pos);
}
let file_ann_len = file_ann.len();
for (file_idx, (file, annotations)) in file_ann.into_iter().enumerate() {
if should_show_source_code(&self.ignored_directories_in_source_blocks, sm, &file) {
if let Some(snippet) = self.annotated_snippet(annotations, &file.name, sm) {
@@ -240,6 +241,7 @@ fn emit_messages_default(
// ╰ warning: this was previously accepted
if let Some(c) = children.first()
&& (!c.span.has_primary_spans() && !c.span.has_span_labels())
&& file_idx == file_ann_len - 1
{
group = group.element(Padding);
}
@@ -631,7 +633,7 @@ fn unannotated_messages<'a>(
report.push(std::mem::replace(&mut group, Group::with_level(level.clone())));
}
if !line_tracker.contains(&lo.line) {
if !line_tracker.contains(&lo.line) && (i == 0 || hi.line <= lo.line) {
line_tracker.push(lo.line);
// ╭▸ $SRC_DIR/core/src/option.rs:594:0 (<- It adds *this*)
// ⸬ $SRC_DIR/core/src/option.rs:602:4
@@ -740,6 +742,14 @@ fn collect_annotations(
}
}
}
// Sort annotations within each file by line number
for (_, ann) in output.iter_mut() {
ann.sort_by_key(|a| {
let lo = sm.lookup_char_pos(a.span.lo());
lo.line
});
}
output
}
+8 -14
View File
@@ -532,30 +532,24 @@ fn translator(&self) -> &Translator {
}
}
/// An emitter that does nothing when emitting a non-fatal diagnostic.
/// Fatal diagnostics are forwarded to `fatal_emitter` to avoid silent
/// failures of rustc, as witnessed e.g. in issue #89358.
pub struct FatalOnlyEmitter {
pub fatal_emitter: Box<dyn Emitter + DynSend>,
pub fatal_note: Option<String>,
/// An emitter that adds a note to each diagnostic.
pub struct EmitterWithNote {
pub emitter: Box<dyn Emitter + DynSend>,
pub note: String,
}
impl Emitter for FatalOnlyEmitter {
impl Emitter for EmitterWithNote {
fn source_map(&self) -> Option<&SourceMap> {
None
}
fn emit_diagnostic(&mut self, mut diag: DiagInner, registry: &Registry) {
if diag.level == Level::Fatal {
if let Some(fatal_note) = &self.fatal_note {
diag.sub(Level::Note, fatal_note.clone(), MultiSpan::new());
}
self.fatal_emitter.emit_diagnostic(diag, registry);
}
diag.sub(Level::Note, self.note.clone(), MultiSpan::new());
self.emitter.emit_diagnostic(diag, registry);
}
fn translator(&self) -> &Translator {
self.fatal_emitter.translator()
self.emitter.translator()
}
}
+1 -1
View File
@@ -348,7 +348,7 @@ fn push_trailing(
hi_opt: Option<&Loc>,
) -> usize {
let mut line_count = 0;
// Convert CharPos to Usize, as CharPose is character offset
// Convert `CharPos` to `usize`, as `CharPos` is character offset
// Extract low index and high index
let (lo, hi_opt) = (lo.col.to_usize(), hi_opt.map(|hi| hi.col.to_usize()));
if let Some(line) = line_opt {
+2
View File
@@ -60,6 +60,8 @@ macro_rules! declare_features {
(accepted, adx_target_feature, "1.61.0", Some(44839)),
/// Allows explicit discriminants on non-unit enum variants.
(accepted, arbitrary_enum_discriminant, "1.66.0", Some(60553)),
/// Allows #[cfg(...)] on inline assembly templates and operands.
(accepted, asm_cfg, "CURRENT_RUSTC_VERSION", Some(140364)),
/// Allows using `const` operands in inline assembly.
(accepted, asm_const, "1.82.0", Some(93332)),
/// Allows using `label` operands in inline assembly.
@@ -1117,6 +1117,11 @@ pub struct BuiltinAttribute {
rustc_autodiff, Normal,
template!(Word, List: &[r#""...""#]), DuplicatesOk,
EncodeCrossCrate::Yes,
),
rustc_attr!(
rustc_offload_kernel, Normal,
template!(Word), DuplicatesOk,
EncodeCrossCrate::Yes,
),
// Traces that are left when `cfg` and `cfg_attr` attributes are expanded.
// The attributes are not gated, to avoid stability errors, but they cannot be used in stable
@@ -1267,6 +1272,11 @@ pub struct BuiltinAttribute {
EncodeCrossCrate::Yes,
"`#[rustc_as_ptr]` is used to mark functions returning pointers to their inner allocations."
),
rustc_attr!(
rustc_should_not_be_called_on_const_items, Normal, template!(Word), ErrorFollowing,
EncodeCrossCrate::Yes,
"`#[rustc_should_not_be_called_on_const_items]` is used to mark methods that don't make sense to be called on interior mutable consts."
),
rustc_attr!(
rustc_pass_by_value, Normal, template!(Word), ErrorFollowing,
EncodeCrossCrate::Yes,
-2
View File
@@ -382,8 +382,6 @@ pub fn internal(&self, feature: Symbol) -> bool {
(unstable, arbitrary_self_types, "1.23.0", Some(44874)),
/// Allows inherent and trait methods with arbitrary self types that are raw pointers.
(unstable, arbitrary_self_types_pointers, "1.83.0", Some(44874)),
/// Allows #[cfg(...)] on inline assembly templates and operands.
(unstable, asm_cfg, "1.89.0", Some(140364)),
/// Enables experimental inline assembly support for additional architectures.
(unstable, asm_experimental_arch, "1.58.0", Some(93335)),
/// Enables experimental register support in inline assembly.
@@ -701,6 +701,9 @@ pub enum AttributeKind {
/// Represents `#[rustc_pass_indirectly_in_non_rustic_abis]`
RustcPassIndirectlyInNonRusticAbis(Span),
/// Represents `#[rustc_should_not_be_called_on_const_items]`
RustcShouldNotBeCalledOnConstItems(Span),
/// Represents `#[rustc_simd_monomorphize_lane_limit = "N"]`.
RustcSimdMonomorphizeLaneLimit(Limit),
@@ -91,6 +91,7 @@ pub fn encode_cross_crate(&self) -> EncodeCrossCrate {
RustcMain => No,
RustcObjectLifetimeDefault => No,
RustcPassIndirectlyInNonRusticAbis(..) => No,
RustcShouldNotBeCalledOnConstItems(..) => Yes,
RustcSimdMonomorphizeLaneLimit(..) => Yes, // Affects layout computation, which needs to work cross-crate
Sanitize { .. } => No,
ShouldPanic { .. } => No,
+13 -2
View File
@@ -3841,8 +3841,12 @@ pub fn is_async(self) -> bool {
}
#[derive(Copy, Clone, PartialEq, Eq, Debug, Encodable, Decodable, HashStable_Generic)]
#[derive(Default)]
pub enum Defaultness {
Default { has_value: bool },
Default {
has_value: bool,
},
#[default]
Final,
}
@@ -4186,8 +4190,13 @@ pub fn is_struct_or_union(&self) -> bool {
}
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
#[derive(Encodable, Decodable, HashStable_Generic)]
#[derive(Encodable, Decodable, HashStable_Generic, Default)]
pub enum Safety {
/// This is the default variant, because the compiler messing up
/// metadata encoding and failing to encode a `Safe` flag, means
/// downstream crates think a thing is `Unsafe` instead of silently
/// treating an unsafe thing as safe.
#[default]
Unsafe,
Safe,
}
@@ -4224,7 +4233,9 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
}
#[derive(Copy, Clone, PartialEq, Eq, Debug, Encodable, Decodable, HashStable_Generic)]
#[derive(Default)]
pub enum Constness {
#[default]
Const,
NotConst,
}
+3 -3
View File
@@ -17,19 +17,19 @@ pub struct DelayedLints {
/// and then there's a gap where no lints can be emitted until HIR is done.
/// The variants in this enum represent lints that are temporarily stashed during
/// AST lowering to be emitted once HIR is built.
#[derive(Clone, Debug, HashStable_Generic)]
#[derive(Debug, HashStable_Generic)]
pub enum DelayedLint {
AttributeParsing(AttributeLint<HirId>),
}
#[derive(Clone, Debug, HashStable_Generic)]
#[derive(Debug, HashStable_Generic)]
pub struct AttributeLint<Id> {
pub id: Id,
pub span: Span,
pub kind: AttributeLintKind,
}
#[derive(Clone, Debug, HashStable_Generic)]
#[derive(Debug, HashStable_Generic)]
pub enum AttributeLintKind {
/// Copy of `IllFormedAttributeInput`
/// specifically for the `invalid_macro_export_arguments` lint until that is removed,
@@ -163,6 +163,7 @@ fn intrinsic_operation_unsafety(tcx: TyCtxt<'_>, intrinsic_id: LocalDefId) -> hi
| sym::minnumf128
| sym::mul_with_overflow
| sym::needs_drop
| sym::offload
| sym::offset_of
| sym::overflow_checks
| sym::powf16
@@ -313,6 +314,7 @@ pub(crate) fn check_intrinsic_type(
let type_id = tcx.type_of(tcx.lang_items().type_id().unwrap()).instantiate_identity();
(0, 0, vec![type_id, type_id], tcx.types.bool)
}
sym::offload => (3, 0, vec![param(0), param(1)], param(2)),
sym::offset => (2, 0, vec![param(0), param(1)], param(0)),
sym::arith_offset => (
1,
@@ -99,7 +99,7 @@ fn resolve_block<'tcx>(
for (i, statement) in blk.stmts.iter().enumerate() {
match statement.kind {
hir::StmtKind::Let(LetStmt { els: Some(els), .. }) => {
// Let-else has a special lexical structure for variables.
// let-else has a special lexical structure for variables.
// First we take a checkpoint of the current scope context here.
let mut prev_cx = visitor.cx;
@@ -1186,14 +1186,21 @@ pub(crate) fn check_static_item<'tcx>(
) -> Result<(), ErrorGuaranteed> {
enter_wf_checking_ctxt(tcx, item_id, |wfcx| {
let span = tcx.ty_span(item_id);
let item_ty = wfcx.deeply_normalize(span, Some(WellFormedLoc::Ty(item_id)), ty);
let loc = Some(WellFormedLoc::Ty(item_id));
let item_ty = wfcx.deeply_normalize(span, loc, ty);
let is_foreign_item = tcx.is_foreign_item(item_id);
let is_structurally_foreign_item = || {
let tail = tcx.struct_tail_raw(
item_ty,
&ObligationCause::dummy(),
|ty| wfcx.deeply_normalize(span, loc, ty),
|| {},
);
let forbid_unsized = !is_foreign_item || {
let tail = tcx.struct_tail_for_codegen(item_ty, wfcx.infcx.typing_env(wfcx.param_env));
!matches!(tail.kind(), ty::Foreign(_))
matches!(tail.kind(), ty::Foreign(_))
};
let forbid_unsized = !(is_foreign_item && is_structurally_foreign_item());
wfcx.register_wf_obligation(span, Some(WellFormedLoc::Ty(item_id)), item_ty.into());
if forbid_unsized {
+14 -2
View File
@@ -1291,14 +1291,26 @@ fn try_find_coercion_lub<E>(
ty::Closure(..) => {
Adjust::Pointer(PointerCoercion::ClosureFnPointer(a_sig.safety()))
}
ty::FnDef(..) => Adjust::Pointer(PointerCoercion::ReifyFnPointer),
ty::FnDef(def_id, ..) => {
// Intrinsics are not coercible to function pointers
if self.tcx.intrinsic(def_id).is_some() {
return Err(TypeError::IntrinsicCast);
}
Adjust::Pointer(PointerCoercion::ReifyFnPointer)
}
_ => span_bug!(cause.span, "should not try to coerce a {prev_ty} to a fn pointer"),
};
let next_adjustment = match new_ty.kind() {
ty::Closure(..) => {
Adjust::Pointer(PointerCoercion::ClosureFnPointer(b_sig.safety()))
}
ty::FnDef(..) => Adjust::Pointer(PointerCoercion::ReifyFnPointer),
ty::FnDef(def_id, ..) => {
// Intrinsics are not coercible to function pointers
if self.tcx.intrinsic(def_id).is_some() {
return Err(TypeError::IntrinsicCast);
}
Adjust::Pointer(PointerCoercion::ReifyFnPointer)
}
_ => span_bug!(new.span, "should not try to coerce a {new_ty} to a fn pointer"),
};
for expr in exprs.iter().map(|e| e.as_coercion_site()) {
+368 -154
View File
@@ -666,99 +666,21 @@ fn visit_pat(&mut self, p: &'v hir::Pat<'v>) -> Self::Result {
}
}
fn report_no_match_method_error(
fn suggest_method_call_annotation(
&self,
mut span: Span,
err: &mut Diag<'_>,
span: Span,
rcvr_ty: Ty<'tcx>,
item_ident: Ident,
expr_id: hir::HirId,
mode: Mode,
source: SelfSource<'tcx>,
args: Option<&'tcx [hir::Expr<'tcx>]>,
sugg_span: Span,
no_match_data: &mut NoMatchData<'tcx>,
expected: Expectation<'tcx>,
trait_missing_method: bool,
within_macro_span: Option<Span>,
) -> ErrorGuaranteed {
let mode = no_match_data.mode;
let tcx = self.tcx;
let rcvr_ty = self.resolve_vars_if_possible(rcvr_ty);
let mut ty_file = None;
let is_method = mode == Mode::MethodCall;
let unsatisfied_predicates = &no_match_data.unsatisfied_predicates;
let similar_candidate = no_match_data.similar_candidate;
let item_kind = if is_method {
"method"
} else if rcvr_ty.is_enum() {
"variant or associated item"
} else {
match (item_ident.as_str().chars().next(), rcvr_ty.is_fresh_ty()) {
(Some(name), false) if name.is_lowercase() => "function or associated item",
(Some(_), false) => "associated item",
(Some(_), true) | (None, false) => "variant or associated item",
(None, true) => "variant",
}
};
// We could pass the file for long types into these two, but it isn't strictly necessary
// given how targeted they are.
if let Err(guar) =
self.report_failed_method_call_on_range_end(tcx, rcvr_ty, source, span, item_ident)
{
return guar;
}
if let Err(guar) = self.report_failed_method_call_on_numerical_infer_var(
tcx,
rcvr_ty,
source,
span,
item_kind,
item_ident,
&mut ty_file,
) {
return guar;
}
span = item_ident.span;
let is_write = sugg_span.ctxt().outer_expn_data().macro_def_id.is_some_and(|def_id| {
tcx.is_diagnostic_item(sym::write_macro, def_id)
|| tcx.is_diagnostic_item(sym::writeln_macro, def_id)
}) && item_ident.name == sym::write_fmt;
let mut err = if is_write && let SelfSource::MethodCall(rcvr_expr) = source {
self.create_missing_writer_err(rcvr_ty, rcvr_expr, ty_file)
} else {
self.create_no_assoc_err(
rcvr_ty,
item_ident,
item_kind,
trait_missing_method,
source,
is_method,
sugg_span,
unsatisfied_predicates,
)
};
if rcvr_ty.references_error() {
err.downgrade_to_delayed_bug();
}
self.set_label_for_method_error(
&mut err,
source,
rcvr_ty,
item_ident,
expr_id,
span,
sugg_span,
within_macro_span,
args,
);
) {
if let Mode::MethodCall = mode
&& let SelfSource::MethodCall(cal) = source
{
self.suggest_await_before_method(
&mut err,
err,
item_ident,
rcvr_ty,
cal,
@@ -767,10 +689,10 @@ fn report_no_match_method_error(
);
}
self.suggest_on_pointer_type(&mut err, source, rcvr_ty, item_ident);
self.suggest_on_pointer_type(err, source, rcvr_ty, item_ident);
if let SelfSource::MethodCall(rcvr_expr) = source {
self.suggest_fn_call(&mut err, rcvr_expr, rcvr_ty, |output_ty| {
self.suggest_fn_call(err, rcvr_expr, rcvr_ty, |output_ty| {
let call_expr = self.tcx.hir_expect_expr(self.tcx.parent_hir_id(rcvr_expr.hir_id));
let probe = self.lookup_probe_for_diagnostic(
item_ident,
@@ -782,14 +704,25 @@ fn report_no_match_method_error(
probe.is_ok()
});
self.note_internal_mutation_in_method(
&mut err,
err,
rcvr_expr,
expected.to_option(self),
rcvr_ty,
);
}
}
let mut custom_span_label = false;
fn suggest_static_method_candidates(
&self,
err: &mut Diag<'_>,
span: Span,
rcvr_ty: Ty<'tcx>,
item_ident: Ident,
source: SelfSource<'tcx>,
args: Option<&'tcx [hir::Expr<'tcx>]>,
sugg_span: Span,
no_match_data: &NoMatchData<'tcx>,
) -> Vec<CandidateSource> {
let mut static_candidates = no_match_data.static_candidates.clone();
// `static_candidates` may have same candidates appended by
@@ -803,11 +736,10 @@ fn report_no_match_method_error(
functions must have a `self` parameter",
);
err.span_label(span, "this is an associated function, not a method");
custom_span_label = true;
}
if static_candidates.len() == 1 {
self.suggest_associated_call_syntax(
&mut err,
err,
&static_candidates,
rcvr_ty,
source,
@@ -821,7 +753,7 @@ fn report_no_match_method_error(
source,
args,
span,
&mut err,
err,
&mut static_candidates,
None,
);
@@ -832,23 +764,31 @@ fn report_no_match_method_error(
source,
args,
span,
&mut err,
err,
&mut static_candidates,
Some(sugg_span),
);
}
static_candidates
}
let mut bound_spans: SortedMap<Span, Vec<String>> = Default::default();
fn suggest_unsatisfied_ty_or_trait(
&self,
err: &mut Diag<'_>,
span: Span,
rcvr_ty: Ty<'tcx>,
item_ident: Ident,
item_kind: &str,
source: SelfSource<'tcx>,
unsatisfied_predicates: &UnsatisfiedPredicates<'tcx>,
static_candidates: &[CandidateSource],
) -> Result<(bool, bool, bool, bool, SortedMap<Span, Vec<String>>), ()> {
let mut restrict_type_params = false;
let mut suggested_derive = false;
let mut unsatisfied_bounds = false;
let mut ty_span = match rcvr_ty.kind() {
ty::Param(param_type) => {
Some(param_type.span_from_generics(self.tcx, self.body_id.to_def_id()))
}
ty::Adt(def, _) if def.did().is_local() => Some(tcx.def_span(def.did())),
_ => None,
};
let mut custom_span_label = !static_candidates.is_empty();
let mut bound_spans: SortedMap<Span, Vec<String>> = Default::default();
let tcx = self.tcx;
if item_ident.name == sym::count && self.is_slice_ty(rcvr_ty, span) {
let msg = "consider using `len` instead";
@@ -873,7 +813,8 @@ fn report_no_match_method_error(
Applicability::MaybeIncorrect,
);
}
return err.emit();
// Report to emit the diagnostic
return Err(());
} else if !unsatisfied_predicates.is_empty() {
if matches!(rcvr_ty.kind(), ty::Param(_)) {
// We special case the situation where we are looking for `_` in
@@ -888,7 +829,7 @@ fn report_no_match_method_error(
// suggestions.
} else {
self.handle_unsatisfied_predicates(
&mut err,
err,
rcvr_ty,
item_ident,
item_kind,
@@ -936,21 +877,55 @@ fn report_no_match_method_error(
}
}
}
Ok((
restrict_type_params,
suggested_derive,
unsatisfied_bounds,
custom_span_label,
bound_spans,
))
}
let mut find_candidate_for_method = false;
let should_label_not_found = match source {
fn suggest_surround_method_call(
&self,
err: &mut Diag<'_>,
span: Span,
rcvr_ty: Ty<'tcx>,
item_ident: Ident,
source: SelfSource<'tcx>,
similar_candidate: &Option<ty::AssocItem>,
) -> bool {
match source {
// If the method name is the name of a field with a function or closure type,
// give a helping note that it has to be called as `(x.f)(...)`.
SelfSource::MethodCall(expr) => {
!self.suggest_calling_field_as_fn(span, rcvr_ty, expr, item_ident, &mut err)
!self.suggest_calling_field_as_fn(span, rcvr_ty, expr, item_ident, err)
&& similar_candidate.is_none()
}
_ => true,
};
}
}
fn find_possible_candidates_for_method(
&self,
err: &mut Diag<'_>,
span: Span,
rcvr_ty: Ty<'tcx>,
item_ident: Ident,
item_kind: &str,
mode: Mode,
source: SelfSource<'tcx>,
no_match_data: &NoMatchData<'tcx>,
expected: Expectation<'tcx>,
should_label_not_found: bool,
custom_span_label: bool,
) {
let mut find_candidate_for_method = false;
let unsatisfied_predicates = &no_match_data.unsatisfied_predicates;
if should_label_not_found && !custom_span_label {
self.set_not_found_span_label(
&mut err,
err,
rcvr_ty,
item_ident,
item_kind,
@@ -963,7 +938,7 @@ fn report_no_match_method_error(
}
if !find_candidate_for_method {
self.lookup_segments_chain_for_no_match_method(
&mut err,
err,
item_ident,
item_kind,
source,
@@ -975,7 +950,7 @@ fn report_no_match_method_error(
// can't be called due to `typeof(expr): Clone` not holding.
if unsatisfied_predicates.is_empty() {
self.suggest_calling_method_on_field(
&mut err,
err,
source,
span,
rcvr_ty,
@@ -983,37 +958,21 @@ fn report_no_match_method_error(
expected.only_has_type(self),
);
}
}
self.suggest_unwrapping_inner_self(&mut err, source, rcvr_ty, item_ident);
if rcvr_ty.is_numeric() && rcvr_ty.is_fresh() || restrict_type_params || suggested_derive {
// skip suggesting traits to import
} else {
self.suggest_traits_to_import(
&mut err,
span,
rcvr_ty,
item_ident,
args.map(|args| args.len() + 1),
source,
no_match_data.out_of_scope_traits.clone(),
&static_candidates,
unsatisfied_bounds,
expected.only_has_type(self),
trait_missing_method,
);
}
self.suggest_enum_variant_for_method_call(
&mut err,
rcvr_ty,
item_ident,
span,
source,
unsatisfied_predicates,
);
fn suggest_confusable_or_similarly_named_method(
&self,
err: &mut Diag<'_>,
span: Span,
rcvr_ty: Ty<'tcx>,
item_ident: Ident,
mode: Mode,
args: Option<&'tcx [hir::Expr<'tcx>]>,
unsatisfied_predicates: &UnsatisfiedPredicates<'tcx>,
similar_candidate: Option<ty::AssocItem>,
) {
let confusable_suggested = self.confusable_method_name(
&mut err,
err,
rcvr_ty,
item_ident,
args.map(|args| {
@@ -1033,18 +992,28 @@ fn report_no_match_method_error(
// and if we aren't in an expansion.
&& !span.from_expansion()
{
self.find_likely_intended_associated_item(
&mut err,
similar_candidate,
span,
args,
mode,
);
self.find_likely_intended_associated_item(err, similar_candidate, span, args, mode);
}
}
}
fn suggest_method_not_found_because_of_unsatisfied_bounds(
&self,
err: &mut Diag<'_>,
rcvr_ty: Ty<'tcx>,
item_ident: Ident,
item_kind: &str,
bound_spans: SortedMap<Span, Vec<String>>,
) {
let mut ty_span = match rcvr_ty.kind() {
ty::Param(param_type) => {
Some(param_type.span_from_generics(self.tcx, self.body_id.to_def_id()))
}
ty::Adt(def, _) if def.did().is_local() => Some(self.tcx.def_span(def.did())),
_ => None,
};
for (span, mut bounds) in bound_spans {
if !tcx.sess.source_map().is_span_accessible(span) {
if !self.tcx.sess.source_map().is_span_accessible(span) {
continue;
}
bounds.sort();
@@ -1077,6 +1046,209 @@ fn report_no_match_method_error(
),
);
}
}
fn report_no_match_method_error(
&self,
span: Span,
rcvr_ty: Ty<'tcx>,
item_ident: Ident,
expr_id: hir::HirId,
source: SelfSource<'tcx>,
args: Option<&'tcx [hir::Expr<'tcx>]>,
sugg_span: Span,
no_match_data: &mut NoMatchData<'tcx>,
expected: Expectation<'tcx>,
trait_missing_method: bool,
within_macro_span: Option<Span>,
) -> ErrorGuaranteed {
let tcx = self.tcx;
let rcvr_ty = self.resolve_vars_if_possible(rcvr_ty);
if let Err(guar) = rcvr_ty.error_reported() {
return guar;
}
// We could pass the file for long types into these two, but it isn't strictly necessary
// given how targeted they are.
if let Err(guar) =
self.report_failed_method_call_on_range_end(tcx, rcvr_ty, source, span, item_ident)
{
return guar;
}
let mut ty_file = None;
let mode = no_match_data.mode;
let is_method = mode == Mode::MethodCall;
let item_kind = if is_method {
"method"
} else if rcvr_ty.is_enum() {
"variant or associated item"
} else {
match (item_ident.as_str().chars().next(), rcvr_ty.is_fresh_ty()) {
(Some(name), false) if name.is_lowercase() => "function or associated item",
(Some(_), false) => "associated item",
(Some(_), true) | (None, false) => "variant or associated item",
(None, true) => "variant",
}
};
if let Err(guar) = self.report_failed_method_call_on_numerical_infer_var(
tcx,
rcvr_ty,
source,
span,
item_kind,
item_ident,
&mut ty_file,
) {
return guar;
}
let unsatisfied_predicates = &no_match_data.unsatisfied_predicates;
let is_write = sugg_span.ctxt().outer_expn_data().macro_def_id.is_some_and(|def_id| {
tcx.is_diagnostic_item(sym::write_macro, def_id)
|| tcx.is_diagnostic_item(sym::writeln_macro, def_id)
}) && item_ident.name == sym::write_fmt;
let mut err = if is_write && let SelfSource::MethodCall(rcvr_expr) = source {
self.create_missing_writer_err(rcvr_ty, rcvr_expr, ty_file)
} else {
self.create_no_assoc_err(
rcvr_ty,
item_ident,
item_kind,
trait_missing_method,
source,
is_method,
sugg_span,
unsatisfied_predicates,
)
};
self.set_label_for_method_error(
&mut err,
source,
rcvr_ty,
item_ident,
expr_id,
item_ident.span,
sugg_span,
within_macro_span,
args,
);
self.suggest_method_call_annotation(
&mut err,
item_ident.span,
rcvr_ty,
item_ident,
mode,
source,
expected,
);
let static_candidates = self.suggest_static_method_candidates(
&mut err,
item_ident.span,
rcvr_ty,
item_ident,
source,
args,
sugg_span,
&no_match_data,
);
let Ok((
restrict_type_params,
suggested_derive,
unsatisfied_bounds,
custom_span_label,
bound_spans,
)) = self.suggest_unsatisfied_ty_or_trait(
&mut err,
item_ident.span,
rcvr_ty,
item_ident,
item_kind,
source,
unsatisfied_predicates,
&static_candidates,
)
else {
return err.emit();
};
let similar_candidate = no_match_data.similar_candidate;
let should_label_not_found = self.suggest_surround_method_call(
&mut err,
item_ident.span,
rcvr_ty,
item_ident,
source,
&similar_candidate,
);
self.find_possible_candidates_for_method(
&mut err,
item_ident.span,
rcvr_ty,
item_ident,
item_kind,
mode,
source,
no_match_data,
expected,
should_label_not_found,
custom_span_label,
);
self.suggest_unwrapping_inner_self(&mut err, source, rcvr_ty, item_ident);
if rcvr_ty.is_numeric() && rcvr_ty.is_fresh() || restrict_type_params || suggested_derive {
// skip suggesting traits to import
} else {
self.suggest_traits_to_import(
&mut err,
item_ident.span,
rcvr_ty,
item_ident,
args.map(|args| args.len() + 1),
source,
no_match_data.out_of_scope_traits.clone(),
&static_candidates,
unsatisfied_bounds,
expected.only_has_type(self),
trait_missing_method,
);
}
self.suggest_enum_variant_for_method_call(
&mut err,
rcvr_ty,
item_ident,
item_ident.span,
source,
unsatisfied_predicates,
);
self.suggest_confusable_or_similarly_named_method(
&mut err,
item_ident.span,
rcvr_ty,
item_ident,
mode,
args,
unsatisfied_predicates,
similar_candidate,
);
self.suggest_method_not_found_because_of_unsatisfied_bounds(
&mut err,
rcvr_ty,
item_ident,
item_kind,
bound_spans,
);
self.note_derefed_ty_has_method(&mut err, source, rcvr_ty, item_ident, expected);
self.suggest_bounds_for_range_to_method(&mut err, source, item_ident);
@@ -1754,6 +1926,20 @@ fn handle_unsatisfied_predicates(
err.note(note);
}
if let ty::Adt(adt_def, _) = rcvr_ty.kind() {
unsatisfied_predicates.iter().find(|(pred, _parent, _cause)| {
if let ty::PredicateKind::Clause(ty::ClauseKind::Trait(pred)) =
pred.kind().skip_binder()
{
self.suggest_hashmap_on_unsatisfied_hashset_buildhasher(
err, &pred, *adt_def,
)
} else {
false
}
});
}
*suggested_derive = self.suggest_derive(err, unsatisfied_predicates);
*unsatisfied_bounds = true;
}
@@ -2990,7 +3176,7 @@ pub(crate) fn note_unmet_impls_on_type(
.filter_map(|e| match e.obligation.predicate.kind().skip_binder() {
ty::PredicateKind::Clause(ty::ClauseKind::Trait(pred)) => {
match pred.self_ty().kind() {
ty::Adt(_, _) => Some(pred),
ty::Adt(_, _) => Some((e.root_obligation.predicate, pred)),
_ => None,
}
}
@@ -3000,7 +3186,7 @@ pub(crate) fn note_unmet_impls_on_type(
// Note for local items and foreign items respectively.
let (mut local_preds, mut foreign_preds): (Vec<_>, Vec<_>) =
preds.iter().partition(|&pred| {
preds.iter().partition(|&(_, pred)| {
if let ty::Adt(def, _) = pred.self_ty().kind() {
def.did().is_local()
} else {
@@ -3008,10 +3194,10 @@ pub(crate) fn note_unmet_impls_on_type(
}
});
local_preds.sort_by_key(|pred: &&ty::TraitPredicate<'_>| pred.trait_ref.to_string());
local_preds.sort_by_key(|(_, pred)| pred.trait_ref.to_string());
let local_def_ids = local_preds
.iter()
.filter_map(|pred| match pred.self_ty().kind() {
.filter_map(|(_, pred)| match pred.self_ty().kind() {
ty::Adt(def, _) => Some(def.did()),
_ => None,
})
@@ -3024,7 +3210,7 @@ pub(crate) fn note_unmet_impls_on_type(
})
.collect::<Vec<_>>()
.into();
for pred in &local_preds {
for (_, pred) in &local_preds {
if let ty::Adt(def, _) = pred.self_ty().kind() {
local_spans.push_span_label(
self.tcx.def_span(def.did()),
@@ -3033,7 +3219,7 @@ pub(crate) fn note_unmet_impls_on_type(
}
}
if local_spans.primary_span().is_some() {
let msg = if let [local_pred] = local_preds.as_slice() {
let msg = if let [(_, local_pred)] = local_preds.as_slice() {
format!(
"an implementation of `{}` might be missing for `{}`",
local_pred.trait_ref.print_trait_sugared(),
@@ -3051,9 +3237,10 @@ pub(crate) fn note_unmet_impls_on_type(
err.span_note(local_spans, msg);
}
foreign_preds.sort_by_key(|pred: &&ty::TraitPredicate<'_>| pred.trait_ref.to_string());
foreign_preds
.sort_by_key(|(_, pred): &(_, ty::TraitPredicate<'_>)| pred.trait_ref.to_string());
for pred in foreign_preds {
for (_, pred) in &foreign_preds {
let ty = pred.self_ty();
let ty::Adt(def, _) = ty.kind() else { continue };
let span = self.tcx.def_span(def.did());
@@ -3066,6 +3253,17 @@ pub(crate) fn note_unmet_impls_on_type(
mspan,
format!("`{ty}` does not implement `{}`", pred.trait_ref.print_trait_sugared()),
);
foreign_preds.iter().find(|&(root_pred, pred)| {
if let ty::PredicateKind::Clause(ty::ClauseKind::Trait(root_pred)) =
root_pred.kind().skip_binder()
&& let Some(root_adt) = root_pred.self_ty().ty_adt_def()
{
self.suggest_hashmap_on_unsatisfied_hashset_buildhasher(err, pred, root_adt)
} else {
false
}
});
}
let preds: Vec<_> = errors
@@ -4388,6 +4586,22 @@ fn is_local(ty: Ty<'_>) -> bool {
self.autoderef(span, rcvr_ty).silence_errors().any(|(ty, _)| is_local(ty))
}
fn suggest_hashmap_on_unsatisfied_hashset_buildhasher(
&self,
err: &mut Diag<'_>,
pred: &ty::TraitPredicate<'_>,
adt: ty::AdtDef<'_>,
) -> bool {
if self.tcx.is_diagnostic_item(sym::HashSet, adt.did())
&& self.tcx.is_diagnostic_item(sym::BuildHasher, pred.def_id())
{
err.help("you might have intended to use a HashMap instead");
true
} else {
false
}
}
}
#[derive(Copy, Clone, Debug)]
+1
View File
@@ -59,4 +59,5 @@ rustc_abi = { path = "../rustc_abi" }
check_only = ['rustc_codegen_llvm?/check_only']
llvm = ['dep:rustc_codegen_llvm']
llvm_enzyme = ['rustc_builtin_macros/llvm_enzyme', 'rustc_codegen_llvm/llvm_enzyme']
llvm_offload = ['rustc_codegen_llvm/llvm_offload']
# tidy-alphabetical-end
+44 -26
View File
@@ -15,6 +15,7 @@
use rustc_middle::util::Providers;
use rustc_parse::lexer::StripTokens;
use rustc_parse::new_parser_from_source_str;
use rustc_parse::parser::Recovery;
use rustc_parse::parser::attr::AllowLeadingUnsafe;
use rustc_query_impl::QueryCtxt;
use rustc_query_system::query::print_query_stack;
@@ -52,9 +53,9 @@ pub struct Compiler {
pub(crate) fn parse_cfg(dcx: DiagCtxtHandle<'_>, cfgs: Vec<String>) -> Cfg {
cfgs.into_iter()
.map(|s| {
let psess = ParseSess::with_fatal_emitter(
let psess = ParseSess::emitter_with_note(
vec![crate::DEFAULT_LOCALE_RESOURCE, rustc_parse::DEFAULT_LOCALE_RESOURCE],
format!("this error occurred on the command line: `--cfg={s}`"),
format!("this occurred on the command line: `--cfg={s}`"),
);
let filename = FileName::cfg_spec_source_code(&s);
@@ -62,36 +63,46 @@ macro_rules! error {
($reason: expr) => {
#[allow(rustc::untranslatable_diagnostic)]
#[allow(rustc::diagnostic_outside_of_impl)]
dcx.fatal(format!(
concat!("invalid `--cfg` argument: `{}` (", $reason, ")"),
s
));
dcx.fatal(format!("invalid `--cfg` argument: `{s}` ({})", $reason));
};
}
match new_parser_from_source_str(&psess, filename, s.to_string(), StripTokens::Nothing)
{
Ok(mut parser) => match parser.parse_meta_item(AllowLeadingUnsafe::No) {
Ok(meta_item) if parser.token == token::Eof => {
if meta_item.path.segments.len() != 1 {
error!("argument key must be an identifier");
}
match &meta_item.kind {
MetaItemKind::List(..) => {}
MetaItemKind::NameValue(lit) if !lit.kind.is_str() => {
error!("argument value must be a string");
Ok(mut parser) => {
parser = parser.recovery(Recovery::Forbidden);
match parser.parse_meta_item(AllowLeadingUnsafe::No) {
Ok(meta_item)
if parser.token == token::Eof
&& parser.dcx().has_errors().is_none() =>
{
if meta_item.path.segments.len() != 1 {
error!("argument key must be an identifier");
}
MetaItemKind::NameValue(..) | MetaItemKind::Word => {
let ident = meta_item.ident().expect("multi-segment cfg key");
return (ident.name, meta_item.value_str());
match &meta_item.kind {
MetaItemKind::List(..) => {}
MetaItemKind::NameValue(lit) if !lit.kind.is_str() => {
error!("argument value must be a string");
}
MetaItemKind::NameValue(..) | MetaItemKind::Word => {
let ident = meta_item.ident().expect("multi-segment cfg key");
if ident.is_path_segment_keyword() {
error!(
"malformed `cfg` input, expected a valid identifier"
);
}
return (ident.name, meta_item.value_str());
}
}
}
Ok(..) => {}
Err(err) => err.cancel(),
}
Ok(..) => {}
Err(err) => err.cancel(),
},
}
Err(errs) => errs.into_iter().for_each(|err| err.cancel()),
}
};
// If the user tried to use a key="value" flag, but is missing the quotes, provide
// a hint about how to resolve this.
@@ -116,9 +127,9 @@ pub(crate) fn parse_check_cfg(dcx: DiagCtxtHandle<'_>, specs: Vec<String>) -> Ch
let mut check_cfg = CheckCfg { exhaustive_names, exhaustive_values, ..CheckCfg::default() };
for s in specs {
let psess = ParseSess::with_fatal_emitter(
let psess = ParseSess::emitter_with_note(
vec![crate::DEFAULT_LOCALE_RESOURCE, rustc_parse::DEFAULT_LOCALE_RESOURCE],
format!("this error occurred on the command line: `--check-cfg={s}`"),
format!("this occurred on the command line: `--check-cfg={s}`"),
);
let filename = FileName::cfg_spec_source_code(&s);
@@ -171,7 +182,7 @@ macro_rules! error {
let mut parser =
match new_parser_from_source_str(&psess, filename, s.to_string(), StripTokens::Nothing)
{
Ok(parser) => parser,
Ok(parser) => parser.recovery(Recovery::Forbidden),
Err(errs) => {
errs.into_iter().for_each(|err| err.cancel());
expected_error();
@@ -179,7 +190,9 @@ macro_rules! error {
};
let meta_item = match parser.parse_meta_item(AllowLeadingUnsafe::No) {
Ok(meta_item) if parser.token == token::Eof => meta_item,
Ok(meta_item) if parser.token == token::Eof && parser.dcx().has_errors().is_none() => {
meta_item
}
Ok(..) => expected_error(),
Err(err) => {
err.cancel();
@@ -209,6 +222,11 @@ macro_rules! error {
if values_specified {
error!("`cfg()` names cannot be after values");
}
if ident.is_path_segment_keyword() {
error!("malformed `cfg` input, expected a valid identifier");
}
names.push(ident);
} else if let Some(boolean) = arg.boolean_literal() {
if values_specified {
+4 -3
View File
@@ -364,15 +364,16 @@ fn name(&self) -> &'static str {
}
fn target_config(&self, sess: &Session) -> TargetConfig {
let abi_required_features = sess.target.abi_required_features();
let (target_features, unstable_target_features) = cfg_target_feature::<0>(
sess,
|_feature| Default::default(),
|feature| {
// This is a standin for the list of features a backend is expected to enable.
// It would be better to parse target.features instead and handle implied features,
// but target.features is a list of LLVM target features, not Rust target features.
// The dummy backend doesn't know the mapping between LLVM and Rust target features.
sess.target.abi_required_features().required.contains(&feature)
// but target.features doesn't contain features that are enabled by default for an
// architecture or target cpu.
abi_required_features.required.contains(&feature)
},
);
+8
View File
@@ -193,6 +193,14 @@ lint_confusable_identifier_pair = found both `{$existing_sym}` and `{$sym}` as i
.current_use = this identifier can be confused with `{$existing_sym}`
.other_use = other identifier used here
lint_const_item_interior_mutations =
mutation of an interior mutable `const` item with call to `{$method_name}`
.label = `{$const_name}` is a interior mutable `const` item of type `{$const_ty}`
.temporary = each usage of a `const` item creates a new temporary
.never_original = only the temporaries and never the original `const {$const_name}` will be modified
.suggestion_static = for a shared instance of `{$const_name}`, consider making it a `static` item instead
.help = for more details on interior mutability see <https://doc.rust-lang.org/reference/interior-mutability.html>
lint_dangling_pointers_from_locals = {$fn_kind} returns a dangling pointer to dropped local variable `{$local_var_name}`
.ret_ty = return type is `{$ret_ty}`
.local_var = local variable `{$local_var_name}` is dropped at the end of the {$fn_kind}
+13 -2
View File
@@ -2697,8 +2697,9 @@ fn ty_find_init_error<'tcx>(
///
/// ### Example
///
/// ```rust,no_run
/// ```rust,compile_fail
/// # #![allow(unused)]
/// # #![cfg_attr(bootstrap, deny(deref_nullptr))]
/// use std::ptr;
/// unsafe {
/// let x = &*ptr::null::<i32>();
@@ -2716,7 +2717,7 @@ fn ty_find_init_error<'tcx>(
///
/// [undefined behavior]: https://doc.rust-lang.org/reference/behavior-considered-undefined.html
pub DEREF_NULLPTR,
Warn,
Deny,
"detects when an null pointer is dereferenced"
}
@@ -2726,6 +2727,16 @@ impl<'tcx> LateLintPass<'tcx> for DerefNullPtr {
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &hir::Expr<'_>) {
/// test if expression is a null ptr
fn is_null_ptr(cx: &LateContext<'_>, expr: &hir::Expr<'_>) -> bool {
let pointer_ty = cx.typeck_results().expr_ty(expr);
let ty::RawPtr(pointee, _) = pointer_ty.kind() else {
return false;
};
if let Ok(layout) = cx.tcx.layout_of(cx.typing_env().as_query_input(*pointee)) {
if layout.layout.size() == rustc_abi::Size::ZERO {
return false;
}
}
match &expr.kind {
hir::ExprKind::Cast(expr, ty) => {
if let hir::TyKind::Ptr(_) = ty.kind {
@@ -0,0 +1,122 @@
use rustc_hir::attrs::AttributeKind;
use rustc_hir::def::{DefKind, Res};
use rustc_hir::{Expr, ExprKind, ItemKind, Node, find_attr};
use rustc_session::{declare_lint, declare_lint_pass};
use crate::lints::{ConstItemInteriorMutationsDiag, ConstItemInteriorMutationsSuggestionStatic};
use crate::{LateContext, LateLintPass, LintContext};
declare_lint! {
/// The `const_item_interior_mutations` lint checks for calls which
/// mutates an interior mutable const-item.
///
/// ### Example
///
/// ```rust
/// use std::sync::Once;
///
/// const INIT: Once = Once::new(); // using `INIT` will always create a temporary and
/// // never modify it-self on use, should be a `static`
/// // instead for shared use
///
/// fn init() {
/// INIT.call_once(|| {
/// println!("Once::call_once first call");
/// });
/// INIT.call_once(|| { // this second will also print
/// println!("Once::call_once second call"); // as each call to `INIT` creates
/// }); // new temporary
/// }
/// ```
///
/// {{produces}}
///
/// ### Explanation
///
/// Calling a method which mutates an interior mutable type has no effect as const-item
/// are essentially inlined wherever they are used, meaning that they are copied
/// directly into the relevant context when used rendering modification through
/// interior mutability ineffective across usage of that const-item.
///
/// The current implementation of this lint only warns on significant `std` and
/// `core` interior mutable types, like `Once`, `AtomicI32`, ... this is done out
/// of prudence to avoid false-positive and may be extended in the future.
pub CONST_ITEM_INTERIOR_MUTATIONS,
Warn,
"checks for calls which mutates a interior mutable const-item"
}
declare_lint_pass!(InteriorMutableConsts => [CONST_ITEM_INTERIOR_MUTATIONS]);
impl<'tcx> LateLintPass<'tcx> for InteriorMutableConsts {
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) {
let typeck = cx.typeck_results();
let (method_did, receiver) = match expr.kind {
// matching on `<receiver>.method(..)`
ExprKind::MethodCall(_, receiver, _, _) => {
(typeck.type_dependent_def_id(expr.hir_id), receiver)
}
// matching on `function(&<receiver>, ...)`
ExprKind::Call(path, [receiver, ..]) => match receiver.kind {
ExprKind::AddrOf(_, _, receiver) => match path.kind {
ExprKind::Path(ref qpath) => {
(cx.qpath_res(qpath, path.hir_id).opt_def_id(), receiver)
}
_ => return,
},
_ => return,
},
_ => return,
};
let Some(method_did) = method_did else {
return;
};
if let ExprKind::Path(qpath) = &receiver.kind
&& let Res::Def(DefKind::Const | DefKind::AssocConst, const_did) =
typeck.qpath_res(qpath, receiver.hir_id)
// Let's do the attribute check after the other checks for perf reasons
&& find_attr!(
cx.tcx.get_all_attrs(method_did),
AttributeKind::RustcShouldNotBeCalledOnConstItems(_)
)
&& let Some(method_name) = cx.tcx.opt_item_ident(method_did)
&& let Some(const_name) = cx.tcx.opt_item_ident(const_did)
&& let Some(const_ty) = typeck.node_type_opt(receiver.hir_id)
{
// Find the local `const`-item and create the suggestion to use `static` instead
let sugg_static = if let Some(Node::Item(const_item)) =
cx.tcx.hir_get_if_local(const_did)
&& let ItemKind::Const(ident, _generics, _ty, _body_id) = const_item.kind
{
if let Some(vis_span) = const_item.vis_span.find_ancestor_inside(const_item.span)
&& const_item.span.can_be_used_for_suggestions()
&& vis_span.can_be_used_for_suggestions()
{
Some(ConstItemInteriorMutationsSuggestionStatic::Spanful {
const_: const_item.vis_span.between(ident.span),
before: if !vis_span.is_empty() { " " } else { "" },
})
} else {
Some(ConstItemInteriorMutationsSuggestionStatic::Spanless)
}
} else {
None
};
cx.emit_span_lint(
CONST_ITEM_INTERIOR_MUTATIONS,
expr.span,
ConstItemInteriorMutationsDiag {
method_name,
const_name,
const_ty,
receiver_span: receiver.span,
sugg_static,
},
);
}
}
}
+3
View File
@@ -48,6 +48,7 @@
mod function_cast_as_integer;
mod if_let_rescope;
mod impl_trait_overcaptures;
mod interior_mutable_consts;
mod internal;
mod invalid_from_utf8;
mod late;
@@ -93,6 +94,7 @@
use function_cast_as_integer::*;
use if_let_rescope::IfLetRescope;
use impl_trait_overcaptures::ImplTraitOvercaptures;
use interior_mutable_consts::*;
use internal::*;
use invalid_from_utf8::*;
use let_underscore::*;
@@ -239,6 +241,7 @@ fn lint_mod(tcx: TyCtxt<'_>, module_def_id: LocalModDefId) {
AsyncClosureUsage: AsyncClosureUsage,
AsyncFnInTrait: AsyncFnInTrait,
NonLocalDefinitions: NonLocalDefinitions::default(),
InteriorMutableConsts: InteriorMutableConsts,
ImplTraitOvercaptures: ImplTraitOvercaptures,
IfLetRescope: IfLetRescope::default(),
StaticMutRefs: StaticMutRefs,
+33
View File
@@ -784,6 +784,39 @@ pub(crate) enum InvalidFromUtf8Diag {
},
}
// interior_mutable_consts.rs
#[derive(LintDiagnostic)]
#[diag(lint_const_item_interior_mutations)]
#[note(lint_temporary)]
#[note(lint_never_original)]
#[help]
pub(crate) struct ConstItemInteriorMutationsDiag<'tcx> {
pub method_name: Ident,
pub const_name: Ident,
pub const_ty: Ty<'tcx>,
#[label]
pub receiver_span: Span,
#[subdiagnostic]
pub sugg_static: Option<ConstItemInteriorMutationsSuggestionStatic>,
}
#[derive(Subdiagnostic)]
pub(crate) enum ConstItemInteriorMutationsSuggestionStatic {
#[suggestion(
lint_suggestion_static,
code = "{before}static ",
style = "verbose",
applicability = "maybe-incorrect"
)]
Spanful {
#[primary_span]
const_: Span,
before: &'static str,
},
#[help(lint_suggestion_static)]
Spanless,
}
// reference_casting.rs
#[derive(LintDiagnostic)]
pub(crate) enum InvalidReferenceCastingDiag<'tcx> {
@@ -124,6 +124,11 @@ fn is_ref_to_boxed_slice(ty: Ty<'_>) -> bool {
return;
};
// This check needs to avoid ICE from when `receiver_arg` is from macro expansion
// Which leads to empty span in span arithmetic below
// cc: https://github.com/rust-lang/rust/issues/147408
let span = receiver_arg.span.find_ancestor_in_same_ctxt(expr.span);
// If this expression comes from the `IntoIter::into_iter` inside of a for loop,
// we should just suggest removing the `.into_iter()` or changing it to `.iter()`
// to disambiguate if we want to iterate by-value or by-ref.
@@ -134,14 +139,15 @@ fn is_ref_to_boxed_slice(ty: Ty<'_>) -> bool {
&& let hir::ExprKind::Call(path, [_]) = &arg.kind
&& let hir::ExprKind::Path(qpath) = path.kind
&& cx.tcx.qpath_is_lang_item(qpath, LangItem::IntoIterIntoIter)
&& let Some(span) = span
{
Some(ShadowedIntoIterDiagSub::RemoveIntoIter {
span: receiver_arg.span.shrink_to_hi().to(expr.span.shrink_to_hi()),
span: span.shrink_to_hi().to(expr.span.shrink_to_hi()),
})
} else if can_suggest_ufcs {
} else if can_suggest_ufcs && let Some(span) = span {
Some(ShadowedIntoIterDiagSub::UseExplicitIntoIter {
start_span: expr.span.shrink_to_lo(),
end_span: receiver_arg.span.shrink_to_hi().to(expr.span.shrink_to_hi()),
end_span: span.shrink_to_hi().to(expr.span.shrink_to_hi()),
})
} else {
None
+4
View File
@@ -214,6 +214,10 @@ fn main() {
cfg.define("ENZYME", None);
}
if tracked_env_var_os("LLVM_OFFLOAD").is_some() {
cfg.define("OFFLOAD", None);
}
if tracked_env_var_os("LLVM_RUSTLLVM").is_some() {
cfg.define("LLVM_RUSTLLVM", None);
}
@@ -39,6 +39,14 @@
#include "llvm/Transforms/Utils/ValueMapper.h"
#include <iostream>
// Some of the functions below rely on LLVM modules that may not always be
// available. As such, we only try to build it in the first place, if
// llvm.offload is enabled.
#ifdef OFFLOAD
#include "llvm/Object/OffloadBinary.h"
#include "llvm/Target/TargetMachine.h"
#endif
// for raw `write` in the bad-alloc handler
#ifdef _MSC_VER
#include <io.h>
@@ -144,6 +152,55 @@ extern "C" void LLVMRustPrintStatistics(RustStringRef OutBuf) {
llvm::PrintStatistics(OS);
}
// Some of the functions here rely on LLVM modules that may not always be
// available. As such, we only try to build it in the first place, if
// llvm.offload is enabled.
#ifdef OFFLOAD
static Error writeFile(StringRef Filename, StringRef Data) {
Expected<std::unique_ptr<FileOutputBuffer>> OutputOrErr =
FileOutputBuffer::create(Filename, Data.size());
if (!OutputOrErr)
return OutputOrErr.takeError();
std::unique_ptr<FileOutputBuffer> Output = std::move(*OutputOrErr);
llvm::copy(Data, Output->getBufferStart());
if (Error E = Output->commit())
return E;
return Error::success();
}
// This is the first of many steps in creating a binary using llvm offload,
// to run code on the gpu. Concrete, it replaces the following binary use:
// clang-offload-packager -o host.out
// --image=file=device.bc,triple=amdgcn-amd-amdhsa,arch=gfx90a,kind=openmp
// The input module is the rust code compiled for a gpu target like amdgpu.
// Based on clang/tools/clang-offload-packager/ClangOffloadPackager.cpp
extern "C" bool LLVMRustBundleImages(LLVMModuleRef M, TargetMachine &TM) {
std::string Storage;
llvm::raw_string_ostream OS1(Storage);
llvm::WriteBitcodeToFile(*unwrap(M), OS1);
OS1.flush();
auto MB = llvm::MemoryBuffer::getMemBufferCopy(Storage, "module.bc");
SmallVector<char, 1024> BinaryData;
raw_svector_ostream OS2(BinaryData);
OffloadBinary::OffloadingImage ImageBinary{};
ImageBinary.TheImageKind = object::IMG_Bitcode;
ImageBinary.Image = std::move(MB);
ImageBinary.TheOffloadKind = object::OFK_OpenMP;
ImageBinary.StringData["triple"] = TM.getTargetTriple().str();
ImageBinary.StringData["arch"] = TM.getTargetCPU();
llvm::SmallString<0> Buffer = OffloadBinary::write(ImageBinary);
if (Buffer.size() % OffloadBinary::getAlignment() != 0)
// Offload binary has invalid size alignment
return false;
OS2 << Buffer;
if (Error E = writeFile("host.out",
StringRef(BinaryData.begin(), BinaryData.size())))
return false;
return true;
}
extern "C" void LLVMRustOffloadMapper(LLVMValueRef OldFn, LLVMValueRef NewFn) {
llvm::Function *oldFn = llvm::unwrap<llvm::Function>(OldFn);
llvm::Function *newFn = llvm::unwrap<llvm::Function>(NewFn);
@@ -163,6 +220,7 @@ extern "C" void LLVMRustOffloadMapper(LLVMValueRef OldFn, LLVMValueRef NewFn) {
llvm::CloneFunctionChangeType::LocalChangesOnly,
returns);
}
#endif
extern "C" LLVMValueRef LLVMRustGetNamedValue(LLVMModuleRef M, const char *Name,
size_t NameLen) {
@@ -1378,6 +1436,39 @@ extern "C" void LLVMRustPositionAfter(LLVMBuilderRef B, LLVMValueRef Instr) {
}
}
extern "C" LLVMValueRef LLVMRustGetInsertPoint(LLVMBuilderRef B) {
llvm::IRBuilderBase &IRB = *unwrap(B);
llvm::IRBuilderBase::InsertPoint ip = IRB.saveIP();
llvm::BasicBlock *BB = ip.getBlock();
if (!BB)
return nullptr;
auto it = ip.getPoint();
if (it == BB->end())
return nullptr;
llvm::Instruction *I = &*it;
return wrap(I);
}
extern "C" void LLVMRustRestoreInsertPoint(LLVMBuilderRef B,
LLVMValueRef Instr) {
llvm::IRBuilderBase &IRB = *unwrap(B);
if (!Instr) {
llvm::BasicBlock *BB = IRB.GetInsertBlock();
if (BB)
IRB.SetInsertPoint(BB);
return;
}
llvm::Instruction *I = unwrap<llvm::Instruction>(Instr);
IRB.SetInsertPoint(I);
}
extern "C" LLVMValueRef
LLVMRustGetFunctionCall(LLVMValueRef Fn, const char *Name, size_t NameLen) {
auto targetName = StringRef(Name, NameLen);
+1 -1
View File
@@ -1187,7 +1187,7 @@ fn get_visibility(self, id: DefIndex) -> Visibility<DefId> {
}
fn get_safety(self, id: DefIndex) -> Safety {
self.root.tables.safety.get(self, id).unwrap_or_else(|| self.missing("safety", id))
self.root.tables.safety.get(self, id)
}
fn get_default_field(self, id: DefIndex) -> Option<DefId> {
+7 -5
View File
@@ -1523,10 +1523,12 @@ fn encode_def_ids(&mut self) {
record!(self.tables.type_of[def_id] <- self.tcx.type_of(def_id));
}
if should_encode_constness(def_kind) {
self.tables.constness.set_some(def_id.index, self.tcx.constness(def_id));
let constness = self.tcx.constness(def_id);
self.tables.constness.set(def_id.index, constness);
}
if let DefKind::Fn | DefKind::AssocFn = def_kind {
self.tables.asyncness.set_some(def_id.index, tcx.asyncness(def_id));
let asyncness = tcx.asyncness(def_id);
self.tables.asyncness.set(def_id.index, asyncness);
record_array!(self.tables.fn_arg_idents[def_id] <- tcx.fn_arg_idents(def_id));
}
if let Some(name) = tcx.intrinsic(def_id) {
@@ -1689,7 +1691,7 @@ fn encode_info_for_adt(&mut self, local_def_id: LocalDefId) {
}));
for field in &variant.fields {
self.tables.safety.set_some(field.did.index, field.safety);
self.tables.safety.set(field.did.index, field.safety);
}
if let Some((CtorKind::Fn, ctor_def_id)) = variant.ctor {
@@ -1751,7 +1753,7 @@ fn encode_info_for_assoc_item(&mut self, def_id: DefId) {
let item = tcx.associated_item(def_id);
if matches!(item.container, AssocContainer::Trait | AssocContainer::TraitImpl(_)) {
self.tables.defaultness.set_some(def_id.index, item.defaultness(tcx));
self.tables.defaultness.set(def_id.index, item.defaultness(tcx));
}
record!(self.tables.assoc_container[def_id] <- item.container);
@@ -2153,7 +2155,7 @@ fn encode_impls(&mut self) -> LazyArray<TraitImpls> {
let header = tcx.impl_trait_header(def_id);
record!(self.tables.impl_trait_header[def_id] <- header);
self.tables.defaultness.set_some(def_id.index, tcx.defaultness(def_id));
self.tables.defaultness.set(def_id.index, tcx.defaultness(def_id));
let trait_ref = header.trait_ref.instantiate_identity();
let simplified_self_ty = fast_reject::simplify_type(
+4 -4
View File
@@ -400,6 +400,10 @@ fn encode(&self, buf: &mut FileEncoder) -> LazyTables {
// individually instead of `DefId`s.
module_children_reexports: Table<DefIndex, LazyArray<ModChild>>,
cross_crate_inlinable: Table<DefIndex, bool>,
asyncness: Table<DefIndex, ty::Asyncness>,
constness: Table<DefIndex, hir::Constness>,
safety: Table<DefIndex, hir::Safety>,
defaultness: Table<DefIndex, hir::Defaultness>,
- optional:
attributes: Table<DefIndex, LazyArray<hir::Attribute>>,
@@ -409,7 +413,6 @@ fn encode(&self, buf: &mut FileEncoder) -> LazyTables {
associated_item_or_field_def_ids: Table<DefIndex, LazyArray<DefIndex>>,
def_kind: Table<DefIndex, DefKind>,
visibility: Table<DefIndex, LazyValue<ty::Visibility<DefIndex>>>,
safety: Table<DefIndex, hir::Safety>,
def_span: Table<DefIndex, LazyValue<Span>>,
def_ident_span: Table<DefIndex, LazyValue<Span>>,
lookup_stability: Table<DefIndex, LazyValue<hir::Stability>>,
@@ -433,15 +436,12 @@ fn encode(&self, buf: &mut FileEncoder) -> LazyTables {
promoted_mir: Table<DefIndex, LazyValue<IndexVec<mir::Promoted, mir::Body<'static>>>>,
thir_abstract_const: Table<DefIndex, LazyValue<ty::EarlyBinder<'static, ty::Const<'static>>>>,
impl_parent: Table<DefIndex, RawDefId>,
constness: Table<DefIndex, hir::Constness>,
const_conditions: Table<DefIndex, LazyValue<ty::ConstConditions<'static>>>,
defaultness: Table<DefIndex, hir::Defaultness>,
// FIXME(eddyb) perhaps compute this on the fly if cheap enough?
coerce_unsized_info: Table<DefIndex, LazyValue<ty::adjustment::CoerceUnsizedInfo>>,
mir_const_qualif: Table<DefIndex, LazyValue<mir::ConstQualifs>>,
rendered_const: Table<DefIndex, LazyValue<String>>,
rendered_precise_capturing_args: Table<DefIndex, LazyArray<PreciseCapturingArgKind<Symbol, Symbol>>>,
asyncness: Table<DefIndex, ty::Asyncness>,
fn_arg_idents: Table<DefIndex, LazyArray<Option<Ident>>>,
coroutine_kind: Table<DefIndex, hir::CoroutineKind>,
coroutine_for_closure: Table<DefIndex, RawDefId>,
+53 -16
View File
@@ -112,6 +112,43 @@ impl FixedSizeEncoding for Option<$ty> {
}
}
macro_rules! defaulted_enum {
($ty:ty { $(($($pat:tt)*))* } $( unreachable { $(($($upat:tt)*))+ } )?) => {
impl FixedSizeEncoding for $ty {
type ByteArray = [u8; 1];
#[inline]
fn from_bytes(b: &[u8; 1]) -> Self {
use $ty::*;
let val = match b[0] {
$(${index()} => $($pat)*,)*
_ => panic!("Unexpected {} code: {:?}", stringify!($ty), b[0]),
};
// Make sure the first entry is always the default value,
// and none of the other values are the default value
debug_assert_ne!((b[0] != 0), IsDefault::is_default(&val));
val
}
#[inline]
fn write_to_bytes(self, b: &mut [u8; 1]) {
debug_assert!(!IsDefault::is_default(&self));
use $ty::*;
b[0] = match self {
$($($pat)* => ${index()},)*
$($($($upat)*)|+ => unreachable!(),)?
};
debug_assert_ne!(b[0], 0);
}
}
impl IsDefault for $ty {
fn is_default(&self) -> bool {
<$ty as Default>::default() == *self
}
}
}
}
// Workaround; need const traits to construct bitflags in a const
macro_rules! const_macro_kinds {
($($name:ident),+$(,)?) => (MacroKinds::from_bits_truncate($(MacroKinds::$name.bits())|+))
@@ -178,14 +215,7 @@ macro_rules! const_macro_kinds {
}
}
fixed_size_enum! {
hir::Constness {
( NotConst )
( Const )
}
}
fixed_size_enum! {
defaulted_enum! {
hir::Defaultness {
( Final )
( Default { has_value: false } )
@@ -193,17 +223,24 @@ macro_rules! const_macro_kinds {
}
}
fixed_size_enum! {
hir::Safety {
( Unsafe )
( Safe )
defaulted_enum! {
ty::Asyncness {
( No )
( Yes )
}
}
fixed_size_enum! {
ty::Asyncness {
( Yes )
( No )
defaulted_enum! {
hir::Constness {
( Const )
( NotConst )
}
}
defaulted_enum! {
hir::Safety {
( Unsafe )
( Safe )
}
}
@@ -190,6 +190,8 @@ impl CodegenFnAttrFlags: u32 {
const NO_BUILTINS = 1 << 15;
/// Marks foreign items, to make `contains_extern_indicator` cheaper.
const FOREIGN_ITEM = 1 << 16;
/// `#[rustc_offload_kernel]`: indicates that this is an offload kernel, an extra ptr arg will be added.
const OFFLOAD_KERNEL = 1 << 17;
}
}
rustc_data_structures::external_bitflags_debug! { CodegenFnAttrFlags }
+7
View File
@@ -1869,6 +1869,13 @@ fn pretty_print_const_value_tcx<'tcx>(
return Ok(());
}
// Printing [MaybeUninit<u8>::uninit(); N] or any other aggregate where all fields are uninit
// becomes very verbose. This special case makes the dump terse and clear.
if ct.all_bytes_uninit(tcx) {
fmt.write_str("<uninit>")?;
return Ok(());
}
let u8_type = tcx.types.u8;
match (ct, ty.kind()) {
// Byte/string slices, printed as (byte) string literals.
+4 -4
View File
@@ -589,13 +589,13 @@ fn for_each_relevant_impl(
| ty::Never
| ty::Tuple(_)
| ty::UnsafeBinder(_) => {
let simp = ty::fast_reject::simplify_type(
if let Some(simp) = ty::fast_reject::simplify_type(
tcx,
self_ty,
ty::fast_reject::TreatParams::AsRigid,
)
.unwrap();
consider_impls_for_simplified_type(simp);
) {
consider_impls_for_simplified_type(simp);
}
}
// HACK: For integer and float variables we have to manually look at all impls
+3 -1
View File
@@ -129,6 +129,7 @@
pub mod inhabitedness;
pub mod layout;
pub mod normalize_erasing_regions;
pub mod offload_meta;
pub mod pattern;
pub mod print;
pub mod relate;
@@ -250,9 +251,10 @@ pub struct ImplTraitHeader<'tcx> {
}
#[derive(Copy, Clone, PartialEq, Eq, Hash, TyEncodable, TyDecodable, HashStable, Debug)]
#[derive(TypeFoldable, TypeVisitable)]
#[derive(TypeFoldable, TypeVisitable, Default)]
pub enum Asyncness {
Yes,
#[default]
No,
}
@@ -0,0 +1,119 @@
use bitflags::bitflags;
use crate::ty::{self, PseudoCanonicalInput, Ty, TyCtxt, TypingEnv};
pub struct OffloadMetadata {
pub payload_size: u64,
pub mode: MappingFlags,
}
bitflags! {
/// Mirrors `OpenMPOffloadMappingFlags` from Clang/OpenMP.
#[derive(Debug, Copy, Clone)]
#[repr(transparent)]
pub struct MappingFlags: u64 {
/// No flags.
const NONE = 0x0;
/// Allocate memory on the device and move data from host to device.
const TO = 0x01;
/// Allocate memory on the device and move data from device to host.
const FROM = 0x02;
/// Always perform the requested mapping action, even if already mapped.
const ALWAYS = 0x04;
/// Delete the element from the device environment, ignoring ref count.
const DELETE = 0x08;
/// The element being mapped is a pointer-pointee pair.
const PTR_AND_OBJ = 0x10;
/// The base address should be passed to the target kernel as argument.
const TARGET_PARAM = 0x20;
/// The runtime must return the device pointer.
const RETURN_PARAM = 0x40;
/// The reference being passed is a pointer to private data.
const PRIVATE = 0x80;
/// Pass the element by value.
const LITERAL = 0x100;
/// Implicit map (generated by compiler, not explicit in code).
const IMPLICIT = 0x200;
/// Hint to allocate memory close to the target device.
const CLOSE = 0x400;
/// Reserved (0x800 in OpenMP for XLC compatibility).
const RESERVED = 0x800;
/// Require that the data is already allocated on the device.
const PRESENT = 0x1000;
/// Increment/decrement a separate ref counter (OpenACC compatibility).
const OMPX_HOLD = 0x2000;
/// Used for non-contiguous list items in target update.
const NON_CONTIG = 0x100000000000;
/// 16 MSBs indicate membership in a struct.
const MEMBER_OF = 0xffff000000000000;
}
}
impl OffloadMetadata {
pub fn from_ty<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> Self {
OffloadMetadata {
payload_size: get_payload_size(tcx, ty),
mode: MappingFlags::from_ty(tcx, ty),
}
}
}
// FIXME(Sa4dUs): implement a solid logic to determine the payload size
fn get_payload_size<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> u64 {
match ty.kind() {
ty::RawPtr(inner, _) | ty::Ref(_, inner, _) => get_payload_size(tcx, *inner),
_ => tcx
.layout_of(PseudoCanonicalInput {
typing_env: TypingEnv::fully_monomorphized(),
value: ty,
})
.unwrap()
.size
.bytes(),
}
}
impl MappingFlags {
fn from_ty<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> Self {
use rustc_ast::Mutability::*;
match ty.kind() {
ty::Bool
| ty::Char
| ty::Int(_)
| ty::Uint(_)
| ty::Float(_)
| ty::Adt(_, _)
| ty::Tuple(_)
| ty::Array(_, _)
| ty::Alias(_, _)
| ty::Param(_) => MappingFlags::TO,
ty::RawPtr(_, Not) | ty::Ref(_, _, Not) => MappingFlags::TO,
ty::RawPtr(_, Mut) | ty::Ref(_, _, Mut) => MappingFlags::TO | MappingFlags::FROM,
ty::Slice(_) | ty::Str | ty::Dynamic(_, _) => MappingFlags::TO | MappingFlags::FROM,
ty::Foreign(_) | ty::Pat(_, _) | ty::UnsafeBinder(_) => {
MappingFlags::TO | MappingFlags::FROM
}
ty::FnDef(_, _)
| ty::FnPtr(_, _)
| ty::Closure(_, _)
| ty::CoroutineClosure(_, _)
| ty::Coroutine(_, _)
| ty::CoroutineWitness(_, _)
| ty::Never
| ty::Bound(_, _)
| ty::Placeholder(_)
| ty::Infer(_)
| ty::Error(_) => {
tcx.dcx()
.span_err(rustc_span::DUMMY_SP, format!("type `{ty:?}` cannot be offloaded"));
MappingFlags::empty()
}
}
}
}
+1 -1
View File
@@ -334,7 +334,7 @@ mir_build_suggest_if_let = you might want to use `if let` to ignore the {$count
*[other] variants that aren't
} matched
mir_build_suggest_let_else = you might want to use `let else` to handle the {$count ->
mir_build_suggest_let_else = you might want to use `let...else` to handle the {$count ->
[one] variant that isn't
*[other] variants that aren't
} matched
+36 -10
View File
@@ -861,20 +861,46 @@ fn lint_and_remove_uninhabited(&mut self) {
}
}
/// Starting at a target unreachable block, find some user code to lint as unreachable
fn find_unreachable_code_from(
bb: BasicBlock,
bbs: &IndexVec<BasicBlock, BasicBlockData<'_>>,
) -> Option<(SourceInfo, &'static str)> {
let bb = &bbs[bb];
for stmt in &bb.statements {
match &stmt.kind {
// Ignore the implicit `()` return place assignment for unit functions/blocks
StatementKind::Assign(box (_, Rvalue::Use(Operand::Constant(const_))))
if const_.ty().is_unit() =>
{
continue;
}
StatementKind::StorageLive(_) | StatementKind::StorageDead(_) => {
continue;
}
StatementKind::FakeRead(..) => return Some((stmt.source_info, "definition")),
_ => return Some((stmt.source_info, "expression")),
}
}
let term = bb.terminator();
match term.kind {
// No user code in this bb, and our goto target may be reachable via other paths
TerminatorKind::Goto { .. } | TerminatorKind::Return => None,
_ => Some((term.source_info, "expression")),
}
}
for (target_bb, orig_ty, orig_span) in lints {
if orig_span.in_external_macro(self.tcx.sess.source_map()) {
continue;
}
let target_bb = &self.cfg.basic_blocks[target_bb];
let (target_loc, descr) = target_bb
.statements
.iter()
.find_map(|stmt| match stmt.kind {
StatementKind::StorageLive(_) | StatementKind::StorageDead(_) => None,
StatementKind::FakeRead(..) => Some((stmt.source_info, "definition")),
_ => Some((stmt.source_info, "expression")),
})
.unwrap_or_else(|| (target_bb.terminator().source_info, "expression"));
let Some((target_loc, descr)) =
find_unreachable_code_from(target_bb, &self.cfg.basic_blocks)
else {
continue;
};
let lint_root = self.source_scopes[target_loc.scope]
.local_data
.as_ref()
@@ -1,4 +1,7 @@
mir_transform_arithmetic_overflow = this arithmetic operation will overflow
mir_transform_asm_unwind_call = call to inline assembly that may unwind
mir_transform_const_defined_here = `const` item defined here
mir_transform_const_modify = attempting to modify a `const` item
+10 -53
View File
@@ -16,7 +16,7 @@
/// _d = move? _c
/// where each of the locals is only assigned once.
///
/// We want to replace all those locals by `_a`, either copied or moved.
/// We want to replace all those locals by `copy _a`.
pub(super) struct CopyProp;
impl<'tcx> crate::MirPass<'tcx> for CopyProp {
@@ -34,11 +34,13 @@ fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
debug!(copy_classes = ?ssa.copy_classes());
let mut any_replacement = false;
let mut storage_to_remove = DenseBitSet::new_empty(body.local_decls.len());
// Locals that participate in copy propagation either as a source or a destination.
let mut unified = DenseBitSet::new_empty(body.local_decls.len());
for (local, &head) in ssa.copy_classes().iter_enumerated() {
if local != head {
any_replacement = true;
storage_to_remove.insert(head);
unified.insert(head);
unified.insert(local);
}
}
@@ -46,11 +48,7 @@ fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
return;
}
let fully_moved = fully_moved_locals(&ssa, body);
debug!(?fully_moved);
Replacer { tcx, copy_classes: ssa.copy_classes(), fully_moved, storage_to_remove }
.visit_body_preserves_cfg(body);
Replacer { tcx, copy_classes: ssa.copy_classes(), unified }.visit_body_preserves_cfg(body);
crate::simplify::remove_unused_definitions(body);
}
@@ -60,44 +58,10 @@ fn is_required(&self) -> bool {
}
}
/// `SsaLocals` computed equivalence classes between locals considering copy/move assignments.
///
/// This function also returns whether all the `move?` in the pattern are `move` and not copies.
/// A local which is in the bitset can be replaced by `move _a`. Otherwise, it must be
/// replaced by `copy _a`, as we cannot move multiple times from `_a`.
///
/// If an operand copies `_c`, it must happen before the assignment `_d = _c`, otherwise it is UB.
/// This means that replacing it by a copy of `_a` if ok, since this copy happens before `_c` is
/// moved, and therefore that `_d` is moved.
#[instrument(level = "trace", skip(ssa, body))]
fn fully_moved_locals(ssa: &SsaLocals, body: &Body<'_>) -> DenseBitSet<Local> {
let mut fully_moved = DenseBitSet::new_filled(body.local_decls.len());
for (_, rvalue, _) in ssa.assignments(body) {
let Rvalue::Use(Operand::Copy(place) | Operand::Move(place)) = rvalue else {
continue;
};
let Some(rhs) = place.as_local() else { continue };
if !ssa.is_ssa(rhs) {
continue;
}
if let Rvalue::Use(Operand::Copy(_)) = rvalue {
fully_moved.remove(rhs);
}
}
ssa.meet_copy_equivalence(&mut fully_moved);
fully_moved
}
/// Utility to help performing substitution of `*pattern` by `target`.
struct Replacer<'a, 'tcx> {
tcx: TyCtxt<'tcx>,
fully_moved: DenseBitSet<Local>,
storage_to_remove: DenseBitSet<Local>,
unified: DenseBitSet<Local>,
copy_classes: &'a IndexSlice<Local, Local>,
}
@@ -108,13 +72,7 @@ fn tcx(&self) -> TyCtxt<'tcx> {
#[tracing::instrument(level = "trace", skip(self))]
fn visit_local(&mut self, local: &mut Local, ctxt: PlaceContext, _: Location) {
let new_local = self.copy_classes[*local];
match ctxt {
// Do not modify the local in storage statements.
PlaceContext::NonUse(NonUseContext::StorageLive | NonUseContext::StorageDead) => {}
// We access the value.
_ => *local = new_local,
}
*local = self.copy_classes[*local];
}
#[tracing::instrument(level = "trace", skip(self))]
@@ -123,7 +81,7 @@ fn visit_operand(&mut self, operand: &mut Operand<'tcx>, loc: Location) {
// A move out of a projection of a copy is equivalent to a copy of the original
// projection.
&& !place.is_indirect_first_projection()
&& !self.fully_moved.contains(place.local)
&& self.unified.contains(place.local)
{
*operand = Operand::Copy(place);
}
@@ -134,10 +92,9 @@ fn visit_operand(&mut self, operand: &mut Operand<'tcx>, loc: Location) {
fn visit_statement(&mut self, stmt: &mut Statement<'tcx>, loc: Location) {
// When removing storage statements, we need to remove both (#107511).
if let StatementKind::StorageLive(l) | StatementKind::StorageDead(l) = stmt.kind
&& self.storage_to_remove.contains(l)
&& self.unified.contains(l)
{
stmt.make_nop(true);
return;
}
self.super_statement(stmt, loc);
@@ -34,6 +34,14 @@ fn cross_crate_inlinable(tcx: TyCtxt<'_>, def_id: LocalDefId) -> bool {
return true;
}
// FIXME(autodiff): replace this as per discussion in https://github.com/rust-lang/rust/pull/149033#discussion_r2535465880
if tcx.has_attr(def_id, sym::autodiff_forward)
|| tcx.has_attr(def_id, sym::autodiff_reverse)
|| tcx.has_attr(def_id, sym::rustc_autodiff)
{
return true;
}
if tcx.has_attr(def_id, sym::rustc_intrinsic) {
// Intrinsic fallback bodies are always cross-crate inlineable.
// To ensure that the MIR inliner doesn't cluelessly try to inline fallback
@@ -511,19 +511,12 @@ fn move_paths_for_fields(
let tcx = self.tcx();
assert_eq!(self.elaborator.typing_env().typing_mode, ty::TypingMode::PostAnalysis);
let field_ty = match tcx.try_normalize_erasing_regions(
self.elaborator.typing_env(),
field.ty(tcx, args),
) {
Ok(t) => t,
Err(_) => Ty::new_error(
self.tcx(),
self.tcx().dcx().span_delayed_bug(
self.elaborator.body().span,
"Error normalizing in drop elaboration.",
),
),
};
let field_ty = field.ty(tcx, args);
// We silently leave an unnormalized type here to support polymorphic drop
// elaboration for users of rustc internal APIs
let field_ty = tcx
.try_normalize_erasing_regions(self.elaborator.typing_env(), field_ty)
.unwrap_or(field_ty);
(tcx.mk_place_field(base_place, field_idx, field_ty), subpath)
})
@@ -143,6 +143,13 @@ pub(crate) fn lint(&self) -> &'static Lint {
}
}
#[derive(LintDiagnostic)]
#[diag(mir_transform_asm_unwind_call)]
pub(crate) struct AsmUnwindCall {
#[label(mir_transform_asm_unwind_call)]
pub span: Span,
}
#[derive(LintDiagnostic)]
#[diag(mir_transform_ffi_unwind_call)]
pub(crate) struct FfiUnwindCall {
@@ -1,4 +1,5 @@
use rustc_abi::ExternAbi;
use rustc_ast::InlineAsmOptions;
use rustc_hir::def_id::{LOCAL_CRATE, LocalDefId};
use rustc_middle::mir::*;
use rustc_middle::query::{LocalCrate, Providers};
@@ -46,6 +47,34 @@ fn has_ffi_unwind_calls(tcx: TyCtxt<'_>, local_def_id: LocalDefId) -> bool {
continue;
}
let Some(terminator) = &block.terminator else { continue };
if let TerminatorKind::InlineAsm { options, .. } = &terminator.kind {
if options.contains(InlineAsmOptions::MAY_UNWIND) {
// We have detected an inline asm block that can possibly leak foreign unwind.
//
// Because the function body itself can unwind, we are not aborting this function call
// upon unwind, so this call can possibly leak foreign unwind into Rust code if the
// panic runtime linked is panic-abort.
let lint_root = body.source_scopes[terminator.source_info.scope]
.local_data
.as_ref()
.unwrap_crate_local()
.lint_root;
let span = terminator.source_info.span;
tcx.emit_node_span_lint(
FFI_UNWIND_CALLS,
lint_root,
span,
errors::AsmUnwindCall { span },
);
tainted = true;
}
continue;
}
let TerminatorKind::Call { func, .. } = &terminator.kind else { continue };
let ty = func.ty(body, tcx);
+23 -5
View File
@@ -570,9 +570,19 @@ fn eval_to_const_inner(&mut self, value: VnIndex) -> Option<OpTy<'tcx>> {
_ if ty.is_zst() => ImmTy::uninit(ty).into(),
Opaque(_) => return None,
// Do not bother evaluating repeat expressions. This would uselessly consume memory.
Repeat(..) => return None,
// In general, evaluating repeat expressions just consumes a lot of memory.
// But in the special case that the element is just Immediate::Uninit, we can evaluate
// it without extra memory! If we don't propagate uninit values like this, LLVM can get
// very confused: https://github.com/rust-lang/rust/issues/139355
Repeat(value, _count) => {
let value = self.eval_to_const(value)?;
if value.is_immediate_uninit() {
ImmTy::uninit(ty).into()
} else {
return None;
}
}
Constant { ref value, disambiguator: _ } => {
self.ecx.eval_mir_constant(value, DUMMY_SP, None).discard_err()?
}
@@ -608,8 +618,12 @@ fn eval_to_const_inner(&mut self, value: VnIndex) -> Option<OpTy<'tcx>> {
}
Union(active_field, field) => {
let field = self.eval_to_const(field)?;
if matches!(ty.backend_repr, BackendRepr::Scalar(..) | BackendRepr::ScalarPair(..))
{
if field.layout.layout.is_zst() {
ImmTy::from_immediate(Immediate::Uninit, ty).into()
} else if matches!(
ty.backend_repr,
BackendRepr::Scalar(..) | BackendRepr::ScalarPair(..)
) {
let dest = self.ecx.allocate(ty, MemoryKind::Stack).discard_err()?;
let field_dest = self.ecx.project_field(&dest, active_field).discard_err()?;
self.ecx.copy_op(field, &field_dest).discard_err()?;
@@ -1695,7 +1709,11 @@ fn op_to_prop_const<'tcx>(
// Do not synthetize too large constants. Codegen will just memcpy them, which we'd like to
// avoid.
if !matches!(op.layout.backend_repr, BackendRepr::Scalar(..) | BackendRepr::ScalarPair(..)) {
// But we *do* want to synthesize any size constant if it is entirely uninit because that
// benefits codegen, which has special handling for them.
if !op.is_immediate_uninit()
&& !matches!(op.layout.backend_repr, BackendRepr::Scalar(..) | BackendRepr::ScalarPair(..))
{
return None;
}
+51 -11
View File
@@ -45,6 +45,9 @@ struct Access {
/// When we encounter multiple statements at the same location, we only increase the liveness,
/// in order to avoid false positives.
live: bool,
/// Is this a direct access to the place itself, no projections, or to a field?
/// This helps distinguish `x = ...` from `x.field = ...`
is_direct: bool,
}
#[tracing::instrument(level = "debug", skip(tcx), ret)]
@@ -650,15 +653,17 @@ fn find_dead_assignments(
|place: Place<'tcx>, kind, source_info: SourceInfo, live: &DenseBitSet<PlaceIndex>| {
if let Some((index, extra_projections)) = checked_places.get(place.as_ref()) {
if !is_indirect(extra_projections) {
let is_direct = extra_projections.is_empty();
match assignments[index].entry(source_info) {
IndexEntry::Vacant(v) => {
let access = Access { kind, live: live.contains(index) };
let access = Access { kind, live: live.contains(index), is_direct };
v.insert(access);
}
IndexEntry::Occupied(mut o) => {
// There were already a sighting. Mark this statement as live if it
// was, to avoid false positives.
o.get_mut().live |= live.contains(index);
o.get_mut().is_direct &= is_direct;
}
}
}
@@ -742,7 +747,7 @@ fn find_dead_assignments(
continue;
};
let source_info = body.local_decls[place.local].source_info;
let access = Access { kind, live: live.contains(index) };
let access = Access { kind, live: live.contains(index), is_direct: true };
assignments[index].insert(source_info, access);
}
}
@@ -836,6 +841,33 @@ fn compute_dead_captures(&self, num_captures: usize) -> DenseBitSet<FieldIdx> {
dead_captures
}
/// Check if a local is referenced in any reachable basic block.
/// Variables in unreachable code (e.g., after `todo!()`) should not trigger unused warnings.
fn is_local_in_reachable_code(&self, local: Local) -> bool {
struct LocalVisitor {
target_local: Local,
found: bool,
}
impl<'tcx> Visitor<'tcx> for LocalVisitor {
fn visit_local(&mut self, local: Local, _context: PlaceContext, _location: Location) {
if local == self.target_local {
self.found = true;
}
}
}
let mut visitor = LocalVisitor { target_local: local, found: false };
for (bb, bb_data) in traversal::postorder(self.body) {
visitor.visit_basic_block_data(bb, bb_data);
if visitor.found {
return true;
}
}
false
}
/// Report fully unused locals, and forget the corresponding assignments.
fn report_fully_unused(&mut self) {
let tcx = self.tcx;
@@ -927,6 +959,10 @@ fn visit_const_operand(&mut self, constant: &ConstOperand<'tcx>, _: Location) {
let statements = &mut self.assignments[index];
if statements.is_empty() {
if !self.is_local_in_reachable_code(local) {
continue;
}
let sugg = if from_macro {
errors::UnusedVariableSugg::NoSugg { span: def_span, name }
} else {
@@ -976,8 +1012,10 @@ fn visit_const_operand(&mut self, constant: &ConstOperand<'tcx>, _: Location) {
self.checked_places,
self.body,
) {
statements.clear();
continue;
statements.retain(|_, access| access.is_direct);
if statements.is_empty() {
continue;
}
}
let typo = maybe_suggest_typo();
@@ -1048,26 +1086,28 @@ fn report_unused_assignments(self) {
let Some((name, decl_span)) = self.checked_places.names[index] else { continue };
// We have outstanding assignments and with non-trivial drop.
// This is probably a drop-guard, so we do not issue a warning there.
if maybe_drop_guard(
let is_maybe_drop_guard = maybe_drop_guard(
tcx,
self.typing_env,
index,
&self.ever_dropped,
self.checked_places,
self.body,
) {
continue;
}
);
// We probed MIR in reverse order for dataflow.
// We revert the vector to give a consistent order to the user.
for (source_info, Access { live, kind }) in statements.into_iter().rev() {
for (source_info, Access { live, kind, is_direct }) in statements.into_iter().rev() {
if live {
continue;
}
// If this place was dropped and has non-trivial drop,
// skip reporting field assignments.
if !is_direct && is_maybe_drop_guard {
continue;
}
// Report the dead assignment.
let Some(hir_id) = source_info.scope.lint_root(&self.body.source_scopes) else {
continue;
@@ -74,7 +74,7 @@ fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
}
// delete comparison statement if it the value being switched on was moved, which means
// it can not be user later on
// it can not be used later on
if opt.can_remove_bin_op_stmt {
bb.statements[opt.bin_op_stmt_idx].make_nop(true);
} else {
@@ -7,6 +7,8 @@
// mono so this does not interfere in `autodiff` intrinsics
// codegen process. If they are unused, LLVM will remove them when
// compiling with O3.
// FIXME(autodiff): Remove this whole file, as per discussion in
// https://github.com/rust-lang/rust/pull/149033#discussion_r2535465880
pub(crate) fn collect_autodiff_fn<'tcx>(
tcx: TyCtxt<'tcx>,
instance: ty::Instance<'tcx>,
@@ -74,6 +74,8 @@ fn probe_and_consider_implied_clause(
/// Consider a clause specifically for a `dyn Trait` self type. This requires
/// additionally checking all of the supertraits and object bounds to hold,
/// since they're not implied by the well-formedness of the object type.
/// `NormalizesTo` overrides this to not check the supertraits for backwards
/// compatibility with the old solver. cc trait-system-refactor-initiative#245.
fn probe_and_consider_object_bound_candidate(
ecx: &mut EvalCtxt<'_, D>,
source: CandidateSource<I>,
@@ -189,10 +189,11 @@ fn consider_error_guaranteed_candidate(
}
fn consider_auto_trait_candidate(
_ecx: &mut EvalCtxt<'_, D>,
ecx: &mut EvalCtxt<'_, D>,
_goal: Goal<I, Self>,
) -> Result<Candidate<I>, NoSolution> {
unreachable!("auto traits are never const")
ecx.cx().delay_bug("auto traits are never const");
Err(NoSolution)
}
fn consider_trait_alias_candidate(
@@ -184,6 +184,20 @@ fn match_assumption(
then(ecx)
}
// Hack for trait-system-refactor-initiative#245.
// FIXME(-Zhigher-ranked-assumptions): this impl differs from trait goals and we should unify
// them again once we properly support binders.
fn probe_and_consider_object_bound_candidate(
ecx: &mut EvalCtxt<'_, D>,
source: CandidateSource<I>,
goal: Goal<I, Self>,
assumption: I::Clause,
) -> Result<Candidate<I>, NoSolution> {
Self::probe_and_match_goal_against_assumption(ecx, source, goal, assumption, |ecx| {
ecx.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
})
}
fn consider_additional_alias_assumptions(
_ecx: &mut EvalCtxt<'_, D>,
_goal: Goal<I, Self>,
-2
View File
@@ -732,8 +732,6 @@ parse_or_in_let_chain = `||` operators are not supported in let chain conditions
parse_or_pattern_not_allowed_in_fn_parameters = function parameters require top-level or-patterns in parentheses
parse_or_pattern_not_allowed_in_let_binding = `let` bindings require top-level or-patterns in parentheses
parse_out_of_range_hex_escape = out of range hex escape
.label = must be a character in the range [\x00-\x7f]
parse_outer_attr_explanation = outer attributes, like `#[test]`, annotate the item following them
-6
View File
@@ -2455,12 +2455,6 @@ pub(crate) enum UnescapeError {
is_hex: bool,
ch: String,
},
#[diag(parse_out_of_range_hex_escape)]
OutOfRangeHexEscape(
#[primary_span]
#[label]
Span,
),
#[diag(parse_leading_underscore_unicode_escape)]
LeadingUnderscoreUnicodeEscape {
#[primary_span]
@@ -226,7 +226,24 @@ pub(crate) fn emit_unescape_error(
err.emit()
}
EscapeError::OutOfRangeHexEscape => {
dcx.emit_err(UnescapeError::OutOfRangeHexEscape(err_span))
let mut err = dcx.struct_span_err(err_span, "out of range hex escape");
err.span_label(err_span, "must be a character in the range [\\x00-\\x7f]");
let escape_str = &lit[range];
if lit.len() <= 4
&& escape_str.len() == 4
&& escape_str.starts_with("\\x")
&& let Ok(value) = u8::from_str_radix(&escape_str[2..4], 16)
&& matches!(mode, Mode::Char | Mode::Str)
{
err.help(format!("if you want to write a byte literal, use `b'{}'`", escape_str));
err.help(format!(
"if you want to write a Unicode character, use `'\\u{{{:X}}}'`",
value
));
}
err.emit()
}
EscapeError::LeadingUnderscoreUnicodeEscape => {
let (c, span) = last_char();
+1 -1
View File
@@ -466,7 +466,7 @@ fn expect_one_of(
// Public for rustfmt usage.
pub fn parse_ident(&mut self) -> PResult<'a, Ident> {
self.parse_ident_common(true)
self.parse_ident_common(self.may_recover())
}
fn parse_ident_common(&mut self, recover: bool) -> PResult<'a, Ident> {
+1 -1
View File
@@ -867,7 +867,7 @@ fn visit_expr(&mut self, node: &'a Expr) {
if let_else || !if_let {
err.span_suggestion_verbose(
block_span.shrink_to_lo(),
format!("{alternatively}you might have meant to use `let else`"),
format!("{alternatively}you might have meant to use `let...else`"),
"else ".to_string(),
if let_else {
Applicability::MachineApplicable
+8
View File
@@ -126,6 +126,14 @@ passes_doc_alias_not_string_literal =
passes_doc_alias_start_end =
{$attr_str} cannot start or end with ' '
passes_doc_attr_expects_no_value =
`doc({$attr_name})` does not accept a value
.suggestion = use `doc({$attr_name})`
passes_doc_attr_expects_string =
`doc({$attr_name})` expects a string value
.suggestion = use `doc({$attr_name} = "...")`
passes_doc_attr_not_crate_level =
`#![doc({$attr_name} = "...")]` isn't allowed as a crate-level attribute
+30 -2
View File
@@ -254,6 +254,7 @@ fn check_attributes(
| AttributeKind::RustcLayoutScalarValidRangeStart(..)
| AttributeKind::RustcLayoutScalarValidRangeEnd(..)
| AttributeKind::RustcSimdMonomorphizeLaneLimit(..)
| AttributeKind::RustcShouldNotBeCalledOnConstItems(..)
| AttributeKind::ExportStable
| AttributeKind::FfiConst(..)
| AttributeKind::UnstableFeatureBound(..)
@@ -1122,6 +1123,28 @@ fn check_attr_crate_level(
true
}
fn check_doc_attr_string_value(&self, meta: &MetaItemInner, hir_id: HirId) {
if meta.value_str().is_none() {
self.tcx.emit_node_span_lint(
INVALID_DOC_ATTRIBUTES,
hir_id,
meta.span(),
errors::DocAttrExpectsString { attr_name: meta.name().unwrap() },
);
}
}
fn check_doc_attr_no_value(&self, meta: &MetaItemInner, hir_id: HirId) {
if !meta.is_word() {
self.tcx.emit_node_span_lint(
INVALID_DOC_ATTRIBUTES,
hir_id,
meta.span(),
errors::DocAttrExpectsNoValue { attr_name: meta.name().unwrap() },
);
}
}
/// Checks that `doc(test(...))` attribute contains only valid attributes and are at the right place.
fn check_test_attr(
&self,
@@ -1292,10 +1315,15 @@ fn check_doc_attrs(
| sym::html_logo_url
| sym::html_playground_url
| sym::issue_tracker_base_url
| sym::html_root_url
| sym::html_no_source,
| sym::html_root_url,
) => {
self.check_attr_crate_level(attr_span, style, meta, hir_id);
self.check_doc_attr_string_value(meta, hir_id);
}
Some(sym::html_no_source) => {
self.check_attr_crate_level(attr_span, style, meta, hir_id);
self.check_doc_attr_no_value(meta, hir_id);
}
Some(sym::auto_cfg) => {
+12
View File
@@ -24,6 +24,18 @@
#[diag(passes_incorrect_do_not_recommend_args)]
pub(crate) struct DoNotRecommendDoesNotExpectArgs;
#[derive(LintDiagnostic)]
#[diag(passes_doc_attr_expects_string)]
pub(crate) struct DocAttrExpectsString {
pub(crate) attr_name: Symbol,
}
#[derive(LintDiagnostic)]
#[diag(passes_doc_attr_expects_no_value)]
pub(crate) struct DocAttrExpectsNoValue {
pub(crate) attr_name: Symbol,
}
#[derive(Diagnostic)]
#[diag(passes_autodiff_attr)]
pub(crate) struct AutoDiffAttr {
+6 -1
View File
@@ -13,10 +13,15 @@ rustc_session = { path = "../rustc_session" }
rustc_span = { path = "../rustc_span" }
rustc_target = { path = "../rustc_target" }
scoped-tls = "1.0"
serde = { version = "1.0.125", features = [ "derive" ] }
serde = { version = "1.0.125", features = ["derive"] }
tracing = "0.1"
# tidy-alphabetical-end
[dev-dependencies]
# tidy-alphabetical-start
serde_json = "1.0.142"
# tidy-alphabetical-end
[features]
# tidy-alphabetical-start
# Provides access to APIs that expose internals of the rust compiler.
+5 -13
View File
@@ -7,8 +7,8 @@
use crate::compiler_interface::with;
use crate::mir::FieldIdx;
use crate::target::{MachineInfo, MachineSize as Size};
use crate::ty::{Align, Ty, VariantIdx};
use crate::{Error, Opaque, error};
use crate::ty::{Align, Ty, VariantIdx, index_impl};
use crate::{Error, Opaque, ThreadLocalIndex, error};
/// A function ABI definition.
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize)]
@@ -109,8 +109,9 @@ pub fn is_1zst(&self) -> bool {
}
}
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize)]
pub struct Layout(usize);
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
pub struct Layout(usize, ThreadLocalIndex);
index_impl!(Layout);
impl Layout {
pub fn shape(self) -> LayoutShape {
@@ -118,15 +119,6 @@ pub fn shape(self) -> LayoutShape {
}
}
impl crate::IndexedVal for Layout {
fn to_val(index: usize) -> Self {
Layout(index)
}
fn to_index(&self) -> usize {
self.0
}
}
/// Describes how the fields of a type are shaped in memory.
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize)]
pub enum FieldsShape {
@@ -25,7 +25,7 @@
use crate::unstable::{RustcInternal, Stable, new_item_kind};
use crate::{
AssocItems, Crate, CrateDef, CrateItem, CrateItems, CrateNum, DefId, Error, Filename,
ImplTraitDecls, ItemKind, Symbol, TraitDecls, alloc, mir,
ImplTraitDecls, ItemKind, Symbol, ThreadLocalIndex, TraitDecls, alloc, mir,
};
pub struct BridgeTys;
@@ -835,6 +835,8 @@ pub(crate) fn associated_items(&self, def_id: DefId) -> AssocItems {
// A thread local variable that stores a pointer to [`CompilerInterface`].
scoped_tls::scoped_thread_local!(static TLV: Cell<*const ()>);
// remove this cfg when we have a stable driver.
#[cfg(feature = "rustc_internal")]
pub(crate) fn run<'tcx, F, T>(interface: &CompilerInterface<'tcx>, f: F) -> Result<T, Error>
where
F: FnOnce() -> T,
@@ -866,7 +868,7 @@ fn smir_crate<'tcx>(
) -> Crate {
let name = cx.crate_name(crate_num);
let is_local = cx.crate_is_local(crate_num);
let id = cx.crate_num_id(crate_num);
let id = CrateNum(cx.crate_num_id(crate_num), ThreadLocalIndex);
debug!(?name, ?crate_num, "smir_crate");
Crate { id, name, is_local }
}
+5 -6
View File
@@ -1,14 +1,13 @@
//! Module that define a common trait for things that represent a crate definition,
//! such as, a function, a trait, an enum, and any other definitions.
use serde::Serialize;
use crate::ty::{GenericArgs, Span, Ty};
use crate::{AssocItems, Crate, Symbol, with};
use crate::ty::{GenericArgs, Span, Ty, index_impl};
use crate::{AssocItems, Crate, Symbol, ThreadLocalIndex, with};
/// A unique identification number for each item accessible for the current compilation unit.
#[derive(Clone, Copy, PartialEq, Eq, Hash, Serialize)]
pub struct DefId(pub(crate) usize);
#[derive(Clone, Copy, PartialEq, Eq, Hash)]
pub struct DefId(pub(crate) usize, ThreadLocalIndex);
index_impl!(DefId);
impl DefId {
/// Return fully qualified name of this definition
+32 -12
View File
@@ -17,6 +17,7 @@
//! [crates.io](https://crates.io).
use std::fmt::Debug;
use std::marker::PhantomData;
use std::{fmt, io};
pub(crate) use rustc_public_bridge::IndexedVal;
@@ -33,7 +34,10 @@
pub use crate::error::*;
use crate::mir::mono::StaticDef;
use crate::mir::{Body, Mutability};
use crate::ty::{AssocItem, FnDef, ForeignModuleDef, ImplDef, ProvenanceMap, Span, TraitDef, Ty};
use crate::ty::{
AssocItem, FnDef, ForeignModuleDef, ImplDef, ProvenanceMap, Span, TraitDef, Ty,
serialize_index_impl,
};
use crate::unstable::Stable;
pub mod abi;
@@ -46,6 +50,8 @@
pub mod error;
pub mod mir;
pub mod target;
#[cfg(test)]
mod tests;
pub mod ty;
pub mod visitor;
@@ -53,7 +59,9 @@
pub type Symbol = String;
/// The number that identifies a crate.
pub type CrateNum = usize;
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
pub struct CrateNum(pub(crate) usize, ThreadLocalIndex);
serialize_index_impl!(CrateNum);
impl Debug for DefId {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
@@ -61,16 +69,6 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
}
}
impl IndexedVal for DefId {
fn to_val(index: usize) -> Self {
DefId(index)
}
fn to_index(&self) -> usize {
self.0
}
}
/// A list of crate items.
pub type CrateItems = Vec<CrateItem>;
@@ -297,3 +295,25 @@ fn new<'tcx>(
}
}
}
#[derive(Clone, Copy, Hash, PartialEq, Eq, Default)]
/// Marker type for indexes into thread local structures.
///
/// Makes things `!Send`/`!Sync`, so users don't move `rustc_public` types to
/// thread with no (or worse, different) `rustc_public` pointer.
///
/// Note. This doesn't make it impossible to confuse TLS. You could return a
/// `DefId` from one `run!` invocation, and then use it inside a different
/// `run!` invocation with different tables.
pub(crate) struct ThreadLocalIndex {
_phantom: PhantomData<*const ()>,
}
#[expect(non_upper_case_globals)]
/// Emulating unit struct `struct ThreadLocalIndex`;
pub(crate) const ThreadLocalIndex: ThreadLocalIndex = ThreadLocalIndex { _phantom: PhantomData };
impl fmt::Debug for ThreadLocalIndex {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_tuple("ThreadLocalIndex").finish()
}
}
+5 -13
View File
@@ -6,8 +6,8 @@
use crate::mir::mono::{Instance, StaticDef};
use crate::target::{Endian, MachineInfo};
use crate::ty::{Allocation, Binder, ExistentialTraitRef, Ty};
use crate::{Error, IndexedVal, with};
use crate::ty::{Allocation, Binder, ExistentialTraitRef, Ty, index_impl};
use crate::{Error, ThreadLocalIndex, with};
/// An allocation in the rustc_public's IR global memory can be either a function pointer,
/// a static, or a "real" allocation with some data in it.
@@ -47,17 +47,9 @@ pub fn vtable_allocation(&self) -> Option<AllocId> {
}
/// A unique identification number for each provenance
#[derive(Clone, Copy, PartialEq, Eq, Debug, Hash, Serialize)]
pub struct AllocId(usize);
impl IndexedVal for AllocId {
fn to_val(index: usize) -> Self {
AllocId(index)
}
fn to_index(&self) -> usize {
self.0
}
}
#[derive(Clone, Copy, PartialEq, Eq, Debug, Hash)]
pub struct AllocId(usize, ThreadLocalIndex);
index_impl!(AllocId);
/// Utility function used to read an allocation data into a unassigned integer.
pub(crate) fn read_target_uint(mut bytes: &[u8]) -> Result<u128, Error> {
+5 -13
View File
@@ -7,8 +7,8 @@
use crate::abi::FnAbi;
use crate::crate_def::CrateDef;
use crate::mir::Body;
use crate::ty::{Allocation, ClosureDef, ClosureKind, FnDef, GenericArgs, Ty};
use crate::{CrateItem, DefId, Error, IndexedVal, ItemKind, Opaque, Symbol, with};
use crate::ty::{Allocation, ClosureDef, ClosureKind, FnDef, GenericArgs, Ty, index_impl};
use crate::{CrateItem, DefId, Error, ItemKind, Opaque, Symbol, ThreadLocalIndex, with};
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize)]
pub enum MonoItem {
@@ -241,8 +241,9 @@ fn from(value: StaticDef) -> Self {
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize)]
pub struct InstanceDef(usize);
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub struct InstanceDef(usize, ThreadLocalIndex);
index_impl!(InstanceDef);
impl CrateDef for InstanceDef {
fn def_id(&self) -> DefId {
@@ -294,12 +295,3 @@ pub fn eval_initializer(&self) -> Result<Allocation, Error> {
with(|cx| cx.eval_static_initializer(*self))
}
}
impl IndexedVal for InstanceDef {
fn to_val(index: usize) -> Self {
InstanceDef(index)
}
fn to_index(&self) -> usize {
self.0
}
}

Some files were not shown because too many files have changed in this diff Show More