diff --git a/Cargo.lock b/Cargo.lock index 85df0dda81857..94e88dfeafe7b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -152,9 +152,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.98" +version = "1.0.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487" +checksum = "b0674a1ddeecb70197781e945de4b3b8ffb61fa939a5597bcf48503737663100" [[package]] name = "ar_archive_writer" @@ -204,7 +204,7 @@ dependencies = [ "rustc-hash 2.1.1", "serde", "serde_derive", - "syn 2.0.104", + "syn 2.0.106", ] [[package]] @@ -266,9 +266,9 @@ dependencies = [ [[package]] name = "bitflags" -version = "2.9.1" +version = "2.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967" +checksum = "6a65b545ab31d687cff52899d4890855fec459eb6afe0da6417b8a18da87aa29" [[package]] name = "blake3" @@ -421,7 +421,7 @@ dependencies = [ "serde", "serde-untagged", "serde-value", - "thiserror 2.0.12", + "thiserror 2.0.15", "toml 0.8.23", "unicode-xid", "url", @@ -453,7 +453,7 @@ dependencies = [ "semver", "serde", "serde_json", - "thiserror 2.0.12", + "thiserror 2.0.15", ] [[package]] @@ -518,9 +518,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.43" +version = "4.5.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50fd97c9dc2399518aa331917ac6f274280ec5eb34e555dd291899745c48ec6f" +checksum = "1fc0e74a703892159f5ae7d3aac52c8e6c392f5ae5f359c70b5881d60aaac318" dependencies = [ "clap_builder", "clap_derive", @@ -538,9 +538,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.43" +version = "4.5.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c35b5830294e1fa0462034af85cc95225a4cb07092c088c55bda3147cfcd8f65" +checksum = "b3e7f4214277f3c7aa526a59dd3fbe306a370daee1f8b7b8c987069cd8e888a8" dependencies = [ "anstream", "anstyle", @@ -550,14 +550,14 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.41" +version = "4.5.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef4f52386a59ca4c860f7393bcf8abd8dfd91ecccc0f774635ff68e92eeef491" +checksum = "14cb31bb0a7d536caef2639baa7fad459e15c3144efefa6dbd1c84562c4739f6" dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.106", ] [[package]] @@ -720,7 +720,7 @@ dependencies = [ "nom", "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.106", ] [[package]] @@ -907,9 +907,9 @@ dependencies = [ [[package]] name = "curl" -version = "0.4.48" +version = "0.4.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e2d5c8f48d9c0c23250e52b55e82a6ab4fdba6650c931f5a0a57a43abda812b" +checksum = "79fc3b6dd0b87ba36e565715bf9a2ced221311db47bd18011676f24a6066edbc" dependencies = [ "curl-sys", "libc", @@ -922,9 +922,9 @@ dependencies = [ [[package]] name = "curl-sys" -version = "0.4.82+curl-8.14.1" +version = "0.4.83+curl-8.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4d63638b5ec65f1a4ae945287b3fd035be4554bbaf211901159c9a2a74fb5be" +checksum = "5830daf304027db10c82632a464879d46a3f7c4ba17a31592657ad16c719b483" dependencies = [ "cc", "libc", @@ -937,9 +937,9 @@ dependencies = [ [[package]] name = "cxx" -version = "1.0.166" +version = "1.0.168" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5287274dfdf7e7eaa3d97d460eb2a94922539e6af214bda423f292105011ee2" +checksum = "7aa144b12f11741f0dab5b4182896afad46faa0598b6a061f7b9d17a21837ba7" dependencies = [ "cc", "cxxbridge-cmd", @@ -951,9 +951,9 @@ dependencies = [ [[package]] name = "cxx-build" -version = "1.0.166" +version = "1.0.168" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65f3ce027a744135db10a1ebffa0863dab685aeef48f40a02c201f5e70c667d3" +checksum = "12d3cbb84fb003242941c231b45ca9417e786e66e94baa39584bd99df3a270b6" dependencies = [ "cc", "codespan-reporting", @@ -961,40 +961,40 @@ dependencies = [ "proc-macro2", "quote", "scratch", - "syn 2.0.104", + "syn 2.0.106", ] [[package]] name = "cxxbridge-cmd" -version = "1.0.166" +version = "1.0.168" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a07dc23f2eea4774297f4c9a17ae4065fecb63127da556e6c9fadb0216d93595" +checksum = "3fa36b7b249d43f67a3f54bd65788e35e7afe64bbc671396387a48b3e8aaea94" dependencies = [ "clap", "codespan-reporting", "indexmap", "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.106", ] [[package]] name = "cxxbridge-flags" -version = "1.0.166" +version = "1.0.168" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7a4dbad6171f763c4066c83dcd27546b6e93c5c5ae2229f9813bda7233f571d" +checksum = "77707c70f6563edc5429618ca34a07241b75ebab35bd01d46697c75d58f8ddfe" [[package]] name = "cxxbridge-macro" -version = "1.0.166" +version = "1.0.168" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9be4b527950fc42db06163705e78e73eedc8fd723708e942afe3572a9a2c366" +checksum = "ede6c0fb7e318f0a11799b86ee29dcf17b9be2960bd379a6c38e1a96a6010fff" dependencies = [ "indexmap", "proc-macro2", "quote", "rustversion", - "syn 2.0.104", + "syn 2.0.106", ] [[package]] @@ -1018,7 +1018,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.104", + "syn 2.0.106", ] [[package]] @@ -1029,7 +1029,7 @@ checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" dependencies = [ "darling_core", "quote", - "syn 2.0.104", + "syn 2.0.106", ] [[package]] @@ -1061,7 +1061,7 @@ checksum = "ef941ded77d15ca19b40374869ac6000af1c9f2a4c0f3d4c70926287e6364a8f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.106", ] [[package]] @@ -1082,7 +1082,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.106", ] [[package]] @@ -1092,7 +1092,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab63b0e2bf4d5928aff72e83a7dace85d7bba5fe12dcc3c5a572d78caffd3f3c" dependencies = [ "derive_builder_core", - "syn 2.0.104", + "syn 2.0.106", ] [[package]] @@ -1104,7 +1104,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.106", ] [[package]] @@ -1194,7 +1194,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.106", ] [[package]] @@ -1379,7 +1379,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "54f0d287c53ffd184d04d8677f590f4ac5379785529e5e08b1c8083acdd5c198" dependencies = [ "memchr", - "thiserror 2.0.12", + "thiserror 2.0.15", ] [[package]] @@ -1539,9 +1539,9 @@ dependencies = [ [[package]] name = "glob" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" +checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280" [[package]] name = "globset" @@ -1855,7 +1855,7 @@ checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.106", ] [[package]] @@ -2044,7 +2044,7 @@ checksum = "03343451ff899767262ec32146f6d559dd759fdadf42ff0e227c7c48f72594b4" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.106", ] [[package]] @@ -2102,7 +2102,7 @@ dependencies = [ "pest_derive", "regex", "serde_json", - "thiserror 2.0.12", + "thiserror 2.0.15", ] [[package]] @@ -2137,9 +2137,9 @@ checksum = "9fa0e2a1fcbe2f6be6c42e342259976206b383122fc152e872795338b5a3f3a7" [[package]] name = "libc" -version = "0.2.174" +version = "0.2.175" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1171693293099992e19cddea4e8b849964e9846f4acee11b3948bcc337be8776" +checksum = "6a82ae493e598baaea5209805c49bbf2ea7de956d50d7da0da1164f9c6d28543" [[package]] name = "libdbus-sys" @@ -2337,7 +2337,7 @@ checksum = "88a9689d8d44bf9964484516275f5cd4c9b59457a6940c1d5d0ecbb94510a36b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.106", ] [[package]] @@ -2643,9 +2643,9 @@ dependencies = [ [[package]] name = "object" -version = "0.37.2" +version = "0.37.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3e3d0a7419f081f4a808147e845310313a39f322d7ae1f996b7f001d6cbed04" +checksum = "ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe" dependencies = [ "crc32fast", "flate2", @@ -2653,7 +2653,7 @@ dependencies = [ "indexmap", "memchr", "ruzstd 0.8.1", - "wasmparser 0.236.0", + "wasmparser 0.236.1", ] [[package]] @@ -2834,7 +2834,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1db05f56d34358a8b1066f67cbb203ee3e7ed2ba674a6263a1d5ec6db2204323" dependencies = [ "memchr", - "thiserror 2.0.12", + "thiserror 2.0.15", "ucd-trie", ] @@ -2858,7 +2858,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.106", ] [[package]] @@ -3007,9 +3007,9 @@ checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" [[package]] name = "proc-macro2" -version = "1.0.95" +version = "1.0.101" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" +checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de" dependencies = [ "unicode-ident", ] @@ -3147,9 +3147,9 @@ dependencies = [ [[package]] name = "rayon" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" +checksum = "368f01d005bf8fd9b1206fb6fa653e6c4a81ceb1466406b81792d87c5677a58f" dependencies = [ "either", "rayon-core", @@ -3157,9 +3157,9 @@ dependencies = [ [[package]] name = "rayon-core" -version = "1.12.1" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" +checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91" dependencies = [ "crossbeam-deque", "crossbeam-utils", @@ -3193,7 +3193,7 @@ checksum = "a4e608c6638b9c18977b00b475ac1f28d14e84b27d8d42f70e0bf1e3dec127ac" dependencies = [ "getrandom 0.2.16", "libredox", - "thiserror 2.0.12", + "thiserror 2.0.15", ] [[package]] @@ -3279,11 +3279,11 @@ dependencies = [ "build_helper", "gimli 0.32.0", "libc", - "object 0.37.2", + "object 0.37.3", "regex", "serde_json", "similar", - "wasmparser 0.236.0", + "wasmparser 0.236.1", ] [[package]] @@ -3570,7 +3570,7 @@ dependencies = [ "itertools", "libc", "measureme", - "object 0.37.2", + "object 0.37.3", "rustc-demangle", "rustc_abi", "rustc_ast", @@ -3608,7 +3608,7 @@ dependencies = [ "cc", "itertools", "libc", - "object 0.37.2", + "object 0.37.3", "pathdiff", "regex", "rustc_abi", @@ -3865,7 +3865,7 @@ dependencies = [ "fluent-syntax", "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.106", "unic-langid", ] @@ -4012,7 +4012,7 @@ version = "0.0.0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.106", ] [[package]] @@ -4158,7 +4158,7 @@ version = "0.0.0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.106", "synstructure", ] @@ -4644,7 +4644,7 @@ name = "rustc_target" version = "0.0.0" dependencies = [ "bitflags", - "object 0.37.2", + "object 0.37.3", "rustc_abi", "rustc_data_structures", "rustc_fs_util", @@ -4781,7 +4781,7 @@ version = "0.0.0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.106", "synstructure", ] @@ -4872,7 +4872,7 @@ dependencies = [ "proc-macro2", "quote", "serde", - "syn 2.0.104", + "syn 2.0.106", ] [[package]] @@ -5009,9 +5009,9 @@ dependencies = [ [[package]] name = "serde-untagged" -version = "0.1.7" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "299d9c19d7d466db4ab10addd5703e4c615dec2a5a16dbbafe191045e87ee66e" +checksum = "34836a629bcbc6f1afdf0907a744870039b1e14c0561cb26094fa683b158eff3" dependencies = [ "erased-serde", "serde", @@ -5036,7 +5036,7 @@ checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.106", ] [[package]] @@ -5127,12 +5127,12 @@ checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" [[package]] name = "socket2" -version = "0.5.10" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e22376abed350d73dd1cd119b57ffccad95b4e585a7cda43e286245ce23c0678" +checksum = "233504af464074f9d066d7b5416c5f9b894a5862a6506e306f7b816cdd6f1807" dependencies = [ "libc", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -5263,9 +5263,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.104" +version = "2.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17b6f705963418cdb9927482fa304bc562ece2fdd4f616084c50b7023b435a40" +checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6" dependencies = [ "proc-macro2", "quote", @@ -5280,7 +5280,7 @@ checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.106", ] [[package]] @@ -5398,11 +5398,11 @@ dependencies = [ [[package]] name = "thiserror" -version = "2.0.12" +version = "2.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708" +checksum = "80d76d3f064b981389ecb4b6b7f45a0bf9fdac1d5b9204c7bd6714fecc302850" dependencies = [ - "thiserror-impl 2.0.12", + "thiserror-impl 2.0.15", ] [[package]] @@ -5413,18 +5413,18 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.106", ] [[package]] name = "thiserror-impl" -version = "2.0.12" +version = "2.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" +checksum = "44d29feb33e986b6ea906bd9c3559a856983f92371b3eaa5e83782a351623de0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.106", ] [[package]] @@ -5621,7 +5621,7 @@ checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.106", ] [[package]] @@ -5804,7 +5804,7 @@ checksum = "a1249a628de3ad34b821ecb1001355bca3940bcb2f88558f1a8bd82e977f75b5" dependencies = [ "proc-macro-hack", "quote", - "syn 2.0.104", + "syn 2.0.106", "unic-langid-impl", ] @@ -5936,9 +5936,9 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "uuid" -version = "1.17.0" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cf4199d1e5d15ddd86a694e4d0dffa9c323ce759fea589f00fef9d81cc1931d" +checksum = "f33196643e165781c20a5ead5582283a7dacbb87855d867fbc2df3f81eddc1be" dependencies = [ "getrandom 0.3.3", "js-sys", @@ -6016,7 +6016,7 @@ dependencies = [ "log", "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.106", "wasm-bindgen-shared", ] @@ -6038,7 +6038,7 @@ checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.106", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -6101,12 +6101,12 @@ dependencies = [ [[package]] name = "wasm-encoder" -version = "0.236.0" +version = "0.236.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3108979166ab0d3c7262d2e16a2190ffe784b2a5beb963edef154b5e8e07680b" +checksum = "724fccfd4f3c24b7e589d333fc0429c68042897a7e8a5f8694f31792471841e7" dependencies = [ "leb128fmt", - "wasmparser 0.236.0", + "wasmparser 0.236.1", ] [[package]] @@ -6146,9 +6146,9 @@ dependencies = [ [[package]] name = "wasmparser" -version = "0.236.0" +version = "0.236.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16d1eee846a705f6f3cb9d7b9f79b54583810f1fb57a1e3aea76d1742db2e3d2" +checksum = "a9b1e81f3eb254cf7404a82cee6926a4a3ccc5aad80cc3d43608a070c67aa1d7" dependencies = [ "bitflags", "indexmap", @@ -6157,22 +6157,22 @@ dependencies = [ [[package]] name = "wast" -version = "236.0.0" +version = "236.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11d6b6faeab519ba6fbf9b26add41617ca6f5553f99ebc33d876e591d2f4f3c6" +checksum = "d3bec4b4db9c6808d394632fd4b0cd4654c32c540bd3237f55ee6a40fff6e51f" dependencies = [ "bumpalo", "leb128fmt", "memchr", "unicode-width 0.2.1", - "wasm-encoder 0.236.0", + "wasm-encoder 0.236.1", ] [[package]] name = "wat" -version = "1.236.0" +version = "1.236.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc31704322400f461f7f31a5f9190d5488aaeafb63ae69ad2b5888d2704dcb08" +checksum = "64475e2f77d6071ce90624098fc236285ddafa8c3ea1fb386f2c4154b6c2bbdb" dependencies = [ "wast", ] @@ -6306,7 +6306,7 @@ checksum = "2bbd5b46c938e506ecbce286b6628a02171d56153ba733b6c741fc627ec9579b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.106", ] [[package]] @@ -6317,7 +6317,7 @@ checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.106", ] [[package]] @@ -6328,7 +6328,7 @@ checksum = "053c4c462dc91d3b1504c6fe5a726dd15e216ba718e84a0e46a88fbe5ded3515" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.106", ] [[package]] @@ -6339,7 +6339,7 @@ checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.106", ] [[package]] @@ -6772,7 +6772,7 @@ checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.106", "synstructure", ] @@ -6784,7 +6784,7 @@ checksum = "38da3c9736e16c5d3c8c597a9aaa5d1fa565d0532ae05e27c24aa62fb32c0ab6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.106", "synstructure", ] @@ -6805,7 +6805,7 @@ checksum = "9ecf5b4cc5364572d7f4c329661bcc82724222973f2cab6f050a4e5c22f75181" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.106", ] [[package]] @@ -6825,7 +6825,7 @@ checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.106", "synstructure", ] @@ -6870,7 +6870,7 @@ checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.106", ] [[package]] @@ -6881,5 +6881,5 @@ checksum = "5b96237efa0c878c64bd89c436f661be4e46b2f3eff1ebb976f7ef2321d2f58f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.106", ] diff --git a/compiler/rustc_attr_parsing/messages.ftl b/compiler/rustc_attr_parsing/messages.ftl index 4fb66a816522e..067d95a0f4822 100644 --- a/compiler/rustc_attr_parsing/messages.ftl +++ b/compiler/rustc_attr_parsing/messages.ftl @@ -12,9 +12,11 @@ attr_parsing_empty_attribute = attr_parsing_invalid_target = `#[{$name}]` attribute cannot be used on {$target} .help = `#[{$name}]` can {$only}be applied to {$applied} + .suggestion = remove the attribute attr_parsing_invalid_target_lint = `#[{$name}]` attribute cannot be used on {$target} .warn = {-attr_parsing_previously_accepted} .help = `#[{$name}]` can {$only}be applied to {$applied} + .suggestion = remove the attribute attr_parsing_empty_confusables = expected at least one confusable name diff --git a/compiler/rustc_attr_parsing/src/attributes/inline.rs b/compiler/rustc_attr_parsing/src/attributes/inline.rs index 6a659a95b856f..33c21bad2401b 100644 --- a/compiler/rustc_attr_parsing/src/attributes/inline.rs +++ b/compiler/rustc_attr_parsing/src/attributes/inline.rs @@ -62,8 +62,8 @@ impl SingleAttributeParser for InlineParser { } } ArgParser::NameValue(_) => { - let suggestions = - >::TEMPLATE.suggestions(false, "inline"); + let suggestions = >::TEMPLATE + .suggestions(cx.attr_style, "inline"); let span = cx.attr_span; cx.emit_lint(AttributeLintKind::IllFormedAttributeInput { suggestions }, span); return None; diff --git a/compiler/rustc_attr_parsing/src/attributes/macro_attrs.rs b/compiler/rustc_attr_parsing/src/attributes/macro_attrs.rs index c9b5dd35fa1d9..8928129c2013d 100644 --- a/compiler/rustc_attr_parsing/src/attributes/macro_attrs.rs +++ b/compiler/rustc_attr_parsing/src/attributes/macro_attrs.rs @@ -107,7 +107,7 @@ impl AttributeParser for MacroUseParser { } } ArgParser::NameValue(_) => { - let suggestions = MACRO_USE_TEMPLATE.suggestions(false, sym::macro_use); + let suggestions = MACRO_USE_TEMPLATE.suggestions(cx.attr_style, sym::macro_use); cx.emit_err(session_diagnostics::IllFormedAttributeInputLint { num_suggestions: suggestions.len(), suggestions: DiagArgValue::StrListSepByAnd( diff --git a/compiler/rustc_attr_parsing/src/attributes/must_use.rs b/compiler/rustc_attr_parsing/src/attributes/must_use.rs index b6cfc78059066..eb2b39298bce8 100644 --- a/compiler/rustc_attr_parsing/src/attributes/must_use.rs +++ b/compiler/rustc_attr_parsing/src/attributes/must_use.rs @@ -1,10 +1,12 @@ use rustc_errors::DiagArgValue; use rustc_feature::{AttributeTemplate, template}; use rustc_hir::attrs::AttributeKind; +use rustc_hir::{MethodKind, Target}; use rustc_span::{Symbol, sym}; use crate::attributes::{AttributeOrder, OnDuplicate, SingleAttributeParser}; -use crate::context::{ALL_TARGETS, AcceptContext, AllowedTargets, Stage}; +use crate::context::MaybeWarn::{Allow, Error}; +use crate::context::{AcceptContext, AllowedTargets, Stage}; use crate::parser::ArgParser; use crate::session_diagnostics; pub(crate) struct MustUseParser; @@ -13,7 +15,21 @@ impl SingleAttributeParser for MustUseParser { const PATH: &[Symbol] = &[sym::must_use]; const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepOutermost; const ON_DUPLICATE: OnDuplicate = OnDuplicate::WarnButFutureError; - const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(ALL_TARGETS); //FIXME Still checked fully in `check_attr.rs` + const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowListWarnRest(&[ + Allow(Target::Fn), + Allow(Target::Enum), + Allow(Target::Struct), + Allow(Target::Union), + Allow(Target::Method(MethodKind::Trait { body: false })), + Allow(Target::Method(MethodKind::Trait { body: true })), + Allow(Target::Method(MethodKind::Inherent)), + Allow(Target::ForeignFn), + // `impl Trait` in return position can trip + // `unused_must_use` if `Trait` is marked as + // `#[must_use]` + Allow(Target::Trait), + Error(Target::WherePredicate), + ]); const TEMPLATE: AttributeTemplate = template!( Word, NameValueStr: "reason", "https://doc.rust-lang.org/reference/attributes/diagnostics.html#the-must_use-attribute" @@ -35,8 +51,8 @@ impl SingleAttributeParser for MustUseParser { Some(value_str) } ArgParser::List(_) => { - let suggestions = - >::TEMPLATE.suggestions(false, "must_use"); + let suggestions = >::TEMPLATE + .suggestions(cx.attr_style, "must_use"); cx.emit_err(session_diagnostics::IllFormedAttributeInputLint { num_suggestions: suggestions.len(), suggestions: DiagArgValue::StrListSepByAnd( diff --git a/compiler/rustc_attr_parsing/src/attributes/test_attrs.rs b/compiler/rustc_attr_parsing/src/attributes/test_attrs.rs index 8b666c3868baf..164c680b8a8de 100644 --- a/compiler/rustc_attr_parsing/src/attributes/test_attrs.rs +++ b/compiler/rustc_attr_parsing/src/attributes/test_attrs.rs @@ -29,7 +29,7 @@ impl SingleAttributeParser for IgnoreParser { ArgParser::NameValue(name_value) => { let Some(str_value) = name_value.value_as_str() else { let suggestions = >::TEMPLATE - .suggestions(false, "ignore"); + .suggestions(cx.attr_style, "ignore"); let span = cx.attr_span; cx.emit_lint( AttributeLintKind::IllFormedAttributeInput { suggestions }, @@ -40,8 +40,8 @@ impl SingleAttributeParser for IgnoreParser { Some(str_value) } ArgParser::List(_) => { - let suggestions = - >::TEMPLATE.suggestions(false, "ignore"); + let suggestions = >::TEMPLATE + .suggestions(cx.attr_style, "ignore"); let span = cx.attr_span; cx.emit_lint(AttributeLintKind::IllFormedAttributeInput { suggestions }, span); return None; diff --git a/compiler/rustc_attr_parsing/src/context.rs b/compiler/rustc_attr_parsing/src/context.rs index bebe3350c4e0d..13b7621001d30 100644 --- a/compiler/rustc_attr_parsing/src/context.rs +++ b/compiler/rustc_attr_parsing/src/context.rs @@ -5,7 +5,7 @@ use std::sync::LazyLock; use itertools::Itertools; use private::Sealed; -use rustc_ast::{self as ast, LitKind, MetaItemLit, NodeId}; +use rustc_ast::{self as ast, AttrStyle, LitKind, MetaItemLit, NodeId}; use rustc_errors::{DiagCtxtHandle, Diagnostic}; use rustc_feature::{AttributeTemplate, Features}; use rustc_hir::attrs::AttributeKind; @@ -313,6 +313,7 @@ pub struct AcceptContext<'f, 'sess, S: Stage> { /// The span of the attribute currently being parsed pub(crate) attr_span: Span, + pub(crate) attr_style: AttrStyle, /// The expected structure of the attribute. /// /// Used in reporting errors to give a hint to users what the attribute *should* look like. @@ -394,6 +395,7 @@ impl<'f, 'sess: 'f, S: Stage> AcceptContext<'f, 'sess, S> { i.kind.is_bytestr().then(|| self.sess().source_map().start_point(i.span)) }), }, + attr_style: self.attr_style, }) } @@ -404,6 +406,7 @@ impl<'f, 'sess: 'f, S: Stage> AcceptContext<'f, 'sess, S> { template: self.template.clone(), attribute: self.attr_path.clone(), reason: AttributeParseErrorReason::ExpectedIntegerLiteral, + attr_style: self.attr_style, }) } @@ -414,6 +417,7 @@ impl<'f, 'sess: 'f, S: Stage> AcceptContext<'f, 'sess, S> { template: self.template.clone(), attribute: self.attr_path.clone(), reason: AttributeParseErrorReason::ExpectedList, + attr_style: self.attr_style, }) } @@ -424,6 +428,7 @@ impl<'f, 'sess: 'f, S: Stage> AcceptContext<'f, 'sess, S> { template: self.template.clone(), attribute: self.attr_path.clone(), reason: AttributeParseErrorReason::ExpectedNoArgs, + attr_style: self.attr_style, }) } @@ -435,6 +440,7 @@ impl<'f, 'sess: 'f, S: Stage> AcceptContext<'f, 'sess, S> { template: self.template.clone(), attribute: self.attr_path.clone(), reason: AttributeParseErrorReason::ExpectedIdentifier, + attr_style: self.attr_style, }) } @@ -447,6 +453,7 @@ impl<'f, 'sess: 'f, S: Stage> AcceptContext<'f, 'sess, S> { template: self.template.clone(), attribute: self.attr_path.clone(), reason: AttributeParseErrorReason::ExpectedNameValue(name), + attr_style: self.attr_style, }) } @@ -458,6 +465,7 @@ impl<'f, 'sess: 'f, S: Stage> AcceptContext<'f, 'sess, S> { template: self.template.clone(), attribute: self.attr_path.clone(), reason: AttributeParseErrorReason::DuplicateKey(key), + attr_style: self.attr_style, }) } @@ -470,6 +478,7 @@ impl<'f, 'sess: 'f, S: Stage> AcceptContext<'f, 'sess, S> { template: self.template.clone(), attribute: self.attr_path.clone(), reason: AttributeParseErrorReason::UnexpectedLiteral, + attr_style: self.attr_style, }) } @@ -480,6 +489,7 @@ impl<'f, 'sess: 'f, S: Stage> AcceptContext<'f, 'sess, S> { template: self.template.clone(), attribute: self.attr_path.clone(), reason: AttributeParseErrorReason::ExpectedSingleArgument, + attr_style: self.attr_style, }) } @@ -490,6 +500,7 @@ impl<'f, 'sess: 'f, S: Stage> AcceptContext<'f, 'sess, S> { template: self.template.clone(), attribute: self.attr_path.clone(), reason: AttributeParseErrorReason::ExpectedAtLeastOneArgument, + attr_style: self.attr_style, }) } @@ -508,6 +519,7 @@ impl<'f, 'sess: 'f, S: Stage> AcceptContext<'f, 'sess, S> { strings: false, list: false, }, + attr_style: self.attr_style, }) } @@ -526,6 +538,7 @@ impl<'f, 'sess: 'f, S: Stage> AcceptContext<'f, 'sess, S> { strings: false, list: true, }, + attr_style: self.attr_style, }) } @@ -544,6 +557,7 @@ impl<'f, 'sess: 'f, S: Stage> AcceptContext<'f, 'sess, S> { strings: true, list: false, }, + attr_style: self.attr_style, }) } @@ -802,6 +816,7 @@ impl<'sess> AttributeParser<'sess, Early> { }, }, attr_span: attr.span, + attr_style: attr.style, template, attr_path: path.get_attribute_path(), }; @@ -912,6 +927,7 @@ impl<'sess, S: Stage> AttributeParser<'sess, S> { emit_lint: &mut emit_lint, }, attr_span: lower_span(attr.span), + attr_style: attr.style, template: &accept.template, attr_path: path.get_attribute_path(), }; diff --git a/compiler/rustc_attr_parsing/src/lints.rs b/compiler/rustc_attr_parsing/src/lints.rs index 733225bab598e..2813fef314896 100644 --- a/compiler/rustc_attr_parsing/src/lints.rs +++ b/compiler/rustc_attr_parsing/src/lints.rs @@ -53,6 +53,7 @@ pub fn emit_attribute_lint(lint: &AttributeLint, lint_emi target: target.plural_name(), applied: applied.clone(), only, + attr_span: *span, }, ), } diff --git a/compiler/rustc_attr_parsing/src/session_diagnostics.rs b/compiler/rustc_attr_parsing/src/session_diagnostics.rs index 95e85667cd662..aec970a3ce9a2 100644 --- a/compiler/rustc_attr_parsing/src/session_diagnostics.rs +++ b/compiler/rustc_attr_parsing/src/session_diagnostics.rs @@ -1,6 +1,6 @@ use std::num::IntErrorKind; -use rustc_ast as ast; +use rustc_ast::{self as ast, AttrStyle}; use rustc_errors::codes::*; use rustc_errors::{ Applicability, Diag, DiagArgValue, DiagCtxtHandle, Diagnostic, EmissionGuarantee, Level, @@ -489,6 +489,8 @@ pub(crate) struct InvalidTargetLint { pub target: &'static str, pub applied: String, pub only: &'static str, + #[suggestion(code = "", applicability = "machine-applicable", style = "tool-only")] + pub attr_span: Span, } #[derive(Diagnostic)] @@ -496,6 +498,7 @@ pub(crate) struct InvalidTargetLint { #[diag(attr_parsing_invalid_target)] pub(crate) struct InvalidTarget { #[primary_span] + #[suggestion(code = "", applicability = "machine-applicable", style = "tool-only")] pub span: Span, pub name: Symbol, pub target: &'static str, @@ -579,6 +582,7 @@ pub(crate) enum AttributeParseErrorReason { pub(crate) struct AttributeParseError { pub(crate) span: Span, pub(crate) attr_span: Span, + pub(crate) attr_style: AttrStyle, pub(crate) template: AttributeTemplate, pub(crate) attribute: AttrPath, pub(crate) reason: AttributeParseErrorReason, @@ -717,7 +721,8 @@ impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for AttributeParseError { if let Some(link) = self.template.docs { diag.note(format!("for more information, visit <{link}>")); } - let suggestions = self.template.suggestions(false, &name); + let suggestions = self.template.suggestions(self.attr_style, &name); + diag.span_suggestions( self.attr_span, if suggestions.len() == 1 { diff --git a/compiler/rustc_borrowck/messages.ftl b/compiler/rustc_borrowck/messages.ftl index 33b80c4b03d6f..f59e106c7ac3c 100644 --- a/compiler/rustc_borrowck/messages.ftl +++ b/compiler/rustc_borrowck/messages.ftl @@ -90,7 +90,7 @@ borrowck_lifetime_constraints_error = lifetime may not live long enough borrowck_limitations_implies_static = - due to current limitations in the borrow checker, this implies a `'static` lifetime + due to a current limitation of the type system, this implies a `'static` lifetime borrowck_move_closure_suggestion = consider adding 'move' keyword before the nested closure diff --git a/compiler/rustc_borrowck/src/diagnostics/mod.rs b/compiler/rustc_borrowck/src/diagnostics/mod.rs index b67dba3af96d2..5642cdf87fded 100644 --- a/compiler/rustc_borrowck/src/diagnostics/mod.rs +++ b/compiler/rustc_borrowck/src/diagnostics/mod.rs @@ -6,7 +6,9 @@ use rustc_abi::{FieldIdx, VariantIdx}; use rustc_data_structures::fx::FxIndexMap; use rustc_errors::{Applicability, Diag, EmissionGuarantee, MultiSpan, listify}; use rustc_hir::def::{CtorKind, Namespace}; -use rustc_hir::{self as hir, CoroutineKind, LangItem}; +use rustc_hir::{ + self as hir, CoroutineKind, GenericBound, LangItem, WhereBoundPredicate, WherePredicateKind, +}; use rustc_index::{IndexSlice, IndexVec}; use rustc_infer::infer::{BoundRegionConversionTime, NllRegionVariableOrigin}; use rustc_infer::traits::SelectionError; @@ -658,25 +660,66 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { /// Add a note to region errors and borrow explanations when higher-ranked regions in predicates /// implicitly introduce an "outlives `'static`" constraint. + /// + /// This is very similar to `fn suggest_static_lifetime_for_gat_from_hrtb` which handles this + /// note for failed type tests instead of outlives errors. fn add_placeholder_from_predicate_note( &self, - err: &mut Diag<'_, G>, + diag: &mut Diag<'_, G>, path: &[OutlivesConstraint<'tcx>], ) { - let predicate_span = path.iter().find_map(|constraint| { + let tcx = self.infcx.tcx; + let Some((gat_hir_id, generics)) = path.iter().find_map(|constraint| { let outlived = constraint.sub; if let Some(origin) = self.regioncx.definitions.get(outlived) - && let NllRegionVariableOrigin::Placeholder(_) = origin.origin - && let ConstraintCategory::Predicate(span) = constraint.category + && let NllRegionVariableOrigin::Placeholder(placeholder) = origin.origin + && let Some(id) = placeholder.bound.kind.get_id() + && let Some(placeholder_id) = id.as_local() + && let gat_hir_id = tcx.local_def_id_to_hir_id(placeholder_id) + && let Some(generics_impl) = + tcx.parent_hir_node(tcx.parent_hir_id(gat_hir_id)).generics() { - Some(span) + Some((gat_hir_id, generics_impl)) } else { None } - }); + }) else { + return; + }; - if let Some(span) = predicate_span { - err.span_note(span, "due to current limitations in the borrow checker, this implies a `'static` lifetime"); + // Look for the where-bound which introduces the placeholder. + // As we're using the HIR, we need to handle both `for<'a> T: Trait<'a>` + // and `T: for<'a> Trait`<'a>. + for pred in generics.predicates { + let WherePredicateKind::BoundPredicate(WhereBoundPredicate { + bound_generic_params, + bounds, + .. + }) = pred.kind + else { + continue; + }; + if bound_generic_params + .iter() + .rfind(|bgp| tcx.local_def_id_to_hir_id(bgp.def_id) == gat_hir_id) + .is_some() + { + diag.span_note(pred.span, fluent::borrowck_limitations_implies_static); + return; + } + for bound in bounds.iter() { + if let GenericBound::Trait(bound) = bound { + if bound + .bound_generic_params + .iter() + .rfind(|bgp| tcx.local_def_id_to_hir_id(bgp.def_id) == gat_hir_id) + .is_some() + { + diag.span_note(bound.span, fluent::borrowck_limitations_implies_static); + return; + } + } + } } } diff --git a/compiler/rustc_borrowck/src/diagnostics/region_errors.rs b/compiler/rustc_borrowck/src/diagnostics/region_errors.rs index 2b74f1a48f731..fe4e1b6011e62 100644 --- a/compiler/rustc_borrowck/src/diagnostics/region_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/region_errors.rs @@ -215,7 +215,6 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { diag: &mut Diag<'_>, lower_bound: RegionVid, ) { - let mut suggestions = vec![]; let tcx = self.infcx.tcx; // find generic associated types in the given region 'lower_bound' @@ -237,9 +236,11 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { .collect::>(); debug!(?gat_id_and_generics); - // find higher-ranked trait bounds bounded to the generic associated types + // Look for the where-bound which introduces the placeholder. + // As we're using the HIR, we need to handle both `for<'a> T: Trait<'a>` + // and `T: for<'a> Trait`<'a>. let mut hrtb_bounds = vec![]; - gat_id_and_generics.iter().flatten().for_each(|(gat_hir_id, generics)| { + gat_id_and_generics.iter().flatten().for_each(|&(gat_hir_id, generics)| { for pred in generics.predicates { let BoundPredicate(WhereBoundPredicate { bound_generic_params, bounds, .. }) = pred.kind @@ -248,17 +249,32 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { }; if bound_generic_params .iter() - .rfind(|bgp| tcx.local_def_id_to_hir_id(bgp.def_id) == *gat_hir_id) + .rfind(|bgp| tcx.local_def_id_to_hir_id(bgp.def_id) == gat_hir_id) .is_some() { for bound in *bounds { hrtb_bounds.push(bound); } + } else { + for bound in *bounds { + if let Trait(trait_bound) = bound { + if trait_bound + .bound_generic_params + .iter() + .rfind(|bgp| tcx.local_def_id_to_hir_id(bgp.def_id) == gat_hir_id) + .is_some() + { + hrtb_bounds.push(bound); + return; + } + } + } } } }); debug!(?hrtb_bounds); + let mut suggestions = vec![]; hrtb_bounds.iter().for_each(|bound| { let Trait(PolyTraitRef { trait_ref, span: trait_span, .. }) = bound else { return; diff --git a/compiler/rustc_builtin_macros/src/deriving/from.rs b/compiler/rustc_builtin_macros/src/deriving/from.rs index ef0e6ca324a32..ab25de7c91752 100644 --- a/compiler/rustc_builtin_macros/src/deriving/from.rs +++ b/compiler/rustc_builtin_macros/src/deriving/from.rs @@ -27,21 +27,39 @@ pub(crate) fn expand_deriving_from( cx.dcx().bug("derive(From) used on something else than an item"); }; - // #[derive(From)] is currently usable only on structs with exactly one field. - let field = if let ItemKind::Struct(_, _, data) = &item.kind - && let [field] = data.fields() - { - Some(field.clone()) - } else { - None + let err_span = || { + let item_span = item.kind.ident().map(|ident| ident.span).unwrap_or(item.span); + MultiSpan::from_spans(vec![span, item_span]) }; - let from_type = match &field { - Some(field) => Ty::AstTy(field.ty.clone()), - // We don't have a type to put into From<...> if we don't have a single field, so just put - // unit there. - None => Ty::Unit, + // `#[derive(From)]` is currently usable only on structs with exactly one field. + let field = match &item.kind { + ItemKind::Struct(_, _, data) => { + if let [field] = data.fields() { + Ok(field.clone()) + } else { + let guar = cx.dcx().emit_err(errors::DeriveFromWrongFieldCount { + span: err_span(), + multiple_fields: data.fields().len() > 1, + }); + Err(guar) + } + } + ItemKind::Enum(_, _, _) | ItemKind::Union(_, _, _) => { + let guar = cx.dcx().emit_err(errors::DeriveFromWrongTarget { + span: err_span(), + kind: &format!("{} {}", item.kind.article(), item.kind.descr()), + }); + Err(guar) + } + _ => cx.dcx().bug("Invalid derive(From) ADT input"), }; + + let from_type = Ty::AstTy(match field { + Ok(ref field) => field.ty.clone(), + Err(guar) => cx.ty(span, ast::TyKind::Err(guar)), + }); + let path = Path::new_(pathvec_std!(convert::From), vec![Box::new(from_type.clone())], PathKind::Std); @@ -71,34 +89,17 @@ pub(crate) fn expand_deriving_from( attributes: thin_vec![cx.attr_word(sym::inline, span)], fieldless_variants_strategy: FieldlessVariantsStrategy::Default, combine_substructure: combine_substructure(Box::new(|cx, span, substructure| { - let Some(field) = &field else { - let item_span = item.kind.ident().map(|ident| ident.span).unwrap_or(item.span); - let err_span = MultiSpan::from_spans(vec![span, item_span]); - let error = match &item.kind { - ItemKind::Struct(_, _, data) => { - cx.dcx().emit_err(errors::DeriveFromWrongFieldCount { - span: err_span, - multiple_fields: data.fields().len() > 1, - }) - } - ItemKind::Enum(_, _, _) | ItemKind::Union(_, _, _) => { - cx.dcx().emit_err(errors::DeriveFromWrongTarget { - span: err_span, - kind: &format!("{} {}", item.kind.article(), item.kind.descr()), - }) - } - _ => cx.dcx().bug("Invalid derive(From) ADT input"), - }; - - return BlockOrExpr::new_expr(DummyResult::raw_expr(span, Some(error))); + let field = match field { + Ok(ref field) => field, + Err(guar) => { + return BlockOrExpr::new_expr(DummyResult::raw_expr(span, Some(guar))); + } }; let self_kw = Ident::new(kw::SelfUpper, span); let expr: Box = match substructure.fields { SubstructureFields::StaticStruct(variant, _) => match variant { - // Self { - // field: value - // } + // Self { field: value } VariantData::Struct { .. } => cx.expr_struct_ident( span, self_kw, diff --git a/compiler/rustc_builtin_macros/src/lib.rs b/compiler/rustc_builtin_macros/src/lib.rs index 86a4927f3903f..1bcea95fbb7b0 100644 --- a/compiler/rustc_builtin_macros/src/lib.rs +++ b/compiler/rustc_builtin_macros/src/lib.rs @@ -8,7 +8,6 @@ #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] #![doc(rust_logo)] #![feature(assert_matches)] -#![feature(autodiff)] #![feature(box_patterns)] #![feature(decl_macro)] #![feature(if_let_guard)] diff --git a/compiler/rustc_codegen_llvm/src/attributes.rs b/compiler/rustc_codegen_llvm/src/attributes.rs index a6daacd95ef80..8f1218bb505fb 100644 --- a/compiler/rustc_codegen_llvm/src/attributes.rs +++ b/compiler/rustc_codegen_llvm/src/attributes.rs @@ -497,7 +497,7 @@ pub(crate) fn llfn_attrs_from_instance<'ll, 'tcx>( to_add.push(llvm::CreateAttrStringValue(cx.llcx, "wasm-import-module", module)); let name = - codegen_fn_attrs.link_name.unwrap_or_else(|| cx.tcx.item_name(instance.def_id())); + codegen_fn_attrs.symbol_name.unwrap_or_else(|| cx.tcx.item_name(instance.def_id())); let name = name.as_str(); to_add.push(llvm::CreateAttrStringValue(cx.llcx, "wasm-import-name", name)); } diff --git a/compiler/rustc_codegen_ssa/src/base.rs b/compiler/rustc_codegen_ssa/src/base.rs index 67cd1f4cd41a0..8abaf201abae2 100644 --- a/compiler/rustc_codegen_ssa/src/base.rs +++ b/compiler/rustc_codegen_ssa/src/base.rs @@ -858,7 +858,7 @@ pub fn is_call_from_compiler_builtins_to_upstream_monomorphization<'tcx>( instance: Instance<'tcx>, ) -> bool { fn is_llvm_intrinsic(tcx: TyCtxt<'_>, def_id: DefId) -> bool { - if let Some(name) = tcx.codegen_fn_attrs(def_id).link_name { + if let Some(name) = tcx.codegen_fn_attrs(def_id).symbol_name { name.as_str().starts_with("llvm.") } else { false diff --git a/compiler/rustc_codegen_ssa/src/codegen_attrs.rs b/compiler/rustc_codegen_ssa/src/codegen_attrs.rs index af70f0deb0706..20385ba8e4cb5 100644 --- a/compiler/rustc_codegen_ssa/src/codegen_attrs.rs +++ b/compiler/rustc_codegen_ssa/src/codegen_attrs.rs @@ -6,7 +6,6 @@ use rustc_ast::{LitKind, MetaItem, MetaItemInner, attr}; use rustc_hir::attrs::{AttributeKind, InlineAttr, InstructionSetAttr, UsedBy}; use rustc_hir::def::DefKind; use rustc_hir::def_id::{DefId, LOCAL_CRATE, LocalDefId}; -use rustc_hir::weak_lang_items::WEAK_LANG_ITEMS; use rustc_hir::{self as hir, Attribute, LangItem, find_attr, lang_items}; use rustc_middle::middle::codegen_fn_attrs::{ CodegenFnAttrFlags, CodegenFnAttrs, PatchableFunctionEntry, @@ -182,7 +181,7 @@ fn process_builtin_attrs( match p { AttributeKind::Cold(_) => codegen_fn_attrs.flags |= CodegenFnAttrFlags::COLD, AttributeKind::ExportName { name, .. } => { - codegen_fn_attrs.export_name = Some(*name) + codegen_fn_attrs.symbol_name = Some(*name) } AttributeKind::Inline(inline, span) => { codegen_fn_attrs.inline = *inline; @@ -190,7 +189,13 @@ fn process_builtin_attrs( } AttributeKind::Naked(_) => codegen_fn_attrs.flags |= CodegenFnAttrFlags::NAKED, AttributeKind::Align { align, .. } => codegen_fn_attrs.alignment = Some(*align), - AttributeKind::LinkName { name, .. } => codegen_fn_attrs.link_name = Some(*name), + AttributeKind::LinkName { name, .. } => { + // FIXME Remove check for foreign functions once #[link_name] on non-foreign + // functions is a hard error + if tcx.is_foreign_item(did) { + codegen_fn_attrs.symbol_name = Some(*name); + } + } AttributeKind::LinkOrdinal { ordinal, span } => { codegen_fn_attrs.link_ordinal = Some(*ordinal); interesting_spans.link_ordinal = Some(*span); @@ -410,7 +415,7 @@ fn apply_overrides(tcx: TyCtxt<'_>, did: LocalDefId, codegen_fn_attrs: &mut Code // * `#[rustc_std_internal_symbol]` mangles the symbol name in a special way // both for exports and imports through foreign items. This is handled further, // during symbol mangling logic. - } else if codegen_fn_attrs.link_name.is_some() { + } else if codegen_fn_attrs.symbol_name.is_some() { // * This can be overridden with the `#[link_name]` attribute } else { // NOTE: there's one more exception that we cannot apply here. On wasm, @@ -465,7 +470,7 @@ fn check_result( } // error when specifying link_name together with link_ordinal - if let Some(_) = codegen_fn_attrs.link_name + if let Some(_) = codegen_fn_attrs.symbol_name && let Some(_) = codegen_fn_attrs.link_ordinal { let msg = "cannot use `#[link_name]` with `#[link_ordinal]`"; @@ -512,14 +517,11 @@ fn handle_lang_items( // strippable by the linker. // // Additionally weak lang items have predetermined symbol names. - if let Some(lang_item) = lang_item { - if WEAK_LANG_ITEMS.contains(&lang_item) { - codegen_fn_attrs.flags |= CodegenFnAttrFlags::RUSTC_STD_INTERNAL_SYMBOL; - } - if let Some(link_name) = lang_item.link_name() { - codegen_fn_attrs.export_name = Some(link_name); - codegen_fn_attrs.link_name = Some(link_name); - } + if let Some(lang_item) = lang_item + && let Some(link_name) = lang_item.link_name() + { + codegen_fn_attrs.flags |= CodegenFnAttrFlags::RUSTC_STD_INTERNAL_SYMBOL; + codegen_fn_attrs.symbol_name = Some(link_name); } // error when using no_mangle on a lang item item diff --git a/compiler/rustc_feature/src/builtin_attrs.rs b/compiler/rustc_feature/src/builtin_attrs.rs index 6fbedaf5b1033..7c889641fe0ab 100644 --- a/compiler/rustc_feature/src/builtin_attrs.rs +++ b/compiler/rustc_feature/src/builtin_attrs.rs @@ -6,6 +6,7 @@ use AttributeDuplicates::*; use AttributeGate::*; use AttributeType::*; use rustc_data_structures::fx::FxHashMap; +use rustc_hir::AttrStyle; use rustc_hir::attrs::EncodeCrossCrate; use rustc_span::edition::Edition; use rustc_span::{Symbol, sym}; @@ -132,9 +133,12 @@ pub struct AttributeTemplate { } impl AttributeTemplate { - pub fn suggestions(&self, inner: bool, name: impl std::fmt::Display) -> Vec { + pub fn suggestions(&self, style: AttrStyle, name: impl std::fmt::Display) -> Vec { let mut suggestions = vec![]; - let inner = if inner { "!" } else { "" }; + let inner = match style { + AttrStyle::Outer => "", + AttrStyle::Inner => "!", + }; if self.word { suggestions.push(format!("#{inner}[{name}]")); } diff --git a/compiler/rustc_hir_typeck/src/expr.rs b/compiler/rustc_hir_typeck/src/expr.rs index 0498a9383663a..940f0e3708d0a 100644 --- a/compiler/rustc_hir_typeck/src/expr.rs +++ b/compiler/rustc_hir_typeck/src/expr.rs @@ -290,6 +290,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { | ExprKind::Let(..) | ExprKind::Loop(..) | ExprKind::Match(..) => {} + // Do not warn on `as` casts from never to any, + // they are sometimes required to appeal typeck. + ExprKind::Cast(_, _) => {} // If `expr` is a result of desugaring the try block and is an ok-wrapped // diverging expression (e.g. it arose from desugaring of `try { return }`), // we skip issuing a warning because it is autogenerated code. diff --git a/compiler/rustc_lint/src/foreign_modules.rs b/compiler/rustc_lint/src/foreign_modules.rs index 759e6c927b828..3267e70f1de26 100644 --- a/compiler/rustc_lint/src/foreign_modules.rs +++ b/compiler/rustc_lint/src/foreign_modules.rs @@ -179,7 +179,7 @@ impl ClashingExternDeclarations { /// symbol's name. fn name_of_extern_decl(tcx: TyCtxt<'_>, fi: hir::OwnerId) -> SymbolName { if let Some((overridden_link_name, overridden_link_name_span)) = - tcx.codegen_fn_attrs(fi).link_name.map(|overridden_link_name| { + tcx.codegen_fn_attrs(fi).symbol_name.map(|overridden_link_name| { // FIXME: Instead of searching through the attributes again to get span // information, we could have codegen_fn_attrs also give span information back for // where the attribute was defined. However, until this is found to be a diff --git a/compiler/rustc_macros/src/print_attribute.rs b/compiler/rustc_macros/src/print_attribute.rs index 9023520c75043..0114e0dfde0db 100644 --- a/compiler/rustc_macros/src/print_attribute.rs +++ b/compiler/rustc_macros/src/print_attribute.rs @@ -4,7 +4,7 @@ use syn::spanned::Spanned; use syn::{Data, Fields, Ident}; use synstructure::Structure; -fn print_fields(name: &Ident, fields: &Fields) -> (TokenStream, TokenStream, TokenStream) { +fn print_fields(name: &Ident, fields: &Fields) -> (TokenStream, TokenStream) { let string_name = name.to_string(); let mut disps = vec![quote! {let mut __printed_anything = false;}]; @@ -43,7 +43,6 @@ fn print_fields(name: &Ident, fields: &Fields) -> (TokenStream, TokenStream, Tok #(#disps)* __p.word("}"); }, - quote! { true }, ) } Fields::Unnamed(fields_unnamed) => { @@ -76,10 +75,9 @@ fn print_fields(name: &Ident, fields: &Fields) -> (TokenStream, TokenStream, Tok #(#disps)* __p.pclose(); }, - quote! { true }, ) } - Fields::Unit => (quote! {}, quote! { __p.word(#string_name) }, quote! { true }), + Fields::Unit => (quote! {}, quote! { __p.word(#string_name) }), } } @@ -89,51 +87,33 @@ pub(crate) fn print_attribute(input: Structure<'_>) -> TokenStream { }; // Must be applied to an enum type. - let (code, printed) = match &input.ast().data { + let code = match &input.ast().data { Data::Enum(e) => { - let (arms, printed) = e + let arms = e .variants .iter() .map(|x| { let ident = &x.ident; - let (pat, code, printed) = print_fields(ident, &x.fields); + let (pat, code) = print_fields(ident, &x.fields); - ( - quote! { - Self::#ident #pat => {#code} - }, - quote! { - Self::#ident #pat => {#printed} - }, - ) + quote! { + Self::#ident #pat => {#code} + } }) - .unzip::<_, _, Vec<_>, Vec<_>>(); + .collect::>(); - ( - quote! { - match self { - #(#arms)* - } - }, - quote! { - match self { - #(#printed)* - } - }, - ) + quote! { + match self { + #(#arms)* + } + } } Data::Struct(s) => { - let (pat, code, printed) = print_fields(&input.ast().ident, &s.fields); - ( - quote! { - let Self #pat = self; - #code - }, - quote! { - let Self #pat = self; - #printed - }, - ) + let (pat, code) = print_fields(&input.ast().ident, &s.fields); + quote! { + let Self #pat = self; + #code + } } Data::Union(u) => { return span_error(u.union_token.span(), "can't derive PrintAttribute on unions"); @@ -144,7 +124,7 @@ pub(crate) fn print_attribute(input: Structure<'_>) -> TokenStream { input.gen_impl(quote! { #[allow(unused)] gen impl PrintAttribute for @Self { - fn should_render(&self) -> bool { #printed } + fn should_render(&self) -> bool { true } fn print_attribute(&self, __p: &mut rustc_ast_pretty::pp::Printer) { #code } } }) diff --git a/compiler/rustc_metadata/src/native_libs.rs b/compiler/rustc_metadata/src/native_libs.rs index 958e314efabb4..63f1b51df1c6b 100644 --- a/compiler/rustc_metadata/src/native_libs.rs +++ b/compiler/rustc_metadata/src/native_libs.rs @@ -701,7 +701,7 @@ impl<'tcx> Collector<'tcx> { .link_ordinal .map_or(import_name_type, |ord| Some(PeImportNameType::Ordinal(ord))); - let name = codegen_fn_attrs.link_name.unwrap_or_else(|| self.tcx.item_name(item)); + let name = codegen_fn_attrs.symbol_name.unwrap_or_else(|| self.tcx.item_name(item)); if self.tcx.sess.target.binary_format == BinaryFormat::Elf { let name = name.as_str(); diff --git a/compiler/rustc_middle/src/middle/codegen_fn_attrs.rs b/compiler/rustc_middle/src/middle/codegen_fn_attrs.rs index 7d2fc0995aa0b..4de7814c8c757 100644 --- a/compiler/rustc_middle/src/middle/codegen_fn_attrs.rs +++ b/compiler/rustc_middle/src/middle/codegen_fn_attrs.rs @@ -35,14 +35,10 @@ pub struct CodegenFnAttrs { pub inline: InlineAttr, /// Parsed representation of the `#[optimize]` attribute pub optimize: OptimizeAttr, - /// The `#[export_name = "..."]` attribute, indicating a custom symbol a - /// function should be exported under - pub export_name: Option, - /// The `#[link_name = "..."]` attribute, indicating a custom symbol an - /// imported function should be imported as. Note that `export_name` - /// probably isn't set when this is set, this is for foreign items while - /// `#[export_name]` is for Rust-defined functions. - pub link_name: Option, + /// The name this function will be imported/exported under. This can be set + /// using the `#[export_name = "..."]` or `#[link_name = "..."]` attribute + /// depending on if this is a function definition or foreign function. + pub symbol_name: Option, /// The `#[link_ordinal = "..."]` attribute, indicating an ordinal an /// imported function has in the dynamic library. Note that this must not /// be set when `link_name` is set. This is for foreign items with the @@ -167,8 +163,7 @@ impl CodegenFnAttrs { flags: CodegenFnAttrFlags::empty(), inline: InlineAttr::None, optimize: OptimizeAttr::Default, - export_name: None, - link_name: None, + symbol_name: None, link_ordinal: None, target_features: vec![], safe_target_features: false, @@ -196,7 +191,7 @@ impl CodegenFnAttrs { self.flags.contains(CodegenFnAttrFlags::NO_MANGLE) || self.flags.contains(CodegenFnAttrFlags::RUSTC_STD_INTERNAL_SYMBOL) - || self.export_name.is_some() + || self.symbol_name.is_some() || match self.linkage { // These are private, so make sure we don't try to consider // them external. diff --git a/compiler/rustc_middle/src/query/on_disk_cache.rs b/compiler/rustc_middle/src/query/on_disk_cache.rs index a7ac34428986e..546791135ba61 100644 --- a/compiler/rustc_middle/src/query/on_disk_cache.rs +++ b/compiler/rustc_middle/src/query/on_disk_cache.rs @@ -645,34 +645,29 @@ impl<'a, 'tcx> SpanDecoder for CacheDecoder<'a, 'tcx> { let parent = Option::::decode(self); let tag: u8 = Decodable::decode(self); - if tag == TAG_PARTIAL_SPAN { - return Span::new(BytePos(0), BytePos(0), ctxt, parent); - } else if tag == TAG_RELATIVE_SPAN { - let dlo = u32::decode(self); - let dto = u32::decode(self); - - let enclosing = self.tcx.source_span_untracked(parent.unwrap()).data_untracked(); - let span = Span::new( - enclosing.lo + BytePos::from_u32(dlo), - enclosing.lo + BytePos::from_u32(dto), - ctxt, - parent, - ); - - return span; - } else { - debug_assert_eq!(tag, TAG_FULL_SPAN); - } - - let file_lo_index = SourceFileIndex::decode(self); - let line_lo = usize::decode(self); - let col_lo = RelativeBytePos::decode(self); - let len = BytePos::decode(self); - - let file_lo = self.file_index_to_file(file_lo_index); - let lo = file_lo.lines()[line_lo - 1] + col_lo; - let lo = file_lo.absolute_position(lo); - let hi = lo + len; + let (lo, hi) = match tag { + TAG_PARTIAL_SPAN => (BytePos(0), BytePos(0)), + TAG_RELATIVE_SPAN => { + let dlo = u32::decode(self); + let dto = u32::decode(self); + + let enclosing = self.tcx.source_span_untracked(parent.unwrap()).data_untracked(); + (enclosing.lo + BytePos::from_u32(dlo), enclosing.lo + BytePos::from_u32(dto)) + } + TAG_FULL_SPAN => { + let file_lo_index = SourceFileIndex::decode(self); + let line_lo = usize::decode(self); + let col_lo = RelativeBytePos::decode(self); + let len = BytePos::decode(self); + + let file_lo = self.file_index_to_file(file_lo_index); + let lo = file_lo.lines()[line_lo - 1] + col_lo; + let lo = file_lo.absolute_position(lo); + let hi = lo + len; + (lo, hi) + } + _ => unreachable!(), + }; Span::new(lo, hi, ctxt, parent) } diff --git a/compiler/rustc_next_trait_solver/src/canonicalizer.rs b/compiler/rustc_next_trait_solver/src/canonicalizer.rs index 1bc35e599c706..3e1f48610ffc0 100644 --- a/compiler/rustc_next_trait_solver/src/canonicalizer.rs +++ b/compiler/rustc_next_trait_solver/src/canonicalizer.rs @@ -27,7 +27,7 @@ enum CanonicalizeInputKind { ParamEnv, /// When canonicalizing predicates, we don't keep `'static`. If we're /// currently outside of the trait solver and canonicalize the root goal - /// during HIR typeck, we replace each occurance of a region with a + /// during HIR typeck, we replace each occurrence of a region with a /// unique region variable. See the comment on `InferCtxt::in_hir_typeck` /// for more details. Predicate { is_hir_typeck_root_goal: bool }, diff --git a/compiler/rustc_passes/messages.ftl b/compiler/rustc_passes/messages.ftl index 7481b0ea96018..4407a87350094 100644 --- a/compiler/rustc_passes/messages.ftl +++ b/compiler/rustc_passes/messages.ftl @@ -422,10 +422,6 @@ passes_must_not_suspend = `must_not_suspend` attribute should be applied to a struct, enum, union, or trait .label = is not a struct, enum, union, or trait -passes_must_use_no_effect = - `#[must_use]` has no effect when applied to {$target} - .suggestion = remove the attribute - passes_no_link = attribute should be applied to an `extern crate` item .label = not an `extern crate` item diff --git a/compiler/rustc_passes/src/check_attr.rs b/compiler/rustc_passes/src/check_attr.rs index 0e28c51e981f8..7f31557a89af3 100644 --- a/compiler/rustc_passes/src/check_attr.rs +++ b/compiler/rustc_passes/src/check_attr.rs @@ -194,9 +194,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> { Attribute::Parsed(AttributeKind::MayDangle(attr_span)) => { self.check_may_dangle(hir_id, *attr_span) } - Attribute::Parsed(AttributeKind::MustUse { span, .. }) => { - self.check_must_use(hir_id, *span, target) - } Attribute::Parsed( AttributeKind::BodyStability { .. } | AttributeKind::ConstStabilityIndirect @@ -246,7 +243,8 @@ impl<'tcx> CheckAttrVisitor<'tcx> { | AttributeKind::Coverage (..) | AttributeKind::ShouldPanic { .. } | AttributeKind::Coroutine(..) - | AttributeKind::Linkage(..), + | AttributeKind::Linkage(..) + | AttributeKind::MustUse { .. }, ) => { /* do nothing */ } Attribute::Unparsed(attr_item) => { @@ -1259,41 +1257,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> { } } - /// Warns against some misuses of `#[must_use]` - fn check_must_use(&self, hir_id: HirId, attr_span: Span, target: Target) { - if matches!( - target, - Target::Fn - | Target::Enum - | Target::Struct - | Target::Union - | Target::Method(MethodKind::Trait { body: false } | MethodKind::Inherent) - | Target::ForeignFn - // `impl Trait` in return position can trip - // `unused_must_use` if `Trait` is marked as - // `#[must_use]` - | Target::Trait - ) { - return; - } - - // `#[must_use]` can be applied to a trait method definition with a default body - if let Target::Method(MethodKind::Trait { body: true }) = target - && let parent_def_id = self.tcx.hir_get_parent_item(hir_id).def_id - && let containing_item = self.tcx.hir_expect_item(parent_def_id) - && let hir::ItemKind::Trait(..) = containing_item.kind - { - return; - } - - self.tcx.emit_node_span_lint( - UNUSED_ATTRIBUTES, - hir_id, - attr_span, - errors::MustUseNoEffect { target: target.plural_name(), attr_span }, - ); - } - /// Checks if `#[must_not_suspend]` is applied to a struct, enum, union, or trait. fn check_must_not_suspend(&self, attr: &Attribute, span: Span, target: Target) { match target { diff --git a/compiler/rustc_passes/src/errors.rs b/compiler/rustc_passes/src/errors.rs index c5d5155d0e5a5..1f724def55f36 100644 --- a/compiler/rustc_passes/src/errors.rs +++ b/compiler/rustc_passes/src/errors.rs @@ -357,14 +357,6 @@ pub(crate) struct BothFfiConstAndPure { pub attr_span: Span, } -#[derive(LintDiagnostic)] -#[diag(passes_must_use_no_effect)] -pub(crate) struct MustUseNoEffect { - pub target: &'static str, - #[suggestion(code = "", applicability = "machine-applicable", style = "tool-only")] - pub attr_span: Span, -} - #[derive(Diagnostic)] #[diag(passes_must_not_suspend)] pub(crate) struct MustNotSuspend { diff --git a/compiler/rustc_resolve/src/imports.rs b/compiler/rustc_resolve/src/imports.rs index 7c93fdb88ee44..2ecabb33763cc 100644 --- a/compiler/rustc_resolve/src/imports.rs +++ b/compiler/rustc_resolve/src/imports.rs @@ -866,7 +866,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { } ImportKind::Glob { .. } => { // FIXME: Use mutable resolver directly as a hack, this should be an output of - // specualtive resolution. + // speculative resolution. self.get_mut_unchecked().resolve_glob_import(import); return 0; } @@ -903,7 +903,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { // We need the `target`, `source` can be extracted. let imported_binding = this.import(binding, import); // FIXME: Use mutable resolver directly as a hack, this should be an output of - // specualtive resolution. + // speculative resolution. this.get_mut_unchecked().define_binding_local( parent, target, @@ -917,7 +917,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { if target.name != kw::Underscore { let key = BindingKey::new(target, ns); // FIXME: Use mutable resolver directly as a hack, this should be an output of - // specualtive resolution. + // speculative resolution. this.get_mut_unchecked().update_local_resolution( parent, key, diff --git a/compiler/rustc_resolve/src/late.rs b/compiler/rustc_resolve/src/late.rs index 5200f9340e115..679e663f88614 100644 --- a/compiler/rustc_resolve/src/late.rs +++ b/compiler/rustc_resolve/src/late.rs @@ -4270,7 +4270,7 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> { if path.len() == 2 && let [segment] = prefix_path { - // Delay to check whether methond name is an associated function or not + // Delay to check whether method name is an associated function or not // ``` // let foo = Foo {}; // foo::bar(); // possibly suggest to foo.bar(); diff --git a/compiler/rustc_span/src/caching_source_map_view.rs b/compiler/rustc_span/src/caching_source_map_view.rs index a887b50ec1ebe..41cfaa3ee34e5 100644 --- a/compiler/rustc_span/src/caching_source_map_view.rs +++ b/compiler/rustc_span/src/caching_source_map_view.rs @@ -123,27 +123,25 @@ impl<'sm> CachingSourceMapView<'sm> { if lo_cache_idx != -1 && hi_cache_idx != -1 { // Cache hit for span lo and hi. Check if they belong to the same file. - let result = { - let lo = &self.line_cache[lo_cache_idx as usize]; - let hi = &self.line_cache[hi_cache_idx as usize]; + let lo_file_index = self.line_cache[lo_cache_idx as usize].file_index; + let hi_file_index = self.line_cache[hi_cache_idx as usize].file_index; - if lo.file_index != hi.file_index { - return None; - } - - ( - lo.file.stable_id, - lo.line_number, - span_data.lo - lo.line.start, - hi.line_number, - span_data.hi - hi.line.start, - ) - }; + if lo_file_index != hi_file_index { + return None; + } self.line_cache[lo_cache_idx as usize].touch(self.time_stamp); self.line_cache[hi_cache_idx as usize].touch(self.time_stamp); - return Some(result); + let lo = &self.line_cache[lo_cache_idx as usize]; + let hi = &self.line_cache[hi_cache_idx as usize]; + return Some(( + lo.file.stable_id, + lo.line_number, + span_data.lo - lo.line.start, + hi.line_number, + span_data.hi - hi.line.start, + )); } // No cache hit or cache hit for only one of span lo and hi. diff --git a/compiler/rustc_symbol_mangling/src/lib.rs b/compiler/rustc_symbol_mangling/src/lib.rs index f3c96f641902e..d97ee95652530 100644 --- a/compiler/rustc_symbol_mangling/src/lib.rs +++ b/compiler/rustc_symbol_mangling/src/lib.rs @@ -193,29 +193,20 @@ fn compute_symbol_name<'tcx>( // defining crate. // Weak lang items automatically get #[rustc_std_internal_symbol] // applied by the code computing the CodegenFnAttrs. - // We are mangling all #[rustc_std_internal_symbol] items that don't - // also have #[no_mangle] as a combination of the rustc version and the - // unmangled linkage name. This is to ensure that if we link against a - // staticlib compiled by a different rustc version, we don't get symbol - // conflicts or even UB due to a different implementation/ABI. Rust - // staticlibs currently export all symbols, including those that are - // hidden in cdylibs. + // We are mangling all #[rustc_std_internal_symbol] items as a + // combination of the rustc version and the unmangled linkage name. + // This is to ensure that if we link against a staticlib compiled by a + // different rustc version, we don't get symbol conflicts or even UB + // due to a different implementation/ABI. Rust staticlibs currently + // export all symbols, including those that are hidden in cdylibs. // We are using the v0 symbol mangling scheme here as we need to be // consistent across all crates and in some contexts the legacy symbol // mangling scheme can't be used. For example both the GCC backend and // Rust-for-Linux don't support some of the characters used by the // legacy symbol mangling scheme. - let name = if tcx.is_foreign_item(def_id) { - if let Some(name) = attrs.link_name { name } else { tcx.item_name(def_id) } - } else { - if let Some(name) = attrs.export_name { name } else { tcx.item_name(def_id) } - }; + let name = if let Some(name) = attrs.symbol_name { name } else { tcx.item_name(def_id) }; - if attrs.flags.contains(CodegenFnAttrFlags::NO_MANGLE) { - return name.to_string(); - } else { - return v0::mangle_internal_symbol(tcx, name.as_str()); - } + return v0::mangle_internal_symbol(tcx, name.as_str()); } let wasm_import_module_exception_force_mangling = { @@ -240,23 +231,16 @@ fn compute_symbol_name<'tcx>( && tcx.wasm_import_module_map(LOCAL_CRATE).contains_key(&def_id.into()) }; - if let Some(name) = attrs.link_name - && !wasm_import_module_exception_force_mangling - { - // Use provided name - return name.to_string(); - } - - if let Some(name) = attrs.export_name { - // Use provided name - return name.to_string(); - } + if !wasm_import_module_exception_force_mangling { + if let Some(name) = attrs.symbol_name { + // Use provided name + return name.to_string(); + } - if attrs.flags.contains(CodegenFnAttrFlags::NO_MANGLE) - && !wasm_import_module_exception_force_mangling - { - // Don't mangle - return tcx.item_name(def_id).to_string(); + if attrs.flags.contains(CodegenFnAttrFlags::NO_MANGLE) { + // Don't mangle + return tcx.item_name(def_id).to_string(); + } } // If we're dealing with an instance of a function that's inlined from diff --git a/library/Cargo.lock b/library/Cargo.lock index 4b06f14c7eea7..d029617048f5f 100644 --- a/library/Cargo.lock +++ b/library/Cargo.lock @@ -140,9 +140,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.174" +version = "0.2.175" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1171693293099992e19cddea4e8b849964e9846f4acee11b3948bcc337be8776" +checksum = "6a82ae493e598baaea5209805c49bbf2ea7de956d50d7da0da1164f9c6d28543" dependencies = [ "rustc-std-workspace-core", ] @@ -169,9 +169,9 @@ dependencies = [ [[package]] name = "object" -version = "0.37.2" +version = "0.37.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3e3d0a7419f081f4a808147e845310313a39f322d7ae1f996b7f001d6cbed04" +checksum = "ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe" dependencies = [ "memchr", "rustc-std-workspace-alloc", @@ -337,7 +337,6 @@ name = "std_detect" version = "0.1.5" dependencies = [ "alloc", - "cfg-if", "core", "libc", ] @@ -376,7 +375,6 @@ dependencies = [ name = "unwind" version = "0.0.0" dependencies = [ - "cfg-if", "libc", "rustc-std-workspace-core", "unwinding", diff --git a/library/core/src/net/ip_addr.rs b/library/core/src/net/ip_addr.rs index 87f2110034c5a..3bf113d017ca9 100644 --- a/library/core/src/net/ip_addr.rs +++ b/library/core/src/net/ip_addr.rs @@ -626,13 +626,13 @@ impl Ipv4Addr { /// # Examples /// /// ``` - /// #![feature(ip_from)] /// use std::net::Ipv4Addr; /// /// let addr = Ipv4Addr::from_octets([13u8, 12u8, 11u8, 10u8]); /// assert_eq!(Ipv4Addr::new(13, 12, 11, 10), addr); /// ``` - #[unstable(feature = "ip_from", issue = "131360")] + #[stable(feature = "ip_from", since = "CURRENT_RUSTC_VERSION")] + #[rustc_const_stable(feature = "ip_from", since = "CURRENT_RUSTC_VERSION")] #[must_use] #[inline] pub const fn from_octets(octets: [u8; 4]) -> Ipv4Addr { @@ -1464,7 +1464,6 @@ impl Ipv6Addr { /// # Examples /// /// ``` - /// #![feature(ip_from)] /// use std::net::Ipv6Addr; /// /// let addr = Ipv6Addr::from_segments([ @@ -1479,7 +1478,8 @@ impl Ipv6Addr { /// addr /// ); /// ``` - #[unstable(feature = "ip_from", issue = "131360")] + #[stable(feature = "ip_from", since = "CURRENT_RUSTC_VERSION")] + #[rustc_const_stable(feature = "ip_from", since = "CURRENT_RUSTC_VERSION")] #[must_use] #[inline] pub const fn from_segments(segments: [u16; 8]) -> Ipv6Addr { @@ -2029,7 +2029,6 @@ impl Ipv6Addr { /// # Examples /// /// ``` - /// #![feature(ip_from)] /// use std::net::Ipv6Addr; /// /// let addr = Ipv6Addr::from_octets([ @@ -2044,7 +2043,8 @@ impl Ipv6Addr { /// addr /// ); /// ``` - #[unstable(feature = "ip_from", issue = "131360")] + #[stable(feature = "ip_from", since = "CURRENT_RUSTC_VERSION")] + #[rustc_const_stable(feature = "ip_from", since = "CURRENT_RUSTC_VERSION")] #[must_use] #[inline] pub const fn from_octets(octets: [u8; 16]) -> Ipv6Addr { diff --git a/library/coretests/tests/lib.rs b/library/coretests/tests/lib.rs index ecda8a7fec68f..b128acfc00083 100644 --- a/library/coretests/tests/lib.rs +++ b/library/coretests/tests/lib.rs @@ -56,7 +56,6 @@ #![feature(hashmap_internals)] #![feature(int_roundings)] #![feature(ip)] -#![feature(ip_from)] #![feature(is_ascii_octdigit)] #![feature(isolate_most_least_significant_one)] #![feature(iter_advance_by)] diff --git a/library/std/Cargo.toml b/library/std/Cargo.toml index 7bc52976500dd..eff2562f03197 100644 --- a/library/std/Cargo.toml +++ b/library/std/Cargo.toml @@ -14,6 +14,7 @@ crate-type = ["dylib", "rlib"] [dependencies] alloc = { path = "../alloc", public = true } +# std no longer uses cfg-if directly, but the included copy of backtrace does. cfg-if = { version = "1.0", features = ['rustc-dep-of-std'] } panic_unwind = { path = "../panic_unwind", optional = true } panic_abort = { path = "../panic_abort" } diff --git a/library/std/src/io/copy.rs b/library/std/src/io/copy.rs index 15e962924ac71..d060ad528973f 100644 --- a/library/std/src/io/copy.rs +++ b/library/std/src/io/copy.rs @@ -63,10 +63,11 @@ where R: Read, W: Write, { - cfg_if::cfg_if! { - if #[cfg(any(target_os = "linux", target_os = "android"))] { + cfg_select! { + any(target_os = "linux", target_os = "android") => { crate::sys::kernel_copy::copy_spec(reader, writer) - } else { + } + _ => { generic_copy(reader, writer) } } diff --git a/library/std/src/lib.rs b/library/std/src/lib.rs index f111fcb4a4712..c27167767a224 100644 --- a/library/std/src/lib.rs +++ b/library/std/src/lib.rs @@ -330,6 +330,7 @@ #![feature(bstr)] #![feature(bstr_internals)] #![feature(cast_maybe_uninit)] +#![feature(cfg_select)] #![feature(char_internals)] #![feature(clone_to_uninit)] #![feature(const_cmp)] diff --git a/library/std/src/os/unix/net/stream.rs b/library/std/src/os/unix/net/stream.rs index 035768a6fab7a..768fa77a5f8cd 100644 --- a/library/std/src/os/unix/net/stream.rs +++ b/library/std/src/os/unix/net/stream.rs @@ -1,14 +1,16 @@ -cfg_if::cfg_if! { - if #[cfg(any( +cfg_select! { + any( target_os = "linux", target_os = "android", target_os = "hurd", target_os = "dragonfly", target_os = "freebsd", target_os = "openbsd", target_os = "netbsd", target_os = "solaris", target_os = "illumos", target_os = "haiku", target_os = "nto", - target_os = "cygwin"))] { + target_os = "cygwin", + ) => { use libc::MSG_NOSIGNAL; - } else { + } + _ => { const MSG_NOSIGNAL: core::ffi::c_int = 0x0; } } diff --git a/library/std/src/os/unix/process.rs b/library/std/src/os/unix/process.rs index 76e63a69e45da..09429af06e386 100644 --- a/library/std/src/os/unix/process.rs +++ b/library/std/src/os/unix/process.rs @@ -4,8 +4,6 @@ #![stable(feature = "rust1", since = "1.0.0")] -use cfg_if::cfg_if; - use crate::ffi::OsStr; use crate::os::unix::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, OwnedFd, RawFd}; use crate::path::Path; @@ -13,17 +11,19 @@ use crate::sealed::Sealed; use crate::sys_common::{AsInner, AsInnerMut, FromInner, IntoInner}; use crate::{io, process, sys}; -cfg_if! { - if #[cfg(any(target_os = "vxworks", target_os = "espidf", target_os = "horizon", target_os = "vita"))] { +cfg_select! { + any(target_os = "vxworks", target_os = "espidf", target_os = "horizon", target_os = "vita") => { type UserId = u16; type GroupId = u16; - } else if #[cfg(target_os = "nto")] { + } + target_os = "nto" => { // Both IDs are signed, see `sys/target_nto.h` of the QNX Neutrino SDP. // Only positive values should be used, see e.g. // https://www.qnx.com/developers/docs/7.1/#com.qnx.doc.neutrino.lib_ref/topic/s/setuid.html type UserId = i32; type GroupId = i32; - } else { + } + _ => { type UserId = u32; type GroupId = u32; } diff --git a/library/std/src/path.rs b/library/std/src/path.rs index 3b52804d6be40..23e957484a5ad 100644 --- a/library/std/src/path.rs +++ b/library/std/src/path.rs @@ -2105,6 +2105,38 @@ impl PartialEq for PathBuf { } } +#[stable(feature = "eq_str_for_path", since = "CURRENT_RUSTC_VERSION")] +impl cmp::PartialEq for PathBuf { + #[inline] + fn eq(&self, other: &str) -> bool { + &*self == other + } +} + +#[stable(feature = "eq_str_for_path", since = "CURRENT_RUSTC_VERSION")] +impl cmp::PartialEq for str { + #[inline] + fn eq(&self, other: &PathBuf) -> bool { + other == self + } +} + +#[stable(feature = "eq_str_for_path", since = "CURRENT_RUSTC_VERSION")] +impl cmp::PartialEq for PathBuf { + #[inline] + fn eq(&self, other: &String) -> bool { + **self == **other + } +} + +#[stable(feature = "eq_str_for_path", since = "CURRENT_RUSTC_VERSION")] +impl cmp::PartialEq for String { + #[inline] + fn eq(&self, other: &PathBuf) -> bool { + other == self + } +} + #[stable(feature = "rust1", since = "1.0.0")] impl Hash for PathBuf { fn hash(&self, h: &mut H) { @@ -3366,6 +3398,39 @@ impl PartialEq for Path { } } +#[stable(feature = "eq_str_for_path", since = "CURRENT_RUSTC_VERSION")] +impl cmp::PartialEq for Path { + #[inline] + fn eq(&self, other: &str) -> bool { + let other: &OsStr = other.as_ref(); + self == other + } +} + +#[stable(feature = "eq_str_for_path", since = "CURRENT_RUSTC_VERSION")] +impl cmp::PartialEq for str { + #[inline] + fn eq(&self, other: &Path) -> bool { + other == self + } +} + +#[stable(feature = "eq_str_for_path", since = "CURRENT_RUSTC_VERSION")] +impl cmp::PartialEq for Path { + #[inline] + fn eq(&self, other: &String) -> bool { + self == &*other + } +} + +#[stable(feature = "eq_str_for_path", since = "CURRENT_RUSTC_VERSION")] +impl cmp::PartialEq for String { + #[inline] + fn eq(&self, other: &Path) -> bool { + other == self + } +} + #[stable(feature = "rust1", since = "1.0.0")] impl Hash for Path { fn hash(&self, h: &mut H) { diff --git a/library/std/src/sync/nonpoison/mutex.rs b/library/std/src/sync/nonpoison/mutex.rs index b6861c78f001d..fd1e671d7a3d3 100644 --- a/library/std/src/sync/nonpoison/mutex.rs +++ b/library/std/src/sync/nonpoison/mutex.rs @@ -100,7 +100,7 @@ pub struct MutexGuard<'a, T: ?Sized + 'a> { lock: &'a Mutex, } -/// A [`MutexGuard`] is not `Send` to maximize platform portablity. +/// A [`MutexGuard`] is not `Send` to maximize platform portability. /// /// On platforms that use POSIX threads (commonly referred to as pthreads) there is a requirement to /// release mutex locks on the same thread they were acquired. diff --git a/library/std/src/sync/poison/mutex.rs b/library/std/src/sync/poison/mutex.rs index 6205c4fa4ca4b..720c212c65cf7 100644 --- a/library/std/src/sync/poison/mutex.rs +++ b/library/std/src/sync/poison/mutex.rs @@ -279,7 +279,7 @@ pub struct MutexGuard<'a, T: ?Sized + 'a> { poison: poison::Guard, } -/// A [`MutexGuard`] is not `Send` to maximize platform portablity. +/// A [`MutexGuard`] is not `Send` to maximize platform portability. /// /// On platforms that use POSIX threads (commonly referred to as pthreads) there is a requirement to /// release mutex locks on the same thread they were acquired. diff --git a/library/std/src/sync/reentrant_lock.rs b/library/std/src/sync/reentrant_lock.rs index 727252f03a24e..4140718560c65 100644 --- a/library/std/src/sync/reentrant_lock.rs +++ b/library/std/src/sync/reentrant_lock.rs @@ -1,5 +1,3 @@ -use cfg_if::cfg_if; - use crate::cell::UnsafeCell; use crate::fmt; use crate::ops::Deref; @@ -87,8 +85,8 @@ pub struct ReentrantLock { data: T, } -cfg_if!( - if #[cfg(target_has_atomic = "64")] { +cfg_select!( + target_has_atomic = "64" => { use crate::sync::atomic::{Atomic, AtomicU64, Ordering::Relaxed}; struct Tid(Atomic); @@ -110,7 +108,8 @@ cfg_if!( self.0.store(value, Relaxed); } } - } else { + } + _ => { /// Returns the address of a TLS variable. This is guaranteed to /// be unique across all currently alive threads. fn tls_addr() -> usize { diff --git a/library/std/src/sys/alloc/mod.rs b/library/std/src/sys/alloc/mod.rs index f3af1f7f5991e..6d4b09494a3f5 100644 --- a/library/std/src/sys/alloc/mod.rs +++ b/library/std/src/sys/alloc/mod.rs @@ -68,29 +68,37 @@ unsafe fn realloc_fallback( } } -cfg_if::cfg_if! { - if #[cfg(any( +cfg_select! { + any( target_family = "unix", target_os = "wasi", target_os = "teeos", target_os = "trusty", - ))] { + ) => { mod unix; - } else if #[cfg(target_os = "windows")] { + } + target_os = "windows" => { mod windows; - } else if #[cfg(target_os = "hermit")] { + } + target_os = "hermit" => { mod hermit; - } else if #[cfg(all(target_vendor = "fortanix", target_env = "sgx"))] { + } + all(target_vendor = "fortanix", target_env = "sgx") => { mod sgx; - } else if #[cfg(target_os = "solid_asp3")] { + } + target_os = "solid_asp3" => { mod solid; - } else if #[cfg(target_os = "uefi")] { + } + target_os = "uefi" => { mod uefi; - } else if #[cfg(target_family = "wasm")] { + } + target_family = "wasm" => { mod wasm; - } else if #[cfg(target_os = "xous")] { + } + target_os = "xous" => { mod xous; - } else if #[cfg(target_os = "zkvm")] { + } + target_os = "zkvm" => { mod zkvm; } } diff --git a/library/std/src/sys/alloc/unix.rs b/library/std/src/sys/alloc/unix.rs index a7ac4117ec902..3d369b08abc77 100644 --- a/library/std/src/sys/alloc/unix.rs +++ b/library/std/src/sys/alloc/unix.rs @@ -58,18 +58,16 @@ unsafe impl GlobalAlloc for System { } } -cfg_if::cfg_if! { +cfg_select! { // We use posix_memalign wherever possible, but some targets have very incomplete POSIX coverage // so we need a fallback for those. - if #[cfg(any( - target_os = "horizon", - target_os = "vita", - ))] { + any(target_os = "horizon", target_os = "vita") => { #[inline] unsafe fn aligned_malloc(layout: &Layout) -> *mut u8 { unsafe { libc::memalign(layout.align(), layout.size()) as *mut u8 } } - } else { + } + _ => { #[inline] #[cfg_attr(target_os = "vxworks", allow(unused_unsafe))] unsafe fn aligned_malloc(layout: &Layout) -> *mut u8 { diff --git a/library/std/src/sys/anonymous_pipe/mod.rs b/library/std/src/sys/anonymous_pipe/mod.rs index aa14c8b650d34..b6f464161ee2b 100644 --- a/library/std/src/sys/anonymous_pipe/mod.rs +++ b/library/std/src/sys/anonymous_pipe/mod.rs @@ -1,13 +1,15 @@ #![forbid(unsafe_op_in_unsafe_fn)] -cfg_if::cfg_if! { - if #[cfg(unix)] { +cfg_select! { + unix => { mod unix; pub use unix::{AnonPipe, pipe}; - } else if #[cfg(windows)] { + } + windows => { mod windows; pub use windows::{AnonPipe, pipe}; - } else { + } + _ => { mod unsupported; pub use unsupported::{AnonPipe, pipe}; } diff --git a/library/std/src/sys/args/mod.rs b/library/std/src/sys/args/mod.rs index 0011f55dc14ee..c9627322276d0 100644 --- a/library/std/src/sys/args/mod.rs +++ b/library/std/src/sys/args/mod.rs @@ -12,32 +12,39 @@ ))] mod common; -cfg_if::cfg_if! { - if #[cfg(any( +cfg_select! { + any( all(target_family = "unix", not(any(target_os = "espidf", target_os = "vita"))), target_os = "hermit", - ))] { + ) => { mod unix; pub use unix::*; - } else if #[cfg(target_family = "windows")] { + } + target_family = "windows" => { mod windows; pub use windows::*; - } else if #[cfg(all(target_vendor = "fortanix", target_env = "sgx"))] { + } + all(target_vendor = "fortanix", target_env = "sgx") => { mod sgx; pub use sgx::*; - } else if #[cfg(target_os = "uefi")] { + } + target_os = "uefi" => { mod uefi; pub use uefi::*; - } else if #[cfg(target_os = "wasi")] { + } + target_os = "wasi" => { mod wasi; pub use wasi::*; - } else if #[cfg(target_os = "xous")] { + } + target_os = "xous" => { mod xous; pub use xous::*; - } else if #[cfg(target_os = "zkvm")] { + } + target_os = "zkvm" => { mod zkvm; pub use zkvm::*; - } else { + } + _ => { mod unsupported; pub use unsupported::*; } diff --git a/library/std/src/sys/cmath.rs b/library/std/src/sys/cmath.rs index 299ce1a6ff063..1592218ead8b0 100644 --- a/library/std/src/sys/cmath.rs +++ b/library/std/src/sys/cmath.rs @@ -45,69 +45,70 @@ unsafe extern "C" { pub safe fn lgammaf128_r(n: f128, s: &mut i32) -> f128; pub safe fn erff128(n: f128) -> f128; pub safe fn erfcf128(n: f128) -> f128; - - cfg_if::cfg_if! { - if #[cfg(not(all(target_os = "windows", target_env = "msvc", target_arch = "x86")))] { - pub safe fn acosf(n: f32) -> f32; - pub safe fn asinf(n: f32) -> f32; - pub safe fn atan2f(a: f32, b: f32) -> f32; - pub safe fn atanf(n: f32) -> f32; - pub safe fn coshf(n: f32) -> f32; - pub safe fn sinhf(n: f32) -> f32; - pub safe fn tanf(n: f32) -> f32; - pub safe fn tanhf(n: f32) -> f32; - }} } -// On AIX, we don't have lgammaf_r only the f64 version, so we can -// use the f64 version lgamma_r -#[cfg(target_os = "aix")] -pub fn lgammaf_r(n: f32, s: &mut i32) -> f32 { - lgamma_r(n.into(), s) as f32 -} +cfg_select! { + all(target_os = "windows", target_env = "msvc", target_arch = "x86") => { + // On 32-bit x86 MSVC these functions aren't defined, so we just define shims + // which promote everything to f64, perform the calculation, and then demote + // back to f32. While not precisely correct should be "correct enough" for now. + #[inline] + pub fn acosf(n: f32) -> f32 { + f64::acos(n as f64) as f32 + } -// On 32-bit x86 MSVC these functions aren't defined, so we just define shims -// which promote everything to f64, perform the calculation, and then demote -// back to f32. While not precisely correct should be "correct enough" for now. -cfg_if::cfg_if! { -if #[cfg(all(target_os = "windows", target_env = "msvc", target_arch = "x86"))] { - #[inline] - pub fn acosf(n: f32) -> f32 { - f64::acos(n as f64) as f32 - } + #[inline] + pub fn asinf(n: f32) -> f32 { + f64::asin(n as f64) as f32 + } - #[inline] - pub fn asinf(n: f32) -> f32 { - f64::asin(n as f64) as f32 - } + #[inline] + pub fn atan2f(n: f32, b: f32) -> f32 { + f64::atan2(n as f64, b as f64) as f32 + } - #[inline] - pub fn atan2f(n: f32, b: f32) -> f32 { - f64::atan2(n as f64, b as f64) as f32 - } + #[inline] + pub fn atanf(n: f32) -> f32 { + f64::atan(n as f64) as f32 + } - #[inline] - pub fn atanf(n: f32) -> f32 { - f64::atan(n as f64) as f32 - } + #[inline] + pub fn coshf(n: f32) -> f32 { + f64::cosh(n as f64) as f32 + } - #[inline] - pub fn coshf(n: f32) -> f32 { - f64::cosh(n as f64) as f32 - } + #[inline] + pub fn sinhf(n: f32) -> f32 { + f64::sinh(n as f64) as f32 + } - #[inline] - pub fn sinhf(n: f32) -> f32 { - f64::sinh(n as f64) as f32 - } + #[inline] + pub fn tanf(n: f32) -> f32 { + f64::tan(n as f64) as f32 + } - #[inline] - pub fn tanf(n: f32) -> f32 { - f64::tan(n as f64) as f32 + #[inline] + pub fn tanhf(n: f32) -> f32 { + f64::tanh(n as f64) as f32 + } } - - #[inline] - pub fn tanhf(n: f32) -> f32 { - f64::tanh(n as f64) as f32 + _ => { + unsafe extern "C" { + pub safe fn acosf(n: f32) -> f32; + pub safe fn asinf(n: f32) -> f32; + pub safe fn atan2f(a: f32, b: f32) -> f32; + pub safe fn atanf(n: f32) -> f32; + pub safe fn coshf(n: f32) -> f32; + pub safe fn sinhf(n: f32) -> f32; + pub safe fn tanf(n: f32) -> f32; + pub safe fn tanhf(n: f32) -> f32; + } } -}} +} + +// On AIX, we don't have lgammaf_r only the f64 version, so we can +// use the f64 version lgamma_r +#[cfg(target_os = "aix")] +pub fn lgammaf_r(n: f32, s: &mut i32) -> f32 { + lgamma_r(n.into(), s) as f32 +} diff --git a/library/std/src/sys/env/mod.rs b/library/std/src/sys/env/mod.rs index d81ff875c830f..f211a9fc86b3b 100644 --- a/library/std/src/sys/env/mod.rs +++ b/library/std/src/sys/env/mod.rs @@ -13,35 +13,44 @@ ))] mod common; -cfg_if::cfg_if! { - if #[cfg(target_family = "unix")] { +cfg_select! { + target_family = "unix" => { mod unix; pub use unix::*; - } else if #[cfg(target_family = "windows")] { + } + target_family = "windows" => { mod windows; pub use windows::*; - } else if #[cfg(target_os = "hermit")] { + } + target_os = "hermit" => { mod hermit; pub use hermit::*; - } else if #[cfg(all(target_vendor = "fortanix", target_env = "sgx"))] { + } + all(target_vendor = "fortanix", target_env = "sgx") => { mod sgx; pub use sgx::*; - } else if #[cfg(target_os = "solid_asp3")] { + } + target_os = "solid_asp3" => { mod solid; pub use solid::*; - } else if #[cfg(target_os = "uefi")] { + } + target_os = "uefi" => { mod uefi; pub use uefi::*; - } else if #[cfg(target_os = "wasi")] { + } + target_os = "wasi" => { mod wasi; pub use wasi::*; - } else if #[cfg(target_os = "xous")] { + } + target_os = "xous" => { mod xous; pub use xous::*; - } else if #[cfg(target_os = "zkvm")] { + } + target_os = "zkvm" => { mod zkvm; pub use zkvm::*; - } else { + } + _ => { mod unsupported; pub use unsupported::*; } diff --git a/library/std/src/sys/env/wasi.rs b/library/std/src/sys/env/wasi.rs index 3719f9db51eb3..1327cbc3263b8 100644 --- a/library/std/src/sys/env/wasi.rs +++ b/library/std/src/sys/env/wasi.rs @@ -7,8 +7,8 @@ use crate::os::wasi::prelude::*; use crate::sys::common::small_c_string::run_with_cstr; use crate::sys::pal::os::{cvt, libc}; -cfg_if::cfg_if! { - if #[cfg(target_feature = "atomics")] { +cfg_select! { + target_feature = "atomics" => { // Access to the environment must be protected by a lock in multi-threaded scenarios. use crate::sync::{PoisonError, RwLock}; static ENV_LOCK: RwLock<()> = RwLock::new(()); @@ -18,7 +18,8 @@ cfg_if::cfg_if! { pub fn env_write_lock() -> impl Drop { ENV_LOCK.write().unwrap_or_else(PoisonError::into_inner) } - } else { + } + _ => { // No need for a lock if we are single-threaded. pub fn env_read_lock() -> impl Drop { Box::new(()) diff --git a/library/std/src/sys/exit_guard.rs b/library/std/src/sys/exit_guard.rs index bd70d1782440f..00b91842e9dba 100644 --- a/library/std/src/sys/exit_guard.rs +++ b/library/std/src/sys/exit_guard.rs @@ -1,5 +1,5 @@ -cfg_if::cfg_if! { - if #[cfg(target_os = "linux")] { +cfg_select! { + target_os = "linux" => { /// Mitigation for /// /// On glibc, `libc::exit` has been observed to not always be thread-safe. @@ -56,7 +56,8 @@ cfg_if::cfg_if! { } } } - } else { + } + _ => { /// Mitigation for /// /// Mitigation is ***NOT*** implemented on this platform, either because this platform diff --git a/library/std/src/sys/fd/mod.rs b/library/std/src/sys/fd/mod.rs index e0f5eab69514e..7cb9dd1cba9d3 100644 --- a/library/std/src/sys/fd/mod.rs +++ b/library/std/src/sys/fd/mod.rs @@ -2,18 +2,22 @@ #![forbid(unsafe_op_in_unsafe_fn)] -cfg_if::cfg_if! { - if #[cfg(target_family = "unix")] { +cfg_select! { + target_family = "unix" => { mod unix; pub use unix::*; - } else if #[cfg(target_os = "hermit")] { + } + target_os = "hermit" => { mod hermit; pub use hermit::*; - } else if #[cfg(all(target_vendor = "fortanix", target_env = "sgx"))] { + } + all(target_vendor = "fortanix", target_env = "sgx") => { mod sgx; pub use sgx::*; - } else if #[cfg(target_os = "wasi")] { + } + target_os = "wasi" => { mod wasi; pub use wasi::*; } + _ => {} } diff --git a/library/std/src/sys/fs/mod.rs b/library/std/src/sys/fs/mod.rs index d55e28074fe8c..d9740e15789aa 100644 --- a/library/std/src/sys/fs/mod.rs +++ b/library/std/src/sys/fs/mod.rs @@ -5,8 +5,8 @@ use crate::path::{Path, PathBuf}; pub mod common; -cfg_if::cfg_if! { - if #[cfg(target_family = "unix")] { +cfg_select! { + target_family = "unix" => { mod unix; use unix as imp; pub use unix::{chown, fchown, lchown, mkfifo}; @@ -16,24 +16,30 @@ cfg_if::cfg_if! { #[cfg(any(target_os = "linux", target_os = "android"))] pub(crate) use unix::CachedFileMetadata; use crate::sys::common::small_c_string::run_path_with_cstr as with_native_path; - } else if #[cfg(target_os = "windows")] { + } + target_os = "windows" => { mod windows; use windows as imp; pub use windows::{symlink_inner, junction_point}; use crate::sys::path::with_native_path; - } else if #[cfg(target_os = "hermit")] { + } + target_os = "hermit" => { mod hermit; use hermit as imp; - } else if #[cfg(target_os = "solid_asp3")] { + } + target_os = "solid_asp3" => { mod solid; use solid as imp; - } else if #[cfg(target_os = "uefi")] { + } + target_os = "uefi" => { mod uefi; use uefi as imp; - } else if #[cfg(target_os = "wasi")] { + } + target_os = "wasi" => { mod wasi; use wasi as imp; - } else { + } + _ => { mod unsupported; use unsupported as imp; } diff --git a/library/std/src/sys/fs/unix.rs b/library/std/src/sys/fs/unix.rs index b310db2dac485..7ee9f3c445a04 100644 --- a/library/std/src/sys/fs/unix.rs +++ b/library/std/src/sys/fs/unix.rs @@ -101,10 +101,11 @@ pub struct File(FileDesc); // https://github.com/rust-lang/rust/pull/67774 macro_rules! cfg_has_statx { ({ $($then_tt:tt)* } else { $($else_tt:tt)* }) => { - cfg_if::cfg_if! { - if #[cfg(all(target_os = "linux", target_env = "gnu"))] { + cfg_select! { + all(target_os = "linux", target_env = "gnu") => { $($then_tt)* - } else { + } + _ => { $($else_tt)* } } @@ -1263,6 +1264,7 @@ impl File { target_os = "fuchsia", target_os = "linux", target_os = "netbsd", + target_os = "openbsd", target_vendor = "apple", ))] pub fn lock(&self) -> io::Result<()> { @@ -1275,6 +1277,7 @@ impl File { target_os = "fuchsia", target_os = "linux", target_os = "netbsd", + target_os = "openbsd", target_vendor = "apple", )))] pub fn lock(&self) -> io::Result<()> { @@ -1286,6 +1289,7 @@ impl File { target_os = "fuchsia", target_os = "linux", target_os = "netbsd", + target_os = "openbsd", target_vendor = "apple", ))] pub fn lock_shared(&self) -> io::Result<()> { @@ -1298,6 +1302,7 @@ impl File { target_os = "fuchsia", target_os = "linux", target_os = "netbsd", + target_os = "openbsd", target_vendor = "apple", )))] pub fn lock_shared(&self) -> io::Result<()> { @@ -1309,6 +1314,7 @@ impl File { target_os = "fuchsia", target_os = "linux", target_os = "netbsd", + target_os = "openbsd", target_vendor = "apple", ))] pub fn try_lock(&self) -> Result<(), TryLockError> { @@ -1329,6 +1335,7 @@ impl File { target_os = "fuchsia", target_os = "linux", target_os = "netbsd", + target_os = "openbsd", target_vendor = "apple", )))] pub fn try_lock(&self) -> Result<(), TryLockError> { @@ -1343,6 +1350,7 @@ impl File { target_os = "fuchsia", target_os = "linux", target_os = "netbsd", + target_os = "openbsd", target_vendor = "apple", ))] pub fn try_lock_shared(&self) -> Result<(), TryLockError> { @@ -1363,6 +1371,7 @@ impl File { target_os = "fuchsia", target_os = "linux", target_os = "netbsd", + target_os = "openbsd", target_vendor = "apple", )))] pub fn try_lock_shared(&self) -> Result<(), TryLockError> { @@ -1377,6 +1386,7 @@ impl File { target_os = "fuchsia", target_os = "linux", target_os = "netbsd", + target_os = "openbsd", target_vendor = "apple", ))] pub fn unlock(&self) -> io::Result<()> { @@ -1389,6 +1399,7 @@ impl File { target_os = "fuchsia", target_os = "linux", target_os = "netbsd", + target_os = "openbsd", target_vendor = "apple", )))] pub fn unlock(&self) -> io::Result<()> { @@ -1505,8 +1516,8 @@ impl File { )), None => Ok(libc::timespec { tv_sec: 0, tv_nsec: libc::UTIME_OMIT as _ }), }; - cfg_if::cfg_if! { - if #[cfg(any(target_os = "redox", target_os = "espidf", target_os = "horizon", target_os = "nuttx"))] { + cfg_select! { + any(target_os = "redox", target_os = "espidf", target_os = "horizon", target_os = "nuttx") => { // Redox doesn't appear to support `UTIME_OMIT`. // ESP-IDF and HorizonOS do not support `futimens` at all and the behavior for those OS is therefore // the same as for Redox. @@ -1515,7 +1526,8 @@ impl File { io::ErrorKind::Unsupported, "setting file times not supported", )) - } else if #[cfg(target_vendor = "apple")] { + } + target_vendor = "apple" => { let mut buf = [mem::MaybeUninit::::uninit(); 3]; let mut num_times = 0; let mut attrlist: libc::attrlist = unsafe { mem::zeroed() }; @@ -1543,7 +1555,8 @@ impl File { 0 ) })?; Ok(()) - } else if #[cfg(target_os = "android")] { + } + target_os = "android" => { let times = [to_timespec(times.accessed)?, to_timespec(times.modified)?]; // futimens requires Android API level 19 cvt(unsafe { @@ -1559,7 +1572,8 @@ impl File { } })?; Ok(()) - } else { + } + _ => { #[cfg(all(target_os = "linux", target_env = "gnu", target_pointer_width = "32", not(target_arch = "riscv32")))] { use crate::sys::{time::__timespec64, weak::weak}; @@ -1677,13 +1691,14 @@ impl fmt::Debug for File { let mut buf = vec![0; libc::PATH_MAX as usize]; let n = unsafe { libc::fcntl(fd, libc::F_GETPATH, buf.as_ptr()) }; if n == -1 { - cfg_if::cfg_if! { - if #[cfg(target_os = "netbsd")] { + cfg_select! { + target_os = "netbsd" => { // fallback to procfs as last resort let mut p = PathBuf::from("/proc/self/fd"); p.push(&fd.to_string()); return run_path_with_cstr(&p, &readlink).ok() - } else { + } + _ => { return None; } } @@ -1884,15 +1899,16 @@ pub fn symlink(original: &CStr, link: &CStr) -> io::Result<()> { } pub fn link(original: &CStr, link: &CStr) -> io::Result<()> { - cfg_if::cfg_if! { - if #[cfg(any(target_os = "vxworks", target_os = "redox", target_os = "android", target_os = "espidf", target_os = "horizon", target_os = "vita", target_env = "nto70"))] { + cfg_select! { + any(target_os = "vxworks", target_os = "redox", target_os = "android", target_os = "espidf", target_os = "horizon", target_os = "vita", target_env = "nto70") => { // VxWorks, Redox and ESP-IDF lack `linkat`, so use `link` instead. POSIX leaves // it implementation-defined whether `link` follows symlinks, so rely on the // `symlink_hard_link` test in library/std/src/fs/tests.rs to check the behavior. // Android has `linkat` on newer versions, but we happen to know `link` // always has the correct behavior, so it's here as well. cvt(unsafe { libc::link(original.as_ptr(), link.as_ptr()) })?; - } else { + } + _ => { // Where we can, use `linkat` instead of `link`; see the comment above // this one for details on why. cvt(unsafe { libc::linkat(libc::AT_FDCWD, original.as_ptr(), libc::AT_FDCWD, link.as_ptr(), 0) })?; diff --git a/library/std/src/sys/io/mod.rs b/library/std/src/sys/io/mod.rs index ae75f4d97b431..fe8ec1dbb7325 100644 --- a/library/std/src/sys/io/mod.rs +++ b/library/std/src/sys/io/mod.rs @@ -1,20 +1,24 @@ #![forbid(unsafe_op_in_unsafe_fn)] mod io_slice { - cfg_if::cfg_if! { - if #[cfg(any(target_family = "unix", target_os = "hermit", target_os = "solid_asp3", target_os = "trusty"))] { + cfg_select! { + any(target_family = "unix", target_os = "hermit", target_os = "solid_asp3", target_os = "trusty") => { mod iovec; pub use iovec::*; - } else if #[cfg(target_os = "windows")] { + } + target_os = "windows" => { mod windows; pub use windows::*; - } else if #[cfg(target_os = "wasi")] { + } + target_os = "wasi" => { mod wasi; pub use wasi::*; - } else if #[cfg(target_os = "uefi")] { + } + target_os = "uefi" => { mod uefi; pub use uefi::*; - } else { + } + _ => { mod unsupported; pub use unsupported::*; } @@ -22,17 +26,20 @@ mod io_slice { } mod is_terminal { - cfg_if::cfg_if! { - if #[cfg(any(target_family = "unix", target_os = "wasi"))] { + cfg_select! { + any(target_family = "unix", target_os = "wasi") => { mod isatty; pub use isatty::*; - } else if #[cfg(target_os = "windows")] { + } + target_os = "windows" => { mod windows; pub use windows::*; - } else if #[cfg(target_os = "hermit")] { + } + target_os = "hermit" => { mod hermit; pub use hermit::*; - } else { + } + _ => { mod unsupported; pub use unsupported::*; } diff --git a/library/std/src/sys/mod.rs b/library/std/src/sys/mod.rs index 8ec0a0e33023f..6324c1a232af4 100644 --- a/library/std/src/sys/mod.rs +++ b/library/std/src/sys/mod.rs @@ -1,7 +1,7 @@ #![allow(unsafe_op_in_unsafe_fn)] /// The configure builtins provides runtime support compiler-builtin features -/// which require dynamic intialization to work as expected, e.g. aarch64 +/// which require dynamic initialization to work as expected, e.g. aarch64 /// outline-atomics. mod configure_builtins; diff --git a/library/std/src/sys/net/connection/socket.rs b/library/std/src/sys/net/connection/socket.rs index 7301bde6881a3..aa83ed65d4c2e 100644 --- a/library/std/src/sys/net/connection/socket.rs +++ b/library/std/src/sys/net/connection/socket.rs @@ -9,29 +9,34 @@ use crate::sys_common::{AsInner, FromInner}; use crate::time::Duration; use crate::{cmp, fmt, mem, ptr}; -cfg_if::cfg_if! { - if #[cfg(target_os = "hermit")] { +cfg_select! { + target_os = "hermit" => { mod hermit; pub use hermit::*; - } else if #[cfg(target_os = "solid_asp3")] { + } + target_os = "solid_asp3" => { mod solid; pub use solid::*; - } else if #[cfg(target_family = "unix")] { + } + target_family = "unix" => { mod unix; pub use unix::*; - } else if #[cfg(all(target_os = "wasi", target_env = "p2"))] { + } + all(target_os = "wasi", target_env = "p2") => { mod wasip2; pub use wasip2::*; - } else if #[cfg(target_os = "windows")] { + } + target_os = "windows" => { mod windows; pub use windows::*; } + _ => {} } use netc as c; -cfg_if::cfg_if! { - if #[cfg(any( +cfg_select! { + any( target_os = "dragonfly", target_os = "freebsd", target_os = "openbsd", @@ -43,39 +48,44 @@ cfg_if::cfg_if! { target_os = "nto", target_os = "nuttx", target_vendor = "apple", - ))] { + ) => { use c::IPV6_JOIN_GROUP as IPV6_ADD_MEMBERSHIP; use c::IPV6_LEAVE_GROUP as IPV6_DROP_MEMBERSHIP; - } else { + } + _ => { use c::IPV6_ADD_MEMBERSHIP; use c::IPV6_DROP_MEMBERSHIP; } } -cfg_if::cfg_if! { - if #[cfg(any( +cfg_select! { + any( target_os = "linux", target_os = "android", target_os = "hurd", target_os = "dragonfly", target_os = "freebsd", target_os = "openbsd", target_os = "netbsd", target_os = "solaris", target_os = "illumos", target_os = "haiku", target_os = "nto", - target_os = "cygwin"))] { + target_os = "cygwin", + ) => { use libc::MSG_NOSIGNAL; - } else { + } + _ => { const MSG_NOSIGNAL: c_int = 0x0; } } -cfg_if::cfg_if! { - if #[cfg(any( +cfg_select! { + any( target_os = "dragonfly", target_os = "freebsd", target_os = "openbsd", target_os = "netbsd", target_os = "solaris", target_os = "illumos", - target_os = "nto"))] { + target_os = "nto", + ) => { use crate::ffi::c_uchar; type IpV4MultiCastType = c_uchar; - } else { + } + _ => { type IpV4MultiCastType = c_int; } } @@ -523,17 +533,19 @@ impl TcpListener { let (addr, len) = socket_addr_to_c(addr); cvt(unsafe { c::bind(sock.as_raw(), addr.as_ptr(), len as _) })?; - cfg_if::cfg_if! { - if #[cfg(target_os = "horizon")] { + cfg_select! { + target_os = "horizon" => { // The 3DS doesn't support a big connection backlog. Sometimes // it allows up to about 37, but other times it doesn't even // accept 32. There may be a global limitation causing this. let backlog = 20; - } else if #[cfg(target_os = "haiku")] { + } + target_os = "haiku" => { // Haiku does not support a queue length > 32 // https://github.com/haiku/haiku/blob/979a0bc487864675517fb2fab28f87dc8bf43041/headers/posix/sys/socket.h#L81 let backlog = 32; - } else { + } + _ => { // The default for all other platforms let backlog = 128; } diff --git a/library/std/src/sys/net/connection/socket/unix.rs b/library/std/src/sys/net/connection/socket/unix.rs index cc111f3521bc1..8b5970d1494e5 100644 --- a/library/std/src/sys/net/connection/socket/unix.rs +++ b/library/std/src/sys/net/connection/socket/unix.rs @@ -12,10 +12,11 @@ use crate::sys_common::{AsInner, FromInner, IntoInner}; use crate::time::{Duration, Instant}; use crate::{cmp, mem}; -cfg_if::cfg_if! { - if #[cfg(target_vendor = "apple")] { +cfg_select! { + target_vendor = "apple" => { use libc::SO_LINGER_SEC as SO_LINGER; - } else { + } + _ => { use libc::SO_LINGER; } } @@ -72,8 +73,8 @@ impl Socket { pub fn new_raw(fam: c_int, ty: c_int) -> io::Result { unsafe { - cfg_if::cfg_if! { - if #[cfg(any( + cfg_select! { + any( target_os = "android", target_os = "dragonfly", target_os = "freebsd", @@ -85,7 +86,7 @@ impl Socket { target_os = "cygwin", target_os = "nto", target_os = "solaris", - ))] { + ) => { // On platforms that support it we pass the SOCK_CLOEXEC // flag to atomically create the socket and set it as // CLOEXEC. On Linux this was added in 2.6.27. @@ -98,7 +99,8 @@ impl Socket { setsockopt(&socket, libc::SOL_SOCKET, libc::SO_NOSIGPIPE, 1)?; Ok(socket) - } else { + } + _ => { let fd = cvt(libc::socket(fam, ty, 0))?; let fd = FileDesc::from_raw_fd(fd); fd.set_cloexec()?; @@ -120,8 +122,8 @@ impl Socket { unsafe { let mut fds = [0, 0]; - cfg_if::cfg_if! { - if #[cfg(any( + cfg_select! { + any( target_os = "android", target_os = "dragonfly", target_os = "freebsd", @@ -132,11 +134,12 @@ impl Socket { target_os = "openbsd", target_os = "cygwin", target_os = "nto", - ))] { + ) => { // Like above, set cloexec atomically cvt(libc::socketpair(fam, ty | libc::SOCK_CLOEXEC, 0, fds.as_mut_ptr()))?; Ok((Socket(FileDesc::from_raw_fd(fds[0])), Socket(FileDesc::from_raw_fd(fds[1])))) - } else { + } + _ => { cvt(libc::socketpair(fam, ty, 0, fds.as_mut_ptr()))?; let a = FileDesc::from_raw_fd(fds[0]); let b = FileDesc::from_raw_fd(fds[1]); @@ -250,8 +253,8 @@ impl Socket { // atomically set the CLOEXEC flag is to use the `accept4` syscall on // platforms that support it. On Linux, this was added in 2.6.28, // glibc 2.10 and musl 0.9.5. - cfg_if::cfg_if! { - if #[cfg(any( + cfg_select! { + any( target_os = "android", target_os = "dragonfly", target_os = "freebsd", @@ -261,12 +264,13 @@ impl Socket { target_os = "netbsd", target_os = "openbsd", target_os = "cygwin", - ))] { + ) => { unsafe { let fd = cvt_r(|| libc::accept4(self.as_raw_fd(), storage, len, libc::SOCK_CLOEXEC))?; Ok(Socket(FileDesc::from_raw_fd(fd))) } - } else { + } + _ => { unsafe { let fd = cvt_r(|| libc::accept(self.as_raw_fd(), storage, len))?; let fd = FileDesc::from_raw_fd(fd); diff --git a/library/std/src/sys/net/mod.rs b/library/std/src/sys/net/mod.rs index 646679a1cc8b9..5df1fe138ab24 100644 --- a/library/std/src/sys/net/mod.rs +++ b/library/std/src/sys/net/mod.rs @@ -1,36 +1,41 @@ -cfg_if::cfg_if! { - if #[cfg(any( +cfg_select! { + any( all(target_family = "unix", not(target_os = "l4re")), target_os = "windows", target_os = "hermit", all(target_os = "wasi", target_env = "p2"), target_os = "solid_asp3", - ))] { + ) => { mod connection { mod socket; pub use socket::*; } - } else if #[cfg(all(target_vendor = "fortanix", target_env = "sgx"))] { + } + all(target_vendor = "fortanix", target_env = "sgx") => { mod connection { mod sgx; pub use sgx::*; } - } else if #[cfg(all(target_os = "wasi", target_env = "p1"))] { + } + all(target_os = "wasi", target_env = "p1") => { mod connection { mod wasip1; pub use wasip1::*; } - } else if #[cfg(target_os = "xous")] { + } + target_os = "xous" => { mod connection { mod xous; pub use xous::*; } - } else if #[cfg(target_os = "uefi")] { + } + target_os = "uefi" => { mod connection { mod uefi; pub use uefi::*; } - } else { + } + _ => { mod connection { mod unsupported; pub use unsupported::*; diff --git a/library/std/src/sys/os_str/mod.rs b/library/std/src/sys/os_str/mod.rs index 345e661586d03..65c90d880495d 100644 --- a/library/std/src/sys/os_str/mod.rs +++ b/library/std/src/sys/os_str/mod.rs @@ -1,13 +1,11 @@ #![forbid(unsafe_op_in_unsafe_fn)] -cfg_if::cfg_if! { - if #[cfg(any( - target_os = "windows", - target_os = "uefi", - ))] { +cfg_select! { + any(target_os = "windows", target_os = "uefi") => { mod wtf8; pub use wtf8::{Buf, Slice}; - } else { + } + _ => { mod bytes; pub use bytes::{Buf, Slice}; } diff --git a/library/std/src/sys/pal/mod.rs b/library/std/src/sys/pal/mod.rs index fbefc62ac88eb..9376f5249f1c2 100644 --- a/library/std/src/sys/pal/mod.rs +++ b/library/std/src/sys/pal/mod.rs @@ -24,60 +24,70 @@ pub mod common; -cfg_if::cfg_if! { - if #[cfg(unix)] { +cfg_select! { + unix => { mod unix; pub use self::unix::*; - } else if #[cfg(windows)] { + } + windows => { mod windows; pub use self::windows::*; - } else if #[cfg(target_os = "solid_asp3")] { + } + target_os = "solid_asp3" => { mod solid; pub use self::solid::*; - } else if #[cfg(target_os = "hermit")] { + } + target_os = "hermit" => { mod hermit; pub use self::hermit::*; - } else if #[cfg(target_os = "trusty")] { + } + target_os = "trusty" => { mod trusty; pub use self::trusty::*; - } else if #[cfg(all(target_os = "wasi", target_env = "p2"))] { + } + all(target_os = "wasi", target_env = "p2") => { mod wasip2; pub use self::wasip2::*; - } else if #[cfg(target_os = "wasi")] { + } + target_os = "wasi" => { mod wasi; pub use self::wasi::*; - } else if #[cfg(target_family = "wasm")] { + } + target_family = "wasm" => { mod wasm; pub use self::wasm::*; - } else if #[cfg(target_os = "xous")] { + } + target_os = "xous" => { mod xous; pub use self::xous::*; - } else if #[cfg(target_os = "uefi")] { + } + target_os = "uefi" => { mod uefi; pub use self::uefi::*; - } else if #[cfg(all(target_vendor = "fortanix", target_env = "sgx"))] { + } + all(target_vendor = "fortanix", target_env = "sgx") => { mod sgx; pub use self::sgx::*; - } else if #[cfg(target_os = "teeos")] { + } + target_os = "teeos" => { mod teeos; pub use self::teeos::*; - } else if #[cfg(target_os = "zkvm")] { + } + target_os = "zkvm" => { mod zkvm; pub use self::zkvm::*; - } else { + } + _ => { mod unsupported; pub use self::unsupported::*; } } -cfg_if::cfg_if! { +pub const FULL_BACKTRACE_DEFAULT: bool = cfg_select! { // Fuchsia components default to full backtrace. - if #[cfg(target_os = "fuchsia")] { - pub const FULL_BACKTRACE_DEFAULT: bool = true; - } else { - pub const FULL_BACKTRACE_DEFAULT: bool = false; - } -} + target_os = "fuchsia" => true, + _ => false, +}; #[cfg(not(target_os = "uefi"))] pub type RawOsError = i32; diff --git a/library/std/src/sys/pal/uefi/time.rs b/library/std/src/sys/pal/uefi/time.rs index df5611b2dddc1..36ce3f7ef962e 100644 --- a/library/std/src/sys/pal/uefi/time.rs +++ b/library/std/src/sys/pal/uefi/time.rs @@ -188,7 +188,7 @@ pub(crate) mod system_time_internal { Duration::new(epoch, t.nanosecond) } - /// This algorithm is a modifed version of the one described in the post: + /// This algorithm is a modified version of the one described in the post: /// https://howardhinnant.github.io/date_algorithms.html#clive_from_days /// /// The changes are to use 1900-01-01-00:00:00 with timezone -1440 as anchor instead of UNIX @@ -197,7 +197,7 @@ pub(crate) mod system_time_internal { // Check timzone validity assert!(timezone <= 1440 && timezone >= -1440); - // FIXME(#126043): use checked_sub_signed once stablized + // FIXME(#126043): use checked_sub_signed once stabilized let secs = dur.as_secs().checked_add_signed((-timezone as i64) * SECS_IN_MINUTE as i64).unwrap(); @@ -296,12 +296,9 @@ pub(crate) mod instant_internal { } pub fn platform_specific() -> Option { - cfg_if::cfg_if! { - if #[cfg(any(target_arch = "x86_64", target_arch = "x86"))] { - timestamp_rdtsc().map(Instant) - } else { - None - } + cfg_select! { + any(target_arch = "x86_64", target_arch = "x86") => timestamp_rdtsc().map(Instant), + _ => None, } } diff --git a/library/std/src/sys/pal/unix/futex.rs b/library/std/src/sys/pal/unix/futex.rs index c23278bdf5e5d..265067d84d502 100644 --- a/library/std/src/sys/pal/unix/futex.rs +++ b/library/std/src/sys/pal/unix/futex.rs @@ -46,8 +46,8 @@ pub fn futex_wait(futex: &Atomic, expected: u32, timeout: Option) } let r = unsafe { - cfg_if::cfg_if! { - if #[cfg(target_os = "freebsd")] { + cfg_select! { + target_os = "freebsd" => { // FreeBSD doesn't have futex(), but it has // _umtx_op(UMTX_OP_WAIT_UINT_PRIVATE), which is nearly // identical. It supports absolute timeouts through a flag @@ -66,7 +66,8 @@ pub fn futex_wait(futex: &Atomic, expected: u32, timeout: Option) crate::ptr::without_provenance_mut(umtx_timeout_size), umtx_timeout_ptr as *mut _, ) - } else if #[cfg(any(target_os = "linux", target_os = "android"))] { + } + any(target_os = "linux", target_os = "android") => { // Use FUTEX_WAIT_BITSET rather than FUTEX_WAIT to be able to give an // absolute time rather than a relative time. libc::syscall( @@ -78,7 +79,8 @@ pub fn futex_wait(futex: &Atomic, expected: u32, timeout: Option) null::(), // This argument is unused for FUTEX_WAIT_BITSET. !0u32, // A full bitmask, to make it behave like a regular FUTEX_WAIT. ) - } else { + } + _ => { compile_error!("unknown target_os"); } } diff --git a/library/std/src/sys/pal/unix/mod.rs b/library/std/src/sys/pal/unix/mod.rs index ba9e14b8009cd..fede3673eb6e8 100644 --- a/library/std/src/sys/pal/unix/mod.rs +++ b/library/std/src/sys/pal/unix/mod.rs @@ -366,31 +366,36 @@ pub fn abort_internal() -> ! { unsafe { libc::abort() } } -cfg_if::cfg_if! { - if #[cfg(target_os = "android")] { +cfg_select! { + target_os = "android" => { #[link(name = "dl", kind = "static", modifiers = "-bundle", cfg(target_feature = "crt-static"))] #[link(name = "dl", cfg(not(target_feature = "crt-static")))] #[link(name = "log", cfg(not(target_feature = "crt-static")))] unsafe extern "C" {} - } else if #[cfg(target_os = "freebsd")] { + } + target_os = "freebsd" => { #[link(name = "execinfo")] #[link(name = "pthread")] unsafe extern "C" {} - } else if #[cfg(target_os = "netbsd")] { + } + target_os = "netbsd" => { #[link(name = "pthread")] #[link(name = "rt")] unsafe extern "C" {} - } else if #[cfg(any(target_os = "dragonfly", target_os = "openbsd", target_os = "cygwin"))] { + } + any(target_os = "dragonfly", target_os = "openbsd", target_os = "cygwin") => { #[link(name = "pthread")] unsafe extern "C" {} - } else if #[cfg(target_os = "solaris")] { + } + target_os = "solaris" => { #[link(name = "socket")] #[link(name = "posix4")] #[link(name = "pthread")] #[link(name = "resolv")] unsafe extern "C" {} - } else if #[cfg(target_os = "illumos")] { + } + target_os = "illumos" => { #[link(name = "socket")] #[link(name = "posix4")] #[link(name = "pthread")] @@ -399,24 +404,29 @@ cfg_if::cfg_if! { // Use libumem for the (malloc-compatible) allocator #[link(name = "umem")] unsafe extern "C" {} - } else if #[cfg(target_vendor = "apple")] { + } + target_vendor = "apple" => { // Link to `libSystem.dylib`. // // Don't get confused by the presence of `System.framework`, // it is a deprecated wrapper over the dynamic library. #[link(name = "System")] unsafe extern "C" {} - } else if #[cfg(target_os = "fuchsia")] { + } + target_os = "fuchsia" => { #[link(name = "zircon")] #[link(name = "fdio")] unsafe extern "C" {} - } else if #[cfg(all(target_os = "linux", target_env = "uclibc"))] { + } + all(target_os = "linux", target_env = "uclibc") => { #[link(name = "dl")] unsafe extern "C" {} - } else if #[cfg(target_os = "vita")] { + } + target_os = "vita" => { #[link(name = "pthread", kind = "static", modifiers = "-bundle")] unsafe extern "C" {} } + _ => {} } #[cfg(any(target_os = "espidf", target_os = "horizon", target_os = "vita", target_os = "nuttx"))] diff --git a/library/std/src/sys/pal/unix/os.rs b/library/std/src/sys/pal/unix/os.rs index 0e68313cc3ed0..1110b775c0953 100644 --- a/library/std/src/sys/pal/unix/os.rs +++ b/library/std/src/sys/pal/unix/os.rs @@ -17,13 +17,10 @@ use crate::{fmt, io, iter, mem, ptr, slice, str}; const TMPBUF_SZ: usize = 128; -cfg_if::cfg_if! { - if #[cfg(target_os = "redox")] { - const PATH_SEPARATOR: u8 = b';'; - } else { - const PATH_SEPARATOR: u8 = b':'; - } -} +const PATH_SEPARATOR: u8 = cfg_select! { + target_os = "redox" => b';', + _ => b':', +}; unsafe extern "C" { #[cfg(not(any(target_os = "dragonfly", target_os = "vxworks", target_os = "rtems")))] @@ -620,14 +617,10 @@ fn darwin_temp_dir() -> PathBuf { pub fn temp_dir() -> PathBuf { crate::env::var_os("TMPDIR").map(PathBuf::from).unwrap_or_else(|| { - cfg_if::cfg_if! { - if #[cfg(all(target_vendor = "apple", not(miri)))] { - darwin_temp_dir() - } else if #[cfg(target_os = "android")] { - PathBuf::from("/data/local/tmp") - } else { - PathBuf::from("/tmp") - } + cfg_select! { + all(target_vendor = "apple", not(miri)) => darwin_temp_dir(), + target_os = "android" => PathBuf::from("/data/local/tmp"), + _ => PathBuf::from("/tmp"), } }) } diff --git a/library/std/src/sys/pal/unix/pipe.rs b/library/std/src/sys/pal/unix/pipe.rs index 55510153dc847..6b0cd14da4f61 100644 --- a/library/std/src/sys/pal/unix/pipe.rs +++ b/library/std/src/sys/pal/unix/pipe.rs @@ -18,8 +18,8 @@ pub fn anon_pipe() -> io::Result<(AnonPipe, AnonPipe)> { // The only known way right now to create atomically set the CLOEXEC flag is // to use the `pipe2` syscall. This was added to Linux in 2.6.27, glibc 2.9 // and musl 0.9.3, and some other targets also have it. - cfg_if::cfg_if! { - if #[cfg(any( + cfg_select! { + any( target_os = "dragonfly", target_os = "freebsd", target_os = "hurd", @@ -29,12 +29,13 @@ pub fn anon_pipe() -> io::Result<(AnonPipe, AnonPipe)> { target_os = "openbsd", target_os = "cygwin", target_os = "redox" - ))] { + ) => { unsafe { cvt(libc::pipe2(fds.as_mut_ptr(), libc::O_CLOEXEC))?; Ok((AnonPipe(FileDesc::from_raw_fd(fds[0])), AnonPipe(FileDesc::from_raw_fd(fds[1])))) } - } else { + } + _ => { unsafe { cvt(libc::pipe(fds.as_mut_ptr()))?; diff --git a/library/std/src/sys/pal/unix/thread.rs b/library/std/src/sys/pal/unix/thread.rs index 24b65c11fd2ab..3389b8c0c8a55 100644 --- a/library/std/src/sys/pal/unix/thread.rs +++ b/library/std/src/sys/pal/unix/thread.rs @@ -151,12 +151,13 @@ impl Thread { ))] pub fn set_name(name: &CStr) { unsafe { - cfg_if::cfg_if! { - if #[cfg(any(target_os = "linux", target_os = "cygwin"))] { + cfg_select! { + any(target_os = "linux", target_os = "cygwin") => { // Linux and Cygwin limits the allowed length of the name. const TASK_COMM_LEN: usize = 16; let name = truncate_cstr::<{ TASK_COMM_LEN }>(name); - } else { + } + _ => { // FreeBSD, DragonFly BSD and NuttX do not enforce length limits. } }; @@ -415,9 +416,9 @@ pub(crate) fn current_os_id() -> Option { // // The OS thread ID is used rather than `pthread_self` so as to match what will be displayed // for process inspection (debuggers, trace, `top`, etc.). - cfg_if::cfg_if! { + cfg_select! { // Most platforms have a function returning a `pid_t` or int, which is an `i32`. - if #[cfg(any(target_os = "android", target_os = "linux"))] { + any(target_os = "android", target_os = "linux") => { use crate::sys::weak::syscall; // `libc::gettid` is only available on glibc 2.30+, but the syscall is available @@ -427,28 +428,34 @@ pub(crate) fn current_os_id() -> Option { // SAFETY: FFI call with no preconditions. let id: libc::pid_t = unsafe { gettid() }; Some(id as u64) - } else if #[cfg(target_os = "nto")] { + } + target_os = "nto" => { // SAFETY: FFI call with no preconditions. let id: libc::pid_t = unsafe { libc::gettid() }; Some(id as u64) - } else if #[cfg(target_os = "openbsd")] { + } + target_os = "openbsd" => { // SAFETY: FFI call with no preconditions. let id: libc::pid_t = unsafe { libc::getthrid() }; Some(id as u64) - } else if #[cfg(target_os = "freebsd")] { + } + target_os = "freebsd" => { // SAFETY: FFI call with no preconditions. let id: libc::c_int = unsafe { libc::pthread_getthreadid_np() }; Some(id as u64) - } else if #[cfg(target_os = "netbsd")] { + } + target_os = "netbsd" => { // SAFETY: FFI call with no preconditions. let id: libc::lwpid_t = unsafe { libc::_lwp_self() }; Some(id as u64) - } else if #[cfg(any(target_os = "illumos", target_os = "solaris"))] { + } + any(target_os = "illumos", target_os = "solaris") => { // On Illumos and Solaris, the `pthread_t` is the same as the OS thread ID. // SAFETY: FFI call with no preconditions. let id: libc::pthread_t = unsafe { libc::pthread_self() }; Some(id as u64) - } else if #[cfg(target_vendor = "apple")] { + } + target_vendor = "apple" => { // Apple allows querying arbitrary thread IDs, `thread=NULL` queries the current thread. let mut id = 0u64; // SAFETY: `thread_id` is a valid pointer, no other preconditions. @@ -458,10 +465,9 @@ pub(crate) fn current_os_id() -> Option { } else { None } - } else { - // Other platforms don't have an OS thread ID or don't have a way to access it. - None } + // Other platforms don't have an OS thread ID or don't have a way to access it. + _ => None, } } @@ -483,8 +489,8 @@ fn truncate_cstr(cstr: &CStr) -> [libc::c_char; MAX_W } pub fn available_parallelism() -> io::Result> { - cfg_if::cfg_if! { - if #[cfg(any( + cfg_select! { + any( target_os = "android", target_os = "emscripten", target_os = "fuchsia", @@ -493,7 +499,7 @@ pub fn available_parallelism() -> io::Result> { target_os = "aix", target_vendor = "apple", target_os = "cygwin", - ))] { + ) => { #[allow(unused_assignments)] #[allow(unused_mut)] let mut quota = usize::MAX; @@ -527,12 +533,13 @@ pub fn available_parallelism() -> io::Result> { Ok(unsafe { NonZero::new_unchecked(count) }) } } - } else if #[cfg(any( - target_os = "freebsd", - target_os = "dragonfly", - target_os = "openbsd", - target_os = "netbsd", - ))] { + } + any( + target_os = "freebsd", + target_os = "dragonfly", + target_os = "openbsd", + target_os = "netbsd", + ) => { use crate::ptr; #[cfg(target_os = "freebsd")] @@ -607,7 +614,8 @@ pub fn available_parallelism() -> io::Result> { } Ok(unsafe { NonZero::new_unchecked(cpus as usize) }) - } else if #[cfg(target_os = "nto")] { + } + target_os = "nto" => { unsafe { use libc::_syspage_ptr; if _syspage_ptr.is_null() { @@ -618,13 +626,15 @@ pub fn available_parallelism() -> io::Result> { .ok_or(io::Error::UNKNOWN_THREAD_COUNT) } } - } else if #[cfg(any(target_os = "solaris", target_os = "illumos"))] { + } + any(target_os = "solaris", target_os = "illumos") => { let mut cpus = 0u32; if unsafe { libc::pset_info(libc::PS_MYID, core::ptr::null_mut(), &mut cpus, core::ptr::null_mut()) } != 0 { return Err(io::Error::UNKNOWN_THREAD_COUNT); } Ok(unsafe { NonZero::new_unchecked(cpus as usize) }) - } else if #[cfg(target_os = "haiku")] { + } + target_os = "haiku" => { // system_info cpu_count field gets the static data set at boot time with `smp_set_num_cpus` // `get_system_info` calls then `smp_get_num_cpus` unsafe { @@ -637,7 +647,8 @@ pub fn available_parallelism() -> io::Result> { Ok(NonZero::new_unchecked(sinfo.cpu_count as usize)) } - } else if #[cfg(target_os = "vxworks")] { + } + target_os = "vxworks" => { // Note: there is also `vxCpuConfiguredGet`, closer to _SC_NPROCESSORS_CONF // expectations than the actual cores availability. unsafe extern "C" { @@ -649,7 +660,8 @@ pub fn available_parallelism() -> io::Result> { let set = vxCpuEnabledGet(); Ok(NonZero::new_unchecked(set.count_ones() as usize)) } - } else { + } + _ => { // FIXME: implement on Redox, l4re Err(io::const_error!(io::ErrorKind::Unsupported, "getting the number of hardware threads is not supported on the target platform")) } diff --git a/library/std/src/sys/pal/wasi/thread.rs b/library/std/src/sys/pal/wasi/thread.rs index 4755e2ef5da04..e062b49bd7a29 100644 --- a/library/std/src/sys/pal/wasi/thread.rs +++ b/library/std/src/sys/pal/wasi/thread.rs @@ -5,8 +5,8 @@ use crate::num::NonZero; use crate::time::{Duration, Instant}; use crate::{io, mem}; -cfg_if::cfg_if! { - if #[cfg(target_feature = "atomics")] { +cfg_select! { + target_feature = "atomics" => { use crate::cmp; use crate::ptr; use crate::sys::os; @@ -62,7 +62,8 @@ cfg_if::cfg_if! { debug_assert_eq!(ret, 0); } } - } else { + } + _ => { pub struct Thread(!); } } @@ -71,8 +72,8 @@ pub const DEFAULT_MIN_STACK_SIZE: usize = 1024 * 1024; impl Thread { // unsafe: see thread::Builder::spawn_unchecked for safety requirements - cfg_if::cfg_if! { - if #[cfg(target_feature = "atomics")] { + cfg_select! { + target_feature = "atomics" => { pub unsafe fn new(stack: usize, _name: Option<&str>, p: Box) -> io::Result { let p = Box::into_raw(Box::new(p)); let mut native: libc::pthread_t = unsafe { mem::zeroed() }; @@ -119,7 +120,8 @@ impl Thread { ptr::null_mut() } } - } else { + } + _ => { pub unsafe fn new(_stack: usize, _name: Option<&str>, _p: Box) -> io::Result { crate::sys::unsupported() } @@ -180,14 +182,15 @@ impl Thread { } pub fn join(self) { - cfg_if::cfg_if! { - if #[cfg(target_feature = "atomics")] { + cfg_select! { + target_feature = "atomics" => { let id = mem::ManuallyDrop::new(self).id; let ret = unsafe { libc::pthread_join(id, ptr::null_mut()) }; if ret != 0 { rtabort!("failed to join thread: {}", io::Error::from_raw_os_error(ret)); } - } else { + } + _ => { self.0 } } @@ -199,14 +202,13 @@ pub(crate) fn current_os_id() -> Option { } pub fn available_parallelism() -> io::Result> { - cfg_if::cfg_if! { - if #[cfg(target_feature = "atomics")] { + cfg_select! { + target_feature = "atomics" => { match unsafe { libc::sysconf(libc::_SC_NPROCESSORS_ONLN) } { -1 => Err(io::Error::last_os_error()), cpus => NonZero::new(cpus as usize).ok_or(io::Error::UNKNOWN_THREAD_COUNT), } - } else { - crate::sys::unsupported() } + _ => crate::sys::unsupported(), } } diff --git a/library/std/src/sys/pal/wasm/mod.rs b/library/std/src/sys/pal/wasm/mod.rs index 37cb46a8f6b3f..346c9ff88c963 100644 --- a/library/std/src/sys/pal/wasm/mod.rs +++ b/library/std/src/sys/pal/wasm/mod.rs @@ -23,13 +23,14 @@ pub mod pipe; #[path = "../unsupported/time.rs"] pub mod time; -cfg_if::cfg_if! { - if #[cfg(target_feature = "atomics")] { +cfg_select! { + target_feature = "atomics" => { #[path = "atomics/futex.rs"] pub mod futex; #[path = "atomics/thread.rs"] pub mod thread; - } else { + } + _ => { #[path = "../unsupported/thread.rs"] pub mod thread; } diff --git a/library/std/src/sys/pal/windows/c.rs b/library/std/src/sys/pal/windows/c.rs index edac5262a4e9a..25c1a82cc426a 100644 --- a/library/std/src/sys/pal/windows/c.rs +++ b/library/std/src/sys/pal/windows/c.rs @@ -95,11 +95,8 @@ pub struct MOUNT_POINT_REPARSE_BUFFER { } // Desktop specific functions & types -cfg_if::cfg_if! { -if #[cfg(not(target_vendor = "uwp"))] { - pub const EXCEPTION_CONTINUE_SEARCH: i32 = 0; -} -} +#[cfg(not(target_vendor = "uwp"))] +pub const EXCEPTION_CONTINUE_SEARCH: i32 = 0; // Use raw-dylib to import ProcessPrng as we can't rely on there being an import library. #[cfg(not(target_vendor = "win7"))] @@ -230,12 +227,13 @@ compat_fn_with_fallback! { } } -cfg_if::cfg_if! { - if #[cfg(target_vendor = "uwp")] { +cfg_select! { + target_vendor = "uwp" => { windows_targets::link_raw_dylib!("ntdll.dll" "system" fn NtCreateFile(filehandle : *mut HANDLE, desiredaccess : FILE_ACCESS_RIGHTS, objectattributes : *const OBJECT_ATTRIBUTES, iostatusblock : *mut IO_STATUS_BLOCK, allocationsize : *const i64, fileattributes : FILE_FLAGS_AND_ATTRIBUTES, shareaccess : FILE_SHARE_MODE, createdisposition : NTCREATEFILE_CREATE_DISPOSITION, createoptions : NTCREATEFILE_CREATE_OPTIONS, eabuffer : *const core::ffi::c_void, ealength : u32) -> NTSTATUS); windows_targets::link_raw_dylib!("ntdll.dll" "system" fn NtOpenFile(filehandle : *mut HANDLE, desiredaccess : u32, objectattributes : *const OBJECT_ATTRIBUTES, iostatusblock : *mut IO_STATUS_BLOCK, shareaccess : u32, openoptions : u32) -> NTSTATUS); windows_targets::link_raw_dylib!("ntdll.dll" "system" fn NtReadFile(filehandle : HANDLE, event : HANDLE, apcroutine : PIO_APC_ROUTINE, apccontext : *const core::ffi::c_void, iostatusblock : *mut IO_STATUS_BLOCK, buffer : *mut core::ffi::c_void, length : u32, byteoffset : *const i64, key : *const u32) -> NTSTATUS); windows_targets::link_raw_dylib!("ntdll.dll" "system" fn NtWriteFile(filehandle : HANDLE, event : HANDLE, apcroutine : PIO_APC_ROUTINE, apccontext : *const core::ffi::c_void, iostatusblock : *mut IO_STATUS_BLOCK, buffer : *const core::ffi::c_void, length : u32, byteoffset : *const i64, key : *const u32) -> NTSTATUS); windows_targets::link_raw_dylib!("ntdll.dll" "system" fn RtlNtStatusToDosError(status : NTSTATUS) -> u32); } + _ => {} } diff --git a/library/std/src/sys/pal/windows/mod.rs b/library/std/src/sys/pal/windows/mod.rs index 8f54e2376eb8b..10ad4541beda3 100644 --- a/library/std/src/sys/pal/windows/mod.rs +++ b/library/std/src/sys/pal/windows/mod.rs @@ -22,10 +22,11 @@ pub mod os; pub mod pipe; pub mod thread; pub mod time; -cfg_if::cfg_if! { - if #[cfg(not(target_vendor = "uwp"))] { +cfg_select! { + not(target_vendor = "uwp") => { pub mod stack_overflow; - } else { + } + _ => { pub mod stack_overflow_uwp; pub use self::stack_overflow_uwp as stack_overflow; } @@ -337,14 +338,17 @@ pub fn dur2timeout(dur: Duration) -> u32 { #[cfg(not(miri))] // inline assembly does not work in Miri pub fn abort_internal() -> ! { unsafe { - cfg_if::cfg_if! { - if #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] { + cfg_select! { + any(target_arch = "x86", target_arch = "x86_64") => { core::arch::asm!("int $$0x29", in("ecx") c::FAST_FAIL_FATAL_APP_EXIT, options(noreturn, nostack)); - } else if #[cfg(all(target_arch = "arm", target_feature = "thumb-mode"))] { + } + all(target_arch = "arm", target_feature = "thumb-mode") => { core::arch::asm!(".inst 0xDEFB", in("r0") c::FAST_FAIL_FATAL_APP_EXIT, options(noreturn, nostack)); - } else if #[cfg(any(target_arch = "aarch64", target_arch = "arm64ec"))] { + } + any(target_arch = "aarch64", target_arch = "arm64ec") => { core::arch::asm!("brk 0xF003", in("x0") c::FAST_FAIL_FATAL_APP_EXIT, options(noreturn, nostack)); - } else { + } + _ => { core::intrinsics::abort(); } } diff --git a/library/std/src/sys/path/mod.rs b/library/std/src/sys/path/mod.rs index a4ff4338cf5f4..254683bc83f91 100644 --- a/library/std/src/sys/path/mod.rs +++ b/library/std/src/sys/path/mod.rs @@ -1,22 +1,27 @@ -cfg_if::cfg_if! { - if #[cfg(target_os = "windows")] { +cfg_select! { + target_os = "windows" => { mod windows; mod windows_prefix; pub use windows::*; - } else if #[cfg(all(target_vendor = "fortanix", target_env = "sgx"))] { + } + all(target_vendor = "fortanix", target_env = "sgx") => { mod sgx; pub use sgx::*; - } else if #[cfg(target_os = "solid_asp3")] { + } + target_os = "solid_asp3" => { mod unsupported_backslash; pub use unsupported_backslash::*; - } else if #[cfg(target_os = "uefi")] { + } + target_os = "uefi" => { mod uefi; pub use uefi::*; - } else if #[cfg(target_os = "cygwin")] { + } + target_os = "cygwin" => { mod cygwin; mod windows_prefix; pub use cygwin::*; - } else { + } + _ => { mod unix; pub use unix::*; } diff --git a/library/std/src/sys/personality/gcc.rs b/library/std/src/sys/personality/gcc.rs index 75e793f18b835..019d5629d6d6e 100644 --- a/library/std/src/sys/personality/gcc.rs +++ b/library/std/src/sys/personality/gcc.rs @@ -93,12 +93,12 @@ const UNWIND_DATA_REG: (i32, i32) = (4, 5); // a0, a1 // https://github.com/gcc-mirror/gcc/blob/master/libstdc++-v3/libsupc++/eh_personality.cc // https://github.com/gcc-mirror/gcc/blob/trunk/libgcc/unwind-c.c -cfg_if::cfg_if! { - if #[cfg(all( +cfg_select! { + all( target_arch = "arm", not(target_vendor = "apple"), not(target_os = "netbsd"), - ))] { + ) => { /// personality fn called by [ARM EHABI][armeabi-eh] /// /// 32-bit ARM on iOS/tvOS/watchOS does not use ARM EHABI, it uses @@ -202,7 +202,8 @@ cfg_if::cfg_if! { } } } - } else { + } + _ => { /// Default personality routine, which is used directly on most targets /// and indirectly on Windows x86_64 and AArch64 via SEH. unsafe extern "C" fn rust_eh_personality_impl( @@ -247,11 +248,11 @@ cfg_if::cfg_if! { } } - cfg_if::cfg_if! { - if #[cfg(any( - all(windows, any(target_arch = "aarch64", target_arch = "x86_64"), target_env = "gnu"), - target_os = "cygwin", - ))] { + cfg_select! { + any( + all(windows, any(target_arch = "aarch64", target_arch = "x86_64"), target_env = "gnu"), + target_os = "cygwin", + ) => { /// personality fn called by [Windows Structured Exception Handling][windows-eh] /// /// On x86_64 and AArch64 MinGW targets, the unwinding mechanism is SEH, @@ -279,7 +280,8 @@ cfg_if::cfg_if! { ) } } - } else { + } + _ => { /// personality fn called by [Itanium C++ ABI Exception Handling][itanium-eh] /// /// The personality routine for most non-Windows targets. This will be called by diff --git a/library/std/src/sys/personality/mod.rs b/library/std/src/sys/personality/mod.rs index 2e1d2e53a2979..158e44e1764a3 100644 --- a/library/std/src/sys/personality/mod.rs +++ b/library/std/src/sys/personality/mod.rs @@ -13,10 +13,11 @@ mod dwarf; #[cfg(not(any(test, doctest)))] -cfg_if::cfg_if! { - if #[cfg(target_os = "emscripten")] { +cfg_select! { + target_os = "emscripten" => { mod emcc; - } else if #[cfg(any(target_env = "msvc", target_family = "wasm"))] { + } + any(target_env = "msvc", target_family = "wasm") => { // This is required by the compiler to exist (e.g., it's a lang item), // but it's never actually called by the compiler because // __CxxFrameHandler3 (msvc) / __gxx_wasm_personality_v0 (wasm) is the @@ -26,16 +27,18 @@ cfg_if::cfg_if! { fn rust_eh_personality() { core::intrinsics::abort() } - } else if #[cfg(any( + } + any( all(target_family = "windows", target_env = "gnu"), target_os = "psp", target_os = "xous", target_os = "solid_asp3", all(target_family = "unix", not(target_os = "espidf"), not(target_os = "l4re"), not(target_os = "nuttx")), all(target_vendor = "fortanix", target_env = "sgx"), - ))] { + ) => { mod gcc; - } else { + } + _ => { // Targets that don't support unwinding. // - os=none ("bare metal" targets) // - os=uefi diff --git a/library/std/src/sys/process/mod.rs b/library/std/src/sys/process/mod.rs index 91c7005a32855..9ef5496e57a05 100644 --- a/library/std/src/sys/process/mod.rs +++ b/library/std/src/sys/process/mod.rs @@ -1,14 +1,17 @@ -cfg_if::cfg_if! { - if #[cfg(target_family = "unix")] { +cfg_select! { + target_family = "unix" => { mod unix; use unix as imp; - } else if #[cfg(target_os = "windows")] { + } + target_os = "windows" => { mod windows; use windows as imp; - } else if #[cfg(target_os = "uefi")] { + } + target_os = "uefi" => { mod uefi; use uefi as imp; - } else { + } + _ => { mod unsupported; use unsupported as imp; } diff --git a/library/std/src/sys/process/unix/common.rs b/library/std/src/sys/process/unix/common.rs index 6219be60caf2c..ea45b08e90a34 100644 --- a/library/std/src/sys/process/unix/common.rs +++ b/library/std/src/sys/process/unix/common.rs @@ -20,12 +20,14 @@ use crate::{fmt, io}; mod cstring_array; -cfg_if::cfg_if! { - if #[cfg(target_os = "fuchsia")] { +cfg_select! { + target_os = "fuchsia" => { // fuchsia doesn't have /dev/null - } else if #[cfg(target_os = "vxworks")] { + } + target_os = "vxworks" => { const DEV_NULL: &CStr = c"/null"; - } else { + } + _ => { const DEV_NULL: &CStr = c"/dev/null"; } } @@ -35,8 +37,8 @@ cfg_if::cfg_if! { // to support older Android version (independent of libc version). // The following implementations are based on // https://github.com/aosp-mirror/platform_bionic/blob/ad8dcd6023294b646e5a8288c0ed431b0845da49/libc/include/android/legacy_signal_inlines.h -cfg_if::cfg_if! { - if #[cfg(target_os = "android")] { +cfg_select! { + target_os = "android" => { #[allow(dead_code)] pub unsafe fn sigemptyset(set: *mut libc::sigset_t) -> libc::c_int { set.write_bytes(0u8, 1); @@ -69,7 +71,8 @@ cfg_if::cfg_if! { raw[bit / LONG_BIT] |= 1 << (bit % LONG_BIT); return 0; } - } else { + } + _ => { #[allow(unused_imports)] pub use libc::{sigemptyset, sigaddset}; } diff --git a/library/std/src/sys/process/unix/mod.rs b/library/std/src/sys/process/unix/mod.rs index ee8fd8b2ca3c6..b4cf060fba9bf 100644 --- a/library/std/src/sys/process/unix/mod.rs +++ b/library/std/src/sys/process/unix/mod.rs @@ -1,18 +1,21 @@ #[cfg_attr(any(target_os = "espidf", target_os = "horizon", target_os = "nuttx"), allow(unused))] mod common; -cfg_if::cfg_if! { - if #[cfg(target_os = "fuchsia")] { +cfg_select! { + target_os = "fuchsia" => { mod fuchsia; use fuchsia as imp; - } else if #[cfg(target_os = "vxworks")] { + } + target_os = "vxworks" => { mod vxworks; use vxworks as imp; - } else if #[cfg(any(target_os = "espidf", target_os = "horizon", target_os = "vita", target_os = "nuttx"))] { + } + any(target_os = "espidf", target_os = "horizon", target_os = "vita", target_os = "nuttx") => { mod unsupported; use unsupported as imp; pub use unsupported::output; - } else { + } + _ => { mod unix; use unix as imp; } diff --git a/library/std/src/sys/process/unix/unix.rs b/library/std/src/sys/process/unix/unix.rs index 5d13d6da18582..11d48878727b0 100644 --- a/library/std/src/sys/process/unix/unix.rs +++ b/library/std/src/sys/process/unix/unix.rs @@ -18,8 +18,8 @@ use crate::sys::cvt; use crate::sys::pal::linux::pidfd::PidFd; use crate::{fmt, mem, sys}; -cfg_if::cfg_if! { - if #[cfg(target_os = "nto")] { +cfg_select! { + target_os = "nto" => { use crate::thread; use libc::{c_char, posix_spawn_file_actions_t, posix_spawnattr_t}; use crate::time::Duration; @@ -43,6 +43,7 @@ cfg_if::cfg_if! { // Maximum duration of sleeping before giving up and returning an error const MAX_FORKSPAWN_SLEEP: Duration = Duration::from_millis(1000); } + _ => {} } //////////////////////////////////////////////////////////////////////////////// @@ -465,8 +466,8 @@ impl Command { return Ok(None); } - cfg_if::cfg_if! { - if #[cfg(target_os = "linux")] { + cfg_select! { + target_os = "linux" => { use crate::sys::weak::weak; weak!( @@ -526,7 +527,8 @@ impl Command { } core::assert_matches::debug_assert_matches!(support, SPAWN | NO); } - } else { + } + _ => { if self.get_create_pidfd() { unreachable!("only implemented on linux") } @@ -746,10 +748,11 @@ impl Command { } if self.get_setsid() { - cfg_if::cfg_if! { - if #[cfg(all(target_os = "linux", target_env = "gnu"))] { + cfg_select! { + all(target_os = "linux", target_env = "gnu") => { flags |= libc::POSIX_SPAWN_SETSID; - } else { + } + _ => { return Ok(None); } } diff --git a/library/std/src/sys/random/mod.rs b/library/std/src/sys/random/mod.rs index fc85797dcc269..a7fbae8609930 100644 --- a/library/std/src/sys/random/mod.rs +++ b/library/std/src/sys/random/mod.rs @@ -1,16 +1,19 @@ -cfg_if::cfg_if! { +cfg_select! { // Tier 1 - if #[cfg(any(target_os = "linux", target_os = "android"))] { + any(target_os = "linux", target_os = "android") => { mod linux; pub use linux::{fill_bytes, hashmap_random_keys}; - } else if #[cfg(target_os = "windows")] { + } + target_os = "windows" => { mod windows; pub use windows::fill_bytes; - } else if #[cfg(target_vendor = "apple")] { + } + target_vendor = "apple" => { mod apple; pub use apple::fill_bytes; // Others, in alphabetical ordering. - } else if #[cfg(any( + } + any( target_os = "dragonfly", target_os = "freebsd", target_os = "haiku", @@ -21,69 +24,86 @@ cfg_if::cfg_if! { target_os = "solaris", target_os = "vita", target_os = "nuttx", - ))] { + ) => { mod arc4random; pub use arc4random::fill_bytes; - } else if #[cfg(target_os = "emscripten")] { + } + target_os = "emscripten" => { mod getentropy; pub use getentropy::fill_bytes; - } else if #[cfg(target_os = "espidf")] { + } + target_os = "espidf" => { mod espidf; pub use espidf::fill_bytes; - } else if #[cfg(target_os = "fuchsia")] { + } + target_os = "fuchsia" => { mod fuchsia; pub use fuchsia::fill_bytes; - } else if #[cfg(target_os = "hermit")] { + } + target_os = "hermit" => { mod hermit; pub use hermit::fill_bytes; - } else if #[cfg(any(target_os = "horizon", target_os = "cygwin"))] { + } + any(target_os = "horizon", target_os = "cygwin") => { // FIXME(horizon): add arc4random_buf to shim-3ds mod getrandom; pub use getrandom::fill_bytes; - } else if #[cfg(any( + } + any( target_os = "aix", target_os = "hurd", target_os = "l4re", target_os = "nto", - ))] { + ) => { mod unix_legacy; pub use unix_legacy::fill_bytes; - } else if #[cfg(target_os = "redox")] { + } + target_os = "redox" => { mod redox; pub use redox::fill_bytes; - } else if #[cfg(all(target_vendor = "fortanix", target_env = "sgx"))] { + } + all(target_vendor = "fortanix", target_env = "sgx") => { mod sgx; pub use sgx::fill_bytes; - } else if #[cfg(target_os = "solid_asp3")] { + } + target_os = "solid_asp3" => { mod solid; pub use solid::fill_bytes; - } else if #[cfg(target_os = "teeos")] { + } + target_os = "teeos" => { mod teeos; pub use teeos::fill_bytes; - } else if #[cfg(target_os = "trusty")] { + } + target_os = "trusty" => { mod trusty; pub use trusty::fill_bytes; - } else if #[cfg(target_os = "uefi")] { + } + target_os = "uefi" => { mod uefi; pub use uefi::fill_bytes; - } else if #[cfg(target_os = "vxworks")] { + } + target_os = "vxworks" => { mod vxworks; pub use vxworks::fill_bytes; - } else if #[cfg(target_os = "wasi")] { + } + target_os = "wasi" => { mod wasi; pub use wasi::fill_bytes; - } else if #[cfg(target_os = "zkvm")] { + } + target_os = "zkvm" => { mod zkvm; pub use zkvm::fill_bytes; - } else if #[cfg(any( + } + any( all(target_family = "wasm", target_os = "unknown"), target_os = "xous", - ))] { + ) => { // FIXME: finally remove std support for wasm32-unknown-unknown // FIXME: add random data generation to xous mod unsupported; pub use unsupported::{fill_bytes, hashmap_random_keys}; } + _ => {} } #[cfg(not(any( diff --git a/library/std/src/sys/random/uefi.rs b/library/std/src/sys/random/uefi.rs index 4a71d32fffeb4..697933f197b75 100644 --- a/library/std/src/sys/random/uefi.rs +++ b/library/std/src/sys/random/uefi.rs @@ -55,12 +55,13 @@ mod rng_protocol { /// Port from [getrandom](https://github.com/rust-random/getrandom/blob/master/src/backends/rdrand.rs) #[cfg(any(target_arch = "x86_64", target_arch = "x86"))] mod rdrand { - cfg_if::cfg_if! { - if #[cfg(target_arch = "x86_64")] { + cfg_select! { + target_arch = "x86_64" => { use crate::arch::x86_64 as arch; use arch::_rdrand64_step as rdrand_step; type Word = u64; - } else if #[cfg(target_arch = "x86")] { + } + target_arch = "x86" => { use crate::arch::x86 as arch; use arch::_rdrand32_step as rdrand_step; type Word = u32; diff --git a/library/std/src/sys/stdio/mod.rs b/library/std/src/sys/stdio/mod.rs index 336d4c8527db3..314f226f07beb 100644 --- a/library/std/src/sys/stdio/mod.rs +++ b/library/std/src/sys/stdio/mod.rs @@ -1,40 +1,47 @@ #![forbid(unsafe_op_in_unsafe_fn)] -cfg_if::cfg_if! { - if #[cfg(any( - target_family = "unix", - target_os = "hermit" - ))] { +cfg_select! { + any(target_family = "unix", target_os = "hermit") => { mod unix; pub use unix::*; - } else if #[cfg(target_os = "windows")] { + } + target_os = "windows" => { mod windows; pub use windows::*; - } else if #[cfg(all(target_vendor = "fortanix", target_env = "sgx"))] { + } + all(target_vendor = "fortanix", target_env = "sgx") => { mod sgx; pub use sgx::*; - } else if #[cfg(target_os = "solid_asp3")] { + } + target_os = "solid_asp3" => { mod solid; pub use solid::*; - } else if #[cfg(target_os = "teeos")] { + } + target_os = "teeos" => { mod teeos; pub use teeos::*; - } else if #[cfg(target_os = "trusty")] { + } + target_os = "trusty" => { mod trusty; pub use trusty::*; - } else if #[cfg(target_os = "uefi")] { + } + target_os = "uefi" => { mod uefi; pub use uefi::*; - } else if #[cfg(target_os = "wasi")] { + } + target_os = "wasi" => { mod wasi; pub use wasi::*; - } else if #[cfg(target_os = "xous")] { + } + target_os = "xous" => { mod xous; pub use xous::*; - } else if #[cfg(target_os = "zkvm")] { + } + target_os = "zkvm" => { mod zkvm; pub use zkvm::*; - } else { + } + _ => { mod unsupported; pub use unsupported::*; } diff --git a/library/std/src/sys/sync/condvar/mod.rs b/library/std/src/sys/sync/condvar/mod.rs index d0c998a559737..cb67d273759dd 100644 --- a/library/std/src/sys/sync/condvar/mod.rs +++ b/library/std/src/sys/sync/condvar/mod.rs @@ -1,5 +1,5 @@ -cfg_if::cfg_if! { - if #[cfg(any( +cfg_select! { + any( all(target_os = "windows", not(target_vendor="win7")), target_os = "linux", target_os = "android", @@ -9,28 +9,34 @@ cfg_if::cfg_if! { target_os = "fuchsia", all(target_family = "wasm", target_feature = "atomics"), target_os = "hermit", - ))] { + ) => { mod futex; pub use futex::Condvar; - } else if #[cfg(any( + } + any( target_family = "unix", target_os = "teeos", - ))] { + ) => { mod pthread; pub use pthread::Condvar; - } else if #[cfg(all(target_os = "windows", target_vendor = "win7"))] { + } + all(target_os = "windows", target_vendor = "win7") => { mod windows7; pub use windows7::Condvar; - } else if #[cfg(all(target_vendor = "fortanix", target_env = "sgx"))] { + } + all(target_vendor = "fortanix", target_env = "sgx") => { mod sgx; pub use sgx::Condvar; - } else if #[cfg(target_os = "solid_asp3")] { + } + target_os = "solid_asp3" => { mod itron; pub use itron::Condvar; - } else if #[cfg(target_os = "xous")] { + } + target_os = "xous" => { mod xous; pub use xous::Condvar; - } else { + } + _ => { mod no_threads; pub use no_threads::Condvar; } diff --git a/library/std/src/sys/sync/mutex/mod.rs b/library/std/src/sys/sync/mutex/mod.rs index 360df3fc4b55d..c885b0eabae2d 100644 --- a/library/std/src/sys/sync/mutex/mod.rs +++ b/library/std/src/sys/sync/mutex/mod.rs @@ -1,5 +1,5 @@ -cfg_if::cfg_if! { - if #[cfg(any( +cfg_select! { + any( all(target_os = "windows", not(target_vendor = "win7")), target_os = "linux", target_os = "android", @@ -8,31 +8,38 @@ cfg_if::cfg_if! { target_os = "dragonfly", all(target_family = "wasm", target_feature = "atomics"), target_os = "hermit", - ))] { + ) => { mod futex; pub use futex::Mutex; - } else if #[cfg(target_os = "fuchsia")] { + } + target_os = "fuchsia" => { mod fuchsia; pub use fuchsia::Mutex; - } else if #[cfg(any( + } + any( target_family = "unix", target_os = "teeos", - ))] { + ) => { mod pthread; pub use pthread::Mutex; - } else if #[cfg(all(target_os = "windows", target_vendor = "win7"))] { + } + all(target_os = "windows", target_vendor = "win7") => { mod windows7; pub use windows7::{Mutex, raw}; - } else if #[cfg(all(target_vendor = "fortanix", target_env = "sgx"))] { + } + all(target_vendor = "fortanix", target_env = "sgx") => { mod sgx; pub use sgx::Mutex; - } else if #[cfg(target_os = "solid_asp3")] { + } + target_os = "solid_asp3" => { mod itron; pub use itron::Mutex; - } else if #[cfg(target_os = "xous")] { + } + target_os = "xous" => { mod xous; pub use xous::Mutex; - } else { + } + _ => { mod no_threads; pub use no_threads::Mutex; } diff --git a/library/std/src/sys/sync/once/mod.rs b/library/std/src/sys/sync/once/mod.rs index 0e38937b1219a..8adeb1f259d72 100644 --- a/library/std/src/sys/sync/once/mod.rs +++ b/library/std/src/sys/sync/once/mod.rs @@ -7,8 +7,8 @@ // This also gives us the opportunity to optimize the implementation a bit which // should help the fast path on call sites. -cfg_if::cfg_if! { - if #[cfg(any( +cfg_select! { + any( all(target_os = "windows", not(target_vendor="win7")), target_os = "linux", target_os = "android", @@ -18,19 +18,21 @@ cfg_if::cfg_if! { target_os = "dragonfly", target_os = "fuchsia", target_os = "hermit", - ))] { + ) => { mod futex; pub use futex::{Once, OnceState}; - } else if #[cfg(any( + } + any( windows, target_family = "unix", all(target_vendor = "fortanix", target_env = "sgx"), target_os = "solid_asp3", target_os = "xous", - ))] { + ) => { mod queue; pub use queue::{Once, OnceState}; - } else { + } + _ => { mod no_threads; pub use no_threads::{Once, OnceState}; } diff --git a/library/std/src/sys/sync/rwlock/mod.rs b/library/std/src/sys/sync/rwlock/mod.rs index 70ba6bf38ef55..82f1dd18dee49 100644 --- a/library/std/src/sys/sync/rwlock/mod.rs +++ b/library/std/src/sys/sync/rwlock/mod.rs @@ -1,5 +1,5 @@ -cfg_if::cfg_if! { - if #[cfg(any( +cfg_select! { + any( all(target_os = "windows", not(target_vendor = "win7")), target_os = "linux", target_os = "android", @@ -9,24 +9,28 @@ cfg_if::cfg_if! { target_os = "fuchsia", all(target_family = "wasm", target_feature = "atomics"), target_os = "hermit", - ))] { + ) => { mod futex; pub use futex::RwLock; - } else if #[cfg(any( + } + any( target_family = "unix", all(target_os = "windows", target_vendor = "win7"), all(target_vendor = "fortanix", target_env = "sgx"), target_os = "xous", - ))] { + ) => { mod queue; pub use queue::RwLock; - } else if #[cfg(target_os = "solid_asp3")] { + } + target_os = "solid_asp3" => { mod solid; pub use solid::RwLock; - } else if #[cfg(target_os = "teeos")] { + } + target_os = "teeos" => { mod teeos; pub use teeos::RwLock; - } else { + } + _ => { mod no_threads; pub use no_threads::RwLock; } diff --git a/library/std/src/sys/sync/thread_parking/mod.rs b/library/std/src/sys/sync/thread_parking/mod.rs index f4d8fa0a58c11..b9fb27b4eef2d 100644 --- a/library/std/src/sys/sync/thread_parking/mod.rs +++ b/library/std/src/sys/sync/thread_parking/mod.rs @@ -1,5 +1,5 @@ -cfg_if::cfg_if! { - if #[cfg(any( +cfg_select! { + any( all(target_os = "windows", not(target_vendor = "win7")), target_os = "linux", target_os = "android", @@ -9,30 +9,36 @@ cfg_if::cfg_if! { target_os = "dragonfly", target_os = "fuchsia", target_os = "hermit", - ))] { + ) => { mod futex; pub use futex::Parker; - } else if #[cfg(any( + } + any( target_os = "netbsd", all(target_vendor = "fortanix", target_env = "sgx"), target_os = "solid_asp3", - ))] { + ) => { mod id; pub use id::Parker; - } else if #[cfg(target_vendor = "win7")] { + } + target_vendor = "win7" => { mod windows7; pub use windows7::Parker; - } else if #[cfg(all(target_vendor = "apple", not(miri)))] { + } + all(target_vendor = "apple", not(miri)) => { // Doesn't work in Miri, see . mod darwin; pub use darwin::Parker; - } else if #[cfg(target_os = "xous")] { + } + target_os = "xous" => { mod xous; pub use xous::Parker; - } else if #[cfg(target_family = "unix")] { + } + target_family = "unix" => { mod pthread; pub use pthread::Parker; - } else { + } + _ => { mod unsupported; pub use unsupported::Parker; } diff --git a/library/std/src/sys/thread_local/mod.rs b/library/std/src/sys/thread_local/mod.rs index 9fafac3aa5b41..cff74857c4733 100644 --- a/library/std/src/sys/thread_local/mod.rs +++ b/library/std/src/sys/thread_local/mod.rs @@ -23,21 +23,23 @@ issue = "none" )] -cfg_if::cfg_if! { - if #[cfg(any( +cfg_select! { + any( all(target_family = "wasm", not(target_feature = "atomics")), target_os = "uefi", target_os = "zkvm", target_os = "trusty", - ))] { + ) => { mod no_threads; pub use no_threads::{EagerStorage, LazyStorage, thread_local_inner}; pub(crate) use no_threads::{LocalPointer, local_pointer}; - } else if #[cfg(target_thread_local)] { + } + target_thread_local => { mod native; pub use native::{EagerStorage, LazyStorage, thread_local_inner}; pub(crate) use native::{LocalPointer, local_pointer}; - } else { + } + _ => { mod os; pub use os::{Storage, thread_local_inner}; pub(crate) use os::{LocalPointer, local_pointer}; @@ -53,8 +55,8 @@ cfg_if::cfg_if! { /// single callback that runs all of the destructors in the list. #[cfg(all(target_thread_local, not(all(target_family = "wasm", not(target_feature = "atomics")))))] pub(crate) mod destructors { - cfg_if::cfg_if! { - if #[cfg(any( + cfg_select! { + any( target_os = "linux", target_os = "android", target_os = "fuchsia", @@ -62,12 +64,13 @@ pub(crate) mod destructors { target_os = "hurd", target_os = "netbsd", target_os = "dragonfly" - ))] { + ) => { mod linux_like; mod list; pub(super) use linux_like::register; pub(super) use list::run; - } else { + } + _ => { mod list; pub(super) use list::register; pub(crate) use list::run; @@ -79,21 +82,23 @@ pub(crate) mod destructors { /// and the [runtime cleanup](crate::rt::thread_cleanup) function. Calling `enable` /// should ensure that these functions are called at the right times. pub(crate) mod guard { - cfg_if::cfg_if! { - if #[cfg(all(target_thread_local, target_vendor = "apple"))] { + cfg_select! { + all(target_thread_local, target_vendor = "apple") => { mod apple; pub(crate) use apple::enable; - } else if #[cfg(target_os = "windows")] { + } + target_os = "windows" => { mod windows; pub(crate) use windows::enable; - } else if #[cfg(any( + } + any( all(target_family = "wasm", not( all(target_os = "wasi", target_env = "p1", target_feature = "atomics") )), target_os = "uefi", target_os = "zkvm", target_os = "trusty", - ))] { + ) => { pub(crate) fn enable() { // FIXME: Right now there is no concept of "thread exit" on // wasm, but this is likely going to show up at some point in @@ -107,17 +112,20 @@ pub(crate) mod guard { #[allow(unused)] use crate::rt::thread_cleanup; } - } else if #[cfg(any( + } + any( target_os = "hermit", target_os = "xous", - ))] { + ) => { // `std` is the only runtime, so it just calls the destructor functions // itself when the time comes. pub(crate) fn enable() {} - } else if #[cfg(target_os = "solid_asp3")] { + } + target_os = "solid_asp3" => { mod solid; pub(crate) use solid::enable; - } else { + } + _ => { mod key; pub(crate) use key::enable; } @@ -131,8 +139,8 @@ pub(crate) mod guard { /// reference an entry in a thread-local table. This then associates each key /// with a pointer which we can get and set to store our data. pub(crate) mod key { - cfg_if::cfg_if! { - if #[cfg(any( + cfg_select! { + any( all( not(target_vendor = "apple"), not(target_family = "wasm"), @@ -141,7 +149,7 @@ pub(crate) mod key { all(not(target_thread_local), target_vendor = "apple"), target_os = "teeos", all(target_os = "wasi", target_env = "p1", target_feature = "atomics"), - ))] { + ) => { mod racy; mod unix; #[cfg(test)] @@ -151,12 +159,14 @@ pub(crate) mod key { #[cfg(any(not(target_thread_local), test))] pub(super) use unix::get; use unix::{create, destroy}; - } else if #[cfg(all(not(target_thread_local), target_os = "windows"))] { + } + all(not(target_thread_local), target_os = "windows") => { #[cfg(test)] mod tests; mod windows; pub(super) use windows::{Key, LazyKey, get, run_dtors, set}; - } else if #[cfg(all(target_vendor = "fortanix", target_env = "sgx"))] { + } + all(target_vendor = "fortanix", target_env = "sgx") => { mod racy; mod sgx; #[cfg(test)] @@ -164,7 +174,8 @@ pub(crate) mod key { pub(super) use racy::LazyKey; pub(super) use sgx::{Key, get, set}; use sgx::{create, destroy}; - } else if #[cfg(target_os = "xous")] { + } + target_os = "xous" => { mod racy; #[cfg(test)] mod tests; @@ -174,6 +185,7 @@ pub(crate) mod key { pub(super) use xous::{Key, get, set}; use xous::{create, destroy}; } + _ => {} } } diff --git a/library/std/src/thread/current.rs b/library/std/src/thread/current.rs index 5c87990352691..7da1621da45ce 100644 --- a/library/std/src/thread/current.rs +++ b/library/std/src/thread/current.rs @@ -18,8 +18,8 @@ local_pointer! { pub(super) mod id { use super::*; - cfg_if::cfg_if! { - if #[cfg(target_thread_local)] { + cfg_select! { + target_thread_local => { use crate::cell::Cell; #[thread_local] @@ -34,7 +34,8 @@ pub(super) mod id { pub(super) fn set(id: ThreadId) { ID.set(Some(id)) } - } else if #[cfg(target_pointer_width = "16")] { + } + target_pointer_width = "16" => { local_pointer! { static ID0; static ID16; @@ -59,7 +60,8 @@ pub(super) mod id { ID32.set(ptr::without_provenance_mut((val >> 32) as usize)); ID48.set(ptr::without_provenance_mut((val >> 48) as usize)); } - } else if #[cfg(target_pointer_width = "32")] { + } + target_pointer_width = "32" => { local_pointer! { static ID0; static ID32; @@ -78,7 +80,8 @@ pub(super) mod id { ID0.set(ptr::without_provenance_mut(val as usize)); ID32.set(ptr::without_provenance_mut((val >> 32) as usize)); } - } else { + } + _ => { local_pointer! { static ID; } diff --git a/library/std/src/thread/mod.rs b/library/std/src/thread/mod.rs index 292323d011892..b6059c28cec7d 100644 --- a/library/std/src/thread/mod.rs +++ b/library/std/src/thread/mod.rs @@ -1212,8 +1212,8 @@ impl ThreadId { panic!("failed to generate unique thread ID: bitspace exhausted") } - cfg_if::cfg_if! { - if #[cfg(target_has_atomic = "64")] { + cfg_select! { + target_has_atomic = "64" => { use crate::sync::atomic::{Atomic, AtomicU64}; static COUNTER: Atomic = AtomicU64::new(0); @@ -1229,7 +1229,8 @@ impl ThreadId { Err(id) => last = id, } } - } else { + } + _ => { use crate::sync::{Mutex, PoisonError}; static COUNTER: Mutex = Mutex::new(0); @@ -1318,8 +1319,8 @@ use thread_name_string::ThreadNameString; /// Note however that this also means that the name reported in pre-main functions /// will be incorrect, but that's just something we have to live with. pub(crate) mod main_thread { - cfg_if::cfg_if! { - if #[cfg(target_has_atomic = "64")] { + cfg_select! { + target_has_atomic = "64" => { use super::ThreadId; use crate::sync::atomic::{Atomic, AtomicU64}; use crate::sync::atomic::Ordering::Relaxed; @@ -1335,7 +1336,8 @@ pub(crate) mod main_thread { pub(crate) unsafe fn set(id: ThreadId) { MAIN.store(id.as_u64().get(), Relaxed) } - } else { + } + _ => { use super::ThreadId; use crate::mem::MaybeUninit; use crate::sync::atomic::{Atomic, AtomicBool}; diff --git a/library/std/tests/env_modify.rs b/library/std/tests/env_modify.rs index ba84978b35f8f..fe0ae68806e9d 100644 --- a/library/std/tests/env_modify.rs +++ b/library/std/tests/env_modify.rs @@ -1,5 +1,6 @@ // These tests are in a separate integration test as they modify the environment, // and would otherwise cause some other tests to fail. +#![feature(cfg_select)] use std::env::*; use std::ffi::{OsStr, OsString}; @@ -110,8 +111,8 @@ fn env_home_dir() { } } - cfg_if::cfg_if! { - if #[cfg(unix)] { + cfg_select! { + unix => { let oldhome = var_to_os_string(var("HOME")); unsafe { @@ -130,7 +131,8 @@ fn env_home_dir() { } if let Some(oldhome) = oldhome { unsafe { set_var("HOME", oldhome); } } - } else if #[cfg(windows)] { + } + windows => { let oldhome = var_to_os_string(var("HOME")); let olduserprofile = var_to_os_string(var("USERPROFILE")); @@ -159,6 +161,7 @@ fn env_home_dir() { if let Some(olduserprofile) = olduserprofile { set_var("USERPROFILE", olduserprofile); } } } + _ => {} } } diff --git a/library/std_detect/Cargo.toml b/library/std_detect/Cargo.toml index 8d91454726bce..33e6617c38147 100644 --- a/library/std_detect/Cargo.toml +++ b/library/std_detect/Cargo.toml @@ -21,7 +21,6 @@ is-it-maintained-open-issues = { repository = "rust-lang/stdarch" } maintenance = { status = "experimental" } [dependencies] -cfg-if = "1.0.0" core = { path = "../core" } alloc = { path = "../alloc" } diff --git a/library/std_detect/src/detect/arch/mod.rs b/library/std_detect/src/detect/arch/mod.rs index b0be554ed898f..c066b9cc68155 100644 --- a/library/std_detect/src/detect/arch/mod.rs +++ b/library/std_detect/src/detect/arch/mod.rs @@ -1,7 +1,5 @@ #![allow(dead_code)] -use cfg_if::cfg_if; - // Export the macros for all supported architectures. #[macro_use] mod x86; @@ -24,38 +22,48 @@ mod loongarch; #[macro_use] mod s390x; -cfg_if! { - if #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] { +cfg_select! { + any(target_arch = "x86", target_arch = "x86_64") => { #[stable(feature = "simd_x86", since = "1.27.0")] pub use x86::*; - } else if #[cfg(target_arch = "arm")] { + } + target_arch = "arm" => { #[unstable(feature = "stdarch_arm_feature_detection", issue = "111190")] pub use arm::*; - } else if #[cfg(any(target_arch = "aarch64", target_arch = "arm64ec"))] { + } + any(target_arch = "aarch64", target_arch = "arm64ec") => { #[stable(feature = "simd_aarch64", since = "1.60.0")] pub use aarch64::*; - } else if #[cfg(any(target_arch = "riscv32", target_arch = "riscv64"))] { + } + any(target_arch = "riscv32", target_arch = "riscv64") => { #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] pub use riscv::*; - } else if #[cfg(target_arch = "powerpc")] { + } + target_arch = "powerpc" => { #[unstable(feature = "stdarch_powerpc_feature_detection", issue = "111191")] pub use powerpc::*; - } else if #[cfg(target_arch = "powerpc64")] { + } + target_arch = "powerpc64" => { #[unstable(feature = "stdarch_powerpc_feature_detection", issue = "111191")] pub use powerpc64::*; - } else if #[cfg(target_arch = "mips")] { + } + target_arch = "mips" => { #[unstable(feature = "stdarch_mips_feature_detection", issue = "111188")] pub use mips::*; - } else if #[cfg(target_arch = "mips64")] { + } + target_arch = "mips64" => { #[unstable(feature = "stdarch_mips_feature_detection", issue = "111188")] pub use mips64::*; - } else if #[cfg(any(target_arch = "loongarch32", target_arch = "loongarch64"))] { + } + any(target_arch = "loongarch32", target_arch = "loongarch64") => { #[stable(feature = "stdarch_loongarch_feature", since = "1.89.0")] pub use loongarch::*; - } else if #[cfg(target_arch = "s390x")] { + } + target_arch = "s390x" => { #[unstable(feature = "stdarch_s390x_feature_detection", issue = "135413")] pub use s390x::*; - } else { + } + _ => { // Unimplemented architecture: #[doc(hidden)] pub(crate) enum Feature { diff --git a/library/std_detect/src/detect/cache.rs b/library/std_detect/src/detect/cache.rs index 1a42e09146319..c0c0b7b7f8635 100644 --- a/library/std_detect/src/detect/cache.rs +++ b/library/std_detect/src/detect/cache.rs @@ -101,8 +101,8 @@ impl Cache { } } -cfg_if::cfg_if! { - if #[cfg(feature = "std_detect_env_override")] { +cfg_select! { + feature = "std_detect_env_override" => { #[inline] fn disable_features(disable: &[u8], value: &mut Initializer) { if let Ok(disable) = core::str::from_utf8(disable) { @@ -116,8 +116,8 @@ cfg_if::cfg_if! { fn initialize(mut value: Initializer) -> Initializer { use core::ffi::CStr; const RUST_STD_DETECT_UNSTABLE: &CStr = c"RUST_STD_DETECT_UNSTABLE"; - cfg_if::cfg_if! { - if #[cfg(windows)] { + cfg_select! { + windows => { use alloc::vec; #[link(name = "kernel32")] unsafe extern "system" { @@ -132,7 +132,8 @@ cfg_if::cfg_if! { disable_features(&env[..len as usize], &mut value); } } - } else { + } + _ => { let env = unsafe { libc::getenv(RUST_STD_DETECT_UNSTABLE.as_ptr()) }; @@ -146,7 +147,8 @@ cfg_if::cfg_if! { do_initialize(value); value } - } else { + } + _ => { #[inline] fn initialize(value: Initializer) -> Initializer { do_initialize(value); diff --git a/library/std_detect/src/detect/mod.rs b/library/std_detect/src/detect/mod.rs index f936a5a1345d9..2bc6e9a24db9a 100644 --- a/library/std_detect/src/detect/mod.rs +++ b/library/std_detect/src/detect/mod.rs @@ -17,8 +17,6 @@ //! due to security concerns (x86 is the big exception). These functions are //! implemented in the `os/{target_os}.rs` modules. -use cfg_if::cfg_if; - #[macro_use] mod macros; @@ -34,8 +32,8 @@ pub(crate) use self::arch::Feature; mod bit; mod cache; -cfg_if! { - if #[cfg(miri)] { +cfg_select! { + miri => { // When running under miri all target-features that are not enabled at // compile-time are reported as disabled at run-time. // @@ -43,35 +41,42 @@ cfg_if! { // this run-time detection logic is never called. #[path = "os/other.rs"] mod os; - } else if #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] { + } + any(target_arch = "x86", target_arch = "x86_64") => { // On x86/x86_64 no OS specific functionality is required. #[path = "os/x86.rs"] mod os; - } else if #[cfg(all(any(target_os = "linux", target_os = "android"), feature = "libc"))] { + } + all(any(target_os = "linux", target_os = "android"), feature = "libc") => { #[cfg(any(target_arch = "riscv32", target_arch = "riscv64"))] #[path = "os/riscv.rs"] mod riscv; #[path = "os/linux/mod.rs"] mod os; - } else if #[cfg(all(target_os = "freebsd", feature = "libc"))] { + } + all(target_os = "freebsd", feature = "libc") => { #[cfg(target_arch = "aarch64")] #[path = "os/aarch64.rs"] mod aarch64; #[path = "os/freebsd/mod.rs"] mod os; - } else if #[cfg(all(target_os = "openbsd", target_arch = "aarch64", feature = "libc"))] { + } + all(target_os = "openbsd", target_arch = "aarch64", feature = "libc") => { #[allow(dead_code)] // we don't use code that calls the mrs instruction. #[path = "os/aarch64.rs"] mod aarch64; #[path = "os/openbsd/aarch64.rs"] mod os; - } else if #[cfg(all(target_os = "windows", any(target_arch = "aarch64", target_arch = "arm64ec")))] { + } + all(target_os = "windows", any(target_arch = "aarch64", target_arch = "arm64ec")) => { #[path = "os/windows/aarch64.rs"] mod os; - } else if #[cfg(all(target_vendor = "apple", target_arch = "aarch64", feature = "libc"))] { + } + all(target_vendor = "apple", target_arch = "aarch64", feature = "libc") => { #[path = "os/darwin/aarch64.rs"] mod os; - } else { + } + _ => { #[path = "os/other.rs"] mod os; } @@ -89,8 +94,8 @@ fn check_for(x: Feature) -> bool { /// is `true` if the feature is supported by the host and `false` otherwise. #[unstable(feature = "stdarch_internal", issue = "none")] pub fn features() -> impl Iterator { - cfg_if! { - if #[cfg(any( + cfg_select! { + any( target_arch = "x86", target_arch = "x86_64", target_arch = "arm", @@ -105,7 +110,7 @@ pub fn features() -> impl Iterator { target_arch = "loongarch32", target_arch = "loongarch64", target_arch = "s390x", - ))] { + ) => { (0_u8..Feature::_last as u8).map(|discriminant: u8| { #[allow(bindings_with_variant_name)] // RISC-V has Feature::f let f: Feature = unsafe { core::mem::transmute(discriminant) }; @@ -113,8 +118,7 @@ pub fn features() -> impl Iterator { let enabled: bool = check_for(f); (name, enabled) }) - } else { - None.into_iter() } + _ => None.into_iter(), } } diff --git a/library/std_detect/src/detect/os/freebsd/mod.rs b/library/std_detect/src/detect/os/freebsd/mod.rs index ade7fb6269d13..7de9250e83584 100644 --- a/library/std_detect/src/detect/os/freebsd/mod.rs +++ b/library/std_detect/src/detect/os/freebsd/mod.rs @@ -2,17 +2,20 @@ mod auxvec; -cfg_if::cfg_if! { - if #[cfg(target_arch = "aarch64")] { +cfg_select! { + target_arch = "aarch64" => { mod aarch64; pub(crate) use self::aarch64::detect_features; - } else if #[cfg(target_arch = "arm")] { + } + target_arch = "arm" => { mod arm; pub(crate) use self::arm::detect_features; - } else if #[cfg(target_arch = "powerpc64")] { + } + target_arch = "powerpc64" => { mod powerpc; pub(crate) use self::powerpc::detect_features; - } else { + } + _ => { use crate::detect::cache; /// Performs run-time feature detection. pub(crate) fn detect_features() -> cache::Initializer { diff --git a/library/std_detect/src/detect/os/linux/auxvec.rs b/library/std_detect/src/detect/os/linux/auxvec.rs index 443caaaa1863e..75e01bdc4499d 100644 --- a/library/std_detect/src/detect/os/linux/auxvec.rs +++ b/library/std_detect/src/detect/os/linux/auxvec.rs @@ -131,15 +131,15 @@ pub(crate) fn auxv() -> Result { /// `getauxval` function. If the function is not linked, this function return `Err`. fn getauxval(key: usize) -> Result { type F = unsafe extern "C" fn(libc::c_ulong) -> libc::c_ulong; - cfg_if::cfg_if! { - if #[cfg(all( + cfg_select! { + all( feature = "std_detect_dlsym_getauxval", not(all( target_os = "linux", any(target_env = "gnu", target_env = "musl", target_env = "ohos"), )), not(target_os = "android"), - ))] { + ) => { let ffi_getauxval: F = unsafe { let ptr = libc::dlsym(libc::RTLD_DEFAULT, c"getauxval".as_ptr()); if ptr.is_null() { @@ -147,7 +147,8 @@ fn getauxval(key: usize) -> Result { } core::mem::transmute(ptr) }; - } else { + } + _ => { let ffi_getauxval: F = libc::getauxval; } } diff --git a/library/std_detect/src/detect/os/linux/auxvec/tests.rs b/library/std_detect/src/detect/os/linux/auxvec/tests.rs index 536615fa27251..631a3e5e9ef17 100644 --- a/library/std_detect/src/detect/os/linux/auxvec/tests.rs +++ b/library/std_detect/src/detect/os/linux/auxvec/tests.rs @@ -42,8 +42,8 @@ fn auxv_dump() { } #[cfg(feature = "std_detect_file_io")] -cfg_if::cfg_if! { - if #[cfg(target_arch = "arm")] { +cfg_select! { + target_arch = "arm" => { // The tests below can be executed under qemu, where we do not have access to the test // files on disk, so we need to embed them with `include_bytes!`. #[test] @@ -62,7 +62,8 @@ cfg_if::cfg_if! { assert_eq!(v.hwcap, 126614527); assert_eq!(v.hwcap2, 0); } - } else if #[cfg(target_arch = "aarch64")] { + } + target_arch = "aarch64" => { #[cfg(target_endian = "little")] #[test] fn linux_artificial_aarch64() { @@ -81,6 +82,7 @@ cfg_if::cfg_if! { assert_eq!(v.hwcap2, 0); } } + _ => {} } #[test] diff --git a/library/std_detect/src/detect/os/linux/mod.rs b/library/std_detect/src/detect/os/linux/mod.rs index 5ae2aaeab5b8a..5273c16c0893c 100644 --- a/library/std_detect/src/detect/os/linux/mod.rs +++ b/library/std_detect/src/detect/os/linux/mod.rs @@ -37,29 +37,36 @@ fn read_file(orig_path: &str) -> Result, alloc::string::String> { } } -cfg_if::cfg_if! { - if #[cfg(target_arch = "aarch64")] { +cfg_select! { + target_arch = "aarch64" => { mod aarch64; pub(crate) use self::aarch64::detect_features; - } else if #[cfg(target_arch = "arm")] { + } + target_arch = "arm" => { mod arm; pub(crate) use self::arm::detect_features; - } else if #[cfg(any(target_arch = "riscv32", target_arch = "riscv64"))] { + } + any(target_arch = "riscv32", target_arch = "riscv64") => { mod riscv; pub(crate) use self::riscv::detect_features; - } else if #[cfg(any(target_arch = "mips", target_arch = "mips64"))] { + } + any(target_arch = "mips", target_arch = "mips64") => { mod mips; pub(crate) use self::mips::detect_features; - } else if #[cfg(any(target_arch = "powerpc", target_arch = "powerpc64"))] { + } + any(target_arch = "powerpc", target_arch = "powerpc64") => { mod powerpc; pub(crate) use self::powerpc::detect_features; - } else if #[cfg(any(target_arch = "loongarch32", target_arch = "loongarch64"))] { + } + any(target_arch = "loongarch32", target_arch = "loongarch64") => { mod loongarch; pub(crate) use self::loongarch::detect_features; - } else if #[cfg(target_arch = "s390x")] { + } + target_arch = "s390x" => { mod s390x; pub(crate) use self::s390x::detect_features; - } else { + } + _ => { use crate::detect::cache; /// Performs run-time feature detection. pub(crate) fn detect_features() -> cache::Initializer { diff --git a/library/std_detect/src/lib.rs b/library/std_detect/src/lib.rs index ab1b77bad5bef..73e2f5dd96442 100644 --- a/library/std_detect/src/lib.rs +++ b/library/std_detect/src/lib.rs @@ -15,7 +15,7 @@ //! * `s390x`: [`is_s390x_feature_detected`] #![unstable(feature = "stdarch_internal", issue = "none")] -#![feature(staged_api, doc_cfg, allow_internal_unstable)] +#![feature(staged_api, cfg_select, doc_cfg, allow_internal_unstable)] #![deny(rust_2018_idioms)] #![allow(clippy::shadow_reuse)] #![cfg_attr(test, allow(unused_imports))] diff --git a/library/unwind/Cargo.toml b/library/unwind/Cargo.toml index b9ce676eb3ffe..f02744a107082 100644 --- a/library/unwind/Cargo.toml +++ b/library/unwind/Cargo.toml @@ -14,7 +14,6 @@ bench = false doc = false [dependencies] -cfg-if = "1.0" core = { path = "../rustc-std-workspace-core", package = "rustc-std-workspace-core" } [target.'cfg(not(all(windows, target_env = "msvc")))'.dependencies] diff --git a/library/unwind/src/lib.rs b/library/unwind/src/lib.rs index 5451a38a674ca..cd3a2f33ffa56 100644 --- a/library/unwind/src/lib.rs +++ b/library/unwind/src/lib.rs @@ -1,6 +1,7 @@ #![no_std] #![unstable(feature = "panic_unwind", issue = "32837")] #![feature(cfg_emscripten_wasm_eh)] +#![feature(cfg_select)] #![feature(link_cfg)] #![feature(staged_api)] #![cfg_attr(not(target_env = "msvc"), feature(libc))] @@ -15,32 +16,37 @@ #[cfg(not(all(windows, target_env = "msvc")))] extern crate libc as _; -cfg_if::cfg_if! { - if #[cfg(target_env = "msvc")] { +cfg_select! { + target_env = "msvc" => { // Windows MSVC no extra unwinder support needed - } else if #[cfg(any( + } + any( target_os = "l4re", target_os = "none", target_os = "espidf", target_os = "nuttx", - ))] { + ) => { // These "unix" family members do not have unwinder. - } else if #[cfg(any( + } + any( unix, windows, target_os = "psp", target_os = "solid_asp3", all(target_vendor = "fortanix", target_env = "sgx"), - ))] { + ) => { mod libunwind; pub use libunwind::*; - } else if #[cfg(target_os = "xous")] { + } + target_os = "xous" => { mod unwinding; pub use unwinding::*; - } else if #[cfg(target_family = "wasm")] { + } + target_family = "wasm" => { mod wasm; pub use wasm::*; - } else { + } + _ => { // no unwinder on the system! // - os=none ("bare metal" targets) // - os=hermit @@ -52,17 +58,20 @@ cfg_if::cfg_if! { } #[cfg(target_env = "musl")] -cfg_if::cfg_if! { - if #[cfg(all(feature = "llvm-libunwind", feature = "system-llvm-libunwind"))] { +cfg_select! { + all(feature = "llvm-libunwind", feature = "system-llvm-libunwind") => { compile_error!("`llvm-libunwind` and `system-llvm-libunwind` cannot be enabled at the same time"); - } else if #[cfg(feature = "llvm-libunwind")] { + } + feature = "llvm-libunwind" => { #[link(name = "unwind", kind = "static", modifiers = "-bundle")] unsafe extern "C" {} - } else if #[cfg(feature = "system-llvm-libunwind")] { + } + feature = "system-llvm-libunwind" => { #[link(name = "unwind", kind = "static", modifiers = "-bundle", cfg(target_feature = "crt-static"))] #[link(name = "unwind", cfg(not(target_feature = "crt-static")))] unsafe extern "C" {} - } else { + } + _ => { #[link(name = "unwind", kind = "static", modifiers = "-bundle", cfg(target_feature = "crt-static"))] #[link(name = "gcc_s", cfg(not(target_feature = "crt-static")))] unsafe extern "C" {} @@ -72,13 +81,15 @@ cfg_if::cfg_if! { // This is the same as musl except that we default to using the system libunwind // instead of libgcc. #[cfg(target_env = "ohos")] -cfg_if::cfg_if! { - if #[cfg(all(feature = "llvm-libunwind", feature = "system-llvm-libunwind"))] { +cfg_select! { + all(feature = "llvm-libunwind", feature = "system-llvm-libunwind") => { compile_error!("`llvm-libunwind` and `system-llvm-libunwind` cannot be enabled at the same time"); - } else if #[cfg(feature = "llvm-libunwind")] { + } + feature = "llvm-libunwind" => { #[link(name = "unwind", kind = "static", modifiers = "-bundle")] unsafe extern "C" {} - } else { + } + _ => { #[link(name = "unwind", kind = "static", modifiers = "-bundle", cfg(target_feature = "crt-static"))] #[link(name = "unwind", cfg(not(target_feature = "crt-static")))] unsafe extern "C" {} @@ -86,10 +97,11 @@ cfg_if::cfg_if! { } #[cfg(target_os = "android")] -cfg_if::cfg_if! { - if #[cfg(feature = "llvm-libunwind")] { +cfg_select! { + feature = "llvm-libunwind" => { compile_error!("`llvm-libunwind` is not supported for Android targets"); - } else { + } + _ => { #[link(name = "unwind", kind = "static", modifiers = "-bundle", cfg(target_feature = "crt-static"))] #[link(name = "unwind", cfg(not(target_feature = "crt-static")))] unsafe extern "C" {} @@ -166,11 +178,12 @@ unsafe extern "C" {} unsafe extern "C" {} #[cfg(target_os = "nto")] -cfg_if::cfg_if! { - if #[cfg(target_env = "nto70")] { +cfg_select! { + target_env = "nto70" => { #[link(name = "gcc")] unsafe extern "C" {} - } else { + } + _ => { #[link(name = "gcc_s")] unsafe extern "C" {} } diff --git a/library/unwind/src/libunwind.rs b/library/unwind/src/libunwind.rs index b350003cbb198..9ac9b54ed4a29 100644 --- a/library/unwind/src/libunwind.rs +++ b/library/unwind/src/libunwind.rs @@ -122,198 +122,205 @@ unsafe extern "C" { pub fn _Unwind_GetDataRelBase(ctx: *mut _Unwind_Context) -> _Unwind_Ptr; } -cfg_if::cfg_if! { -if #[cfg(any(target_vendor = "apple", target_os = "netbsd", not(target_arch = "arm")))] { - // Not ARM EHABI - // - // 32-bit ARM on iOS/tvOS/watchOS use either DWARF/Compact unwinding or - // "setjmp-longjmp" / SjLj unwinding. - pub type _Unwind_Action = c_int; - - pub const _UA_SEARCH_PHASE: c_int = 1; - pub const _UA_CLEANUP_PHASE: c_int = 2; - pub const _UA_HANDLER_FRAME: c_int = 4; - pub const _UA_FORCE_UNWIND: c_int = 8; - pub const _UA_END_OF_STACK: c_int = 16; - - #[cfg_attr( - all(feature = "llvm-libunwind", any(target_os = "fuchsia", target_os = "linux", target_os = "xous")), - link(name = "unwind", kind = "static", modifiers = "-bundle") - )] - unsafe extern "C" { - pub fn _Unwind_GetGR(ctx: *mut _Unwind_Context, reg_index: c_int) -> _Unwind_Word; - pub fn _Unwind_SetGR(ctx: *mut _Unwind_Context, reg_index: c_int, value: _Unwind_Word); - pub fn _Unwind_GetIP(ctx: *mut _Unwind_Context) -> _Unwind_Word; - pub fn _Unwind_SetIP(ctx: *mut _Unwind_Context, value: _Unwind_Word); - pub fn _Unwind_GetIPInfo(ctx: *mut _Unwind_Context, ip_before_insn: *mut c_int) - -> _Unwind_Word; - pub fn _Unwind_FindEnclosingFunction(pc: *mut c_void) -> *mut c_void; - } +cfg_select! { + any(target_vendor = "apple", target_os = "netbsd", not(target_arch = "arm")) => { + // Not ARM EHABI + // + // 32-bit ARM on iOS/tvOS/watchOS use either DWARF/Compact unwinding or + // "setjmp-longjmp" / SjLj unwinding. + pub type _Unwind_Action = c_int; + + pub const _UA_SEARCH_PHASE: c_int = 1; + pub const _UA_CLEANUP_PHASE: c_int = 2; + pub const _UA_HANDLER_FRAME: c_int = 4; + pub const _UA_FORCE_UNWIND: c_int = 8; + pub const _UA_END_OF_STACK: c_int = 16; + + #[cfg_attr( + all(feature = "llvm-libunwind", any(target_os = "fuchsia", target_os = "linux", target_os = "xous")), + link(name = "unwind", kind = "static", modifiers = "-bundle") + )] + unsafe extern "C" { + pub fn _Unwind_GetGR(ctx: *mut _Unwind_Context, reg_index: c_int) -> _Unwind_Word; + pub fn _Unwind_SetGR(ctx: *mut _Unwind_Context, reg_index: c_int, value: _Unwind_Word); + pub fn _Unwind_GetIP(ctx: *mut _Unwind_Context) -> _Unwind_Word; + pub fn _Unwind_SetIP(ctx: *mut _Unwind_Context, value: _Unwind_Word); + pub fn _Unwind_GetIPInfo(ctx: *mut _Unwind_Context, ip_before_insn: *mut c_int) + -> _Unwind_Word; + pub fn _Unwind_FindEnclosingFunction(pc: *mut c_void) -> *mut c_void; + } -} else { - // ARM EHABI - #[repr(C)] - #[derive(Copy, Clone, PartialEq)] - pub enum _Unwind_State { - _US_VIRTUAL_UNWIND_FRAME = 0, - _US_UNWIND_FRAME_STARTING = 1, - _US_UNWIND_FRAME_RESUME = 2, - _US_ACTION_MASK = 3, - _US_FORCE_UNWIND = 8, - _US_END_OF_STACK = 16, } - pub use _Unwind_State::*; + _ => { + // ARM EHABI + #[repr(C)] + #[derive(Copy, Clone, PartialEq)] + pub enum _Unwind_State { + _US_VIRTUAL_UNWIND_FRAME = 0, + _US_UNWIND_FRAME_STARTING = 1, + _US_UNWIND_FRAME_RESUME = 2, + _US_ACTION_MASK = 3, + _US_FORCE_UNWIND = 8, + _US_END_OF_STACK = 16, + } + pub use _Unwind_State::*; - #[repr(C)] - enum _Unwind_VRS_Result { - _UVRSR_OK = 0, - _UVRSR_NOT_IMPLEMENTED = 1, - _UVRSR_FAILED = 2, - } - #[repr(C)] - enum _Unwind_VRS_RegClass { - _UVRSC_CORE = 0, - _UVRSC_VFP = 1, - _UVRSC_FPA = 2, - _UVRSC_WMMXD = 3, - _UVRSC_WMMXC = 4, - } - use _Unwind_VRS_RegClass::*; - #[repr(C)] - enum _Unwind_VRS_DataRepresentation { - _UVRSD_UINT32 = 0, - _UVRSD_VFPX = 1, - _UVRSD_FPAX = 2, - _UVRSD_UINT64 = 3, - _UVRSD_FLOAT = 4, - _UVRSD_DOUBLE = 5, - } - use _Unwind_VRS_DataRepresentation::*; - - pub const UNWIND_POINTER_REG: c_int = 12; - pub const UNWIND_SP_REG: c_int = 13; - pub const UNWIND_IP_REG: c_int = 15; - - #[cfg_attr( - all(feature = "llvm-libunwind", any(target_os = "fuchsia", target_os = "linux", target_os = "xous")), - link(name = "unwind", kind = "static", modifiers = "-bundle") - )] - unsafe extern "C" { - fn _Unwind_VRS_Get(ctx: *mut _Unwind_Context, - regclass: _Unwind_VRS_RegClass, - regno: _Unwind_Word, - repr: _Unwind_VRS_DataRepresentation, - data: *mut c_void) - -> _Unwind_VRS_Result; - - fn _Unwind_VRS_Set(ctx: *mut _Unwind_Context, - regclass: _Unwind_VRS_RegClass, - regno: _Unwind_Word, - repr: _Unwind_VRS_DataRepresentation, - data: *mut c_void) - -> _Unwind_VRS_Result; - } + #[repr(C)] + enum _Unwind_VRS_Result { + _UVRSR_OK = 0, + _UVRSR_NOT_IMPLEMENTED = 1, + _UVRSR_FAILED = 2, + } + #[repr(C)] + enum _Unwind_VRS_RegClass { + _UVRSC_CORE = 0, + _UVRSC_VFP = 1, + _UVRSC_FPA = 2, + _UVRSC_WMMXD = 3, + _UVRSC_WMMXC = 4, + } + use _Unwind_VRS_RegClass::*; + #[repr(C)] + enum _Unwind_VRS_DataRepresentation { + _UVRSD_UINT32 = 0, + _UVRSD_VFPX = 1, + _UVRSD_FPAX = 2, + _UVRSD_UINT64 = 3, + _UVRSD_FLOAT = 4, + _UVRSD_DOUBLE = 5, + } + use _Unwind_VRS_DataRepresentation::*; + + pub const UNWIND_POINTER_REG: c_int = 12; + pub const UNWIND_SP_REG: c_int = 13; + pub const UNWIND_IP_REG: c_int = 15; + + #[cfg_attr( + all(feature = "llvm-libunwind", any(target_os = "fuchsia", target_os = "linux", target_os = "xous")), + link(name = "unwind", kind = "static", modifiers = "-bundle") + )] + unsafe extern "C" { + fn _Unwind_VRS_Get(ctx: *mut _Unwind_Context, + regclass: _Unwind_VRS_RegClass, + regno: _Unwind_Word, + repr: _Unwind_VRS_DataRepresentation, + data: *mut c_void) + -> _Unwind_VRS_Result; + + fn _Unwind_VRS_Set(ctx: *mut _Unwind_Context, + regclass: _Unwind_VRS_RegClass, + regno: _Unwind_Word, + repr: _Unwind_VRS_DataRepresentation, + data: *mut c_void) + -> _Unwind_VRS_Result; + } - // On Android or ARM/Linux, these are implemented as macros: + // On Android or ARM/Linux, these are implemented as macros: - pub unsafe fn _Unwind_GetGR(ctx: *mut _Unwind_Context, reg_index: c_int) -> _Unwind_Word { - let mut val: _Unwind_Word = core::ptr::null(); - unsafe { _Unwind_VRS_Get(ctx, _UVRSC_CORE, reg_index as _Unwind_Word, _UVRSD_UINT32, - (&raw mut val) as *mut c_void); } - val - } + pub unsafe fn _Unwind_GetGR(ctx: *mut _Unwind_Context, reg_index: c_int) -> _Unwind_Word { + let mut val: _Unwind_Word = core::ptr::null(); + unsafe { _Unwind_VRS_Get(ctx, _UVRSC_CORE, reg_index as _Unwind_Word, _UVRSD_UINT32, + (&raw mut val) as *mut c_void); } + val + } - pub unsafe fn _Unwind_SetGR(ctx: *mut _Unwind_Context, reg_index: c_int, value: _Unwind_Word) { - let mut value = value; - unsafe { _Unwind_VRS_Set(ctx, _UVRSC_CORE, reg_index as _Unwind_Word, _UVRSD_UINT32, - (&raw mut value) as *mut c_void); } - } + pub unsafe fn _Unwind_SetGR( + ctx: *mut _Unwind_Context, + reg_index: c_int, + value: _Unwind_Word + ) { + let mut value = value; + unsafe { _Unwind_VRS_Set(ctx, _UVRSC_CORE, reg_index as _Unwind_Word, _UVRSD_UINT32, + (&raw mut value) as *mut c_void); } + } - pub unsafe fn _Unwind_GetIP(ctx: *mut _Unwind_Context) - -> _Unwind_Word { - let val = unsafe { _Unwind_GetGR(ctx, UNWIND_IP_REG) }; - val.map_addr(|v| v & !1) - } + pub unsafe fn _Unwind_GetIP(ctx: *mut _Unwind_Context) + -> _Unwind_Word { + let val = unsafe { _Unwind_GetGR(ctx, UNWIND_IP_REG) }; + val.map_addr(|v| v & !1) + } - pub unsafe fn _Unwind_SetIP(ctx: *mut _Unwind_Context, - value: _Unwind_Word) { - // Propagate thumb bit to instruction pointer - let thumb_state = unsafe { _Unwind_GetGR(ctx, UNWIND_IP_REG).addr() & 1 }; - let value = value.map_addr(|v| v | thumb_state); - unsafe { _Unwind_SetGR(ctx, UNWIND_IP_REG, value); } - } + pub unsafe fn _Unwind_SetIP(ctx: *mut _Unwind_Context, + value: _Unwind_Word) { + // Propagate thumb bit to instruction pointer + let thumb_state = unsafe { _Unwind_GetGR(ctx, UNWIND_IP_REG).addr() & 1 }; + let value = value.map_addr(|v| v | thumb_state); + unsafe { _Unwind_SetGR(ctx, UNWIND_IP_REG, value); } + } - pub unsafe fn _Unwind_GetIPInfo(ctx: *mut _Unwind_Context, - ip_before_insn: *mut c_int) - -> _Unwind_Word { - unsafe { - *ip_before_insn = 0; - _Unwind_GetIP(ctx) + pub unsafe fn _Unwind_GetIPInfo(ctx: *mut _Unwind_Context, + ip_before_insn: *mut c_int) + -> _Unwind_Word { + unsafe { + *ip_before_insn = 0; + _Unwind_GetIP(ctx) + } } - } - // This function also doesn't exist on Android or ARM/Linux, so make it a no-op - pub unsafe fn _Unwind_FindEnclosingFunction(pc: *mut c_void) -> *mut c_void { - pc + // This function also doesn't exist on Android or ARM/Linux, so make it a no-op + pub unsafe fn _Unwind_FindEnclosingFunction(pc: *mut c_void) -> *mut c_void { + pc + } } } -} // cfg_if! - -cfg_if::cfg_if! { -if #[cfg(all(target_vendor = "apple", not(target_os = "watchos"), target_arch = "arm"))] { - // 32-bit ARM Apple (except for watchOS armv7k specifically) uses SjLj and - // does not provide _Unwind_Backtrace() - unsafe extern "C-unwind" { - pub fn _Unwind_SjLj_RaiseException(e: *mut _Unwind_Exception) -> _Unwind_Reason_Code; - } - pub use _Unwind_SjLj_RaiseException as _Unwind_RaiseException; -} else { - #[cfg_attr( - all(feature = "llvm-libunwind", any(target_os = "fuchsia", target_os = "linux", target_os = "xous")), - link(name = "unwind", kind = "static", modifiers = "-bundle") - )] - unsafe extern "C-unwind" { - pub fn _Unwind_RaiseException(exception: *mut _Unwind_Exception) -> _Unwind_Reason_Code; +cfg_select! { + all(target_vendor = "apple", not(target_os = "watchos"), target_arch = "arm") => { + // 32-bit ARM Apple (except for watchOS armv7k specifically) uses SjLj and + // does not provide _Unwind_Backtrace() + unsafe extern "C-unwind" { + pub fn _Unwind_SjLj_RaiseException(e: *mut _Unwind_Exception) -> _Unwind_Reason_Code; + } + + pub use _Unwind_SjLj_RaiseException as _Unwind_RaiseException; } - #[cfg_attr( - all(feature = "llvm-libunwind", any(target_os = "fuchsia", target_os = "linux", target_os = "xous")), - link(name = "unwind", kind = "static", modifiers = "-bundle") - )] - unsafe extern "C" { - pub fn _Unwind_Backtrace(trace: _Unwind_Trace_Fn, - trace_argument: *mut c_void) - -> _Unwind_Reason_Code; + _ => { + #[cfg_attr( + all(feature = "llvm-libunwind", any(target_os = "fuchsia", target_os = "linux", target_os = "xous")), + link(name = "unwind", kind = "static", modifiers = "-bundle") + )] + unsafe extern "C-unwind" { + pub fn _Unwind_RaiseException(exception: *mut _Unwind_Exception) -> _Unwind_Reason_Code; + } + #[cfg_attr( + all(feature = "llvm-libunwind", any(target_os = "fuchsia", target_os = "linux", target_os = "xous")), + link(name = "unwind", kind = "static", modifiers = "-bundle") + )] + unsafe extern "C" { + pub fn _Unwind_Backtrace(trace: _Unwind_Trace_Fn, + trace_argument: *mut c_void) + -> _Unwind_Reason_Code; + } } } -} // cfg_if! -cfg_if::cfg_if! { -if #[cfg(any( +cfg_select! { + any( all(windows, any(target_arch = "aarch64", target_arch = "x86_64"), target_env = "gnu"), target_os = "cygwin", - ))] { - // We declare these as opaque types. This is fine since you just need to - // pass them to _GCC_specific_handler and forget about them. - pub enum EXCEPTION_RECORD {} - pub type LPVOID = *mut c_void; - pub enum CONTEXT {} - pub enum DISPATCHER_CONTEXT {} - pub type EXCEPTION_DISPOSITION = c_int; - type PersonalityFn = unsafe extern "C" fn(version: c_int, - actions: _Unwind_Action, - exception_class: _Unwind_Exception_Class, - exception_object: *mut _Unwind_Exception, - context: *mut _Unwind_Context) - -> _Unwind_Reason_Code; - - unsafe extern "C" { - pub fn _GCC_specific_handler(exceptionRecord: *mut EXCEPTION_RECORD, - establisherFrame: LPVOID, - contextRecord: *mut CONTEXT, - dispatcherContext: *mut DISPATCHER_CONTEXT, - personality: PersonalityFn) - -> EXCEPTION_DISPOSITION; + ) => { + // We declare these as opaque types. This is fine since you just need to + // pass them to _GCC_specific_handler and forget about them. + pub enum EXCEPTION_RECORD {} + pub type LPVOID = *mut c_void; + pub enum CONTEXT {} + pub enum DISPATCHER_CONTEXT {} + pub type EXCEPTION_DISPOSITION = c_int; + type PersonalityFn = unsafe extern "C" fn(version: c_int, + actions: _Unwind_Action, + exception_class: _Unwind_Exception_Class, + exception_object: *mut _Unwind_Exception, + context: *mut _Unwind_Context) + -> _Unwind_Reason_Code; + + unsafe extern "C" { + pub fn _GCC_specific_handler(exceptionRecord: *mut EXCEPTION_RECORD, + establisherFrame: LPVOID, + contextRecord: *mut CONTEXT, + dispatcherContext: *mut DISPATCHER_CONTEXT, + personality: PersonalityFn) + -> EXCEPTION_DISPOSITION; + } } + _ => {} } -} // cfg_if! diff --git a/library/unwind/src/wasm.rs b/library/unwind/src/wasm.rs index 2d36a8be00469..3341e54759a0d 100644 --- a/library/unwind/src/wasm.rs +++ b/library/unwind/src/wasm.rs @@ -45,18 +45,19 @@ pub unsafe fn _Unwind_RaiseException(exception: *mut _Unwind_Exception) -> _Unwi // via integers, with 0 corresponding to C++ exceptions and 1 to C setjmp()/longjmp(). // Ideally, we'd be able to choose something unique for Rust, but for now, // we pretend to be C++ and implement the Itanium exception-handling ABI. - cfg_if::cfg_if! { + cfg_select! { // panic=abort is default for wasm targets. Because an unknown instruction is a load-time // error on wasm, instead of a runtime error like on traditional architectures, we never // want to codegen a `throw` instruction, as that would break users using runtimes that // don't yet support exceptions. The only time this first branch would be selected is if // the user explicitly opts in to wasm exceptions, via -Zbuild-std with -Cpanic=unwind. - if #[cfg(panic = "unwind")] { + panic = "unwind" => { // corresponds with llvm::WebAssembly::Tag::CPP_EXCEPTION // in llvm-project/llvm/include/llvm/CodeGen/WasmEHFuncInfo.h const CPP_EXCEPTION_TAG: i32 = 0; core::arch::wasm::throw::(exception.cast()) - } else { + } + _ => { let _ = exception; core::arch::wasm::unreachable() } diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs index 997a152a31fcb..75b25fae0e561 100644 --- a/src/bootstrap/src/core/build_steps/compile.rs +++ b/src/bootstrap/src/core/build_steps/compile.rs @@ -12,6 +12,7 @@ use std::ffi::OsStr; use std::io::BufReader; use std::io::prelude::*; use std::path::{Path, PathBuf}; +use std::time::SystemTime; use std::{env, fs, str}; use serde_derive::Deserialize; @@ -2568,7 +2569,17 @@ pub fn strip_debug(builder: &Builder<'_>, target: TargetSelection, path: &Path) } let previous_mtime = t!(t!(path.metadata()).modified()); - command("strip").arg("--strip-debug").arg(path).run_capture(builder); + let stamp = BuildStamp::new(path.parent().unwrap()) + .with_prefix(path.file_name().unwrap().to_str().unwrap()) + .with_prefix("strip") + .add_stamp(previous_mtime.duration_since(SystemTime::UNIX_EPOCH).unwrap().as_nanos()); + + // Running strip can be relatively expensive (~1s on librustc_driver.so), so we don't rerun it + // if the file is unchanged. + if !stamp.is_up_to_date() { + command("strip").arg("--strip-debug").arg(path).run_capture(builder); + } + t!(stamp.write()); let file = t!(fs::File::open(path)); diff --git a/src/ci/docker/host-x86_64/tidy/Dockerfile b/src/ci/docker/host-x86_64/tidy/Dockerfile index ee1ae5410ee81..c8558689d3ba9 100644 --- a/src/ci/docker/host-x86_64/tidy/Dockerfile +++ b/src/ci/docker/host-x86_64/tidy/Dockerfile @@ -45,4 +45,4 @@ RUN bash -c 'npm install -g eslint@$(cat /tmp/eslint.version)' # NOTE: intentionally uses python2 for x.py so we can test it still works. # validate-toolstate only runs in our CI, so it's ok for it to only support python3. ENV SCRIPT TIDY_PRINT_DIFF=1 python2.7 ../x.py test --stage 0 \ - src/tools/tidy tidyselftest --extra-checks=py,cpp,js + src/tools/tidy tidyselftest --extra-checks=py,cpp,js,spellcheck diff --git a/src/doc/rustc/src/codegen-options/index.md b/src/doc/rustc/src/codegen-options/index.md index 07eafdf4c4c62..445b10188e3f8 100644 --- a/src/doc/rustc/src/codegen-options/index.md +++ b/src/doc/rustc/src/codegen-options/index.md @@ -375,12 +375,12 @@ linking time. It takes one of the following values: * `y`, `yes`, `on`, `true`, `fat`, or no value: perform "fat" LTO which attempts to perform optimizations across all crates within the dependency graph. -* `n`, `no`, `off`, `false`: disables LTO. * `thin`: perform ["thin" LTO](http://blog.llvm.org/2016/06/thinlto-scalable-and-incremental-lto.html). This is similar to "fat", but takes substantially less time to run while still achieving performance gains similar to "fat". For larger projects like the Rust compiler, ThinLTO can even result in better performance than fat LTO. +* `n`, `no`, `off`, `false`: disables LTO. If `-C lto` is not specified, then the compiler will attempt to perform "thin local LTO" which performs "thin" LTO on the local crate only across its diff --git a/src/librustdoc/html/static/js/main.js b/src/librustdoc/html/static/js/main.js index 8e3d07b3a1c28..21d154edf5d2a 100644 --- a/src/librustdoc/html/static/js/main.js +++ b/src/librustdoc/html/static/js/main.js @@ -1529,7 +1529,7 @@ function preLoadCss(cssUrl) { ["⏎", "Go to active search result"], ["+", "Expand all sections"], ["-", "Collapse all sections"], - // for the sake of brevity, we don't say "inherint impl blocks", + // for the sake of brevity, we don't say "inherit impl blocks", // although that would be more correct, // since trait impl blocks are collapsed by - ["_", "Collapse all sections, including impl blocks"], diff --git a/src/tools/miri/src/shims/foreign_items.rs b/src/tools/miri/src/shims/foreign_items.rs index 21545b680299c..23b1d0c4f6ecf 100644 --- a/src/tools/miri/src/shims/foreign_items.rs +++ b/src/tools/miri/src/shims/foreign_items.rs @@ -146,7 +146,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { return interp_ok(()); } // Skip over items without an explicitly defined symbol name. - if !(attrs.export_name.is_some() + if !(attrs.symbol_name.is_some() || attrs.flags.contains(CodegenFnAttrFlags::NO_MANGLE) || attrs.flags.contains(CodegenFnAttrFlags::RUSTC_STD_INTERNAL_SYMBOL)) { diff --git a/src/tools/rustbook/Cargo.lock b/src/tools/rustbook/Cargo.lock index e42f266391e2f..c3db6e51b821a 100644 --- a/src/tools/rustbook/Cargo.lock +++ b/src/tools/rustbook/Cargo.lock @@ -97,9 +97,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.98" +version = "1.0.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487" +checksum = "b0674a1ddeecb70197781e945de4b3b8ffb61fa939a5597bcf48503737663100" [[package]] name = "autocfg" @@ -124,9 +124,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.9.1" +version = "2.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967" +checksum = "6a65b545ab31d687cff52899d4890855fec459eb6afe0da6417b8a18da87aa29" [[package]] name = "block-buffer" @@ -156,9 +156,9 @@ checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" [[package]] name = "cc" -version = "1.2.32" +version = "1.2.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2352e5597e9c544d5e6d9c95190d5d27738ade584fa8db0a16e130e5c2b5296e" +checksum = "3ee0f8803222ba5a7e2777dd72ca451868909b1ac410621b676adf07280e9b5f" dependencies = [ "shlex", ] @@ -185,9 +185,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.43" +version = "4.5.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50fd97c9dc2399518aa331917ac6f274280ec5eb34e555dd291899745c48ec6f" +checksum = "1fc0e74a703892159f5ae7d3aac52c8e6c392f5ae5f359c70b5881d60aaac318" dependencies = [ "clap_builder", "clap_derive", @@ -195,9 +195,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.43" +version = "4.5.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c35b5830294e1fa0462034af85cc95225a4cb07092c088c55bda3147cfcd8f65" +checksum = "b3e7f4214277f3c7aa526a59dd3fbe306a370daee1f8b7b8c987069cd8e888a8" dependencies = [ "anstream", "anstyle", @@ -208,18 +208,18 @@ dependencies = [ [[package]] name = "clap_complete" -version = "4.5.56" +version = "4.5.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67e4efcbb5da11a92e8a609233aa1e8a7d91e38de0be865f016d14700d45a7fd" +checksum = "4d9501bd3f5f09f7bbee01da9a511073ed30a80cd7a509f1214bb74eadea71ad" dependencies = [ "clap", ] [[package]] name = "clap_derive" -version = "4.5.41" +version = "4.5.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef4f52386a59ca4c860f7393bcf8abd8dfd91ecccc0f774635ff68e92eeef491" +checksum = "14cb31bb0a7d536caef2639baa7fad459e15c3144efefa6dbd1c84562c4739f6" dependencies = [ "heck", "proc-macro2", @@ -559,7 +559,7 @@ dependencies = [ "pest_derive", "serde", "serde_json", - "thiserror 2.0.12", + "thiserror 2.0.15", ] [[package]] @@ -807,9 +807,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.174" +version = "0.2.175" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1171693293099992e19cddea4e8b849964e9846f4acee11b3948bcc337be8776" +checksum = "6a82ae493e598baaea5209805c49bbf2ea7de956d50d7da0da1164f9c6d28543" [[package]] name = "linereader" @@ -1035,7 +1035,7 @@ version = "6.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "336b9c63443aceef14bea841b899035ae3abe89b7c486aaf4c5bd8aafedac3f0" dependencies = [ - "bitflags 2.9.1", + "bitflags 2.9.2", "libc", "once_cell", "onig_sys", @@ -1104,7 +1104,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1db05f56d34358a8b1066f67cbb203ee3e7ed2ba674a6263a1d5ec6db2204323" dependencies = [ "memchr", - "thiserror 2.0.12", + "thiserror 2.0.15", "ucd-trie", ] @@ -1240,9 +1240,9 @@ checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" [[package]] name = "proc-macro2" -version = "1.0.95" +version = "1.0.101" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" +checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de" dependencies = [ "unicode-ident", ] @@ -1253,7 +1253,7 @@ version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "76979bea66e7875e7509c4ec5300112b316af87fa7a252ca91c448b32dfe3993" dependencies = [ - "bitflags 2.9.1", + "bitflags 2.9.2", "memchr", "pulldown-cmark-escape 0.10.1", "unicase", @@ -1265,7 +1265,7 @@ version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f86ba2052aebccc42cbbb3ed234b8b13ce76f75c3551a303cb2bcffcff12bb14" dependencies = [ - "bitflags 2.9.1", + "bitflags 2.9.2", "getopts", "memchr", "pulldown-cmark-escape 0.11.0", @@ -1347,7 +1347,7 @@ version = "0.5.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5407465600fb0548f1442edf71dd20683c6ed326200ace4b1ef0763521bb3b77" dependencies = [ - "bitflags 2.9.1", + "bitflags 2.9.2", ] [[package]] @@ -1397,7 +1397,7 @@ version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "11181fbabf243db407ef8df94a6ce0b2f9a733bd8be4ad02b4eda9602296cac8" dependencies = [ - "bitflags 2.9.1", + "bitflags 2.9.2", "errno", "libc", "linux-raw-sys", @@ -1546,9 +1546,9 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "syn" -version = "2.0.104" +version = "2.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17b6f705963418cdb9927482fa304bc562ece2fdd4f616084c50b7023b435a40" +checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6" dependencies = [ "proc-macro2", "quote", @@ -1612,12 +1612,12 @@ dependencies = [ [[package]] name = "terminal_size" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45c6481c4829e4cc63825e62c49186a34538b7b2750b73b266581ffb612fb5ed" +checksum = "60b8cb979cb11c32ce1603f8137b22262a9d131aaa5c37b5678025f22b8becd0" dependencies = [ "rustix", - "windows-sys 0.59.0", + "windows-sys 0.60.2", ] [[package]] @@ -1637,11 +1637,11 @@ dependencies = [ [[package]] name = "thiserror" -version = "2.0.12" +version = "2.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708" +checksum = "80d76d3f064b981389ecb4b6b7f45a0bf9fdac1d5b9204c7bd6714fecc302850" dependencies = [ - "thiserror-impl 2.0.12", + "thiserror-impl 2.0.15", ] [[package]] @@ -1657,9 +1657,9 @@ dependencies = [ [[package]] name = "thiserror-impl" -version = "2.0.12" +version = "2.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" +checksum = "44d29feb33e986b6ea906bd9c3559a856983f92371b3eaa5e83782a351623de0" dependencies = [ "proc-macro2", "quote", @@ -2116,7 +2116,7 @@ version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" dependencies = [ - "bitflags 2.9.1", + "bitflags 2.9.2", ] [[package]] diff --git a/src/tools/rustdoc-js/tester.js b/src/tools/rustdoc-js/tester.js index 0baa179e16b2d..b88c95d81bca1 100644 --- a/src/tools/rustdoc-js/tester.js +++ b/src/tools/rustdoc-js/tester.js @@ -409,6 +409,24 @@ async function runChecks(testFile, doSearch, parseQuery, getCorrections) { return res; } +function mostRecentMatch(staticFiles, regex) { + const matchingEntries = fs.readdirSync(staticFiles) + .filter(f => f.match(regex)) + .map(f => { + const stats = fs.statSync(path.join(staticFiles, f)); + return { + path: f, + time: stats.mtimeMs, + }; + }); + if (matchingEntries.length === 0) { + throw "No static file matching regex"; + } + // We sort entries in descending order. + matchingEntries.sort((a, b) => b.time - a.time); + return matchingEntries[0].path; +} + /** * Load searchNNN.js and search-indexNNN.js. * @@ -452,7 +470,7 @@ function loadSearchJS(doc_folder, resource_suffix) { }; const staticFiles = path.join(doc_folder, "static.files"); - const searchJs = fs.readdirSync(staticFiles).find(f => f.match(/search.*\.js$/)); + const searchJs = mostRecentMatch(staticFiles, /search-[0-9a-f]{8}.*\.js$/); const searchModule = require(path.join(staticFiles, searchJs)); searchModule.initSearch(searchIndex.searchIndex); const docSearch = searchModule.docSearch; diff --git a/src/tools/tidy/src/extra_checks/mod.rs b/src/tools/tidy/src/extra_checks/mod.rs index f90f716cd9501..31169ec596775 100644 --- a/src/tools/tidy/src/extra_checks/mod.rs +++ b/src/tools/tidy/src/extra_checks/mod.rs @@ -41,7 +41,6 @@ const RUFF_CONFIG_PATH: &[&str] = &["src", "tools", "tidy", "config", "ruff.toml const RUFF_CACHE_PATH: &[&str] = &["cache", "ruff_cache"]; const PIP_REQ_PATH: &[&str] = &["src", "tools", "tidy", "config", "requirements.txt"]; -// this must be kept in sync with with .github/workflows/spellcheck.yml const SPELLCHECK_DIRS: &[&str] = &["compiler", "library", "src/bootstrap", "src/librustdoc"]; pub fn check( @@ -51,6 +50,7 @@ pub fn check( librustdoc_path: &Path, tools_path: &Path, npm: &Path, + cargo: &Path, bless: bool, extra_checks: Option<&str>, pos_args: &[String], @@ -63,6 +63,7 @@ pub fn check( librustdoc_path, tools_path, npm, + cargo, bless, extra_checks, pos_args, @@ -78,6 +79,7 @@ fn check_impl( librustdoc_path: &Path, tools_path: &Path, npm: &Path, + cargo: &Path, bless: bool, extra_checks: Option<&str>, pos_args: &[String], @@ -293,7 +295,7 @@ fn check_impl( } else { eprintln!("spellcheck files"); } - spellcheck_runner(&args)?; + spellcheck_runner(root_path, &outdir, &cargo, &args)?; } if js_lint || js_typecheck { @@ -576,34 +578,25 @@ fn shellcheck_runner(args: &[&OsStr]) -> Result<(), Error> { if status.success() { Ok(()) } else { Err(Error::FailedCheck("shellcheck")) } } -/// Check that spellchecker is installed then run it at the given path -fn spellcheck_runner(args: &[&str]) -> Result<(), Error> { - // sync version with .github/workflows/spellcheck.yml - let expected_version = "typos-cli 1.34.0"; - match Command::new("typos").arg("--version").output() { - Ok(o) => { - let stdout = String::from_utf8_lossy(&o.stdout); - if stdout.trim() != expected_version { - return Err(Error::Version { - program: "typos", - required: expected_version, - installed: stdout.trim().to_string(), - }); +/// Ensure that spellchecker is installed then run it at the given path +fn spellcheck_runner( + src_root: &Path, + outdir: &Path, + cargo: &Path, + args: &[&str], +) -> Result<(), Error> { + let bin_path = + crate::ensure_version_or_cargo_install(outdir, cargo, "typos-cli", "typos", "1.34.0")?; + match Command::new(bin_path).current_dir(src_root).args(args).status() { + Ok(status) => { + if status.success() { + Ok(()) + } else { + Err(Error::FailedCheck("typos")) } } - Err(e) if e.kind() == io::ErrorKind::NotFound => { - return Err(Error::MissingReq( - "typos", - "spellcheck file checks", - // sync version with .github/workflows/spellcheck.yml - Some("install tool via `cargo install typos-cli@1.34.0`".to_owned()), - )); - } - Err(e) => return Err(e.into()), + Err(err) => Err(Error::Generic(format!("failed to run typos tool: {err:?}"))), } - - let status = Command::new("typos").args(args).status()?; - if status.success() { Ok(()) } else { Err(Error::FailedCheck("typos")) } } /// Check git for tracked files matching an extension diff --git a/src/tools/tidy/src/lib.rs b/src/tools/tidy/src/lib.rs index 4ea9d051ddb5e..37713cbf75e9b 100644 --- a/src/tools/tidy/src/lib.rs +++ b/src/tools/tidy/src/lib.rs @@ -4,7 +4,9 @@ //! to be used by tools. use std::ffi::OsStr; +use std::path::{Path, PathBuf}; use std::process::Command; +use std::{env, io}; use build_helper::ci::CiEnv; use build_helper::git::{GitConfig, get_closest_upstream_commit}; @@ -180,6 +182,70 @@ pub fn files_modified(ci_info: &CiInfo, pred: impl Fn(&str) -> bool) -> bool { !v.is_empty() } +/// If the given executable is installed with the given version, use that, +/// otherwise install via cargo. +pub fn ensure_version_or_cargo_install( + build_dir: &Path, + cargo: &Path, + pkg_name: &str, + bin_name: &str, + version: &str, +) -> io::Result { + // ignore the process exit code here and instead just let the version number check fail. + // we also importantly don't return if the program wasn't installed, + // instead we want to continue to the fallback. + 'ck: { + // FIXME: rewrite as if-let chain once this crate is 2024 edition. + let Ok(output) = Command::new(bin_name).arg("--version").output() else { + break 'ck; + }; + let Ok(s) = str::from_utf8(&output.stdout) else { + break 'ck; + }; + let Some(v) = s.trim().split_whitespace().last() else { + break 'ck; + }; + if v == version { + return Ok(PathBuf::from(bin_name)); + } + } + + let tool_root_dir = build_dir.join("misc-tools"); + let tool_bin_dir = tool_root_dir.join("bin"); + eprintln!("building external tool {bin_name} from package {pkg_name}@{version}"); + // use --force to ensure that if the required version is bumped, we update it. + // use --target-dir to ensure we have a build cache so repeated invocations aren't slow. + // modify PATH so that cargo doesn't print a warning telling the user to modify the path. + let cargo_exit_code = Command::new(cargo) + .args(["install", "--locked", "--force", "--quiet"]) + .arg("--root") + .arg(&tool_root_dir) + .arg("--target-dir") + .arg(tool_root_dir.join("target")) + .arg(format!("{pkg_name}@{version}")) + .env( + "PATH", + env::join_paths( + env::split_paths(&env::var("PATH").unwrap()) + .chain(std::iter::once(tool_bin_dir.clone())), + ) + .expect("build dir contains invalid char"), + ) + .env("RUSTFLAGS", "-Copt-level=0") + .spawn()? + .wait()?; + if !cargo_exit_code.success() { + return Err(io::Error::other("cargo install failed")); + } + let bin_path = tool_bin_dir.join(bin_name); + assert!( + matches!(bin_path.try_exists(), Ok(true)), + "cargo install did not produce the expected binary" + ); + eprintln!("finished building tool {bin_name}"); + Ok(bin_path) +} + pub mod alphabetical; pub mod bins; pub mod debug_artifacts; diff --git a/src/tools/tidy/src/main.rs b/src/tools/tidy/src/main.rs index cd2567ddb64bf..bfe30258915ea 100644 --- a/src/tools/tidy/src/main.rs +++ b/src/tools/tidy/src/main.rs @@ -184,6 +184,7 @@ fn main() { &librustdoc_path, &tools_path, &npm, + &cargo, bless, extra_checks, pos_args diff --git a/tests/run-make/linker-warning/short-error.txt b/tests/run-make/linker-warning/short-error.txt index 5b7c040bc50ea..e5861b732c5f0 100644 --- a/tests/run-make/linker-warning/short-error.txt +++ b/tests/run-make/linker-warning/short-error.txt @@ -1,6 +1,6 @@ error: linking with `./fake-linker` failed: exit status: 1 | - = note: "./fake-linker" "-m64" "/symbols.o" "<2 object files omitted>" "-Wl,--as-needed" "-Wl,-Bstatic" "/build-root/test/run-make/linker-warning/rmake_out/{libfoo,libbar}.rlib" "/lib/rustlib/x86_64-unknown-linux-gnu/lib/{libstd-*,libpanic_unwind-*,libobject-*,libmemchr-*,libaddr2line-*,libgimli-*,librustc_demangle-*,libstd_detect-*,libhashbrown-*,librustc_std_workspace_alloc-*,libminiz_oxide-*,libadler2-*,libunwind-*,libcfg_if-*,liblibc-*,librustc_std_workspace_core-*,liballoc-*,libcore-*,libcompiler_builtins-*}.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-L" "/raw-dylibs" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/build-root/test/run-make/linker-warning/rmake_out" "-L" "/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "main" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs" "run_make_error" + = note: "./fake-linker" "-m64" "/symbols.o" "<2 object files omitted>" "-Wl,--as-needed" "-Wl,-Bstatic" "/build-root/test/run-make/linker-warning/rmake_out/{libfoo,libbar}.rlib" "/lib/rustlib/x86_64-unknown-linux-gnu/lib/{libstd-*,libpanic_unwind-*,libobject-*,libmemchr-*,libaddr2line-*,libgimli-*,libcfg_if-*,librustc_demangle-*,libstd_detect-*,libhashbrown-*,librustc_std_workspace_alloc-*,libminiz_oxide-*,libadler2-*,libunwind-*,liblibc-*,librustc_std_workspace_core-*,liballoc-*,libcore-*,libcompiler_builtins-*}.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-L" "/raw-dylibs" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/build-root/test/run-make/linker-warning/rmake_out" "-L" "/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "main" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs" "run_make_error" = note: some arguments are omitted. use `--verbose` to show all linker arguments = note: error: baz diff --git a/tests/ui/issues/issue-8498.rs b/tests/ui/array-slice-vec/matching-on-vector-slice-option-8498.rs similarity index 91% rename from tests/ui/issues/issue-8498.rs rename to tests/ui/array-slice-vec/matching-on-vector-slice-option-8498.rs index 92904e2198f68..e243a247ed518 100644 --- a/tests/ui/issues/issue-8498.rs +++ b/tests/ui/array-slice-vec/matching-on-vector-slice-option-8498.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/8498 //@ run-pass pub fn main() { diff --git a/tests/ui/issues/issue-7784.rs b/tests/ui/array-slice-vec/pattern-matching-fixed-length-vectors-7784.rs similarity index 93% rename from tests/ui/issues/issue-7784.rs rename to tests/ui/array-slice-vec/pattern-matching-fixed-length-vectors-7784.rs index 90b88ae572764..7d987e92b63aa 100644 --- a/tests/ui/issues/issue-7784.rs +++ b/tests/ui/array-slice-vec/pattern-matching-fixed-length-vectors-7784.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/7784 //@ run-pass use std::ops::Add; diff --git a/tests/ui/issues/issue-78622.rs b/tests/ui/associated-consts/ambiguous-associated-type-error-78622.rs similarity index 67% rename from tests/ui/issues/issue-78622.rs rename to tests/ui/associated-consts/ambiguous-associated-type-error-78622.rs index c00fd26606367..9763be1ecb219 100644 --- a/tests/ui/issues/issue-78622.rs +++ b/tests/ui/associated-consts/ambiguous-associated-type-error-78622.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/78622 #![crate_type = "lib"] struct S; diff --git a/tests/ui/issues/issue-78622.stderr b/tests/ui/associated-consts/ambiguous-associated-type-error-78622.stderr similarity index 87% rename from tests/ui/issues/issue-78622.stderr rename to tests/ui/associated-consts/ambiguous-associated-type-error-78622.stderr index 432913a0fc9c1..4dff1364af777 100644 --- a/tests/ui/issues/issue-78622.stderr +++ b/tests/ui/associated-consts/ambiguous-associated-type-error-78622.stderr @@ -1,5 +1,5 @@ error[E0223]: ambiguous associated type - --> $DIR/issue-78622.rs:5:5 + --> $DIR/ambiguous-associated-type-error-78622.rs:6:5 | LL | S::A:: {} | ^^^^ diff --git a/tests/ui/issues/issue-78957.rs b/tests/ui/attributes/invalid-attributes-on-const-params-78957.rs similarity index 95% rename from tests/ui/issues/issue-78957.rs rename to tests/ui/attributes/invalid-attributes-on-const-params-78957.rs index 2ff92612e1852..106b9ae269068 100644 --- a/tests/ui/issues/issue-78957.rs +++ b/tests/ui/attributes/invalid-attributes-on-const-params-78957.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/78957 #![deny(unused_attributes)] use std::marker::PhantomData; diff --git a/tests/ui/issues/issue-78957.stderr b/tests/ui/attributes/invalid-attributes-on-const-params-78957.stderr similarity index 80% rename from tests/ui/issues/issue-78957.stderr rename to tests/ui/attributes/invalid-attributes-on-const-params-78957.stderr index d271b1840fb5a..f8010b4ea687c 100644 --- a/tests/ui/issues/issue-78957.stderr +++ b/tests/ui/attributes/invalid-attributes-on-const-params-78957.stderr @@ -1,5 +1,5 @@ error: `#[inline]` attribute cannot be used on function params - --> $DIR/issue-78957.rs:5:16 + --> $DIR/invalid-attributes-on-const-params-78957.rs:6:16 | LL | pub struct Foo<#[inline] const N: usize>; | ^^^^^^^^^ @@ -7,7 +7,7 @@ LL | pub struct Foo<#[inline] const N: usize>; = help: `#[inline]` can only be applied to functions error: `#[inline]` attribute cannot be used on function params - --> $DIR/issue-78957.rs:13:17 + --> $DIR/invalid-attributes-on-const-params-78957.rs:14:17 | LL | pub struct Foo2<#[inline] 'a>(PhantomData<&'a ()>); | ^^^^^^^^^ @@ -15,7 +15,7 @@ LL | pub struct Foo2<#[inline] 'a>(PhantomData<&'a ()>); = help: `#[inline]` can only be applied to functions error: `#[inline]` attribute cannot be used on function params - --> $DIR/issue-78957.rs:21:17 + --> $DIR/invalid-attributes-on-const-params-78957.rs:22:17 | LL | pub struct Foo3<#[inline] T>(PhantomData); | ^^^^^^^^^ @@ -23,25 +23,25 @@ LL | pub struct Foo3<#[inline] T>(PhantomData); = help: `#[inline]` can only be applied to functions error[E0517]: attribute should be applied to a struct, enum, or union - --> $DIR/issue-78957.rs:10:23 + --> $DIR/invalid-attributes-on-const-params-78957.rs:11:23 | LL | pub struct Baz<#[repr(C)] const N: usize>; | ^ -------------- not a struct, enum, or union error[E0517]: attribute should be applied to a struct, enum, or union - --> $DIR/issue-78957.rs:18:24 + --> $DIR/invalid-attributes-on-const-params-78957.rs:19:24 | LL | pub struct Baz2<#[repr(C)] 'a>(PhantomData<&'a ()>); | ^ -- not a struct, enum, or union error[E0517]: attribute should be applied to a struct, enum, or union - --> $DIR/issue-78957.rs:26:24 + --> $DIR/invalid-attributes-on-const-params-78957.rs:27:24 | LL | pub struct Baz3<#[repr(C)] T>(PhantomData); | ^ - not a struct, enum, or union error: `#[cold]` attribute cannot be used on function params - --> $DIR/issue-78957.rs:7:16 + --> $DIR/invalid-attributes-on-const-params-78957.rs:8:16 | LL | pub struct Bar<#[cold] const N: usize>; | ^^^^^^^ @@ -49,13 +49,13 @@ LL | pub struct Bar<#[cold] const N: usize>; = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = help: `#[cold]` can only be applied to functions note: the lint level is defined here - --> $DIR/issue-78957.rs:1:9 + --> $DIR/invalid-attributes-on-const-params-78957.rs:2:9 | LL | #![deny(unused_attributes)] | ^^^^^^^^^^^^^^^^^ error: `#[cold]` attribute cannot be used on function params - --> $DIR/issue-78957.rs:15:17 + --> $DIR/invalid-attributes-on-const-params-78957.rs:16:17 | LL | pub struct Bar2<#[cold] 'a>(PhantomData<&'a ()>); | ^^^^^^^ @@ -64,7 +64,7 @@ LL | pub struct Bar2<#[cold] 'a>(PhantomData<&'a ()>); = help: `#[cold]` can only be applied to functions error: `#[cold]` attribute cannot be used on function params - --> $DIR/issue-78957.rs:23:17 + --> $DIR/invalid-attributes-on-const-params-78957.rs:24:17 | LL | pub struct Bar3<#[cold] T>(PhantomData); | ^^^^^^^ diff --git a/tests/ui/attributes/lint_on_root.rs b/tests/ui/attributes/lint_on_root.rs index bafdb46883ff5..6cec7508560a5 100644 --- a/tests/ui/attributes/lint_on_root.rs +++ b/tests/ui/attributes/lint_on_root.rs @@ -1,7 +1,7 @@ // NOTE: this used to panic in debug builds (by a sanity assertion) // and not emit any lint on release builds. See https://github.com/rust-lang/rust/issues/142891. #![inline = ""] -//~^ ERROR: valid forms for the attribute are `#[inline(always)]`, `#[inline(never)]`, and `#[inline]` [ill_formed_attribute_input] +//~^ ERROR: valid forms for the attribute are `#![inline(always)]`, `#![inline(never)]`, and `#![inline]` [ill_formed_attribute_input] //~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! //~| ERROR attribute cannot be used on diff --git a/tests/ui/attributes/lint_on_root.stderr b/tests/ui/attributes/lint_on_root.stderr index 9d8d1495c1bfe..f6eafc33d6986 100644 --- a/tests/ui/attributes/lint_on_root.stderr +++ b/tests/ui/attributes/lint_on_root.stderr @@ -6,7 +6,7 @@ LL | #![inline = ""] | = help: `#[inline]` can only be applied to functions -error: valid forms for the attribute are `#[inline(always)]`, `#[inline(never)]`, and `#[inline]` +error: valid forms for the attribute are `#![inline(always)]`, `#![inline(never)]`, and `#![inline]` --> $DIR/lint_on_root.rs:3:1 | LL | #![inline = ""] @@ -19,7 +19,7 @@ LL | #![inline = ""] error: aborting due to 2 previous errors Future incompatibility report: Future breakage diagnostic: -error: valid forms for the attribute are `#[inline(always)]`, `#[inline(never)]`, and `#[inline]` +error: valid forms for the attribute are `#![inline(always)]`, `#![inline(never)]`, and `#![inline]` --> $DIR/lint_on_root.rs:3:1 | LL | #![inline = ""] diff --git a/tests/ui/attributes/malformed-reprs.stderr b/tests/ui/attributes/malformed-reprs.stderr index 43085b9c3415c..3a788999542b4 100644 --- a/tests/ui/attributes/malformed-reprs.stderr +++ b/tests/ui/attributes/malformed-reprs.stderr @@ -7,18 +7,14 @@ LL | #![repr] = note: for more information, visit help: try changing it to one of the following valid forms of the attribute | -LL - #![repr] -LL + #[repr()] - | -LL - #![repr] -LL + #[repr(C)] - | -LL - #![repr] -LL + #[repr(Rust)] - | -LL - #![repr] -LL + #[repr(align(...))] - | +LL | #![repr()] + | ++++++++++++++++ +LL | #![repr(C)] + | +++ +LL | #![repr(Rust)] + | ++++++ +LL | #![repr(align(...))] + | ++++++++++++ = and 2 other candidates error[E0589]: invalid `repr(align)` attribute: not a power of two diff --git a/tests/ui/attributes/rustc_confusables.rs b/tests/ui/attributes/rustc_confusables.rs index 91c66a75cc3a6..14aed092694b1 100644 --- a/tests/ui/attributes/rustc_confusables.rs +++ b/tests/ui/attributes/rustc_confusables.rs @@ -45,4 +45,5 @@ impl Bar { #[rustc_confusables("blah")] //~^ ERROR attribute cannot be used on //~| HELP can only be applied to +//~| HELP remove the attribute fn not_inherent_impl_method() {} diff --git a/tests/ui/issues/issue-77218/issue-77218.fixed b/tests/ui/binding/invalid-assignment-in-while-loop-77218.fixed similarity index 73% rename from tests/ui/issues/issue-77218/issue-77218.fixed rename to tests/ui/binding/invalid-assignment-in-while-loop-77218.fixed index 6ce9dd1c2c57a..aa662ead21ac8 100644 --- a/tests/ui/issues/issue-77218/issue-77218.fixed +++ b/tests/ui/binding/invalid-assignment-in-while-loop-77218.fixed @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/77218 //@ run-rustfix fn main() { let value = [7u8]; diff --git a/tests/ui/issues/issue-77218/issue-77218.rs b/tests/ui/binding/invalid-assignment-in-while-loop-77218.rs similarity index 73% rename from tests/ui/issues/issue-77218/issue-77218.rs rename to tests/ui/binding/invalid-assignment-in-while-loop-77218.rs index 14edc065d0e63..9f249180e83a2 100644 --- a/tests/ui/issues/issue-77218/issue-77218.rs +++ b/tests/ui/binding/invalid-assignment-in-while-loop-77218.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/77218 //@ run-rustfix fn main() { let value = [7u8]; diff --git a/tests/ui/issues/issue-77218/issue-77218.stderr b/tests/ui/binding/invalid-assignment-in-while-loop-77218.stderr similarity index 88% rename from tests/ui/issues/issue-77218/issue-77218.stderr rename to tests/ui/binding/invalid-assignment-in-while-loop-77218.stderr index e98e69314d91d..e6baf349d28ad 100644 --- a/tests/ui/issues/issue-77218/issue-77218.stderr +++ b/tests/ui/binding/invalid-assignment-in-while-loop-77218.stderr @@ -1,5 +1,5 @@ error[E0070]: invalid left-hand side of assignment - --> $DIR/issue-77218.rs:4:19 + --> $DIR/invalid-assignment-in-while-loop-77218.rs:5:19 | LL | while Some(0) = value.get(0) {} | - ^ diff --git a/tests/ui/borrowck/implementation-not-general-enough-ice-133252.stderr b/tests/ui/borrowck/implementation-not-general-enough-ice-133252.stderr index 4ec4d2138db60..5389226f7a7a4 100644 --- a/tests/ui/borrowck/implementation-not-general-enough-ice-133252.stderr +++ b/tests/ui/borrowck/implementation-not-general-enough-ice-133252.stderr @@ -22,12 +22,6 @@ LL | force_send(async_load(¬_static)); ... LL | } | - `not_static` dropped here while still borrowed - | -note: due to current limitations in the borrow checker, this implies a `'static` lifetime - --> $DIR/implementation-not-general-enough-ice-133252.rs:16:18 - | -LL | fn force_send(_: T) {} - | ^^^^ error: aborting due to 2 previous errors diff --git a/tests/ui/issues/issue-78192.rs b/tests/ui/borrowck/incorrect-use-after-storage-end-78192.rs similarity index 82% rename from tests/ui/issues/issue-78192.rs rename to tests/ui/borrowck/incorrect-use-after-storage-end-78192.rs index bec2a82910cfa..99a1d37eb4de7 100644 --- a/tests/ui/issues/issue-78192.rs +++ b/tests/ui/borrowck/incorrect-use-after-storage-end-78192.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/78192 //@ run-pass #![allow(unused_assignments)] diff --git a/tests/ui/issues/issue-7660.rs b/tests/ui/borrowck/rvalue-lifetime-match-equivalence-7660.rs similarity index 88% rename from tests/ui/issues/issue-7660.rs rename to tests/ui/borrowck/rvalue-lifetime-match-equivalence-7660.rs index 104cdad8f7bb7..90526de14e758 100644 --- a/tests/ui/issues/issue-7660.rs +++ b/tests/ui/borrowck/rvalue-lifetime-match-equivalence-7660.rs @@ -1,9 +1,9 @@ +// https://github.com/rust-lang/rust/issues/7660 //@ run-pass #![allow(unused_variables)] // Regression test for issue 7660 // rvalue lifetime too short when equivalent `match` works - use std::collections::HashMap; struct A(isize, isize); diff --git a/tests/ui/issues/issue-76042.rs b/tests/ui/codegen/i128-shift-overflow-check-76042.rs similarity index 85% rename from tests/ui/issues/issue-76042.rs rename to tests/ui/codegen/i128-shift-overflow-check-76042.rs index 279e860459d2c..7ae0806216cd6 100644 --- a/tests/ui/issues/issue-76042.rs +++ b/tests/ui/codegen/i128-shift-overflow-check-76042.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/76042 //@ run-pass //@ compile-flags: -Coverflow-checks=off -Ccodegen-units=1 -Copt-level=0 diff --git a/tests/ui/issues/issue-8248.rs b/tests/ui/coercion/mut-trait-coercion-8248.rs similarity index 81% rename from tests/ui/issues/issue-8248.rs rename to tests/ui/coercion/mut-trait-coercion-8248.rs index 95f626658cc67..a45a4d94315f1 100644 --- a/tests/ui/issues/issue-8248.rs +++ b/tests/ui/coercion/mut-trait-coercion-8248.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/8248 //@ run-pass trait A { diff --git a/tests/ui/issues/issue-8248.stderr b/tests/ui/coercion/mut-trait-coercion-8248.stderr similarity index 83% rename from tests/ui/issues/issue-8248.stderr rename to tests/ui/coercion/mut-trait-coercion-8248.stderr index 8570bfaefadbe..2f79a9ba1c868 100644 --- a/tests/ui/issues/issue-8248.stderr +++ b/tests/ui/coercion/mut-trait-coercion-8248.stderr @@ -1,5 +1,5 @@ warning: method `dummy` is never used - --> $DIR/issue-8248.rs:4:8 + --> $DIR/mut-trait-coercion-8248.rs:5:8 | LL | trait A { | - method in this trait diff --git a/tests/ui/issues/issue-8398.rs b/tests/ui/coercion/mut-trait-object-coercion-8398.rs similarity index 79% rename from tests/ui/issues/issue-8398.rs rename to tests/ui/coercion/mut-trait-object-coercion-8398.rs index 7d100b855fd1a..d87d27582bab6 100644 --- a/tests/ui/issues/issue-8398.rs +++ b/tests/ui/coercion/mut-trait-object-coercion-8398.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/8398 //@ check-pass #![allow(dead_code)] diff --git a/tests/ui/issues/issue-76191.rs b/tests/ui/consts/const-range-matching-76191.rs similarity index 89% rename from tests/ui/issues/issue-76191.rs rename to tests/ui/consts/const-range-matching-76191.rs index d2de44380c372..b579a4b3258a7 100644 --- a/tests/ui/issues/issue-76191.rs +++ b/tests/ui/consts/const-range-matching-76191.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/76191 // Regression test for diagnostic issue #76191 #![allow(non_snake_case)] diff --git a/tests/ui/issues/issue-76191.stderr b/tests/ui/consts/const-range-matching-76191.stderr similarity index 92% rename from tests/ui/issues/issue-76191.stderr rename to tests/ui/consts/const-range-matching-76191.stderr index d8b54be88f4bf..5c358d0fa1cf5 100644 --- a/tests/ui/issues/issue-76191.stderr +++ b/tests/ui/consts/const-range-matching-76191.stderr @@ -1,11 +1,11 @@ error[E0080]: evaluation panicked: explicit panic - --> $DIR/issue-76191.rs:8:37 + --> $DIR/const-range-matching-76191.rs:9:37 | LL | const RANGE2: RangeInclusive = panic!(); | ^^^^^^^^ evaluation of `RANGE2` failed here error[E0308]: mismatched types - --> $DIR/issue-76191.rs:14:9 + --> $DIR/const-range-matching-76191.rs:15:9 | LL | const RANGE: RangeInclusive = 0..=255; | -------------------------------- constant defined here @@ -27,7 +27,7 @@ LL + 0..=255 => {} | error[E0308]: mismatched types - --> $DIR/issue-76191.rs:16:9 + --> $DIR/const-range-matching-76191.rs:17:9 | LL | const RANGE2: RangeInclusive = panic!(); | --------------------------------- constant defined here diff --git a/tests/ui/coverage-attr/name-value.stderr b/tests/ui/coverage-attr/name-value.stderr index 2dac2401e3cd9..d1527ec810c50 100644 --- a/tests/ui/coverage-attr/name-value.stderr +++ b/tests/ui/coverage-attr/name-value.stderr @@ -22,10 +22,10 @@ LL | #![coverage = "off"] help: try changing it to one of the following valid forms of the attribute | LL - #![coverage = "off"] -LL + #[coverage(off)] +LL + #![coverage(off)] | LL - #![coverage = "off"] -LL + #[coverage(on)] +LL + #![coverage(on)] | error[E0539]: malformed `coverage` attribute input diff --git a/tests/ui/coverage-attr/word-only.stderr b/tests/ui/coverage-attr/word-only.stderr index e916a817e3678..880ad0809536e 100644 --- a/tests/ui/coverage-attr/word-only.stderr +++ b/tests/ui/coverage-attr/word-only.stderr @@ -19,12 +19,10 @@ LL | #![coverage] | help: try changing it to one of the following valid forms of the attribute | -LL - #![coverage] -LL + #[coverage(off)] - | -LL - #![coverage] -LL + #[coverage(on)] - | +LL | #![coverage(off)] + | +++++ +LL | #![coverage(on)] + | ++++ error[E0539]: malformed `coverage` attribute input --> $DIR/word-only.rs:21:1 diff --git a/tests/ui/issues/auxiliary/issue-7899.rs b/tests/ui/cross-crate/auxiliary/aux-7899.rs similarity index 100% rename from tests/ui/issues/auxiliary/issue-7899.rs rename to tests/ui/cross-crate/auxiliary/aux-7899.rs diff --git a/tests/ui/issues/auxiliary/issue-8259.rs b/tests/ui/cross-crate/auxiliary/aux-8259.rs similarity index 100% rename from tests/ui/issues/auxiliary/issue-8259.rs rename to tests/ui/cross-crate/auxiliary/aux-8259.rs diff --git a/tests/ui/issues/issue-8259.rs b/tests/ui/cross-crate/static-regions-in-cross-crate-8259.rs similarity index 55% rename from tests/ui/issues/issue-8259.rs rename to tests/ui/cross-crate/static-regions-in-cross-crate-8259.rs index e843f7f9c5083..347cfa2aee130 100644 --- a/tests/ui/issues/issue-8259.rs +++ b/tests/ui/cross-crate/static-regions-in-cross-crate-8259.rs @@ -1,11 +1,11 @@ +// https://github.com/rust-lang/rust/issues/8259 //@ run-pass #![allow(dead_code)] #![allow(non_upper_case_globals)] -//@ aux-build:issue-8259.rs +//@ aux-build:aux-8259.rs - -extern crate issue_8259 as other; +extern crate aux_8259 as other; static a: other::Foo<'static> = other::Foo::A; pub fn main() {} diff --git a/tests/ui/cross-crate/tuple-like-structs-cross-crate-7899.rs b/tests/ui/cross-crate/tuple-like-structs-cross-crate-7899.rs new file mode 100644 index 0000000000000..ce3ea7dd5796a --- /dev/null +++ b/tests/ui/cross-crate/tuple-like-structs-cross-crate-7899.rs @@ -0,0 +1,10 @@ +// https://github.com/rust-lang/rust/issues/7899 +//@ run-pass +#![allow(unused_variables)] +//@ aux-build:aux-7899.rs + +extern crate aux_7899 as testcrate; + +fn main() { + let f = testcrate::V2(1.0f32, 2.0f32); +} diff --git a/tests/ui/deriving/deriving-from-wrong-target.rs b/tests/ui/deriving/deriving-from-wrong-target.rs index 57e009cae69eb..ebeb3cb29db72 100644 --- a/tests/ui/deriving/deriving-from-wrong-target.rs +++ b/tests/ui/deriving/deriving-from-wrong-target.rs @@ -28,8 +28,6 @@ struct S4 { enum E1 {} #[derive(From)] -//~^ ERROR the size for values of type `T` cannot be known at compilation time [E0277] -//~| ERROR the size for values of type `T` cannot be known at compilation time [E0277] struct SUnsizedField { last: T, //~^ ERROR the size for values of type `T` cannot be known at compilation time [E0277] diff --git a/tests/ui/deriving/deriving-from-wrong-target.stderr b/tests/ui/deriving/deriving-from-wrong-target.stderr index 13593c95973e4..751c6c8ac7cf1 100644 --- a/tests/ui/deriving/deriving-from-wrong-target.stderr +++ b/tests/ui/deriving/deriving-from-wrong-target.stderr @@ -54,45 +54,7 @@ LL | enum E1 {} = note: `#[derive(From)]` can only be used on structs with exactly one field error[E0277]: the size for values of type `T` cannot be known at compilation time - --> $DIR/deriving-from-wrong-target.rs:30:10 - | -LL | #[derive(From)] - | ^^^^ doesn't have a size known at compile-time -... -LL | struct SUnsizedField { - | - this type parameter needs to be `Sized` - | -note: required by an implicit `Sized` bound in `From` - --> $SRC_DIR/core/src/convert/mod.rs:LL:COL -help: consider removing the `?Sized` bound to make the type parameter `Sized` - | -LL - struct SUnsizedField { -LL + struct SUnsizedField { - | - -error[E0277]: the size for values of type `T` cannot be known at compilation time - --> $DIR/deriving-from-wrong-target.rs:30:10 - | -LL | #[derive(From)] - | ^^^^ doesn't have a size known at compile-time -... -LL | struct SUnsizedField { - | - this type parameter needs to be `Sized` - | -note: required because it appears within the type `SUnsizedField` - --> $DIR/deriving-from-wrong-target.rs:33:8 - | -LL | struct SUnsizedField { - | ^^^^^^^^^^^^^ - = note: the return type of a function must have a statically known size -help: consider removing the `?Sized` bound to make the type parameter `Sized` - | -LL - struct SUnsizedField { -LL + struct SUnsizedField { - | - -error[E0277]: the size for values of type `T` cannot be known at compilation time - --> $DIR/deriving-from-wrong-target.rs:34:11 + --> $DIR/deriving-from-wrong-target.rs:32:11 | LL | struct SUnsizedField { | - this type parameter needs to be `Sized` @@ -110,6 +72,6 @@ help: function arguments must have a statically known size, borrowed types alway LL | last: &T, | + -error: aborting due to 8 previous errors +error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/issues/auxiliary/issue-8401.rs b/tests/ui/dyn-keyword/auxiliary/aux-8401.rs similarity index 100% rename from tests/ui/issues/auxiliary/issue-8401.rs rename to tests/ui/dyn-keyword/auxiliary/aux-8401.rs diff --git a/tests/ui/dyn-keyword/methods-with-mut-trait-and-polymorphic-objects-issue-8401.rs b/tests/ui/dyn-keyword/methods-with-mut-trait-and-polymorphic-objects-issue-8401.rs new file mode 100644 index 0000000000000..313c6891720ac --- /dev/null +++ b/tests/ui/dyn-keyword/methods-with-mut-trait-and-polymorphic-objects-issue-8401.rs @@ -0,0 +1,7 @@ +//@ run-pass +//@ aux-build:aux-8401.rs +// https://github.com/rust-lang/rust/issues/8401 + +extern crate aux_8401; + +pub fn main() {} diff --git a/tests/ui/issues/issue-8761.rs b/tests/ui/enum/enum-discriminant-type-mismatch-8761.rs similarity index 80% rename from tests/ui/issues/issue-8761.rs rename to tests/ui/enum/enum-discriminant-type-mismatch-8761.rs index 5883bb9669562..ae09b919dc152 100644 --- a/tests/ui/issues/issue-8761.rs +++ b/tests/ui/enum/enum-discriminant-type-mismatch-8761.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/8761 enum Foo { A = 1i64, //~^ ERROR mismatched types diff --git a/tests/ui/issues/issue-8761.stderr b/tests/ui/enum/enum-discriminant-type-mismatch-8761.stderr similarity index 83% rename from tests/ui/issues/issue-8761.stderr rename to tests/ui/enum/enum-discriminant-type-mismatch-8761.stderr index 4a9db56891386..f1645183e176b 100644 --- a/tests/ui/issues/issue-8761.stderr +++ b/tests/ui/enum/enum-discriminant-type-mismatch-8761.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-8761.rs:2:9 + --> $DIR/enum-discriminant-type-mismatch-8761.rs:3:9 | LL | A = 1i64, | ^^^^ expected `isize`, found `i64` @@ -11,7 +11,7 @@ LL + A = 1isize, | error[E0308]: mismatched types - --> $DIR/issue-8761.rs:5:9 + --> $DIR/enum-discriminant-type-mismatch-8761.rs:6:9 | LL | B = 2u8 | ^^^ expected `isize`, found `u8` diff --git a/tests/ui/issues/issue-80607.rs b/tests/ui/enum/enum-variant-field-error-80607.rs similarity index 82% rename from tests/ui/issues/issue-80607.rs rename to tests/ui/enum/enum-variant-field-error-80607.rs index 63f4df359b831..aa3f2f7c526f6 100644 --- a/tests/ui/issues/issue-80607.rs +++ b/tests/ui/enum/enum-variant-field-error-80607.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/80607 // This tests makes sure the diagnostics print the offending enum variant, not just the type. pub enum Enum { V1(i32), diff --git a/tests/ui/issues/issue-80607.stderr b/tests/ui/enum/enum-variant-field-error-80607.stderr similarity index 89% rename from tests/ui/issues/issue-80607.stderr rename to tests/ui/enum/enum-variant-field-error-80607.stderr index 8f9f494c8b7a4..8d088ef04bbbf 100644 --- a/tests/ui/issues/issue-80607.stderr +++ b/tests/ui/enum/enum-variant-field-error-80607.stderr @@ -1,5 +1,5 @@ error[E0559]: variant `Enum::V1` has no field named `x` - --> $DIR/issue-80607.rs:7:16 + --> $DIR/enum-variant-field-error-80607.rs:8:16 | LL | V1(i32), | -- `Enum::V1` defined here diff --git a/tests/ui/issues/issue-8506.rs b/tests/ui/enum/simple-enum-usage-8506.rs similarity index 78% rename from tests/ui/issues/issue-8506.rs rename to tests/ui/enum/simple-enum-usage-8506.rs index 30a789a3e27bf..ebe095d84e437 100644 --- a/tests/ui/issues/issue-8506.rs +++ b/tests/ui/enum/simple-enum-usage-8506.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/8506 //@ run-pass #![allow(non_upper_case_globals)] diff --git a/tests/ui/issues/issue-75283.rs b/tests/ui/extern/function-definition-in-extern-block-75283.rs similarity index 70% rename from tests/ui/issues/issue-75283.rs rename to tests/ui/extern/function-definition-in-extern-block-75283.rs index d556132e47ffd..e2b7358743ba1 100644 --- a/tests/ui/issues/issue-75283.rs +++ b/tests/ui/extern/function-definition-in-extern-block-75283.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/75283 extern "C" { fn lol() { //~ ERROR incorrect function inside `extern` block println!(""); diff --git a/tests/ui/issues/issue-75283.stderr b/tests/ui/extern/function-definition-in-extern-block-75283.stderr similarity index 91% rename from tests/ui/issues/issue-75283.stderr rename to tests/ui/extern/function-definition-in-extern-block-75283.stderr index 240d9716a5561..67be1c2959922 100644 --- a/tests/ui/issues/issue-75283.stderr +++ b/tests/ui/extern/function-definition-in-extern-block-75283.stderr @@ -1,5 +1,5 @@ error: incorrect function inside `extern` block - --> $DIR/issue-75283.rs:2:8 + --> $DIR/function-definition-in-extern-block-75283.rs:3:8 | LL | extern "C" { | ---------- `extern` blocks define existing foreign functions and functions inside of them cannot have a body diff --git a/tests/ui/extern/issue-47725.rs b/tests/ui/extern/issue-47725.rs index b0a0af930defb..6b4d0dd30e024 100644 --- a/tests/ui/extern/issue-47725.rs +++ b/tests/ui/extern/issue-47725.rs @@ -4,12 +4,14 @@ //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to +//~| HELP remove the attribute struct Foo; #[link_name = "foobar"] //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to +//~| HELP remove the attribute extern "C" { fn foo() -> u32; } @@ -19,6 +21,7 @@ extern "C" { //~| HELP must be of the form //~| WARN attribute cannot be used on //~| WARN previously accepted +//~| HELP remove the attribute //~| HELP can be applied to //~| NOTE for more information, visit extern "C" { diff --git a/tests/ui/extern/issue-47725.stderr b/tests/ui/extern/issue-47725.stderr index 704b1d81b6398..43362ea655bd9 100644 --- a/tests/ui/extern/issue-47725.stderr +++ b/tests/ui/extern/issue-47725.stderr @@ -1,5 +1,5 @@ error[E0539]: malformed `link_name` attribute input - --> $DIR/issue-47725.rs:17:1 + --> $DIR/issue-47725.rs:19:1 | LL | #[link_name] | ^^^^^^^^^^^^ help: must be of the form: `#[link_name = "name"]` @@ -21,7 +21,7 @@ LL | #![warn(unused_attributes)] | ^^^^^^^^^^^^^^^^^ warning: `#[link_name]` attribute cannot be used on foreign modules - --> $DIR/issue-47725.rs:9:1 + --> $DIR/issue-47725.rs:10:1 | LL | #[link_name = "foobar"] | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -30,7 +30,7 @@ LL | #[link_name = "foobar"] = help: `#[link_name]` can be applied to foreign functions, foreign statics warning: `#[link_name]` attribute cannot be used on foreign modules - --> $DIR/issue-47725.rs:17:1 + --> $DIR/issue-47725.rs:19:1 | LL | #[link_name] | ^^^^^^^^^^^^ diff --git a/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.rs b/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.rs index 8702d852a896e..60666481bec82 100644 --- a/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.rs +++ b/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.rs @@ -50,9 +50,11 @@ #![should_panic] //~ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can only be applied to +//~| HELP remove the attribute #![ignore] //~ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can only be applied to +//~| HELP remove the attribute #![no_implicit_prelude] #![reexport_test_harness_main = "2900"] // see gated-link-args.rs @@ -61,22 +63,28 @@ #![proc_macro_derive(Test)] //~ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can only be applied to +//~| HELP remove the attribute #![doc = "2400"] #![cold] //~ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can only be applied to +//~| HELP remove the attribute #![link()] //~ WARN attribute should be applied to an `extern` block //~^ WARN this was previously accepted #![link_name = "1900"] //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to +//~| HELP remove the attribute #![link_section = "1800"] //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to +//~| HELP remove the attribute #![must_use] -//~^ WARN `#[must_use]` has no effect +//~^ WARN attribute cannot be used on +//~| WARN previously accepted +//~| HELP can be applied to //~| HELP remove the attribute // see issue-43106-gating-of-stable.rs // see issue-43106-gating-of-unstable.rs @@ -184,21 +192,25 @@ mod macro_use { //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to + //~| HELP remove the attribute #[macro_use] struct S; //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to + //~| HELP remove the attribute #[macro_use] type T = S; //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to + //~| HELP remove the attribute #[macro_use] impl S { } //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to + //~| HELP remove the attribute } #[macro_export] @@ -260,57 +272,68 @@ mod path { //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can only be applied to + //~| HELP remove the attribute #[path = "3800"] struct S; //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can only be applied to + //~| HELP remove the attribute #[path = "3800"] type T = S; //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can only be applied to + //~| HELP remove the attribute #[path = "3800"] impl S { } //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can only be applied to + //~| HELP remove the attribute } #[automatically_derived] //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can only be applied to +//~| HELP remove the attribute mod automatically_derived { mod inner { #![automatically_derived] } //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can only be applied to + //~| HELP remove the attribute #[automatically_derived] fn f() { } //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can only be applied to + //~| HELP remove the attribute #[automatically_derived] struct S; //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can only be applied to + //~| HELP remove the attribute #[automatically_derived] type T = S; //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can only be applied to + //~| HELP remove the attribute #[automatically_derived] trait W { } //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can only be applied to + //~| HELP remove the attribute #[automatically_derived] impl S { } //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can only be applied to + //~| HELP remove the attribute #[automatically_derived] impl W for S { } } @@ -319,11 +342,13 @@ mod automatically_derived { //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to +//~| HELP remove the attribute mod no_mangle { mod inner { #![no_mangle] } //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to + //~| HELP remove the attribute #[no_mangle] fn f() { } @@ -331,27 +356,32 @@ mod no_mangle { //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to + //~| HELP remove the attribute #[no_mangle] type T = S; //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to + //~| HELP remove the attribute #[no_mangle] impl S { } //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to + //~| HELP remove the attribute trait Tr { #[no_mangle] fn foo(); //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to + //~| HELP remove the attribute #[no_mangle] fn bar() {} //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to + //~| HELP remove the attribute } } @@ -359,11 +389,13 @@ mod no_mangle { //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can only be applied to +//~| HELP remove the attribute mod should_panic { mod inner { #![should_panic] } //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can only be applied to + //~| HELP remove the attribute #[should_panic] fn f() { } @@ -371,27 +403,32 @@ mod should_panic { //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can only be applied to + //~| HELP remove the attribute #[should_panic] type T = S; //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can only be applied to + //~| HELP remove the attribute #[should_panic] impl S { } //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can only be applied to + //~| HELP remove the attribute } #[ignore] //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can only be applied to +//~| HELP remove the attribute mod ignore { mod inner { #![ignore] } //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can only be applied to + //~| HELP remove the attribute #[ignore] fn f() { } @@ -399,16 +436,19 @@ mod ignore { //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can only be applied to + //~| HELP remove the attribute #[ignore] type T = S; //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can only be applied to + //~| HELP remove the attribute #[ignore] impl S { } //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can only be applied to + //~| HELP remove the attribute } #[no_implicit_prelude] @@ -419,21 +459,25 @@ mod no_implicit_prelude { //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to + //~| HELP remove the attribute #[no_implicit_prelude] struct S; //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to + //~| HELP remove the attribute #[no_implicit_prelude] type T = S; //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to + //~| HELP remove the attribute #[no_implicit_prelude] impl S { } //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to + //~| HELP remove the attribute } #[reexport_test_harness_main = "2900"] @@ -467,21 +511,25 @@ mod macro_escape { //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to + //~| HELP remove the attribute #[macro_escape] struct S; //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to + //~| HELP remove the attribute #[macro_escape] type T = S; //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to + //~| HELP remove the attribute #[macro_escape] impl S { } //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to + //~| HELP remove the attribute } #[no_std] @@ -524,12 +572,14 @@ mod doc { //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can only be applied to +//~| HELP remove the attribute mod cold { mod inner { #![cold] } //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can only be applied to + //~| HELP remove the attribute #[cold] fn f() { } @@ -537,64 +587,76 @@ mod cold { //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can only be applied to + //~| HELP remove the attribute #[cold] type T = S; //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can only be applied to + //~| HELP remove the attribute #[cold] impl S { } //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can only be applied to + //~| HELP remove the attribute } #[link_name = "1900"] //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to +//~| HELP remove the attribute mod link_name { #[link_name = "1900"] //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to + //~| HELP remove the attribute extern "C" { } mod inner { #![link_name="1900"] } //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to + //~| HELP remove the attribute #[link_name = "1900"] fn f() { } //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to + //~| HELP remove the attribute #[link_name = "1900"] struct S; //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to + //~| HELP remove the attribute #[link_name = "1900"] type T = S; //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to + //~| HELP remove the attribute #[link_name = "1900"] impl S { } //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to + //~| HELP remove the attribute } #[link_section = "1800"] //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to +//~| HELP remove the attribute mod link_section { mod inner { #![link_section="1800"] } //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to + //~| HELP remove the attribute #[link_section = "1800"] fn f() { } @@ -602,16 +664,19 @@ mod link_section { //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to + //~| HELP remove the attribute #[link_section = "1800"] type T = S; //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to + //~| HELP remove the attribute #[link_section = "1800"] impl S { } //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to + //~| HELP remove the attribute } @@ -668,21 +733,29 @@ mod deprecated { #[deprecated] impl super::StructForDeprecated { } } -#[must_use] //~ WARN `#[must_use]` has no effect -//~^ HELP remove the attribute +#[must_use] //~ WARN attribute cannot be used on +//~| WARN previously accepted +//~| HELP can be applied to +//~| HELP remove the attribute mod must_use { - mod inner { #![must_use] } //~ WARN `#[must_use]` has no effect - //~^ HELP remove the attribute + mod inner { #![must_use] } //~ WARN attribute cannot be used on + //~| WARN previously accepted + //~| HELP can be applied to + //~| HELP remove the attribute #[must_use] fn f() { } #[must_use] struct S; - #[must_use] type T = S; //~ WARN `#[must_use]` has no effect - //~^ HELP remove the attribute + #[must_use] type T = S; //~ WARN attribute cannot be used on + //~| WARN previously accepted + //~| HELP can be applied to + //~| HELP remove the attribute - #[must_use] impl S { } //~ WARN `#[must_use]` has no effect - //~^ HELP remove the attribute + #[must_use] impl S { } //~ WARN attribute cannot be used on + //~| WARN previously accepted + //~| HELP can be applied to + //~| HELP remove the attribute } #[windows_subsystem = "windows"] diff --git a/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.stderr b/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.stderr index 8e2bffb91ca51..a633ac0aadb61 100644 --- a/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.stderr +++ b/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.stderr @@ -1,5 +1,5 @@ warning: `#[macro_escape]` is a deprecated synonym for `#[macro_use]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:462:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:506:17 | LL | mod inner { #![macro_escape] } | ^^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ LL | mod inner { #![macro_escape] } = help: try an outer attribute: `#[macro_use]` warning: `#[macro_escape]` is a deprecated synonym for `#[macro_use]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:459:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:503:1 | LL | #[macro_escape] | ^^^^^^^^^^^^^^^ @@ -43,151 +43,151 @@ LL | #![deny(x5100)] | ^^^^^ warning: unknown lint: `x5400` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:103:8 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:111:8 | LL | #[warn(x5400)] | ^^^^^ warning: unknown lint: `x5400` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:106:25 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:114:25 | LL | mod inner { #![warn(x5400)] } | ^^^^^ warning: unknown lint: `x5400` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:109:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:117:12 | LL | #[warn(x5400)] fn f() { } | ^^^^^ warning: unknown lint: `x5400` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:112:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:120:12 | LL | #[warn(x5400)] struct S; | ^^^^^ warning: unknown lint: `x5400` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:115:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:123:12 | LL | #[warn(x5400)] type T = S; | ^^^^^ warning: unknown lint: `x5400` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:118:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:126:12 | LL | #[warn(x5400)] impl S { } | ^^^^^ warning: unknown lint: `x5300` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:122:9 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:130:9 | LL | #[allow(x5300)] | ^^^^^ warning: unknown lint: `x5300` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:125:26 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:133:26 | LL | mod inner { #![allow(x5300)] } | ^^^^^ warning: unknown lint: `x5300` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:128:13 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:136:13 | LL | #[allow(x5300)] fn f() { } | ^^^^^ warning: unknown lint: `x5300` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:131:13 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:139:13 | LL | #[allow(x5300)] struct S; | ^^^^^ warning: unknown lint: `x5300` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:134:13 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:142:13 | LL | #[allow(x5300)] type T = S; | ^^^^^ warning: unknown lint: `x5300` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:137:13 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:145:13 | LL | #[allow(x5300)] impl S { } | ^^^^^ warning: unknown lint: `x5200` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:141:10 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:149:10 | LL | #[forbid(x5200)] | ^^^^^ warning: unknown lint: `x5200` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:144:27 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:152:27 | LL | mod inner { #![forbid(x5200)] } | ^^^^^ warning: unknown lint: `x5200` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:147:14 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:155:14 | LL | #[forbid(x5200)] fn f() { } | ^^^^^ warning: unknown lint: `x5200` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:150:14 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:158:14 | LL | #[forbid(x5200)] struct S; | ^^^^^ warning: unknown lint: `x5200` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:153:14 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:161:14 | LL | #[forbid(x5200)] type T = S; | ^^^^^ warning: unknown lint: `x5200` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:156:14 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:164:14 | LL | #[forbid(x5200)] impl S { } | ^^^^^ warning: unknown lint: `x5100` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:160:8 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:168:8 | LL | #[deny(x5100)] | ^^^^^ warning: unknown lint: `x5100` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:163:25 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:171:25 | LL | mod inner { #![deny(x5100)] } | ^^^^^ warning: unknown lint: `x5100` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:166:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:174:12 | LL | #[deny(x5100)] fn f() { } | ^^^^^ warning: unknown lint: `x5100` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:169:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:177:12 | LL | #[deny(x5100)] struct S; | ^^^^^ warning: unknown lint: `x5100` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:172:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:180:12 | LL | #[deny(x5100)] type T = S; | ^^^^^ warning: unknown lint: `x5100` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:175:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:183:12 | LL | #[deny(x5100)] impl S { } | ^^^^^ warning: `#[macro_export]` only has an effect on macro definitions - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:204:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:216:1 | LL | #[macro_export] | ^^^^^^^^^^^^^^^ @@ -199,19 +199,19 @@ LL | #![warn(unused_attributes, unknown_lints)] | ^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:439:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:483:1 | LL | #[reexport_test_harness_main = "2900"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:487:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:535:1 | LL | #[no_std] | ^^^^^^^^^ warning: attribute should be applied to an `extern` block with non-Rust ABI - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:620:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:685:1 | LL | #[link()] | ^^^^^^^^^ @@ -226,76 +226,64 @@ LL | | } | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! -warning: `#[must_use]` has no effect when applied to modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:671:1 - | -LL | #[must_use] - | ^^^^^^^^^^^ - warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:688:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:761:1 | LL | #[windows_subsystem = "windows"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:709:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:782:1 | LL | #[crate_name = "0900"] | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:728:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:801:1 | LL | #[crate_type = "0800"] | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:747:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:820:1 | LL | #[feature(x0600)] | ^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:767:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:840:1 | LL | #[no_main] | ^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:786:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:859:1 | LL | #[no_builtins] | ^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:805:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:878:1 | LL | #[recursion_limit="0200"] | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:824:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:897:1 | LL | #[type_length_limit="0100"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: attribute should be applied to an `extern` block with non-Rust ABI - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:68:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:72:1 | LL | #![link()] | ^^^^^^^^^^ not an `extern` block | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! -warning: `#[must_use]` has no effect when applied to modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:78:1 - | -LL | #![must_use] - | ^^^^^^^^^^^^ - warning: the feature `rust1` has been stable since 1.0.0 and no longer requires an attribute to enable - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:92:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:100:12 | LL | #![feature(rust1)] | ^^^^^ @@ -303,97 +291,97 @@ LL | #![feature(rust1)] = note: `#[warn(stable_features)]` on by default warning: `#[macro_export]` only has an effect on macro definitions - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:207:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:219:17 | LL | mod inner { #![macro_export] } | ^^^^^^^^^^^^^^^^ warning: `#[macro_export]` only has an effect on macro definitions - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:210:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:222:5 | LL | #[macro_export] fn f() { } | ^^^^^^^^^^^^^^^ warning: `#[macro_export]` only has an effect on macro definitions - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:213:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:225:5 | LL | #[macro_export] struct S; | ^^^^^^^^^^^^^^^ warning: `#[macro_export]` only has an effect on macro definitions - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:216:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:228:5 | LL | #[macro_export] type T = S; | ^^^^^^^^^^^^^^^ warning: `#[macro_export]` only has an effect on macro definitions - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:219:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:231:5 | LL | #[macro_export] impl S { } | ^^^^^^^^^^^^^^^ warning: crate-level attribute should be in the root module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:442:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:486:17 | LL | mod inner { #![reexport_test_harness_main="2900"] } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:445:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:489:5 | LL | #[reexport_test_harness_main = "2900"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:448:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:492:5 | LL | #[reexport_test_harness_main = "2900"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:451:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:495:5 | LL | #[reexport_test_harness_main = "2900"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:454:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:498:5 | LL | #[reexport_test_harness_main = "2900"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be in the root module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:490:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:538:17 | LL | mod inner { #![no_std] } | ^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:493:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:541:5 | LL | #[no_std] fn f() { } | ^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:496:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:544:5 | LL | #[no_std] struct S; | ^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:499:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:547:5 | LL | #[no_std] type T = S; | ^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:502:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:550:5 | LL | #[no_std] impl S { } | ^^^^^^^^^ warning: attribute should be applied to an `extern` block with non-Rust ABI - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:626:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:691:17 | LL | mod inner { #![link()] } | ------------^^^^^^^^^^-- not an `extern` block @@ -401,7 +389,7 @@ LL | mod inner { #![link()] } = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: attribute should be applied to an `extern` block with non-Rust ABI - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:631:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:696:5 | LL | #[link()] fn f() { } | ^^^^^^^^^ ---------- not an `extern` block @@ -409,7 +397,7 @@ LL | #[link()] fn f() { } = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: attribute should be applied to an `extern` block with non-Rust ABI - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:636:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:701:5 | LL | #[link()] struct S; | ^^^^^^^^^ --------- not an `extern` block @@ -417,7 +405,7 @@ LL | #[link()] struct S; = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: attribute should be applied to an `extern` block with non-Rust ABI - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:641:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:706:5 | LL | #[link()] type T = S; | ^^^^^^^^^ ----------- not an `extern` block @@ -425,7 +413,7 @@ LL | #[link()] type T = S; = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: attribute should be applied to an `extern` block with non-Rust ABI - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:646:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:711:5 | LL | #[link()] impl S { } | ^^^^^^^^^ ---------- not an `extern` block @@ -433,273 +421,255 @@ LL | #[link()] impl S { } = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: attribute should be applied to an `extern` block with non-Rust ABI - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:651:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:716:5 | LL | #[link()] extern "Rust" {} | ^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! -warning: `#[must_use]` has no effect when applied to modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:674:17 - | -LL | mod inner { #![must_use] } - | ^^^^^^^^^^^^ - -warning: `#[must_use]` has no effect when applied to type aliases - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:681:5 - | -LL | #[must_use] type T = S; - | ^^^^^^^^^^^ - -warning: `#[must_use]` has no effect when applied to inherent impl blocks - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:684:5 - | -LL | #[must_use] impl S { } - | ^^^^^^^^^^^ - warning: crate-level attribute should be in the root module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:691:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:764:17 | LL | mod inner { #![windows_subsystem="windows"] } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:694:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:767:5 | LL | #[windows_subsystem = "windows"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:697:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:770:5 | LL | #[windows_subsystem = "windows"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:700:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:773:5 | LL | #[windows_subsystem = "windows"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:703:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:776:5 | LL | #[windows_subsystem = "windows"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be in the root module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:712:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:785:17 | LL | mod inner { #![crate_name="0900"] } | ^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:715:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:788:5 | LL | #[crate_name = "0900"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:718:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:791:5 | LL | #[crate_name = "0900"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:721:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:794:5 | LL | #[crate_name = "0900"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:724:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:797:5 | LL | #[crate_name = "0900"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be in the root module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:731:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:804:17 | LL | mod inner { #![crate_type="0800"] } | ^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:734:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:807:5 | LL | #[crate_type = "0800"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:737:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:810:5 | LL | #[crate_type = "0800"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:740:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:813:5 | LL | #[crate_type = "0800"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:743:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:816:5 | LL | #[crate_type = "0800"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be in the root module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:750:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:823:17 | LL | mod inner { #![feature(x0600)] } | ^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:753:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:826:5 | LL | #[feature(x0600)] fn f() { } | ^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:756:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:829:5 | LL | #[feature(x0600)] struct S; | ^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:759:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:832:5 | LL | #[feature(x0600)] type T = S; | ^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:762:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:835:5 | LL | #[feature(x0600)] impl S { } | ^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be in the root module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:770:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:843:17 | LL | mod inner { #![no_main] } | ^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:773:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:846:5 | LL | #[no_main] fn f() { } | ^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:776:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:849:5 | LL | #[no_main] struct S; | ^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:779:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:852:5 | LL | #[no_main] type T = S; | ^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:782:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:855:5 | LL | #[no_main] impl S { } | ^^^^^^^^^^ warning: crate-level attribute should be in the root module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:789:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:862:17 | LL | mod inner { #![no_builtins] } | ^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:792:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:865:5 | LL | #[no_builtins] fn f() { } | ^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:795:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:868:5 | LL | #[no_builtins] struct S; | ^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:798:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:871:5 | LL | #[no_builtins] type T = S; | ^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:801:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:874:5 | LL | #[no_builtins] impl S { } | ^^^^^^^^^^^^^^ warning: crate-level attribute should be in the root module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:808:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:881:17 | LL | mod inner { #![recursion_limit="0200"] } | ^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:811:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:884:5 | LL | #[recursion_limit="0200"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:814:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:887:5 | LL | #[recursion_limit="0200"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:817:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:890:5 | LL | #[recursion_limit="0200"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:820:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:893:5 | LL | #[recursion_limit="0200"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be in the root module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:827:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:900:17 | LL | mod inner { #![type_length_limit="0100"] } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:830:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:903:5 | LL | #[type_length_limit="0100"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:833:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:906:5 | LL | #[type_length_limit="0100"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:836:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:909:5 | LL | #[type_length_limit="0100"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:839:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:912:5 | LL | #[type_length_limit="0100"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: `#[macro_use]` attribute cannot be used on functions - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:183:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:191:5 | LL | #[macro_use] fn f() { } | ^^^^^^^^^^^^ @@ -708,7 +678,7 @@ LL | #[macro_use] fn f() { } = help: `#[macro_use]` can be applied to modules, extern crates, crates warning: `#[macro_use]` attribute cannot be used on structs - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:188:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:197:5 | LL | #[macro_use] struct S; | ^^^^^^^^^^^^ @@ -717,7 +687,7 @@ LL | #[macro_use] struct S; = help: `#[macro_use]` can be applied to modules, extern crates, crates warning: `#[macro_use]` attribute cannot be used on type aliases - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:193:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:203:5 | LL | #[macro_use] type T = S; | ^^^^^^^^^^^^ @@ -726,7 +696,7 @@ LL | #[macro_use] type T = S; = help: `#[macro_use]` can be applied to modules, extern crates, crates warning: `#[macro_use]` attribute cannot be used on inherent impl blocks - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:198:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:209:5 | LL | #[macro_use] impl S { } | ^^^^^^^^^^^^ @@ -735,7 +705,7 @@ LL | #[macro_use] impl S { } = help: `#[macro_use]` can be applied to modules, extern crates, crates warning: `#[path]` attribute cannot be used on functions - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:259:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:271:5 | LL | #[path = "3800"] fn f() { } | ^^^^^^^^^^^^^^^^ @@ -744,7 +714,7 @@ LL | #[path = "3800"] fn f() { } = help: `#[path]` can only be applied to modules warning: `#[path]` attribute cannot be used on structs - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:264:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:277:5 | LL | #[path = "3800"] struct S; | ^^^^^^^^^^^^^^^^ @@ -753,7 +723,7 @@ LL | #[path = "3800"] struct S; = help: `#[path]` can only be applied to modules warning: `#[path]` attribute cannot be used on type aliases - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:269:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:283:5 | LL | #[path = "3800"] type T = S; | ^^^^^^^^^^^^^^^^ @@ -762,7 +732,7 @@ LL | #[path = "3800"] type T = S; = help: `#[path]` can only be applied to modules warning: `#[path]` attribute cannot be used on inherent impl blocks - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:274:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:289:5 | LL | #[path = "3800"] impl S { } | ^^^^^^^^^^^^^^^^ @@ -771,7 +741,7 @@ LL | #[path = "3800"] impl S { } = help: `#[path]` can only be applied to modules warning: `#[automatically_derived]` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:280:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:296:1 | LL | #[automatically_derived] | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -780,7 +750,7 @@ LL | #[automatically_derived] = help: `#[automatically_derived]` can only be applied to trait impl blocks warning: `#[automatically_derived]` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:285:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:302:17 | LL | mod inner { #![automatically_derived] } | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -789,7 +759,7 @@ LL | mod inner { #![automatically_derived] } = help: `#[automatically_derived]` can only be applied to trait impl blocks warning: `#[automatically_derived]` attribute cannot be used on functions - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:290:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:308:5 | LL | #[automatically_derived] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -798,7 +768,7 @@ LL | #[automatically_derived] fn f() { } = help: `#[automatically_derived]` can only be applied to trait impl blocks warning: `#[automatically_derived]` attribute cannot be used on structs - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:295:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:314:5 | LL | #[automatically_derived] struct S; | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -807,7 +777,7 @@ LL | #[automatically_derived] struct S; = help: `#[automatically_derived]` can only be applied to trait impl blocks warning: `#[automatically_derived]` attribute cannot be used on type aliases - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:300:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:320:5 | LL | #[automatically_derived] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -816,7 +786,7 @@ LL | #[automatically_derived] type T = S; = help: `#[automatically_derived]` can only be applied to trait impl blocks warning: `#[automatically_derived]` attribute cannot be used on traits - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:305:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:326:5 | LL | #[automatically_derived] trait W { } | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -825,7 +795,7 @@ LL | #[automatically_derived] trait W { } = help: `#[automatically_derived]` can only be applied to trait impl blocks warning: `#[automatically_derived]` attribute cannot be used on inherent impl blocks - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:310:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:332:5 | LL | #[automatically_derived] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -834,7 +804,7 @@ LL | #[automatically_derived] impl S { } = help: `#[automatically_derived]` can only be applied to trait impl blocks warning: `#[no_mangle]` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:318:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:341:1 | LL | #[no_mangle] | ^^^^^^^^^^^^ @@ -843,7 +813,7 @@ LL | #[no_mangle] = help: `#[no_mangle]` can be applied to functions, statics warning: `#[no_mangle]` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:323:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:347:17 | LL | mod inner { #![no_mangle] } | ^^^^^^^^^^^^^ @@ -852,7 +822,7 @@ LL | mod inner { #![no_mangle] } = help: `#[no_mangle]` can be applied to functions, statics warning: `#[no_mangle]` attribute cannot be used on structs - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:330:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:355:5 | LL | #[no_mangle] struct S; | ^^^^^^^^^^^^ @@ -861,7 +831,7 @@ LL | #[no_mangle] struct S; = help: `#[no_mangle]` can be applied to functions, statics warning: `#[no_mangle]` attribute cannot be used on type aliases - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:335:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:361:5 | LL | #[no_mangle] type T = S; | ^^^^^^^^^^^^ @@ -870,7 +840,7 @@ LL | #[no_mangle] type T = S; = help: `#[no_mangle]` can be applied to functions, statics warning: `#[no_mangle]` attribute cannot be used on inherent impl blocks - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:340:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:367:5 | LL | #[no_mangle] impl S { } | ^^^^^^^^^^^^ @@ -879,7 +849,7 @@ LL | #[no_mangle] impl S { } = help: `#[no_mangle]` can be applied to functions, statics warning: `#[no_mangle]` attribute cannot be used on required trait methods - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:346:9 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:374:9 | LL | #[no_mangle] fn foo(); | ^^^^^^^^^^^^ @@ -888,7 +858,7 @@ LL | #[no_mangle] fn foo(); = help: `#[no_mangle]` can be applied to functions, statics, inherent methods, trait methods in impl blocks warning: `#[no_mangle]` attribute cannot be used on provided trait methods - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:351:9 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:380:9 | LL | #[no_mangle] fn bar() {} | ^^^^^^^^^^^^ @@ -897,7 +867,7 @@ LL | #[no_mangle] fn bar() {} = help: `#[no_mangle]` can be applied to functions, statics, inherent methods, trait methods in impl blocks warning: `#[should_panic]` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:358:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:388:1 | LL | #[should_panic] | ^^^^^^^^^^^^^^^ @@ -906,7 +876,7 @@ LL | #[should_panic] = help: `#[should_panic]` can only be applied to functions warning: `#[should_panic]` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:363:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:394:17 | LL | mod inner { #![should_panic] } | ^^^^^^^^^^^^^^^^ @@ -915,7 +885,7 @@ LL | mod inner { #![should_panic] } = help: `#[should_panic]` can only be applied to functions warning: `#[should_panic]` attribute cannot be used on structs - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:370:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:402:5 | LL | #[should_panic] struct S; | ^^^^^^^^^^^^^^^ @@ -924,7 +894,7 @@ LL | #[should_panic] struct S; = help: `#[should_panic]` can only be applied to functions warning: `#[should_panic]` attribute cannot be used on type aliases - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:375:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:408:5 | LL | #[should_panic] type T = S; | ^^^^^^^^^^^^^^^ @@ -933,7 +903,7 @@ LL | #[should_panic] type T = S; = help: `#[should_panic]` can only be applied to functions warning: `#[should_panic]` attribute cannot be used on inherent impl blocks - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:380:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:414:5 | LL | #[should_panic] impl S { } | ^^^^^^^^^^^^^^^ @@ -942,7 +912,7 @@ LL | #[should_panic] impl S { } = help: `#[should_panic]` can only be applied to functions warning: `#[ignore]` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:386:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:421:1 | LL | #[ignore] | ^^^^^^^^^ @@ -951,7 +921,7 @@ LL | #[ignore] = help: `#[ignore]` can only be applied to functions warning: `#[ignore]` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:391:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:427:17 | LL | mod inner { #![ignore] } | ^^^^^^^^^^ @@ -960,7 +930,7 @@ LL | mod inner { #![ignore] } = help: `#[ignore]` can only be applied to functions warning: `#[ignore]` attribute cannot be used on structs - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:398:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:435:5 | LL | #[ignore] struct S; | ^^^^^^^^^ @@ -969,7 +939,7 @@ LL | #[ignore] struct S; = help: `#[ignore]` can only be applied to functions warning: `#[ignore]` attribute cannot be used on type aliases - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:403:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:441:5 | LL | #[ignore] type T = S; | ^^^^^^^^^ @@ -978,7 +948,7 @@ LL | #[ignore] type T = S; = help: `#[ignore]` can only be applied to functions warning: `#[ignore]` attribute cannot be used on inherent impl blocks - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:408:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:447:5 | LL | #[ignore] impl S { } | ^^^^^^^^^ @@ -987,7 +957,7 @@ LL | #[ignore] impl S { } = help: `#[ignore]` can only be applied to functions warning: `#[no_implicit_prelude]` attribute cannot be used on functions - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:418:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:458:5 | LL | #[no_implicit_prelude] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^ @@ -996,7 +966,7 @@ LL | #[no_implicit_prelude] fn f() { } = help: `#[no_implicit_prelude]` can be applied to modules, crates warning: `#[no_implicit_prelude]` attribute cannot be used on structs - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:423:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:464:5 | LL | #[no_implicit_prelude] struct S; | ^^^^^^^^^^^^^^^^^^^^^^ @@ -1005,7 +975,7 @@ LL | #[no_implicit_prelude] struct S; = help: `#[no_implicit_prelude]` can be applied to modules, crates warning: `#[no_implicit_prelude]` attribute cannot be used on type aliases - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:428:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:470:5 | LL | #[no_implicit_prelude] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^ @@ -1014,7 +984,7 @@ LL | #[no_implicit_prelude] type T = S; = help: `#[no_implicit_prelude]` can be applied to modules, crates warning: `#[no_implicit_prelude]` attribute cannot be used on inherent impl blocks - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:433:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:476:5 | LL | #[no_implicit_prelude] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^ @@ -1023,7 +993,7 @@ LL | #[no_implicit_prelude] impl S { } = help: `#[no_implicit_prelude]` can be applied to modules, crates warning: `#[macro_escape]` attribute cannot be used on functions - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:466:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:510:5 | LL | #[macro_escape] fn f() { } | ^^^^^^^^^^^^^^^ @@ -1032,7 +1002,7 @@ LL | #[macro_escape] fn f() { } = help: `#[macro_escape]` can be applied to modules, extern crates, crates warning: `#[macro_escape]` attribute cannot be used on structs - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:471:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:516:5 | LL | #[macro_escape] struct S; | ^^^^^^^^^^^^^^^ @@ -1041,7 +1011,7 @@ LL | #[macro_escape] struct S; = help: `#[macro_escape]` can be applied to modules, extern crates, crates warning: `#[macro_escape]` attribute cannot be used on type aliases - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:476:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:522:5 | LL | #[macro_escape] type T = S; | ^^^^^^^^^^^^^^^ @@ -1050,7 +1020,7 @@ LL | #[macro_escape] type T = S; = help: `#[macro_escape]` can be applied to modules, extern crates, crates warning: `#[macro_escape]` attribute cannot be used on inherent impl blocks - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:481:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:528:5 | LL | #[macro_escape] impl S { } | ^^^^^^^^^^^^^^^ @@ -1059,7 +1029,7 @@ LL | #[macro_escape] impl S { } = help: `#[macro_escape]` can be applied to modules, extern crates, crates warning: `#[cold]` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:523:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:571:1 | LL | #[cold] | ^^^^^^^ @@ -1068,7 +1038,7 @@ LL | #[cold] = help: `#[cold]` can only be applied to functions warning: `#[cold]` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:529:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:578:17 | LL | mod inner { #![cold] } | ^^^^^^^^ @@ -1077,7 +1047,7 @@ LL | mod inner { #![cold] } = help: `#[cold]` can only be applied to functions warning: `#[cold]` attribute cannot be used on structs - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:536:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:586:5 | LL | #[cold] struct S; | ^^^^^^^ @@ -1086,7 +1056,7 @@ LL | #[cold] struct S; = help: `#[cold]` can only be applied to functions warning: `#[cold]` attribute cannot be used on type aliases - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:541:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:592:5 | LL | #[cold] type T = S; | ^^^^^^^ @@ -1095,7 +1065,7 @@ LL | #[cold] type T = S; = help: `#[cold]` can only be applied to functions warning: `#[cold]` attribute cannot be used on inherent impl blocks - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:546:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:598:5 | LL | #[cold] impl S { } | ^^^^^^^ @@ -1104,7 +1074,7 @@ LL | #[cold] impl S { } = help: `#[cold]` can only be applied to functions warning: `#[link_name]` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:552:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:605:1 | LL | #[link_name = "1900"] | ^^^^^^^^^^^^^^^^^^^^^ @@ -1113,7 +1083,7 @@ LL | #[link_name = "1900"] = help: `#[link_name]` can be applied to foreign functions, foreign statics warning: `#[link_name]` attribute cannot be used on foreign modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:557:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:611:5 | LL | #[link_name = "1900"] | ^^^^^^^^^^^^^^^^^^^^^ @@ -1122,7 +1092,7 @@ LL | #[link_name = "1900"] = help: `#[link_name]` can be applied to foreign functions, foreign statics warning: `#[link_name]` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:563:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:618:17 | LL | mod inner { #![link_name="1900"] } | ^^^^^^^^^^^^^^^^^^^^ @@ -1131,7 +1101,7 @@ LL | mod inner { #![link_name="1900"] } = help: `#[link_name]` can be applied to foreign functions, foreign statics warning: `#[link_name]` attribute cannot be used on functions - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:568:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:624:5 | LL | #[link_name = "1900"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^ @@ -1140,7 +1110,7 @@ LL | #[link_name = "1900"] fn f() { } = help: `#[link_name]` can be applied to foreign functions, foreign statics warning: `#[link_name]` attribute cannot be used on structs - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:573:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:630:5 | LL | #[link_name = "1900"] struct S; | ^^^^^^^^^^^^^^^^^^^^^ @@ -1149,7 +1119,7 @@ LL | #[link_name = "1900"] struct S; = help: `#[link_name]` can be applied to foreign functions, foreign statics warning: `#[link_name]` attribute cannot be used on type aliases - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:578:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:636:5 | LL | #[link_name = "1900"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^ @@ -1158,7 +1128,7 @@ LL | #[link_name = "1900"] type T = S; = help: `#[link_name]` can be applied to foreign functions, foreign statics warning: `#[link_name]` attribute cannot be used on inherent impl blocks - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:583:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:642:5 | LL | #[link_name = "1900"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^ @@ -1167,7 +1137,7 @@ LL | #[link_name = "1900"] impl S { } = help: `#[link_name]` can be applied to foreign functions, foreign statics warning: `#[link_section]` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:589:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:649:1 | LL | #[link_section = "1800"] | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1176,7 +1146,7 @@ LL | #[link_section = "1800"] = help: `#[link_section]` can be applied to statics, functions warning: `#[link_section]` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:594:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:655:17 | LL | mod inner { #![link_section="1800"] } | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -1185,7 +1155,7 @@ LL | mod inner { #![link_section="1800"] } = help: `#[link_section]` can be applied to statics, functions warning: `#[link_section]` attribute cannot be used on structs - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:601:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:663:5 | LL | #[link_section = "1800"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1194,7 +1164,7 @@ LL | #[link_section = "1800"] struct S; = help: `#[link_section]` can be applied to statics, functions warning: `#[link_section]` attribute cannot be used on type aliases - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:606:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:669:5 | LL | #[link_section = "1800"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1203,7 +1173,7 @@ LL | #[link_section = "1800"] type T = S; = help: `#[link_section]` can be applied to statics, functions warning: `#[link_section]` attribute cannot be used on inherent impl blocks - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:611:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:675:5 | LL | #[link_section = "1800"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1211,6 +1181,42 @@ LL | #[link_section = "1800"] impl S { } = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = help: `#[link_section]` can be applied to statics, functions +warning: `#[must_use]` attribute cannot be used on modules + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:736:1 + | +LL | #[must_use] + | ^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[must_use]` can be applied to functions, data types, unions, traits + +warning: `#[must_use]` attribute cannot be used on modules + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:741:17 + | +LL | mod inner { #![must_use] } + | ^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[must_use]` can be applied to functions, data types, unions, traits + +warning: `#[must_use]` attribute cannot be used on type aliases + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:750:5 + | +LL | #[must_use] type T = S; + | ^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[must_use]` can be applied to functions, data types, unions, traits + +warning: `#[must_use]` attribute cannot be used on inherent impl blocks + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:755:5 + | +LL | #[must_use] impl S { } + | ^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[must_use]` can be applied to functions, data types, unions, traits + warning: `#[should_panic]` attribute cannot be used on crates --> $DIR/issue-43106-gating-of-builtin-attrs.rs:50:1 | @@ -1221,7 +1227,7 @@ LL | #![should_panic] = help: `#[should_panic]` can only be applied to functions warning: `#[ignore]` attribute cannot be used on crates - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:53:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:54:1 | LL | #![ignore] | ^^^^^^^^^^ @@ -1230,7 +1236,7 @@ LL | #![ignore] = help: `#[ignore]` can only be applied to functions warning: `#[proc_macro_derive]` attribute cannot be used on crates - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:61:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:63:1 | LL | #![proc_macro_derive(Test)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1239,7 +1245,7 @@ LL | #![proc_macro_derive(Test)] = help: `#[proc_macro_derive]` can only be applied to functions warning: `#[cold]` attribute cannot be used on crates - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:65:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:68:1 | LL | #![cold] | ^^^^^^^^ @@ -1248,7 +1254,7 @@ LL | #![cold] = help: `#[cold]` can only be applied to functions warning: `#[link_name]` attribute cannot be used on crates - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:70:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:74:1 | LL | #![link_name = "1900"] | ^^^^^^^^^^^^^^^^^^^^^^ @@ -1257,7 +1263,7 @@ LL | #![link_name = "1900"] = help: `#[link_name]` can be applied to foreign functions, foreign statics warning: `#[link_section]` attribute cannot be used on crates - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:74:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:79:1 | LL | #![link_section = "1800"] | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1265,5 +1271,14 @@ LL | #![link_section = "1800"] = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = help: `#[link_section]` can be applied to statics, functions +warning: `#[must_use]` attribute cannot be used on crates + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:84:1 + | +LL | #![must_use] + | ^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[must_use]` can be applied to functions, data types, unions, traits + warning: 173 warnings emitted diff --git a/tests/ui/generic-associated-types/bugs/hrtb-implied-1.stderr b/tests/ui/generic-associated-types/bugs/hrtb-implied-1.stderr index 5dfc42bc8735a..8bb72833e301c 100644 --- a/tests/ui/generic-associated-types/bugs/hrtb-implied-1.stderr +++ b/tests/ui/generic-associated-types/bugs/hrtb-implied-1.stderr @@ -9,11 +9,11 @@ LL | print_items::>(windows); LL | } | - temporary value is freed at the end of this statement | -note: due to current limitations in the borrow checker, this implies a `'static` lifetime - --> $DIR/hrtb-implied-1.rs:26:26 +note: due to a current limitation of the type system, this implies a `'static` lifetime + --> $DIR/hrtb-implied-1.rs:26:5 | LL | for<'a> I::Item<'a>: Debug, - | ^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 1 previous error diff --git a/tests/ui/generic-associated-types/bugs/hrtb-implied-2.stderr b/tests/ui/generic-associated-types/bugs/hrtb-implied-2.stderr index 9a1a09b29df9a..1a397f6cdb21a 100644 --- a/tests/ui/generic-associated-types/bugs/hrtb-implied-2.stderr +++ b/tests/ui/generic-associated-types/bugs/hrtb-implied-2.stderr @@ -15,7 +15,11 @@ LL | let _next = iter2.next(); = note: requirement occurs because of a mutable reference to `Eat<&mut I, F>` = note: mutable references are invariant over their type parameter = help: see for more information about variance - = note: due to current limitations in the borrow checker, this implies a `'static` lifetime +note: due to a current limitation of the type system, this implies a `'static` lifetime + --> $DIR/hrtb-implied-2.rs:31:8 + | +LL | F: FnMut(I::Item<'_>), + | ^^^^^^^^^^^^^^^^^^ error: aborting due to 1 previous error diff --git a/tests/ui/generic-associated-types/bugs/hrtb-implied-3.stderr b/tests/ui/generic-associated-types/bugs/hrtb-implied-3.stderr index 77f363ee87db8..aaafcb3b7afb4 100644 --- a/tests/ui/generic-associated-types/bugs/hrtb-implied-3.stderr +++ b/tests/ui/generic-associated-types/bugs/hrtb-implied-3.stderr @@ -11,11 +11,11 @@ LL | trivial_bound(iter); | `iter` escapes the function body here | argument requires that `'1` must outlive `'static` | -note: due to current limitations in the borrow checker, this implies a `'static` lifetime - --> $DIR/hrtb-implied-3.rs:14:26 +note: due to a current limitation of the type system, this implies a `'static` lifetime + --> $DIR/hrtb-implied-3.rs:14:5 | LL | for<'a> I::Item<'a>: Sized, - | ^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 1 previous error diff --git a/tests/ui/generic-associated-types/collectivity-regression.stderr b/tests/ui/generic-associated-types/collectivity-regression.stderr index 1c081ac644afa..31349c8eb270c 100644 --- a/tests/ui/generic-associated-types/collectivity-regression.stderr +++ b/tests/ui/generic-associated-types/collectivity-regression.stderr @@ -7,7 +7,7 @@ LL | | let _x = x; LL | | }; | |_____^ | -note: due to current limitations in the borrow checker, this implies a `'static` lifetime +note: due to a current limitation of the type system, this implies a `'static` lifetime --> $DIR/collectivity-regression.rs:11:16 | LL | for<'a> T: Get = ()>, diff --git a/tests/ui/generic-associated-types/extended/lending_iterator.stderr b/tests/ui/generic-associated-types/extended/lending_iterator.stderr index 84f5ed07bda59..7af95dc96a10a 100644 --- a/tests/ui/generic-associated-types/extended/lending_iterator.stderr +++ b/tests/ui/generic-associated-types/extended/lending_iterator.stderr @@ -12,6 +12,12 @@ error: `Self` does not live long enough | LL | >::from_iter(self) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: due to a current limitation of the type system, this implies a `'static` lifetime + --> $DIR/lending_iterator.rs:4:21 + | +LL | fn from_iter LendingIterator = A>>(iter: T) -> Self; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/tests/ui/issues/issue-86756.rs b/tests/ui/generics/duplicate-generic-parameter-error-86756.rs similarity index 89% rename from tests/ui/issues/issue-86756.rs rename to tests/ui/generics/duplicate-generic-parameter-error-86756.rs index 55a6c144839e8..acc281cb8c456 100644 --- a/tests/ui/issues/issue-86756.rs +++ b/tests/ui/generics/duplicate-generic-parameter-error-86756.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/86756 //@ edition: 2015 trait Foo {} //~^ ERROR the name `T` is already used for a generic parameter in this item's generic parameters diff --git a/tests/ui/issues/issue-86756.stderr b/tests/ui/generics/duplicate-generic-parameter-error-86756.stderr similarity index 82% rename from tests/ui/issues/issue-86756.stderr rename to tests/ui/generics/duplicate-generic-parameter-error-86756.stderr index b650b32c2a367..d4b2169ffd2dd 100644 --- a/tests/ui/issues/issue-86756.stderr +++ b/tests/ui/generics/duplicate-generic-parameter-error-86756.stderr @@ -1,5 +1,5 @@ error[E0403]: the name `T` is already used for a generic parameter in this item's generic parameters - --> $DIR/issue-86756.rs:2:14 + --> $DIR/duplicate-generic-parameter-error-86756.rs:3:14 | LL | trait Foo {} | - ^ already used @@ -7,13 +7,13 @@ LL | trait Foo {} | first use of `T` error[E0412]: cannot find type `dyn` in this scope - --> $DIR/issue-86756.rs:6:10 + --> $DIR/duplicate-generic-parameter-error-86756.rs:7:10 | LL | eq:: | ^^^ not found in this scope warning: trait objects without an explicit `dyn` are deprecated - --> $DIR/issue-86756.rs:6:15 + --> $DIR/duplicate-generic-parameter-error-86756.rs:7:15 | LL | eq:: | ^^^ @@ -27,13 +27,13 @@ LL | eq:: | +++ error[E0107]: missing generics for trait `Foo` - --> $DIR/issue-86756.rs:6:15 + --> $DIR/duplicate-generic-parameter-error-86756.rs:7:15 | LL | eq:: | ^^^ expected at least 1 generic argument | note: trait defined here, with at least 1 generic parameter: `T` - --> $DIR/issue-86756.rs:2:7 + --> $DIR/duplicate-generic-parameter-error-86756.rs:3:7 | LL | trait Foo {} | ^^^ - diff --git a/tests/ui/higher-ranked/trait-bounds/hrtb-just-for-static.stderr b/tests/ui/higher-ranked/trait-bounds/hrtb-just-for-static.stderr index 1c077a9b906cd..697e85dc8c394 100644 --- a/tests/ui/higher-ranked/trait-bounds/hrtb-just-for-static.stderr +++ b/tests/ui/higher-ranked/trait-bounds/hrtb-just-for-static.stderr @@ -15,7 +15,7 @@ LL | fn give_some<'a>() { LL | want_hrtb::<&'a u32>() | ^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` | -note: due to current limitations in the borrow checker, this implies a `'static` lifetime +note: due to a current limitation of the type system, this implies a `'static` lifetime --> $DIR/hrtb-just-for-static.rs:9:15 | LL | where T : for<'a> Foo<&'a isize> diff --git a/tests/ui/higher-ranked/trait-bounds/hrtb-perfect-forwarding.stderr b/tests/ui/higher-ranked/trait-bounds/hrtb-perfect-forwarding.stderr index 727b9e6bec8e6..327c0faa48287 100644 --- a/tests/ui/higher-ranked/trait-bounds/hrtb-perfect-forwarding.stderr +++ b/tests/ui/higher-ranked/trait-bounds/hrtb-perfect-forwarding.stderr @@ -47,7 +47,7 @@ LL | fn foo_hrtb_bar_not<'b, T>(mut t: T) LL | foo_hrtb_bar_not(&mut t); | ^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'b` must outlive `'static` | -note: due to current limitations in the borrow checker, this implies a `'static` lifetime +note: due to a current limitation of the type system, this implies a `'static` lifetime --> $DIR/hrtb-perfect-forwarding.rs:37:8 | LL | T: for<'a> Foo<&'a isize> + Bar<&'b isize>, diff --git a/tests/ui/implied-bounds/normalization-placeholder-leak.fail.stderr b/tests/ui/implied-bounds/normalization-placeholder-leak.fail.stderr index 8919919d04e5c..be8b44b1bde6c 100644 --- a/tests/ui/implied-bounds/normalization-placeholder-leak.fail.stderr +++ b/tests/ui/implied-bounds/normalization-placeholder-leak.fail.stderr @@ -30,6 +30,12 @@ LL | fn test_lifetime<'lt, T: Trait>(_: Foo<&'lt u8>) {} | | | | | lifetime `'lt` defined here | requires that `'lt` must outlive `'static` + | +note: due to a current limitation of the type system, this implies a `'static` lifetime + --> $DIR/normalization-placeholder-leak.rs:19:5 + | +LL | for<'x> T::Ty<'x>: Sized; + | ^^^^^^^^^^^^^^^^^^^^^^^^ error: lifetime may not live long enough --> $DIR/normalization-placeholder-leak.rs:38:5 @@ -39,6 +45,12 @@ LL | fn test_alias<'lt, T: AnotherTrait>(_: Foo>) {} | | | | | lifetime `'lt` defined here | requires that `'lt` must outlive `'static` + | +note: due to a current limitation of the type system, this implies a `'static` lifetime + --> $DIR/normalization-placeholder-leak.rs:19:5 + | +LL | for<'x> T::Ty<'x>: Sized; + | ^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 6 previous errors diff --git a/tests/ui/inference/issue-72616.stderr b/tests/ui/inference/issue-72616.stderr index 31a0586301df2..a271639996fd2 100644 --- a/tests/ui/inference/issue-72616.stderr +++ b/tests/ui/inference/issue-72616.stderr @@ -6,14 +6,10 @@ LL | if String::from("a") == "a".try_into().unwrap() {} | | | type must be known at this point | - = note: cannot satisfy `String: PartialEq<_>` - = help: the following types implement trait `PartialEq`: - `String` implements `PartialEq<&str>` - `String` implements `PartialEq` - `String` implements `PartialEq` - `String` implements `PartialEq>` - `String` implements `PartialEq` - `String` implements `PartialEq` + = note: multiple `impl`s satisfying `String: PartialEq<_>` found in the following crates: `alloc`, `std`: + - impl PartialEq for String; + - impl PartialEq for String; + - impl PartialEq for String; help: try using a fully qualified path to specify the expected types | LL - if String::from("a") == "a".try_into().unwrap() {} diff --git a/tests/ui/issues/issue-85461.rs b/tests/ui/instrument-coverage/link-regex-crate-with-instrument-coverage-85461.rs similarity index 91% rename from tests/ui/issues/issue-85461.rs rename to tests/ui/instrument-coverage/link-regex-crate-with-instrument-coverage-85461.rs index 72538081ccb3a..ffb535e69ee56 100644 --- a/tests/ui/issues/issue-85461.rs +++ b/tests/ui/instrument-coverage/link-regex-crate-with-instrument-coverage-85461.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/85461 //@ compile-flags: -Cinstrument-coverage -Ccodegen-units=4 --crate-type dylib -Copt-level=0 //@ build-pass //@ needs-profiler-runtime diff --git a/tests/ui/issues/issue-26217.stderr b/tests/ui/issues/issue-26217.stderr index 0b153ad7490e0..a875056781955 100644 --- a/tests/ui/issues/issue-26217.stderr +++ b/tests/ui/issues/issue-26217.stderr @@ -6,11 +6,11 @@ LL | fn bar<'a>() { LL | foo::<&'a i32>(); | ^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` | -note: due to current limitations in the borrow checker, this implies a `'static` lifetime - --> $DIR/issue-26217.rs:1:30 +note: due to a current limitation of the type system, this implies a `'static` lifetime + --> $DIR/issue-26217.rs:1:19 | LL | fn foo() where for<'a> T: 'a {} - | ^^ + | ^^^^^^^^^^^^^ error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-77218/issue-77218-2.fixed b/tests/ui/issues/issue-77218/issue-77218-2.fixed deleted file mode 100644 index 98d79b5da6561..0000000000000 --- a/tests/ui/issues/issue-77218/issue-77218-2.fixed +++ /dev/null @@ -1,6 +0,0 @@ -//@ run-rustfix -fn main() { - let value = [7u8]; - while let Some(0) = value.get(0) { //~ ERROR invalid left-hand side of assignment - } -} diff --git a/tests/ui/issues/issue-77218/issue-77218-2.rs b/tests/ui/issues/issue-77218/issue-77218-2.rs deleted file mode 100644 index 3be38f8f721da..0000000000000 --- a/tests/ui/issues/issue-77218/issue-77218-2.rs +++ /dev/null @@ -1,6 +0,0 @@ -//@ run-rustfix -fn main() { - let value = [7u8]; - while Some(0) = value.get(0) { //~ ERROR invalid left-hand side of assignment - } -} diff --git a/tests/ui/issues/issue-77218/issue-77218-2.stderr b/tests/ui/issues/issue-77218/issue-77218-2.stderr deleted file mode 100644 index dfed0b6e67e33..0000000000000 --- a/tests/ui/issues/issue-77218/issue-77218-2.stderr +++ /dev/null @@ -1,16 +0,0 @@ -error[E0070]: invalid left-hand side of assignment - --> $DIR/issue-77218-2.rs:4:19 - | -LL | while Some(0) = value.get(0) { - | - ^ - | | - | cannot assign to this expression - | -help: you might have meant to use pattern destructuring - | -LL | while let Some(0) = value.get(0) { - | +++ - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0070`. diff --git a/tests/ui/issues/issue-7899.rs b/tests/ui/issues/issue-7899.rs deleted file mode 100644 index 4b69f3e3d89aa..0000000000000 --- a/tests/ui/issues/issue-7899.rs +++ /dev/null @@ -1,10 +0,0 @@ -//@ run-pass -#![allow(unused_variables)] -//@ aux-build:issue-7899.rs - - -extern crate issue_7899 as testcrate; - -fn main() { - let f = testcrate::V2(1.0f32, 2.0f32); -} diff --git a/tests/ui/issues/issue-8044.rs b/tests/ui/issues/issue-8044.rs deleted file mode 100644 index 3c10bbca6342b..0000000000000 --- a/tests/ui/issues/issue-8044.rs +++ /dev/null @@ -1,10 +0,0 @@ -//@ run-pass -//@ aux-build:issue-8044.rs - - -extern crate issue_8044 as minimal; -use minimal::{BTree, leaf}; - -pub fn main() { - BTree:: { node: leaf(1) }; -} diff --git a/tests/ui/issues/issue-8401.rs b/tests/ui/issues/issue-8401.rs deleted file mode 100644 index 1df63516fb0be..0000000000000 --- a/tests/ui/issues/issue-8401.rs +++ /dev/null @@ -1,7 +0,0 @@ -//@ run-pass -//@ aux-build:issue-8401.rs - - -extern crate issue_8401; - -pub fn main() {} diff --git a/tests/ui/issues/issue-9123.rs b/tests/ui/issues/issue-9123.rs deleted file mode 100644 index bbf6c13341c27..0000000000000 --- a/tests/ui/issues/issue-9123.rs +++ /dev/null @@ -1,7 +0,0 @@ -//@ run-pass -//@ aux-build:issue-9123.rs - - -extern crate issue_9123; - -pub fn main() {} diff --git a/tests/ui/issues/issue-81584.fixed b/tests/ui/iterators/iterator-scope-collect-suggestion-81584.fixed similarity index 84% rename from tests/ui/issues/issue-81584.fixed rename to tests/ui/iterators/iterator-scope-collect-suggestion-81584.fixed index c3d33a1b4f8bc..0e3d48fe27d8a 100644 --- a/tests/ui/issues/issue-81584.fixed +++ b/tests/ui/iterators/iterator-scope-collect-suggestion-81584.fixed @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/81584 //@ run-rustfix fn main() { let _ = vec![vec![0, 1], vec![2]] diff --git a/tests/ui/issues/issue-81584.rs b/tests/ui/iterators/iterator-scope-collect-suggestion-81584.rs similarity index 83% rename from tests/ui/issues/issue-81584.rs rename to tests/ui/iterators/iterator-scope-collect-suggestion-81584.rs index 27db73aaa2c86..3fba39517fcc5 100644 --- a/tests/ui/issues/issue-81584.rs +++ b/tests/ui/iterators/iterator-scope-collect-suggestion-81584.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/81584 //@ run-rustfix fn main() { let _ = vec![vec![0, 1], vec![2]] diff --git a/tests/ui/issues/issue-81584.stderr b/tests/ui/iterators/iterator-scope-collect-suggestion-81584.stderr similarity index 89% rename from tests/ui/issues/issue-81584.stderr rename to tests/ui/iterators/iterator-scope-collect-suggestion-81584.stderr index eb97916ad75ef..e180183e7e387 100644 --- a/tests/ui/issues/issue-81584.stderr +++ b/tests/ui/iterators/iterator-scope-collect-suggestion-81584.stderr @@ -1,5 +1,5 @@ error[E0515]: cannot return value referencing function parameter `y` - --> $DIR/issue-81584.rs:5:22 + --> $DIR/iterator-scope-collect-suggestion-81584.rs:6:22 | LL | .map(|y| y.iter().map(|x| x + 1)) | -^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/lifetimes/issue-105507.fixed b/tests/ui/lifetimes/issue-105507.fixed index 177da01b154b3..46d4f14a2457e 100644 --- a/tests/ui/lifetimes/issue-105507.fixed +++ b/tests/ui/lifetimes/issue-105507.fixed @@ -25,8 +25,8 @@ impl ProjectedMyTrait for T where T: Project, for<'a> T::Projected<'a>: MyTrait, - //~^ NOTE due to current limitations in the borrow checker, this implies a `'static` lifetime - //~| NOTE due to current limitations in the borrow checker, this implies a `'static` lifetime + //~^ NOTE due to a current limitation of the type system, this implies a `'static` lifetime + //~| NOTE due to a current limitation of the type system, this implies a `'static` lifetime {} fn require_trait(_: T) {} diff --git a/tests/ui/lifetimes/issue-105507.rs b/tests/ui/lifetimes/issue-105507.rs index 858fa19a0295b..f1721fee5b4ad 100644 --- a/tests/ui/lifetimes/issue-105507.rs +++ b/tests/ui/lifetimes/issue-105507.rs @@ -25,8 +25,8 @@ impl ProjectedMyTrait for T where T: Project, for<'a> T::Projected<'a>: MyTrait, - //~^ NOTE due to current limitations in the borrow checker, this implies a `'static` lifetime - //~| NOTE due to current limitations in the borrow checker, this implies a `'static` lifetime + //~^ NOTE due to a current limitation of the type system, this implies a `'static` lifetime + //~| NOTE due to a current limitation of the type system, this implies a `'static` lifetime {} fn require_trait(_: T) {} diff --git a/tests/ui/lifetimes/issue-105507.stderr b/tests/ui/lifetimes/issue-105507.stderr index 44d3a7eb9a420..7fccba7cc4468 100644 --- a/tests/ui/lifetimes/issue-105507.stderr +++ b/tests/ui/lifetimes/issue-105507.stderr @@ -4,7 +4,7 @@ error: `T` does not live long enough LL | require_trait(wrap); | ^^^^^^^^^^^^^^^^^^^ | -note: due to current limitations in the borrow checker, this implies a `'static` lifetime +note: due to a current limitation of the type system, this implies a `'static` lifetime --> $DIR/issue-105507.rs:27:35 | LL | for<'a> T::Projected<'a>: MyTrait, @@ -20,7 +20,7 @@ error: `U` does not live long enough LL | require_trait(wrap1); | ^^^^^^^^^^^^^^^^^^^^ | -note: due to current limitations in the borrow checker, this implies a `'static` lifetime +note: due to a current limitation of the type system, this implies a `'static` lifetime --> $DIR/issue-105507.rs:27:35 | LL | for<'a> T::Projected<'a>: MyTrait, diff --git a/tests/ui/lint/unused/unused_attributes-must_use.fixed b/tests/ui/lint/unused/unused_attributes-must_use.fixed index 80d488296eaa2..2e800cbff3f31 100644 --- a/tests/ui/lint/unused/unused_attributes-must_use.fixed +++ b/tests/ui/lint/unused/unused_attributes-must_use.fixed @@ -4,18 +4,23 @@ #![deny(unused_attributes, unused_must_use)] #![feature(asm_experimental_arch, stmt_expr_attributes, trait_alias)] - //~ ERROR `#[must_use]` has no effect + //~ ERROR attribute cannot be used on +//~| WARN previously accepted extern crate std as std2; - //~ ERROR `#[must_use]` has no effect + //~ ERROR attribute cannot be used on +//~| WARN previously accepted mod test_mod {} - //~ ERROR `#[must_use]` has no effect + //~ ERROR attribute cannot be used on +//~| WARN previously accepted use std::arch::global_asm; - //~ ERROR `#[must_use]` has no effect + //~ ERROR attribute cannot be used on +//~| WARN previously accepted const CONST: usize = 4; - //~ ERROR `#[must_use]` has no effect + //~ ERROR attribute cannot be used on +//~| WARN previously accepted #[no_mangle] static STATIC: usize = 4; @@ -32,7 +37,8 @@ union U { unit: (), } - //~ ERROR `#[must_use]` has no effect + //~ ERROR attribute cannot be used on +//~| WARN previously accepted impl U { #[must_use] fn method() -> i32 { @@ -46,10 +52,12 @@ fn foo() -> i64 { 4 } - //~ ERROR `#[must_use]` has no effect + //~ ERROR attribute cannot be used on +//~| WARN previously accepted extern "Rust" { #[link_name = "STATIC"] - //~ ERROR `#[must_use]` has no effect + //~ ERROR attribute cannot be used on + //~| WARN previously accepted static FOREIGN_STATIC: usize; #[link_name = "foo"] @@ -60,16 +68,20 @@ extern "Rust" { //~ ERROR unused attribute global_asm!(""); - //~ ERROR `#[must_use]` has no effect + //~ ERROR attribute cannot be used on +//~| WARN previously accepted type UseMe = (); -fn qux< T>(_: T) {} //~ ERROR `#[must_use]` has no effect +fn qux< T>(_: T) {} //~ ERROR attribute cannot be used on +//~| WARN previously accepted #[must_use] trait Use { - //~ ERROR `#[must_use]` has no effect + //~ ERROR attribute cannot be used on + //~| WARN previously accepted const ASSOC_CONST: usize = 4; - //~ ERROR `#[must_use]` has no effect + //~ ERROR attribute cannot be used on + //~| WARN previously accepted type AssocTy; #[must_use] @@ -78,20 +90,24 @@ trait Use { } } - //~ ERROR `#[must_use]` has no effect + //~ ERROR attribute cannot be used on +//~| WARN previously accepted impl Use for () { type AssocTy = (); - //~ ERROR `#[must_use]` has no effect + //~ ERROR attribute cannot be used on + //~| WARN previously accepted fn get_four(&self) -> usize { 4 } } - //~ ERROR `#[must_use]` has no effect + //~ ERROR attribute cannot be used on +//~| WARN previously accepted trait Alias = Use; - //~ ERROR `#[must_use]` has no effect + //~ ERROR attribute cannot be used on +//~| WARN previously accepted macro_rules! cool_macro { () => { 4 @@ -99,11 +115,13 @@ macro_rules! cool_macro { } fn main() { - //~ ERROR `#[must_use]` has no effect + //~ ERROR attribute cannot be used on + //~| WARN previously accepted let x = || {}; x(); - let x = //~ ERROR `#[must_use]` has no effect + let x = //~ ERROR attribute cannot be used on + //~| WARN previously accepted || {}; x(); @@ -125,7 +143,8 @@ fn main() { let _ = ().get_four(); //~ ERROR that must be used match Some(4) { - //~ ERROR `#[must_use]` has no effect + //~ ERROR attribute cannot be used on + //~| WARN previously accepted Some(res) => res, None => 0, }; @@ -133,7 +152,9 @@ fn main() { struct PatternField { foo: i32, } - let s = PatternField { foo: 123 }; //~ ERROR `#[must_use]` has no effect - let PatternField { foo } = s; //~ ERROR `#[must_use]` has no effect + let s = PatternField { foo: 123 }; //~ ERROR attribute cannot be used on + //~| WARN previously accepted + let PatternField { foo } = s; //~ ERROR attribute cannot be used on + //~| WARN previously accepted let _ = foo; } diff --git a/tests/ui/lint/unused/unused_attributes-must_use.rs b/tests/ui/lint/unused/unused_attributes-must_use.rs index edefe8ed65ec7..c41c6c1d706b4 100644 --- a/tests/ui/lint/unused/unused_attributes-must_use.rs +++ b/tests/ui/lint/unused/unused_attributes-must_use.rs @@ -4,18 +4,23 @@ #![deny(unused_attributes, unused_must_use)] #![feature(asm_experimental_arch, stmt_expr_attributes, trait_alias)] -#[must_use] //~ ERROR `#[must_use]` has no effect +#[must_use] //~ ERROR attribute cannot be used on +//~| WARN previously accepted extern crate std as std2; -#[must_use] //~ ERROR `#[must_use]` has no effect +#[must_use] //~ ERROR attribute cannot be used on +//~| WARN previously accepted mod test_mod {} -#[must_use] //~ ERROR `#[must_use]` has no effect +#[must_use] //~ ERROR attribute cannot be used on +//~| WARN previously accepted use std::arch::global_asm; -#[must_use] //~ ERROR `#[must_use]` has no effect +#[must_use] //~ ERROR attribute cannot be used on +//~| WARN previously accepted const CONST: usize = 4; -#[must_use] //~ ERROR `#[must_use]` has no effect +#[must_use] //~ ERROR attribute cannot be used on +//~| WARN previously accepted #[no_mangle] static STATIC: usize = 4; @@ -32,7 +37,8 @@ union U { unit: (), } -#[must_use] //~ ERROR `#[must_use]` has no effect +#[must_use] //~ ERROR attribute cannot be used on +//~| WARN previously accepted impl U { #[must_use] fn method() -> i32 { @@ -46,10 +52,12 @@ fn foo() -> i64 { 4 } -#[must_use] //~ ERROR `#[must_use]` has no effect +#[must_use] //~ ERROR attribute cannot be used on +//~| WARN previously accepted extern "Rust" { #[link_name = "STATIC"] - #[must_use] //~ ERROR `#[must_use]` has no effect + #[must_use] //~ ERROR attribute cannot be used on + //~| WARN previously accepted static FOREIGN_STATIC: usize; #[link_name = "foo"] @@ -60,16 +68,20 @@ extern "Rust" { #[must_use] //~ ERROR unused attribute global_asm!(""); -#[must_use] //~ ERROR `#[must_use]` has no effect +#[must_use] //~ ERROR attribute cannot be used on +//~| WARN previously accepted type UseMe = (); -fn qux<#[must_use] T>(_: T) {} //~ ERROR `#[must_use]` has no effect +fn qux<#[must_use] T>(_: T) {} //~ ERROR attribute cannot be used on +//~| WARN previously accepted #[must_use] trait Use { - #[must_use] //~ ERROR `#[must_use]` has no effect + #[must_use] //~ ERROR attribute cannot be used on + //~| WARN previously accepted const ASSOC_CONST: usize = 4; - #[must_use] //~ ERROR `#[must_use]` has no effect + #[must_use] //~ ERROR attribute cannot be used on + //~| WARN previously accepted type AssocTy; #[must_use] @@ -78,20 +90,24 @@ trait Use { } } -#[must_use] //~ ERROR `#[must_use]` has no effect +#[must_use] //~ ERROR attribute cannot be used on +//~| WARN previously accepted impl Use for () { type AssocTy = (); - #[must_use] //~ ERROR `#[must_use]` has no effect + #[must_use] //~ ERROR attribute cannot be used on + //~| WARN previously accepted fn get_four(&self) -> usize { 4 } } -#[must_use] //~ ERROR `#[must_use]` has no effect +#[must_use] //~ ERROR attribute cannot be used on +//~| WARN previously accepted trait Alias = Use; -#[must_use] //~ ERROR `#[must_use]` has no effect +#[must_use] //~ ERROR attribute cannot be used on +//~| WARN previously accepted macro_rules! cool_macro { () => { 4 @@ -99,11 +115,13 @@ macro_rules! cool_macro { } fn main() { - #[must_use] //~ ERROR `#[must_use]` has no effect + #[must_use] //~ ERROR attribute cannot be used on + //~| WARN previously accepted let x = || {}; x(); - let x = #[must_use] //~ ERROR `#[must_use]` has no effect + let x = #[must_use] //~ ERROR attribute cannot be used on + //~| WARN previously accepted || {}; x(); @@ -125,7 +143,8 @@ fn main() { ().get_four(); //~ ERROR that must be used match Some(4) { - #[must_use] //~ ERROR `#[must_use]` has no effect + #[must_use] //~ ERROR attribute cannot be used on + //~| WARN previously accepted Some(res) => res, None => 0, }; @@ -133,7 +152,9 @@ fn main() { struct PatternField { foo: i32, } - let s = PatternField { #[must_use] foo: 123 }; //~ ERROR `#[must_use]` has no effect - let PatternField { #[must_use] foo } = s; //~ ERROR `#[must_use]` has no effect + let s = PatternField { #[must_use] foo: 123 }; //~ ERROR attribute cannot be used on + //~| WARN previously accepted + let PatternField { #[must_use] foo } = s; //~ ERROR attribute cannot be used on + //~| WARN previously accepted let _ = foo; } diff --git a/tests/ui/lint/unused/unused_attributes-must_use.stderr b/tests/ui/lint/unused/unused_attributes-must_use.stderr index 9e37f6504cc25..12cc2ea56beeb 100644 --- a/tests/ui/lint/unused/unused_attributes-must_use.stderr +++ b/tests/ui/lint/unused/unused_attributes-must_use.stderr @@ -1,11 +1,11 @@ error: unused attribute `must_use` - --> $DIR/unused_attributes-must_use.rs:60:1 + --> $DIR/unused_attributes-must_use.rs:68:1 | LL | #[must_use] | ^^^^^^^^^^^ | note: the built-in attribute `must_use` will be ignored, since it's applied to the macro invocation `global_asm` - --> $DIR/unused_attributes-must_use.rs:61:1 + --> $DIR/unused_attributes-must_use.rs:69:1 | LL | global_asm!(""); | ^^^^^^^^^^ @@ -15,134 +15,197 @@ note: the lint level is defined here LL | #![deny(unused_attributes, unused_must_use)] | ^^^^^^^^^^^^^^^^^ -error: `#[must_use]` has no effect when applied to extern crates +error: `#[must_use]` attribute cannot be used on extern crates --> $DIR/unused_attributes-must_use.rs:7:1 | LL | #[must_use] | ^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[must_use]` can be applied to functions, data types, unions, traits -error: `#[must_use]` has no effect when applied to modules - --> $DIR/unused_attributes-must_use.rs:10:1 +error: `#[must_use]` attribute cannot be used on modules + --> $DIR/unused_attributes-must_use.rs:11:1 | LL | #[must_use] | ^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[must_use]` can be applied to functions, data types, unions, traits -error: `#[must_use]` has no effect when applied to use statements - --> $DIR/unused_attributes-must_use.rs:13:1 +error: `#[must_use]` attribute cannot be used on use statements + --> $DIR/unused_attributes-must_use.rs:15:1 | LL | #[must_use] | ^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[must_use]` can be applied to functions, data types, unions, traits -error: `#[must_use]` has no effect when applied to constants - --> $DIR/unused_attributes-must_use.rs:16:1 +error: `#[must_use]` attribute cannot be used on constants + --> $DIR/unused_attributes-must_use.rs:19:1 | LL | #[must_use] | ^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[must_use]` can be applied to functions, data types, unions, traits -error: `#[must_use]` has no effect when applied to statics - --> $DIR/unused_attributes-must_use.rs:18:1 +error: `#[must_use]` attribute cannot be used on statics + --> $DIR/unused_attributes-must_use.rs:22:1 | LL | #[must_use] | ^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[must_use]` can be applied to functions, data types, unions, traits -error: `#[must_use]` has no effect when applied to inherent impl blocks - --> $DIR/unused_attributes-must_use.rs:35:1 +error: `#[must_use]` attribute cannot be used on inherent impl blocks + --> $DIR/unused_attributes-must_use.rs:40:1 | LL | #[must_use] | ^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[must_use]` can be applied to functions, data types, unions, traits -error: `#[must_use]` has no effect when applied to foreign modules - --> $DIR/unused_attributes-must_use.rs:49:1 +error: `#[must_use]` attribute cannot be used on foreign modules + --> $DIR/unused_attributes-must_use.rs:55:1 | LL | #[must_use] | ^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[must_use]` can be applied to functions, data types, unions, traits -error: `#[must_use]` has no effect when applied to type aliases - --> $DIR/unused_attributes-must_use.rs:63:1 +error: `#[must_use]` attribute cannot be used on foreign statics + --> $DIR/unused_attributes-must_use.rs:59:5 + | +LL | #[must_use] + | ^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[must_use]` can be applied to functions, data types, unions, traits + +error: `#[must_use]` attribute cannot be used on type aliases + --> $DIR/unused_attributes-must_use.rs:71:1 | LL | #[must_use] | ^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[must_use]` can be applied to functions, data types, unions, traits -error: `#[must_use]` has no effect when applied to type parameters - --> $DIR/unused_attributes-must_use.rs:66:8 +error: `#[must_use]` attribute cannot be used on function params + --> $DIR/unused_attributes-must_use.rs:75:8 | LL | fn qux<#[must_use] T>(_: T) {} | ^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[must_use]` can be applied to functions, data types, unions, traits -error: `#[must_use]` has no effect when applied to trait impl blocks - --> $DIR/unused_attributes-must_use.rs:81:1 +error: `#[must_use]` attribute cannot be used on associated consts + --> $DIR/unused_attributes-must_use.rs:80:5 + | +LL | #[must_use] + | ^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[must_use]` can be applied to functions, data types, unions, traits + +error: `#[must_use]` attribute cannot be used on associated types + --> $DIR/unused_attributes-must_use.rs:83:5 + | +LL | #[must_use] + | ^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[must_use]` can be applied to functions, data types, unions, traits + +error: `#[must_use]` attribute cannot be used on trait impl blocks + --> $DIR/unused_attributes-must_use.rs:93:1 | LL | #[must_use] | ^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[must_use]` can be applied to functions, data types, unions, traits -error: `#[must_use]` has no effect when applied to trait aliases - --> $DIR/unused_attributes-must_use.rs:91:1 +error: `#[must_use]` attribute cannot be used on trait methods in impl blocks + --> $DIR/unused_attributes-must_use.rs:98:5 + | +LL | #[must_use] + | ^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[must_use]` can be applied to data types, functions, unions, required trait methods, provided trait methods, inherent methods, foreign functions, traits + +error: `#[must_use]` attribute cannot be used on trait aliases + --> $DIR/unused_attributes-must_use.rs:105:1 | LL | #[must_use] | ^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[must_use]` can be applied to functions, data types, unions, traits -error: `#[must_use]` has no effect when applied to macro defs - --> $DIR/unused_attributes-must_use.rs:94:1 +error: `#[must_use]` attribute cannot be used on macro defs + --> $DIR/unused_attributes-must_use.rs:109:1 | LL | #[must_use] | ^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[must_use]` can be applied to functions, data types, unions, traits -error: `#[must_use]` has no effect when applied to statements - --> $DIR/unused_attributes-must_use.rs:102:5 +error: `#[must_use]` attribute cannot be used on statements + --> $DIR/unused_attributes-must_use.rs:118:5 | LL | #[must_use] | ^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[must_use]` can be applied to functions, data types, unions, traits -error: `#[must_use]` has no effect when applied to closures - --> $DIR/unused_attributes-must_use.rs:106:13 +error: `#[must_use]` attribute cannot be used on closures + --> $DIR/unused_attributes-must_use.rs:123:13 | LL | let x = #[must_use] | ^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[must_use]` can be applied to methods, data types, functions, unions, foreign functions, traits -error: `#[must_use]` has no effect when applied to match arms - --> $DIR/unused_attributes-must_use.rs:128:9 +error: `#[must_use]` attribute cannot be used on match arms + --> $DIR/unused_attributes-must_use.rs:146:9 | LL | #[must_use] | ^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[must_use]` can be applied to functions, data types, unions, traits -error: `#[must_use]` has no effect when applied to struct fields - --> $DIR/unused_attributes-must_use.rs:136:28 +error: `#[must_use]` attribute cannot be used on struct fields + --> $DIR/unused_attributes-must_use.rs:155:28 | LL | let s = PatternField { #[must_use] foo: 123 }; | ^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[must_use]` can be applied to functions, data types, unions, traits -error: `#[must_use]` has no effect when applied to pattern fields - --> $DIR/unused_attributes-must_use.rs:137:24 +error: `#[must_use]` attribute cannot be used on pattern fields + --> $DIR/unused_attributes-must_use.rs:157:24 | LL | let PatternField { #[must_use] foo } = s; | ^^^^^^^^^^^ - -error: `#[must_use]` has no effect when applied to associated consts - --> $DIR/unused_attributes-must_use.rs:70:5 | -LL | #[must_use] - | ^^^^^^^^^^^ - -error: `#[must_use]` has no effect when applied to associated types - --> $DIR/unused_attributes-must_use.rs:72:5 - | -LL | #[must_use] - | ^^^^^^^^^^^ - -error: `#[must_use]` has no effect when applied to provided trait methods - --> $DIR/unused_attributes-must_use.rs:85:5 - | -LL | #[must_use] - | ^^^^^^^^^^^ - -error: `#[must_use]` has no effect when applied to foreign statics - --> $DIR/unused_attributes-must_use.rs:52:5 - | -LL | #[must_use] - | ^^^^^^^^^^^ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[must_use]` can be applied to functions, data types, unions, traits error: unused `X` that must be used - --> $DIR/unused_attributes-must_use.rs:110:5 + --> $DIR/unused_attributes-must_use.rs:128:5 | LL | X; | ^ @@ -158,7 +221,7 @@ LL | let _ = X; | +++++++ error: unused `Y` that must be used - --> $DIR/unused_attributes-must_use.rs:111:5 + --> $DIR/unused_attributes-must_use.rs:129:5 | LL | Y::Z; | ^^^^ @@ -169,7 +232,7 @@ LL | let _ = Y::Z; | +++++++ error: unused `U` that must be used - --> $DIR/unused_attributes-must_use.rs:112:5 + --> $DIR/unused_attributes-must_use.rs:130:5 | LL | U { unit: () }; | ^^^^^^^^^^^^^^ @@ -180,7 +243,7 @@ LL | let _ = U { unit: () }; | +++++++ error: unused return value of `U::method` that must be used - --> $DIR/unused_attributes-must_use.rs:113:5 + --> $DIR/unused_attributes-must_use.rs:131:5 | LL | U::method(); | ^^^^^^^^^^^ @@ -191,7 +254,7 @@ LL | let _ = U::method(); | +++++++ error: unused return value of `foo` that must be used - --> $DIR/unused_attributes-must_use.rs:114:5 + --> $DIR/unused_attributes-must_use.rs:132:5 | LL | foo(); | ^^^^^ @@ -202,7 +265,7 @@ LL | let _ = foo(); | +++++++ error: unused return value of `foreign_foo` that must be used - --> $DIR/unused_attributes-must_use.rs:117:9 + --> $DIR/unused_attributes-must_use.rs:135:9 | LL | foreign_foo(); | ^^^^^^^^^^^^^ @@ -213,7 +276,7 @@ LL | let _ = foreign_foo(); | +++++++ error: unused return value of `Use::get_four` that must be used - --> $DIR/unused_attributes-must_use.rs:125:5 + --> $DIR/unused_attributes-must_use.rs:143:5 | LL | ().get_four(); | ^^^^^^^^^^^^^ diff --git a/tests/ui/issues/issue-7970a.rs b/tests/ui/macros/macro-invocation-span-error-7970.rs similarity index 51% rename from tests/ui/issues/issue-7970a.rs rename to tests/ui/macros/macro-invocation-span-error-7970.rs index dae906410ed61..df7e1cfea88bc 100644 --- a/tests/ui/issues/issue-7970a.rs +++ b/tests/ui/macros/macro-invocation-span-error-7970.rs @@ -1,5 +1,8 @@ +// https://github.com/rust-lang/rust/issues/7970 macro_rules! one_arg_macro { - ($fmt:expr) => (print!(concat!($fmt, "\n"))); + ($fmt:expr) => { + print!(concat!($fmt, "\n")) + }; } fn main() { diff --git a/tests/ui/issues/issue-7970a.stderr b/tests/ui/macros/macro-invocation-span-error-7970.stderr similarity index 73% rename from tests/ui/issues/issue-7970a.stderr rename to tests/ui/macros/macro-invocation-span-error-7970.stderr index 1e6bb92ea579e..beb54e0599248 100644 --- a/tests/ui/issues/issue-7970a.stderr +++ b/tests/ui/macros/macro-invocation-span-error-7970.stderr @@ -1,5 +1,5 @@ error: unexpected end of macro invocation - --> $DIR/issue-7970a.rs:6:5 + --> $DIR/macro-invocation-span-error-7970.rs:9:5 | LL | macro_rules! one_arg_macro { | -------------------------- when calling this macro @@ -8,9 +8,9 @@ LL | one_arg_macro!(); | ^^^^^^^^^^^^^^^^ missing tokens in macro arguments | note: while trying to match meta-variable `$fmt:expr` - --> $DIR/issue-7970a.rs:2:6 + --> $DIR/macro-invocation-span-error-7970.rs:3:6 | -LL | ($fmt:expr) => (print!(concat!($fmt, "\n"))); +LL | ($fmt:expr) => { | ^^^^^^^^^ error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-8521.rs b/tests/ui/macros/macro-path-type-bounds-8521.rs similarity index 84% rename from tests/ui/issues/issue-8521.rs rename to tests/ui/macros/macro-path-type-bounds-8521.rs index 78ce85787d5cf..975d3dc402e1f 100644 --- a/tests/ui/issues/issue-8521.rs +++ b/tests/ui/macros/macro-path-type-bounds-8521.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/8521 //@ check-pass trait Foo1 {} diff --git a/tests/ui/issues/issue-7911.rs b/tests/ui/macros/macro-self-mutability-7911.rs similarity index 95% rename from tests/ui/issues/issue-7911.rs rename to tests/ui/macros/macro-self-mutability-7911.rs index 11da4df5285f1..5313f86d97f5f 100644 --- a/tests/ui/issues/issue-7911.rs +++ b/tests/ui/macros/macro-self-mutability-7911.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/7911 //@ run-pass // (Closes #7911) Test that we can use the same self expression // with different mutability in macro in two methods diff --git a/tests/ui/issues/issue-7911.stderr b/tests/ui/macros/macro-self-mutability-7911.stderr similarity index 83% rename from tests/ui/issues/issue-7911.stderr rename to tests/ui/macros/macro-self-mutability-7911.stderr index ead7ee191ac9b..7fc2abe06eb39 100644 --- a/tests/ui/issues/issue-7911.stderr +++ b/tests/ui/macros/macro-self-mutability-7911.stderr @@ -1,5 +1,5 @@ warning: method `dummy` is never used - --> $DIR/issue-7911.rs:7:8 + --> $DIR/macro-self-mutability-7911.rs:8:8 | LL | trait FooBar { | ------ method in this trait diff --git a/tests/ui/issues/issue-7867.rs b/tests/ui/match/mismatched-types-in-match-pattern-7867.rs similarity index 87% rename from tests/ui/issues/issue-7867.rs rename to tests/ui/match/mismatched-types-in-match-pattern-7867.rs index 87e7c831e6855..9ff8755c81956 100644 --- a/tests/ui/issues/issue-7867.rs +++ b/tests/ui/match/mismatched-types-in-match-pattern-7867.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/7867 //@ dont-require-annotations: NOTE enum A { B, C } diff --git a/tests/ui/issues/issue-7867.stderr b/tests/ui/match/mismatched-types-in-match-pattern-7867.stderr similarity index 88% rename from tests/ui/issues/issue-7867.stderr rename to tests/ui/match/mismatched-types-in-match-pattern-7867.stderr index fcb69d775face..8997f36114a89 100644 --- a/tests/ui/issues/issue-7867.stderr +++ b/tests/ui/match/mismatched-types-in-match-pattern-7867.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-7867.rs:9:9 + --> $DIR/mismatched-types-in-match-pattern-7867.rs:10:9 | LL | enum A { B, C } | - unit variant defined here diff --git a/tests/ui/issues/issue-7575.rs b/tests/ui/methods/trait-method-self-param-error-7575.rs similarity index 83% rename from tests/ui/issues/issue-7575.rs rename to tests/ui/methods/trait-method-self-param-error-7575.rs index 8b1fdf6c851e2..9793d43cc24fc 100644 --- a/tests/ui/issues/issue-7575.rs +++ b/tests/ui/methods/trait-method-self-param-error-7575.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/7575 //@ run-pass trait Foo { //~ WARN trait `Foo` is never used diff --git a/tests/ui/issues/issue-7575.stderr b/tests/ui/methods/trait-method-self-param-error-7575.stderr similarity index 74% rename from tests/ui/issues/issue-7575.stderr rename to tests/ui/methods/trait-method-self-param-error-7575.stderr index 2f987d19c80ce..5c10a7e1da9d0 100644 --- a/tests/ui/issues/issue-7575.stderr +++ b/tests/ui/methods/trait-method-self-param-error-7575.stderr @@ -1,5 +1,5 @@ warning: trait `Foo` is never used - --> $DIR/issue-7575.rs:3:7 + --> $DIR/trait-method-self-param-error-7575.rs:4:7 | LL | trait Foo { | ^^^ diff --git a/tests/ui/issues/issue-81918.rs b/tests/ui/mir/mir-cfg-unpretty-check-81918.rs similarity index 81% rename from tests/ui/issues/issue-81918.rs rename to tests/ui/mir/mir-cfg-unpretty-check-81918.rs index ee9721c2493de..4798a6543755d 100644 --- a/tests/ui/issues/issue-81918.rs +++ b/tests/ui/mir/mir-cfg-unpretty-check-81918.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/81918 //@ check-pass //@ dont-check-compiler-stdout //@ compile-flags: -Z unpretty=mir-cfg diff --git a/tests/ui/mismatched_types/closure-arg-type-mismatch.stderr b/tests/ui/mismatched_types/closure-arg-type-mismatch.stderr index abc5d150a3f9c..62e872639671b 100644 --- a/tests/ui/mismatched_types/closure-arg-type-mismatch.stderr +++ b/tests/ui/mismatched_types/closure-arg-type-mismatch.stderr @@ -57,7 +57,7 @@ LL | baz(f); = note: requirement occurs because of a mutable pointer to `&u32` = note: mutable pointers are invariant over their type parameter = help: see for more information about variance -note: due to current limitations in the borrow checker, this implies a `'static` lifetime +note: due to a current limitation of the type system, this implies a `'static` lifetime --> $DIR/closure-arg-type-mismatch.rs:8:11 | LL | fn baz(_: F) {} diff --git a/tests/ui/issues/issue-87490.rs b/tests/ui/mismatched_types/mismatched-types-in-trait-implementation-87490.rs similarity index 80% rename from tests/ui/issues/issue-87490.rs rename to tests/ui/mismatched_types/mismatched-types-in-trait-implementation-87490.rs index 998f61a6bd32d..67e16ec6ce3ab 100644 --- a/tests/ui/issues/issue-87490.rs +++ b/tests/ui/mismatched_types/mismatched-types-in-trait-implementation-87490.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/87490 fn main() {} trait StreamOnce { type Position; diff --git a/tests/ui/issues/issue-87490.stderr b/tests/ui/mismatched_types/mismatched-types-in-trait-implementation-87490.stderr similarity index 87% rename from tests/ui/issues/issue-87490.stderr rename to tests/ui/mismatched_types/mismatched-types-in-trait-implementation-87490.stderr index 5a4ec55833bea..bbd73347d0272 100644 --- a/tests/ui/issues/issue-87490.stderr +++ b/tests/ui/mismatched_types/mismatched-types-in-trait-implementation-87490.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-87490.rs:9:5 + --> $DIR/mismatched-types-in-trait-implementation-87490.rs:10:5 | LL | fn follow(_: &str) -> <&str as StreamOnce>::Position { | ------------------------------ expected `usize` because of return type diff --git a/tests/ui/nll/local-outlives-static-via-hrtb.stderr b/tests/ui/nll/local-outlives-static-via-hrtb.stderr index a6b3328b5a294..a98f11ce51363 100644 --- a/tests/ui/nll/local-outlives-static-via-hrtb.stderr +++ b/tests/ui/nll/local-outlives-static-via-hrtb.stderr @@ -12,11 +12,11 @@ LL | assert_static_via_hrtb_with_assoc_type(&&local); LL | } | - `local` dropped here while still borrowed | -note: due to current limitations in the borrow checker, this implies a `'static` lifetime - --> $DIR/local-outlives-static-via-hrtb.rs:15:53 +note: due to a current limitation of the type system, this implies a `'static` lifetime + --> $DIR/local-outlives-static-via-hrtb.rs:15:42 | LL | fn assert_static_via_hrtb(_: G) where for<'a> G: Outlives<'a> {} - | ^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^ error[E0597]: `local` does not live long enough --> $DIR/local-outlives-static-via-hrtb.rs:25:45 @@ -32,11 +32,11 @@ LL | assert_static_via_hrtb_with_assoc_type(&&local); LL | } | - `local` dropped here while still borrowed | -note: due to current limitations in the borrow checker, this implies a `'static` lifetime - --> $DIR/local-outlives-static-via-hrtb.rs:19:20 +note: due to a current limitation of the type system, this implies a `'static` lifetime + --> $DIR/local-outlives-static-via-hrtb.rs:19:5 | LL | for<'a> &'a T: Reference, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.nll.stderr b/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.nll.stderr index 1d086c658dfcd..6e47b8e59f5c6 100644 --- a/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.nll.stderr +++ b/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.nll.stderr @@ -13,11 +13,11 @@ LL | let b = |_| &a; LL | } | - `a` dropped here while still borrowed | -note: due to current limitations in the borrow checker, this implies a `'static` lifetime - --> $DIR/location-insensitive-scopes-issue-117146.rs:20:22 +note: due to a current limitation of the type system, this implies a `'static` lifetime + --> $DIR/location-insensitive-scopes-issue-117146.rs:20:11 | LL | fn bad &()>(_: F) {} - | ^^^ + | ^^^^^^^^^^^^^^ error: implementation of `Fn` is not general enough --> $DIR/location-insensitive-scopes-issue-117146.rs:13:5 diff --git a/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.polonius.stderr b/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.polonius.stderr index 1d086c658dfcd..6e47b8e59f5c6 100644 --- a/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.polonius.stderr +++ b/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.polonius.stderr @@ -13,11 +13,11 @@ LL | let b = |_| &a; LL | } | - `a` dropped here while still borrowed | -note: due to current limitations in the borrow checker, this implies a `'static` lifetime - --> $DIR/location-insensitive-scopes-issue-117146.rs:20:22 +note: due to a current limitation of the type system, this implies a `'static` lifetime + --> $DIR/location-insensitive-scopes-issue-117146.rs:20:11 | LL | fn bad &()>(_: F) {} - | ^^^ + | ^^^^^^^^^^^^^^ error: implementation of `Fn` is not general enough --> $DIR/location-insensitive-scopes-issue-117146.rs:13:5 diff --git a/tests/ui/nll/type-test-universe.stderr b/tests/ui/nll/type-test-universe.stderr index 31e17d64b8caf..54b48c1597bdf 100644 --- a/tests/ui/nll/type-test-universe.stderr +++ b/tests/ui/nll/type-test-universe.stderr @@ -12,11 +12,11 @@ LL | fn test2<'a>() { LL | outlives_forall::>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` | -note: due to current limitations in the borrow checker, this implies a `'static` lifetime - --> $DIR/type-test-universe.rs:6:16 +note: due to a current limitation of the type system, this implies a `'static` lifetime + --> $DIR/type-test-universe.rs:6:5 | LL | for<'u> T: 'u, - | ^^ + | ^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/tests/ui/issues/issue-8391.rs b/tests/ui/pattern/match-with-at-binding-8391.rs similarity index 73% rename from tests/ui/issues/issue-8391.rs rename to tests/ui/pattern/match-with-at-binding-8391.rs index 20698eed18b7b..bc4e7be798929 100644 --- a/tests/ui/issues/issue-8391.rs +++ b/tests/ui/pattern/match-with-at-binding-8391.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/8391 //@ run-pass fn main() { diff --git a/tests/ui/issues/issue-8860.rs b/tests/ui/pattern/ref-in-function-parameter-patterns-8860.rs similarity index 94% rename from tests/ui/issues/issue-8860.rs rename to tests/ui/pattern/ref-in-function-parameter-patterns-8860.rs index 3af61576fe1a2..1a67caf021cf7 100644 --- a/tests/ui/issues/issue-8860.rs +++ b/tests/ui/pattern/ref-in-function-parameter-patterns-8860.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/8860 //@ run-pass // FIXME(static_mut_refs): this could use an atomic #![allow(static_mut_refs)] diff --git a/tests/ui/issues/issue-76077-inaccesible-private-fields/issue-76077-1.fixed b/tests/ui/privacy/inaccessible-fields-pattern-matching-76077.fixed similarity index 90% rename from tests/ui/issues/issue-76077-inaccesible-private-fields/issue-76077-1.fixed rename to tests/ui/privacy/inaccessible-fields-pattern-matching-76077.fixed index 6fde4e390fa1a..7d648543a2071 100644 --- a/tests/ui/issues/issue-76077-inaccesible-private-fields/issue-76077-1.fixed +++ b/tests/ui/privacy/inaccessible-fields-pattern-matching-76077.fixed @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/76077 //@ run-rustfix #![allow(dead_code, unused_variables)] diff --git a/tests/ui/issues/issue-76077-inaccesible-private-fields/issue-76077-1.rs b/tests/ui/privacy/inaccessible-fields-pattern-matching-76077.rs similarity index 90% rename from tests/ui/issues/issue-76077-inaccesible-private-fields/issue-76077-1.rs rename to tests/ui/privacy/inaccessible-fields-pattern-matching-76077.rs index 30a8535faf5cc..f3b51187ae316 100644 --- a/tests/ui/issues/issue-76077-inaccesible-private-fields/issue-76077-1.rs +++ b/tests/ui/privacy/inaccessible-fields-pattern-matching-76077.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/76077 //@ run-rustfix #![allow(dead_code, unused_variables)] diff --git a/tests/ui/issues/issue-76077-inaccesible-private-fields/issue-76077-1.stderr b/tests/ui/privacy/inaccessible-fields-pattern-matching-76077.stderr similarity index 83% rename from tests/ui/issues/issue-76077-inaccesible-private-fields/issue-76077-1.stderr rename to tests/ui/privacy/inaccessible-fields-pattern-matching-76077.stderr index f54990d5d8618..070fa1a53a547 100644 --- a/tests/ui/issues/issue-76077-inaccesible-private-fields/issue-76077-1.stderr +++ b/tests/ui/privacy/inaccessible-fields-pattern-matching-76077.stderr @@ -1,5 +1,5 @@ error: pattern requires `..` due to inaccessible fields - --> $DIR/issue-76077-1.rs:13:9 + --> $DIR/inaccessible-fields-pattern-matching-76077.rs:14:9 | LL | let foo::Foo {} = foo::Foo::default(); | ^^^^^^^^^^^ @@ -10,7 +10,7 @@ LL | let foo::Foo { .. } = foo::Foo::default(); | ++ error: pattern requires `..` due to inaccessible fields - --> $DIR/issue-76077-1.rs:16:9 + --> $DIR/inaccessible-fields-pattern-matching-76077.rs:17:9 | LL | let foo::Bar { visible } = foo::Bar::default(); | ^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/issues/issue-76077-inaccesible-private-fields/issue-76077.rs b/tests/ui/privacy/private-field-struct-construction-76077.rs similarity index 80% rename from tests/ui/issues/issue-76077-inaccesible-private-fields/issue-76077.rs rename to tests/ui/privacy/private-field-struct-construction-76077.rs index 2d29093b01b02..7fc3473e8decc 100644 --- a/tests/ui/issues/issue-76077-inaccesible-private-fields/issue-76077.rs +++ b/tests/ui/privacy/private-field-struct-construction-76077.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/76077 pub mod foo { pub struct Foo { you_cant_use_this_field: bool, diff --git a/tests/ui/issues/issue-76077-inaccesible-private-fields/issue-76077.stderr b/tests/ui/privacy/private-field-struct-construction-76077.stderr similarity index 80% rename from tests/ui/issues/issue-76077-inaccesible-private-fields/issue-76077.stderr rename to tests/ui/privacy/private-field-struct-construction-76077.stderr index 3fef5ffce30dc..5131db72fe3bf 100644 --- a/tests/ui/issues/issue-76077-inaccesible-private-fields/issue-76077.stderr +++ b/tests/ui/privacy/private-field-struct-construction-76077.stderr @@ -1,5 +1,5 @@ error: cannot construct `Foo` with struct literal syntax due to private fields - --> $DIR/issue-76077.rs:8:5 + --> $DIR/private-field-struct-construction-76077.rs:9:5 | LL | foo::Foo {}; | ^^^^^^^^ diff --git a/tests/ui/reachable/expr_cast.rs b/tests/ui/reachable/expr_cast.rs index e8e477ea4f684..aa412c99b2e9b 100644 --- a/tests/ui/reachable/expr_cast.rs +++ b/tests/ui/reachable/expr_cast.rs @@ -1,13 +1,21 @@ -#![allow(unused_variables)] -#![allow(unused_assignments)] -#![allow(dead_code)] +//@ check-pass +//@ edition: 2024 +// +// Check that we don't warn on `as` casts of never to any as unreachable. +// While they *are* unreachable, sometimes they are required to appeal typeck. #![deny(unreachable_code)] -#![feature(never_type, type_ascription)] fn a() { - // the cast is unreachable: - let x = {return} as !; //~ ERROR unreachable - //~| ERROR non-primitive cast + _ = {return} as u32; } -fn main() { } +fn b() { + (return) as u32; +} + +// example that needs an explicit never-to-any `as` cast +fn example() -> impl Iterator { + todo!() as std::iter::Empty<_> +} + +fn main() {} diff --git a/tests/ui/reachable/expr_cast.stderr b/tests/ui/reachable/expr_cast.stderr deleted file mode 100644 index 6643f1784a174..0000000000000 --- a/tests/ui/reachable/expr_cast.stderr +++ /dev/null @@ -1,24 +0,0 @@ -error: unreachable expression - --> $DIR/expr_cast.rs:9:13 - | -LL | let x = {return} as !; - | ^------^^^^^^ - | || - | |any code following this expression is unreachable - | unreachable expression - | -note: the lint level is defined here - --> $DIR/expr_cast.rs:4:9 - | -LL | #![deny(unreachable_code)] - | ^^^^^^^^^^^^^^^^ - -error[E0605]: non-primitive cast: `()` as `!` - --> $DIR/expr_cast.rs:9:13 - | -LL | let x = {return} as !; - | ^^^^^^^^^^^^^ an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0605`. diff --git a/tests/ui/reachable/unreachable-try-pattern.rs b/tests/ui/reachable/unreachable-try-pattern.rs index 22cbfb95af084..1358722e229ce 100644 --- a/tests/ui/reachable/unreachable-try-pattern.rs +++ b/tests/ui/reachable/unreachable-try-pattern.rs @@ -18,7 +18,7 @@ fn bar(x: Result) -> Result { fn foo(x: Result) -> Result { let y = (match x { Ok(n) => Ok(n as u32), Err(e) => Err(e) })?; //~^ WARN unreachable pattern - //~| WARN unreachable expression + //~| WARN unreachable call Ok(y) } diff --git a/tests/ui/reachable/unreachable-try-pattern.stderr b/tests/ui/reachable/unreachable-try-pattern.stderr index 40b116131057c..468af427249c1 100644 --- a/tests/ui/reachable/unreachable-try-pattern.stderr +++ b/tests/ui/reachable/unreachable-try-pattern.stderr @@ -1,11 +1,10 @@ -warning: unreachable expression - --> $DIR/unreachable-try-pattern.rs:19:36 +warning: unreachable call + --> $DIR/unreachable-try-pattern.rs:19:33 | LL | let y = (match x { Ok(n) => Ok(n as u32), Err(e) => Err(e) })?; - | -^^^^^^^ - | | - | unreachable expression - | any code following this expression is unreachable + | ^^ - any code following this expression is unreachable + | | + | unreachable call | note: the lint level is defined here --> $DIR/unreachable-try-pattern.rs:3:9 diff --git a/tests/ui/issues/issue-8727.rs b/tests/ui/recursion/infinite-function-recursion-error-8727.rs similarity index 90% rename from tests/ui/issues/issue-8727.rs rename to tests/ui/recursion/infinite-function-recursion-error-8727.rs index c1b60e8e08509..a4037f761098e 100644 --- a/tests/ui/issues/issue-8727.rs +++ b/tests/ui/recursion/infinite-function-recursion-error-8727.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/8727 // Verify the compiler fails with an error on infinite function // recursions. @@ -9,7 +10,6 @@ fn generic() { //~ WARN function cannot return without recursing } //~^^ ERROR reached the recursion limit while instantiating `generic:: at least once to trigger instantiation. generic::(); diff --git a/tests/ui/issues/issue-8727.stderr b/tests/ui/recursion/infinite-function-recursion-error-8727.stderr similarity index 76% rename from tests/ui/issues/issue-8727.stderr rename to tests/ui/recursion/infinite-function-recursion-error-8727.stderr index 9fb09a7d4f42d..13d57ecb3b2f0 100644 --- a/tests/ui/issues/issue-8727.stderr +++ b/tests/ui/recursion/infinite-function-recursion-error-8727.stderr @@ -1,5 +1,5 @@ warning: function cannot return without recursing - --> $DIR/issue-8727.rs:7:1 + --> $DIR/infinite-function-recursion-error-8727.rs:8:1 | LL | fn generic() { | ^^^^^^^^^^^^^^^ cannot return without recursing @@ -10,17 +10,17 @@ LL | generic::>(); = note: `#[warn(unconditional_recursion)]` on by default error: reached the recursion limit while instantiating `generic::>>>>` - --> $DIR/issue-8727.rs:8:5 + --> $DIR/infinite-function-recursion-error-8727.rs:9:5 | LL | generic::>(); | ^^^^^^^^^^^^^^^^^^^^^^ | note: `generic` defined here - --> $DIR/issue-8727.rs:7:1 + --> $DIR/infinite-function-recursion-error-8727.rs:8:1 | LL | fn generic() { | ^^^^^^^^^^^^^^^ - = note: the full name for the type has been written to '$TEST_BUILD_DIR/issue-8727.long-type-$LONG_TYPE_HASH.txt' + = note: the full name for the type has been written to '$TEST_BUILD_DIR/infinite-function-recursion-error-8727.long-type-$LONG_TYPE_HASH.txt' = note: consider using `--verbose` to print the full type name to the console error: aborting due to 1 previous error; 1 warning emitted diff --git a/tests/ui/issues/issue-7663.rs b/tests/ui/resolve/module-import-resolution-7663.rs similarity index 91% rename from tests/ui/issues/issue-7663.rs rename to tests/ui/resolve/module-import-resolution-7663.rs index d2b2c727cab25..872806594fc40 100644 --- a/tests/ui/issues/issue-7663.rs +++ b/tests/ui/resolve/module-import-resolution-7663.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/7663 //@ run-pass #![allow(unused_imports, dead_code)] diff --git a/tests/ui/resolve/path-attr-in-const-block.stderr b/tests/ui/resolve/path-attr-in-const-block.stderr index f3ae5b60c4fe8..23f4e319c6d4d 100644 --- a/tests/ui/resolve/path-attr-in-const-block.stderr +++ b/tests/ui/resolve/path-attr-in-const-block.stderr @@ -11,7 +11,7 @@ LL | #![path = foo!()] | ^^^^^^^^^^------^ | | | | | expected a string literal here - | help: must be of the form: `#[path = "file"]` + | help: must be of the form: `#![path = "file"]` | = note: for more information, visit diff --git a/tests/ui/issues/issue-8578.rs b/tests/ui/static/static-struct-with-option-8578.rs similarity index 90% rename from tests/ui/issues/issue-8578.rs rename to tests/ui/static/static-struct-with-option-8578.rs index 9baa2f70a02db..d490a3f50b419 100644 --- a/tests/ui/issues/issue-8578.rs +++ b/tests/ui/static/static-struct-with-option-8578.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/8578 //@ check-pass #![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/tests/ui/issues/auxiliary/issue-8044.rs b/tests/ui/structs-enums/auxiliary/aux-8044.rs similarity index 100% rename from tests/ui/issues/auxiliary/issue-8044.rs rename to tests/ui/structs-enums/auxiliary/aux-8044.rs diff --git a/tests/ui/structs-enums/struct-and-enum-usage-8044.rs b/tests/ui/structs-enums/struct-and-enum-usage-8044.rs new file mode 100644 index 0000000000000..9b544f33f1c2d --- /dev/null +++ b/tests/ui/structs-enums/struct-and-enum-usage-8044.rs @@ -0,0 +1,10 @@ +// https://github.com/rust-lang/rust/issues/8044 +//@ run-pass +//@ aux-build:aux-8044.rs + +extern crate aux_8044 as minimal; +use minimal::{BTree, leaf}; + +pub fn main() { + BTree:: { node: leaf(1) }; +} diff --git a/tests/ui/issues/issue-8783.rs b/tests/ui/structs/destructuring-struct-type-inference-8783.rs similarity index 88% rename from tests/ui/issues/issue-8783.rs rename to tests/ui/structs/destructuring-struct-type-inference-8783.rs index d0ff79f8ac800..60bc4bf3289e5 100644 --- a/tests/ui/issues/issue-8783.rs +++ b/tests/ui/structs/destructuring-struct-type-inference-8783.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/8783 //@ run-pass #![allow(unused_variables)] diff --git a/tests/ui/suggestions/partialeq_suggest_swap_on_e0277.stderr b/tests/ui/suggestions/partialeq_suggest_swap_on_e0277.stderr index ebe103ef19a1c..c5984f53f68b5 100644 --- a/tests/ui/suggestions/partialeq_suggest_swap_on_e0277.stderr +++ b/tests/ui/suggestions/partialeq_suggest_swap_on_e0277.stderr @@ -10,6 +10,8 @@ LL | String::from("Girls Band Cry") == T(String::from("Girls Band Cry")); `String` implements `PartialEq` `String` implements `PartialEq` `String` implements `PartialEq>` + `String` implements `PartialEq` + `String` implements `PartialEq` `String` implements `PartialEq` `String` implements `PartialEq` = note: `T` implements `PartialEq` diff --git a/tests/ui/issues/issue-83048.rs b/tests/ui/thir-print/break-outside-loop-error-83048.rs similarity index 72% rename from tests/ui/issues/issue-83048.rs rename to tests/ui/thir-print/break-outside-loop-error-83048.rs index 6c941133a152c..6dcebd77c27b2 100644 --- a/tests/ui/issues/issue-83048.rs +++ b/tests/ui/thir-print/break-outside-loop-error-83048.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/83048 //@ compile-flags: -Z unpretty=thir-tree pub fn main() { diff --git a/tests/ui/issues/issue-83048.stderr b/tests/ui/thir-print/break-outside-loop-error-83048.stderr similarity index 83% rename from tests/ui/issues/issue-83048.stderr rename to tests/ui/thir-print/break-outside-loop-error-83048.stderr index 672bf69a7325b..65a08e62e3df6 100644 --- a/tests/ui/issues/issue-83048.stderr +++ b/tests/ui/thir-print/break-outside-loop-error-83048.stderr @@ -1,5 +1,5 @@ error[E0268]: `break` outside of a loop or labeled block - --> $DIR/issue-83048.rs:4:5 + --> $DIR/break-outside-loop-error-83048.rs:5:5 | LL | break; | ^^^^^ cannot `break` outside of a loop or labeled block diff --git a/tests/ui/issues/issue-87707.rs b/tests/ui/track-diagnostics/track-caller-for-once-87707.rs similarity index 87% rename from tests/ui/issues/issue-87707.rs rename to tests/ui/track-diagnostics/track-caller-for-once-87707.rs index a0da8a740ac39..9b450943f5d7a 100644 --- a/tests/ui/issues/issue-87707.rs +++ b/tests/ui/track-diagnostics/track-caller-for-once-87707.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/87707 // test for #87707 //@ edition:2018 //@ run-fail diff --git a/tests/ui/issues/issue-87707.run.stderr b/tests/ui/track-diagnostics/track-caller-for-once-87707.run.stderr similarity index 50% rename from tests/ui/issues/issue-87707.run.stderr rename to tests/ui/track-diagnostics/track-caller-for-once-87707.run.stderr index 8485c0578b82c..093df62836bfa 100644 --- a/tests/ui/issues/issue-87707.run.stderr +++ b/tests/ui/track-diagnostics/track-caller-for-once-87707.run.stderr @@ -1,7 +1,7 @@ -thread 'main' ($TID) panicked at $DIR/issue-87707.rs:14:24: +thread 'main' ($TID) panicked at $DIR/track-caller-for-once-87707.rs:15:24: Here Once instance is poisoned. note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace -thread 'main' ($TID) panicked at $DIR/issue-87707.rs:16:7: +thread 'main' ($TID) panicked at $DIR/track-caller-for-once-87707.rs:17:7: Once instance has previously been poisoned diff --git a/tests/ui/issues/issue-87199.rs b/tests/ui/trait-bounds/relaxed-bounds-assumed-unsized-87199.rs similarity index 94% rename from tests/ui/issues/issue-87199.rs rename to tests/ui/trait-bounds/relaxed-bounds-assumed-unsized-87199.rs index dd9dfc74ca352..f3baa4b1feb8d 100644 --- a/tests/ui/issues/issue-87199.rs +++ b/tests/ui/trait-bounds/relaxed-bounds-assumed-unsized-87199.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/87199 // Regression test for issue #87199, where attempting to relax a bound // other than the only supported `?Sized` would still cause the compiler // to assume that the `Sized` bound was relaxed. diff --git a/tests/ui/issues/issue-87199.stderr b/tests/ui/trait-bounds/relaxed-bounds-assumed-unsized-87199.stderr similarity index 80% rename from tests/ui/issues/issue-87199.stderr rename to tests/ui/trait-bounds/relaxed-bounds-assumed-unsized-87199.stderr index 8a930a3d704c1..16223676c067e 100644 --- a/tests/ui/issues/issue-87199.stderr +++ b/tests/ui/trait-bounds/relaxed-bounds-assumed-unsized-87199.stderr @@ -1,23 +1,23 @@ error: bound modifier `?` can only be applied to `Sized` - --> $DIR/issue-87199.rs:8:11 + --> $DIR/relaxed-bounds-assumed-unsized-87199.rs:9:11 | LL | fn arg(_: T) {} | ^^^^^ error: bound modifier `?` can only be applied to `Sized` - --> $DIR/issue-87199.rs:10:15 + --> $DIR/relaxed-bounds-assumed-unsized-87199.rs:11:15 | LL | fn ref_arg(_: &T) {} | ^^^^^ error: bound modifier `?` can only be applied to `Sized` - --> $DIR/issue-87199.rs:12:40 + --> $DIR/relaxed-bounds-assumed-unsized-87199.rs:13:40 | LL | fn ret() -> impl Iterator + ?Send { std::iter::empty() } | ^^^^^ error: bound modifier `?` can only be applied to `Sized` - --> $DIR/issue-87199.rs:12:40 + --> $DIR/relaxed-bounds-assumed-unsized-87199.rs:13:40 | LL | fn ret() -> impl Iterator + ?Send { std::iter::empty() } | ^^^^^ @@ -25,14 +25,14 @@ LL | fn ret() -> impl Iterator + ?Send { std::iter::empty() } = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0277]: the size for values of type `[i32]` cannot be known at compilation time - --> $DIR/issue-87199.rs:19:15 + --> $DIR/relaxed-bounds-assumed-unsized-87199.rs:20:15 | LL | ref_arg::<[i32]>(&[5]); | ^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[i32]` note: required by an implicit `Sized` bound in `ref_arg` - --> $DIR/issue-87199.rs:10:12 + --> $DIR/relaxed-bounds-assumed-unsized-87199.rs:11:12 | LL | fn ref_arg(_: &T) {} | ^ required by the implicit `Sized` requirement on this type parameter in `ref_arg` diff --git a/tests/ui/issues/auxiliary/issue-9123.rs b/tests/ui/traits/auxiliary/aux-9123.rs similarity index 100% rename from tests/ui/issues/auxiliary/issue-9123.rs rename to tests/ui/traits/auxiliary/aux-9123.rs diff --git a/tests/ui/traits/default-method-fn-call-9123.rs b/tests/ui/traits/default-method-fn-call-9123.rs new file mode 100644 index 0000000000000..266b95ca960c5 --- /dev/null +++ b/tests/ui/traits/default-method-fn-call-9123.rs @@ -0,0 +1,7 @@ +// https://github.com/rust-lang/rust/issues/9123 +//@ run-pass +//@ aux-build:aux-9123.rs + +extern crate aux_9123; + +pub fn main() {} diff --git a/tests/ui/issues/issue-8249.rs b/tests/ui/traits/mut-trait-in-struct-8249.rs similarity index 80% rename from tests/ui/issues/issue-8249.rs rename to tests/ui/traits/mut-trait-in-struct-8249.rs index 2364fc14d31ac..b6dcd848b8b34 100644 --- a/tests/ui/issues/issue-8249.rs +++ b/tests/ui/traits/mut-trait-in-struct-8249.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/8249 //@ run-pass #![allow(dead_code)] diff --git a/tests/ui/issues/issue-7673-cast-generically-implemented-trait.rs b/tests/ui/traits/polymorphic-trait-creation-7673.rs similarity index 85% rename from tests/ui/issues/issue-7673-cast-generically-implemented-trait.rs rename to tests/ui/traits/polymorphic-trait-creation-7673.rs index edba3284e3175..643818ffe1e52 100644 --- a/tests/ui/issues/issue-7673-cast-generically-implemented-trait.rs +++ b/tests/ui/traits/polymorphic-trait-creation-7673.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/7673 //@ check-pass #![allow(dead_code)] diff --git a/tests/ui/issues/issue-8171-default-method-self-inherit-builtin-trait.rs b/tests/ui/traits/self-implements-kinds-in-default-methods-8171.rs similarity index 85% rename from tests/ui/issues/issue-8171-default-method-self-inherit-builtin-trait.rs rename to tests/ui/traits/self-implements-kinds-in-default-methods-8171.rs index 6a03404cdca71..59ea62c7690ee 100644 --- a/tests/ui/issues/issue-8171-default-method-self-inherit-builtin-trait.rs +++ b/tests/ui/traits/self-implements-kinds-in-default-methods-8171.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/8171 //@ check-pass #![allow(dead_code)] diff --git a/tests/ui/issues/issue-7563.rs b/tests/ui/traits/trait-implementation-and-usage-7563.rs similarity index 91% rename from tests/ui/issues/issue-7563.rs rename to tests/ui/traits/trait-implementation-and-usage-7563.rs index 9ee8857b99960..8cfc7a14ffe66 100644 --- a/tests/ui/issues/issue-7563.rs +++ b/tests/ui/traits/trait-implementation-and-usage-7563.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/7563 //@ run-pass #![allow(dead_code)] trait IDummy { diff --git a/tests/ui/transmutability/references/reject_lifetime_extension.stderr b/tests/ui/transmutability/references/reject_lifetime_extension.stderr index a597041c6cac2..b97029841453f 100644 --- a/tests/ui/transmutability/references/reject_lifetime_extension.stderr +++ b/tests/ui/transmutability/references/reject_lifetime_extension.stderr @@ -67,11 +67,11 @@ LL | unsafe { extend_hrtb(src) } | `src` escapes the function body here | argument requires that `'a` must outlive `'static` | -note: due to current limitations in the borrow checker, this implies a `'static` lifetime - --> $DIR/reject_lifetime_extension.rs:85:25 +note: due to a current limitation of the type system, this implies a `'static` lifetime + --> $DIR/reject_lifetime_extension.rs:85:9 | LL | for<'b> &'b u8: TransmuteFrom<&'a u8>, - | ^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 8 previous errors diff --git a/tests/ui/issues/issue-8767.rs b/tests/ui/typeck/impl-for-nonexistent-type-error-8767.rs similarity index 59% rename from tests/ui/issues/issue-8767.rs rename to tests/ui/typeck/impl-for-nonexistent-type-error-8767.rs index 972101a0bc3ee..005c676ed39b3 100644 --- a/tests/ui/issues/issue-8767.rs +++ b/tests/ui/typeck/impl-for-nonexistent-type-error-8767.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/8767 impl B { //~ ERROR cannot find type `B` in this scope } diff --git a/tests/ui/issues/issue-8767.stderr b/tests/ui/typeck/impl-for-nonexistent-type-error-8767.stderr similarity index 79% rename from tests/ui/issues/issue-8767.stderr rename to tests/ui/typeck/impl-for-nonexistent-type-error-8767.stderr index 66141628e28d2..0e37391a00f7b 100644 --- a/tests/ui/issues/issue-8767.stderr +++ b/tests/ui/typeck/impl-for-nonexistent-type-error-8767.stderr @@ -1,5 +1,5 @@ error[E0412]: cannot find type `B` in this scope - --> $DIR/issue-8767.rs:1:6 + --> $DIR/impl-for-nonexistent-type-error-8767.rs:2:6 | LL | impl B { | ^ not found in this scope diff --git a/triagebot.toml b/triagebot.toml index 2f31a30019bce..e55f2abce7f10 100644 --- a/triagebot.toml +++ b/triagebot.toml @@ -1003,11 +1003,12 @@ cc = ["@calebzulawski", "@programmerjake"] [mentions."library/core/src/unicode/unicode_data.rs"] message = """ -`library/core/src/unicode/unicode_data.rs` is generated by -`src/tools/unicode-table-generator` via `./x run -src/tools/unicode-table-generator`. If you want to modify `unicode_data.rs`, -please modify the tool then regenerate the library source file with the tool -instead of editing the library source file manually. +`library/core/src/unicode/unicode_data.rs` is generated by the \ +`src/tools/unicode-table-generator` tool. + +If you want to modify `unicode_data.rs`, please modify the tool then regenerate the library \ +source file via `./x run src/tools/unicode-table-generator` instead of editing \ +`unicode_data.rs` manually. """ [mentions."src/librustdoc/html/static"] diff --git a/typos.toml b/typos.toml index 317aafc861565..b0ff48f8fa28b 100644 --- a/typos.toml +++ b/typos.toml @@ -33,6 +33,7 @@ misformed = "misformed" targetting = "targetting" publically = "publically" clonable = "clonable" +moreso = "moreso" # this can be valid word, depends on dictionary edition #matcheable = "matcheable"