diff --git a/Cargo.lock b/Cargo.lock
index 54b1bf593e0a2..58d95f927bf95 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -131,9 +131,9 @@ dependencies = [
[[package]]
name = "annotate-snippets"
-version = "0.11.2"
+version = "0.11.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5a5a59f105fb9635e9eebdc1e29d53e764fa5795b9cf899a638a53e61567ef61"
+checksum = "086b0afab3b349e5691143adbfb26983821e3eec4ba4c51957104d372c2e1b7d"
dependencies = [
"anstyle",
"unicode-width",
@@ -189,9 +189,9 @@ dependencies = [
[[package]]
name = "anstyle-query"
-version = "1.0.3"
+version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a64c907d4e79225ac72e2a354c9ce84d50ebb4586dee56c82b3ee73004f537f5"
+checksum = "ad186efb764318d35165f1758e7dcef3b10628e26d41a44bc5550652e6804391"
dependencies = [
"windows-sys 0.52.0",
]
@@ -266,7 +266,7 @@ dependencies = [
"proc-macro2",
"quote",
"serde",
- "syn 2.0.64",
+ "syn 2.0.66",
]
[[package]]
@@ -501,9 +501,9 @@ version = "0.1.0"
[[package]]
name = "cc"
-version = "1.0.97"
+version = "1.0.99"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "099a5357d84c4c61eb35fc8eafa9a79a902c2f76911e5747ced4e032edd8d9b4"
+checksum = "96c51067fd44124faa7f870b4b1c969379ad32b2ba805aa959430ceaa384f695"
[[package]]
name = "cfg-if"
@@ -568,9 +568,9 @@ dependencies = [
[[package]]
name = "clap"
-version = "4.5.4"
+version = "4.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "90bc066a67923782aa8515dbaea16946c5bcc5addbd668bb80af688e53e548a0"
+checksum = "a9689a29b593160de5bc4aacab7b5d54fb52231de70122626c178e6a368994c7"
dependencies = [
"clap_builder",
"clap_derive",
@@ -588,9 +588,9 @@ dependencies = [
[[package]]
name = "clap_builder"
-version = "4.5.2"
+version = "4.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ae129e2e766ae0ec03484e609954119f123cc1fe650337e155d03b022f24f7b4"
+checksum = "2e5387378c84f6faa26890ebf9f0a92989f8873d4d380467bcd0d8d8620424df"
dependencies = [
"anstream",
"anstyle",
@@ -601,30 +601,30 @@ dependencies = [
[[package]]
name = "clap_complete"
-version = "4.5.2"
+version = "4.5.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dd79504325bf38b10165b02e89b4347300f855f273c4cb30c4a3209e6583275e"
+checksum = "d2020fa13af48afc65a9a87335bda648309ab3d154cd03c7ff95b378c7ed39c4"
dependencies = [
"clap",
]
[[package]]
name = "clap_derive"
-version = "4.5.4"
+version = "4.5.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "528131438037fd55894f62d6e9f068b8f45ac57ffa77517819645d10aed04f64"
+checksum = "c780290ccf4fb26629baa7a1081e68ced113f1d3ec302fa5948f1c381ebf06c6"
dependencies = [
"heck 0.5.0",
"proc-macro2",
"quote",
- "syn 2.0.64",
+ "syn 2.0.66",
]
[[package]]
name = "clap_lex"
-version = "0.7.0"
+version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce"
+checksum = "4b82cf0babdbd58558212896d1a4272303a57bdb245c2bf1147185fb45640e70"
[[package]]
name = "clippy"
@@ -644,7 +644,7 @@ dependencies = [
"regex",
"rustc_tools_util",
"serde",
- "syn 2.0.64",
+ "syn 2.0.66",
"tempfile",
"termize",
"tokio",
@@ -754,7 +754,7 @@ dependencies = [
"nom",
"proc-macro2",
"quote",
- "syn 2.0.64",
+ "syn 2.0.66",
]
[[package]]
@@ -878,18 +878,18 @@ dependencies = [
[[package]]
name = "crc32fast"
-version = "1.4.0"
+version = "1.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b3855a8a784b474f333699ef2bbca9db2c4a1f6d9088a90a2d25b1eb53111eaa"
+checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3"
dependencies = [
"cfg-if",
]
[[package]]
name = "crossbeam-channel"
-version = "0.5.12"
+version = "0.5.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ab3db02a9c5b5121e1e42fbdb1aeb65f5e02624cc58c43f2884c6ccac0b82f95"
+checksum = "33480d6946193aa8033910124896ca395333cae7e2d1113d1fef6c3272217df2"
dependencies = [
"crossbeam-utils",
]
@@ -915,9 +915,9 @@ dependencies = [
[[package]]
name = "crossbeam-utils"
-version = "0.8.19"
+version = "0.8.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345"
+checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80"
[[package]]
name = "crypto-common"
@@ -990,7 +990,7 @@ dependencies = [
"proc-macro2",
"quote",
"strsim",
- "syn 2.0.64",
+ "syn 2.0.66",
]
[[package]]
@@ -1001,7 +1001,7 @@ checksum = "733cabb43482b1a1b53eee8583c2b9e8684d592215ea83efd305dd31bc2f0178"
dependencies = [
"darling_core",
"quote",
- "syn 2.0.64",
+ "syn 2.0.66",
]
[[package]]
@@ -1027,7 +1027,7 @@ version = "0.1.80"
dependencies = [
"itertools 0.12.1",
"quote",
- "syn 2.0.64",
+ "syn 2.0.66",
]
[[package]]
@@ -1068,7 +1068,7 @@ dependencies = [
"darling",
"proc-macro2",
"quote",
- "syn 2.0.64",
+ "syn 2.0.66",
]
[[package]]
@@ -1078,7 +1078,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "206868b8242f27cecce124c19fd88157fbd0dd334df2587f36417bafbc85097b"
dependencies = [
"derive_builder_core",
- "syn 2.0.64",
+ "syn 2.0.66",
]
[[package]]
@@ -1101,7 +1101,7 @@ dependencies = [
"darling",
"proc-macro2",
"quote",
- "syn 2.0.64",
+ "syn 2.0.66",
]
[[package]]
@@ -1196,7 +1196,7 @@ checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.64",
+ "syn 2.0.66",
]
[[package]]
@@ -1516,7 +1516,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.64",
+ "syn 2.0.66",
]
[[package]]
@@ -1588,9 +1588,9 @@ dependencies = [
[[package]]
name = "getrandom"
-version = "0.2.14"
+version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "94b22e06ecb0110981051723910cbf0b5f5e09a2062dd7663334ee79a9d1286c"
+checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7"
dependencies = [
"cfg-if",
"libc",
@@ -1757,7 +1757,7 @@ dependencies = [
"markup5ever 0.12.1",
"proc-macro2",
"quote",
- "syn 2.0.64",
+ "syn 2.0.66",
]
[[package]]
@@ -1800,9 +1800,9 @@ dependencies = [
[[package]]
name = "icu_list"
-version = "1.4.0"
+version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fe6c04ec71ad1bacdbfb47164d4801f80a0533d9340f94f1a880f521eff59f54"
+checksum = "bbfeda1d7775b6548edd4e8b7562304a559a91ed56ab56e18961a053f367c365"
dependencies = [
"displaydoc",
"icu_list_data",
@@ -1814,15 +1814,15 @@ dependencies = [
[[package]]
name = "icu_list_data"
-version = "1.4.0"
+version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "42f6afcf7a9a7fedece70b7f17d7a7ecdfb8df145d37ae46d0277cd1e3932532"
+checksum = "e1825170d2c6679cb20dbd96a589d034e49f698aed9a2ef4fafc9a0101ed298f"
[[package]]
name = "icu_locid"
-version = "1.4.0"
+version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5c0aa2536adc14c07e2a521e95512b75ed8ef832f0fdf9299d4a0a45d2be2a9d"
+checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637"
dependencies = [
"displaydoc",
"litemap",
@@ -1833,9 +1833,9 @@ dependencies = [
[[package]]
name = "icu_locid_transform"
-version = "1.4.0"
+version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "57c17d8f6524fdca4471101dd71f0a132eb6382b5d6d7f2970441cb25f6f435a"
+checksum = "01d11ac35de8e40fdeda00d9e1e9d92525f3f9d887cdd7aa81d727596788b54e"
dependencies = [
"displaydoc",
"icu_locid",
@@ -1847,15 +1847,15 @@ dependencies = [
[[package]]
name = "icu_locid_transform_data"
-version = "1.4.0"
+version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "545c6c3e8bf9580e2dafee8de6f9ec14826aaf359787789c7724f1f85f47d3dc"
+checksum = "fdc8ff3388f852bede6b579ad4e978ab004f139284d7b28715f773507b946f6e"
[[package]]
name = "icu_provider"
-version = "1.4.0"
+version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ba58e782287eb6950247abbf11719f83f5d4e4a5c1f2cd490d30a334bc47c2f4"
+checksum = "6ed421c8a8ef78d3e2dbc98a973be2f3770cb42b606e3ab18d6237c4dfde68d9"
dependencies = [
"displaydoc",
"icu_locid",
@@ -1870,9 +1870,9 @@ dependencies = [
[[package]]
name = "icu_provider_adapters"
-version = "1.4.0"
+version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a229f978260da7c3aabb68cb7dc7316589936680570fe55e50fdd3f97711a4dd"
+checksum = "d6324dfd08348a8e0374a447ebd334044d766b1839bb8d5ccf2482a99a77c0bc"
dependencies = [
"icu_locid",
"icu_locid_transform",
@@ -1883,13 +1883,13 @@ dependencies = [
[[package]]
name = "icu_provider_macros"
-version = "1.4.0"
+version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d2abdd3a62551e8337af119c5899e600ca0c88ec8f23a46c60ba216c803dcf1a"
+checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.64",
+ "syn 2.0.66",
]
[[package]]
@@ -2196,9 +2196,9 @@ dependencies = [
[[package]]
name = "libz-sys"
-version = "1.1.16"
+version = "1.1.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5e143b5e666b2695d28f6bca6497720813f699c9602dd7f5cac91008b8ada7f9"
+checksum = "c15da26e5af7e25c90b37a2d75cdbf940cf4a55316de9d84c679c9b8bfabf82e"
dependencies = [
"cc",
"libc",
@@ -2252,9 +2252,9 @@ checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89"
[[package]]
name = "litemap"
-version = "0.7.2"
+version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f9d642685b028806386b2b6e75685faadd3eb65a85fff7df711ce18446a422da"
+checksum = "643cb0b8d4fcc284004d5fd0d67ccf61dfffadb7f75e1e71bc420f4688a3a704"
[[package]]
name = "lld-wrapper"
@@ -2415,7 +2415,7 @@ dependencies = [
"pulldown-cmark-to-cmark",
"serde_json",
"thiserror",
- "toml 0.8.13",
+ "toml 0.8.14",
"xmlparser",
]
@@ -2608,9 +2608,9 @@ dependencies = [
[[package]]
name = "nu-ansi-term"
-version = "0.49.0"
+version = "0.50.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c073d3c1930d0751774acf49e66653acecb416c3a54c6ec095a9b11caddb5a68"
+checksum = "dd2800e1520bdc966782168a627aa5d1ad92e33b984bf7c7615d31280c83ff14"
dependencies = [
"windows-sys 0.48.0",
]
@@ -2849,9 +2849,9 @@ dependencies = [
[[package]]
name = "parking_lot"
-version = "0.12.2"
+version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7e4af0ca4f6caed20e900d564c242b8e5d4903fdacf31d3daf527b66fe6f42fb"
+checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27"
dependencies = [
"lock_api",
"parking_lot_core",
@@ -2931,7 +2931,7 @@ dependencies = [
"pest_meta",
"proc-macro2",
"quote",
- "syn 2.0.64",
+ "syn 2.0.66",
]
[[package]]
@@ -3142,9 +3142,9 @@ checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068"
[[package]]
name = "proc-macro2"
-version = "1.0.82"
+version = "1.0.85"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8ad3d49ab951a01fbaafe34f2ec74122942fe18a3f9814c3268f1bb72042131b"
+checksum = "22244ce15aa966053a896d1accb3a6e68469b97c7f33f284b99f0d576879fc23"
dependencies = [
"unicode-ident",
]
@@ -3246,9 +3246,9 @@ dependencies = [
[[package]]
name = "r-efi"
-version = "4.4.0"
+version = "4.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c47196f636c4cc0634b73b0405323d177753c2e15e866952c64ea22902567a34"
+checksum = "e9e935efc5854715dfc0a4c9ef18dc69dee0ec3bf9cc3ab740db831c0fdd86a3"
dependencies = [
"compiler_builtins",
"rustc-std-workspace-core",
@@ -4058,7 +4058,7 @@ dependencies = [
"fluent-syntax",
"proc-macro2",
"quote",
- "syn 2.0.64",
+ "syn 2.0.66",
"unic-langid",
]
@@ -4192,7 +4192,7 @@ version = "0.0.0"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.64",
+ "syn 2.0.66",
"synstructure",
]
@@ -4341,7 +4341,7 @@ version = "0.0.0"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.64",
+ "syn 2.0.66",
"synstructure",
]
@@ -4920,7 +4920,7 @@ version = "0.0.0"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.64",
+ "syn 2.0.66",
"synstructure",
]
@@ -5018,7 +5018,7 @@ dependencies = [
"proc-macro2",
"quote",
"serde",
- "syn 2.0.64",
+ "syn 2.0.66",
]
[[package]]
@@ -5154,22 +5154,22 @@ dependencies = [
[[package]]
name = "serde"
-version = "1.0.202"
+version = "1.0.203"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "226b61a0d411b2ba5ff6d7f73a476ac4f8bb900373459cd00fab8512828ba395"
+checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
-version = "1.0.202"
+version = "1.0.203"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6048858004bcff69094cd972ed40a32500f153bd3be9f716b2eed2e8217c4838"
+checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.64",
+ "syn 2.0.66",
]
[[package]]
@@ -5281,9 +5281,9 @@ dependencies = [
[[package]]
name = "spanned"
-version = "0.2.0"
+version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ccdf4f5590b7e6fbd4f2e80d442789079a6fff7c12ef921a9de358b7b353098e"
+checksum = "ed14ba8b4b82241bd5daba2c49185d4a0581a0058355fe96537338f002b8605d"
dependencies = [
"bstr",
"color-eyre",
@@ -5463,9 +5463,9 @@ dependencies = [
[[package]]
name = "syn"
-version = "2.0.64"
+version = "2.0.66"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7ad3dee41f36859875573074334c200d1add8e4a87bb37113ebd31d926b7b11f"
+checksum = "c42f3f41a2de00b01c0aaad383c5a45241efc8b2d1eda5661812fda5f3cdcff5"
dependencies = [
"proc-macro2",
"quote",
@@ -5480,7 +5480,7 @@ checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.64",
+ "syn 2.0.66",
]
[[package]]
@@ -5540,9 +5540,9 @@ dependencies = [
[[package]]
name = "tar"
-version = "0.4.40"
+version = "0.4.41"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b16afcea1f22891c49a00c751c7b63b2233284064f11a200fc624137c51e2ddb"
+checksum = "cb797dad5fb5b76fcf519e702f4a589483b5ef06567f160c392832c1f5e44909"
dependencies = [
"filetime",
"libc",
@@ -5659,7 +5659,7 @@ checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.64",
+ "syn 2.0.66",
]
[[package]]
@@ -5744,9 +5744,9 @@ dependencies = [
[[package]]
name = "tinystr"
-version = "0.7.5"
+version = "0.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "83c02bf3c538ab32ba913408224323915f4ef9a6d61c0e85d493f355921c0ece"
+checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f"
dependencies = [
"displaydoc",
"zerovec",
@@ -5769,9 +5769,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]]
name = "tokio"
-version = "1.37.0"
+version = "1.38.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1adbebffeca75fcfd058afa480fb6c0b81e165a0323f9c9d39c9697e37c46787"
+checksum = "ba4f4a02a7a80d6f274636f0aa95c7e383b912d41fe721a31f29e29698585a4a"
dependencies = [
"backtrace",
"bytes",
@@ -5801,14 +5801,14 @@ dependencies = [
[[package]]
name = "toml"
-version = "0.8.13"
+version = "0.8.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a4e43f8cc456c9704c851ae29c67e17ef65d2c30017c17a9765b89c382dc8bba"
+checksum = "6f49eb2ab21d2f26bd6db7bf383edc527a7ebaee412d17af4d40fdccd442f335"
dependencies = [
"serde",
"serde_spanned",
"toml_datetime",
- "toml_edit 0.22.13",
+ "toml_edit 0.22.14",
]
[[package]]
@@ -5835,15 +5835,15 @@ dependencies = [
[[package]]
name = "toml_edit"
-version = "0.22.13"
+version = "0.22.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c127785850e8c20836d49732ae6abfa47616e60bf9d9f57c43c250361a9db96c"
+checksum = "f21c7aaf97f1bd9ca9d4f9e73b0a6c74bd5afef56f2bc931943a6e1c37e04e38"
dependencies = [
"indexmap",
"serde",
"serde_spanned",
"toml_datetime",
- "winnow 0.6.8",
+ "winnow 0.6.13",
]
[[package]]
@@ -5872,7 +5872,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.64",
+ "syn 2.0.66",
]
[[package]]
@@ -5927,11 +5927,11 @@ dependencies = [
[[package]]
name = "tracing-tree"
-version = "0.3.0"
+version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "65139ecd2c3f6484c3b99bc01c77afe21e95473630747c7aca525e78b0666675"
+checksum = "b56c62d2c80033cb36fae448730a2f2ef99410fe3ecbffc916681a32f6807dbe"
dependencies = [
- "nu-ansi-term 0.49.0",
+ "nu-ansi-term 0.50.0",
"tracing-core",
"tracing-log",
"tracing-subscriber",
@@ -6011,7 +6011,7 @@ version = "0.23.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "29e5f4ffcbab82453958fbf59990e981b8e8a177dcd60c2bd8f9b52c3036a6e1"
dependencies = [
- "annotate-snippets 0.11.2",
+ "annotate-snippets 0.11.3",
"anyhow",
"bstr",
"cargo-platform",
@@ -6072,7 +6072,7 @@ checksum = "1ed7f4237ba393424195053097c1516bd4590dc82b84f2f97c5c69e12704555b"
dependencies = [
"proc-macro-hack",
"quote",
- "syn 2.0.64",
+ "syn 2.0.66",
"unic-langid-impl",
]
@@ -6143,9 +6143,9 @@ checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202"
[[package]]
name = "unicode-width"
-version = "0.1.12"
+version = "0.1.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "68f5e5f3158ecfd4b8ff6fe086db7c8467a2dfdac97fe420f2b7c4aa97af66d6"
+checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d"
dependencies = [
"compiler_builtins",
"rustc-std-workspace-core",
@@ -6222,9 +6222,9 @@ checksum = "86bd8d4e895da8537e5315b8254664e6b769c4ff3db18321b297a1e7004392e3"
[[package]]
name = "utf8parse"
-version = "0.2.1"
+version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a"
+checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
[[package]]
name = "uuid"
@@ -6304,7 +6304,7 @@ dependencies = [
"once_cell",
"proc-macro2",
"quote",
- "syn 2.0.64",
+ "syn 2.0.66",
"wasm-bindgen-shared",
]
@@ -6326,7 +6326,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.64",
+ "syn 2.0.66",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
@@ -6407,7 +6407,7 @@ dependencies = [
"rayon",
"serde",
"serde_json",
- "syn 2.0.64",
+ "syn 2.0.66",
"windows-metadata",
]
@@ -6576,18 +6576,18 @@ dependencies = [
[[package]]
name = "winnow"
-version = "0.6.8"
+version = "0.6.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c3c52e9c97a68071b23e836c9380edae937f17b9c4667bd021973efc689f618d"
+checksum = "59b5e5f6c299a3c7890b876a2a587f3115162487e704907d9b6cd29473052ba1"
dependencies = [
"memchr",
]
[[package]]
name = "writeable"
-version = "0.5.4"
+version = "0.5.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dad7bb64b8ef9c0aa27b6da38b452b0ee9fd82beaf276a87dd796fb55cbae14e"
+checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51"
[[package]]
name = "xattr"
@@ -6635,9 +6635,9 @@ dependencies = [
[[package]]
name = "yoke"
-version = "0.7.3"
+version = "0.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "65e71b2e4f287f467794c671e2b8f8a5f3716b3c829079a1c44740148eff07e4"
+checksum = "6c5b1314b079b0930c31e3af543d8ee1757b1951ae1e1565ec704403a7240ca5"
dependencies = [
"serde",
"stable_deref_trait",
@@ -6647,13 +6647,13 @@ dependencies = [
[[package]]
name = "yoke-derive"
-version = "0.7.3"
+version = "0.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9e6936f0cce458098a201c245a11bef556c6a0181129c7034d10d76d1ec3a2b8"
+checksum = "28cc31741b18cb6f1d5ff12f5b7523e3d6eb0852bbbad19d73905511d9849b95"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.64",
+ "syn 2.0.66",
"synstructure",
]
@@ -6674,35 +6674,35 @@ checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.64",
+ "syn 2.0.66",
]
[[package]]
name = "zerofrom"
-version = "0.1.3"
+version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "655b0814c5c0b19ade497851070c640773304939a6c0fd5f5fb43da0696d05b7"
+checksum = "91ec111ce797d0e0784a1116d0ddcdbea84322cd79e5d5ad173daeba4f93ab55"
dependencies = [
"zerofrom-derive",
]
[[package]]
name = "zerofrom-derive"
-version = "0.1.3"
+version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e6a647510471d372f2e6c2e6b7219e44d8c574d24fdc11c610a61455782f18c3"
+checksum = "0ea7b4a3637ea8669cedf0f1fd5c286a17f3de97b8dd5a70a6c167a1730e63a5"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.64",
+ "syn 2.0.66",
"synstructure",
]
[[package]]
name = "zerovec"
-version = "0.10.1"
+version = "0.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "eff4439ae91fb5c72b8abc12f3f2dbf51bd27e6eadb9f8a5bc8898dddb0e27ea"
+checksum = "bb2cc8827d6c0994478a15c53f374f46fbd41bea663d809b14744bc42e6b109c"
dependencies = [
"yoke",
"zerofrom",
@@ -6711,11 +6711,11 @@ dependencies = [
[[package]]
name = "zerovec-derive"
-version = "0.10.1"
+version = "0.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7b4e5997cbf58990550ef1f0e5124a05e47e1ebd33a84af25739be6031a62c20"
+checksum = "97cf56601ee5052b4417d90c8755c6683473c926039908196cf35d99f893ebe7"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.64",
+ "syn 2.0.66",
]
diff --git a/RELEASES.md b/RELEASES.md
index 3080f03c7210b..c1311ab14c534 100644
--- a/RELEASES.md
+++ b/RELEASES.md
@@ -1,3 +1,131 @@
+Version 1.79.0 (2024-06-13)
+==========================
+
+
+
+Language
+--------
+- [Stabilize inline `const {}` expressions.](https://github.com/rust-lang/rust/pull/104087/)
+- [Prevent opaque types being instantiated twice with different regions within the same function.](https://github.com/rust-lang/rust/pull/116935/)
+- [Stabilize WebAssembly target features that are in phase 4 and 5.](https://github.com/rust-lang/rust/pull/117457/)
+- [Add the `redundant_lifetimes` lint to detect lifetimes which are semantically redundant.](https://github.com/rust-lang/rust/pull/118391/)
+- [Stabilize the `unnameable_types` lint for public types that can't be named.](https://github.com/rust-lang/rust/pull/120144/)
+- [Enable debuginfo in macros, and stabilize `-C collapse-macro-debuginfo` and `#[collapse_debuginfo]`.](https://github.com/rust-lang/rust/pull/120845/)
+- [Propagate temporary lifetime extension into `if` and `match` expressions.](https://github.com/rust-lang/rust/pull/121346/)
+- [Restrict promotion of `const fn` calls.](https://github.com/rust-lang/rust/pull/121557/)
+- [Warn against refining impls of crate-private traits with `refining_impl_trait` lint.](https://github.com/rust-lang/rust/pull/121720/)
+- [Stabilize associated type bounds (RFC 2289).](https://github.com/rust-lang/rust/pull/122055/)
+- [Stabilize importing `main` from other modules or crates.](https://github.com/rust-lang/rust/pull/122060/)
+- [Check return types of function types for well-formedness](https://github.com/rust-lang/rust/pull/115538)
+- [Rework `impl Trait` lifetime inference](https://github.com/rust-lang/rust/pull/116891/)
+- [Change inductive trait solver cycles to be ambiguous](https://github.com/rust-lang/rust/pull/122791)
+
+
+
+Compiler
+--------
+- [Define `-C strip` to only affect binaries, not artifacts like `.pdb`.](https://github.com/rust-lang/rust/pull/115120/)
+- [Stabilize `-Crelro-level` for controlling runtime link hardening.](https://github.com/rust-lang/rust/pull/121694/)
+- [Stabilize checking of `cfg` names and values at compile-time with `--check-cfg`.](https://github.com/rust-lang/rust/pull/123501/)
+ *Note that this only stabilizes the compiler part, the Cargo part is still unstable in this release.*
+- [Add `aarch64-apple-visionos` and `aarch64-apple-visionos-sim` tier 3 targets.](https://github.com/rust-lang/rust/pull/121419/)
+- [Add `riscv32ima-unknown-none-elf` tier 3 target.](https://github.com/rust-lang/rust/pull/122696/)
+- [Promote several Windows targets to tier 2](https://github.com/rust-lang/rust/pull/121712): `aarch64-pc-windows-gnullvm`, `i686-pc-windows-gnullvm`, and `x86_64-pc-windows-gnullvm`.
+
+Refer to Rust's [platform support page][platform-support-doc]
+for more information on Rust's tiered platform support.
+
+
+
+Libraries
+---------
+
+- [Implement `FromIterator` for `(impl Default + Extend, impl Default + Extend)`.](https://github.com/rust-lang/rust/pull/107462/)
+- [Implement `{Div,Rem}Assign>` on `X`.](https://github.com/rust-lang/rust/pull/121952/)
+- [Document overrides of `clone_from()` in core/std.](https://github.com/rust-lang/rust/pull/122201/)
+- [Link MSVC default lib in core.](https://github.com/rust-lang/rust/pull/122268/)
+- [Caution against using `transmute` between pointers and integers.](https://github.com/rust-lang/rust/pull/122379/)
+- [Enable frame pointers for the standard library.](https://github.com/rust-lang/rust/pull/122646/)
+
+
+
+Stabilized APIs
+---------------
+
+- [`{integer}::unchecked_add`](https://doc.rust-lang.org/stable/core/primitive.i32.html#method.unchecked_add)
+- [`{integer}::unchecked_mul`](https://doc.rust-lang.org/stable/core/primitive.i32.html#method.unchecked_mul)
+- [`{integer}::unchecked_sub`](https://doc.rust-lang.org/stable/core/primitive.i32.html#method.unchecked_sub)
+- [`<[T]>::split_at_unchecked`](https://doc.rust-lang.org/stable/core/primitive.slice.html#method.split_at_unchecked)
+- [`<[T]>::split_at_mut_unchecked`](https://doc.rust-lang.org/stable/core/primitive.slice.html#method.split_at_mut_unchecked)
+- [`<[u8]>::utf8_chunks`](https://doc.rust-lang.org/stable/core/primitive.slice.html#method.utf8_chunks)
+- [`str::Utf8Chunks`](https://doc.rust-lang.org/stable/core/str/struct.Utf8Chunks.html)
+- [`str::Utf8Chunk`](https://doc.rust-lang.org/stable/core/str/struct.Utf8Chunk.html)
+- [`<*const T>::is_aligned`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.is_aligned)
+- [`<*mut T>::is_aligned`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.is_aligned-1)
+- [`NonNull::is_aligned`](https://doc.rust-lang.org/stable/core/ptr/struct.NonNull.html#method.is_aligned)
+- [`<*const [T]>::len`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.len)
+- [`<*mut [T]>::len`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.len-1)
+- [`<*const [T]>::is_empty`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.is_empty)
+- [`<*mut [T]>::is_empty`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.is_empty-1)
+- [`NonNull::<[T]>::is_empty`](https://doc.rust-lang.org/stable/core/ptr/struct.NonNull.html#method.is_empty)
+- [`CStr::count_bytes`](https://doc.rust-lang.org/stable/core/ffi/c_str/struct.CStr.html#method.count_bytes)
+- [`io::Error::downcast`](https://doc.rust-lang.org/stable/std/io/struct.Error.html#method.downcast)
+- [`num::NonZero`](https://doc.rust-lang.org/stable/core/num/struct.NonZero.html)
+- [`path::absolute`](https://doc.rust-lang.org/stable/std/path/fn.absolute.html)
+- [`proc_macro::Literal::byte_character`](https://doc.rust-lang.org/stable/proc_macro/struct.Literal.html#method.byte_character)
+- [`proc_macro::Literal::c_string`](https://doc.rust-lang.org/stable/proc_macro/struct.Literal.html#method.c_string)
+
+These APIs are now stable in const contexts:
+
+- [`Atomic*::into_inner`](https://doc.rust-lang.org/stable/core/sync/atomic/struct.AtomicUsize.html#method.into_inner)
+- [`io::Cursor::new`](https://doc.rust-lang.org/stable/std/io/struct.Cursor.html#method.new)
+- [`io::Cursor::get_ref`](https://doc.rust-lang.org/stable/std/io/struct.Cursor.html#method.get_ref)
+- [`io::Cursor::position`](https://doc.rust-lang.org/stable/std/io/struct.Cursor.html#method.position)
+- [`io::empty`](https://doc.rust-lang.org/stable/std/io/fn.empty.html)
+- [`io::repeat`](https://doc.rust-lang.org/stable/std/io/fn.repeat.html)
+- [`io::sink`](https://doc.rust-lang.org/stable/std/io/fn.sink.html)
+- [`panic::Location::caller`](https://doc.rust-lang.org/stable/std/panic/struct.Location.html#method.caller)
+- [`panic::Location::file`](https://doc.rust-lang.org/stable/std/panic/struct.Location.html#method.file)
+- [`panic::Location::line`](https://doc.rust-lang.org/stable/std/panic/struct.Location.html#method.line)
+- [`panic::Location::column`](https://doc.rust-lang.org/stable/std/panic/struct.Location.html#method.column)
+
+
+
+Cargo
+-----
+
+- [Prevent dashes in `lib.name`, always normalizing to `_`.](https://github.com/rust-lang/cargo/pull/12783/)
+- [Stabilize MSRV-aware version requirement selection in `cargo add`.](https://github.com/rust-lang/cargo/pull/13608/)
+- [Switch to using `gitoxide` by default for listing files.](https://github.com/rust-lang/cargo/pull/13696/)
+- [Error on `[project]` in Edition 2024; `cargo fix --edition` will change it to `[package]`.](https://github.com/rust-lang/cargo/pull/13747/)
+
+
+
+Rustdoc
+-----
+
+- [Always display stability version even if it's the same as the containing item.](https://github.com/rust-lang/rust/pull/118441/)
+- [Show a single search result for items with multiple paths.](https://github.com/rust-lang/rust/pull/119912/)
+- [Support typing `/` in docs to begin a search.](https://github.com/rust-lang/rust/pull/123355/)
+
+
+
+Misc
+----
+
+
+
+Compatibility Notes
+-------------------
+
+- [Update the minimum external LLVM to 17.](https://github.com/rust-lang/rust/pull/122649/)
+- [`RustcEncodable` and `RustcDecodable` are soft-destabilized, to be removed
+ from the prelude in next edition.](https://github.com/rust-lang/rust/pull/116016/)
+- [The `wasm_c_abi` future-incompatibility lint will warn about use of the
+ non-spec-compliant C ABI.](https://github.com/rust-lang/rust/pull/117918/)
+ Use `wasm-bindgen v0.2.88` to generate forward-compatible bindings.
+- [Check return types of function types for well-formedness](https://github.com/rust-lang/rust/pull/115538)
+
Version 1.78.0 (2024-05-02)
==========================
diff --git a/compiler/rustc_codegen_cranelift/src/base.rs b/compiler/rustc_codegen_cranelift/src/base.rs
index 963e5de91cefe..6d26ca0b899b2 100644
--- a/compiler/rustc_codegen_cranelift/src/base.rs
+++ b/compiler/rustc_codegen_cranelift/src/base.rs
@@ -832,9 +832,10 @@ fn codegen_stmt<'tcx>(
let val = match null_op {
NullOp::SizeOf => layout.size.bytes(),
NullOp::AlignOf => layout.align.abi.bytes(),
- NullOp::OffsetOf(fields) => {
- layout.offset_of_subfield(fx, fields.iter()).bytes()
- }
+ NullOp::OffsetOf(fields) => fx
+ .tcx
+ .offset_of_subfield(ParamEnv::reveal_all(), layout, fields.iter())
+ .bytes(),
NullOp::UbChecks => {
let val = fx.tcx.sess.ub_checks();
let val = CValue::by_val(
diff --git a/compiler/rustc_codegen_llvm/src/intrinsic.rs b/compiler/rustc_codegen_llvm/src/intrinsic.rs
index 7b1038d561765..ad4e753fe9d77 100644
--- a/compiler/rustc_codegen_llvm/src/intrinsic.rs
+++ b/compiler/rustc_codegen_llvm/src/intrinsic.rs
@@ -1109,10 +1109,12 @@ fn generic_simd_intrinsic<'ll, 'tcx>(
tcx.normalize_erasing_late_bound_regions(ty::ParamEnv::reveal_all(), callee_ty.fn_sig(tcx));
let arg_tys = sig.inputs();
- // Vectors must be immediates (non-power-of-2 #[repr(packed)] are not)
- for (ty, arg) in arg_tys.iter().zip(args) {
- if ty.is_simd() && !matches!(arg.val, OperandValue::Immediate(_)) {
- return_error!(InvalidMonomorphization::SimdArgument { span, name, ty: *ty });
+ // Sanity-check: all vector arguments must be immediates.
+ if cfg!(debug_assertions) {
+ for (ty, arg) in arg_tys.iter().zip(args) {
+ if ty.is_simd() {
+ assert!(matches!(arg.val, OperandValue::Immediate(_)));
+ }
}
}
diff --git a/compiler/rustc_codegen_ssa/src/mir/rvalue.rs b/compiler/rustc_codegen_ssa/src/mir/rvalue.rs
index c23867be3a10d..ad6b3f1159dec 100644
--- a/compiler/rustc_codegen_ssa/src/mir/rvalue.rs
+++ b/compiler/rustc_codegen_ssa/src/mir/rvalue.rs
@@ -680,7 +680,10 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
bx.cx().const_usize(val)
}
mir::NullOp::OffsetOf(fields) => {
- let val = layout.offset_of_subfield(bx.cx(), fields.iter()).bytes();
+ let val = bx
+ .tcx()
+ .offset_of_subfield(bx.param_env(), layout, fields.iter())
+ .bytes();
bx.cx().const_usize(val)
}
mir::NullOp::UbChecks => {
diff --git a/compiler/rustc_const_eval/src/interpret/step.rs b/compiler/rustc_const_eval/src/interpret/step.rs
index d0bb821862aa2..1baf62baa816f 100644
--- a/compiler/rustc_const_eval/src/interpret/step.rs
+++ b/compiler/rustc_const_eval/src/interpret/step.rs
@@ -253,7 +253,10 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
Scalar::from_target_usize(val, self)
}
mir::NullOp::OffsetOf(fields) => {
- let val = layout.offset_of_subfield(self, fields.iter()).bytes();
+ let val = self
+ .tcx
+ .offset_of_subfield(self.param_env, layout, fields.iter())
+ .bytes();
Scalar::from_target_usize(val, self)
}
mir::NullOp::UbChecks => Scalar::from_bool(self.tcx.sess.ub_checks()),
diff --git a/compiler/rustc_feature/src/unstable.rs b/compiler/rustc_feature/src/unstable.rs
index d67422849d8a6..2410019868a19 100644
--- a/compiler/rustc_feature/src/unstable.rs
+++ b/compiler/rustc_feature/src/unstable.rs
@@ -559,6 +559,8 @@ declare_features! (
(unstable, offset_of_enum, "1.75.0", Some(120141)),
/// Allows using multiple nested field accesses in offset_of!
(unstable, offset_of_nested, "1.77.0", Some(120140)),
+ /// Allows using fields with slice type in offset_of!
+ (unstable, offset_of_slice, "CURRENT_RUSTC_VERSION", Some(126151)),
/// Allows using `#[optimize(X)]`.
(unstable, optimize_attribute, "1.34.0", Some(54882)),
/// Allows postfix match `expr.match { ... }`
diff --git a/compiler/rustc_hir_typeck/src/expr.rs b/compiler/rustc_hir_typeck/src/expr.rs
index d5d360ca0479f..5b27ebe3416ae 100644
--- a/compiler/rustc_hir_typeck/src/expr.rs
+++ b/compiler/rustc_hir_typeck/src/expr.rs
@@ -3363,7 +3363,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
let field_ty = self.field_ty(expr.span, field, args);
- // FIXME: DSTs with static alignment should be allowed
+ // Enums are anyway always sized. But just to safeguard against future
+ // language extensions, let's double-check.
self.require_type_is_sized(field_ty, expr.span, ObligationCauseCode::Misc);
if field.vis.is_accessible_from(sub_def_scope, self.tcx) {
@@ -3391,8 +3392,19 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
{
let field_ty = self.field_ty(expr.span, field, args);
- // FIXME: DSTs with static alignment should be allowed
- self.require_type_is_sized(field_ty, expr.span, ObligationCauseCode::Misc);
+ if self.tcx.features().offset_of_slice {
+ self.require_type_has_static_alignment(
+ field_ty,
+ expr.span,
+ ObligationCauseCode::Misc,
+ );
+ } else {
+ self.require_type_is_sized(
+ field_ty,
+ expr.span,
+ ObligationCauseCode::Misc,
+ );
+ }
if field.vis.is_accessible_from(def_scope, self.tcx) {
self.tcx.check_stability(field.did, Some(expr.hir_id), expr.span, None);
@@ -3412,10 +3424,21 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
if let Ok(index) = field.as_str().parse::()
&& field.name == sym::integer(index)
{
- for ty in tys.iter().take(index + 1) {
- self.require_type_is_sized(ty, expr.span, ObligationCauseCode::Misc);
- }
if let Some(&field_ty) = tys.get(index) {
+ if self.tcx.features().offset_of_slice {
+ self.require_type_has_static_alignment(
+ field_ty,
+ expr.span,
+ ObligationCauseCode::Misc,
+ );
+ } else {
+ self.require_type_is_sized(
+ field_ty,
+ expr.span,
+ ObligationCauseCode::Misc,
+ );
+ }
+
field_indices.push((FIRST_VARIANT, index.into()));
current_container = field_ty;
diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs
index 85c6d4dc12c55..e354e1ec59c63 100644
--- a/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs
+++ b/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs
@@ -386,6 +386,26 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
}
}
+ pub fn require_type_has_static_alignment(
+ &self,
+ ty: Ty<'tcx>,
+ span: Span,
+ code: traits::ObligationCauseCode<'tcx>,
+ ) {
+ if !ty.references_error() {
+ let tail =
+ self.tcx.struct_tail_with_normalize(ty, |ty| self.normalize(span, ty), || {});
+ // Sized types have static alignment, and so do slices.
+ if tail.is_trivially_sized(self.tcx) || matches!(tail.kind(), ty::Slice(..)) {
+ // Nothing else is required here.
+ } else {
+ // We can't be sure, let's required full `Sized`.
+ let lang_item = self.tcx.require_lang_item(LangItem::Sized, None);
+ self.require_type_meets(ty, span, code, lang_item);
+ }
+ }
+ }
+
pub fn register_bound(
&self,
ty: Ty<'tcx>,
diff --git a/compiler/rustc_middle/src/ty/layout.rs b/compiler/rustc_middle/src/ty/layout.rs
index 142872009bf21..56945bf6be4f8 100644
--- a/compiler/rustc_middle/src/ty/layout.rs
+++ b/compiler/rustc_middle/src/ty/layout.rs
@@ -1351,3 +1351,37 @@ pub trait FnAbiOf<'tcx>: FnAbiOfHelpers<'tcx> {
}
impl<'tcx, C: FnAbiOfHelpers<'tcx>> FnAbiOf<'tcx> for C {}
+
+impl<'tcx> TyCtxt<'tcx> {
+ pub fn offset_of_subfield(
+ self,
+ param_env: ty::ParamEnv<'tcx>,
+ mut layout: TyAndLayout<'tcx>,
+ indices: I,
+ ) -> Size
+ where
+ I: Iterator- ,
+ {
+ let cx = LayoutCx { tcx: self, param_env };
+ let mut offset = Size::ZERO;
+
+ for (variant, field) in indices {
+ layout = layout.for_variant(&cx, variant);
+ let index = field.index();
+ offset += layout.fields.offset(index);
+ layout = layout.field(&cx, index);
+ if !layout.is_sized() {
+ // If it is not sized, then the tail must still have at least a known static alignment.
+ let tail = self.struct_tail_erasing_lifetimes(layout.ty, param_env);
+ if !matches!(tail.kind(), ty::Slice(..)) {
+ bug!(
+ "offset of not-statically-aligned field (type {:?}) cannot be computed statically",
+ layout.ty
+ );
+ }
+ }
+ }
+
+ offset
+ }
+}
diff --git a/compiler/rustc_mir_transform/src/dataflow_const_prop.rs b/compiler/rustc_mir_transform/src/dataflow_const_prop.rs
index a8caead46f2f9..eba5d13d33f64 100644
--- a/compiler/rustc_mir_transform/src/dataflow_const_prop.rs
+++ b/compiler/rustc_mir_transform/src/dataflow_const_prop.rs
@@ -10,7 +10,7 @@ use rustc_middle::bug;
use rustc_middle::mir::interpret::{InterpResult, Scalar};
use rustc_middle::mir::visit::{MutVisitor, PlaceContext, Visitor};
use rustc_middle::mir::*;
-use rustc_middle::ty::layout::LayoutOf;
+use rustc_middle::ty::layout::{HasParamEnv, LayoutOf};
use rustc_middle::ty::{self, Ty, TyCtxt};
use rustc_mir_dataflow::value_analysis::{
Map, PlaceIndex, State, TrackElem, ValueAnalysis, ValueAnalysisWrapper, ValueOrPlace,
@@ -285,9 +285,11 @@ impl<'tcx> ValueAnalysis<'tcx> for ConstAnalysis<'_, 'tcx> {
let val = match null_op {
NullOp::SizeOf if layout.is_sized() => layout.size.bytes(),
NullOp::AlignOf if layout.is_sized() => layout.align.abi.bytes(),
- NullOp::OffsetOf(fields) => {
- layout.offset_of_subfield(&self.ecx, fields.iter()).bytes()
- }
+ NullOp::OffsetOf(fields) => self
+ .ecx
+ .tcx
+ .offset_of_subfield(self.ecx.param_env(), layout, fields.iter())
+ .bytes(),
_ => return ValueOrPlace::Value(FlatSet::Top),
};
FlatSet::Elem(Scalar::from_target_usize(val, &self.tcx))
diff --git a/compiler/rustc_mir_transform/src/gvn.rs b/compiler/rustc_mir_transform/src/gvn.rs
index acde16fcb7579..459d15b1cacc3 100644
--- a/compiler/rustc_mir_transform/src/gvn.rs
+++ b/compiler/rustc_mir_transform/src/gvn.rs
@@ -83,8 +83,8 @@
//! that contain `AllocId`s.
use rustc_const_eval::const_eval::DummyMachine;
-use rustc_const_eval::interpret::{intern_const_alloc_for_constprop, MemoryKind};
-use rustc_const_eval::interpret::{ImmTy, InterpCx, OpTy, Projectable, Scalar};
+use rustc_const_eval::interpret::{intern_const_alloc_for_constprop, MemPlaceMeta, MemoryKind};
+use rustc_const_eval::interpret::{ImmTy, Immediate, InterpCx, OpTy, Projectable, Scalar};
use rustc_data_structures::fx::FxIndexSet;
use rustc_data_structures::graph::dominators::Dominators;
use rustc_hir::def::DefKind;
@@ -95,11 +95,11 @@ use rustc_middle::bug;
use rustc_middle::mir::interpret::GlobalAlloc;
use rustc_middle::mir::visit::*;
use rustc_middle::mir::*;
-use rustc_middle::ty::layout::LayoutOf;
+use rustc_middle::ty::layout::{HasParamEnv, LayoutOf};
use rustc_middle::ty::{self, Ty, TyCtxt};
use rustc_span::def_id::DefId;
use rustc_span::DUMMY_SP;
-use rustc_target::abi::{self, Abi, Size, VariantIdx, FIRST_VARIANT};
+use rustc_target::abi::{self, Abi, FieldIdx, Size, VariantIdx, FIRST_VARIANT};
use smallvec::SmallVec;
use std::borrow::Cow;
@@ -177,6 +177,12 @@ enum AggregateTy<'tcx> {
Array,
Tuple,
Def(DefId, ty::GenericArgsRef<'tcx>),
+ RawPtr {
+ /// Needed for cast propagation.
+ data_pointer_ty: Ty<'tcx>,
+ /// The data pointer can be anything thin, so doesn't determine the output.
+ output_pointer_ty: Ty<'tcx>,
+ },
}
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
@@ -385,11 +391,22 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
AggregateTy::Def(def_id, args) => {
self.tcx.type_of(def_id).instantiate(self.tcx, args)
}
+ AggregateTy::RawPtr { output_pointer_ty, .. } => output_pointer_ty,
};
let variant = if ty.is_enum() { Some(variant) } else { None };
let ty = self.ecx.layout_of(ty).ok()?;
if ty.is_zst() {
ImmTy::uninit(ty).into()
+ } else if matches!(kind, AggregateTy::RawPtr { .. }) {
+ // Pointers don't have fields, so don't `project_field` them.
+ let data = self.ecx.read_pointer(fields[0]).ok()?;
+ let meta = if fields[1].layout.is_zst() {
+ MemPlaceMeta::None
+ } else {
+ MemPlaceMeta::Meta(self.ecx.read_scalar(fields[1]).ok()?)
+ };
+ let ptr_imm = Immediate::new_pointer_with_meta(data, meta, &self.ecx);
+ ImmTy::from_immediate(ptr_imm, ty).into()
} else if matches!(ty.abi, Abi::Scalar(..) | Abi::ScalarPair(..)) {
let dest = self.ecx.allocate(ty, MemoryKind::Stack).ok()?;
let variant_dest = if let Some(variant) = variant {
@@ -484,9 +501,11 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
let val = match null_op {
NullOp::SizeOf => layout.size.bytes(),
NullOp::AlignOf => layout.align.abi.bytes(),
- NullOp::OffsetOf(fields) => {
- layout.offset_of_subfield(&self.ecx, fields.iter()).bytes()
- }
+ NullOp::OffsetOf(fields) => self
+ .ecx
+ .tcx
+ .offset_of_subfield(self.ecx.param_env(), layout, fields.iter())
+ .bytes(),
NullOp::UbChecks => return None,
};
let usize_layout = self.ecx.layout_of(self.tcx.types.usize).unwrap();
@@ -862,10 +881,10 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
rvalue: &mut Rvalue<'tcx>,
location: Location,
) -> Option {
- let Rvalue::Aggregate(box ref kind, ref mut fields) = *rvalue else { bug!() };
+ let Rvalue::Aggregate(box ref kind, ref mut field_ops) = *rvalue else { bug!() };
let tcx = self.tcx;
- if fields.is_empty() {
+ if field_ops.is_empty() {
let is_zst = match *kind {
AggregateKind::Array(..)
| AggregateKind::Tuple
@@ -884,13 +903,13 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
}
}
- let (ty, variant_index) = match *kind {
+ let (mut ty, variant_index) = match *kind {
AggregateKind::Array(..) => {
- assert!(!fields.is_empty());
+ assert!(!field_ops.is_empty());
(AggregateTy::Array, FIRST_VARIANT)
}
AggregateKind::Tuple => {
- assert!(!fields.is_empty());
+ assert!(!field_ops.is_empty());
(AggregateTy::Tuple, FIRST_VARIANT)
}
AggregateKind::Closure(did, args)
@@ -901,15 +920,49 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
}
// Do not track unions.
AggregateKind::Adt(_, _, _, _, Some(_)) => return None,
- // FIXME: Do the extra work to GVN `from_raw_parts`
- AggregateKind::RawPtr(..) => return None,
+ AggregateKind::RawPtr(pointee_ty, mtbl) => {
+ assert_eq!(field_ops.len(), 2);
+ let data_pointer_ty = field_ops[FieldIdx::ZERO].ty(self.local_decls, self.tcx);
+ let output_pointer_ty = Ty::new_ptr(self.tcx, pointee_ty, mtbl);
+ (AggregateTy::RawPtr { data_pointer_ty, output_pointer_ty }, FIRST_VARIANT)
+ }
};
- let fields: Option> = fields
+ let fields: Option> = field_ops
.iter_mut()
.map(|op| self.simplify_operand(op, location).or_else(|| self.new_opaque()))
.collect();
- let fields = fields?;
+ let mut fields = fields?;
+
+ if let AggregateTy::RawPtr { data_pointer_ty, output_pointer_ty } = &mut ty {
+ let mut was_updated = false;
+
+ // Any thin pointer of matching mutability is fine as the data pointer.
+ while let Value::Cast {
+ kind: CastKind::PtrToPtr,
+ value: cast_value,
+ from: cast_from,
+ to: _,
+ } = self.get(fields[0])
+ && let ty::RawPtr(from_pointee_ty, from_mtbl) = cast_from.kind()
+ && let ty::RawPtr(_, output_mtbl) = output_pointer_ty.kind()
+ && from_mtbl == output_mtbl
+ && from_pointee_ty.is_sized(self.tcx, self.param_env)
+ {
+ fields[0] = *cast_value;
+ *data_pointer_ty = *cast_from;
+ was_updated = true;
+ }
+
+ if was_updated {
+ if let Some(const_) = self.try_as_constant(fields[0]) {
+ field_ops[FieldIdx::ZERO] = Operand::Constant(Box::new(const_));
+ } else if let Some(local) = self.try_as_local(fields[0], location) {
+ field_ops[FieldIdx::ZERO] = Operand::Copy(Place::from(local));
+ self.reused_locals.insert(local);
+ }
+ }
+ }
if let AggregateTy::Array = ty
&& fields.len() > 4
@@ -941,6 +994,9 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
(UnOp::Not, Value::BinaryOp(BinOp::Ne, lhs, rhs)) => {
Value::BinaryOp(BinOp::Eq, *lhs, *rhs)
}
+ (UnOp::PtrMetadata, Value::Aggregate(AggregateTy::RawPtr { .. }, _, fields)) => {
+ return Some(fields[1]);
+ }
_ => return None,
};
@@ -1092,6 +1148,23 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
return self.new_opaque();
}
+ let mut was_updated = false;
+
+ // If that cast just casts away the metadata again,
+ if let PtrToPtr = kind
+ && let Value::Aggregate(AggregateTy::RawPtr { data_pointer_ty, .. }, _, fields) =
+ self.get(value)
+ && let ty::RawPtr(to_pointee, _) = to.kind()
+ && to_pointee.is_sized(self.tcx, self.param_env)
+ {
+ from = *data_pointer_ty;
+ value = fields[0];
+ was_updated = true;
+ if *data_pointer_ty == to {
+ return Some(fields[0]);
+ }
+ }
+
if let PtrToPtr | PointerCoercion(MutToConstPointer) = kind
&& let Value::Cast { kind: inner_kind, value: inner_value, from: inner_from, to: _ } =
*self.get(value)
@@ -1100,9 +1173,13 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
from = inner_from;
value = inner_value;
*kind = PtrToPtr;
+ was_updated = true;
if inner_from == to {
return Some(inner_value);
}
+ }
+
+ if was_updated {
if let Some(const_) = self.try_as_constant(value) {
*operand = Operand::Constant(Box::new(const_));
} else if let Some(local) = self.try_as_local(value, location) {
diff --git a/compiler/rustc_mir_transform/src/known_panics_lint.rs b/compiler/rustc_mir_transform/src/known_panics_lint.rs
index 8b46658b3225e..47bbddbc31d49 100644
--- a/compiler/rustc_mir_transform/src/known_panics_lint.rs
+++ b/compiler/rustc_mir_transform/src/known_panics_lint.rs
@@ -625,9 +625,10 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
let val = match null_op {
NullOp::SizeOf => op_layout.size.bytes(),
NullOp::AlignOf => op_layout.align.abi.bytes(),
- NullOp::OffsetOf(fields) => {
- op_layout.offset_of_subfield(self, fields.iter()).bytes()
- }
+ NullOp::OffsetOf(fields) => self
+ .tcx
+ .offset_of_subfield(self.param_env, op_layout, fields.iter())
+ .bytes(),
NullOp::UbChecks => return None,
};
ImmTy::from_scalar(Scalar::from_target_usize(val, self), layout).into()
diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs
index 935942641677a..e245dfb9f5d77 100644
--- a/compiler/rustc_span/src/symbol.rs
+++ b/compiler/rustc_span/src/symbol.rs
@@ -1304,6 +1304,7 @@ symbols! {
offset_of,
offset_of_enum,
offset_of_nested,
+ offset_of_slice,
ok_or_else,
omit_gdb_pretty_printer_section,
on,
diff --git a/compiler/rustc_target/src/abi/mod.rs b/compiler/rustc_target/src/abi/mod.rs
index 666efd9deca28..737e9a8eab022 100644
--- a/compiler/rustc_target/src/abi/mod.rs
+++ b/compiler/rustc_target/src/abi/mod.rs
@@ -256,29 +256,6 @@ impl<'a, Ty> TyAndLayout<'a, Ty> {
Ty::is_transparent(self)
}
- pub fn offset_of_subfield(self, cx: &C, indices: I) -> Size
- where
- Ty: TyAbiInterface<'a, C>,
- I: Iterator
- ,
- {
- let mut layout = self;
- let mut offset = Size::ZERO;
-
- for (variant, field) in indices {
- layout = layout.for_variant(cx, variant);
- let index = field.index();
- offset += layout.fields.offset(index);
- layout = layout.field(cx, index);
- assert!(
- layout.is_sized(),
- "offset of unsized field (type {:?}) cannot be computed statically",
- layout.ty
- );
- }
-
- offset
- }
-
/// Finds the one field that is not a 1-ZST.
/// Returns `None` if there are multiple non-1-ZST fields or only 1-ZST-fields.
pub fn non_1zst_field(&self, cx: &C) -> Option<(usize, Self)>
diff --git a/library/core/src/num/f128.rs b/library/core/src/num/f128.rs
index 9362dc8765492..129f62fb43d1a 100644
--- a/library/core/src/num/f128.rs
+++ b/library/core/src/num/f128.rs
@@ -68,6 +68,13 @@ pub mod consts {
pub const FRAC_1_SQRT_PI: f128 =
0.564189583547756286948079451560772585844050629328998856844086_f128;
+ /// 1/sqrt(2π)
+ #[doc(alias = "FRAC_1_SQRT_TAU")]
+ #[unstable(feature = "f128", issue = "116909")]
+ // Also, #[unstable(feature = "more_float_constants", issue = "103883")]
+ pub const FRAC_1_SQRT_2PI: f128 =
+ 0.398942280401432677939946059934381868475858631164934657665926_f128;
+
/// 2/π
#[unstable(feature = "f128", issue = "116909")]
pub const FRAC_2_PI: f128 = 0.636619772367581343075535053490057448137838582961825794990669_f128;
diff --git a/library/core/src/num/f16.rs b/library/core/src/num/f16.rs
index c4d4584544bad..7a488cd6bf6fa 100644
--- a/library/core/src/num/f16.rs
+++ b/library/core/src/num/f16.rs
@@ -67,6 +67,12 @@ pub mod consts {
// Also, #[unstable(feature = "more_float_constants", issue = "103883")]
pub const FRAC_1_SQRT_PI: f16 = 0.564189583547756286948079451560772586_f16;
+ /// 1/sqrt(2π)
+ #[doc(alias = "FRAC_1_SQRT_TAU")]
+ #[unstable(feature = "f16", issue = "116909")]
+ // Also, #[unstable(feature = "more_float_constants", issue = "103883")]
+ pub const FRAC_1_SQRT_2PI: f16 = 0.398942280401432677939946059934381868_f16;
+
/// 2/π
#[unstable(feature = "f16", issue = "116909")]
pub const FRAC_2_PI: f16 = 0.636619772367581343075535053490057448_f16;
diff --git a/library/core/src/num/f32.rs b/library/core/src/num/f32.rs
index 22b24937cbce2..9d34d3da9e955 100644
--- a/library/core/src/num/f32.rs
+++ b/library/core/src/num/f32.rs
@@ -327,6 +327,11 @@ pub mod consts {
#[unstable(feature = "more_float_constants", issue = "103883")]
pub const FRAC_1_SQRT_PI: f32 = 0.564189583547756286948079451560772586_f32;
+ /// 1/sqrt(2π)
+ #[doc(alias = "FRAC_1_SQRT_TAU")]
+ #[unstable(feature = "more_float_constants", issue = "103883")]
+ pub const FRAC_1_SQRT_2PI: f32 = 0.398942280401432677939946059934381868_f32;
+
/// 2/π
#[stable(feature = "rust1", since = "1.0.0")]
pub const FRAC_2_PI: f32 = 0.636619772367581343075535053490057448_f32;
diff --git a/library/core/src/num/f64.rs b/library/core/src/num/f64.rs
index 34357d1b05ad5..95f021b2541ab 100644
--- a/library/core/src/num/f64.rs
+++ b/library/core/src/num/f64.rs
@@ -327,6 +327,11 @@ pub mod consts {
#[unstable(feature = "more_float_constants", issue = "103883")]
pub const FRAC_1_SQRT_PI: f64 = 0.564189583547756286948079451560772586_f64;
+ /// 1/sqrt(2π)
+ #[doc(alias = "FRAC_1_SQRT_TAU")]
+ #[unstable(feature = "more_float_constants", issue = "103883")]
+ pub const FRAC_1_SQRT_2PI: f64 = 0.398942280401432677939946059934381868_f64;
+
/// 2/π
#[stable(feature = "rust1", since = "1.0.0")]
pub const FRAC_2_PI: f64 = 0.636619772367581343075535053490057448_f64;
diff --git a/library/std/src/sys/pal/unix/os.rs b/library/std/src/sys/pal/unix/os.rs
index b5c7d30da7bc0..ae1e42c419b91 100644
--- a/library/std/src/sys/pal/unix/os.rs
+++ b/library/std/src/sys/pal/unix/os.rs
@@ -462,21 +462,21 @@ pub fn current_exe() -> io::Result {
#[cfg(target_os = "haiku")]
pub fn current_exe() -> io::Result {
+ let mut name = vec![0; libc::PATH_MAX as usize];
unsafe {
- let mut info: mem::MaybeUninit = mem::MaybeUninit::uninit();
- let mut cookie: i32 = 0;
- // the executable can be found at team id 0
- let result = libc::_get_next_image_info(
- 0,
- &mut cookie,
- info.as_mut_ptr(),
- mem::size_of::(),
+ let result = libc::find_path(
+ std::ptr::null_mut(),
+ libc::path_base_directory::B_FIND_PATH_IMAGE_PATH,
+ std::ptr::null_mut(),
+ name.as_mut_ptr(),
+ name.len(),
);
- if result != 0 {
+ if result != libc::B_OK {
use crate::io::ErrorKind;
Err(io::const_io_error!(ErrorKind::Uncategorized, "Error getting executable path"))
} else {
- let name = CStr::from_ptr((*info.as_ptr()).name.as_ptr()).to_bytes();
+ // find_path adds the null terminator.
+ let name = CStr::from_ptr(name.as_ptr()).to_bytes();
Ok(PathBuf::from(OsStr::from_bytes(name)))
}
}
diff --git a/library/std/src/sys/pal/unix/process/process_unix.rs b/library/std/src/sys/pal/unix/process/process_unix.rs
index e2fca8c7e63dc..72bda90a9ba71 100644
--- a/library/std/src/sys/pal/unix/process/process_unix.rs
+++ b/library/std/src/sys/pal/unix/process/process_unix.rs
@@ -1053,6 +1053,10 @@ fn signal_string(signal: i32) -> &'static str {
libc::SIGINFO => " (SIGINFO)",
#[cfg(target_os = "hurd")]
libc::SIGLOST => " (SIGLOST)",
+ #[cfg(target_os = "freebsd")]
+ libc::SIGTHR => " (SIGTHR)",
+ #[cfg(target_os = "freebsd")]
+ libc::SIGLIBRT => " (SIGLIBRT)",
_ => "",
}
}
diff --git a/library/std/src/sys/pal/windows/api.rs b/library/std/src/sys/pal/windows/api.rs
index 555ad581b8568..17a0e47ad5950 100644
--- a/library/std/src/sys/pal/windows/api.rs
+++ b/library/std/src/sys/pal/windows/api.rs
@@ -251,3 +251,39 @@ pub fn get_last_error() -> WinError {
pub struct WinError {
pub code: u32,
}
+impl WinError {
+ const fn new(code: u32) -> Self {
+ Self { code }
+ }
+}
+
+// Error code constants.
+// The constant names should be the same as the winapi constants except for the leading `ERROR_`.
+// Due to the sheer number of codes, error codes should only be added here on an as-needed basis.
+// However, they should never be removed as the assumption is they may be useful again in the future.
+#[allow(unused)]
+impl WinError {
+ /// Success is not an error.
+ /// Some Windows APIs do use this to distinguish between a zero return and an error return
+ /// but we should never return this to users as an error.
+ pub const SUCCESS: Self = Self::new(c::ERROR_SUCCESS);
+ // tidy-alphabetical-start
+ pub const ACCESS_DENIED: Self = Self::new(c::ERROR_ACCESS_DENIED);
+ pub const ALREADY_EXISTS: Self = Self::new(c::ERROR_ALREADY_EXISTS);
+ pub const CANT_ACCESS_FILE: Self = Self::new(c::ERROR_CANT_ACCESS_FILE);
+ pub const DELETE_PENDING: Self = Self::new(c::ERROR_DELETE_PENDING);
+ pub const DIRECTORY: Self = Self::new(c::ERROR_DIRECTORY);
+ pub const FILE_NOT_FOUND: Self = Self::new(c::ERROR_FILE_NOT_FOUND);
+ pub const INSUFFICIENT_BUFFER: Self = Self::new(c::ERROR_INSUFFICIENT_BUFFER);
+ pub const INVALID_FUNCTION: Self = Self::new(c::ERROR_INVALID_FUNCTION);
+ pub const INVALID_HANDLE: Self = Self::new(c::ERROR_INVALID_HANDLE);
+ pub const INVALID_PARAMETER: Self = Self::new(c::ERROR_INVALID_PARAMETER);
+ pub const NO_MORE_FILES: Self = Self::new(c::ERROR_NO_MORE_FILES);
+ pub const NOT_FOUND: Self = Self::new(c::ERROR_NOT_FOUND);
+ pub const NOT_SUPPORTED: Self = Self::new(c::ERROR_NOT_SUPPORTED);
+ pub const OPERATION_ABORTED: Self = Self::new(c::ERROR_OPERATION_ABORTED);
+ pub const PATH_NOT_FOUND: Self = Self::new(c::ERROR_PATH_NOT_FOUND);
+ pub const SHARING_VIOLATION: Self = Self::new(c::ERROR_SHARING_VIOLATION);
+ pub const TIMEOUT: Self = Self::new(c::ERROR_TIMEOUT);
+ // tidy-alphabetical-end
+}
diff --git a/library/std/src/sys/pal/windows/fs.rs b/library/std/src/sys/pal/windows/fs.rs
index e92c5e80eac9c..629ff114b5a88 100644
--- a/library/std/src/sys/pal/windows/fs.rs
+++ b/library/std/src/sys/pal/windows/fs.rs
@@ -18,7 +18,8 @@ use crate::sys::{c, cvt, Align8};
use crate::sys_common::{AsInner, FromInner, IntoInner};
use crate::thread;
-use super::{api, to_u16s, IoResult};
+use super::api::{self, WinError};
+use super::{to_u16s, IoResult};
use crate::sys::path::maybe_verbatim;
pub struct File {
@@ -130,10 +131,11 @@ impl Iterator for ReadDir {
let mut wfd = mem::zeroed();
loop {
if c::FindNextFileW(self.handle.0, &mut wfd) == 0 {
- if api::get_last_error().code == c::ERROR_NO_MORE_FILES {
- return None;
- } else {
- return Some(Err(Error::last_os_error()));
+ match api::get_last_error() {
+ WinError::NO_MORE_FILES => return None,
+ WinError { code } => {
+ return Some(Err(Error::from_raw_os_error(code as i32)));
+ }
}
}
if let Some(e) = DirEntry::new(&self.root, &wfd) {
@@ -244,8 +246,6 @@ impl OpenOptions {
}
fn get_access_mode(&self) -> io::Result {
- const ERROR_INVALID_PARAMETER: i32 = 87;
-
match (self.read, self.write, self.append, self.access_mode) {
(.., Some(mode)) => Ok(mode),
(true, false, false, None) => Ok(c::GENERIC_READ),
@@ -255,23 +255,23 @@ impl OpenOptions {
(true, _, true, None) => {
Ok(c::GENERIC_READ | (c::FILE_GENERIC_WRITE & !c::FILE_WRITE_DATA))
}
- (false, false, false, None) => Err(Error::from_raw_os_error(ERROR_INVALID_PARAMETER)),
+ (false, false, false, None) => {
+ Err(Error::from_raw_os_error(c::ERROR_INVALID_PARAMETER as i32))
+ }
}
}
fn get_creation_mode(&self) -> io::Result {
- const ERROR_INVALID_PARAMETER: i32 = 87;
-
match (self.write, self.append) {
(true, false) => {}
(false, false) => {
if self.truncate || self.create || self.create_new {
- return Err(Error::from_raw_os_error(ERROR_INVALID_PARAMETER));
+ return Err(Error::from_raw_os_error(c::ERROR_INVALID_PARAMETER as i32));
}
}
(_, true) => {
if self.truncate && !self.create_new {
- return Err(Error::from_raw_os_error(ERROR_INVALID_PARAMETER));
+ return Err(Error::from_raw_os_error(c::ERROR_INVALID_PARAMETER as i32));
}
}
}
@@ -315,7 +315,7 @@ impl File {
// Manual truncation. See #115745.
if opts.truncate
&& creation == c::OPEN_ALWAYS
- && unsafe { c::GetLastError() } == c::ERROR_ALREADY_EXISTS
+ && api::get_last_error() == WinError::ALREADY_EXISTS
{
unsafe {
// This originally used `FileAllocationInfo` instead of
@@ -845,7 +845,7 @@ fn open_link_no_reparse(parent: &File, name: &[u16], access: u32) -> io::Result<
// We make a special exception for `STATUS_DELETE_PENDING` because
// otherwise this will be mapped to `ERROR_ACCESS_DENIED` which is
// very unhelpful.
- Err(io::Error::from_raw_os_error(c::ERROR_DELETE_PENDING as _))
+ Err(io::Error::from_raw_os_error(c::ERROR_DELETE_PENDING as i32))
} else if status == c::STATUS_INVALID_PARAMETER
&& ATTRIBUTES.load(Ordering::Relaxed) == c::OBJ_DONT_REPARSE
{
@@ -1097,7 +1097,7 @@ pub fn readdir(p: &Path) -> io::Result {
//
// See issue #120040: https://github.com/rust-lang/rust/issues/120040.
let last_error = api::get_last_error();
- if last_error.code == c::ERROR_FILE_NOT_FOUND {
+ if last_error == WinError::FILE_NOT_FOUND {
return Ok(ReadDir {
handle: FindNextFileHandle(find_handle),
root: Arc::new(root),
diff --git a/library/std/src/sys/pal/windows/futex.rs b/library/std/src/sys/pal/windows/futex.rs
index bc19c402d9c12..08b7fe300dc3c 100644
--- a/library/std/src/sys/pal/windows/futex.rs
+++ b/library/std/src/sys/pal/windows/futex.rs
@@ -1,4 +1,4 @@
-use super::api;
+use super::api::{self, WinError};
use crate::sys::c;
use crate::sys::dur2timeout;
use core::ffi::c_void;
@@ -72,7 +72,7 @@ pub fn wake_by_address_all(address: &T) {
pub fn futex_wait(futex: &W::Atomic, expected: W, timeout: Option) -> bool {
// return false only on timeout
- wait_on_address(futex, expected, timeout) || api::get_last_error().code != c::ERROR_TIMEOUT
+ wait_on_address(futex, expected, timeout) || api::get_last_error() != WinError::TIMEOUT
}
pub fn futex_wake(futex: &T) -> bool {
diff --git a/library/std/src/sys/pal/windows/os.rs b/library/std/src/sys/pal/windows/os.rs
index 483b8b0072c8f..62199c16bfed3 100644
--- a/library/std/src/sys/pal/windows/os.rs
+++ b/library/std/src/sys/pal/windows/os.rs
@@ -17,7 +17,8 @@ use crate::ptr;
use crate::slice;
use crate::sys::{c, cvt};
-use super::{api, to_u16s};
+use super::api::{self, WinError};
+use super::to_u16s;
pub fn errno() -> i32 {
api::get_last_error().code as i32
@@ -333,7 +334,7 @@ fn home_dir_crt() -> Option {
buf,
&mut sz,
) {
- 0 if api::get_last_error().code != c::ERROR_INSUFFICIENT_BUFFER => 0,
+ 0 if api::get_last_error() != WinError::INSUFFICIENT_BUFFER => 0,
0 => sz,
_ => sz - 1, // sz includes the null terminator
}
@@ -358,7 +359,7 @@ fn home_dir_crt() -> Option {
super::fill_utf16_buf(
|buf, mut sz| {
match c::GetUserProfileDirectoryW(token, buf, &mut sz) {
- 0 if api::get_last_error().code != c::ERROR_INSUFFICIENT_BUFFER => 0,
+ 0 if api::get_last_error() != WinError::INSUFFICIENT_BUFFER => 0,
0 => sz,
_ => sz - 1, // sz includes the null terminator
}
diff --git a/library/std/src/sys/pal/windows/pipe.rs b/library/std/src/sys/pal/windows/pipe.rs
index dfa938d4d5769..67ef3ca82da02 100644
--- a/library/std/src/sys/pal/windows/pipe.rs
+++ b/library/std/src/sys/pal/windows/pipe.rs
@@ -12,6 +12,7 @@ use crate::sys::c;
use crate::sys::fs::{File, OpenOptions};
use crate::sys::handle::Handle;
use crate::sys::hashmap_random_keys;
+use crate::sys::pal::windows::api::{self, WinError};
use crate::sys_common::{FromInner, IntoInner};
////////////////////////////////////////////////////////////////////////////////
@@ -124,20 +125,19 @@ pub fn anon_pipe(ours_readable: bool, their_handle_inheritable: bool) -> io::Res
// testing strategy
// For more info, see https://github.com/rust-lang/rust/pull/37677.
if handle == c::INVALID_HANDLE_VALUE {
- let err = io::Error::last_os_error();
- let raw_os_err = err.raw_os_error();
+ let error = api::get_last_error();
if tries < 10 {
- if raw_os_err == Some(c::ERROR_ACCESS_DENIED as i32) {
+ if error == WinError::ACCESS_DENIED {
continue;
} else if reject_remote_clients_flag != 0
- && raw_os_err == Some(c::ERROR_INVALID_PARAMETER as i32)
+ && error == WinError::INVALID_PARAMETER
{
reject_remote_clients_flag = 0;
tries -= 1;
continue;
}
}
- return Err(err);
+ return Err(io::Error::from_raw_os_error(error.code as i32));
}
ours = Handle::from_raw_handle(handle);
break;
diff --git a/library/std/src/sys/pal/windows/process.rs b/library/std/src/sys/pal/windows/process.rs
index e4ab2ca7da1ce..2da986a1494ef 100644
--- a/library/std/src/sys/pal/windows/process.rs
+++ b/library/std/src/sys/pal/windows/process.rs
@@ -31,6 +31,8 @@ use crate::sys_common::IntoInner;
use core::ffi::c_void;
+use super::api::{self, WinError};
+
////////////////////////////////////////////////////////////////////////////////
// Command
////////////////////////////////////////////////////////////////////////////////
@@ -645,12 +647,12 @@ impl Process {
pub fn kill(&mut self) -> io::Result<()> {
let result = unsafe { c::TerminateProcess(self.handle.as_raw_handle(), 1) };
if result == c::FALSE {
- let error = unsafe { c::GetLastError() };
+ let error = api::get_last_error();
// TerminateProcess returns ERROR_ACCESS_DENIED if the process has already been
// terminated (by us, or for any other reason). So check if the process was actually
// terminated, and if so, do not return an error.
- if error != c::ERROR_ACCESS_DENIED || self.try_wait().is_err() {
- return Err(crate::io::Error::from_raw_os_error(error as i32));
+ if error != WinError::ACCESS_DENIED || self.try_wait().is_err() {
+ return Err(crate::io::Error::from_raw_os_error(error.code as i32));
}
}
Ok(())
diff --git a/library/std/src/sys/pal/windows/stdio.rs b/library/std/src/sys/pal/windows/stdio.rs
index 96c23f82aec2e..690b60d1decca 100644
--- a/library/std/src/sys/pal/windows/stdio.rs
+++ b/library/std/src/sys/pal/windows/stdio.rs
@@ -1,6 +1,6 @@
#![unstable(issue = "none", feature = "windows_stdio")]
-use super::api;
+use super::api::{self, WinError};
use crate::cmp;
use crate::io;
use crate::mem::MaybeUninit;
@@ -370,7 +370,7 @@ fn read_u16s(handle: c::HANDLE, buf: &mut [MaybeUninit]) -> io::Result Builder<'a> {
test::RustAnalyzer,
test::ErrorIndex,
test::Distcheck,
- test::RunMakeFullDeps,
test::Nomicon,
test::Reference,
test::RustdocBook,
@@ -1038,14 +1036,26 @@ impl<'a> Builder<'a> {
}
pub fn doc_rust_lang_org_channel(&self) -> String {
- let channel = match &*self.config.channel {
- "stable" => &self.version,
- "beta" => "beta",
- "nightly" | "dev" => "nightly",
- // custom build of rustdoc maybe? link to the latest stable docs just in case
- _ => "stable",
+ // When using precompiled compiler from CI, we need to use CI rustc's channel and
+ // ignore `rust.channel` from the configuration. Otherwise most of the rustdoc tests
+ // will fail due to incompatible `DOC_RUST_LANG_ORG_CHANNEL`.
+ let channel = if let Some(commit) = self.config.download_rustc_commit() {
+ self.config
+ .read_file_by_commit(&PathBuf::from("src/ci/channel"), commit)
+ .trim()
+ .to_owned()
+ } else {
+ match &*self.config.channel {
+ "stable" => &self.version,
+ "beta" => "beta",
+ "nightly" | "dev" => "nightly",
+ // custom build of rustdoc maybe? link to the latest stable docs just in case
+ _ => "stable",
+ }
+ .to_owned()
};
- "https://doc.rust-lang.org/".to_owned() + channel
+
+ format!("https://doc.rust-lang.org/{channel}")
}
fn run_step_descriptions(&self, v: &[StepDescription], paths: &[PathBuf]) {
diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs
index 17e37c1ecd238..36b44d0169c9c 100644
--- a/src/bootstrap/src/core/config/config.rs
+++ b/src/bootstrap/src/core/config/config.rs
@@ -1608,19 +1608,8 @@ impl Config {
set(&mut config.channel, channel);
config.download_rustc_commit = config.download_ci_rustc_commit(download_rustc);
- // This list is incomplete, please help by expanding it!
- if config.download_rustc_commit.is_some() {
- // We need the channel used by the downloaded compiler to match the one we set for rustdoc;
- // otherwise rustdoc-ui tests break.
- if config.channel != ci_channel
- && !(config.channel == "dev" && ci_channel == "nightly")
- {
- panic!(
- "setting rust.channel={} is incompatible with download-rustc",
- config.channel
- );
- }
- }
+
+ // FIXME: handle download-rustc incompatible options.
debug = debug_toml;
debug_assertions = debug_assertions_toml;
@@ -2134,17 +2123,29 @@ impl Config {
args
}
+ /// Returns the content of the given file at a specific commit.
+ pub(crate) fn read_file_by_commit(&self, file: &Path, commit: &str) -> String {
+ assert!(
+ self.rust_info.is_managed_git_subrepository(),
+ "`Config::read_file_by_commit` is not supported in non-git sources."
+ );
+
+ let mut git = self.git();
+ git.arg("show").arg(format!("{commit}:{}", file.to_str().unwrap()));
+ output(&mut git)
+ }
+
/// Bootstrap embeds a version number into the name of shared libraries it uploads in CI.
/// Return the version it would have used for the given commit.
pub(crate) fn artifact_version_part(&self, commit: &str) -> String {
let (channel, version) = if self.rust_info.is_managed_git_subrepository() {
- let mut channel = self.git();
- channel.arg("show").arg(format!("{commit}:src/ci/channel"));
- let channel = output(&mut channel);
- let mut version = self.git();
- version.arg("show").arg(format!("{commit}:src/version"));
- let version = output(&mut version);
- (channel.trim().to_owned(), version.trim().to_owned())
+ let channel = self
+ .read_file_by_commit(&PathBuf::from("src/ci/channel"), commit)
+ .trim()
+ .to_owned();
+ let version =
+ self.read_file_by_commit(&PathBuf::from("src/version"), commit).trim().to_owned();
+ (channel, version)
} else {
let channel = fs::read_to_string(self.src.join("src/ci/channel"));
let version = fs::read_to_string(self.src.join("src/version"));
diff --git a/src/ci/docker/README.md b/src/ci/docker/README.md
index 9af368ef44504..824c904e17f75 100644
--- a/src/ci/docker/README.md
+++ b/src/ci/docker/README.md
@@ -233,7 +233,7 @@ For targets: `aarch64-unknown-linux-gnu`
- Operating System > Linux kernel version = 4.1.49
- Binary utilities > Version of binutils = 2.29.1
- C-library > glibc version = 2.17 -- aarch64 support was introduced in this version
-- C compiler > gcc version = 8.5.0
+- C compiler > gcc version = 13.2.0
- C compiler > C++ = ENABLE -- to cross compile LLVM
### `i586-linux-gnu.defconfig`
diff --git a/src/ci/docker/host-x86_64/dist-aarch64-linux/aarch64-linux-gnu.defconfig b/src/ci/docker/host-x86_64/dist-aarch64-linux/aarch64-linux-gnu.defconfig
index 47e984ef85a21..520b1667c8be1 100644
--- a/src/ci/docker/host-x86_64/dist-aarch64-linux/aarch64-linux-gnu.defconfig
+++ b/src/ci/docker/host-x86_64/dist-aarch64-linux/aarch64-linux-gnu.defconfig
@@ -6,7 +6,5 @@ CT_ARCH_ARM=y
CT_ARCH_64=y
CT_KERNEL_LINUX=y
CT_LINUX_V_4_1=y
-CT_BINUTILS_V_2_29=y
CT_GLIBC_V_2_17=y
-CT_GCC_V_8=y
CT_CC_LANG_CXX=y
diff --git a/src/ci/docker/host-x86_64/test-various/uefi_qemu_test/Cargo.lock b/src/ci/docker/host-x86_64/test-various/uefi_qemu_test/Cargo.lock
index b0c17d9a296c8..dacf531e4048d 100644
--- a/src/ci/docker/host-x86_64/test-various/uefi_qemu_test/Cargo.lock
+++ b/src/ci/docker/host-x86_64/test-various/uefi_qemu_test/Cargo.lock
@@ -4,9 +4,9 @@ version = 3
[[package]]
name = "r-efi"
-version = "4.4.0"
+version = "4.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c47196f636c4cc0634b73b0405323d177753c2e15e866952c64ea22902567a34"
+checksum = "e9e935efc5854715dfc0a4c9ef18dc69dee0ec3bf9cc3ab740db831c0fdd86a3"
[[package]]
name = "uefi_qemu_test"
diff --git a/src/ci/docker/host-x86_64/x86_64-gnu-debug/Dockerfile b/src/ci/docker/host-x86_64/x86_64-gnu-debug/Dockerfile
index e4534d0f8408c..64a1fb093b49b 100644
--- a/src/ci/docker/host-x86_64/x86_64-gnu-debug/Dockerfile
+++ b/src/ci/docker/host-x86_64/x86_64-gnu-debug/Dockerfile
@@ -44,6 +44,14 @@ ENV RUST_CONFIGURE_ARGS \
--set target.x86_64-unknown-linux-gnu.cc=clang \
--set target.x86_64-unknown-linux-gnu.cxx=clang++
+# This job appears to be checking two separate things:
+# - That we can build the compiler with `--enable-debug`
+# (without necessarily testing the result).
+# - That the tests with `//@ needs-matching-clang` pass, since they
+# don't run by default unless RUSTBUILD_FORCE_CLANG_BASED_TESTS is set.
+# - FIXME(https://github.com/rust-lang/rust/pull/126155#issuecomment-2156314273):
+# Currently we only run the subset of tests with "clang" in their name.
+
ENV SCRIPT \
python3 ../x.py --stage 2 build && \
- python3 ../x.py --stage 2 test tests/run-make-fulldeps --test-args clang
+ python3 ../x.py --stage 2 test tests/run-make --test-args clang
diff --git a/src/ci/docker/scripts/x86_64-gnu-llvm.sh b/src/ci/docker/scripts/x86_64-gnu-llvm.sh
index 876b300d35c6b..b3921f114217d 100755
--- a/src/ci/docker/scripts/x86_64-gnu-llvm.sh
+++ b/src/ci/docker/scripts/x86_64-gnu-llvm.sh
@@ -4,13 +4,7 @@ set -ex
# Only run the stage 1 tests on merges, not on PR CI jobs.
if [[ -z "${PR_CI_JOB}" ]]; then
- # When running gcc backend tests, we need to install `libgccjit` and to not run llvm codegen
- # tests as it will fail them.
- if [[ "${ENABLE_GCC_CODEGEN}" == "1" ]]; then
- ../x.py --stage 1 test --skip src/tools/tidy --skip tests/codegen
- else
- ../x.py --stage 1 test --skip src/tools/tidy
- fi
+ ../x.py --stage 1 test --skip src/tools/tidy
# Run the `mir-opt` tests again but this time for a 32-bit target.
# This enforces that tests using `// EMIT_MIR_FOR_EACH_BIT_WIDTH` have
@@ -29,14 +23,8 @@ if [[ -z "${PR_CI_JOB}" ]]; then
--rustc-args "--cfg feature=\"optimize_for_size\""
fi
-# When running gcc backend tests, we need to install `libgccjit` and to not run llvm codegen
-# tests as it will fail them.
# NOTE: intentionally uses all of `x.py`, `x`, and `x.ps1` to make sure they all work on Linux.
-if [[ "${ENABLE_GCC_CODEGEN}" == "1" ]]; then
- ../x.py --stage 2 test --skip src/tools/tidy --skip tests/codegen
-else
- ../x.py --stage 2 test --skip src/tools/tidy
-fi
+../x.py --stage 2 test --skip src/tools/tidy
# Run the `mir-opt` tests again but this time for a 32-bit target.
# This enforces that tests using `// EMIT_MIR_FOR_EACH_BIT_WIDTH` have
diff --git a/src/ci/github-actions/jobs.yml b/src/ci/github-actions/jobs.yml
index 8c84e721f5de5..48c39d2c33e56 100644
--- a/src/ci/github-actions/jobs.yml
+++ b/src/ci/github-actions/jobs.yml
@@ -37,7 +37,7 @@ runners:
envs:
env-x86_64-apple-tests: &env-x86_64-apple-tests
- SCRIPT: ./x.py --stage 2 test --skip tests/ui --skip tests/rustdoc --skip tests/run-make-fulldeps
+ SCRIPT: ./x.py --stage 2 test --skip tests/ui --skip tests/rustdoc
RUST_CONFIGURE_ARGS: --build=x86_64-apple-darwin --enable-sanitizers --enable-profiler --set rust.jemalloc
RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
MACOSX_DEPLOYMENT_TARGET: 10.12
@@ -294,7 +294,7 @@ auto:
- image: x86_64-apple-2
env:
- SCRIPT: ./x.py --stage 2 test tests/ui tests/rustdoc tests/run-make-fulldeps
+ SCRIPT: ./x.py --stage 2 test tests/ui tests/rustdoc
<<: *env-x86_64-apple-tests
<<: *job-macos-xl
diff --git a/src/doc/rustc/src/platform-support/nto-qnx.md b/src/doc/rustc/src/platform-support/nto-qnx.md
index 56070c2ec34e3..51a397a38d209 100644
--- a/src/doc/rustc/src/platform-support/nto-qnx.md
+++ b/src/doc/rustc/src/platform-support/nto-qnx.md
@@ -160,8 +160,7 @@ export exclude_tests='
--exclude src/tools/linkchecker
--exclude tests/ui-fulldeps
--exclude rustc
- --exclude rustdoc
- --exclude tests/run-make-fulldeps'
+ --exclude rustdoc'
env $build_env \
./x.py test \
diff --git a/src/librustdoc/config.rs b/src/librustdoc/config.rs
index 012afada1e5ee..78d4129f6422c 100644
--- a/src/librustdoc/config.rs
+++ b/src/librustdoc/config.rs
@@ -128,6 +128,8 @@ pub(crate) struct Options {
pub(crate) enable_per_target_ignores: bool,
/// Do not run doctests, compile them if should_test is active.
pub(crate) no_run: bool,
+ /// What sources are being mapped.
+ pub(crate) remap_path_prefix: Vec<(PathBuf, PathBuf)>,
/// The path to a rustc-like binary to build tests with. If not set, we
/// default to loading from `$sysroot/bin/rustc`.
@@ -211,6 +213,7 @@ impl fmt::Debug for Options {
.field("run_check", &self.run_check)
.field("no_run", &self.no_run)
.field("test_builder_wrappers", &self.test_builder_wrappers)
+ .field("remap-file-prefix", &self.remap_path_prefix)
.field("nocapture", &self.nocapture)
.field("scrape_examples_options", &self.scrape_examples_options)
.field("unstable_features", &self.unstable_features)
@@ -372,6 +375,13 @@ impl Options {
let codegen_options = CodegenOptions::build(early_dcx, matches);
let unstable_opts = UnstableOptions::build(early_dcx, matches);
+ let remap_path_prefix = match parse_remap_path_prefix(&matches) {
+ Ok(prefix_mappings) => prefix_mappings,
+ Err(err) => {
+ early_dcx.early_fatal(err);
+ }
+ };
+
let dcx = new_dcx(error_format, None, diagnostic_width, &unstable_opts);
// check for deprecated options
@@ -772,6 +782,7 @@ impl Options {
run_check,
no_run,
test_builder_wrappers,
+ remap_path_prefix,
nocapture,
crate_name,
output_format,
@@ -820,6 +831,21 @@ impl Options {
}
}
+fn parse_remap_path_prefix(
+ matches: &getopts::Matches,
+) -> Result, &'static str> {
+ matches
+ .opt_strs("remap-path-prefix")
+ .into_iter()
+ .map(|remap| {
+ remap
+ .rsplit_once('=')
+ .ok_or("--remap-path-prefix must contain '=' between FROM and TO")
+ .map(|(from, to)| (PathBuf::from(from), PathBuf::from(to)))
+ })
+ .collect()
+}
+
/// Prints deprecation warnings for deprecated options
fn check_deprecated_options(matches: &getopts::Matches, dcx: &rustc_errors::DiagCtxt) {
let deprecated_flags = [];
diff --git a/src/librustdoc/doctest.rs b/src/librustdoc/doctest.rs
index a732e645b6baa..81a7463decadc 100644
--- a/src/librustdoc/doctest.rs
+++ b/src/librustdoc/doctest.rs
@@ -129,6 +129,7 @@ pub(crate) fn run(
edition: options.edition,
target_triple: options.target.clone(),
crate_name: options.crate_name.clone(),
+ remap_path_prefix: options.remap_path_prefix.clone(),
..config::Options::default()
};
@@ -572,7 +573,6 @@ fn make_maybe_absolute_path(path: PathBuf) -> PathBuf {
std::env::current_dir().map(|c| c.join(&path)).unwrap_or_else(|_| path)
}
}
-
struct IndividualTestOptions {
outdir: DirState,
test_id: String,
@@ -651,7 +651,7 @@ impl CreateRunnableDoctests {
if !item_path.is_empty() {
item_path.push(' ');
}
- format!("{} - {item_path}(line {line})", filename.prefer_local())
+ format!("{} - {item_path}(line {line})", filename.prefer_remapped_unconditionaly())
}
fn add_test(&mut self, test: ScrapedDoctest) {
diff --git a/src/librustdoc/doctest/rust.rs b/src/librustdoc/doctest/rust.rs
index e6bef395fa9ce..fc8e119ccc232 100644
--- a/src/librustdoc/doctest/rust.rs
+++ b/src/librustdoc/doctest/rust.rs
@@ -27,11 +27,13 @@ struct RustCollector {
impl RustCollector {
fn get_filename(&self) -> FileName {
let filename = self.source_map.span_to_filename(self.position);
- if let FileName::Real(ref filename) = filename
- && let Ok(cur_dir) = env::current_dir()
- && let Some(local_path) = filename.local_path()
- && let Ok(path) = local_path.strip_prefix(&cur_dir)
- {
+ if let FileName::Real(ref filename) = filename {
+ let path = filename.remapped_path_if_available();
+ // Strip the cwd prefix from the path. This will likely exist if
+ // the path was not remapped.
+ let path = env::current_dir()
+ .map(|cur_dir| path.strip_prefix(&cur_dir).unwrap_or(path))
+ .unwrap_or(path);
return path.to_owned().into();
}
filename
diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs
index 3b6bddf263a9f..d6e715d48ea5a 100644
--- a/src/librustdoc/lib.rs
+++ b/src/librustdoc/lib.rs
@@ -555,6 +555,14 @@ fn opts() -> Vec {
unstable("no-run", |o| {
o.optflagmulti("", "no-run", "Compile doctests without running them")
}),
+ unstable("remap-path-prefix", |o| {
+ o.optmulti(
+ "",
+ "remap-path-prefix",
+ "Remap source names in compiler messages",
+ "FROM=TO",
+ )
+ }),
unstable("show-type-layout", |o| {
o.optflagmulti("", "show-type-layout", "Include the memory layout of types in the docs")
}),
diff --git a/src/tools/build_helper/README.md b/src/tools/build_helper/README.md
new file mode 100644
index 0000000000000..f81b631c3fdbf
--- /dev/null
+++ b/src/tools/build_helper/README.md
@@ -0,0 +1 @@
+Types and functions shared across tools in this workspace.
diff --git a/src/tools/build_helper/src/lib.rs b/src/tools/build_helper/src/lib.rs
index 2abda5d3ebf27..15807d1c0d8f8 100644
--- a/src/tools/build_helper/src/lib.rs
+++ b/src/tools/build_helper/src/lib.rs
@@ -1,5 +1,30 @@
+//! Types and functions shared across tools in this workspace.
+
pub mod ci;
pub mod git;
pub mod metrics;
pub mod stage0_parser;
pub mod util;
+
+/// The default set of crates for opt-dist to collect LLVM profiles.
+pub const LLVM_PGO_CRATES: &[&str] = &[
+ "syn-1.0.89",
+ "cargo-0.60.0",
+ "serde-1.0.136",
+ "ripgrep-13.0.0",
+ "regex-1.5.5",
+ "clap-3.1.6",
+ "hyper-0.14.18",
+];
+
+/// The default set of crates for opt-dist to collect rustc profiles.
+pub const RUSTC_PGO_CRATES: &[&str] = &[
+ "externs",
+ "ctfe-stress-5",
+ "cargo-0.60.0",
+ "token-stream-stress",
+ "match-stress",
+ "tuple-stress",
+ "diesel-1.4.8",
+ "bitmaps-3.1.0",
+];
diff --git a/src/tools/clippy/tests/ui/unicode.stderr b/src/tools/clippy/tests/ui/unicode.stderr
index 9c365e1097dbc..b004493300eed 100644
--- a/src/tools/clippy/tests/ui/unicode.stderr
+++ b/src/tools/clippy/tests/ui/unicode.stderr
@@ -11,7 +11,7 @@ error: invisible character detected
--> tests/ui/unicode.rs:7:12
|
LL | print!("Here >< is a SHY, and another");
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider replacing the string with: `"Here >\u{AD}< is a SHY, and \u{AD}another"`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider replacing the string with: `"Here >\u{AD}< is a SHY, and \u{AD}another"`
error: invisible character detected
--> tests/ui/unicode.rs:9:12
diff --git a/src/tools/miri/CONTRIBUTING.md b/src/tools/miri/CONTRIBUTING.md
index 092ad46a7cad3..9067cbc603261 100644
--- a/src/tools/miri/CONTRIBUTING.md
+++ b/src/tools/miri/CONTRIBUTING.md
@@ -223,7 +223,7 @@ will eventually sync those changes back into this repository.
When working on Miri in the rustc tree, here's how you can run tests:
```
-./x.py test miri --stage 0
+./x.py test miri
```
`--bless` will work, too.
@@ -231,7 +231,7 @@ When working on Miri in the rustc tree, here's how you can run tests:
You can also directly run Miri on a Rust source file:
```
-./x.py run miri --stage 0 --args src/tools/miri/tests/pass/hello.rs
+./x.py run miri --stage 1 --args src/tools/miri/tests/pass/hello.rs
```
## Advanced topic: Syncing with the rustc repo
@@ -287,7 +287,22 @@ https. Add the following to your `.gitconfig`:
pushInsteadOf = https://github.com/
```
-## Internal environment variables
+## Further environment variables
+
+The following environment variables are relevant to `./miri`:
+
+* `MIRI_AUTO_OPS` indicates whether the automatic execution of rustfmt, clippy and toolchain setup
+ (as controlled by the `./auto-*` files) should be skipped. If it is set to `no`, they are skipped.
+ This is used to allow automated IDE actions to avoid the auto ops.
+* `MIRI_LOG`, `MIRI_BACKTRACE` control logging and backtrace printing during Miri executions.
+* `MIRI_TEST_THREADS` (recognized by `./miri test`) sets the number of threads to use for running
+ tests. By default, the number of cores is used.
+* `MIRI_SKIP_UI_CHECKS` (recognized by `./miri test`) disables checking that the `stderr` or
+ `stdout` files match the actual output.
+
+Furthermore, the usual environment variables recognized by `cargo miri` also work for `./miri`, e.g.
+`MIRI_LIB_SRC`. Note that `MIRIFLAGS` is ignored by `./miri test` as each test controls the flags it
+is run with.
The following environment variables are *internal* and must not be used by
anyone but Miri itself. They are used to communicate between different Miri
diff --git a/src/tools/miri/README.md b/src/tools/miri/README.md
index 208a8b9ee617d..c437619a76eab 100644
--- a/src/tools/miri/README.md
+++ b/src/tools/miri/README.md
@@ -448,28 +448,19 @@ Some native rustc `-Z` flags are also very relevant for Miri:
* `-Zmir-emit-retag` controls whether `Retag` statements are emitted. Miri
enables this per default because it is needed for [Stacked Borrows] and [Tree Borrows].
-Moreover, Miri recognizes some environment variables (unless noted otherwise, these are supported
-by all intended entry points, i.e. `cargo miri` and `./miri {test,run}`):
-
-* `MIRI_AUTO_OPS` indicates whether the automatic execution of rustfmt, clippy and toolchain setup
- should be skipped. If it is set to `no`, they are skipped. This is used to allow automated IDE
- actions to avoid the auto ops.
-* `MIRI_LOG`, `MIRI_BACKTRACE` control logging and backtrace printing during
- Miri executions, also [see "Testing the Miri driver" in `CONTRIBUTING.md`][testing-miri].
+Moreover, Miri recognizes some environment variables:
+
* `MIRIFLAGS` defines extra flags to be passed to Miri.
* `MIRI_LIB_SRC` defines the directory where Miri expects the sources of the standard library that
it will build and use for interpretation. This directory must point to the `library` subdirectory
of a `rust-lang/rust` repository checkout.
-* `MIRI_SYSROOT` indicates the sysroot to use. When using `cargo miri`, this skips the automatic
+* `MIRI_SYSROOT` indicates the sysroot to use. When using `cargo miri test`/`cargo miri run`, this skips the automatic
setup -- only set this if you do not want to use the automatically created sysroot. When invoking
`cargo miri setup`, this indicates where the sysroot will be put.
-* `MIRI_TEST_THREADS` (recognized by `./miri test`): set the number of threads to use for running tests.
- By default, the number of cores is used.
* `MIRI_NO_STD` makes sure that the target's sysroot is built without libstd. This allows testing
- and running no_std programs. (Miri has a heuristic to detect no-std targets based on the target
- name; this environment variable is only needed when that heuristic fails.)
-* `MIRI_SKIP_UI_CHECKS` (recognized by `./miri test`): don't check whether the
- `stderr` or `stdout` files match the actual output.
+ and running no_std programs. This should *not usually be used*; Miri has a heuristic to detect
+ no-std targets based on the target name. Setting this on a target that does support libstd can
+ lead to confusing results.
[testing-miri]: CONTRIBUTING.md#testing-the-miri-driver
diff --git a/src/tools/miri/bench-cargo-miri/big-allocs/Cargo.lock b/src/tools/miri/bench-cargo-miri/big-allocs/Cargo.lock
new file mode 100644
index 0000000000000..da0db7f47ea44
--- /dev/null
+++ b/src/tools/miri/bench-cargo-miri/big-allocs/Cargo.lock
@@ -0,0 +1,7 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+version = 3
+
+[[package]]
+name = "big-allocs"
+version = "0.1.0"
diff --git a/src/tools/miri/bench-cargo-miri/big-allocs/Cargo.toml b/src/tools/miri/bench-cargo-miri/big-allocs/Cargo.toml
new file mode 100644
index 0000000000000..7234c9371cff3
--- /dev/null
+++ b/src/tools/miri/bench-cargo-miri/big-allocs/Cargo.toml
@@ -0,0 +1,8 @@
+[package]
+name = "big-allocs"
+version = "0.1.0"
+edition = "2021"
+
+# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
+
+[dependencies]
diff --git a/src/tools/miri/bench-cargo-miri/big-allocs/src/main.rs b/src/tools/miri/bench-cargo-miri/big-allocs/src/main.rs
new file mode 100644
index 0000000000000..a1c1708cf3baa
--- /dev/null
+++ b/src/tools/miri/bench-cargo-miri/big-allocs/src/main.rs
@@ -0,0 +1,13 @@
+//! This is a regression test for https://github.com/rust-lang/miri/issues/3637.
+//! `Allocation`s are backed by a `Box<[u8]>`, which we create using `alloc_zeroed`, which should
+//! make very large allocations cheap. But then we also need to not clone those `Allocation`s, or
+//! we end up slow anyway.
+
+fn main() {
+ // We can't use too big of an allocation or this code will encounter an allocation failure in
+ // CI. Since the allocation can't be huge, we need to do a few iterations so that the effect
+ // we're trying to measure is clearly visible above the interpreter's startup time.
+ for _ in 0..10 {
+ drop(Vec::::with_capacity(512 * 1024 * 1024));
+ }
+}
diff --git a/src/tools/miri/cargo-miri/src/main.rs b/src/tools/miri/cargo-miri/src/main.rs
index 9fdd4c3e47043..7d9f77f3752d9 100644
--- a/src/tools/miri/cargo-miri/src/main.rs
+++ b/src/tools/miri/cargo-miri/src/main.rs
@@ -1,15 +1,14 @@
#![allow(clippy::useless_format, clippy::derive_partial_eq_without_eq, rustc::internal)]
-#[macro_use]
-mod util;
-
mod arg;
mod phases;
mod setup;
+mod util;
use std::{env, iter};
use crate::phases::*;
+use crate::util::show_error;
/// Returns `true` if our flags look like they may be for rustdoc, i.e., this is cargo calling us to
/// be rustdoc. It's hard to be sure as cargo does not have a RUSTDOC_WRAPPER or an env var that
diff --git a/src/tools/miri/cargo-miri/src/util.rs b/src/tools/miri/cargo-miri/src/util.rs
index 28a824e54f65c..f36cff1f7981e 100644
--- a/src/tools/miri/cargo-miri/src/util.rs
+++ b/src/tools/miri/cargo-miri/src/util.rs
@@ -1,3 +1,4 @@
+use std::collections::HashMap;
use std::env;
use std::ffi::OsString;
use std::fs::File;
@@ -11,14 +12,15 @@ use serde::{Deserialize, Serialize};
pub use crate::arg::*;
-pub fn show_error(msg: &impl std::fmt::Display) -> ! {
+pub fn show_error_(msg: &impl std::fmt::Display) -> ! {
eprintln!("fatal error: {msg}");
std::process::exit(1)
}
macro_rules! show_error {
- ($($tt:tt)*) => { crate::util::show_error(&format_args!($($tt)*)) };
+ ($($tt:tt)*) => { crate::util::show_error_(&format_args!($($tt)*)) };
}
+pub(crate) use show_error;
/// The information to run a crate with the given environment.
#[derive(Clone, Serialize, Deserialize)]
@@ -232,21 +234,18 @@ pub fn get_cargo_metadata() -> Metadata {
}
/// Pulls all the crates in this workspace from the cargo metadata.
-/// Workspace members are emitted like "miri 0.1.0 (path+file:///path/to/miri)"
/// Additionally, somewhere between cargo metadata and TyCtxt, '-' gets replaced with '_' so we
/// make that same transformation here.
pub fn local_crates(metadata: &Metadata) -> String {
assert!(!metadata.workspace_members.is_empty());
- let mut local_crates = String::new();
- for member in &metadata.workspace_members {
- let name = member.repr.split(' ').next().unwrap();
- let name = name.replace('-', "_");
- local_crates.push_str(&name);
- local_crates.push(',');
- }
- local_crates.pop(); // Remove the trailing ','
-
- local_crates
+ let package_name_by_id: HashMap<_, _> =
+ metadata.packages.iter().map(|package| (&package.id, package.name.as_str())).collect();
+ metadata
+ .workspace_members
+ .iter()
+ .map(|id| package_name_by_id[id].replace('-', "_"))
+ .collect::>()
+ .join(",")
}
/// Debug-print a command that is going to be run.
diff --git a/src/tools/miri/ci/ci.sh b/src/tools/miri/ci/ci.sh
index f97a611b36407..67985f9b7d6e9 100755
--- a/src/tools/miri/ci/ci.sh
+++ b/src/tools/miri/ci/ci.sh
@@ -148,8 +148,8 @@ case $HOST_TARGET in
UNIX="panic/panic panic/unwind concurrency/simple atomic libc-mem libc-misc libc-random env num_cpus" # the things that are very similar across all Unixes, and hence easily supported there
TEST_TARGET=x86_64-unknown-freebsd run_tests_minimal $BASIC $UNIX threadname libc-time fs
TEST_TARGET=i686-unknown-freebsd run_tests_minimal $BASIC $UNIX threadname libc-time fs
- TEST_TARGET=x86_64-unknown-illumos run_tests_minimal $BASIC $UNIX threadname pthread-sync libc-time
- TEST_TARGET=x86_64-pc-solaris run_tests_minimal $BASIC $UNIX threadname pthread-sync libc-time
+ TEST_TARGET=x86_64-unknown-illumos run_tests_minimal $BASIC $UNIX threadname pthread-sync available-parallelism libc-time
+ TEST_TARGET=x86_64-pc-solaris run_tests_minimal $BASIC $UNIX threadname pthread-sync available-parallelism libc-time
TEST_TARGET=aarch64-linux-android run_tests_minimal $BASIC $UNIX
TEST_TARGET=wasm32-wasip2 run_tests_minimal empty_main wasm heap_alloc libc-mem
TEST_TARGET=wasm32-unknown-unknown run_tests_minimal empty_main wasm
diff --git a/src/tools/miri/rust-version b/src/tools/miri/rust-version
index aa06a0dbcdc5b..0f738653b14a7 100644
--- a/src/tools/miri/rust-version
+++ b/src/tools/miri/rust-version
@@ -1 +1 @@
-21e6de7eb64c09102de3f100420a09edc1a2a8d7
+565cadb514d35e7b851540edbc172af0f606014f
diff --git a/src/tools/miri/src/alloc_addresses/mod.rs b/src/tools/miri/src/alloc_addresses/mod.rs
index 002e106206102..ae95d28d3eb65 100644
--- a/src/tools/miri/src/alloc_addresses/mod.rs
+++ b/src/tools/miri/src/alloc_addresses/mod.rs
@@ -257,7 +257,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
Ok(())
}
- fn ptr_from_addr_cast(&self, addr: u64) -> InterpResult<'tcx, Pointer