diff options
367 files changed, 5859 insertions, 3694 deletions
diff --git a/.github/renovate.json5 b/.github/renovate.json5 new file mode 100644 index 00000000000..87f5f103ddf --- /dev/null +++ b/.github/renovate.json5 @@ -0,0 +1,14 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + // Let Renovatebot keep an opened issue that tracks our dependencies + "dependencyDashboard": true, + // Disable "normal" package updates + "enabledManagers": [], + // Update lockfiles once per week + "lockFileMaintenance": { + "enabled": true, + "schedule": [ + "before 5am on Tuesday" + ] + } +} diff --git a/.gitignore b/.gitignore index ce9db8b861d..f84a3704ca9 100644 --- a/.gitignore +++ b/.gitignore @@ -88,12 +88,12 @@ package.json tests/rustdoc-gui/src/**.lock ## direnv -.envrc -.direnv/ +/.envrc +/.direnv/ ## nix -flake.nix +/flake.nix flake.lock -default.nix +/default.nix # Before adding new lines, see the comment at the top. diff --git a/Cargo.lock b/Cargo.lock index 12970dd1ebf..38b009bfc70 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -57,9 +57,9 @@ dependencies = [ [[package]] name = "allocator-api2" -version = "0.2.18" +version = "0.2.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" +checksum = "45862d1c77f2228b9e10bc609d5bc203d86ebc9b87ad8d5d5167a6c9abf739d9" [[package]] name = "ammonia" @@ -182,9 +182,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.92" +version = "1.0.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74f37166d7d48a0284b99dd824694c26119c700b53bf0d1540cdb147dbdaaf13" +checksum = "4c95c10ba0b00a02636238b814946408b1322d5ac4760326e6fb8ec956d85775" dependencies = [ "backtrace", ] @@ -257,21 +257,15 @@ dependencies = [ [[package]] name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "bitflags" version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "blake3" -version = "1.5.4" +version = "1.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d82033247fd8e890df8f740e407ad4d038debb9eb1f40533fffb32e7d17dc6f7" +checksum = "b8ee0c1824c4dea5b5f81736aff91bae041d2c07ee1192bec91054e10e3e601e" dependencies = [ "arrayref", "arrayvec", @@ -291,12 +285,12 @@ dependencies = [ [[package]] name = "bstr" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40723b8fb387abc38f4f4a37c09073622e41dd12327033091ef8950659e6dc0c" +checksum = "1a68f1f47cdf0ec8ee4b941b2eee2a80cb796db73118c0dd09ac63fbe405be22" dependencies = [ "memchr", - "regex-automata 0.4.8", + "regex-automata 0.4.9", "serde", ] @@ -356,9 +350,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ac0150caa2ae65ca5bd83f25c7de183dea78d4d366469f148435e2acfbad0da" +checksum = "325918d6fe32f23b19878fe4b34794ae41fc19ddbe53b10571a4874d44ffd39b" [[package]] name = "camino" @@ -384,9 +378,9 @@ dependencies = [ [[package]] name = "cargo-platform" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24b1f0365a6c6bb4020cd05806fd0d33c44d38046b8bd7f0e40814b9763cabfc" +checksum = "e35af189006b9c0f00a064685c727031e3ed2d8020f7ba284d78cc2671bd36ea" dependencies = [ "serde", ] @@ -476,9 +470,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.20" +version = "4.5.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b97f376d85a664d5837dbae44bf546e6477a679ff6610010f17276f686d867e8" +checksum = "fb3b4b9e5a7c7514dfa52869339ee98b3156b0bfb4e8a77c4ff4babb64b1604f" dependencies = [ "clap_builder", "clap_derive", @@ -496,9 +490,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.20" +version = "4.5.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19bc80abd44e4bed93ca373a0704ccbd1b710dc5749406201bb018272808dc54" +checksum = "b17a95aa67cc7b5ebd32aa5370189aa0d79069ef1c64ce893bd30fb24bff20ec" dependencies = [ "anstream", "anstyle", @@ -509,9 +503,9 @@ dependencies = [ [[package]] name = "clap_complete" -version = "4.5.36" +version = "4.5.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86bc73de94bc81e52f3bebec71bc4463e9748f7a59166663e32044669577b0e2" +checksum = "d9647a559c112175f17cf724dc72d3645680a883c58481332779192b0d8e7a01" dependencies = [ "clap", ] @@ -525,14 +519,14 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] name = "clap_lex" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97" +checksum = "afb84c814227b90d6895e01398aee0d8033c00e7466aca416fb6a8e0eb19d8a7" [[package]] name = "clippy" @@ -556,7 +550,7 @@ dependencies = [ "rustc_tools_util", "serde", "serde_json", - "syn 2.0.87", + "syn 2.0.90", "tempfile", "termize", "tokio", @@ -650,23 +644,23 @@ dependencies = [ [[package]] name = "color-print" -version = "0.3.6" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ee543c60ff3888934877a5671f45494dd27ed4ba25c6670b9a7576b7ed7a8c0" +checksum = "3aa954171903797d5623e047d9ab69d91b493657917bdfb8c2c80ecaf9cdb6f4" dependencies = [ "color-print-proc-macro", ] [[package]] name = "color-print-proc-macro" -version = "0.3.6" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77ff1a80c5f3cb1ca7c06ffdd71b6a6dd6d8f896c42141fbd43f50ed28dcdb93" +checksum = "692186b5ebe54007e45a59aea47ece9eb4108e141326c304cdc91699a7118a22" dependencies = [ "nom", "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -770,9 +764,9 @@ dependencies = [ [[package]] name = "cpufeatures" -version = "0.2.14" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0" +checksum = "16b80225097f2e5ae4e7179dd2266824648f3e2f49d9134d584b76389d31c4c3" dependencies = [ "libc", ] @@ -857,9 +851,9 @@ dependencies = [ [[package]] name = "curl-sys" -version = "0.4.77+curl-8.10.1" +version = "0.4.78+curl-8.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f469e8a5991f277a208224f6c7ad72ecb5f986e36d09ae1f2c1bb9259478a480" +checksum = "8eec768341c5c7789611ae51cf6c459099f22e64a5d5d0ce4892434e33821eaf" dependencies = [ "cc", "libc", @@ -891,7 +885,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -902,7 +896,7 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -939,7 +933,7 @@ checksum = "62d671cc41a825ebabc75757b62d3d168c577f9149b2d49ece1dad1f72119d25" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -960,7 +954,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -970,7 +964,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab63b0e2bf4d5928aff72e83a7dace85d7bba5fe12dcc3c5a572d78caffd3f3c" dependencies = [ "derive_builder_core", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -982,7 +976,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -1060,7 +1054,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -1142,12 +1136,12 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.9" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" +checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d" dependencies = [ "libc", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -1185,9 +1179,9 @@ checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649" [[package]] name = "fastrand" -version = "2.1.1" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" +checksum = "486f806e73c5707928240ddc295403b1b93c96a02038563881c4a2fd84b81ac4" [[package]] name = "field-offset" @@ -1213,9 +1207,9 @@ dependencies = [ [[package]] name = "flate2" -version = "1.0.34" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1b589b4dc103969ad3cf85c950899926ec64300a1a46d76c03a6072957036f0" +checksum = "c936bfdafb507ebbf50b8074c54fa31c5be9a1e7e5f467dd659697041407d07c" dependencies = [ "crc32fast", "miniz_oxide 0.8.0", @@ -1357,7 +1351,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -1482,7 +1476,7 @@ dependencies = [ "aho-corasick", "bstr", "log", - "regex-automata 0.4.8", + "regex-automata 0.4.9", "regex-syntax 0.8.5", ] @@ -1497,11 +1491,12 @@ dependencies = [ [[package]] name = "handlebars" -version = "5.1.2" +version = "6.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d08485b96a0e6393e9e4d1b8d48cf74ad6c063cd905eb33f42c1ce3f0377539b" +checksum = "fd4ccde012831f9a071a637b0d4e31df31c0f6c525784b35ae76a9ac6bc1e315" dependencies = [ "log", + "num-order", "pest", "pest_derive", "serde", @@ -1522,9 +1517,9 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.15.0" +version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb" +checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" dependencies = [ "foldhash", ] @@ -1590,7 +1585,7 @@ dependencies = [ "markup5ever", "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -1632,6 +1627,18 @@ dependencies = [ ] [[package]] +name = "icu_collections" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] name = "icu_list" version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1685,6 +1692,51 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fdc8ff3388f852bede6b579ad4e978ab004f139284d7b28715f773507b946f6e" [[package]] +name = "icu_normalizer" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "utf16_iter", + "utf8_iter", + "write16", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8cafbf7aa791e9b22bec55a167906f9e1215fd475cd22adfcf660e03e989516" + +[[package]] +name = "icu_properties" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93d6020766cfc6302c15dbbc9c8778c37e62c14427cb7f6e601d849e092aeef5" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locid_transform", + "icu_properties_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67a8effbc3dd3e4ba1afa8ad918d5684b8868b3b26500753effea8d2eed19569" + +[[package]] name = "icu_provider" version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1722,7 +1774,7 @@ checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -1739,12 +1791,23 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" [[package]] name = "idna" -version = "0.5.0" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e" dependencies = [ - "unicode-bidi", - "unicode-normalization", + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daca1df1c957320b2cf139ac61e7bd64fed304c5040df000a745aa1de3b4ef71" +dependencies = [ + "icu_normalizer", + "icu_properties", ] [[package]] @@ -1763,7 +1826,7 @@ dependencies = [ "globset", "log", "memchr", - "regex-automata 0.4.8", + "regex-automata 0.4.9", "same-file", "walkdir", "winapi-util", @@ -1777,27 +1840,27 @@ checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683" [[package]] name = "indexmap" -version = "2.6.0" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" +checksum = "62f822373a4fe84d4bb149bf54e584a7f4abec90e072ed49cda0edea5b95471f" dependencies = [ "equivalent", - "hashbrown 0.15.0", + "hashbrown 0.15.2", "rustc-rayon", "serde", ] [[package]] name = "indicatif" -version = "0.17.8" +version = "0.17.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "763a5a8f45087d6bcea4222e7b72c291a054edf80e4ef6efd2a4979878c7bea3" +checksum = "cbf675b85ed934d3c67b5c5469701eec7db22689d0a2139d856e0925fa28b281" dependencies = [ "console", - "instant", "number_prefix", "portable-atomic", - "unicode-width 0.1.14", + "unicode-width 0.2.0", + "web-time", ] [[package]] @@ -1829,15 +1892,6 @@ dependencies = [ ] [[package]] -name = "instant" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222" -dependencies = [ - "cfg-if", -] - -[[package]] name = "intl-memoizer" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1873,9 +1927,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.11" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" +checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" [[package]] name = "jobserver" @@ -1888,10 +1942,11 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.72" +version = "0.3.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a88f1bda2bd75b0452a14784937d796722fdebfe50df998aeb3f0b7603019a9" +checksum = "a865e038f7f6ed956f788f0d7d60c541fff74c7bd74272c5d4cf15c63743e705" dependencies = [ + "once_cell", "wasm-bindgen", ] @@ -1914,7 +1969,7 @@ dependencies = [ "anyhow", "clap", "fs-err", - "rustc-hash 2.0.0", + "rustc-hash 2.1.0", "rustdoc-json-types", "serde", "serde_json", @@ -1957,9 +2012,9 @@ checksum = "baff4b617f7df3d896f97fe922b64817f6cd9a756bb81d40f8883f2f66dcb401" [[package]] name = "libc" -version = "0.2.164" +version = "0.2.167" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "433bfe06b8c75da9b2e3fbea6e5329ff87748f0b144ef75306e674c3f6f7c13f" +checksum = "09d6582e104315a817dff97f75133544b2e094ee22447d2acf4a74e189ba06fc" [[package]] name = "libdbus-sys" @@ -1992,9 +2047,9 @@ dependencies = [ [[package]] name = "libloading" -version = "0.8.5" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" +checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34" dependencies = [ "cfg-if", "windows-targets 0.52.6", @@ -2012,7 +2067,7 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" dependencies = [ - "bitflags 2.6.0", + "bitflags", "libc", "redox_syscall", ] @@ -2054,9 +2109,9 @@ checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" [[package]] name = "litemap" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "643cb0b8d4fcc284004d5fd0d67ccf61dfffadb7f75e1e71bc420f4688a3a704" +checksum = "4ee93343901ab17bd981295f2cf0026d4ad018c7c31ba84549a4ddbb47a45104" [[package]] name = "lld-wrapper" @@ -2147,9 +2202,9 @@ dependencies = [ [[package]] name = "mdbook" -version = "0.4.40" +version = "0.4.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b45a38e19bd200220ef07c892b0157ad3d2365e5b5a267ca01ad12182491eea5" +checksum = "fe1f98b8d66e537d2f0ba06e7dec4f44001deec539a2d18bfc102d6a86189148" dependencies = [ "ammonia", "anyhow", @@ -2306,7 +2361,7 @@ version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46" dependencies = [ - "bitflags 2.6.0", + "bitflags", "cfg-if", "cfg_aliases", "libc", @@ -2410,6 +2465,21 @@ dependencies = [ ] [[package]] +name = "num-modular" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17bb261bf36fa7d83f4c294f834e91256769097b3cb505d44831e0a179ac647f" + +[[package]] +name = "num-order" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "537b596b97c40fcf8056d153049eb22f481c17ebce72a513ec9286e4986d1bb6" +dependencies = [ + "num-modular", +] + +[[package]] name = "num-rational" version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2462,7 +2532,7 @@ checksum = "aedf0a2d09c573ed1d8d85b30c119153926a2b36dce0ab28322c09a117a4683e" dependencies = [ "crc32fast", "flate2", - "hashbrown 0.15.0", + "hashbrown 0.15.2", "indexmap", "memchr", "ruzstd", @@ -2610,9 +2680,9 @@ dependencies = [ [[package]] name = "pathdiff" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d61c5ce1153ab5b689d0c074c4e7fc613e942dfb7dd9eea5ab202d2ad91fe361" +checksum = "df94ce210e5bc13cb6651479fa48d14f601d9858cfe0467f43ae157023b938d3" [[package]] name = "percent-encoding" @@ -2660,7 +2730,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -2762,9 +2832,9 @@ dependencies = [ [[package]] name = "portable-atomic" -version = "1.9.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc9c68a3f6da06753e9335d63e27f6b9754dd1920d941135b7ea8224f141adb2" +checksum = "280dc24453071f1b63954171985a0b0d30058d287960968b9b2aca264c8d4ee6" [[package]] name = "powerfmt" @@ -2805,9 +2875,9 @@ checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" [[package]] name = "proc-macro2" -version = "1.0.89" +version = "1.0.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e" +checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" dependencies = [ "unicode-ident", ] @@ -2827,7 +2897,7 @@ version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57206b407293d2bcd3af849ce869d52068623f19e1b5ff8e8778e3309439682b" dependencies = [ - "bitflags 2.6.0", + "bitflags", "memchr", "unicase", ] @@ -2838,7 +2908,7 @@ version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "76979bea66e7875e7509c4ec5300112b316af87fa7a252ca91c448b32dfe3993" dependencies = [ - "bitflags 2.6.0", + "bitflags", "memchr", "pulldown-cmark-escape 0.10.1", "unicase", @@ -2850,7 +2920,7 @@ version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "679341d22c78c6c649893cbd6c3278dcbe9fc4faa62fea3a9296ae2b50c14625" dependencies = [ - "bitflags 2.6.0", + "bitflags", "memchr", "pulldown-cmark-escape 0.11.0", "unicase", @@ -2954,7 +3024,7 @@ version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b6dfecf2c74bce2466cabf93f6664d6998a69eb21e39f4207930065b27b771f" dependencies = [ - "bitflags 2.6.0", + "bitflags", ] [[package]] @@ -2976,7 +3046,7 @@ checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.8", + "regex-automata 0.4.9", "regex-syntax 0.8.5", ] @@ -3000,9 +3070,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.8" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "368758f23274712b504848e9d5a6f010445cc8b87a7cdb4d7cbee666c1288da3" +checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" dependencies = [ "aho-corasick", "memchr", @@ -3068,9 +3138,9 @@ dependencies = [ "proc-macro2", "quote", "rinja_parser", - "rustc-hash 2.0.0", + "rustc-hash 2.1.0", "serde", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -3103,7 +3173,7 @@ dependencies = [ "regex", "serde_json", "similar", - "wasmparser 0.216.0", + "wasmparser 0.219.1", ] [[package]] @@ -3132,9 +3202,9 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] name = "rustc-hash" -version = "2.0.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152" +checksum = "c7fb8039b3032c191086b10f11f319a6e99e1e82889c5cc6046f515c9db1d497" [[package]] name = "rustc-main" @@ -3199,7 +3269,7 @@ version = "1.0.1" name = "rustc_abi" version = "0.0.0" dependencies = [ - "bitflags 2.6.0", + "bitflags", "rand", "rand_xoshiro", "rustc_data_structures", @@ -3213,11 +3283,11 @@ dependencies = [ [[package]] name = "rustc_apfloat" -version = "0.2.1+llvm-462a31f5a5ab" +version = "0.2.2+llvm-462a31f5a5ab" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "886d94c63c812a8037c4faca2607453a0fa4cf82f734665266876b022244543f" +checksum = "121e2195ff969977a4e2b5c9965ea867fce7e4cb5aee5b09dee698a7932d574f" dependencies = [ - "bitflags 1.3.2", + "bitflags", "smallvec", ] @@ -3232,7 +3302,7 @@ dependencies = [ name = "rustc_ast" version = "0.0.0" dependencies = [ - "bitflags 2.6.0", + "bitflags", "memchr", "rustc_ast_ir", "rustc_data_structures", @@ -3395,7 +3465,7 @@ dependencies = [ name = "rustc_codegen_llvm" version = "0.0.0" dependencies = [ - "bitflags 2.6.0", + "bitflags", "itertools", "libc", "measureme", @@ -3433,7 +3503,7 @@ version = "0.0.0" dependencies = [ "ar_archive_writer", "arrayvec", - "bitflags 2.6.0", + "bitflags", "cc", "either", "itertools", @@ -3445,6 +3515,7 @@ dependencies = [ "rustc_abi", "rustc_arena", "rustc_ast", + "rustc_ast_pretty", "rustc_attr", "rustc_data_structures", "rustc_errors", @@ -3470,7 +3541,7 @@ dependencies = [ "thin-vec", "thorin-dwp", "tracing", - "wasm-encoder 0.216.0", + "wasm-encoder 0.219.1", "windows", ] @@ -3505,7 +3576,7 @@ name = "rustc_data_structures" version = "0.0.0" dependencies = [ "arrayvec", - "bitflags 2.6.0", + "bitflags", "either", "elsa", "ena", @@ -3516,7 +3587,7 @@ dependencies = [ "memmap2", "parking_lot", "portable-atomic", - "rustc-hash 2.0.0", + "rustc-hash 2.1.0", "rustc-rayon", "rustc-stable-hash", "rustc_arena", @@ -3689,7 +3760,7 @@ dependencies = [ "fluent-syntax", "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", "unic-langid", ] @@ -3823,7 +3894,7 @@ version = "0.0.0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -3971,7 +4042,7 @@ version = "0.0.0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", "synstructure", ] @@ -3979,7 +4050,7 @@ dependencies = [ name = "rustc_metadata" version = "0.0.0" dependencies = [ - "bitflags 2.6.0", + "bitflags", "libc", "libloading", "odht", @@ -4010,7 +4081,7 @@ dependencies = [ name = "rustc_middle" version = "0.0.0" dependencies = [ - "bitflags 2.6.0", + "bitflags", "derive-where", "either", "field-offset", @@ -4161,7 +4232,7 @@ dependencies = [ name = "rustc_parse" version = "0.0.0" dependencies = [ - "bitflags 2.6.0", + "bitflags", "rustc_ast", "rustc_ast_pretty", "rustc_data_structures", @@ -4218,7 +4289,7 @@ dependencies = [ name = "rustc_pattern_analysis" version = "0.0.0" dependencies = [ - "rustc-hash 2.0.0", + "rustc-hash 2.1.0", "rustc_abi", "rustc_apfloat", "rustc_arena", @@ -4301,7 +4372,7 @@ dependencies = [ name = "rustc_resolve" version = "0.0.0" dependencies = [ - "bitflags 2.6.0", + "bitflags", "pulldown-cmark 0.11.3", "rustc_arena", "rustc_ast", @@ -4329,7 +4400,7 @@ dependencies = [ name = "rustc_sanitizers" version = "0.0.0" dependencies = [ - "bitflags 2.6.0", + "bitflags", "rustc_abi", "rustc_data_structures", "rustc_hir", @@ -4356,7 +4427,7 @@ dependencies = [ name = "rustc_session" version = "0.0.0" dependencies = [ - "bitflags 2.6.0", + "bitflags", "getopts", "libc", "rustc_abi", @@ -4437,7 +4508,7 @@ dependencies = [ name = "rustc_target" version = "0.0.0" dependencies = [ - "bitflags 2.6.0", + "bitflags", "object 0.36.5", "rustc_abi", "rustc_data_structures", @@ -4538,7 +4609,7 @@ dependencies = [ name = "rustc_type_ir" version = "0.0.0" dependencies = [ - "bitflags 2.6.0", + "bitflags", "derive-where", "indexmap", "rustc-hash 1.1.0", @@ -4560,7 +4631,7 @@ version = "0.0.0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", "synstructure", ] @@ -4614,7 +4685,7 @@ name = "rustdoc-json-types" version = "0.1.0" dependencies = [ "bincode", - "rustc-hash 2.0.0", + "rustc-hash 2.1.0", "serde", "serde_json", ] @@ -4649,7 +4720,7 @@ dependencies = [ "proc-macro2", "quote", "serde", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -4683,11 +4754,11 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.38" +version = "0.38.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa260229e6538e52293eeb577aabd09945a09d6d9cc0fc550ed7529056c2e32a" +checksum = "d7f649912bc1495e167a6edee79151c84b1bad49748cb4f1f1167f459f6224f6" dependencies = [ - "bitflags 2.6.0", + "bitflags", "errno", "libc", "linux-raw-sys", @@ -4726,9 +4797,9 @@ dependencies = [ [[package]] name = "schannel" -version = "0.1.26" +version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01227be5826fa0690321a2ba6c5cd57a19cf3f6a09e76973b58e61de6ab9d1c1" +checksum = "1f29ebaa345f945cec9fbbc532eb307f0fdad8161f281b6369539c8d84876b3d" dependencies = [ "windows-sys 0.59.0", ] @@ -4771,29 +4842,29 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.214" +version = "1.0.215" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f55c3193aca71c12ad7890f1785d2b73e1b9f63a0bbc353c08ef26fe03fc56b5" +checksum = "6513c1ad0b11a9376da888e3e0baa0077f1aed55c17f50e7b2397136129fb88f" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.214" +version = "1.0.215" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de523f781f095e28fa605cdce0f8307e451cc0fd14e2eb4cd2e98a355b147766" +checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] name = "serde_json" -version = "1.0.132" +version = "1.0.133" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d726bfaff4b320266d395898905d0eba0345aae23b54aee3a737e260fd46db03" +checksum = "c7fceb2473b9166b2294ef05efcb65a3db80803f0b03ef86a5fc88a2b85ee377" dependencies = [ "indexmap", "itoa", @@ -4883,9 +4954,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "socket2" -version = "0.5.7" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" +checksum = "c970269d99b64e60ec3bd6ad27270092a5394c4e309314b18ae3fe575695fbe8" dependencies = [ "libc", "windows-sys 0.52.0", @@ -4903,9 +4974,9 @@ dependencies = [ [[package]] name = "spdx" -version = "0.10.6" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47317bbaf63785b53861e1ae2d11b80d6b624211d42cb20efcd210ee6f8a14bc" +checksum = "bae30cc7bfe3656d60ee99bf6836f472b0c53dddcbf335e253329abb16e535a2" dependencies = [ "smallvec", ] @@ -5044,9 +5115,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.87" +version = "2.0.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d" +checksum = "919d3b74a5dd0ccd15aeb8f93e7006bd9e14c295087c9896a110f490752bcf31" dependencies = [ "proc-macro2", "quote", @@ -5061,7 +5132,7 @@ checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -5098,9 +5169,9 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.13.0" +version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0f2c9fc62d0beef6951ccffd757e241266a2c833136efbe35af6cd2567dca5b" +checksum = "28cce251fcbc87fac86a866eeb0d6c2d536fc16d06f184bb61aeae11aa4cee0c" dependencies = [ "cfg-if", "fastrand", @@ -5142,9 +5213,9 @@ dependencies = [ [[package]] name = "terminal_size" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f599bd7ca042cfdf8f4512b277c02ba102247820f9d9d4a9f521f496751a6ef" +checksum = "5352447f921fda68cf61b4101566c0bdb5104eff6804d0678e5227580ab6a4e9" dependencies = [ "rustix", "windows-sys 0.59.0", @@ -5179,22 +5250,22 @@ checksum = "a38c90d48152c236a3ab59271da4f4ae63d678c5d7ad6b7714d7cb9760be5e4b" [[package]] name = "thiserror" -version = "1.0.66" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d171f59dbaa811dbbb1aee1e73db92ec2b122911a48e1390dfe327a821ddede" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.66" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b08be0f17bd307950653ce45db00cd31200d82b624b36e181337d9c7d92765b5" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -5238,7 +5309,7 @@ dependencies = [ "ignore", "miropt-test-tools", "regex", - "rustc-hash 2.0.0", + "rustc-hash 2.1.0", "semver", "similar", "termcolor", @@ -5317,9 +5388,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.41.0" +version = "1.41.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "145f3413504347a2be84393cc8a7d2fb4d863b375909ea59f2158261aa258bbb" +checksum = "22cfb5bee7a6a52939ca9224d6ac897bb669134078daa8735560897f69de4d33" dependencies = [ "backtrace", "bytes", @@ -5389,13 +5460,13 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.27" +version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -5410,9 +5481,9 @@ dependencies = [ [[package]] name = "tracing-error" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d686ec1c0f384b1277f097b2f279a2ecc11afe8c133c1aabf036a27cb4cd206e" +checksum = "8b1581020d7a273442f5b45074a6a57d5757ad0a47dac0e9f0bd57b81936f3db" dependencies = [ "tracing", "tracing-subscriber", @@ -5566,7 +5637,7 @@ checksum = "1ed7f4237ba393424195053097c1516bd4590dc82b84f2f97c5c69e12704555b" dependencies = [ "proc-macro-hack", "quote", - "syn 2.0.87", + "syn 2.0.90", "unic-langid-impl", ] @@ -5577,16 +5648,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7e51b68083f157f853b6379db119d1c1be0e6e4dec98101079dec41f6f5cf6df" [[package]] -name = "unicode-bidi" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ab17db44d7388991a428b2ee655ce0c212e862eff1768a455c58f9aad6e7893" - -[[package]] name = "unicode-ident" -version = "1.0.13" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" +checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" [[package]] name = "unicode-normalization" @@ -5669,9 +5734,9 @@ dependencies = [ [[package]] name = "url" -version = "2.5.2" +version = "2.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" +checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60" dependencies = [ "form_urlencoded", "idna", @@ -5685,12 +5750,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" [[package]] +name = "utf16_iter" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" + +[[package]] name = "utf8-width" version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "86bd8d4e895da8537e5315b8254664e6b769c4ff3db18321b297a1e7004392e3" [[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + +[[package]] name = "utf8parse" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -5747,9 +5824,9 @@ checksum = "0f76d9fa52234153eeb40b088de91a8c13dc28a912cf6f31cd89ca4bac9024e0" [[package]] name = "wasm-bindgen" -version = "0.2.95" +version = "0.2.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e" +checksum = "d15e63b4482863c109d70a7b8706c1e364eb6ea449b201a76c5b89cedcec2d5c" dependencies = [ "cfg-if", "once_cell", @@ -5758,24 +5835,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.95" +version = "0.2.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358" +checksum = "8d36ef12e3aaca16ddd3f67922bc63e48e953f126de60bd33ccc0101ef9998cd" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.95" +version = "0.2.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56" +checksum = "705440e08b42d3e4b36de7d66c944be628d579796b8090bfa3471478a2260051" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -5783,22 +5860,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.95" +version = "0.2.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" +checksum = "98c9ae5a76e46f4deecd0f0255cc223cfa18dc9b261213b8aa0c7b36f61b3f1d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.95" +version = "0.2.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" +checksum = "6ee99da9c5ba11bd675621338ef6fa52296b76b83305e9b6e5c77d4c286d6d49" [[package]] name = "wasm-component-ld" @@ -5829,21 +5906,22 @@ dependencies = [ [[package]] name = "wasm-encoder" -version = "0.216.0" +version = "0.219.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04c23aebea22c8a75833ae08ed31ccc020835b12a41999e58c31464271b94a88" +checksum = "29cbbd772edcb8e7d524a82ee8cef8dd046fc14033796a754c3ad246d019fa54" dependencies = [ "leb128", + "wasmparser 0.219.1", ] [[package]] name = "wasm-encoder" -version = "0.219.1" +version = "0.221.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29cbbd772edcb8e7d524a82ee8cef8dd046fc14033796a754c3ad246d019fa54" +checksum = "de35b6c3ef1f53ac7a31b5e69bc00f1542ea337e7e7162dc34c68b537ff82690" dependencies = [ "leb128", - "wasmparser 0.219.1", + "wasmparser 0.221.0", ] [[package]] @@ -5864,21 +5942,11 @@ dependencies = [ [[package]] name = "wasmparser" -version = "0.216.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcdee6bea3619d311fb4b299721e89a986c3470f804b6d534340e412589028e3" -dependencies = [ - "bitflags 2.6.0", - "indexmap", -] - -[[package]] -name = "wasmparser" version = "0.218.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b09e46c7fceceaa72b2dd1a8a137ea7fd8f93dfaa69806010a709918e496c5dc" dependencies = [ - "bitflags 2.6.0", + "bitflags", ] [[package]] @@ -5888,7 +5956,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c771866898879073c53b565a6c7b49953795159836714ac56a5befb581227c5" dependencies = [ "ahash", - "bitflags 2.6.0", + "bitflags", "hashbrown 0.14.5", "indexmap", "semver", @@ -5896,28 +5964,49 @@ dependencies = [ ] [[package]] +name = "wasmparser" +version = "0.221.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8659e755615170cfe20da468865c989da78c5da16d8652e69a75acda02406a92" +dependencies = [ + "bitflags", + "indexmap", + "semver", +] + +[[package]] name = "wast" -version = "219.0.1" +version = "221.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f79a9d9df79986a68689a6b40bcc8d5d40d807487b235bebc2ac69a242b54a1" +checksum = "9d8eb1933d493dd07484a255c3f52236123333f5befaa3be36182a50d393ec54" dependencies = [ "bumpalo", "leb128", "memchr", - "unicode-width 0.1.14", - "wasm-encoder 0.219.1", + "unicode-width 0.2.0", + "wasm-encoder 0.221.0", ] [[package]] name = "wat" -version = "1.219.1" +version = "1.221.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bc3cf014fb336883a411cd662f987abf6a1d2a27f2f0008616a0070bbf6bd0d" +checksum = "c813fd4e5b2b97242830b56e7b7dc5479bc17aaa8730109be35e61909af83993" dependencies = [ "wast", ] [[package]] +name = "web-time" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] name = "winapi" version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -5968,7 +6057,7 @@ dependencies = [ "rayon", "serde", "serde_json", - "syn 2.0.87", + "syn 2.0.90", "windows-metadata", ] @@ -6001,7 +6090,7 @@ checksum = "9107ddc059d5b6fbfbffdfa7a7fe3e22a226def0b2608f72e9d552763d3e1ad7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -6012,7 +6101,7 @@ checksum = "29bee4b38ea3cde66011baa44dba677c432a78593e202392d1e9070cf2a7fca7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -6200,7 +6289,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ad1673163c0cb14a6a19ddbf44dd4efe6f015ec1ebb8156710ac32501f19fba2" dependencies = [ "anyhow", - "bitflags 2.6.0", + "bitflags", "indexmap", "log", "serde", @@ -6231,6 +6320,12 @@ dependencies = [ ] [[package]] +name = "write16" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" + +[[package]] name = "writeable" version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -6267,9 +6362,9 @@ dependencies = [ [[package]] name = "yoke" -version = "0.7.4" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c5b1314b079b0930c31e3af543d8ee1757b1951ae1e1565ec704403a7240ca5" +checksum = "120e6aef9aa629e3d4f52dc8cc43a015c7724194c97dfaf45180d2daf2b77f40" dependencies = [ "serde", "stable_deref_trait", @@ -6279,13 +6374,13 @@ dependencies = [ [[package]] name = "yoke-derive" -version = "0.7.4" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28cc31741b18cb6f1d5ff12f5b7523e3d6eb0852bbbad19d73905511d9849b95" +checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", "synstructure", ] @@ -6307,27 +6402,27 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] name = "zerofrom" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ec111ce797d0e0784a1116d0ddcdbea84322cd79e5d5ad173daeba4f93ab55" +checksum = "cff3ee08c995dee1859d998dea82f7374f2826091dd9cd47def953cae446cd2e" dependencies = [ "zerofrom-derive", ] [[package]] name = "zerofrom-derive" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ea7b4a3637ea8669cedf0f1fd5c286a17f3de97b8dd5a70a6c167a1730e63a5" +checksum = "595eed982f7d355beb85837f651fa22e90b3c044842dc7f2c2842c086f295808" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", "synstructure", ] @@ -6350,5 +6445,5 @@ checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] diff --git a/README.md b/README.md index 3690a9c93c5..d84d96a0e91 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ standard library, and documentation. ## Why Rust? -- **Performance:** Fast and memory-efficient, suitable for critical services, embedded devices, and easily integrate with other languages. +- **Performance:** Fast and memory-efficient, suitable for critical services, embedded devices, and easily integrated with other languages. - **Reliability:** Our rich type system and ownership model ensure memory and thread safety, reducing bugs at compile-time. diff --git a/compiler/rustc_ast/src/ast.rs b/compiler/rustc_ast/src/ast.rs index 69ba78282f9..650525a2f52 100644 --- a/compiler/rustc_ast/src/ast.rs +++ b/compiler/rustc_ast/src/ast.rs @@ -3119,6 +3119,7 @@ pub struct FieldDef { pub ident: Option<Ident>, pub ty: P<Ty>, + pub default: Option<AnonConst>, pub is_placeholder: bool, } diff --git a/compiler/rustc_ast/src/mut_visit.rs b/compiler/rustc_ast/src/mut_visit.rs index 3a4a8ce266e..2c09059fe19 100644 --- a/compiler/rustc_ast/src/mut_visit.rs +++ b/compiler/rustc_ast/src/mut_visit.rs @@ -1120,13 +1120,14 @@ fn walk_poly_trait_ref<T: MutVisitor>(vis: &mut T, p: &mut PolyTraitRef) { } pub fn walk_field_def<T: MutVisitor>(visitor: &mut T, fd: &mut FieldDef) { - let FieldDef { span, ident, vis, id, ty, attrs, is_placeholder: _, safety } = fd; + let FieldDef { span, ident, vis, id, ty, attrs, is_placeholder: _, safety, default } = fd; visitor.visit_id(id); visit_attrs(visitor, attrs); visitor.visit_vis(vis); visit_safety(visitor, safety); visit_opt(ident, |ident| visitor.visit_ident(ident)); visitor.visit_ty(ty); + visit_opt(default, |default| visitor.visit_anon_const(default)); visitor.visit_span(span); } diff --git a/compiler/rustc_ast/src/visit.rs b/compiler/rustc_ast/src/visit.rs index 0b000c8cef8..a7f7c37693a 100644 --- a/compiler/rustc_ast/src/visit.rs +++ b/compiler/rustc_ast/src/visit.rs @@ -975,11 +975,13 @@ pub fn walk_struct_def<'a, V: Visitor<'a>>( } pub fn walk_field_def<'a, V: Visitor<'a>>(visitor: &mut V, field: &'a FieldDef) -> V::Result { - let FieldDef { attrs, id: _, span: _, vis, ident, ty, is_placeholder: _, safety: _ } = field; + let FieldDef { attrs, id: _, span: _, vis, ident, ty, is_placeholder: _, safety: _, default } = + field; walk_list!(visitor, visit_attribute, attrs); try_visit!(visitor.visit_vis(vis)); visit_opt!(visitor, visit_ident, ident); try_visit!(visitor.visit_ty(ty)); + visit_opt!(visitor, visit_anon_const, &*default); V::Result::output() } diff --git a/compiler/rustc_ast_lowering/messages.ftl b/compiler/rustc_ast_lowering/messages.ftl index a4dbf981115..f96c9fe8e32 100644 --- a/compiler/rustc_ast_lowering/messages.ftl +++ b/compiler/rustc_ast_lowering/messages.ftl @@ -45,10 +45,6 @@ ast_lowering_bad_return_type_notation_output = ast_lowering_bad_return_type_notation_position = return type notation not allowed in this position yet -ast_lowering_base_expression_double_dot = - base expression required after `..` - .suggestion = add a base expression here - ast_lowering_clobber_abi_not_supported = `clobber_abi` is not supported on this target @@ -57,6 +53,9 @@ ast_lowering_closure_cannot_be_static = closures cannot be static ast_lowering_coroutine_too_many_parameters = too many parameters for a coroutine (expected 0 or 1 parameters) +ast_lowering_default_field_in_tuple = default fields are not supported in tuple structs + .label = default fields are only supported on structs + ast_lowering_does_not_support_modifiers = the `{$class_name}` register class does not support template modifiers diff --git a/compiler/rustc_ast_lowering/src/errors.rs b/compiler/rustc_ast_lowering/src/errors.rs index 447af57354f..2564d4e2772 100644 --- a/compiler/rustc_ast_lowering/src/errors.rs +++ b/compiler/rustc_ast_lowering/src/errors.rs @@ -38,6 +38,14 @@ pub(crate) struct InvalidAbi { pub suggestion: Option<InvalidAbiSuggestion>, } +#[derive(Diagnostic)] +#[diag(ast_lowering_default_field_in_tuple)] +pub(crate) struct TupleStructWithDefault { + #[primary_span] + #[label] + pub span: Span, +} + pub(crate) struct InvalidAbiReason(pub &'static str); impl Subdiagnostic for InvalidAbiReason { @@ -115,14 +123,6 @@ pub(crate) struct UnderscoreExprLhsAssign { } #[derive(Diagnostic)] -#[diag(ast_lowering_base_expression_double_dot, code = E0797)] -pub(crate) struct BaseExpressionDoubleDot { - #[primary_span] - #[suggestion(code = "/* expr */", applicability = "has-placeholders", style = "verbose")] - pub span: Span, -} - -#[derive(Diagnostic)] #[diag(ast_lowering_await_only_in_async_fn_and_blocks, code = E0728)] pub(crate) struct AwaitOnlyInAsyncFnAndBlocks { #[primary_span] diff --git a/compiler/rustc_ast_lowering/src/expr.rs b/compiler/rustc_ast_lowering/src/expr.rs index 84e648f4923..2ad0ff3200e 100644 --- a/compiler/rustc_ast_lowering/src/expr.rs +++ b/compiler/rustc_ast_lowering/src/expr.rs @@ -19,10 +19,10 @@ use thin_vec::{ThinVec, thin_vec}; use visit::{Visitor, walk_expr}; use super::errors::{ - AsyncCoroutinesNotSupported, AwaitOnlyInAsyncFnAndBlocks, BaseExpressionDoubleDot, - ClosureCannotBeStatic, CoroutineTooManyParameters, - FunctionalRecordUpdateDestructuringAssignment, InclusiveRangeWithNoEnd, MatchArmWithNoBody, - NeverPatternWithBody, NeverPatternWithGuard, UnderscoreExprLhsAssign, + AsyncCoroutinesNotSupported, AwaitOnlyInAsyncFnAndBlocks, ClosureCannotBeStatic, + CoroutineTooManyParameters, FunctionalRecordUpdateDestructuringAssignment, + InclusiveRangeWithNoEnd, MatchArmWithNoBody, NeverPatternWithBody, NeverPatternWithGuard, + UnderscoreExprLhsAssign, }; use super::{ GenericArgsMode, ImplTraitContext, LoweringContext, ParamMode, ResolverAstLoweringExt, @@ -357,12 +357,9 @@ impl<'hir> LoweringContext<'_, 'hir> { ), ExprKind::Struct(se) => { let rest = match &se.rest { - StructRest::Base(e) => Some(self.lower_expr(e)), - StructRest::Rest(sp) => { - let guar = self.dcx().emit_err(BaseExpressionDoubleDot { span: *sp }); - Some(&*self.arena.alloc(self.expr_err(*sp, guar))) - } - StructRest::None => None, + StructRest::Base(e) => hir::StructTailExpr::Base(self.lower_expr(e)), + StructRest::Rest(sp) => hir::StructTailExpr::DefaultFields(*sp), + StructRest::None => hir::StructTailExpr::None, }; hir::ExprKind::Struct( self.arena.alloc(self.lower_qpath( @@ -1526,7 +1523,7 @@ impl<'hir> LoweringContext<'_, 'hir> { hir::ExprKind::Struct( self.arena.alloc(hir::QPath::LangItem(lang_item, self.lower_span(span))), fields, - None, + hir::StructTailExpr::None, ) } diff --git a/compiler/rustc_ast_lowering/src/item.rs b/compiler/rustc_ast_lowering/src/item.rs index fb09f1c7fee..7d6c41992eb 100644 --- a/compiler/rustc_ast_lowering/src/item.rs +++ b/compiler/rustc_ast_lowering/src/item.rs @@ -17,7 +17,10 @@ use smallvec::{SmallVec, smallvec}; use thin_vec::ThinVec; use tracing::instrument; -use super::errors::{InvalidAbi, InvalidAbiReason, InvalidAbiSuggestion, MisplacedRelaxTraitBound}; +use super::errors::{ + InvalidAbi, InvalidAbiReason, InvalidAbiSuggestion, MisplacedRelaxTraitBound, + TupleStructWithDefault, +}; use super::{ AstOwner, FnDeclKind, ImplTraitContext, ImplTraitPosition, LoweringContext, ParamMode, ResolverAstLoweringExt, @@ -690,13 +693,27 @@ impl<'hir> LoweringContext<'_, 'hir> { VariantData::Tuple(fields, id) => { let ctor_id = self.lower_node_id(*id); self.alias_attrs(ctor_id, parent_id); - hir::VariantData::Tuple( - self.arena.alloc_from_iter( - fields.iter().enumerate().map(|f| self.lower_field_def(f)), - ), - ctor_id, - self.local_def_id(*id), - ) + let fields = self + .arena + .alloc_from_iter(fields.iter().enumerate().map(|f| self.lower_field_def(f))); + for field in &fields[..] { + if let Some(default) = field.default { + // Default values in tuple struct and tuple variants are not allowed by the + // RFC due to concerns about the syntax, both in the item definition and the + // expression. We could in the future allow `struct S(i32 = 0);` and force + // users to construct the value with `let _ = S { .. };`. + if self.tcx.features().default_field_values() { + self.dcx().emit_err(TupleStructWithDefault { span: default.span }); + } else { + let _ = self.dcx().span_delayed_bug( + default.span, + "expected `default values on `struct` fields aren't supported` \ + feature-gate error but none was produced", + ); + } + } + } + hir::VariantData::Tuple(fields, ctor_id, self.local_def_id(*id)) } VariantData::Unit(id) => { let ctor_id = self.lower_node_id(*id); @@ -723,6 +740,7 @@ impl<'hir> LoweringContext<'_, 'hir> { None => Ident::new(sym::integer(index), self.lower_span(f.span)), }, vis_span: self.lower_span(f.vis.span), + default: f.default.as_ref().map(|v| self.lower_anon_const_to_anon_const(v)), ty, safety: self.lower_safety(f.safety, hir::Safety::Safe), } diff --git a/compiler/rustc_ast_passes/src/feature_gate.rs b/compiler/rustc_ast_passes/src/feature_gate.rs index 390a575a186..aa3b772efb1 100644 --- a/compiler/rustc_ast_passes/src/feature_gate.rs +++ b/compiler/rustc_ast_passes/src/feature_gate.rs @@ -557,6 +557,7 @@ pub fn check_crate(krate: &ast::Crate, sess: &Session, features: &Features) { gate_all!(explicit_tail_calls, "`become` expression is experimental"); gate_all!(generic_const_items, "generic const items are experimental"); gate_all!(guard_patterns, "guard patterns are experimental", "consider using match arm guards"); + gate_all!(default_field_values, "default values on fields are experimental"); gate_all!(fn_delegation, "functions delegation is not yet fully implemented"); gate_all!(postfix_match, "postfix match is experimental"); gate_all!(mut_ref, "mutable by-reference bindings are experimental"); diff --git a/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs b/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs index b42c99e1a6d..8dcc5324fdf 100644 --- a/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs @@ -1151,7 +1151,11 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { expr: &hir::Expr<'_>, ) { let typeck_results = self.infcx.tcx.typeck(self.mir_def_id()); - let hir::ExprKind::Struct(struct_qpath, fields, Some(base)) = expr.kind else { return }; + let hir::ExprKind::Struct(struct_qpath, fields, hir::StructTailExpr::Base(base)) = + expr.kind + else { + return; + }; let hir::QPath::Resolved(_, path) = struct_qpath else { return }; let hir::def::Res::Def(_, def_id) = path.res else { return }; let Some(expr_ty) = typeck_results.node_type_opt(expr.hir_id) else { return }; @@ -1239,7 +1243,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { expr: &'tcx hir::Expr<'tcx>, use_spans: Option<UseSpans<'tcx>>, ) { - if let hir::ExprKind::Struct(_, _, Some(_)) = expr.kind { + if let hir::ExprKind::Struct(_, _, hir::StructTailExpr::Base(_)) = expr.kind { // We have `S { foo: val, ..base }`. In `check_aggregate_rvalue` we have a single // `Location` that covers both the `S { ... }` literal, all of its fields and the // `base`. If the move happens because of `S { foo: val, bar: base.bar }` the `expr` diff --git a/compiler/rustc_builtin_macros/messages.ftl b/compiler/rustc_builtin_macros/messages.ftl index c05d44cb452..87d3d288013 100644 --- a/compiler/rustc_builtin_macros/messages.ftl +++ b/compiler/rustc_builtin_macros/messages.ftl @@ -261,7 +261,7 @@ builtin_macros_non_exhaustive_default = default variant must be exhaustive builtin_macros_non_generic_pointee = the `#[pointee]` attribute may only be used on generic parameters -builtin_macros_non_unit_default = the `#[default]` attribute may only be used on unit enum variants +builtin_macros_non_unit_default = the `#[default]` attribute may only be used on unit enum variants{$post} .help = consider a manual implementation of `Default` builtin_macros_only_one_argument = {$name} takes 1 argument diff --git a/compiler/rustc_builtin_macros/src/deriving/decodable.rs b/compiler/rustc_builtin_macros/src/deriving/decodable.rs index 686424770fc..469092e7b1c 100644 --- a/compiler/rustc_builtin_macros/src/deriving/decodable.rs +++ b/compiler/rustc_builtin_macros/src/deriving/decodable.rs @@ -205,7 +205,7 @@ where let fields = fields .iter() .enumerate() - .map(|(i, &(ident, span))| { + .map(|(i, &(ident, span, _))| { let arg = getarg(cx, span, ident.name, i); cx.field_imm(span, ident, arg) }) diff --git a/compiler/rustc_builtin_macros/src/deriving/default.rs b/compiler/rustc_builtin_macros/src/deriving/default.rs index d4befd12190..6b1a6effad7 100644 --- a/compiler/rustc_builtin_macros/src/deriving/default.rs +++ b/compiler/rustc_builtin_macros/src/deriving/default.rs @@ -54,26 +54,38 @@ pub(crate) fn expand_deriving_default( trait_def.expand(cx, mitem, item, push) } +fn default_call(cx: &ExtCtxt<'_>, span: Span) -> ast::ptr::P<ast::Expr> { + // Note that `kw::Default` is "default" and `sym::Default` is "Default"! + let default_ident = cx.std_path(&[kw::Default, sym::Default, kw::Default]); + cx.expr_call_global(span, default_ident, ThinVec::new()) +} + fn default_struct_substructure( cx: &ExtCtxt<'_>, trait_span: Span, substr: &Substructure<'_>, summary: &StaticFields, ) -> BlockOrExpr { - // Note that `kw::Default` is "default" and `sym::Default` is "Default"! - let default_ident = cx.std_path(&[kw::Default, sym::Default, kw::Default]); - let default_call = |span| cx.expr_call_global(span, default_ident.clone(), ThinVec::new()); - let expr = match summary { Unnamed(_, IsTuple::No) => cx.expr_ident(trait_span, substr.type_ident), Unnamed(fields, IsTuple::Yes) => { - let exprs = fields.iter().map(|sp| default_call(*sp)).collect(); + let exprs = fields.iter().map(|sp| default_call(cx, *sp)).collect(); cx.expr_call_ident(trait_span, substr.type_ident, exprs) } Named(fields) => { let default_fields = fields .iter() - .map(|&(ident, span)| cx.field_imm(span, ident, default_call(span))) + .map(|(ident, span, default_val)| { + let value = match default_val { + // We use `Default::default()`. + None => default_call(cx, *span), + // We use the field default const expression. + Some(val) => { + cx.expr(val.value.span, ast::ExprKind::ConstBlock(val.clone())) + } + }; + cx.field_imm(*span, *ident, value) + }) .collect(); cx.expr_struct_ident(trait_span, substr.type_ident, default_fields) } @@ -93,10 +105,38 @@ fn default_enum_substructure( } { Ok(default_variant) => { // We now know there is exactly one unit variant with exactly one `#[default]` attribute. - cx.expr_path(cx.path(default_variant.span, vec![ - Ident::new(kw::SelfUpper, default_variant.span), - default_variant.ident, - ])) + match &default_variant.data { + VariantData::Unit(_) => cx.expr_path(cx.path(default_variant.span, vec![ + Ident::new(kw::SelfUpper, default_variant.span), + default_variant.ident, + ])), + VariantData::Struct { fields, .. } => { + // This only happens if `#![feature(default_field_values)]`. We have validated + // all fields have default values in the definition. + let default_fields = fields + .iter() + .map(|field| { + cx.field_imm(field.span, field.ident.unwrap(), match &field.default { + // We use `Default::default()`. + None => default_call(cx, field.span), + // We use the field default const expression. + Some(val) => { + cx.expr(val.value.span, ast::ExprKind::ConstBlock(val.clone())) + } + }) + }) + .collect(); + let path = cx.path(default_variant.span, vec![ + Ident::new(kw::SelfUpper, default_variant.span), + default_variant.ident, + ]); + cx.expr_struct(default_variant.span, path, default_fields) + } + // Logic error in `extract_default_variant`. + VariantData::Tuple(..) => { + cx.dcx().bug("encountered tuple variant annotated with `#[default]`") + } + } } Err(guar) => DummyResult::raw_expr(trait_span, Some(guar)), }; @@ -156,8 +196,20 @@ fn extract_default_variant<'a>( } }; - if !matches!(variant.data, VariantData::Unit(..)) { - let guar = cx.dcx().emit_err(errors::NonUnitDefault { span: variant.ident.span }); + if cx.ecfg.features.default_field_values() + && let VariantData::Struct { fields, .. } = &variant.data + && fields.iter().all(|f| f.default.is_some()) + // Disallow `#[default] Variant {}` + && !fields.is_empty() + { + // Allowed + } else if !matches!(variant.data, VariantData::Unit(..)) { + let post = if cx.ecfg.features.default_field_values() { + " or variants where every field has a default value" + } else { + "" + }; + let guar = cx.dcx().emit_err(errors::NonUnitDefault { span: variant.ident.span, post }); return Err(guar); } @@ -216,7 +268,12 @@ struct DetectNonVariantDefaultAttr<'a, 'b> { impl<'a, 'b> rustc_ast::visit::Visitor<'a> for DetectNonVariantDefaultAttr<'a, 'b> { fn visit_attribute(&mut self, attr: &'a rustc_ast::Attribute) { if attr.has_name(kw::Default) { - self.cx.dcx().emit_err(errors::NonUnitDefault { span: attr.span }); + let post = if self.cx.ecfg.features.default_field_values() { + " or variants where every field has a default value" + } else { + "" + }; + self.cx.dcx().emit_err(errors::NonUnitDefault { span: attr.span, post }); } rustc_ast::visit::walk_attribute(self, attr); diff --git a/compiler/rustc_builtin_macros/src/deriving/generic/mod.rs b/compiler/rustc_builtin_macros/src/deriving/generic/mod.rs index f6eea0b21ca..846d8784dea 100644 --- a/compiler/rustc_builtin_macros/src/deriving/generic/mod.rs +++ b/compiler/rustc_builtin_macros/src/deriving/generic/mod.rs @@ -182,8 +182,8 @@ pub(crate) use StaticFields::*; pub(crate) use SubstructureFields::*; use rustc_ast::ptr::P; use rustc_ast::{ - self as ast, BindingMode, ByRef, EnumDef, Expr, GenericArg, GenericParamKind, Generics, - Mutability, PatKind, VariantData, + self as ast, AnonConst, BindingMode, ByRef, EnumDef, Expr, GenericArg, GenericParamKind, + Generics, Mutability, PatKind, VariantData, }; use rustc_attr as attr; use rustc_expand::base::{Annotatable, ExtCtxt}; @@ -296,7 +296,7 @@ pub(crate) enum StaticFields { /// Tuple and unit structs/enum variants like this. Unnamed(Vec<Span>, IsTuple), /// Normal structs/struct variants. - Named(Vec<(Ident, Span)>), + Named(Vec<(Ident, Span, Option<AnonConst>)>), } /// A summary of the possible sets of fields. @@ -1435,7 +1435,7 @@ impl<'a> TraitDef<'a> { for field in struct_def.fields() { let sp = field.span.with_ctxt(self.span.ctxt()); match field.ident { - Some(ident) => named_idents.push((ident, sp)), + Some(ident) => named_idents.push((ident, sp, field.default.clone())), _ => just_spans.push(sp), } } diff --git a/compiler/rustc_builtin_macros/src/errors.rs b/compiler/rustc_builtin_macros/src/errors.rs index f8e65661e52..c9bd3371e55 100644 --- a/compiler/rustc_builtin_macros/src/errors.rs +++ b/compiler/rustc_builtin_macros/src/errors.rs @@ -424,6 +424,7 @@ pub(crate) struct MultipleDefaultsSugg { pub(crate) struct NonUnitDefault { #[primary_span] pub(crate) span: Span, + pub(crate) post: &'static str, } #[derive(Diagnostic)] diff --git a/compiler/rustc_codegen_cranelift/example/mini_core.rs b/compiler/rustc_codegen_cranelift/example/mini_core.rs index 3da215fe6c0..a0a381638c0 100644 --- a/compiler/rustc_codegen_cranelift/example/mini_core.rs +++ b/compiler/rustc_codegen_cranelift/example/mini_core.rs @@ -55,26 +55,26 @@ impl<T: ?Sized> LegacyReceiver for &mut T {} impl<T: ?Sized> LegacyReceiver for Box<T> {} #[lang = "copy"] -pub unsafe trait Copy {} - -unsafe impl Copy for bool {} -unsafe impl Copy for u8 {} -unsafe impl Copy for u16 {} -unsafe impl Copy for u32 {} -unsafe impl Copy for u64 {} -unsafe impl Copy for u128 {} -unsafe impl Copy for usize {} -unsafe impl Copy for i8 {} -unsafe impl Copy for i16 {} -unsafe impl Copy for i32 {} -unsafe impl Copy for isize {} -unsafe impl Copy for f32 {} -unsafe impl Copy for f64 {} -unsafe impl Copy for char {} -unsafe impl<'a, T: ?Sized> Copy for &'a T {} -unsafe impl<T: ?Sized> Copy for *const T {} -unsafe impl<T: ?Sized> Copy for *mut T {} -unsafe impl<T: Copy> Copy for Option<T> {} +pub trait Copy {} + +impl Copy for bool {} +impl Copy for u8 {} +impl Copy for u16 {} +impl Copy for u32 {} +impl Copy for u64 {} +impl Copy for u128 {} +impl Copy for usize {} +impl Copy for i8 {} +impl Copy for i16 {} +impl Copy for i32 {} +impl Copy for isize {} +impl Copy for f32 {} +impl Copy for f64 {} +impl Copy for char {} +impl<'a, T: ?Sized> Copy for &'a T {} +impl<T: ?Sized> Copy for *const T {} +impl<T: ?Sized> Copy for *mut T {} +impl<T: Copy> Copy for Option<T> {} #[lang = "sync"] pub unsafe trait Sync {} diff --git a/compiler/rustc_codegen_gcc/example/mini_core.rs b/compiler/rustc_codegen_gcc/example/mini_core.rs index c887598f6e9..cdd151613df 100644 --- a/compiler/rustc_codegen_gcc/example/mini_core.rs +++ b/compiler/rustc_codegen_gcc/example/mini_core.rs @@ -52,24 +52,24 @@ impl<T: ?Sized> LegacyReceiver for &mut T {} impl<T: ?Sized, A: Allocator> LegacyReceiver for Box<T, A> {} #[lang = "copy"] -pub unsafe trait Copy {} - -unsafe impl Copy for bool {} -unsafe impl Copy for u8 {} -unsafe impl Copy for u16 {} -unsafe impl Copy for u32 {} -unsafe impl Copy for u64 {} -unsafe impl Copy for usize {} -unsafe impl Copy for i8 {} -unsafe impl Copy for i16 {} -unsafe impl Copy for i32 {} -unsafe impl Copy for isize {} -unsafe impl Copy for f32 {} -unsafe impl Copy for f64 {} -unsafe impl Copy for char {} -unsafe impl<'a, T: ?Sized> Copy for &'a T {} -unsafe impl<T: ?Sized> Copy for *const T {} -unsafe impl<T: ?Sized> Copy for *mut T {} +pub trait Copy {} + +impl Copy for bool {} +impl Copy for u8 {} +impl Copy for u16 {} +impl Copy for u32 {} +impl Copy for u64 {} +impl Copy for usize {} +impl Copy for i8 {} +impl Copy for i16 {} +impl Copy for i32 {} +impl Copy for isize {} +impl Copy for f32 {} +impl Copy for f64 {} +impl Copy for char {} +impl<'a, T: ?Sized> Copy for &'a T {} +impl<T: ?Sized> Copy for *const T {} +impl<T: ?Sized> Copy for *mut T {} #[lang = "sync"] pub unsafe trait Sync {} diff --git a/compiler/rustc_codegen_llvm/src/coverageinfo/map_data.rs b/compiler/rustc_codegen_llvm/src/coverageinfo/map_data.rs index 0752c718c70..c5d1ebdfe7c 100644 --- a/compiler/rustc_codegen_llvm/src/coverageinfo/map_data.rs +++ b/compiler/rustc_codegen_llvm/src/coverageinfo/map_data.rs @@ -1,159 +1,38 @@ use rustc_data_structures::captures::Captures; -use rustc_data_structures::fx::FxIndexSet; -use rustc_index::bit_set::BitSet; -use rustc_middle::mir::CoverageIdsInfo; use rustc_middle::mir::coverage::{ - CounterId, CovTerm, Expression, ExpressionId, FunctionCoverageInfo, Mapping, MappingKind, Op, + CovTerm, CoverageIdsInfo, Expression, FunctionCoverageInfo, Mapping, MappingKind, Op, SourceRegion, }; -use rustc_middle::ty::Instance; -use tracing::debug; use crate::coverageinfo::ffi::{Counter, CounterExpression, ExprKind}; -/// Holds all of the coverage mapping data associated with a function instance, -/// collected during traversal of `Coverage` statements in the function's MIR. -#[derive(Debug)] -pub(crate) struct FunctionCoverageCollector<'tcx> { - /// Coverage info that was attached to this function by the instrumentor. - function_coverage_info: &'tcx FunctionCoverageInfo, - ids_info: &'tcx CoverageIdsInfo, - is_used: bool, +pub(crate) struct FunctionCoverage<'tcx> { + pub(crate) function_coverage_info: &'tcx FunctionCoverageInfo, + /// If `None`, the corresponding function is unused. + ids_info: Option<&'tcx CoverageIdsInfo>, } -impl<'tcx> FunctionCoverageCollector<'tcx> { - /// Creates a new set of coverage data for a used (called) function. - pub(crate) fn new( - instance: Instance<'tcx>, - function_coverage_info: &'tcx FunctionCoverageInfo, - ids_info: &'tcx CoverageIdsInfo, - ) -> Self { - Self::create(instance, function_coverage_info, ids_info, true) - } - - /// Creates a new set of coverage data for an unused (never called) function. - pub(crate) fn unused( - instance: Instance<'tcx>, - function_coverage_info: &'tcx FunctionCoverageInfo, - ids_info: &'tcx CoverageIdsInfo, - ) -> Self { - Self::create(instance, function_coverage_info, ids_info, false) - } - - fn create( - instance: Instance<'tcx>, +impl<'tcx> FunctionCoverage<'tcx> { + pub(crate) fn new_used( function_coverage_info: &'tcx FunctionCoverageInfo, ids_info: &'tcx CoverageIdsInfo, - is_used: bool, ) -> Self { - let num_counters = function_coverage_info.num_counters; - let num_expressions = function_coverage_info.expressions.len(); - debug!( - "FunctionCoverage::create(instance={instance:?}) has \ - num_counters={num_counters}, num_expressions={num_expressions}, is_used={is_used}" - ); - - Self { function_coverage_info, ids_info, is_used } - } - - /// Identify expressions that will always have a value of zero, and note - /// their IDs in [`ZeroExpressions`]. Mappings that refer to a zero expression - /// can instead become mappings to a constant zero value. - /// - /// This method mainly exists to preserve the simplifications that were - /// already being performed by the Rust-side expression renumbering, so that - /// the resulting coverage mappings don't get worse. - fn identify_zero_expressions(&self) -> ZeroExpressions { - // The set of expressions that either were optimized out entirely, or - // have zero as both of their operands, and will therefore always have - // a value of zero. Other expressions that refer to these as operands - // can have those operands replaced with `CovTerm::Zero`. - let mut zero_expressions = ZeroExpressions::default(); - - // Simplify a copy of each expression based on lower-numbered expressions, - // and then update the set of always-zero expressions if necessary. - // (By construction, expressions can only refer to other expressions - // that have lower IDs, so one pass is sufficient.) - for (id, expression) in self.function_coverage_info.expressions.iter_enumerated() { - if !self.is_used || !self.ids_info.expressions_seen.contains(id) { - // If an expression was not seen, it must have been optimized away, - // so any operand that refers to it can be replaced with zero. - zero_expressions.insert(id); - continue; - } - - // We don't need to simplify the actual expression data in the - // expressions list; we can just simplify a temporary copy and then - // use that to update the set of always-zero expressions. - let Expression { mut lhs, op, mut rhs } = *expression; - - // If an expression has an operand that is also an expression, the - // operand's ID must be strictly lower. This is what lets us find - // all zero expressions in one pass. - let assert_operand_expression_is_lower = |operand_id: ExpressionId| { - assert!( - operand_id < id, - "Operand {operand_id:?} should be less than {id:?} in {expression:?}", - ) - }; - - // If an operand refers to a counter or expression that is always - // zero, then that operand can be replaced with `CovTerm::Zero`. - let maybe_set_operand_to_zero = |operand: &mut CovTerm| { - if let CovTerm::Expression(id) = *operand { - assert_operand_expression_is_lower(id); - } - - if is_zero_term(&self.ids_info.counters_seen, &zero_expressions, *operand) { - *operand = CovTerm::Zero; - } - }; - maybe_set_operand_to_zero(&mut lhs); - maybe_set_operand_to_zero(&mut rhs); - - // Coverage counter values cannot be negative, so if an expression - // involves subtraction from zero, assume that its RHS must also be zero. - // (Do this after simplifications that could set the LHS to zero.) - if lhs == CovTerm::Zero && op == Op::Subtract { - rhs = CovTerm::Zero; - } - - // After the above simplifications, if both operands are zero, then - // we know that this expression is always zero too. - if lhs == CovTerm::Zero && rhs == CovTerm::Zero { - zero_expressions.insert(id); - } - } - - zero_expressions + Self { function_coverage_info, ids_info: Some(ids_info) } } - pub(crate) fn into_finished(self) -> FunctionCoverage<'tcx> { - let zero_expressions = self.identify_zero_expressions(); - let FunctionCoverageCollector { function_coverage_info, ids_info, is_used, .. } = self; - - FunctionCoverage { function_coverage_info, ids_info, is_used, zero_expressions } + pub(crate) fn new_unused(function_coverage_info: &'tcx FunctionCoverageInfo) -> Self { + Self { function_coverage_info, ids_info: None } } -} - -pub(crate) struct FunctionCoverage<'tcx> { - pub(crate) function_coverage_info: &'tcx FunctionCoverageInfo, - ids_info: &'tcx CoverageIdsInfo, - is_used: bool, - - zero_expressions: ZeroExpressions, -} -impl<'tcx> FunctionCoverage<'tcx> { /// Returns true for a used (called) function, and false for an unused function. pub(crate) fn is_used(&self) -> bool { - self.is_used + self.ids_info.is_some() } /// Return the source hash, generated from the HIR node structure, and used to indicate whether /// or not the source code structure changed between different compilations. pub(crate) fn source_hash(&self) -> u64 { - if self.is_used { self.function_coverage_info.function_source_hash } else { 0 } + if self.is_used() { self.function_coverage_info.function_source_hash } else { 0 } } /// Convert this function's coverage expression data into a form that can be @@ -196,37 +75,10 @@ impl<'tcx> FunctionCoverage<'tcx> { } fn is_zero_term(&self, term: CovTerm) -> bool { - !self.is_used || is_zero_term(&self.ids_info.counters_seen, &self.zero_expressions, term) - } -} - -/// Set of expression IDs that are known to always evaluate to zero. -/// Any mapping or expression operand that refers to these expressions can have -/// that reference replaced with a constant zero value. -#[derive(Default)] -struct ZeroExpressions(FxIndexSet<ExpressionId>); - -impl ZeroExpressions { - fn insert(&mut self, id: ExpressionId) { - self.0.insert(id); - } - - fn contains(&self, id: ExpressionId) -> bool { - self.0.contains(&id) - } -} - -/// Returns `true` if the given term is known to have a value of zero, taking -/// into account knowledge of which counters are unused and which expressions -/// are always zero. -fn is_zero_term( - counters_seen: &BitSet<CounterId>, - zero_expressions: &ZeroExpressions, - term: CovTerm, -) -> bool { - match term { - CovTerm::Zero => true, - CovTerm::Counter(id) => !counters_seen.contains(id), - CovTerm::Expression(id) => zero_expressions.contains(id), + match self.ids_info { + Some(ids_info) => ids_info.is_zero_term(term), + // This function is unused, so all coverage counters/expressions are zero. + None => true, + } } } diff --git a/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs b/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs index 8c24579fa7c..a6c3caf9e2b 100644 --- a/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs +++ b/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs @@ -20,7 +20,7 @@ use rustc_target::spec::HasTargetSpec; use tracing::debug; use crate::common::CodegenCx; -use crate::coverageinfo::map_data::{FunctionCoverage, FunctionCoverageCollector}; +use crate::coverageinfo::map_data::FunctionCoverage; use crate::coverageinfo::{ffi, llvm_cov}; use crate::llvm; @@ -63,16 +63,11 @@ pub(crate) fn finalize(cx: &CodegenCx<'_, '_>) { None => return, }; if function_coverage_map.is_empty() { - // This module has no functions with coverage instrumentation + // This CGU has no functions with coverage instrumentation. return; } - let function_coverage_entries = function_coverage_map - .into_iter() - .map(|(instance, function_coverage)| (instance, function_coverage.into_finished())) - .collect::<Vec<_>>(); - - let all_file_names = function_coverage_entries + let all_file_names = function_coverage_map .iter() .map(|(_, fn_cov)| fn_cov.function_coverage_info.body_span) .map(|span| span_file_name(tcx, span)); @@ -92,7 +87,7 @@ pub(crate) fn finalize(cx: &CodegenCx<'_, '_>) { let mut unused_function_names = Vec::new(); // Encode coverage mappings and generate function records - for (instance, function_coverage) in function_coverage_entries { + for (instance, function_coverage) in function_coverage_map { debug!("Generate function coverage for {}, {:?}", cx.codegen_unit.name(), instance); let mangled_function_name = tcx.symbol_name(instance).name; @@ -536,11 +531,6 @@ fn add_unused_function_coverage<'tcx>( ); // An unused function's mappings will all be rewritten to map to zero. - let function_coverage = FunctionCoverageCollector::unused( - instance, - function_coverage_info, - tcx.coverage_ids_info(instance.def), - ); - + let function_coverage = FunctionCoverage::new_unused(function_coverage_info); cx.coverage_cx().function_coverage_map.borrow_mut().insert(instance, function_coverage); } diff --git a/compiler/rustc_codegen_llvm/src/coverageinfo/mod.rs b/compiler/rustc_codegen_llvm/src/coverageinfo/mod.rs index c2fcb33f98b..82b6677e203 100644 --- a/compiler/rustc_codegen_llvm/src/coverageinfo/mod.rs +++ b/compiler/rustc_codegen_llvm/src/coverageinfo/mod.rs @@ -13,7 +13,7 @@ use tracing::{debug, instrument}; use crate::builder::Builder; use crate::common::CodegenCx; -use crate::coverageinfo::map_data::FunctionCoverageCollector; +use crate::coverageinfo::map_data::FunctionCoverage; use crate::llvm; pub(crate) mod ffi; @@ -24,8 +24,7 @@ mod mapgen; /// Extra per-CGU context/state needed for coverage instrumentation. pub(crate) struct CguCoverageContext<'ll, 'tcx> { /// Coverage data for each instrumented function identified by DefId. - pub(crate) function_coverage_map: - RefCell<FxIndexMap<Instance<'tcx>, FunctionCoverageCollector<'tcx>>>, + pub(crate) function_coverage_map: RefCell<FxIndexMap<Instance<'tcx>, FunctionCoverage<'tcx>>>, pub(crate) pgo_func_name_var_map: RefCell<FxHashMap<Instance<'tcx>, &'ll llvm::Value>>, pub(crate) mcdc_condition_bitmap_map: RefCell<FxHashMap<Instance<'tcx>, Vec<&'ll llvm::Value>>>, @@ -42,9 +41,7 @@ impl<'ll, 'tcx> CguCoverageContext<'ll, 'tcx> { } } - fn take_function_coverage_map( - &self, - ) -> FxIndexMap<Instance<'tcx>, FunctionCoverageCollector<'tcx>> { + fn take_function_coverage_map(&self) -> FxIndexMap<Instance<'tcx>, FunctionCoverage<'tcx>> { self.function_coverage_map.replace(FxIndexMap::default()) } @@ -161,8 +158,7 @@ impl<'tcx> CoverageInfoBuilderMethods<'tcx> for Builder<'_, '_, 'tcx> { // This includes functions that were not partitioned into this CGU, // but were MIR-inlined into one of this CGU's functions. coverage_cx.function_coverage_map.borrow_mut().entry(instance).or_insert_with(|| { - FunctionCoverageCollector::new( - instance, + FunctionCoverage::new_used( function_coverage_info, bx.tcx.coverage_ids_info(instance.def), ) diff --git a/compiler/rustc_codegen_llvm/src/llvm_util.rs b/compiler/rustc_codegen_llvm/src/llvm_util.rs index db2b03d9aed..07eb89e6041 100644 --- a/compiler/rustc_codegen_llvm/src/llvm_util.rs +++ b/compiler/rustc_codegen_llvm/src/llvm_util.rs @@ -230,6 +230,8 @@ pub(crate) fn to_llvm_features<'a>(sess: &Session, s: &'a str) -> Option<LLVMFea "aarch64" } else if sess.target.arch == "sparc64" { "sparc" + } else if sess.target.arch == "powerpc64" { + "powerpc" } else { &*sess.target.arch }; @@ -289,6 +291,7 @@ pub(crate) fn to_llvm_features<'a>(sess: &Session, s: &'a str) -> Option<LLVMFea // https://github.com/llvm/llvm-project/blob/llvmorg-18.1.0/llvm/lib/Target/Sparc/MCTargetDesc/SparcELFObjectWriter.cpp#L26 ("sparc", "v8plus") if get_version().0 == 19 => Some(LLVMFeature::new("v9")), ("sparc", "v8plus") if get_version().0 < 19 => None, + ("powerpc", "power8-crypto") => Some(LLVMFeature::new("crypto")), (_, s) => Some(LLVMFeature::new(s)), } } diff --git a/compiler/rustc_codegen_ssa/Cargo.toml b/compiler/rustc_codegen_ssa/Cargo.toml index b898cfec796..c81e36dfc8d 100644 --- a/compiler/rustc_codegen_ssa/Cargo.toml +++ b/compiler/rustc_codegen_ssa/Cargo.toml @@ -17,6 +17,7 @@ regex = "1.4" rustc_abi = { path = "../rustc_abi" } rustc_arena = { path = "../rustc_arena" } rustc_ast = { path = "../rustc_ast" } +rustc_ast_pretty = { path = "../rustc_ast_pretty" } rustc_attr = { path = "../rustc_attr" } rustc_data_structures = { path = "../rustc_data_structures" } rustc_errors = { path = "../rustc_errors" } @@ -42,7 +43,7 @@ tempfile = "3.2" thin-vec = "0.2.12" thorin-dwp = "0.8" tracing = "0.1" -wasm-encoder = "0.216.0" +wasm-encoder = "0.219" # tidy-alphabetical-end [target.'cfg(unix)'.dependencies] diff --git a/compiler/rustc_codegen_ssa/messages.ftl b/compiler/rustc_codegen_ssa/messages.ftl index 62db3d5a98c..56188714b44 100644 --- a/compiler/rustc_codegen_ssa/messages.ftl +++ b/compiler/rustc_codegen_ssa/messages.ftl @@ -201,6 +201,11 @@ codegen_ssa_missing_memory_ordering = Atomic intrinsic missing memory ordering codegen_ssa_missing_query_depgraph = found CGU-reuse attribute but `-Zquery-dep-graph` was not specified +codegen_ssa_mixed_export_name_and_no_mangle = `{$no_mangle_attr}` attribute may not be used in combination with `#[export_name]` + .label = `{$no_mangle_attr}` is ignored + .note = `#[export_name]` takes precedence + .suggestion = remove the `{$no_mangle_attr}` attribute + codegen_ssa_msvc_missing_linker = the msvc targets depend on the msvc linker but `link.exe` was not found codegen_ssa_multiple_external_func_decl = multiple declarations of external function `{$function}` from library `{$library_name}` have different calling conventions diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs index f8b3ba79c0d..35d18d0206d 100644 --- a/compiler/rustc_codegen_ssa/src/back/link.rs +++ b/compiler/rustc_codegen_ssa/src/back/link.rs @@ -2745,6 +2745,15 @@ fn add_upstream_rust_crates( .find(|(ty, _)| *ty == crate_type) .expect("failed to find crate type in dependency format list"); + if sess.target.is_like_aix { + // Unlike ELF linkers, AIX doesn't feature `DT_SONAME` to override + // the dependency name when outputing a shared library. Thus, `ld` will + // use the full path to shared libraries as the dependency if passed it + // by default unless `noipath` is passed. + // https://www.ibm.com/docs/en/aix/7.3?topic=l-ld-command. + cmd.link_or_cc_arg("-bnoipath"); + } + for &cnum in &codegen_results.crate_info.used_crates { // We may not pass all crates through to the linker. Some crates may appear statically in // an existing dylib, meaning we'll pick up all the symbols from the dylib. diff --git a/compiler/rustc_codegen_ssa/src/codegen_attrs.rs b/compiler/rustc_codegen_ssa/src/codegen_attrs.rs index a5acd8170ab..11744eabab0 100644 --- a/compiler/rustc_codegen_ssa/src/codegen_attrs.rs +++ b/compiler/rustc_codegen_ssa/src/codegen_attrs.rs @@ -3,11 +3,10 @@ use rustc_attr::{InlineAttr, InstructionSetAttr, OptimizeAttr, list_contains_nam use rustc_data_structures::fx::FxHashMap; use rustc_errors::codes::*; use rustc_errors::{DiagMessage, SubdiagMessage, struct_span_code_err}; -use rustc_hir as hir; 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::{LangItem, lang_items}; +use rustc_hir::{self as hir, HirId, LangItem, lang_items}; use rustc_middle::middle::codegen_fn_attrs::{ CodegenFnAttrFlags, CodegenFnAttrs, PatchableFunctionEntry, }; @@ -78,6 +77,7 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs { let mut inline_span = None; let mut link_ordinal_span = None; let mut no_sanitize_span = None; + let mut mixed_export_name_no_mangle_lint_state = MixedExportNameAndNoMangleState::default(); for attr in attrs.iter() { // In some cases, attribute are only valid on functions, but it's the `check_attr` @@ -116,7 +116,12 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs { sym::naked => codegen_fn_attrs.flags |= CodegenFnAttrFlags::NAKED, sym::no_mangle => { if tcx.opt_item_name(did.to_def_id()).is_some() { - codegen_fn_attrs.flags |= CodegenFnAttrFlags::NO_MANGLE + codegen_fn_attrs.flags |= CodegenFnAttrFlags::NO_MANGLE; + mixed_export_name_no_mangle_lint_state.track_no_mangle( + attr.span, + tcx.local_def_id_to_hir_id(did), + attr, + ); } else { tcx.dcx() .struct_span_err( @@ -240,6 +245,7 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs { .emit(); } codegen_fn_attrs.export_name = Some(s); + mixed_export_name_no_mangle_lint_state.track_export_name(attr.span); } } sym::target_feature => { @@ -513,6 +519,8 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs { } } + mixed_export_name_no_mangle_lint_state.lint_if_mixed(tcx); + codegen_fn_attrs.inline = attrs.iter().fold(InlineAttr::None, |ia, attr| { if !attr.has_name(sym::inline) { return ia; @@ -779,6 +787,49 @@ fn check_link_name_xor_ordinal( } } +#[derive(Default)] +struct MixedExportNameAndNoMangleState<'a> { + export_name: Option<Span>, + hir_id: Option<HirId>, + no_mangle: Option<Span>, + no_mangle_attr: Option<&'a ast::Attribute>, +} + +impl<'a> MixedExportNameAndNoMangleState<'a> { + fn track_export_name(&mut self, span: Span) { + self.export_name = Some(span); + } + + fn track_no_mangle(&mut self, span: Span, hir_id: HirId, attr_name: &'a ast::Attribute) { + self.no_mangle = Some(span); + self.hir_id = Some(hir_id); + self.no_mangle_attr = Some(attr_name); + } + + /// Emit diagnostics if the lint condition is met. + fn lint_if_mixed(self, tcx: TyCtxt<'_>) { + if let Self { + export_name: Some(export_name), + no_mangle: Some(no_mangle), + hir_id: Some(hir_id), + no_mangle_attr: Some(no_mangle_attr), + } = self + { + tcx.emit_node_span_lint( + lint::builtin::UNUSED_ATTRIBUTES, + hir_id, + no_mangle, + errors::MixedExportNameAndNoMangle { + no_mangle, + no_mangle_attr: rustc_ast_pretty::pprust::attribute_to_string(no_mangle_attr), + export_name, + removal_span: no_mangle, + }, + ); + } + } +} + pub(crate) fn provide(providers: &mut Providers) { *providers = Providers { codegen_fn_attrs, should_inherit_track_caller, ..*providers }; } diff --git a/compiler/rustc_codegen_ssa/src/errors.rs b/compiler/rustc_codegen_ssa/src/errors.rs index f93cb52ea3e..00f8654e670 100644 --- a/compiler/rustc_codegen_ssa/src/errors.rs +++ b/compiler/rustc_codegen_ssa/src/errors.rs @@ -10,7 +10,7 @@ use rustc_errors::codes::*; use rustc_errors::{ Diag, DiagArgValue, DiagCtxtHandle, Diagnostic, EmissionGuarantee, IntoDiagArg, Level, }; -use rustc_macros::{Diagnostic, Subdiagnostic}; +use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic}; use rustc_middle::ty::Ty; use rustc_middle::ty::layout::LayoutError; use rustc_span::{Span, Symbol}; @@ -1114,3 +1114,15 @@ impl<G: EmissionGuarantee> Diagnostic<'_, G> for TargetFeatureDisableOrEnable<'_ #[derive(Diagnostic)] #[diag(codegen_ssa_aix_strip_not_used)] pub(crate) struct AixStripNotUsed; + +#[derive(LintDiagnostic)] +#[diag(codegen_ssa_mixed_export_name_and_no_mangle)] +pub(crate) struct MixedExportNameAndNoMangle { + #[label] + pub no_mangle: Span, + pub no_mangle_attr: String, + #[note] + pub export_name: Span, + #[suggestion(style = "verbose", code = "", applicability = "machine-applicable")] + pub removal_span: Span, +} diff --git a/compiler/rustc_const_eval/src/const_eval/error.rs b/compiler/rustc_const_eval/src/const_eval/error.rs index 3cb77d1dcb5..fee7287951d 100644 --- a/compiler/rustc_const_eval/src/const_eval/error.rs +++ b/compiler/rustc_const_eval/src/const_eval/error.rs @@ -170,7 +170,7 @@ where let reported = if allowed_in_infallible { ReportedErrorInfo::allowed_in_infallible(g) } else { - ReportedErrorInfo::from(g) + ReportedErrorInfo::const_eval_error(g) }; ErrorHandled::Reported(reported, span) } diff --git a/compiler/rustc_const_eval/src/const_eval/eval_queries.rs b/compiler/rustc_const_eval/src/const_eval/eval_queries.rs index 647d880e2bf..ce8eceebdf8 100644 --- a/compiler/rustc_const_eval/src/const_eval/eval_queries.rs +++ b/compiler/rustc_const_eval/src/const_eval/eval_queries.rs @@ -3,13 +3,13 @@ use std::sync::atomic::Ordering::Relaxed; use either::{Left, Right}; use rustc_abi::{self as abi, BackendRepr}; use rustc_hir::def::DefKind; -use rustc_middle::bug; -use rustc_middle::mir::interpret::{AllocId, ErrorHandled, InterpErrorInfo}; +use rustc_middle::mir::interpret::{AllocId, ErrorHandled, InterpErrorInfo, ReportedErrorInfo}; use rustc_middle::mir::{self, ConstAlloc, ConstValue}; use rustc_middle::query::TyCtxtAt; use rustc_middle::ty::layout::{HasTypingEnv, LayoutOf}; use rustc_middle::ty::print::with_no_trimmed_paths; use rustc_middle::ty::{self, Ty, TyCtxt}; +use rustc_middle::{bug, throw_inval}; use rustc_span::def_id::LocalDefId; use rustc_span::{DUMMY_SP, Span}; use tracing::{debug, instrument, trace}; @@ -93,18 +93,18 @@ fn eval_body_using_ecx<'tcx, R: InterpretationResult<'tcx>>( match intern_result { Ok(()) => {} Err(InternResult::FoundDanglingPointer) => { - return Err(ecx - .tcx - .dcx() - .emit_err(errors::DanglingPtrInFinal { span: ecx.tcx.span, kind: intern_kind })) - .into(); + throw_inval!(AlreadyReported(ReportedErrorInfo::non_const_eval_error( + ecx.tcx + .dcx() + .emit_err(errors::DanglingPtrInFinal { span: ecx.tcx.span, kind: intern_kind }), + ))); } Err(InternResult::FoundBadMutablePointer) => { - return Err(ecx - .tcx - .dcx() - .emit_err(errors::MutablePtrInFinal { span: ecx.tcx.span, kind: intern_kind })) - .into(); + throw_inval!(AlreadyReported(ReportedErrorInfo::non_const_eval_error( + ecx.tcx + .dcx() + .emit_err(errors::MutablePtrInFinal { span: ecx.tcx.span, kind: intern_kind }), + ))); } } diff --git a/compiler/rustc_const_eval/src/const_eval/machine.rs b/compiler/rustc_const_eval/src/const_eval/machine.rs index 11e0fac51d8..56325eaa1be 100644 --- a/compiler/rustc_const_eval/src/const_eval/machine.rs +++ b/compiler/rustc_const_eval/src/const_eval/machine.rs @@ -8,6 +8,7 @@ use rustc_data_structures::fx::{FxHashMap, FxIndexMap, IndexEntry}; use rustc_hir::def_id::{DefId, LocalDefId}; use rustc_hir::{self as hir, CRATE_HIR_ID, LangItem}; use rustc_middle::mir::AssertMessage; +use rustc_middle::mir::interpret::ReportedErrorInfo; use rustc_middle::query::TyCtxtAt; use rustc_middle::ty::layout::{HasTypingEnv, TyAndLayout}; use rustc_middle::ty::{self, Ty, TyCtxt}; @@ -563,7 +564,7 @@ impl<'tcx> interpret::Machine<'tcx> for CompileTimeMachine<'tcx> { .tcx .dcx() .span_delayed_bug(span, "The deny lint should have already errored"); - throw_inval!(AlreadyReported(guard.into())); + throw_inval!(AlreadyReported(ReportedErrorInfo::allowed_in_infallible(guard))); } } else if new_steps > start && new_steps.is_power_of_two() { // Only report after a certain number of terminators have been evaluated and the diff --git a/compiler/rustc_const_eval/src/const_eval/valtrees.rs b/compiler/rustc_const_eval/src/const_eval/valtrees.rs index 515028e6826..6f51b09323d 100644 --- a/compiler/rustc_const_eval/src/const_eval/valtrees.rs +++ b/compiler/rustc_const_eval/src/const_eval/valtrees.rs @@ -1,6 +1,6 @@ use rustc_abi::{BackendRepr, VariantIdx}; use rustc_data_structures::stack::ensure_sufficient_stack; -use rustc_middle::mir::interpret::{EvalToValTreeResult, GlobalId}; +use rustc_middle::mir::interpret::{EvalToValTreeResult, GlobalId, ReportedErrorInfo}; use rustc_middle::ty::layout::{LayoutCx, LayoutOf, TyAndLayout}; use rustc_middle::ty::{self, ScalarInt, Ty, TyCtxt}; use rustc_middle::{bug, mir}; @@ -261,7 +261,7 @@ pub(crate) fn eval_to_valtree<'tcx>( ValTreeCreationError::NodesOverflow => { let handled = tcx.dcx().emit_err(MaxNumNodesInConstErr { span, global_const_id }); - Err(handled.into()) + Err(ReportedErrorInfo::allowed_in_infallible(handled).into()) } ValTreeCreationError::NonSupportedType(ty) => Ok(Err(ty)), } diff --git a/compiler/rustc_const_eval/src/interpret/eval_context.rs b/compiler/rustc_const_eval/src/interpret/eval_context.rs index 241be5e175c..95a72d3cbc1 100644 --- a/compiler/rustc_const_eval/src/interpret/eval_context.rs +++ b/compiler/rustc_const_eval/src/interpret/eval_context.rs @@ -268,7 +268,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> { }; // do not continue if typeck errors occurred (can only occur in local crate) if let Some(err) = body.tainted_by_errors { - throw_inval!(AlreadyReported(ReportedErrorInfo::from(err))); + throw_inval!(AlreadyReported(ReportedErrorInfo::non_const_eval_error(err))); } interp_ok(body) } @@ -317,7 +317,9 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> { Ok(None) => throw_inval!(TooGeneric), // FIXME(eddyb) this could be a bit more specific than `AlreadyReported`. - Err(error_reported) => throw_inval!(AlreadyReported(error_reported.into())), + Err(error_guaranteed) => throw_inval!(AlreadyReported( + ReportedErrorInfo::non_const_eval_error(error_guaranteed) + )), } } diff --git a/compiler/rustc_const_eval/src/interpret/place.rs b/compiler/rustc_const_eval/src/interpret/place.rs index f54a932e1b6..810e9356b26 100644 --- a/compiler/rustc_const_eval/src/interpret/place.rs +++ b/compiler/rustc_const_eval/src/interpret/place.rs @@ -5,8 +5,7 @@ use std::assert_matches::assert_matches; use either::{Either, Left, Right}; -use rustc_abi::{Align, BackendRepr, HasDataLayout, Size}; -use rustc_ast::Mutability; +use rustc_abi::{BackendRepr, HasDataLayout, Size}; use rustc_middle::ty::Ty; use rustc_middle::ty::layout::{LayoutOf, TyAndLayout}; use rustc_middle::{bug, mir, span_bug}; @@ -1018,40 +1017,31 @@ where self.allocate_dyn(layout, kind, MemPlaceMeta::None) } - /// Allocates a sequence of bytes in the interpreter's memory. - /// For immutable allocations, uses deduplication to reuse existing memory. - /// For mutable allocations, creates a new unique allocation. - pub fn allocate_bytes( + /// Allocates a sequence of bytes in the interpreter's memory with alignment 1. + /// This is allocated in immutable global memory and deduplicated. + pub fn allocate_bytes_dedup( &mut self, bytes: &[u8], - align: Align, - kind: MemoryKind<M::MemoryKind>, - mutbl: Mutability, ) -> InterpResult<'tcx, Pointer<M::Provenance>> { - // Use cache for immutable strings. - if mutbl.is_not() { - // Use dedup'd allocation function. - let salt = M::get_global_alloc_salt(self, None); - let id = self.tcx.allocate_bytes_dedup(bytes, salt); - - // Turn untagged "global" pointers (obtained via `tcx`) into the machine pointer to the allocation. - M::adjust_alloc_root_pointer(&self, Pointer::from(id), Some(kind)) - } else { - // Allocate new memory for mutable data. - self.allocate_bytes_ptr(bytes, align, kind, mutbl) - } + let salt = M::get_global_alloc_salt(self, None); + let id = self.tcx.allocate_bytes_dedup(bytes, salt); + + // Turn untagged "global" pointers (obtained via `tcx`) into the machine pointer to the allocation. + M::adjust_alloc_root_pointer( + &self, + Pointer::from(id), + M::GLOBAL_KIND.map(MemoryKind::Machine), + ) } - /// Allocates a string in the interpreter's memory with metadata for length. - /// Uses `allocate_bytes` internally but adds string-specific metadata handling. - pub fn allocate_str( + /// Allocates a string in the interpreter's memory, returning it as a (wide) place. + /// This is allocated in immutable global memory and deduplicated. + pub fn allocate_str_dedup( &mut self, str: &str, - kind: MemoryKind<M::MemoryKind>, - mutbl: Mutability, ) -> InterpResult<'tcx, MPlaceTy<'tcx, M::Provenance>> { let bytes = str.as_bytes(); - let ptr = self.allocate_bytes(bytes, Align::ONE, kind, mutbl)?; + let ptr = self.allocate_bytes_dedup(bytes)?; // Create length metadata for the string. let meta = Scalar::from_target_usize(u64::try_from(bytes.len()).unwrap(), self); diff --git a/compiler/rustc_const_eval/src/util/caller_location.rs b/compiler/rustc_const_eval/src/util/caller_location.rs index 9bf16d4fe16..6593547cd23 100644 --- a/compiler/rustc_const_eval/src/util/caller_location.rs +++ b/compiler/rustc_const_eval/src/util/caller_location.rs @@ -1,7 +1,7 @@ use rustc_hir::LangItem; use rustc_middle::query::TyCtxtAt; use rustc_middle::ty::layout::LayoutOf; -use rustc_middle::ty::{self, Mutability}; +use rustc_middle::ty::{self}; use rustc_middle::{bug, mir}; use rustc_span::symbol::Symbol; use tracing::trace; @@ -20,12 +20,9 @@ fn alloc_caller_location<'tcx>( // This can fail if rustc runs out of memory right here. Trying to emit an error would be // pointless, since that would require allocating more memory than these short strings. let file = if loc_details.file { - ecx.allocate_str(filename.as_str(), MemoryKind::CallerLocation, Mutability::Not).unwrap() + ecx.allocate_str_dedup(filename.as_str()).unwrap() } else { - // FIXME: This creates a new allocation each time. It might be preferable to - // perform this allocation only once, and re-use the `MPlaceTy`. - // See https://github.com/rust-lang/rust/pull/89920#discussion_r730012398 - ecx.allocate_str("<redacted>", MemoryKind::CallerLocation, Mutability::Not).unwrap() + ecx.allocate_str_dedup("<redacted>").unwrap() }; let file = file.map_provenance(CtfeProvenance::as_immutable); let line = if loc_details.line { Scalar::from_u32(line) } else { Scalar::from_u32(0) }; diff --git a/compiler/rustc_expand/src/placeholders.rs b/compiler/rustc_expand/src/placeholders.rs index f044d964f13..9e459bd81a1 100644 --- a/compiler/rustc_expand/src/placeholders.rs +++ b/compiler/rustc_expand/src/placeholders.rs @@ -174,6 +174,7 @@ pub(crate) fn placeholder( vis, is_placeholder: true, safety: Safety::Default, + default: None, }]), AstFragmentKind::Variants => AstFragment::Variants(smallvec![ast::Variant { attrs: Default::default(), diff --git a/compiler/rustc_feature/src/unstable.rs b/compiler/rustc_feature/src/unstable.rs index bf26b5d25d2..93a605e197c 100644 --- a/compiler/rustc_feature/src/unstable.rs +++ b/compiler/rustc_feature/src/unstable.rs @@ -455,6 +455,9 @@ declare_features! ( (unstable, custom_test_frameworks, "1.30.0", Some(50297)), /// Allows declarative macros 2.0 (`macro`). (unstable, decl_macro, "1.17.0", Some(39412)), + /// Allows the use of default values on struct definitions and the construction of struct + /// literals with the functional update syntax without a base. + (unstable, default_field_values, "CURRENT_RUSTC_VERSION", Some(132162)), /// Allows using `#[deprecated_safe]` to deprecate the safeness of a function or trait (unstable, deprecated_safe, "1.61.0", Some(94978)), /// Allows having using `suggestion` in the `#[deprecated]` attribute. diff --git a/compiler/rustc_hir/src/hir.rs b/compiler/rustc_hir/src/hir.rs index a9696627f11..365e4cbb556 100644 --- a/compiler/rustc_hir/src/hir.rs +++ b/compiler/rustc_hir/src/hir.rs @@ -1857,7 +1857,12 @@ impl Expr<'_> { base.can_have_side_effects() } ExprKind::Struct(_, fields, init) => { - fields.iter().map(|field| field.expr).chain(init).any(|e| e.can_have_side_effects()) + let init_side_effects = match init { + StructTailExpr::Base(init) => init.can_have_side_effects(), + StructTailExpr::DefaultFields(_) | StructTailExpr::None => false, + }; + fields.iter().map(|field| field.expr).any(|e| e.can_have_side_effects()) + || init_side_effects } ExprKind::Array(args) @@ -1926,20 +1931,52 @@ impl Expr<'_> { ExprKind::Path(QPath::Resolved(None, path2)), ) => path1.res == path2.res, ( - ExprKind::Struct(QPath::LangItem(LangItem::RangeTo, _), [val1], None), - ExprKind::Struct(QPath::LangItem(LangItem::RangeTo, _), [val2], None), + ExprKind::Struct( + QPath::LangItem(LangItem::RangeTo, _), + [val1], + StructTailExpr::None, + ), + ExprKind::Struct( + QPath::LangItem(LangItem::RangeTo, _), + [val2], + StructTailExpr::None, + ), ) | ( - ExprKind::Struct(QPath::LangItem(LangItem::RangeToInclusive, _), [val1], None), - ExprKind::Struct(QPath::LangItem(LangItem::RangeToInclusive, _), [val2], None), + ExprKind::Struct( + QPath::LangItem(LangItem::RangeToInclusive, _), + [val1], + StructTailExpr::None, + ), + ExprKind::Struct( + QPath::LangItem(LangItem::RangeToInclusive, _), + [val2], + StructTailExpr::None, + ), ) | ( - ExprKind::Struct(QPath::LangItem(LangItem::RangeFrom, _), [val1], None), - ExprKind::Struct(QPath::LangItem(LangItem::RangeFrom, _), [val2], None), + ExprKind::Struct( + QPath::LangItem(LangItem::RangeFrom, _), + [val1], + StructTailExpr::None, + ), + ExprKind::Struct( + QPath::LangItem(LangItem::RangeFrom, _), + [val2], + StructTailExpr::None, + ), ) => val1.expr.equivalent_for_indexing(val2.expr), ( - ExprKind::Struct(QPath::LangItem(LangItem::Range, _), [val1, val3], None), - ExprKind::Struct(QPath::LangItem(LangItem::Range, _), [val2, val4], None), + ExprKind::Struct( + QPath::LangItem(LangItem::Range, _), + [val1, val3], + StructTailExpr::None, + ), + ExprKind::Struct( + QPath::LangItem(LangItem::Range, _), + [val2, val4], + StructTailExpr::None, + ), ) => { val1.expr.equivalent_for_indexing(val2.expr) && val3.expr.equivalent_for_indexing(val4.expr) @@ -2096,7 +2133,7 @@ pub enum ExprKind<'hir> { /// /// E.g., `Foo {x: 1, y: 2}`, or `Foo {x: 1, .. base}`, /// where `base` is the `Option<Expr>`. - Struct(&'hir QPath<'hir>, &'hir [ExprField<'hir>], Option<&'hir Expr<'hir>>), + Struct(&'hir QPath<'hir>, &'hir [ExprField<'hir>], StructTailExpr<'hir>), /// An array literal constructed from one repeated element. /// @@ -2111,6 +2148,19 @@ pub enum ExprKind<'hir> { Err(rustc_span::ErrorGuaranteed), } +#[derive(Debug, Clone, Copy, HashStable_Generic)] +pub enum StructTailExpr<'hir> { + /// A struct expression where all the fields are explicitly enumerated: `Foo { a, b }`. + None, + /// A struct expression with a "base", an expression of the same type as the outer struct that + /// will be used to populate any fields not explicitly mentioned: `Foo { ..base }` + Base(&'hir Expr<'hir>), + /// A struct expression with a `..` tail but no "base" expression. The values from the struct + /// fields' default values will be used to populate any fields not explicitly mentioned: + /// `Foo { .. }`. + DefaultFields(Span), +} + /// Represents an optionally `Self`-qualified value/type path or associated extension. /// /// To resolve the path to a `DefId`, call [`qpath_res`]. @@ -3172,6 +3222,7 @@ pub struct FieldDef<'hir> { pub def_id: LocalDefId, pub ty: &'hir Ty<'hir>, pub safety: Safety, + pub default: Option<&'hir AnonConst>, } impl FieldDef<'_> { diff --git a/compiler/rustc_hir/src/intravisit.rs b/compiler/rustc_hir/src/intravisit.rs index 602aa8be740..9abb0870bf0 100644 --- a/compiler/rustc_hir/src/intravisit.rs +++ b/compiler/rustc_hir/src/intravisit.rs @@ -748,7 +748,10 @@ pub fn walk_expr<'v, V: Visitor<'v>>(visitor: &mut V, expression: &'v Expr<'v>) ExprKind::Struct(ref qpath, fields, ref optional_base) => { try_visit!(visitor.visit_qpath(qpath, expression.hir_id, expression.span)); walk_list!(visitor, visit_expr_field, fields); - visit_opt!(visitor, visit_expr, optional_base); + match optional_base { + StructTailExpr::Base(base) => try_visit!(visitor.visit_expr(base)), + StructTailExpr::None | StructTailExpr::DefaultFields(_) => {} + } } ExprKind::Tup(subexpressions) => { walk_list!(visitor, visit_expr, subexpressions); @@ -1190,10 +1193,14 @@ pub fn walk_struct_def<'v, V: Visitor<'v>>( V::Result::output() } -pub fn walk_field_def<'v, V: Visitor<'v>>(visitor: &mut V, field: &'v FieldDef<'v>) -> V::Result { - try_visit!(visitor.visit_id(field.hir_id)); - try_visit!(visitor.visit_ident(field.ident)); - visitor.visit_ty(field.ty) +pub fn walk_field_def<'v, V: Visitor<'v>>( + visitor: &mut V, + FieldDef { hir_id, ident, ty, default, span: _, vis_span: _, def_id: _, safety: _ }: &'v FieldDef<'v>, +) -> V::Result { + try_visit!(visitor.visit_id(*hir_id)); + try_visit!(visitor.visit_ident(*ident)); + visit_opt!(visitor, visit_anon_const, default); + visitor.visit_ty(*ty) } pub fn walk_enum_def<'v, V: Visitor<'v>>( diff --git a/compiler/rustc_hir_analysis/messages.ftl b/compiler/rustc_hir_analysis/messages.ftl index 070d63b48b7..32498d9c5ab 100644 --- a/compiler/rustc_hir_analysis/messages.ftl +++ b/compiler/rustc_hir_analysis/messages.ftl @@ -96,12 +96,14 @@ hir_analysis_coercion_between_struct_same_note = expected coercion between the s hir_analysis_coercion_between_struct_single_note = expected a single field to be coerced, none found -hir_analysis_const_bound_for_non_const_trait = - `{$modifier}` can only be applied to `#[const_trait]` traits - -hir_analysis_const_impl_for_non_const_trait = - const `impl` for trait `{$trait_name}` which is not marked with `#[const_trait]` - .suggestion = mark `{$trait_name}` as const +hir_analysis_const_bound_for_non_const_trait = `{$modifier}` can only be applied to `#[const_trait]` traits + .label = can't be applied to `{$trait_name}` + .note = `{$trait_name}` can't be used with `{$modifier}` because it isn't annotated with `#[const_trait]` + .suggestion = {$suggestion_pre}mark `{$trait_name}` as `#[const_trait]` to allow it to have `const` implementations + +hir_analysis_const_impl_for_non_const_trait = const `impl` for trait `{$trait_name}` which is not marked with `#[const_trait]` + .label = this trait is not `const` + .suggestion = {$suggestion_pre}mark `{$trait_name}` as `#[const_trait]` to allow it to have `const` implementations .note = marking a trait with `#[const_trait]` ensures all default method bodies are `const` .adding = adding a non-const method body in the future would be a breaking change diff --git a/compiler/rustc_hir_analysis/src/check/wfcheck.rs b/compiler/rustc_hir_analysis/src/check/wfcheck.rs index 2b33da3c49a..c9773972d9a 100644 --- a/compiler/rustc_hir_analysis/src/check/wfcheck.rs +++ b/compiler/rustc_hir_analysis/src/check/wfcheck.rs @@ -1104,6 +1104,25 @@ fn check_type_defn<'tcx>( for variant in variants.iter() { // All field types must be well-formed. for field in &variant.fields { + if let Some(def_id) = field.value + && let Some(_ty) = tcx.type_of(def_id).no_bound_vars() + { + // FIXME(generic_const_exprs, default_field_values): this is a hack and needs to + // be refactored to check the instantiate-ability of the code better. + if let Some(def_id) = def_id.as_local() + && let hir::Node::AnonConst(anon) = tcx.hir_node_by_def_id(def_id) + && let expr = &tcx.hir().body(anon.body).value + && let hir::ExprKind::Path(hir::QPath::Resolved(None, path)) = expr.kind + && let Res::Def(DefKind::ConstParam, _def_id) = path.res + { + // Do not evaluate bare `const` params, as those would ICE and are only + // usable if `#![feature(generic_const_exprs)]` is enabled. + } else { + // Evaluate the constant proactively, to emit an error if the constant has + // an unconditional error. We only do so if the const has no type params. + let _ = tcx.const_eval_poly(def_id.into()); + } + } let field_id = field.did.expect_local(); let hir::FieldDef { ty: hir_ty, .. } = tcx.hir_node_by_def_id(field_id).expect_field(); diff --git a/compiler/rustc_hir_analysis/src/coherence/builtin.rs b/compiler/rustc_hir_analysis/src/coherence/builtin.rs index 3b49bc41ffe..2eea65125b0 100644 --- a/compiler/rustc_hir_analysis/src/coherence/builtin.rs +++ b/compiler/rustc_hir_analysis/src/coherence/builtin.rs @@ -103,7 +103,7 @@ fn visit_implementation_of_copy(checker: &Checker<'_>) -> Result<(), ErrorGuaran } let cause = traits::ObligationCause::misc(DUMMY_SP, impl_did); - match type_allowed_to_implement_copy(tcx, param_env, self_type, cause) { + match type_allowed_to_implement_copy(tcx, param_env, self_type, cause, impl_header.safety) { Ok(()) => Ok(()), Err(CopyImplementationError::InfringingFields(fields)) => { let span = tcx.hir().expect_item(impl_did).expect_impl().self_ty.span; @@ -123,6 +123,12 @@ fn visit_implementation_of_copy(checker: &Checker<'_>) -> Result<(), ErrorGuaran let span = tcx.hir().expect_item(impl_did).expect_impl().self_ty.span; Err(tcx.dcx().emit_err(errors::CopyImplOnTypeWithDtor { span })) } + Err(CopyImplementationError::HasUnsafeFields) => { + let span = tcx.hir().expect_item(impl_did).expect_impl().self_ty.span; + Err(tcx + .dcx() + .span_delayed_bug(span, format!("cannot implement `Copy` for `{}`", self_type))) + } } } diff --git a/compiler/rustc_hir_analysis/src/coherence/unsafety.rs b/compiler/rustc_hir_analysis/src/coherence/unsafety.rs index d66114a50d7..86839e40330 100644 --- a/compiler/rustc_hir_analysis/src/coherence/unsafety.rs +++ b/compiler/rustc_hir_analysis/src/coherence/unsafety.rs @@ -3,7 +3,7 @@ use rustc_errors::codes::*; use rustc_errors::struct_span_code_err; -use rustc_hir::Safety; +use rustc_hir::{LangItem, Safety}; use rustc_middle::ty::ImplPolarity::*; use rustc_middle::ty::print::PrintTraitRefExt as _; use rustc_middle::ty::{ImplTraitHeader, TraitDef, TyCtxt}; @@ -20,7 +20,19 @@ pub(super) fn check_item( tcx.generics_of(def_id).own_params.iter().find(|p| p.pure_wrt_drop).map(|_| "may_dangle"); let trait_ref = trait_header.trait_ref.instantiate_identity(); - match (trait_def.safety, unsafe_attr, trait_header.safety, trait_header.polarity) { + let is_copy = tcx.is_lang_item(trait_def.def_id, LangItem::Copy); + let trait_def_safety = if is_copy { + // If `Self` has unsafe fields, `Copy` is unsafe to implement. + if trait_header.trait_ref.skip_binder().self_ty().has_unsafe_fields() { + rustc_hir::Safety::Unsafe + } else { + rustc_hir::Safety::Safe + } + } else { + trait_def.safety + }; + + match (trait_def_safety, unsafe_attr, trait_header.safety, trait_header.polarity) { (Safety::Safe, None, Safety::Unsafe, Positive | Reservation) => { let span = tcx.def_span(def_id); return Err(struct_span_code_err!( @@ -48,12 +60,22 @@ pub(super) fn check_item( "the trait `{}` requires an `unsafe impl` declaration", trait_ref.print_trait_sugared() ) - .with_note(format!( - "the trait `{}` enforces invariants that the compiler can't check. \ - Review the trait documentation and make sure this implementation \ - upholds those invariants before adding the `unsafe` keyword", - trait_ref.print_trait_sugared() - )) + .with_note(if is_copy { + format!( + "the trait `{}` cannot be safely implemented for `{}` \ + because it has unsafe fields. Review the invariants \ + of those fields before adding an `unsafe impl`", + trait_ref.print_trait_sugared(), + trait_ref.self_ty(), + ) + } else { + format!( + "the trait `{}` enforces invariants that the compiler can't check. \ + Review the trait documentation and make sure this implementation \ + upholds those invariants before adding the `unsafe` keyword", + trait_ref.print_trait_sugared() + ) + }) .with_span_suggestion_verbose( span.shrink_to_lo(), "add `unsafe` to this trait implementation", diff --git a/compiler/rustc_hir_analysis/src/collect.rs b/compiler/rustc_hir_analysis/src/collect.rs index a4636da3f62..96d2714252a 100644 --- a/compiler/rustc_hir_analysis/src/collect.rs +++ b/compiler/rustc_hir_analysis/src/collect.rs @@ -1021,12 +1021,12 @@ impl<'tcx> FieldUniquenessCheckContext<'tcx> { } } -fn lower_variant( - tcx: TyCtxt<'_>, +fn lower_variant<'tcx>( + tcx: TyCtxt<'tcx>, variant_did: Option<LocalDefId>, ident: Ident, discr: ty::VariantDiscr, - def: &hir::VariantData<'_>, + def: &hir::VariantData<'tcx>, adt_kind: ty::AdtKind, parent_did: LocalDefId, ) -> ty::VariantDef { @@ -1042,6 +1042,7 @@ fn lower_variant( name: f.ident.name, vis: tcx.visibility(f.def_id), safety: f.safety, + value: f.default.map(|v| v.def_id.to_def_id()), }) .collect(); let recovered = match def { @@ -1637,11 +1638,23 @@ fn check_impl_constness( } let trait_name = tcx.item_name(trait_def_id).to_string(); + let (local_trait_span, suggestion_pre) = + match (trait_def_id.is_local(), tcx.sess.is_nightly_build()) { + (true, true) => ( + Some(tcx.def_span(trait_def_id).shrink_to_lo()), + if tcx.features().const_trait_impl() { + "" + } else { + "enable `#![feature(const_trait_impl)]` in your crate and " + }, + ), + (false, _) | (_, false) => (None, ""), + }; Some(tcx.dcx().emit_err(errors::ConstImplForNonConstTrait { trait_ref_span: hir_trait_ref.path.span, trait_name, - local_trait_span: - trait_def_id.as_local().map(|_| tcx.def_span(trait_def_id).shrink_to_lo()), + local_trait_span, + suggestion_pre, marking: (), adding: (), })) diff --git a/compiler/rustc_hir_analysis/src/collect/type_of.rs b/compiler/rustc_hir_analysis/src/collect/type_of.rs index 72d5b3ac4f5..5595504c3d9 100644 --- a/compiler/rustc_hir_analysis/src/collect/type_of.rs +++ b/compiler/rustc_hir_analysis/src/collect/type_of.rs @@ -125,6 +125,12 @@ fn anon_const_type_of<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) -> Ty<'tcx> { return ty; } + Node::Field(&hir::FieldDef { default: Some(c), def_id: field_def_id, .. }) + if c.hir_id == hir_id => + { + tcx.type_of(field_def_id).instantiate_identity() + } + _ => Ty::new_error_with_message( tcx, span, diff --git a/compiler/rustc_hir_analysis/src/errors.rs b/compiler/rustc_hir_analysis/src/errors.rs index 4142dcff226..7f62ccc91f0 100644 --- a/compiler/rustc_hir_analysis/src/errors.rs +++ b/compiler/rustc_hir_analysis/src/errors.rs @@ -530,10 +530,16 @@ pub(crate) struct GenericArgsOnOverriddenImpl { #[diag(hir_analysis_const_impl_for_non_const_trait)] pub(crate) struct ConstImplForNonConstTrait { #[primary_span] + #[label] pub trait_ref_span: Span, pub trait_name: String, - #[suggestion(applicability = "machine-applicable", code = "#[const_trait]")] + #[suggestion( + applicability = "machine-applicable", + code = "#[const_trait] ", + style = "verbose" + )] pub local_trait_span: Option<Span>, + pub suggestion_pre: &'static str, #[note] pub marking: (), #[note(hir_analysis_adding)] @@ -544,8 +550,19 @@ pub(crate) struct ConstImplForNonConstTrait { #[diag(hir_analysis_const_bound_for_non_const_trait)] pub(crate) struct ConstBoundForNonConstTrait { #[primary_span] + #[label] pub span: Span, pub modifier: &'static str, + #[note] + pub def_span: Option<Span>, + pub suggestion_pre: &'static str, + #[suggestion( + applicability = "machine-applicable", + code = "#[const_trait] ", + style = "verbose" + )] + pub suggestion: Option<Span>, + pub trait_name: String, } #[derive(Diagnostic)] diff --git a/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs b/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs index 3313339abb3..09e46517cea 100644 --- a/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs +++ b/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs @@ -737,9 +737,26 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { if let hir::BoundConstness::Always(span) | hir::BoundConstness::Maybe(span) = constness && !self.tcx().is_const_trait(trait_def_id) { + let (def_span, suggestion, suggestion_pre) = + match (trait_def_id.is_local(), self.tcx().sess.is_nightly_build()) { + (true, true) => ( + None, + Some(tcx.def_span(trait_def_id).shrink_to_lo()), + if self.tcx().features().const_trait_impl() { + "" + } else { + "enable `#![feature(const_trait_impl)]` in your crate and " + }, + ), + (false, _) | (_, false) => (Some(tcx.def_span(trait_def_id)), None, ""), + }; self.dcx().emit_err(crate::errors::ConstBoundForNonConstTrait { span, modifier: constness.as_str(), + def_span, + trait_name: self.tcx().def_path_str(trait_def_id), + suggestion_pre, + suggestion, }); } diff --git a/compiler/rustc_hir_pretty/src/lib.rs b/compiler/rustc_hir_pretty/src/lib.rs index 0f3dcebc092..a74e36c45c6 100644 --- a/compiler/rustc_hir_pretty/src/lib.rs +++ b/compiler/rustc_hir_pretty/src/lib.rs @@ -1080,22 +1080,36 @@ impl<'a> State<'a> { &mut self, qpath: &hir::QPath<'_>, fields: &[hir::ExprField<'_>], - wth: Option<&hir::Expr<'_>>, + wth: hir::StructTailExpr<'_>, ) { self.print_qpath(qpath, true); self.word("{"); self.commasep_cmnt(Consistent, fields, |s, field| s.print_expr_field(field), |f| f.span); - if let Some(expr) = wth { - self.ibox(INDENT_UNIT); - if !fields.is_empty() { - self.word(","); - self.space(); + match wth { + hir::StructTailExpr::Base(expr) => { + self.ibox(INDENT_UNIT); + if !fields.is_empty() { + self.word(","); + self.space(); + } + self.word(".."); + self.print_expr(expr); + self.end(); + } + hir::StructTailExpr::DefaultFields(_) => { + self.ibox(INDENT_UNIT); + if !fields.is_empty() { + self.word(","); + self.space(); + } + self.word(".."); + self.end(); + } + hir::StructTailExpr::None => { + if !fields.is_empty() { + self.word(","); + } } - self.word(".."); - self.print_expr(expr); - self.end(); - } else if !fields.is_empty() { - self.word(","); } self.word("}"); diff --git a/compiler/rustc_hir_typeck/messages.ftl b/compiler/rustc_hir_typeck/messages.ftl index b27f7215ae4..a93da52b270 100644 --- a/compiler/rustc_hir_typeck/messages.ftl +++ b/compiler/rustc_hir_typeck/messages.ftl @@ -10,6 +10,12 @@ hir_typeck_address_of_temporary_taken = cannot take address of a temporary hir_typeck_arg_mismatch_indeterminate = argument type mismatch was detected, but rustc had trouble determining where .note = we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new +hir_typeck_base_expression_double_dot = base expression required after `..` +hir_typeck_base_expression_double_dot_add_expr = add a base expression here +hir_typeck_base_expression_double_dot_enable_default_field_values = + add `#![feature(default_field_values)]` to the crate attributes to enable default values on `struct` fields +hir_typeck_base_expression_double_dot_remove = remove the `..` as all the fields are already present + hir_typeck_candidate_trait_note = `{$trait_name}` defines an item `{$item_name}`{$action_or_ty -> [NONE] {""} [implement] , perhaps you need to implement it diff --git a/compiler/rustc_hir_typeck/src/closure.rs b/compiler/rustc_hir_typeck/src/closure.rs index e715a7f7e15..9037caf0066 100644 --- a/compiler/rustc_hir_typeck/src/closure.rs +++ b/compiler/rustc_hir_typeck/src/closure.rs @@ -454,20 +454,16 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { closure_kind: hir::ClosureKind, projection: ty::PolyProjectionPredicate<'tcx>, ) -> Option<ExpectedSig<'tcx>> { - let tcx = self.tcx; - - let trait_def_id = projection.trait_def_id(tcx); + let def_id = projection.projection_def_id(); // For now, we only do signature deduction based off of the `Fn` and `AsyncFn` traits, // for closures and async closures, respectively. match closure_kind { - hir::ClosureKind::Closure - if self.tcx.fn_trait_kind_from_def_id(trait_def_id).is_some() => - { + hir::ClosureKind::Closure if self.tcx.is_lang_item(def_id, LangItem::FnOnceOutput) => { self.extract_sig_from_projection(cause_span, projection) } hir::ClosureKind::CoroutineClosure(hir::CoroutineDesugaring::Async) - if self.tcx.async_fn_trait_kind_from_def_id(trait_def_id).is_some() => + if self.tcx.is_lang_item(def_id, LangItem::AsyncFnOnceOutput) => { self.extract_sig_from_projection(cause_span, projection) } @@ -475,7 +471,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // `F: FnOnce() -> Fut, Fut: Future<Output = T>` style bound. Let's still // guide inference here, since it's beneficial for the user. hir::ClosureKind::CoroutineClosure(hir::CoroutineDesugaring::Async) - if self.tcx.fn_trait_kind_from_def_id(trait_def_id).is_some() => + if self.tcx.is_lang_item(def_id, LangItem::FnOnceOutput) => { self.extract_sig_from_projection_and_future_bound(cause_span, projection) } diff --git a/compiler/rustc_hir_typeck/src/errors.rs b/compiler/rustc_hir_typeck/src/errors.rs index a2e00859307..7746a5a7132 100644 --- a/compiler/rustc_hir_typeck/src/errors.rs +++ b/compiler/rustc_hir_typeck/src/errors.rs @@ -16,6 +16,47 @@ use rustc_span::{Span, Symbol}; use crate::fluent_generated as fluent; #[derive(Diagnostic)] +#[diag(hir_typeck_base_expression_double_dot, code = E0797)] +pub(crate) struct BaseExpressionDoubleDot { + #[primary_span] + pub span: Span, + #[subdiagnostic] + pub default_field_values: Option<BaseExpressionDoubleDotEnableDefaultFieldValues>, + #[subdiagnostic] + pub add_expr: Option<BaseExpressionDoubleDotAddExpr>, + #[subdiagnostic] + pub remove_dots: Option<BaseExpressionDoubleDotRemove>, +} + +#[derive(Subdiagnostic)] +#[suggestion( + hir_typeck_base_expression_double_dot_remove, + code = "", + applicability = "machine-applicable", + style = "verbose" +)] +pub(crate) struct BaseExpressionDoubleDotRemove { + #[primary_span] + pub span: Span, +} + +#[derive(Subdiagnostic)] +#[suggestion( + hir_typeck_base_expression_double_dot_add_expr, + code = "/* expr */", + applicability = "has-placeholders", + style = "verbose" +)] +pub(crate) struct BaseExpressionDoubleDotAddExpr { + #[primary_span] + pub span: Span, +} + +#[derive(Subdiagnostic)] +#[help(hir_typeck_base_expression_double_dot_enable_default_field_values)] +pub(crate) struct BaseExpressionDoubleDotEnableDefaultFieldValues; + +#[derive(Diagnostic)] #[diag(hir_typeck_field_multiply_specified_in_initializer, code = E0062)] pub(crate) struct FieldMultiplySpecifiedInInitializer { #[primary_span] diff --git a/compiler/rustc_hir_typeck/src/expr.rs b/compiler/rustc_hir_typeck/src/expr.rs index 04c06169d33..0e079b03769 100644 --- a/compiler/rustc_hir_typeck/src/expr.rs +++ b/compiler/rustc_hir_typeck/src/expr.rs @@ -44,10 +44,11 @@ use crate::Expectation::{self, ExpectCastableToType, ExpectHasType, NoExpectatio use crate::TupleArgumentsFlag::DontTupleArguments; use crate::coercion::{CoerceMany, DynamicCoerceMany}; use crate::errors::{ - AddressOfTemporaryTaken, FieldMultiplySpecifiedInInitializer, - FunctionalRecordUpdateOnNonStruct, HelpUseLatestEdition, ReturnLikeStatementKind, - ReturnStmtOutsideOfFnBody, StructExprNonExhaustive, TypeMismatchFruTypo, - YieldExprOutsideOfCoroutine, + AddressOfTemporaryTaken, BaseExpressionDoubleDot, BaseExpressionDoubleDotAddExpr, + BaseExpressionDoubleDotEnableDefaultFieldValues, BaseExpressionDoubleDotRemove, + FieldMultiplySpecifiedInInitializer, FunctionalRecordUpdateOnNonStruct, HelpUseLatestEdition, + ReturnLikeStatementKind, ReturnStmtOutsideOfFnBody, StructExprNonExhaustive, + TypeMismatchFruTypo, YieldExprOutsideOfCoroutine, }; use crate::{ BreakableCtxt, CoroutineTypes, Diverges, FnCtxt, Needs, cast, fatally_break_rust, @@ -723,7 +724,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { self.suggest_assoc_method_call(segs); let e = self.dcx().span_delayed_bug(qpath.span(), "`Res::Err` but no error emitted"); - self.set_tainted_by_errors(e); Ty::new_error(tcx, e) } Res::Def(DefKind::Variant, _) => { @@ -1855,11 +1855,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { fn check_expr_struct( &self, - expr: &hir::Expr<'_>, + expr: &hir::Expr<'tcx>, expected: Expectation<'tcx>, - qpath: &QPath<'tcx>, + qpath: &'tcx QPath<'tcx>, fields: &'tcx [hir::ExprField<'tcx>], - base_expr: &'tcx Option<&'tcx hir::Expr<'tcx>>, + base_expr: &'tcx hir::StructTailExpr<'tcx>, ) -> Ty<'tcx> { // Find the relevant variant let (variant, adt_ty) = match self.check_struct_path(qpath, expr.hir_id) { @@ -1899,7 +1899,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { span: Span, variant: &'tcx ty::VariantDef, hir_fields: &'tcx [hir::ExprField<'tcx>], - base_expr: &'tcx Option<&'tcx hir::Expr<'tcx>>, + base_expr: &'tcx hir::StructTailExpr<'tcx>, ) { let tcx = self.tcx; @@ -2023,13 +2023,90 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // the fields with the base_expr. This could cause us to hit errors later // when certain fields are assumed to exist that in fact do not. if error_happened { - if let Some(base_expr) = base_expr { + if let hir::StructTailExpr::Base(base_expr) = base_expr { self.check_expr(base_expr); } return; } - if let Some(base_expr) = base_expr { + if let hir::StructTailExpr::DefaultFields(span) = *base_expr { + let mut missing_mandatory_fields = Vec::new(); + let mut missing_optional_fields = Vec::new(); + for f in &variant.fields { + let ident = self.tcx.adjust_ident(f.ident(self.tcx), variant.def_id); + if let Some(_) = remaining_fields.remove(&ident) { + if f.value.is_none() { + missing_mandatory_fields.push(ident); + } else { + missing_optional_fields.push(ident); + } + } + } + if !self.tcx.features().default_field_values() { + self.dcx().emit_err(BaseExpressionDoubleDot { + span: span.shrink_to_hi(), + // We only mention enabling the feature if this is a nightly rustc *and* the + // expression would make sense with the feature enabled. + default_field_values: if self.tcx.sess.is_nightly_build() + && missing_mandatory_fields.is_empty() + && !missing_optional_fields.is_empty() + { + Some(BaseExpressionDoubleDotEnableDefaultFieldValues) + } else { + None + }, + add_expr: if !missing_mandatory_fields.is_empty() + || !missing_optional_fields.is_empty() + { + Some(BaseExpressionDoubleDotAddExpr { span: span.shrink_to_hi() }) + } else { + None + }, + remove_dots: if missing_mandatory_fields.is_empty() + && missing_optional_fields.is_empty() + { + Some(BaseExpressionDoubleDotRemove { span }) + } else { + None + }, + }); + return; + } + if !missing_mandatory_fields.is_empty() { + let s = pluralize!(missing_mandatory_fields.len()); + let fields: Vec<_> = + missing_mandatory_fields.iter().map(|f| format!("`{f}`")).collect(); + let fields = match &fields[..] { + [] => unreachable!(), + [only] => only.to_string(), + [start @ .., last] => format!("{} and {last}", start.join(", ")), + }; + self.dcx() + .struct_span_err( + span.shrink_to_hi(), + format!("missing mandatory field{s} {fields}"), + ) + .emit(); + return; + } + let fru_tys = match adt_ty.kind() { + ty::Adt(adt, args) if adt.is_struct() => variant + .fields + .iter() + .map(|f| self.normalize(span, f.ty(self.tcx, args))) + .collect(), + ty::Adt(adt, args) if adt.is_enum() => variant + .fields + .iter() + .map(|f| self.normalize(span, f.ty(self.tcx, args))) + .collect(), + _ => { + self.dcx().emit_err(FunctionalRecordUpdateOnNonStruct { span }); + return; + } + }; + self.typeck_results.borrow_mut().fru_field_types_mut().insert(expr.hir_id, fru_tys); + } else if let hir::StructTailExpr::Base(base_expr) = base_expr { // FIXME: We are currently creating two branches here in order to maintain // consistency. But they should be merged as much as possible. let fru_tys = if self.tcx.features().type_changing_struct_update() { @@ -2161,12 +2238,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { fn check_struct_fields_on_error( &self, fields: &'tcx [hir::ExprField<'tcx>], - base_expr: &'tcx Option<&'tcx hir::Expr<'tcx>>, + base_expr: &'tcx hir::StructTailExpr<'tcx>, ) { for field in fields { self.check_expr(field.expr); } - if let Some(base) = *base_expr { + if let hir::StructTailExpr::Base(base) = *base_expr { self.check_expr(base); } } diff --git a/compiler/rustc_hir_typeck/src/expr_use_visitor.rs b/compiler/rustc_hir_typeck/src/expr_use_visitor.rs index 774d00edea0..27ec2e9e0d4 100644 --- a/compiler/rustc_hir_typeck/src/expr_use_visitor.rs +++ b/compiler/rustc_hir_typeck/src/expr_use_visitor.rs @@ -686,7 +686,7 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx fn walk_struct_expr<'hir>( &self, fields: &[hir::ExprField<'_>], - opt_with: &Option<&'hir hir::Expr<'_>>, + opt_with: &hir::StructTailExpr<'hir>, ) -> Result<(), Cx::Error> { // Consume the expressions supplying values for each field. for field in fields { @@ -702,8 +702,8 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx } let with_expr = match *opt_with { - Some(w) => &*w, - None => { + hir::StructTailExpr::Base(w) => &*w, + hir::StructTailExpr::DefaultFields(_) | hir::StructTailExpr::None => { return Ok(()); } }; diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs index 44582390a4b..6b1cceefbee 100644 --- a/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs +++ b/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs @@ -903,6 +903,34 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } } + let detect_dotdot = |err: &mut Diag<'_>, ty: Ty<'_>, expr: &hir::Expr<'_>| { + if let ty::Adt(adt, _) = ty.kind() + && self.tcx().lang_items().get(hir::LangItem::RangeFull) == Some(adt.did()) + && let hir::ExprKind::Struct( + hir::QPath::LangItem(hir::LangItem::RangeFull, _), + [], + _, + ) = expr.kind + { + // We have `Foo(a, .., c)`, where the user might be trying to use the "rest" syntax + // from default field values, which is not supported on tuples. + let explanation = if self.tcx.features().default_field_values() { + "this is only supported on non-tuple struct literals" + } else if self.tcx.sess.is_nightly_build() { + "this is only supported on non-tuple struct literals when \ + `#![feature(default_field_values)]` is enabled" + } else { + "this is not supported" + }; + let msg = format!( + "you might have meant to use `..` to skip providing a value for \ + expected fields, but {explanation}; it is instead interpreted as a \ + `std::ops::RangeFull` literal", + ); + err.span_help(expr.span, msg); + } + }; + let mut reported = None; errors.retain(|error| { let Error::Invalid(provided_idx, expected_idx, Compatibility::Incompatible(Some(e))) = @@ -1009,6 +1037,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { tuple_arguments, ); suggest_confusable(&mut err); + detect_dotdot(&mut err, provided_ty, provided_args[provided_idx]); return err.emit(); } @@ -1133,6 +1162,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { None, None, ); + detect_dotdot(&mut err, provided_ty, provided_args[provided_idx]); } Error::Extra(arg_idx) => { let (provided_ty, provided_span) = provided_arg_tys[arg_idx]; @@ -1216,6 +1246,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { }; prev_extra_idx = Some(arg_idx.index()) } + detect_dotdot(&mut err, provided_ty, provided_args[arg_idx]); } Error::Missing(expected_idx) => { // If there are multiple missing arguments adjacent to each other, diff --git a/compiler/rustc_lexer/src/lib.rs b/compiler/rustc_lexer/src/lib.rs index 6caeec1b5cc..aa4abf678b9 100644 --- a/compiler/rustc_lexer/src/lib.rs +++ b/compiler/rustc_lexer/src/lib.rs @@ -33,6 +33,7 @@ pub mod unescape; mod tests; use unicode_properties::UnicodeEmoji; +pub use unicode_xid::UNICODE_VERSION as UNICODE_XID_VERSION; use self::LiteralKind::*; use self::TokenKind::*; diff --git a/compiler/rustc_lint/src/builtin.rs b/compiler/rustc_lint/src/builtin.rs index ec085198922..093cc16fb4c 100644 --- a/compiler/rustc_lint/src/builtin.rs +++ b/compiler/rustc_lint/src/builtin.rs @@ -625,6 +625,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingCopyImplementations { cx.param_env, ty, traits::ObligationCause::misc(item.span, item.owner_id.def_id), + hir::Safety::Safe, ) .is_ok() { diff --git a/compiler/rustc_metadata/src/rmeta/decoder.rs b/compiler/rustc_metadata/src/rmeta/decoder.rs index f3f5af49412..b9586338655 100644 --- a/compiler/rustc_metadata/src/rmeta/decoder.rs +++ b/compiler/rustc_metadata/src/rmeta/decoder.rs @@ -1104,6 +1104,7 @@ impl<'a> CrateMetadataRef<'a> { name: self.item_name(did.index), vis: self.get_visibility(did.index), safety: self.get_safety(did.index), + value: self.get_default_field(did.index), }) .collect(), adt_kind, @@ -1169,6 +1170,10 @@ impl<'a> CrateMetadataRef<'a> { self.root.tables.safety.get(self, id).unwrap_or_else(|| self.missing("safety", id)) } + fn get_default_field(self, id: DefIndex) -> Option<DefId> { + self.root.tables.default_fields.get(self, id).map(|d| d.decode(self)) + } + fn get_trait_item_def_id(self, id: DefIndex) -> Option<DefId> { self.root.tables.trait_item_def_id.get(self, id).map(|d| d.decode_from_cdata(self)) } diff --git a/compiler/rustc_metadata/src/rmeta/encoder.rs b/compiler/rustc_metadata/src/rmeta/encoder.rs index d4ea1276d00..5c80d24f502 100644 --- a/compiler/rustc_metadata/src/rmeta/encoder.rs +++ b/compiler/rustc_metadata/src/rmeta/encoder.rs @@ -1401,6 +1401,13 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> { continue; } + if def_kind == DefKind::Field + && let hir::Node::Field(field) = tcx.hir_node_by_def_id(local_id) + && let Some(anon) = field.default + { + record!(self.tables.default_fields[def_id] <- anon.def_id.to_def_id()); + } + if should_encode_span(def_kind) { let def_span = tcx.def_span(local_id); record!(self.tables.def_span[def_id] <- def_span); diff --git a/compiler/rustc_metadata/src/rmeta/mod.rs b/compiler/rustc_metadata/src/rmeta/mod.rs index a5e21ab51fd..4961464833a 100644 --- a/compiler/rustc_metadata/src/rmeta/mod.rs +++ b/compiler/rustc_metadata/src/rmeta/mod.rs @@ -450,6 +450,7 @@ define_tables! { trait_def: Table<DefIndex, LazyValue<ty::TraitDef>>, trait_item_def_id: Table<DefIndex, RawDefId>, expn_that_defined: Table<DefIndex, LazyValue<ExpnId>>, + default_fields: Table<DefIndex, LazyValue<DefId>>, params_in_repr: Table<DefIndex, LazyValue<BitSet<u32>>>, repr_options: Table<DefIndex, LazyValue<ReprOptions>>, // `def_keys` and `def_path_hashes` represent a lazy version of a diff --git a/compiler/rustc_middle/src/mir/consts.rs b/compiler/rustc_middle/src/mir/consts.rs index 7983329b0f7..52009422d98 100644 --- a/compiler/rustc_middle/src/mir/consts.rs +++ b/compiler/rustc_middle/src/mir/consts.rs @@ -8,6 +8,7 @@ use rustc_session::config::RemapPathScopeComponents; use rustc_span::{DUMMY_SP, Span}; use rustc_type_ir::visit::TypeVisitableExt; +use super::interpret::ReportedErrorInfo; use crate::mir::interpret::{AllocId, ConstAllocation, ErrorHandled, Scalar, alloc_range}; use crate::mir::{Promoted, pretty_print_const_value}; use crate::ty::print::{pretty_print_const, with_no_trimmed_paths}; @@ -331,7 +332,10 @@ impl<'tcx> Const<'tcx> { ConstKind::Expr(_) => { bug!("Normalization of `ty::ConstKind::Expr` is unimplemented") } - _ => Err(tcx.dcx().delayed_bug("Unevaluated `ty::Const` in MIR body").into()), + _ => Err(ReportedErrorInfo::non_const_eval_error( + tcx.dcx().delayed_bug("Unevaluated `ty::Const` in MIR body"), + ) + .into()), } } Const::Unevaluated(uneval, _) => { diff --git a/compiler/rustc_middle/src/mir/coverage.rs b/compiler/rustc_middle/src/mir/coverage.rs index b7410ca5f18..962176290df 100644 --- a/compiler/rustc_middle/src/mir/coverage.rs +++ b/compiler/rustc_middle/src/mir/coverage.rs @@ -3,6 +3,7 @@ use std::fmt::{self, Debug, Formatter}; use rustc_index::IndexVec; +use rustc_index::bit_set::BitSet; use rustc_macros::{HashStable, TyDecodable, TyEncodable, TypeFoldable, TypeVisitable}; use rustc_span::Span; @@ -310,3 +311,41 @@ pub struct MCDCDecisionSpan { pub decision_depth: u16, pub num_conditions: usize, } + +/// Summarizes coverage IDs inserted by the `InstrumentCoverage` MIR pass +/// (for compiler option `-Cinstrument-coverage`), after MIR optimizations +/// have had a chance to potentially remove some of them. +/// +/// Used by the `coverage_ids_info` query. +#[derive(Clone, TyEncodable, TyDecodable, Debug, HashStable)] +pub struct CoverageIdsInfo { + pub counters_seen: BitSet<CounterId>, + pub zero_expressions: BitSet<ExpressionId>, +} + +impl CoverageIdsInfo { + /// Coverage codegen needs to know how many coverage counters are ever + /// incremented within a function, so that it can set the `num-counters` + /// argument of the `llvm.instrprof.increment` intrinsic. + /// + /// This may be less than the highest counter ID emitted by the + /// InstrumentCoverage MIR pass, if the highest-numbered counter increments + /// were removed by MIR optimizations. + pub fn num_counters_after_mir_opts(&self) -> u32 { + // FIXME(Zalathar): Currently this treats an unused counter as "used" + // if its ID is less than that of the highest counter that really is + // used. Fixing this would require adding a renumbering step somewhere. + self.counters_seen.last_set_in(..).map_or(0, |max| max.as_u32() + 1) + } + + /// Returns `true` if the given term is known to have a value of zero, taking + /// into account knowledge of which counters are unused and which expressions + /// are always zero. + pub fn is_zero_term(&self, term: CovTerm) -> bool { + match term { + CovTerm::Zero => true, + CovTerm::Counter(id) => !self.counters_seen.contains(id), + CovTerm::Expression(id) => self.zero_expressions.contains(id), + } + } +} diff --git a/compiler/rustc_middle/src/mir/interpret/error.rs b/compiler/rustc_middle/src/mir/interpret/error.rs index ad5d678178d..fbada6ec405 100644 --- a/compiler/rustc_middle/src/mir/interpret/error.rs +++ b/compiler/rustc_middle/src/mir/interpret/error.rs @@ -28,10 +28,10 @@ pub enum ErrorHandled { TooGeneric(Span), } -impl From<ErrorGuaranteed> for ErrorHandled { +impl From<ReportedErrorInfo> for ErrorHandled { #[inline] - fn from(error: ErrorGuaranteed) -> ErrorHandled { - ErrorHandled::Reported(error.into(), DUMMY_SP) + fn from(error: ReportedErrorInfo) -> ErrorHandled { + ErrorHandled::Reported(error, DUMMY_SP) } } @@ -65,6 +65,20 @@ pub struct ReportedErrorInfo { impl ReportedErrorInfo { #[inline] + pub fn const_eval_error(error: ErrorGuaranteed) -> ReportedErrorInfo { + ReportedErrorInfo { allowed_in_infallible: false, error } + } + + /// Use this when the error that led to this is *not* a const-eval error + /// (e.g., a layout or type checking error). + #[inline] + pub fn non_const_eval_error(error: ErrorGuaranteed) -> ReportedErrorInfo { + ReportedErrorInfo { allowed_in_infallible: true, error } + } + + /// Use this when the error that led to this *is* a const-eval error, but + /// we do allow it to occur in infallible constants (e.g., resource exhaustion). + #[inline] pub fn allowed_in_infallible(error: ErrorGuaranteed) -> ReportedErrorInfo { ReportedErrorInfo { allowed_in_infallible: true, error } } @@ -74,13 +88,6 @@ impl ReportedErrorInfo { } } -impl From<ErrorGuaranteed> for ReportedErrorInfo { - #[inline] - fn from(error: ErrorGuaranteed) -> ReportedErrorInfo { - ReportedErrorInfo { allowed_in_infallible: false, error } - } -} - impl Into<ErrorGuaranteed> for ReportedErrorInfo { #[inline] fn into(self) -> ErrorGuaranteed { @@ -180,12 +187,6 @@ fn print_backtrace(backtrace: &Backtrace) { eprintln!("\n\nAn error occurred in the MIR interpreter:\n{backtrace}"); } -impl From<ErrorGuaranteed> for InterpErrorInfo<'_> { - fn from(err: ErrorGuaranteed) -> Self { - InterpErrorKind::InvalidProgram(InvalidProgramInfo::AlreadyReported(err.into())).into() - } -} - impl From<ErrorHandled> for InterpErrorInfo<'_> { fn from(err: ErrorHandled) -> Self { InterpErrorKind::InvalidProgram(match err { diff --git a/compiler/rustc_middle/src/mir/interpret/queries.rs b/compiler/rustc_middle/src/mir/interpret/queries.rs index e540f0194ec..f7f38575bd0 100644 --- a/compiler/rustc_middle/src/mir/interpret/queries.rs +++ b/compiler/rustc_middle/src/mir/interpret/queries.rs @@ -6,6 +6,7 @@ use tracing::{debug, instrument}; use super::{ ErrorHandled, EvalToAllocationRawResult, EvalToConstValueResult, EvalToValTreeResult, GlobalId, + ReportedErrorInfo, }; use crate::mir; use crate::query::TyCtxtEnsure; @@ -81,7 +82,9 @@ impl<'tcx> TyCtxt<'tcx> { // For errors during resolution, we deliberately do not point at the usage site of the constant, // since for these errors the place the constant is used shouldn't matter. Ok(None) => Err(ErrorHandled::TooGeneric(DUMMY_SP)), - Err(err) => Err(ErrorHandled::Reported(err.into(), DUMMY_SP)), + Err(err) => { + Err(ErrorHandled::Reported(ReportedErrorInfo::non_const_eval_error(err), DUMMY_SP)) + } } } @@ -138,7 +141,9 @@ impl<'tcx> TyCtxt<'tcx> { // For errors during resolution, we deliberately do not point at the usage site of the constant, // since for these errors the place the constant is used shouldn't matter. Ok(None) => Err(ErrorHandled::TooGeneric(DUMMY_SP)), - Err(err) => Err(ErrorHandled::Reported(err.into(), DUMMY_SP)), + Err(err) => { + Err(ErrorHandled::Reported(ReportedErrorInfo::non_const_eval_error(err), DUMMY_SP)) + } } } diff --git a/compiler/rustc_middle/src/mir/query.rs b/compiler/rustc_middle/src/mir/query.rs index 80dfcbf2e69..f690359e012 100644 --- a/compiler/rustc_middle/src/mir/query.rs +++ b/compiler/rustc_middle/src/mir/query.rs @@ -8,7 +8,7 @@ use rustc_abi::{FieldIdx, VariantIdx}; use rustc_data_structures::fx::FxIndexMap; use rustc_errors::ErrorGuaranteed; use rustc_hir::def_id::LocalDefId; -use rustc_index::bit_set::{BitMatrix, BitSet}; +use rustc_index::bit_set::BitMatrix; use rustc_index::{Idx, IndexVec}; use rustc_macros::{HashStable, TyDecodable, TyEncodable, TypeFoldable, TypeVisitable}; use rustc_span::Span; @@ -16,7 +16,6 @@ use rustc_span::symbol::Symbol; use smallvec::SmallVec; use super::{ConstValue, SourceInfo}; -use crate::mir; use crate::ty::fold::fold_regions; use crate::ty::{self, CoroutineArgsExt, OpaqueHiddenType, Ty, TyCtxt}; @@ -351,30 +350,3 @@ pub struct DestructuredConstant<'tcx> { pub variant: Option<VariantIdx>, pub fields: &'tcx [(ConstValue<'tcx>, Ty<'tcx>)], } - -/// Summarizes coverage IDs inserted by the `InstrumentCoverage` MIR pass -/// (for compiler option `-Cinstrument-coverage`), after MIR optimizations -/// have had a chance to potentially remove some of them. -/// -/// Used by the `coverage_ids_info` query. -#[derive(Clone, TyEncodable, TyDecodable, Debug, HashStable)] -pub struct CoverageIdsInfo { - pub counters_seen: BitSet<mir::coverage::CounterId>, - pub expressions_seen: BitSet<mir::coverage::ExpressionId>, -} - -impl CoverageIdsInfo { - /// Coverage codegen needs to know how many coverage counters are ever - /// incremented within a function, so that it can set the `num-counters` - /// argument of the `llvm.instrprof.increment` intrinsic. - /// - /// This may be less than the highest counter ID emitted by the - /// InstrumentCoverage MIR pass, if the highest-numbered counter increments - /// were removed by MIR optimizations. - pub fn num_counters_after_mir_opts(&self) -> u32 { - // FIXME(Zalathar): Currently this treats an unused counter as "used" - // if its ID is less than that of the highest counter that really is - // used. Fixing this would require adding a renumbering step somewhere. - self.counters_seen.last_set_in(..).map_or(0, |max| max.as_u32() + 1) - } -} diff --git a/compiler/rustc_middle/src/query/mod.rs b/compiler/rustc_middle/src/query/mod.rs index a3976c3dda1..fc3d690a8a9 100644 --- a/compiler/rustc_middle/src/query/mod.rs +++ b/compiler/rustc_middle/src/query/mod.rs @@ -581,7 +581,7 @@ rustc_queries! { /// Summarizes coverage IDs inserted by the `InstrumentCoverage` MIR pass /// (for compiler option `-Cinstrument-coverage`), after MIR optimizations /// have had a chance to potentially remove some of them. - query coverage_ids_info(key: ty::InstanceKind<'tcx>) -> &'tcx mir::CoverageIdsInfo { + query coverage_ids_info(key: ty::InstanceKind<'tcx>) -> &'tcx mir::coverage::CoverageIdsInfo { desc { |tcx| "retrieving coverage IDs info from MIR for `{}`", tcx.def_path_str(key.def_id()) } arena_cache } diff --git a/compiler/rustc_middle/src/thir.rs b/compiler/rustc_middle/src/thir.rs index 9cf6bc1b777..86014c34b45 100644 --- a/compiler/rustc_middle/src/thir.rs +++ b/compiler/rustc_middle/src/thir.rs @@ -158,8 +158,21 @@ pub struct AdtExpr<'tcx> { pub user_ty: UserTy<'tcx>, pub fields: Box<[FieldExpr]>, - /// The base, e.g. `Foo {x: 1, .. base}`. - pub base: Option<FruInfo<'tcx>>, + /// The base, e.g. `Foo {x: 1, ..base}`. + pub base: AdtExprBase<'tcx>, +} + +#[derive(Clone, Debug, HashStable)] +pub enum AdtExprBase<'tcx> { + /// A struct expression where all the fields are explicitly enumerated: `Foo { a, b }`. + None, + /// A struct expression with a "base", an expression of the same type as the outer struct that + /// will be used to populate any fields not explicitly mentioned: `Foo { ..base }` + Base(FruInfo<'tcx>), + /// A struct expression with a `..` tail but no "base" expression. The values from the struct + /// fields' default values will be used to populate any fields not explicitly mentioned: + /// `Foo { .. }`. + DefaultFields(Box<[Ty<'tcx>]>), } #[derive(Clone, Debug, HashStable)] diff --git a/compiler/rustc_middle/src/thir/visit.rs b/compiler/rustc_middle/src/thir/visit.rs index 81202a6eaad..64bac12b266 100644 --- a/compiler/rustc_middle/src/thir/visit.rs +++ b/compiler/rustc_middle/src/thir/visit.rs @@ -2,6 +2,7 @@ use super::{ AdtExpr, Arm, Block, ClosureExpr, Expr, ExprKind, InlineAsmExpr, InlineAsmOperand, Pat, PatKind, Stmt, StmtKind, Thir, }; +use crate::thir::AdtExprBase; pub trait Visitor<'thir, 'tcx: 'thir>: Sized { fn thir(&self) -> &'thir Thir<'tcx>; @@ -127,7 +128,7 @@ pub fn walk_expr<'thir, 'tcx: 'thir, V: Visitor<'thir, 'tcx>>( for field in &**fields { visitor.visit_expr(&visitor.thir()[field.expr]); } - if let Some(base) = base { + if let AdtExprBase::Base(base) = base { visitor.visit_expr(&visitor.thir()[base.base]); } } diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs index d4835bb07f6..2841470d248 100644 --- a/compiler/rustc_middle/src/ty/context.rs +++ b/compiler/rustc_middle/src/ty/context.rs @@ -1479,7 +1479,7 @@ impl<'tcx> TyCtxt<'tcx> { self.mk_adt_def_from_data(ty::AdtDefData::new(self, did, kind, variants, repr)) } - /// Allocates a read-only byte or string literal for `mir::interpret`. + /// Allocates a read-only byte or string literal for `mir::interpret` with alignment 1. /// Returns the same `AllocId` if called again with the same bytes. pub fn allocate_bytes_dedup(self, bytes: &[u8], salt: usize) -> interpret::AllocId { // Create an allocation that just contains these bytes. diff --git a/compiler/rustc_middle/src/ty/mod.rs b/compiler/rustc_middle/src/ty/mod.rs index c7a2223ecd7..70e0568b202 100644 --- a/compiler/rustc_middle/src/ty/mod.rs +++ b/compiler/rustc_middle/src/ty/mod.rs @@ -1364,6 +1364,7 @@ pub struct FieldDef { pub name: Symbol, pub vis: Visibility<DefId>, pub safety: hir::Safety, + pub value: Option<DefId>, } impl PartialEq for FieldDef { @@ -1376,9 +1377,9 @@ impl PartialEq for FieldDef { // of `FieldDef` changes, a compile-error will be produced, reminding // us to revisit this assumption. - let Self { did: lhs_did, name: _, vis: _, safety: _ } = &self; + let Self { did: lhs_did, name: _, vis: _, safety: _, value: _ } = &self; - let Self { did: rhs_did, name: _, vis: _, safety: _ } = other; + let Self { did: rhs_did, name: _, vis: _, safety: _, value: _ } = other; let res = lhs_did == rhs_did; @@ -1405,7 +1406,7 @@ impl Hash for FieldDef { // of `FieldDef` changes, a compile-error will be produced, reminding // us to revisit this assumption. - let Self { did, name: _, vis: _, safety: _ } = &self; + let Self { did, name: _, vis: _, safety: _, value: _ } = &self; did.hash(s) } diff --git a/compiler/rustc_middle/src/ty/sty.rs b/compiler/rustc_middle/src/ty/sty.rs index 474062218c9..3fbc23924f5 100644 --- a/compiler/rustc_middle/src/ty/sty.rs +++ b/compiler/rustc_middle/src/ty/sty.rs @@ -980,11 +980,7 @@ impl<'tcx> rustc_type_ir::inherent::Ty<TyCtxt<'tcx>> for Ty<'tcx> { } fn has_unsafe_fields(self) -> bool { - if let ty::Adt(adt_def, ..) = self.kind() { - adt_def.all_fields().any(|x| x.safety == hir::Safety::Unsafe) - } else { - false - } + Ty::has_unsafe_fields(self) } } diff --git a/compiler/rustc_middle/src/ty/util.rs b/compiler/rustc_middle/src/ty/util.rs index 57054bd1a0b..b9a45ea3c2c 100644 --- a/compiler/rustc_middle/src/ty/util.rs +++ b/compiler/rustc_middle/src/ty/util.rs @@ -1288,6 +1288,15 @@ impl<'tcx> Ty<'tcx> { } } + /// Checks whether this type is an ADT that has unsafe fields. + pub fn has_unsafe_fields(self) -> bool { + if let ty::Adt(adt_def, ..) = self.kind() { + adt_def.all_fields().any(|x| x.safety == hir::Safety::Unsafe) + } else { + false + } + } + /// Get morphology of the async drop glue, needed for types which do not /// use async drop. To get async drop glue morphology for a definition see /// [`TyCtxt::async_drop_glue_morphology`]. Used for `AsyncDestruct::Destructor` diff --git a/compiler/rustc_mir_build/src/build/custom/parse/instruction.rs b/compiler/rustc_mir_build/src/build/custom/parse/instruction.rs index c3e9bd302de..67114efdff5 100644 --- a/compiler/rustc_mir_build/src/build/custom/parse/instruction.rs +++ b/compiler/rustc_mir_build/src/build/custom/parse/instruction.rs @@ -283,7 +283,7 @@ impl<'a, 'tcx> ParseCtxt<'a, 'tcx> { fields.iter().map(|e| self.parse_operand(*e)).collect::<Result<_, _>>()? )) }, - ExprKind::Adt(box AdtExpr{ adt_def, variant_index, args, fields, .. }) => { + ExprKind::Adt(box AdtExpr { adt_def, variant_index, args, fields, .. }) => { let is_union = adt_def.is_union(); let active_field_index = is_union.then(|| fields[0].name); diff --git a/compiler/rustc_mir_build/src/build/expr/into.rs b/compiler/rustc_mir_build/src/build/expr/into.rs index bebb44faba6..a3d5376dcd4 100644 --- a/compiler/rustc_mir_build/src/build/expr/into.rs +++ b/compiler/rustc_mir_build/src/build/expr/into.rs @@ -1,7 +1,5 @@ //! See docs in build/expr/mod.rs -use std::iter; - use rustc_ast::{AsmMacro, InlineAsmOptions}; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::stack::ensure_sufficient_stack; @@ -344,25 +342,51 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { }) .collect(); - let field_names = adt_def.variant(variant_index).fields.indices(); - - let fields = if let Some(FruInfo { base, field_types }) = base { - let place_builder = unpack!(block = this.as_place_builder(block, *base)); + let variant = adt_def.variant(variant_index); + let field_names = variant.fields.indices(); - // MIR does not natively support FRU, so for each - // base-supplied field, generate an operand that - // reads it from the base. - iter::zip(field_names, &**field_types) - .map(|(n, ty)| match fields_map.get(&n) { - Some(v) => v.clone(), - None => { - let place = place_builder.clone_project(PlaceElem::Field(n, *ty)); - this.consume_by_copy_or_move(place.to_place(this)) - } - }) - .collect() - } else { - field_names.filter_map(|n| fields_map.get(&n).cloned()).collect() + let fields = match base { + AdtExprBase::None => { + field_names.filter_map(|n| fields_map.get(&n).cloned()).collect() + } + AdtExprBase::Base(FruInfo { base, field_types }) => { + let place_builder = unpack!(block = this.as_place_builder(block, *base)); + + // We desugar FRU as we lower to MIR, so for each + // base-supplied field, generate an operand that + // reads it from the base. + itertools::zip_eq(field_names, &**field_types) + .map(|(n, ty)| match fields_map.get(&n) { + Some(v) => v.clone(), + None => { + let place = + place_builder.clone_project(PlaceElem::Field(n, *ty)); + this.consume_by_copy_or_move(place.to_place(this)) + } + }) + .collect() + } + AdtExprBase::DefaultFields(field_types) => { + itertools::zip_eq(field_names, &**field_types) + .map(|(n, ty)| match fields_map.get(&n) { + Some(v) => v.clone(), + None => match variant.fields[n].value { + Some(def) => { + let value = Const::from_unevaluated(this.tcx, def) + .instantiate(this.tcx, args); + this.literal_operand(expr_span, value) + } + None => { + let name = variant.fields[n].name; + span_bug!( + expr_span, + "missing mandatory field `{name}` of type `{ty}`", + ); + } + }, + }) + .collect() + } }; let inferred_ty = expr.ty; diff --git a/compiler/rustc_mir_build/src/thir/cx/expr.rs b/compiler/rustc_mir_build/src/thir/cx/expr.rs index ee9bcce104e..d75f01dfba0 100644 --- a/compiler/rustc_mir_build/src/thir/cx/expr.rs +++ b/compiler/rustc_mir_build/src/thir/cx/expr.rs @@ -222,7 +222,7 @@ impl<'tcx> Cx<'tcx> { args, fields: Box::new([FieldExpr { name: FieldIdx::from(0u32), expr }]), user_ty: None, - base: None, + base: AdtExprBase::None, })); debug!(?kind); @@ -464,7 +464,7 @@ impl<'tcx> Cx<'tcx> { variant_index: index, fields: field_refs, user_ty, - base: None, + base: AdtExprBase::None, })) } else { ExprKind::Call { @@ -594,20 +594,36 @@ impl<'tcx> Cx<'tcx> { args, user_ty, fields: self.field_refs(fields), - base: base.map(|base| FruInfo { - base: self.mirror_expr(base), - field_types: self.typeck_results().fru_field_types()[expr.hir_id] - .iter() - .copied() - .collect(), - }), + base: match base { + hir::StructTailExpr::Base(base) => AdtExprBase::Base(FruInfo { + base: self.mirror_expr(base), + field_types: self.typeck_results().fru_field_types() + [expr.hir_id] + .iter() + .copied() + .collect(), + }), + hir::StructTailExpr::DefaultFields(_) => { + AdtExprBase::DefaultFields( + self.typeck_results().fru_field_types()[expr.hir_id] + .iter() + .copied() + .collect(), + ) + } + hir::StructTailExpr::None => AdtExprBase::None, + }, })) } AdtKind::Enum => { let res = self.typeck_results().qpath_res(qpath, expr.hir_id); match res { Res::Def(DefKind::Variant, variant_id) => { - assert!(base.is_none()); + assert!(matches!( + base, + hir::StructTailExpr::None + | hir::StructTailExpr::DefaultFields(_) + )); let index = adt.variant_index_with_id(variant_id); let user_provided_types = @@ -621,7 +637,21 @@ impl<'tcx> Cx<'tcx> { args, user_ty, fields: self.field_refs(fields), - base: None, + base: match base { + hir::StructTailExpr::DefaultFields(_) => { + AdtExprBase::DefaultFields( + self.typeck_results().fru_field_types() + [expr.hir_id] + .iter() + .copied() + .collect(), + ) + } + hir::StructTailExpr::Base(base) => { + span_bug!(base.span, "unexpected res: {:?}", res); + } + hir::StructTailExpr::None => AdtExprBase::None, + }, })) } _ => { @@ -1029,7 +1059,7 @@ impl<'tcx> Cx<'tcx> { args, user_ty, fields: Box::new([]), - base: None, + base: AdtExprBase::None, })), _ => bug!("unexpected ty: {:?}", ty), } diff --git a/compiler/rustc_mir_build/src/thir/print.rs b/compiler/rustc_mir_build/src/thir/print.rs index 6be0ed5fb31..2bcdb67c58a 100644 --- a/compiler/rustc_mir_build/src/thir/print.rs +++ b/compiler/rustc_mir_build/src/thir/print.rs @@ -566,11 +566,17 @@ impl<'a, 'tcx> ThirPrinter<'a, 'tcx> { self.print_expr(field_expr.expr, depth_lvl + 2); } - if let Some(ref base) = adt_expr.base { - print_indented!(self, "base:", depth_lvl + 1); - self.print_fru_info(base, depth_lvl + 2); - } else { - print_indented!(self, "base: None", depth_lvl + 1); + match adt_expr.base { + AdtExprBase::Base(ref base) => { + print_indented!(self, "base:", depth_lvl + 1); + self.print_fru_info(base, depth_lvl + 2); + } + AdtExprBase::DefaultFields(_) => { + print_indented!(self, "base: {{ defaulted fields }}", depth_lvl + 1); + } + AdtExprBase::None => { + print_indented!(self, "base: None", depth_lvl + 1); + } } } diff --git a/compiler/rustc_mir_dataflow/src/framework/graphviz.rs b/compiler/rustc_mir_dataflow/src/framework/graphviz.rs index 561229cf725..f844e8fbe03 100644 --- a/compiler/rustc_mir_dataflow/src/framework/graphviz.rs +++ b/compiler/rustc_mir_dataflow/src/framework/graphviz.rs @@ -2,19 +2,186 @@ use std::borrow::Cow; use std::cell::RefCell; +use std::ffi::OsString; +use std::path::PathBuf; use std::sync::OnceLock; use std::{io, ops, str}; use regex::Regex; -use rustc_graphviz as dot; +use rustc_hir::def_id::DefId; use rustc_index::bit_set::BitSet; -use rustc_middle::mir::{self, BasicBlock, Body, Location, graphviz_safe_def_name}; +use rustc_middle::mir::{ + self, BasicBlock, Body, Location, create_dump_file, dump_enabled, graphviz_safe_def_name, + traversal, +}; +use rustc_middle::ty::TyCtxt; +use rustc_middle::ty::print::with_no_trimmed_paths; +use rustc_span::symbol::{Symbol, sym}; +use tracing::debug; +use {rustc_ast as ast, rustc_graphviz as dot}; use super::fmt::{DebugDiffWithAdapter, DebugWithAdapter, DebugWithContext}; use super::{Analysis, CallReturnPlaces, Direction, Results, ResultsCursor, ResultsVisitor}; +use crate::errors::{ + DuplicateValuesFor, PathMustEndInFilename, RequiresAnArgument, UnknownFormatter, +}; + +/// Writes a DOT file containing the results of a dataflow analysis if the user requested it via +/// `rustc_mir` attributes and `-Z dump-mir-dataflow`. The `Result` in and the `Results` out are +/// the same. +pub(super) fn write_graphviz_results<'tcx, A>( + tcx: TyCtxt<'tcx>, + body: &Body<'tcx>, + results: &mut Results<'tcx, A>, + pass_name: Option<&'static str>, +) -> std::io::Result<()> +where + A: Analysis<'tcx>, + A::Domain: DebugWithContext<A>, +{ + use std::fs; + use std::io::Write; + + let def_id = body.source.def_id(); + let Ok(attrs) = RustcMirAttrs::parse(tcx, def_id) else { + // Invalid `rustc_mir` attrs are reported in `RustcMirAttrs::parse` + return Ok(()); + }; + + let file = try { + match attrs.output_path(A::NAME) { + Some(path) => { + debug!("printing dataflow results for {:?} to {}", def_id, path.display()); + if let Some(parent) = path.parent() { + fs::create_dir_all(parent)?; + } + fs::File::create_buffered(&path)? + } + + None if dump_enabled(tcx, A::NAME, def_id) => { + create_dump_file(tcx, "dot", false, A::NAME, &pass_name.unwrap_or("-----"), body)? + } + + _ => return Ok(()), + } + }; + let mut file = match file { + Ok(f) => f, + Err(e) => return Err(e), + }; + + let style = match attrs.formatter { + Some(sym::two_phase) => OutputStyle::BeforeAndAfter, + _ => OutputStyle::AfterOnly, + }; + + let mut buf = Vec::new(); + + let graphviz = Formatter::new(body, results, style); + let mut render_opts = + vec![dot::RenderOption::Fontname(tcx.sess.opts.unstable_opts.graphviz_font.clone())]; + if tcx.sess.opts.unstable_opts.graphviz_dark_mode { + render_opts.push(dot::RenderOption::DarkTheme); + } + let r = with_no_trimmed_paths!(dot::render_opts(&graphviz, &mut buf, &render_opts)); + + let lhs = try { + r?; + file.write_all(&buf)?; + }; + + lhs +} + +#[derive(Default)] +struct RustcMirAttrs { + basename_and_suffix: Option<PathBuf>, + formatter: Option<Symbol>, +} + +impl RustcMirAttrs { + fn parse(tcx: TyCtxt<'_>, def_id: DefId) -> Result<Self, ()> { + let mut result = Ok(()); + let mut ret = RustcMirAttrs::default(); + + let rustc_mir_attrs = tcx + .get_attrs(def_id, sym::rustc_mir) + .flat_map(|attr| attr.meta_item_list().into_iter().flat_map(|v| v.into_iter())); + + for attr in rustc_mir_attrs { + let attr_result = if attr.has_name(sym::borrowck_graphviz_postflow) { + Self::set_field(&mut ret.basename_and_suffix, tcx, &attr, |s| { + let path = PathBuf::from(s.to_string()); + match path.file_name() { + Some(_) => Ok(path), + None => { + tcx.dcx().emit_err(PathMustEndInFilename { span: attr.span() }); + Err(()) + } + } + }) + } else if attr.has_name(sym::borrowck_graphviz_format) { + Self::set_field(&mut ret.formatter, tcx, &attr, |s| match s { + sym::gen_kill | sym::two_phase => Ok(s), + _ => { + tcx.dcx().emit_err(UnknownFormatter { span: attr.span() }); + Err(()) + } + }) + } else { + Ok(()) + }; + + result = result.and(attr_result); + } + + result.map(|()| ret) + } + + fn set_field<T>( + field: &mut Option<T>, + tcx: TyCtxt<'_>, + attr: &ast::MetaItemInner, + mapper: impl FnOnce(Symbol) -> Result<T, ()>, + ) -> Result<(), ()> { + if field.is_some() { + tcx.dcx() + .emit_err(DuplicateValuesFor { span: attr.span(), name: attr.name_or_empty() }); + + return Err(()); + } + + if let Some(s) = attr.value_str() { + *field = Some(mapper(s)?); + Ok(()) + } else { + tcx.dcx() + .emit_err(RequiresAnArgument { span: attr.span(), name: attr.name_or_empty() }); + Err(()) + } + } + + /// Returns the path where dataflow results should be written, or `None` + /// `borrowck_graphviz_postflow` was not specified. + /// + /// This performs the following transformation to the argument of `borrowck_graphviz_postflow`: + /// + /// "path/suffix.dot" -> "path/analysis_name_suffix.dot" + fn output_path(&self, analysis_name: &str) -> Option<PathBuf> { + let mut ret = self.basename_and_suffix.as_ref().cloned()?; + let suffix = ret.file_name().unwrap(); // Checked when parsing attrs + + let mut file_name: OsString = analysis_name.into(); + file_name.push("_"); + file_name.push(suffix); + ret.set_file_name(file_name); + + Some(ret) + } +} #[derive(Clone, Copy, Debug, PartialEq, Eq)] -pub(crate) enum OutputStyle { +enum OutputStyle { AfterOnly, BeforeAndAfter, } @@ -28,7 +195,7 @@ impl OutputStyle { } } -pub(crate) struct Formatter<'mir, 'tcx, A> +struct Formatter<'mir, 'tcx, A> where A: Analysis<'tcx>, { @@ -45,12 +212,12 @@ impl<'mir, 'tcx, A> Formatter<'mir, 'tcx, A> where A: Analysis<'tcx>, { - pub(crate) fn new( + fn new( body: &'mir Body<'tcx>, results: &'mir mut Results<'tcx, A>, style: OutputStyle, ) -> Self { - let reachable = mir::traversal::reachable_as_bitset(body); + let reachable = traversal::reachable_as_bitset(body); Formatter { cursor: results.as_results_cursor(body).into(), style, reachable } } @@ -61,7 +228,7 @@ where /// A pair of a basic block and an index into that basic blocks `successors`. #[derive(Copy, Clone, PartialEq, Eq, Debug)] -pub(crate) struct CfgEdge { +struct CfgEdge { source: BasicBlock, index: usize, } @@ -520,7 +687,7 @@ struct StateDiffCollector<D> { impl<D> StateDiffCollector<D> { fn run<'tcx, A>( - body: &mir::Body<'tcx>, + body: &Body<'tcx>, block: BasicBlock, results: &mut Results<'tcx, A>, style: OutputStyle, diff --git a/compiler/rustc_mir_dataflow/src/framework/mod.rs b/compiler/rustc_mir_dataflow/src/framework/mod.rs index caff2a81ff3..7f5a68e884e 100644 --- a/compiler/rustc_mir_dataflow/src/framework/mod.rs +++ b/compiler/rustc_mir_dataflow/src/framework/mod.rs @@ -42,7 +42,7 @@ use rustc_middle::mir::{self, BasicBlock, CallReturnPlaces, Location, Terminator use rustc_middle::ty::TyCtxt; use tracing::error; -use self::results::write_graphviz_results; +use self::graphviz::write_graphviz_results; use super::fmt::DebugWithContext; mod cursor; diff --git a/compiler/rustc_mir_dataflow/src/framework/results.rs b/compiler/rustc_mir_dataflow/src/framework/results.rs index c4321c454e6..a7dbd99b8ab 100644 --- a/compiler/rustc_mir_dataflow/src/framework/results.rs +++ b/compiler/rustc_mir_dataflow/src/framework/results.rs @@ -1,22 +1,9 @@ //! Dataflow analysis results. -use std::ffi::OsString; -use std::path::PathBuf; - -use rustc_hir::def_id::DefId; use rustc_index::IndexVec; -use rustc_middle::mir::{self, BasicBlock, create_dump_file, dump_enabled, traversal}; -use rustc_middle::ty::TyCtxt; -use rustc_middle::ty::print::with_no_trimmed_paths; -use rustc_span::symbol::{Symbol, sym}; -use tracing::debug; -use {rustc_ast as ast, rustc_graphviz as dot}; +use rustc_middle::mir::{BasicBlock, Body, traversal}; -use super::fmt::DebugWithContext; -use super::{Analysis, ResultsCursor, ResultsVisitor, graphviz, visit_results}; -use crate::errors::{ - DuplicateValuesFor, PathMustEndInFilename, RequiresAnArgument, UnknownFormatter, -}; +use super::{Analysis, ResultsCursor, ResultsVisitor, visit_results}; use crate::framework::cursor::ResultsHandle; pub type EntrySets<'tcx, A> = IndexVec<BasicBlock, <A as Analysis<'tcx>>::Domain>; @@ -41,16 +28,13 @@ where /// `Results` is also used outside the cursor. pub fn as_results_cursor<'mir>( &'mir mut self, - body: &'mir mir::Body<'tcx>, + body: &'mir Body<'tcx>, ) -> ResultsCursor<'mir, 'tcx, A> { ResultsCursor::new(body, ResultsHandle::BorrowedMut(self)) } /// Creates a `ResultsCursor` that takes ownership of the `Results`. - pub fn into_results_cursor<'mir>( - self, - body: &'mir mir::Body<'tcx>, - ) -> ResultsCursor<'mir, 'tcx, A> { + pub fn into_results_cursor<'mir>(self, body: &'mir Body<'tcx>) -> ResultsCursor<'mir, 'tcx, A> { ResultsCursor::new(body, ResultsHandle::Owned(self)) } @@ -61,7 +45,7 @@ where pub fn visit_with<'mir>( &mut self, - body: &'mir mir::Body<'tcx>, + body: &'mir Body<'tcx>, blocks: impl IntoIterator<Item = BasicBlock>, vis: &mut impl ResultsVisitor<'mir, 'tcx, A>, ) { @@ -70,166 +54,10 @@ where pub fn visit_reachable_with<'mir>( &mut self, - body: &'mir mir::Body<'tcx>, + body: &'mir Body<'tcx>, vis: &mut impl ResultsVisitor<'mir, 'tcx, A>, ) { let blocks = traversal::reachable(body); visit_results(body, blocks.map(|(bb, _)| bb), self, vis) } } - -// Graphviz - -/// Writes a DOT file containing the results of a dataflow analysis if the user requested it via -/// `rustc_mir` attributes and `-Z dump-mir-dataflow`. The `Result` in and the `Results` out are -/// the same. -pub(super) fn write_graphviz_results<'tcx, A>( - tcx: TyCtxt<'tcx>, - body: &mir::Body<'tcx>, - results: &mut Results<'tcx, A>, - pass_name: Option<&'static str>, -) -> std::io::Result<()> -where - A: Analysis<'tcx>, - A::Domain: DebugWithContext<A>, -{ - use std::fs; - use std::io::Write; - - let def_id = body.source.def_id(); - let Ok(attrs) = RustcMirAttrs::parse(tcx, def_id) else { - // Invalid `rustc_mir` attrs are reported in `RustcMirAttrs::parse` - return Ok(()); - }; - - let file = try { - match attrs.output_path(A::NAME) { - Some(path) => { - debug!("printing dataflow results for {:?} to {}", def_id, path.display()); - if let Some(parent) = path.parent() { - fs::create_dir_all(parent)?; - } - fs::File::create_buffered(&path)? - } - - None if dump_enabled(tcx, A::NAME, def_id) => { - create_dump_file(tcx, "dot", false, A::NAME, &pass_name.unwrap_or("-----"), body)? - } - - _ => return Ok(()), - } - }; - let mut file = match file { - Ok(f) => f, - Err(e) => return Err(e), - }; - - let style = match attrs.formatter { - Some(sym::two_phase) => graphviz::OutputStyle::BeforeAndAfter, - _ => graphviz::OutputStyle::AfterOnly, - }; - - let mut buf = Vec::new(); - - let graphviz = graphviz::Formatter::new(body, results, style); - let mut render_opts = - vec![dot::RenderOption::Fontname(tcx.sess.opts.unstable_opts.graphviz_font.clone())]; - if tcx.sess.opts.unstable_opts.graphviz_dark_mode { - render_opts.push(dot::RenderOption::DarkTheme); - } - let r = with_no_trimmed_paths!(dot::render_opts(&graphviz, &mut buf, &render_opts)); - - let lhs = try { - r?; - file.write_all(&buf)?; - }; - - lhs -} - -#[derive(Default)] -struct RustcMirAttrs { - basename_and_suffix: Option<PathBuf>, - formatter: Option<Symbol>, -} - -impl RustcMirAttrs { - fn parse(tcx: TyCtxt<'_>, def_id: DefId) -> Result<Self, ()> { - let mut result = Ok(()); - let mut ret = RustcMirAttrs::default(); - - let rustc_mir_attrs = tcx - .get_attrs(def_id, sym::rustc_mir) - .flat_map(|attr| attr.meta_item_list().into_iter().flat_map(|v| v.into_iter())); - - for attr in rustc_mir_attrs { - let attr_result = if attr.has_name(sym::borrowck_graphviz_postflow) { - Self::set_field(&mut ret.basename_and_suffix, tcx, &attr, |s| { - let path = PathBuf::from(s.to_string()); - match path.file_name() { - Some(_) => Ok(path), - None => { - tcx.dcx().emit_err(PathMustEndInFilename { span: attr.span() }); - Err(()) - } - } - }) - } else if attr.has_name(sym::borrowck_graphviz_format) { - Self::set_field(&mut ret.formatter, tcx, &attr, |s| match s { - sym::gen_kill | sym::two_phase => Ok(s), - _ => { - tcx.dcx().emit_err(UnknownFormatter { span: attr.span() }); - Err(()) - } - }) - } else { - Ok(()) - }; - - result = result.and(attr_result); - } - - result.map(|()| ret) - } - - fn set_field<T>( - field: &mut Option<T>, - tcx: TyCtxt<'_>, - attr: &ast::MetaItemInner, - mapper: impl FnOnce(Symbol) -> Result<T, ()>, - ) -> Result<(), ()> { - if field.is_some() { - tcx.dcx() - .emit_err(DuplicateValuesFor { span: attr.span(), name: attr.name_or_empty() }); - - return Err(()); - } - - if let Some(s) = attr.value_str() { - *field = Some(mapper(s)?); - Ok(()) - } else { - tcx.dcx() - .emit_err(RequiresAnArgument { span: attr.span(), name: attr.name_or_empty() }); - Err(()) - } - } - - /// Returns the path where dataflow results should be written, or `None` - /// `borrowck_graphviz_postflow` was not specified. - /// - /// This performs the following transformation to the argument of `borrowck_graphviz_postflow`: - /// - /// "path/suffix.dot" -> "path/analysis_name_suffix.dot" - fn output_path(&self, analysis_name: &str) -> Option<PathBuf> { - let mut ret = self.basename_and_suffix.as_ref().cloned()?; - let suffix = ret.file_name().unwrap(); // Checked when parsing attrs - - let mut file_name: OsString = analysis_name.into(); - file_name.push("_"); - file_name.push(suffix); - ret.set_file_name(file_name); - - Some(ret) - } -} diff --git a/compiler/rustc_mir_dataflow/src/impls/mod.rs b/compiler/rustc_mir_dataflow/src/impls/mod.rs index b9e194b00c5..d69a8019c8d 100644 --- a/compiler/rustc_mir_dataflow/src/impls/mod.rs +++ b/compiler/rustc_mir_dataflow/src/impls/mod.rs @@ -1,7 +1,3 @@ -//! Dataflow analyses are built upon some interpretation of the -//! bitvectors attached to each basic block, represented via a -//! zero-sized structure. - mod borrowed_locals; mod initialized; mod liveness; diff --git a/compiler/rustc_mir_transform/src/coverage/counters.rs b/compiler/rustc_mir_transform/src/coverage/counters.rs index 46efdd16ee8..9e80f1f1c4a 100644 --- a/compiler/rustc_mir_transform/src/coverage/counters.rs +++ b/compiler/rustc_mir_transform/src/coverage/counters.rs @@ -9,7 +9,7 @@ use rustc_index::bit_set::BitSet; use rustc_middle::mir::coverage::{CounterId, CovTerm, Expression, ExpressionId, Op}; use tracing::{debug, debug_span, instrument}; -use crate::coverage::graph::{BasicCoverageBlock, CoverageGraph, TraverseCoverageGraphWithLoops}; +use crate::coverage::graph::{BasicCoverageBlock, CoverageGraph, ReadyFirstTraversal}; #[cfg(test)] mod tests; @@ -236,23 +236,12 @@ impl<'a> CountersBuilder<'a> { // Traverse the coverage graph, ensuring that every node that needs a // coverage counter has one. - // - // The traversal tries to ensure that, when a loop is encountered, all - // nodes within the loop are visited before visiting any nodes outside - // the loop. - let mut traversal = TraverseCoverageGraphWithLoops::new(self.graph); - while let Some(bcb) = traversal.next() { + for bcb in ReadyFirstTraversal::new(self.graph) { let _span = debug_span!("traversal", ?bcb).entered(); if self.bcb_needs_counter.contains(bcb) { self.make_node_counter_and_out_edge_counters(bcb); } } - - assert!( - traversal.is_complete(), - "`TraverseCoverageGraphWithLoops` missed some `BasicCoverageBlock`s: {:?}", - traversal.unvisited(), - ); } /// Make sure the given node has a node counter, and then make sure each of diff --git a/compiler/rustc_mir_transform/src/coverage/graph.rs b/compiler/rustc_mir_transform/src/coverage/graph.rs index 092bce1de2c..ad6774fccd6 100644 --- a/compiler/rustc_mir_transform/src/coverage/graph.rs +++ b/compiler/rustc_mir_transform/src/coverage/graph.rs @@ -9,7 +9,6 @@ use rustc_data_structures::graph::dominators::Dominators; use rustc_data_structures::graph::{self, DirectedGraph, StartNode}; use rustc_index::IndexVec; use rustc_index::bit_set::BitSet; -use rustc_middle::bug; use rustc_middle::mir::{self, BasicBlock, Terminator, TerminatorKind}; use tracing::debug; @@ -462,138 +461,6 @@ fn bcb_filtered_successors<'a, 'tcx>(terminator: &'a Terminator<'tcx>) -> Covera CoverageSuccessors { targets, is_yield } } -/// Maintains separate worklists for each loop in the BasicCoverageBlock CFG, plus one for the -/// CoverageGraph outside all loops. This supports traversing the BCB CFG in a way that -/// ensures a loop is completely traversed before processing Blocks after the end of the loop. -#[derive(Debug)] -struct TraversalContext { - /// BCB with one or more incoming loop backedges, indicating which loop - /// this context is for. - /// - /// If `None`, this is the non-loop context for the function as a whole. - loop_header: Option<BasicCoverageBlock>, - - /// Worklist of BCBs to be processed in this context. - worklist: VecDeque<BasicCoverageBlock>, -} - -pub(crate) struct TraverseCoverageGraphWithLoops<'a> { - basic_coverage_blocks: &'a CoverageGraph, - - context_stack: Vec<TraversalContext>, - visited: BitSet<BasicCoverageBlock>, -} - -impl<'a> TraverseCoverageGraphWithLoops<'a> { - pub(crate) fn new(basic_coverage_blocks: &'a CoverageGraph) -> Self { - let worklist = VecDeque::from([basic_coverage_blocks.start_node()]); - let context_stack = vec![TraversalContext { loop_header: None, worklist }]; - - // `context_stack` starts with a `TraversalContext` for the main function context (beginning - // with the `start` BasicCoverageBlock of the function). New worklists are pushed to the top - // of the stack as loops are entered, and popped off of the stack when a loop's worklist is - // exhausted. - let visited = BitSet::new_empty(basic_coverage_blocks.num_nodes()); - Self { basic_coverage_blocks, context_stack, visited } - } - - pub(crate) fn next(&mut self) -> Option<BasicCoverageBlock> { - debug!( - "TraverseCoverageGraphWithLoops::next - context_stack: {:?}", - self.context_stack.iter().rev().collect::<Vec<_>>() - ); - - while let Some(context) = self.context_stack.last_mut() { - let Some(bcb) = context.worklist.pop_front() else { - // This stack level is exhausted; pop it and try the next one. - self.context_stack.pop(); - continue; - }; - - if !self.visited.insert(bcb) { - debug!("Already visited: {bcb:?}"); - continue; - } - debug!("Visiting {bcb:?}"); - - if self.basic_coverage_blocks.is_loop_header.contains(bcb) { - debug!("{bcb:?} is a loop header! Start a new TraversalContext..."); - self.context_stack - .push(TraversalContext { loop_header: Some(bcb), worklist: VecDeque::new() }); - } - self.add_successors_to_worklists(bcb); - return Some(bcb); - } - - None - } - - fn add_successors_to_worklists(&mut self, bcb: BasicCoverageBlock) { - let successors = &self.basic_coverage_blocks.successors[bcb]; - debug!("{:?} has {} successors:", bcb, successors.len()); - - for &successor in successors { - if successor == bcb { - debug!( - "{:?} has itself as its own successor. (Note, the compiled code will \ - generate an infinite loop.)", - bcb - ); - // Don't re-add this successor to the worklist. We are already processing it. - // FIXME: This claims to skip just the self-successor, but it actually skips - // all other successors as well. Does that matter? - break; - } - - // Add successors of the current BCB to the appropriate context. Successors that - // stay within a loop are added to the BCBs context worklist. Successors that - // exit the loop (they are not dominated by the loop header) must be reachable - // from other BCBs outside the loop, and they will be added to a different - // worklist. - // - // Branching blocks (with more than one successor) must be processed before - // blocks with only one successor, to prevent unnecessarily complicating - // `Expression`s by creating a Counter in a `BasicCoverageBlock` that the - // branching block would have given an `Expression` (or vice versa). - - let context = self - .context_stack - .iter_mut() - .rev() - .find(|context| match context.loop_header { - Some(loop_header) => { - self.basic_coverage_blocks.dominates(loop_header, successor) - } - None => true, - }) - .unwrap_or_else(|| bug!("should always fall back to the root non-loop context")); - debug!("adding to worklist for {:?}", context.loop_header); - - // FIXME: The code below had debug messages claiming to add items to a - // particular end of the worklist, but was confused about which end was - // which. The existing behaviour has been preserved for now, but it's - // unclear what the intended behaviour was. - - if self.basic_coverage_blocks.successors[successor].len() > 1 { - context.worklist.push_back(successor); - } else { - context.worklist.push_front(successor); - } - } - } - - pub(crate) fn is_complete(&self) -> bool { - self.visited.count() == self.visited.domain_size() - } - - pub(crate) fn unvisited(&self) -> Vec<BasicCoverageBlock> { - let mut unvisited_set: BitSet<BasicCoverageBlock> = - BitSet::new_filled(self.visited.domain_size()); - unvisited_set.subtract(&self.visited); - unvisited_set.iter().collect::<Vec<_>>() - } -} - /// Wrapper around a [`mir::BasicBlocks`] graph that restricts each node's /// successors to only the ones considered "relevant" when building a coverage /// graph. @@ -622,3 +489,126 @@ impl<'a, 'tcx> graph::Successors for CoverageRelevantSubgraph<'a, 'tcx> { self.coverage_successors(bb).into_iter() } } + +/// State of a node in the coverage graph during ready-first traversal. +#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)] +enum ReadyState { + /// This node has not yet been added to the fallback queue or ready queue. + Unqueued, + /// This node is currently in the fallback queue. + InFallbackQueue, + /// This node's predecessors have all been visited, so it is in the ready queue. + /// (It might also have a stale entry in the fallback queue.) + InReadyQueue, + /// This node has been visited. + /// (It might also have a stale entry in the fallback queue.) + Visited, +} + +/// Iterator that visits nodes in the coverage graph, in an order that always +/// prefers "ready" nodes whose predecessors have already been visited. +pub(crate) struct ReadyFirstTraversal<'a> { + graph: &'a CoverageGraph, + + /// For each node, the number of its predecessor nodes that haven't been visited yet. + n_unvisited_preds: IndexVec<BasicCoverageBlock, u32>, + /// Indicates whether a node has been visited, or which queue it is in. + state: IndexVec<BasicCoverageBlock, ReadyState>, + + /// Holds unvisited nodes whose predecessors have all been visited. + ready_queue: VecDeque<BasicCoverageBlock>, + /// Holds unvisited nodes with some unvisited predecessors. + /// Also contains stale entries for nodes that were upgraded to ready. + fallback_queue: VecDeque<BasicCoverageBlock>, +} + +impl<'a> ReadyFirstTraversal<'a> { + pub(crate) fn new(graph: &'a CoverageGraph) -> Self { + let num_nodes = graph.num_nodes(); + + let n_unvisited_preds = + IndexVec::from_fn_n(|node| graph.predecessors[node].len() as u32, num_nodes); + let mut state = IndexVec::from_elem_n(ReadyState::Unqueued, num_nodes); + + // We know from coverage graph construction that the start node is the + // only node with no predecessors. + debug_assert!( + n_unvisited_preds.iter_enumerated().all(|(node, &n)| (node == START_BCB) == (n == 0)) + ); + let ready_queue = VecDeque::from(vec![START_BCB]); + state[START_BCB] = ReadyState::InReadyQueue; + + Self { graph, state, n_unvisited_preds, ready_queue, fallback_queue: VecDeque::new() } + } + + /// Returns the next node from the ready queue, or else the next unvisited + /// node from the fallback queue. + fn next_inner(&mut self) -> Option<BasicCoverageBlock> { + // Always prefer to yield a ready node if possible. + if let Some(node) = self.ready_queue.pop_front() { + assert_eq!(self.state[node], ReadyState::InReadyQueue); + return Some(node); + } + + while let Some(node) = self.fallback_queue.pop_front() { + match self.state[node] { + // This entry in the fallback queue is not stale, so yield it. + ReadyState::InFallbackQueue => return Some(node), + // This node was added to the fallback queue, but later became + // ready and was visited via the ready queue. Ignore it here. + ReadyState::Visited => {} + // Unqueued nodes can't be in the fallback queue, by definition. + // We know that the ready queue is empty at this point. + ReadyState::Unqueued | ReadyState::InReadyQueue => unreachable!( + "unexpected state for {node:?} in the fallback queue: {:?}", + self.state[node] + ), + } + } + + None + } + + fn mark_visited_and_enqueue_successors(&mut self, node: BasicCoverageBlock) { + assert!(self.state[node] < ReadyState::Visited); + self.state[node] = ReadyState::Visited; + + // For each of this node's successors, decrease the successor's + // "unvisited predecessors" count, and enqueue it if appropriate. + for &succ in &self.graph.successors[node] { + let is_unqueued = match self.state[succ] { + ReadyState::Unqueued => true, + ReadyState::InFallbackQueue => false, + ReadyState::InReadyQueue => { + unreachable!("nodes in the ready queue have no unvisited predecessors") + } + // The successor was already visited via one of its other predecessors. + ReadyState::Visited => continue, + }; + + self.n_unvisited_preds[succ] -= 1; + if self.n_unvisited_preds[succ] == 0 { + // This node's predecessors have all been visited, so add it to + // the ready queue. If it's already in the fallback queue, that + // fallback entry will be ignored later. + self.state[succ] = ReadyState::InReadyQueue; + self.ready_queue.push_back(succ); + } else if is_unqueued { + // This node has unvisited predecessors, so add it to the + // fallback queue in case we run out of ready nodes later. + self.state[succ] = ReadyState::InFallbackQueue; + self.fallback_queue.push_back(succ); + } + } + } +} + +impl<'a> Iterator for ReadyFirstTraversal<'a> { + type Item = BasicCoverageBlock; + + fn next(&mut self) -> Option<Self::Item> { + let node = self.next_inner()?; + self.mark_visited_and_enqueue_successors(node); + Some(node) + } +} diff --git a/compiler/rustc_mir_transform/src/coverage/query.rs b/compiler/rustc_mir_transform/src/coverage/query.rs index 0090f6f3040..edaec3c7965 100644 --- a/compiler/rustc_mir_transform/src/coverage/query.rs +++ b/compiler/rustc_mir_transform/src/coverage/query.rs @@ -1,8 +1,11 @@ use rustc_data_structures::captures::Captures; use rustc_index::bit_set::BitSet; use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags; -use rustc_middle::mir::coverage::{CovTerm, CoverageKind, MappingKind}; -use rustc_middle::mir::{Body, CoverageIdsInfo, Statement, StatementKind}; +use rustc_middle::mir::coverage::{ + CounterId, CovTerm, CoverageIdsInfo, CoverageKind, Expression, ExpressionId, + FunctionCoverageInfo, MappingKind, Op, +}; +use rustc_middle::mir::{Body, Statement, StatementKind}; use rustc_middle::query::TyCtxtAt; use rustc_middle::ty::{self, TyCtxt}; use rustc_middle::util::Providers; @@ -87,10 +90,10 @@ fn coverage_ids_info<'tcx>( ) -> CoverageIdsInfo { let mir_body = tcx.instance_mir(instance_def); - let Some(fn_cov_info) = mir_body.function_coverage_info.as_ref() else { + let Some(fn_cov_info) = mir_body.function_coverage_info.as_deref() else { return CoverageIdsInfo { counters_seen: BitSet::new_empty(0), - expressions_seen: BitSet::new_empty(0), + zero_expressions: BitSet::new_empty(0), }; }; @@ -123,7 +126,10 @@ fn coverage_ids_info<'tcx>( } } - CoverageIdsInfo { counters_seen, expressions_seen } + let zero_expressions = + identify_zero_expressions(fn_cov_info, &counters_seen, &expressions_seen); + + CoverageIdsInfo { counters_seen, zero_expressions } } fn all_coverage_in_mir_body<'a, 'tcx>( @@ -141,3 +147,94 @@ fn is_inlined(body: &Body<'_>, statement: &Statement<'_>) -> bool { let scope_data = &body.source_scopes[statement.source_info.scope]; scope_data.inlined.is_some() || scope_data.inlined_parent_scope.is_some() } + +/// Identify expressions that will always have a value of zero, and note +/// their IDs in a `BitSet`. Mappings that refer to a zero expression +/// can instead become mappings to a constant zero value. +/// +/// This function mainly exists to preserve the simplifications that were +/// already being performed by the Rust-side expression renumbering, so that +/// the resulting coverage mappings don't get worse. +fn identify_zero_expressions( + fn_cov_info: &FunctionCoverageInfo, + counters_seen: &BitSet<CounterId>, + expressions_seen: &BitSet<ExpressionId>, +) -> BitSet<ExpressionId> { + // The set of expressions that either were optimized out entirely, or + // have zero as both of their operands, and will therefore always have + // a value of zero. Other expressions that refer to these as operands + // can have those operands replaced with `CovTerm::Zero`. + let mut zero_expressions = BitSet::new_empty(fn_cov_info.expressions.len()); + + // Simplify a copy of each expression based on lower-numbered expressions, + // and then update the set of always-zero expressions if necessary. + // (By construction, expressions can only refer to other expressions + // that have lower IDs, so one pass is sufficient.) + for (id, expression) in fn_cov_info.expressions.iter_enumerated() { + if !expressions_seen.contains(id) { + // If an expression was not seen, it must have been optimized away, + // so any operand that refers to it can be replaced with zero. + zero_expressions.insert(id); + continue; + } + + // We don't need to simplify the actual expression data in the + // expressions list; we can just simplify a temporary copy and then + // use that to update the set of always-zero expressions. + let Expression { mut lhs, op, mut rhs } = *expression; + + // If an expression has an operand that is also an expression, the + // operand's ID must be strictly lower. This is what lets us find + // all zero expressions in one pass. + let assert_operand_expression_is_lower = |operand_id: ExpressionId| { + assert!( + operand_id < id, + "Operand {operand_id:?} should be less than {id:?} in {expression:?}", + ) + }; + + // If an operand refers to a counter or expression that is always + // zero, then that operand can be replaced with `CovTerm::Zero`. + let maybe_set_operand_to_zero = |operand: &mut CovTerm| { + if let CovTerm::Expression(id) = *operand { + assert_operand_expression_is_lower(id); + } + + if is_zero_term(&counters_seen, &zero_expressions, *operand) { + *operand = CovTerm::Zero; + } + }; + maybe_set_operand_to_zero(&mut lhs); + maybe_set_operand_to_zero(&mut rhs); + + // Coverage counter values cannot be negative, so if an expression + // involves subtraction from zero, assume that its RHS must also be zero. + // (Do this after simplifications that could set the LHS to zero.) + if lhs == CovTerm::Zero && op == Op::Subtract { + rhs = CovTerm::Zero; + } + + // After the above simplifications, if both operands are zero, then + // we know that this expression is always zero too. + if lhs == CovTerm::Zero && rhs == CovTerm::Zero { + zero_expressions.insert(id); + } + } + + zero_expressions +} + +/// Returns `true` if the given term is known to have a value of zero, taking +/// into account knowledge of which counters are unused and which expressions +/// are always zero. +fn is_zero_term( + counters_seen: &BitSet<CounterId>, + zero_expressions: &BitSet<ExpressionId>, + term: CovTerm, +) -> bool { + match term { + CovTerm::Zero => true, + CovTerm::Counter(id) => !counters_seen.contains(id), + CovTerm::Expression(id) => zero_expressions.contains(id), + } +} diff --git a/compiler/rustc_mir_transform/src/dataflow_const_prop.rs b/compiler/rustc_mir_transform/src/dataflow_const_prop.rs index d017202f48b..b94c925b1db 100644 --- a/compiler/rustc_mir_transform/src/dataflow_const_prop.rs +++ b/compiler/rustc_mir_transform/src/dataflow_const_prop.rs @@ -534,8 +534,13 @@ impl<'a, 'tcx> ConstAnalysis<'a, 'tcx> { // This allows the set of visited edges to grow monotonically with the lattice. FlatSet::Bottom => TerminatorEdges::None, FlatSet::Elem(scalar) => { - let choice = scalar.assert_scalar_int().to_bits_unchecked(); - TerminatorEdges::Single(targets.target_for_value(choice)) + if let Ok(scalar_int) = scalar.try_to_scalar_int() { + TerminatorEdges::Single( + targets.target_for_value(scalar_int.to_bits_unchecked()), + ) + } else { + TerminatorEdges::SwitchInt { discr, targets } + } } FlatSet::Top => TerminatorEdges::SwitchInt { discr, targets }, } diff --git a/compiler/rustc_parse/messages.ftl b/compiler/rustc_parse/messages.ftl index e5cd4622dae..d50bd18a1d7 100644 --- a/compiler/rustc_parse/messages.ftl +++ b/compiler/rustc_parse/messages.ftl @@ -169,9 +169,6 @@ parse_enum_struct_mutually_exclusive = `enum` and `struct` are mutually exclusiv parse_eq_field_init = expected `:`, found `=` .suggestion = replace equals symbol with a colon -parse_equals_struct_default = default values on `struct` fields aren't supported - .suggestion = remove this unsupported default value - parse_escape_only_char = {$byte -> [true] byte *[false] character diff --git a/compiler/rustc_parse/src/errors.rs b/compiler/rustc_parse/src/errors.rs index 14f2dd32e92..4c4e03cdfa3 100644 --- a/compiler/rustc_parse/src/errors.rs +++ b/compiler/rustc_parse/src/errors.rs @@ -3067,14 +3067,6 @@ pub(crate) struct SingleColonStructType { } #[derive(Diagnostic)] -#[diag(parse_equals_struct_default)] -pub(crate) struct EqualsStructDefault { - #[primary_span] - #[suggestion(code = "", applicability = "machine-applicable", style = "verbose")] - pub span: Span, -} - -#[derive(Diagnostic)] #[diag(parse_macro_rules_missing_bang)] pub(crate) struct MacroRulesMissingBang { #[primary_span] diff --git a/compiler/rustc_parse/src/lexer/mod.rs b/compiler/rustc_parse/src/lexer/mod.rs index d97f05dc7eb..2426eb81678 100644 --- a/compiler/rustc_parse/src/lexer/mod.rs +++ b/compiler/rustc_parse/src/lexer/mod.rs @@ -822,7 +822,7 @@ impl<'psess, 'src> Lexer<'psess, 'src> { /// Detect guarded string literal syntax /// - /// RFC 3598 reserved this syntax for future use. As of Rust 2024, + /// RFC 3593 reserved this syntax for future use. As of Rust 2024, /// using this syntax produces an error. In earlier editions, however, it /// only results in an (allowed by default) lint, and is treated as /// separate tokens. diff --git a/compiler/rustc_parse/src/lib.rs b/compiler/rustc_parse/src/lib.rs index 2792050a0b3..f963a424a7f 100644 --- a/compiler/rustc_parse/src/lib.rs +++ b/compiler/rustc_parse/src/lib.rs @@ -24,6 +24,7 @@ use rustc_data_structures::sync::Lrc; use rustc_errors::{Diag, FatalError, PResult}; use rustc_session::parse::ParseSess; use rustc_span::{FileName, SourceFile, Span}; +pub use unicode_normalization::UNICODE_VERSION as UNICODE_NORMALIZATION_VERSION; pub const MACRO_ARGUMENTS: Option<&str> = Some("macro arguments"); diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs index 3a9e9b480ec..eeb83a85e59 100644 --- a/compiler/rustc_parse/src/parser/expr.rs +++ b/compiler/rustc_parse/src/parser/expr.rs @@ -3533,7 +3533,7 @@ impl<'a> Parser<'a> { let exp_span = self.prev_token.span; // We permit `.. }` on the left-hand side of a destructuring assignment. if self.check(&token::CloseDelim(close_delim)) { - base = ast::StructRest::Rest(self.prev_token.span.shrink_to_hi()); + base = ast::StructRest::Rest(self.prev_token.span); break; } match self.parse_expr() { diff --git a/compiler/rustc_parse/src/parser/item.rs b/compiler/rustc_parse/src/parser/item.rs index 475cd09147f..58b4bf8980b 100644 --- a/compiler/rustc_parse/src/parser/item.rs +++ b/compiler/rustc_parse/src/parser/item.rs @@ -1836,6 +1836,22 @@ impl<'a> Parser<'a> { return Err(err); } }; + let mut default = None; + if p.token == token::Eq { + let mut snapshot = p.create_snapshot_for_diagnostic(); + snapshot.bump(); + match snapshot.parse_expr_anon_const() { + Ok(const_expr) => { + let sp = ty.span.shrink_to_hi().to(const_expr.value.span); + p.psess.gated_spans.gate(sym::default_field_values, sp); + p.restore_snapshot(snapshot); + default = Some(const_expr); + } + Err(err) => { + err.cancel(); + } + } + } Ok(( FieldDef { @@ -1845,6 +1861,7 @@ impl<'a> Parser<'a> { ident: None, id: DUMMY_NODE_ID, ty, + default, attrs, is_placeholder: false, }, @@ -2024,12 +2041,15 @@ impl<'a> Parser<'a> { if self.token == token::Colon && self.look_ahead(1, |t| *t != token::Colon) { self.dcx().emit_err(errors::SingleColonStructType { span: self.token.span }); } - if self.token == token::Eq { + let default = if self.token == token::Eq { self.bump(); let const_expr = self.parse_expr_anon_const()?; let sp = ty.span.shrink_to_hi().to(const_expr.value.span); - self.dcx().emit_err(errors::EqualsStructDefault { span: sp }); - } + self.psess.gated_spans.gate(sym::default_field_values, sp); + Some(const_expr) + } else { + None + }; Ok(FieldDef { span: lo.to(self.prev_token.span), ident: Some(name), @@ -2037,6 +2057,7 @@ impl<'a> Parser<'a> { safety, id: DUMMY_NODE_ID, ty, + default, attrs, is_placeholder: false, }) diff --git a/compiler/rustc_passes/src/debugger_visualizer.rs b/compiler/rustc_passes/src/debugger_visualizer.rs index fec149c8c43..062d56a79a0 100644 --- a/compiler/rustc_passes/src/debugger_visualizer.rs +++ b/compiler/rustc_passes/src/debugger_visualizer.rs @@ -1,7 +1,6 @@ //! Detecting usage of the `#[debugger_visualizer]` attribute. use rustc_ast::Attribute; -use rustc_data_structures::sync::Lrc; use rustc_expand::base::resolve_path; use rustc_middle::middle::debugger_visualizer::{DebuggerVisualizerFile, DebuggerVisualizerType}; use rustc_middle::query::{LocalCrate, Providers}; @@ -49,10 +48,10 @@ impl DebuggerVisualizerCollector<'_> { } }; - match std::fs::read(&file) { - Ok(contents) => { + match self.sess.source_map().load_binary_file(&file) { + Ok((source, _)) => { self.visualizers.push(DebuggerVisualizerFile::new( - Lrc::from(contents), + source, visualizer_type, file, )); diff --git a/compiler/rustc_passes/src/liveness.rs b/compiler/rustc_passes/src/liveness.rs index 9cd95a0b02d..09cbb648f9b 100644 --- a/compiler/rustc_passes/src/liveness.rs +++ b/compiler/rustc_passes/src/liveness.rs @@ -1007,7 +1007,12 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> { hir::ExprKind::Array(exprs) => self.propagate_through_exprs(exprs, succ), hir::ExprKind::Struct(_, fields, ref with_expr) => { - let succ = self.propagate_through_opt_expr(with_expr.as_deref(), succ); + let succ = match with_expr { + hir::StructTailExpr::Base(base) => { + self.propagate_through_opt_expr(Some(base), succ) + } + hir::StructTailExpr::None | hir::StructTailExpr::DefaultFields(_) => succ, + }; fields .iter() .rev() diff --git a/compiler/rustc_privacy/src/lib.rs b/compiler/rustc_privacy/src/lib.rs index c845d60ac07..3057f13e3a7 100644 --- a/compiler/rustc_privacy/src/lib.rs +++ b/compiler/rustc_privacy/src/lib.rs @@ -947,6 +947,25 @@ impl<'tcx> NamePrivacyVisitor<'tcx> { }); } } + + fn check_expanded_fields( + &mut self, + adt: ty::AdtDef<'tcx>, + variant: &'tcx ty::VariantDef, + fields: &[hir::ExprField<'tcx>], + hir_id: hir::HirId, + span: Span, + ) { + for (vf_index, variant_field) in variant.fields.iter_enumerated() { + let field = + fields.iter().find(|f| self.typeck_results().field_index(f.hir_id) == vf_index); + let (hir_id, use_ctxt, span) = match field { + Some(field) => (field.hir_id, field.ident.span, field.span), + None => (hir_id, span, span), + }; + self.check_field(hir_id, use_ctxt, span, adt, variant_field, true); + } + } } impl<'tcx> Visitor<'tcx> for NamePrivacyVisitor<'tcx> { @@ -966,25 +985,29 @@ impl<'tcx> Visitor<'tcx> for NamePrivacyVisitor<'tcx> { let res = self.typeck_results().qpath_res(qpath, expr.hir_id); let adt = self.typeck_results().expr_ty(expr).ty_adt_def().unwrap(); let variant = adt.variant_of_res(res); - if let Some(base) = *base { - // If the expression uses FRU we need to make sure all the unmentioned fields - // are checked for privacy (RFC 736). Rather than computing the set of - // unmentioned fields, just check them all. - for (vf_index, variant_field) in variant.fields.iter_enumerated() { - let field = fields - .iter() - .find(|f| self.typeck_results().field_index(f.hir_id) == vf_index); - let (hir_id, use_ctxt, span) = match field { - Some(field) => (field.hir_id, field.ident.span, field.span), - None => (base.hir_id, base.span, base.span), - }; - self.check_field(hir_id, use_ctxt, span, adt, variant_field, true); + match *base { + hir::StructTailExpr::Base(base) => { + // If the expression uses FRU we need to make sure all the unmentioned fields + // are checked for privacy (RFC 736). Rather than computing the set of + // unmentioned fields, just check them all. + self.check_expanded_fields(adt, variant, fields, base.hir_id, base.span); } - } else { - for field in fields { - let (hir_id, use_ctxt, span) = (field.hir_id, field.ident.span, field.span); - let index = self.typeck_results().field_index(field.hir_id); - self.check_field(hir_id, use_ctxt, span, adt, &variant.fields[index], false); + hir::StructTailExpr::DefaultFields(span) => { + self.check_expanded_fields(adt, variant, fields, expr.hir_id, span); + } + hir::StructTailExpr::None => { + for field in fields { + let (hir_id, use_ctxt, span) = (field.hir_id, field.ident.span, field.span); + let index = self.typeck_results().field_index(field.hir_id); + self.check_field( + hir_id, + use_ctxt, + span, + adt, + &variant.fields[index], + false, + ); + } } } } diff --git a/compiler/rustc_resolve/src/late.rs b/compiler/rustc_resolve/src/late.rs index fc92dc8b4ed..789d74876f7 100644 --- a/compiler/rustc_resolve/src/late.rs +++ b/compiler/rustc_resolve/src/late.rs @@ -13,7 +13,9 @@ use std::collections::hash_map::Entry; use std::mem::{replace, swap, take}; use rustc_ast::ptr::P; -use rustc_ast::visit::{AssocCtxt, BoundKind, FnCtxt, FnKind, Visitor, visit_opt, walk_list}; +use rustc_ast::visit::{ + AssocCtxt, BoundKind, FnCtxt, FnKind, Visitor, try_visit, visit_opt, walk_list, +}; use rustc_ast::*; use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexMap}; use rustc_errors::codes::*; @@ -749,8 +751,8 @@ impl<'ra: 'ast, 'ast, 'tcx> Visitor<'ast> for LateResolutionVisitor<'_, 'ast, 'r self.resolve_block(block); self.parent_scope.macro_rules = old_macro_rules; } - fn visit_anon_const(&mut self, _constant: &'ast AnonConst) { - bug!("encountered anon const without a manual call to `resolve_anon_const`"); + fn visit_anon_const(&mut self, constant: &'ast AnonConst) { + bug!("encountered anon const without a manual call to `resolve_anon_const`: {constant:#?}"); } fn visit_expr(&mut self, expr: &'ast Expr) { self.resolve_expr(expr, None); @@ -1346,7 +1348,24 @@ impl<'ra: 'ast, 'ast, 'tcx> Visitor<'ast> for LateResolutionVisitor<'_, 'ast, 'r fn visit_field_def(&mut self, f: &'ast FieldDef) { self.resolve_doc_links(&f.attrs, MaybeExported::Ok(f.id)); - visit::walk_field_def(self, f) + let FieldDef { + attrs, + id: _, + span: _, + vis, + ident, + ty, + is_placeholder: _, + default, + safety: _, + } = f; + walk_list!(self, visit_attribute, attrs); + try_visit!(self.visit_vis(vis)); + visit_opt!(self, visit_ident, ident); + try_visit!(self.visit_ty(ty)); + if let Some(v) = &default { + self.resolve_anon_const(v, AnonConstKind::ConstArg(IsRepeatExpr::No)); + } } } diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index 818d4afffc6..d30b17c9cd8 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -728,6 +728,7 @@ symbols! { declare_lint_pass, decode, default_alloc_error_handler, + default_field_values, default_fn, default_lib_allocator, default_method_body_is_const, diff --git a/compiler/rustc_target/src/target_features.rs b/compiler/rustc_target/src/target_features.rs index 67c047dddfc..3a130607265 100644 --- a/compiler/rustc_target/src/target_features.rs +++ b/compiler/rustc_target/src/target_features.rs @@ -412,6 +412,7 @@ const POWERPC_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[ ("partword-atomics", Unstable(sym::powerpc_target_feature), &[]), ("power10-vector", Unstable(sym::powerpc_target_feature), &["power9-vector"]), ("power8-altivec", Unstable(sym::powerpc_target_feature), &["altivec"]), + ("power8-crypto", Unstable(sym::powerpc_target_feature), &["power8-altivec"]), ("power8-vector", Unstable(sym::powerpc_target_feature), &["vsx", "power8-altivec"]), ("power9-altivec", Unstable(sym::powerpc_target_feature), &["power8-altivec"]), ("power9-vector", Unstable(sym::powerpc_target_feature), &["power8-vector", "power9-altivec"]), diff --git a/compiler/rustc_trait_selection/src/traits/misc.rs b/compiler/rustc_trait_selection/src/traits/misc.rs index 3b17fa6b032..d216ae72913 100644 --- a/compiler/rustc_trait_selection/src/traits/misc.rs +++ b/compiler/rustc_trait_selection/src/traits/misc.rs @@ -18,6 +18,7 @@ pub enum CopyImplementationError<'tcx> { InfringingFields(Vec<(&'tcx ty::FieldDef, Ty<'tcx>, InfringingFieldsReason<'tcx>)>), NotAnAdt, HasDestructor, + HasUnsafeFields, } pub enum ConstParamTyImplementationError<'tcx> { @@ -39,11 +40,16 @@ pub enum InfringingFieldsReason<'tcx> { /// /// If it's not an ADT, int ty, `bool`, float ty, `char`, raw pointer, `!`, /// a reference or an array returns `Err(NotAnAdt)`. +/// +/// If the impl is `Safe`, `self_type` must not have unsafe fields. When used to +/// generate suggestions in lints, `Safe` should be supplied so as to not +/// suggest implementing `Copy` for types with unsafe fields. pub fn type_allowed_to_implement_copy<'tcx>( tcx: TyCtxt<'tcx>, param_env: ty::ParamEnv<'tcx>, self_type: Ty<'tcx>, parent_cause: ObligationCause<'tcx>, + impl_safety: hir::Safety, ) -> Result<(), CopyImplementationError<'tcx>> { let (adt, args) = match self_type.kind() { // These types used to have a builtin impl. @@ -78,6 +84,10 @@ pub fn type_allowed_to_implement_copy<'tcx>( return Err(CopyImplementationError::HasDestructor); } + if impl_safety == hir::Safety::Safe && self_type.has_unsafe_fields() { + return Err(CopyImplementationError::HasUnsafeFields); + } + Ok(()) } diff --git a/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs b/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs index 3e2c8467d32..5e27fd43789 100644 --- a/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs +++ b/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs @@ -795,8 +795,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { | ty::Never | ty::Tuple(_) | ty::CoroutineWitness(..) => { - use rustc_type_ir::inherent::*; - // Only consider auto impls of unsafe traits when there are // no unsafe fields. if self.tcx().trait_is_unsafe(def_id) && self_ty.has_unsafe_fields() { diff --git a/config.example.toml b/config.example.toml index 9ec0d77e79b..5ea6774ce03 100644 --- a/config.example.toml +++ b/config.example.toml @@ -311,9 +311,8 @@ # Indicate whether the vendored sources are used for Rust dependencies or not. # # Vendoring requires additional setup. We recommend using the pre-generated source tarballs if you -# want to use vendoring. See -# https://forge.rust-lang.org/infra/other-installation-methods.html#source-code. -#vendor = false +# want to use vendoring. See https://forge.rust-lang.org/infra/other-installation-methods.html#source-code. +#vendor = if "is a tarball source" && "vendor" dir exists && ".cargo/config.toml" file exists { true } else { false } # Typically the build system will build the Rust compiler twice. The second # compiler, however, will simply use its own libraries to link against. If you diff --git a/library/Cargo.lock b/library/Cargo.lock index f9b0af2c6e8..03c2356e542 100644 --- a/library/Cargo.lock +++ b/library/Cargo.lock @@ -36,9 +36,9 @@ dependencies = [ [[package]] name = "allocator-api2" -version = "0.2.18" +version = "0.2.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" +checksum = "45862d1c77f2228b9e10bc609d5bc203d86ebc9b87ad8d5d5167a6c9abf739d9" [[package]] name = "cc" @@ -403,9 +403,9 @@ dependencies = [ [[package]] name = "unwinding" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "637d511437df708cee34bdec7ba2f1548d256b7acf3ff20e0a1c559f9bf3a987" +checksum = "e2c6cb20f236dae10c69b0b45d82ef50af8b7e45c10e429e7901d26b49b4dbf3" dependencies = [ "compiler_builtins", "gimli 0.31.1", diff --git a/library/core/src/ops/control_flow.rs b/library/core/src/ops/control_flow.rs index c4429b3cd7d..c8fcee5c140 100644 --- a/library/core/src/ops/control_flow.rs +++ b/library/core/src/ops/control_flow.rs @@ -141,8 +141,8 @@ impl<B, C> ControlFlow<B, C> { /// ``` /// use std::ops::ControlFlow; /// - /// assert!(ControlFlow::<i32, String>::Break(3).is_break()); - /// assert!(!ControlFlow::<String, i32>::Continue(3).is_break()); + /// assert!(ControlFlow::<&str, i32>::Break("Stop right there!").is_break()); + /// assert!(!ControlFlow::<&str, i32>::Continue(3).is_break()); /// ``` #[inline] #[stable(feature = "control_flow_enum_is", since = "1.59.0")] @@ -157,8 +157,8 @@ impl<B, C> ControlFlow<B, C> { /// ``` /// use std::ops::ControlFlow; /// - /// assert!(!ControlFlow::<i32, String>::Break(3).is_continue()); - /// assert!(ControlFlow::<String, i32>::Continue(3).is_continue()); + /// assert!(!ControlFlow::<&str, i32>::Break("Stop right there!").is_continue()); + /// assert!(ControlFlow::<&str, i32>::Continue(3).is_continue()); /// ``` #[inline] #[stable(feature = "control_flow_enum_is", since = "1.59.0")] @@ -174,8 +174,8 @@ impl<B, C> ControlFlow<B, C> { /// ``` /// use std::ops::ControlFlow; /// - /// assert_eq!(ControlFlow::<i32, String>::Break(3).break_value(), Some(3)); - /// assert_eq!(ControlFlow::<String, i32>::Continue(3).break_value(), None); + /// assert_eq!(ControlFlow::<&str, i32>::Break("Stop right there!").break_value(), Some("Stop right there!")); + /// assert_eq!(ControlFlow::<&str, i32>::Continue(3).break_value(), None); /// ``` #[inline] #[stable(feature = "control_flow_enum", since = "1.83.0")] @@ -205,8 +205,8 @@ impl<B, C> ControlFlow<B, C> { /// ``` /// use std::ops::ControlFlow; /// - /// assert_eq!(ControlFlow::<i32, String>::Break(3).continue_value(), None); - /// assert_eq!(ControlFlow::<String, i32>::Continue(3).continue_value(), Some(3)); + /// assert_eq!(ControlFlow::<&str, i32>::Break("Stop right there!").continue_value(), None); + /// assert_eq!(ControlFlow::<&str, i32>::Continue(3).continue_value(), Some(3)); /// ``` #[inline] #[stable(feature = "control_flow_enum", since = "1.83.0")] diff --git a/library/std/src/sys/pal/wasi/fs.rs b/library/std/src/sys/pal/wasi/fs.rs index 0667eb90101..7779d2b97d7 100644 --- a/library/std/src/sys/pal/wasi/fs.rs +++ b/library/std/src/sys/pal/wasi/fs.rs @@ -27,10 +27,27 @@ pub struct FileAttr { pub struct ReadDir { inner: Arc<ReadDirInner>, - cookie: Option<wasi::Dircookie>, - buf: Vec<u8>, - offset: usize, - cap: usize, + state: ReadDirState, +} + +enum ReadDirState { + /// Fill `buf` with `buf.len()` bytes starting from `next_read_offset`. + FillBuffer { + next_read_offset: wasi::Dircookie, + buf: Vec<u8>, + }, + ProcessEntry { + buf: Vec<u8>, + next_read_offset: Option<wasi::Dircookie>, + offset: usize, + }, + /// There is no more data to get in [`Self::FillBuffer`]; keep returning + /// entries via ProcessEntry until `buf` is exhausted. + RunUntilExhaustion { + buf: Vec<u8>, + offset: usize, + }, + Done, } struct ReadDirInner { @@ -147,11 +164,8 @@ impl FileType { impl ReadDir { fn new(dir: File, root: PathBuf) -> ReadDir { ReadDir { - cookie: Some(0), - buf: vec![0; 128], - offset: 0, - cap: 0, inner: Arc::new(ReadDirInner { dir, root }), + state: ReadDirState::FillBuffer { next_read_offset: 0, buf: vec![0; 128] }, } } } @@ -162,78 +176,99 @@ impl fmt::Debug for ReadDir { } } +impl core::iter::FusedIterator for ReadDir {} + impl Iterator for ReadDir { type Item = io::Result<DirEntry>; fn next(&mut self) -> Option<io::Result<DirEntry>> { - loop { - // If we've reached the capacity of our buffer then we need to read - // some more from the OS, otherwise we pick up at our old offset. - let offset = if self.offset == self.cap { - let cookie = self.cookie.take()?; - match self.inner.dir.fd.readdir(&mut self.buf, cookie) { - Ok(bytes) => self.cap = bytes, - Err(e) => return Some(Err(e)), - } - self.offset = 0; - self.cookie = Some(cookie); - - // If we didn't actually read anything, this is in theory the - // end of the directory. - if self.cap == 0 { - self.cookie = None; - return None; - } - - 0 - } else { - self.offset - }; - let data = &self.buf[offset..self.cap]; - - // If we're not able to read a directory entry then that means it - // must have been truncated at the end of the buffer, so reset our - // offset so we can go back and reread into the buffer, picking up - // where we last left off. - let dirent_size = mem::size_of::<wasi::Dirent>(); - if data.len() < dirent_size { - assert!(self.cookie.is_some()); - assert!(self.buf.len() >= dirent_size); - self.offset = self.cap; - continue; - } - let (dirent, data) = data.split_at(dirent_size); - let dirent = unsafe { ptr::read_unaligned(dirent.as_ptr() as *const wasi::Dirent) }; - - // If the file name was truncated, then we need to reinvoke - // `readdir` so we truncate our buffer to start over and reread this - // descriptor. Note that if our offset is 0 that means the file name - // is massive and we need a bigger buffer. - if data.len() < dirent.d_namlen as usize { - if offset == 0 { - let amt_to_add = self.buf.capacity(); - self.buf.extend(iter::repeat(0).take(amt_to_add)); + match &mut self.state { + ReadDirState::FillBuffer { next_read_offset, ref mut buf } => { + let result = self.inner.dir.fd.readdir(buf, *next_read_offset); + match result { + Ok(read_bytes) => { + if read_bytes < buf.len() { + buf.truncate(read_bytes); + self.state = + ReadDirState::RunUntilExhaustion { buf: mem::take(buf), offset: 0 }; + } else { + debug_assert_eq!(read_bytes, buf.len()); + self.state = ReadDirState::ProcessEntry { + buf: mem::take(buf), + offset: 0, + next_read_offset: Some(*next_read_offset), + }; + } + self.next() + } + Err(e) => { + self.state = ReadDirState::Done; + return Some(Err(e)); + } } - assert!(self.cookie.is_some()); - self.offset = self.cap; - continue; } - self.cookie = Some(dirent.d_next); - self.offset = offset + dirent_size + dirent.d_namlen as usize; + ReadDirState::ProcessEntry { ref mut buf, next_read_offset, offset } => { + let contents = &buf[*offset..]; + const DIRENT_SIZE: usize = crate::mem::size_of::<wasi::Dirent>(); + if contents.len() >= DIRENT_SIZE { + let (dirent, data) = contents.split_at(DIRENT_SIZE); + let dirent = + unsafe { ptr::read_unaligned(dirent.as_ptr() as *const wasi::Dirent) }; + // If the file name was truncated, then we need to reinvoke + // `readdir` so we truncate our buffer to start over and reread this + // descriptor. + if data.len() < dirent.d_namlen as usize { + if buf.len() < dirent.d_namlen as usize + DIRENT_SIZE { + buf.resize(dirent.d_namlen as usize + DIRENT_SIZE, 0); + } + if let Some(next_read_offset) = *next_read_offset { + self.state = + ReadDirState::FillBuffer { next_read_offset, buf: mem::take(buf) }; + } else { + self.state = ReadDirState::Done; + } + + return self.next(); + } + next_read_offset.as_mut().map(|cookie| { + *cookie = dirent.d_next; + }); + *offset = *offset + DIRENT_SIZE + dirent.d_namlen as usize; - let name = &data[..(dirent.d_namlen as usize)]; + let name = &data[..(dirent.d_namlen as usize)]; + + // These names are skipped on all other platforms, so let's skip + // them here too + if name == b"." || name == b".." { + return self.next(); + } - // These names are skipped on all other platforms, so let's skip - // them here too - if name == b"." || name == b".." { - continue; + return Some(Ok(DirEntry { + meta: dirent, + name: name.to_vec(), + inner: self.inner.clone(), + })); + } else if let Some(next_read_offset) = *next_read_offset { + self.state = ReadDirState::FillBuffer { next_read_offset, buf: mem::take(buf) }; + } else { + self.state = ReadDirState::Done; + } + self.next() } + ReadDirState::RunUntilExhaustion { buf, offset } => { + if *offset >= buf.len() { + self.state = ReadDirState::Done; + } else { + self.state = ReadDirState::ProcessEntry { + buf: mem::take(buf), + offset: *offset, + next_read_offset: None, + }; + } - return Some(Ok(DirEntry { - meta: dirent, - name: name.to_vec(), - inner: self.inner.clone(), - })); + self.next() + } + ReadDirState::Done => None, } } } diff --git a/library/std/src/sys/thread_local/key/unix.rs b/library/std/src/sys/thread_local/key/unix.rs index 28e48a750b9..b4b58b34706 100644 --- a/library/std/src/sys/thread_local/key/unix.rs +++ b/library/std/src/sys/thread_local/key/unix.rs @@ -1,5 +1,25 @@ use crate::mem; +// For WASI add a few symbols not in upstream `libc` just yet. +#[cfg(all(target_os = "wasi", target_env = "p1", target_feature = "atomics"))] +mod libc { + use crate::ffi; + + #[allow(non_camel_case_types)] + pub type pthread_key_t = ffi::c_uint; + + extern "C" { + pub fn pthread_key_create( + key: *mut pthread_key_t, + destructor: unsafe extern "C" fn(*mut ffi::c_void), + ) -> ffi::c_int; + #[allow(dead_code)] + pub fn pthread_getspecific(key: pthread_key_t) -> *mut ffi::c_void; + pub fn pthread_setspecific(key: pthread_key_t, value: *const ffi::c_void) -> ffi::c_int; + pub fn pthread_key_delete(key: pthread_key_t) -> ffi::c_int; + } +} + pub type Key = libc::pthread_key_t; #[inline] diff --git a/library/std/src/sys/thread_local/mod.rs b/library/std/src/sys/thread_local/mod.rs index 31d3b439060..f0a13323ec9 100644 --- a/library/std/src/sys/thread_local/mod.rs +++ b/library/std/src/sys/thread_local/mod.rs @@ -86,7 +86,9 @@ pub(crate) mod guard { mod windows; pub(crate) use windows::enable; } else if #[cfg(any( - target_family = "wasm", + all(target_family = "wasm", not( + all(target_os = "wasi", target_env = "p1", target_feature = "atomics") + )), target_os = "uefi", target_os = "zkvm", ))] { @@ -135,6 +137,7 @@ pub(crate) mod key { target_family = "unix", ), target_os = "teeos", + all(target_os = "wasi", target_env = "p1", target_feature = "atomics"), ))] { mod racy; mod unix; diff --git a/src/bootstrap/src/bin/main.rs b/src/bootstrap/src/bin/main.rs index ee813de1c9e..74dfe2e7ec8 100644 --- a/src/bootstrap/src/bin/main.rs +++ b/src/bootstrap/src/bin/main.rs @@ -48,9 +48,9 @@ fn main() { err => { drop(err); if let Ok(pid) = pid { - println!("WARNING: build directory locked by process {pid}, waiting for lock"); + eprintln!("WARNING: build directory locked by process {pid}, waiting for lock"); } else { - println!("WARNING: build directory locked, waiting for lock"); + eprintln!("WARNING: build directory locked, waiting for lock"); } let mut lock = t!(build_lock.write()); t!(lock.write(process::id().to_string().as_ref())); @@ -70,13 +70,13 @@ fn main() { // changelog warning, not the `x.py setup` message. let suggest_setup = config.config.is_none() && !matches!(config.cmd, Subcommand::Setup { .. }); if suggest_setup { - println!("WARNING: you have not made a `config.toml`"); - println!( + eprintln!("WARNING: you have not made a `config.toml`"); + eprintln!( "HELP: consider running `./x.py setup` or copying `config.example.toml` by running \ `cp config.example.toml config.toml`" ); } else if let Some(suggestion) = &changelog_suggestion { - println!("{suggestion}"); + eprintln!("{suggestion}"); } let pre_commit = config.src.join(".git").join("hooks").join("pre-commit"); @@ -86,13 +86,13 @@ fn main() { Build::new(config).build(); if suggest_setup { - println!("WARNING: you have not made a `config.toml`"); - println!( + eprintln!("WARNING: you have not made a `config.toml`"); + eprintln!( "HELP: consider running `./x.py setup` or copying `config.example.toml` by running \ `cp config.example.toml config.toml`" ); } else if let Some(suggestion) = &changelog_suggestion { - println!("{suggestion}"); + eprintln!("{suggestion}"); } // Give a warning if the pre-commit script is in pre-commit and not pre-push. @@ -102,14 +102,14 @@ fn main() { if fs::read_to_string(pre_commit).is_ok_and(|contents| { contents.contains("https://github.com/rust-lang/rust/issues/77620#issuecomment-705144570") }) { - println!( + eprintln!( "WARNING: You have the pre-push script installed to .git/hooks/pre-commit. \ Consider moving it to .git/hooks/pre-push instead, which runs less often." ); } if suggest_setup || changelog_suggestion.is_some() { - println!("NOTE: this message was printed twice to make it more likely to be seen"); + eprintln!("NOTE: this message was printed twice to make it more likely to be seen"); } if dump_bootstrap_shims { diff --git a/src/bootstrap/src/bin/rustc.rs b/src/bootstrap/src/bin/rustc.rs index 88595ff7e51..e57ed488f97 100644 --- a/src/bootstrap/src/bin/rustc.rs +++ b/src/bootstrap/src/bin/rustc.rs @@ -306,7 +306,7 @@ fn main() { // should run on success, after this block. } if verbose > 0 { - println!("\nDid not run successfully: {status}\n{cmd:?}\n-------------"); + eprintln!("\nDid not run successfully: {status}\n{cmd:?}\n-------------"); } if let Some(mut on_fail) = on_fail { diff --git a/src/bootstrap/src/core/build_steps/check.rs b/src/bootstrap/src/core/build_steps/check.rs index d46c0ab7fef..2af2e83db8f 100644 --- a/src/bootstrap/src/core/build_steps/check.rs +++ b/src/bootstrap/src/core/build_steps/check.rs @@ -287,7 +287,7 @@ impl Step for CodegenBackend { fn run(self, builder: &Builder<'_>) { // FIXME: remove once https://github.com/rust-lang/rust/issues/112393 is resolved if builder.build.config.vendor && self.backend == "gcc" { - println!("Skipping checking of `rustc_codegen_gcc` with vendoring enabled."); + eprintln!("Skipping checking of `rustc_codegen_gcc` with vendoring enabled."); return; } diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs index 0cacd6e4f37..93f8091299f 100644 --- a/src/bootstrap/src/core/build_steps/compile.rs +++ b/src/bootstrap/src/core/build_steps/compile.rs @@ -1611,7 +1611,7 @@ impl Step for Sysroot { let sysroot = sysroot_dir(compiler.stage); builder - .verbose(|| println!("Removing sysroot {} to avoid caching bugs", sysroot.display())); + .verbose(|| eprintln!("Removing sysroot {} to avoid caching bugs", sysroot.display())); let _ = fs::remove_dir_all(&sysroot); t!(fs::create_dir_all(&sysroot)); @@ -1681,7 +1681,7 @@ impl Step for Sysroot { return true; } if !filtered_files.iter().all(|f| f != path.file_name().unwrap()) { - builder.verbose_than(1, || println!("ignoring {}", path.display())); + builder.verbose_than(1, || eprintln!("ignoring {}", path.display())); false } else { true @@ -2240,7 +2240,7 @@ pub fn stream_cargo( cargo.arg(arg); } - builder.verbose(|| println!("running: {cargo:?}")); + builder.verbose(|| eprintln!("running: {cargo:?}")); if builder.config.dry_run() { return true; @@ -2266,7 +2266,7 @@ pub fn stream_cargo( cb(msg) } // If this was informational, just print it out and continue - Err(_) => println!("{line}"), + Err(_) => eprintln!("{line}"), } } diff --git a/src/bootstrap/src/core/build_steps/dist.rs b/src/bootstrap/src/core/build_steps/dist.rs index 0c739115165..57fce206f95 100644 --- a/src/bootstrap/src/core/build_steps/dist.rs +++ b/src/bootstrap/src/core/build_steps/dist.rs @@ -2080,7 +2080,7 @@ fn maybe_install_llvm( { let mut cmd = command(llvm_config); cmd.arg("--libfiles"); - builder.verbose(|| println!("running {cmd:?}")); + builder.verbose(|| eprintln!("running {cmd:?}")); let files = cmd.run_capture_stdout(builder).stdout(); let build_llvm_out = &builder.llvm_out(builder.config.build); let target_llvm_out = &builder.llvm_out(target); diff --git a/src/bootstrap/src/core/build_steps/format.rs b/src/bootstrap/src/core/build_steps/format.rs index 29a96f77672..d32e06d8748 100644 --- a/src/bootstrap/src/core/build_steps/format.rs +++ b/src/bootstrap/src/core/build_steps/format.rs @@ -107,10 +107,10 @@ fn print_paths(verb: &str, adjective: Option<&str>, paths: &[String]) { if let Some(adjective) = adjective { format!("{adjective} ") } else { String::new() }; if len <= 10 { for path in paths { - println!("fmt: {verb} {adjective}file {path}"); + eprintln!("fmt: {verb} {adjective}file {path}"); } } else { - println!("fmt: {verb} {len} {adjective}files"); + eprintln!("fmt: {verb} {len} {adjective}files"); } } @@ -199,7 +199,7 @@ pub fn format(build: &Builder<'_>, check: bool, all: bool, paths: &[PathBuf]) { match get_modified_rs_files(build) { Ok(Some(files)) => { if files.is_empty() { - println!("fmt info: No modified files detected for formatting."); + eprintln!("fmt info: No modified files detected for formatting."); return; } diff --git a/src/bootstrap/src/core/build_steps/install.rs b/src/bootstrap/src/core/build_steps/install.rs index 0ce86eadbce..b6862c2d5c4 100644 --- a/src/bootstrap/src/core/build_steps/install.rs +++ b/src/bootstrap/src/core/build_steps/install.rs @@ -21,9 +21,9 @@ const SHELL: &str = "sh"; /// We have to run a few shell scripts, which choke quite a bit on both `\` /// characters and on `C:\` paths, so normalize both of them away. -fn sanitize_sh(path: &Path) -> String { +fn sanitize_sh(path: &Path, is_cygwin: bool) -> String { let path = path.to_str().unwrap().replace('\\', "/"); - return change_drive(unc_to_lfs(&path)).unwrap_or(path); + return if is_cygwin { path } else { change_drive(unc_to_lfs(&path)).unwrap_or(path) }; fn unc_to_lfs(s: &str) -> &str { s.strip_prefix("//?/").unwrap_or(s) @@ -71,6 +71,7 @@ fn install_sh( let prefix = default_path(&builder.config.prefix, "/usr/local"); let sysconfdir = prefix.join(default_path(&builder.config.sysconfdir, "/etc")); let destdir_env = env::var_os("DESTDIR").map(PathBuf::from); + let is_cygwin = builder.config.build.is_cygwin(); // Sanity checks on the write access of user. // @@ -103,14 +104,14 @@ fn install_sh( let mut cmd = command(SHELL); cmd.current_dir(&empty_dir) - .arg(sanitize_sh(&tarball.decompressed_output().join("install.sh"))) - .arg(format!("--prefix={}", prepare_dir(&destdir_env, prefix))) - .arg(format!("--sysconfdir={}", prepare_dir(&destdir_env, sysconfdir))) - .arg(format!("--datadir={}", prepare_dir(&destdir_env, datadir))) - .arg(format!("--docdir={}", prepare_dir(&destdir_env, docdir))) - .arg(format!("--bindir={}", prepare_dir(&destdir_env, bindir))) - .arg(format!("--libdir={}", prepare_dir(&destdir_env, libdir))) - .arg(format!("--mandir={}", prepare_dir(&destdir_env, mandir))) + .arg(sanitize_sh(&tarball.decompressed_output().join("install.sh"), is_cygwin)) + .arg(format!("--prefix={}", prepare_dir(&destdir_env, prefix, is_cygwin))) + .arg(format!("--sysconfdir={}", prepare_dir(&destdir_env, sysconfdir, is_cygwin))) + .arg(format!("--datadir={}", prepare_dir(&destdir_env, datadir, is_cygwin))) + .arg(format!("--docdir={}", prepare_dir(&destdir_env, docdir, is_cygwin))) + .arg(format!("--bindir={}", prepare_dir(&destdir_env, bindir, is_cygwin))) + .arg(format!("--libdir={}", prepare_dir(&destdir_env, libdir, is_cygwin))) + .arg(format!("--mandir={}", prepare_dir(&destdir_env, mandir, is_cygwin))) .arg("--disable-ldconfig"); cmd.run(builder); t!(fs::remove_dir_all(&empty_dir)); @@ -120,7 +121,7 @@ fn default_path(config: &Option<PathBuf>, default: &str) -> PathBuf { config.as_ref().cloned().unwrap_or_else(|| PathBuf::from(default)) } -fn prepare_dir(destdir_env: &Option<PathBuf>, mut path: PathBuf) -> String { +fn prepare_dir(destdir_env: &Option<PathBuf>, mut path: PathBuf, is_cygwin: bool) -> String { // The DESTDIR environment variable is a standard way to install software in a subdirectory // while keeping the original directory structure, even if the prefix or other directories // contain absolute paths. @@ -146,7 +147,7 @@ fn prepare_dir(destdir_env: &Option<PathBuf>, mut path: PathBuf) -> String { assert!(path.is_absolute(), "could not make the path relative"); } - sanitize_sh(&path) + sanitize_sh(&path, is_cygwin) } macro_rules! install { diff --git a/src/bootstrap/src/core/build_steps/setup.rs b/src/bootstrap/src/core/build_steps/setup.rs index 7ed01f25c94..175e9982cc1 100644 --- a/src/bootstrap/src/core/build_steps/setup.rs +++ b/src/bootstrap/src/core/build_steps/setup.rs @@ -134,7 +134,7 @@ impl Step for Profile { t!(fs::remove_file(path)); } _ => { - println!("Exiting."); + eprintln!("Exiting."); crate::exit!(1); } } @@ -184,15 +184,15 @@ pub fn setup(config: &Config, profile: Profile) { Profile::Dist => &["dist", "build"], }; - println!(); + eprintln!(); - println!("To get started, try one of the following commands:"); + eprintln!("To get started, try one of the following commands:"); for cmd in suggestions { - println!("- `x.py {cmd}`"); + eprintln!("- `x.py {cmd}`"); } if profile != Profile::Dist { - println!( + eprintln!( "For more suggestions, see https://rustc-dev-guide.rust-lang.org/building/suggested.html" ); } @@ -224,7 +224,7 @@ fn setup_config_toml(path: &PathBuf, profile: Profile, config: &Config) { t!(fs::write(path, settings)); let include_path = profile.include_path(&config.src); - println!("`x.py` will now use the configuration at {}", include_path.display()); + eprintln!("`x.py` will now use the configuration at {}", include_path.display()); } /// Creates a toolchain link for stage1 using `rustup` @@ -256,7 +256,7 @@ impl Step for Link { } if !rustup_installed(builder) { - println!("WARNING: `rustup` is not installed; Skipping `stage1` toolchain linking."); + eprintln!("WARNING: `rustup` is not installed; Skipping `stage1` toolchain linking."); return; } @@ -296,7 +296,7 @@ fn attempt_toolchain_link(builder: &Builder<'_>, stage_path: &str) { } if try_link_toolchain(builder, stage_path) { - println!( + eprintln!( "Added `stage1` rustup toolchain; try `cargo +stage1 build` on a separate rust project to run a newly-built toolchain" ); } else { @@ -321,14 +321,14 @@ fn toolchain_is_linked(builder: &Builder<'_>) -> bool { return false; } // The toolchain has already been linked. - println!( + eprintln!( "`stage1` toolchain already linked; not attempting to link `stage1` toolchain" ); } None => { // In this case, we don't know if the `stage1` toolchain has been linked; // but `rustup` failed, so let's not go any further. - println!( + eprintln!( "`rustup` failed to list current toolchains; not attempting to link `stage1` toolchain" ); } @@ -389,12 +389,12 @@ pub fn interactive_path() -> io::Result<Profile> { input.parse() } - println!("Welcome to the Rust project! What do you want to do with x.py?"); + eprintln!("Welcome to the Rust project! What do you want to do with x.py?"); for ((letter, _), profile) in abbrev_all() { - println!("{}) {}: {}", letter, profile, profile.purpose()); + eprintln!("{}) {}: {}", letter, profile, profile.purpose()); } let template = loop { - print!( + eprint!( "Please choose one ({}): ", abbrev_all().map(|((l, _), _)| l).collect::<Vec<_>>().join("/") ); @@ -428,7 +428,7 @@ enum PromptResult { fn prompt_user(prompt: &str) -> io::Result<Option<PromptResult>> { let mut input = String::new(); loop { - print!("{prompt} "); + eprint!("{prompt} "); io::stdout().flush()?; input.clear(); io::stdin().read_line(&mut input)?; @@ -490,7 +490,7 @@ fn install_git_hook_maybe(builder: &Builder<'_>, config: &Config) -> io::Result< return Ok(()); } - println!( + eprintln!( "\nRust's CI will automatically fail if it doesn't pass `tidy`, the internal tool for ensuring code quality. If you'd like, x.py can install a git hook for you that will automatically run `test tidy` before pushing your code to ensure your code is up to par. If you decide later that this behavior is @@ -498,7 +498,7 @@ undesirable, simply delete the `pre-push` file from .git/hooks." ); if prompt_user("Would you like to install the git hook?: [y/N]")? != Some(PromptResult::Yes) { - println!("Ok, skipping installation!"); + eprintln!("Ok, skipping installation!"); return Ok(()); } if !hooks_dir.exists() { @@ -515,7 +515,7 @@ undesirable, simply delete the `pre-push` file from .git/hooks." ); return Err(e); } - Ok(_) => println!("Linked `src/etc/pre-push.sh` to `.git/hooks/pre-push`"), + Ok(_) => eprintln!("Linked `src/etc/pre-push.sh` to `.git/hooks/pre-push`"), }; Ok(()) } @@ -541,7 +541,7 @@ Select which editor you would like to set up [default: None]: "; let mut input = String::new(); loop { - print!("{}", prompt_str); + eprint!("{}", prompt_str); io::stdout().flush()?; input.clear(); io::stdin().read_line(&mut input)?; @@ -656,7 +656,7 @@ impl Step for Editor { if let Some(editor_kind) = editor_kind { while !t!(create_editor_settings_maybe(config, editor_kind.clone())) {} } else { - println!("Ok, skipping editor setup!"); + eprintln!("Ok, skipping editor setup!"); } } Err(e) => eprintln!("Could not determine the editor: {e}"), @@ -689,7 +689,7 @@ fn create_editor_settings_maybe(config: &Config, editor: EditorKind) -> io::Resu mismatched_settings = Some(false); } } - println!( + eprintln!( "\nx.py can automatically install the recommended `{settings_filename}` file for rustc development" ); @@ -708,7 +708,7 @@ fn create_editor_settings_maybe(config: &Config, editor: EditorKind) -> io::Resu Some(PromptResult::Yes) => true, Some(PromptResult::Print) => false, _ => { - println!("Ok, skipping settings!"); + eprintln!("Ok, skipping settings!"); return Ok(true); } }; @@ -735,9 +735,9 @@ fn create_editor_settings_maybe(config: &Config, editor: EditorKind) -> io::Resu _ => "Created", }; fs::write(&settings_path, editor.settings_template())?; - println!("{verb} `{}`", settings_filename); + eprintln!("{verb} `{}`", settings_filename); } else { - println!("\n{}", editor.settings_template()); + eprintln!("\n{}", editor.settings_template()); } Ok(should_create) } diff --git a/src/bootstrap/src/core/build_steps/suggest.rs b/src/bootstrap/src/core/build_steps/suggest.rs index ba9b1b2fc33..7b2d9fff8f5 100644 --- a/src/bootstrap/src/core/build_steps/suggest.rs +++ b/src/bootstrap/src/core/build_steps/suggest.rs @@ -66,6 +66,6 @@ pub fn suggest(builder: &Builder<'_>, run: bool) { build.build(); } } else { - println!("HELP: consider using the `--run` flag to automatically run suggested tests"); + eprintln!("HELP: consider using the `--run` flag to automatically run suggested tests"); } } diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs index 30fdea7e19e..380626952b2 100644 --- a/src/bootstrap/src/core/build_steps/test.rs +++ b/src/bootstrap/src/core/build_steps/test.rs @@ -471,11 +471,11 @@ impl Miri { // We re-use the `cargo` from above. cargo.arg("--print-sysroot"); - builder.verbose(|| println!("running: {cargo:?}")); + builder.verbose(|| eprintln!("running: {cargo:?}")); let stdout = cargo.run_capture_stdout(builder).stdout(); // Output is "<sysroot>\n". let sysroot = stdout.trim_end(); - builder.verbose(|| println!("`cargo miri setup --print-sysroot` said: {sysroot:?}")); + builder.verbose(|| eprintln!("`cargo miri setup --print-sysroot` said: {sysroot:?}")); PathBuf::from(sysroot) } } @@ -2488,7 +2488,7 @@ fn markdown_test(builder: &Builder<'_>, compiler: Compiler, markdown: &Path) -> } } - builder.verbose(|| println!("doc tests for: {}", markdown.display())); + builder.verbose(|| eprintln!("doc tests for: {}", markdown.display())); let mut cmd = builder.rustdoc_cmd(compiler); builder.add_rust_test_threads(&mut cmd); // allow for unstable options such as new editions diff --git a/src/bootstrap/src/core/builder/cargo.rs b/src/bootstrap/src/core/builder/cargo.rs index 77f6edaabb2..38abca8b8da 100644 --- a/src/bootstrap/src/core/builder/cargo.rs +++ b/src/bootstrap/src/core/builder/cargo.rs @@ -523,7 +523,7 @@ impl Builder<'_> { let sysroot_str = sysroot.as_os_str().to_str().expect("sysroot should be UTF-8"); if self.is_verbose() && !matches!(self.config.dry_run, DryRun::SelfCheck) { - println!("using sysroot {sysroot_str}"); + eprintln!("using sysroot {sysroot_str}"); } let mut rustflags = Rustflags::new(target); diff --git a/src/bootstrap/src/core/builder/mod.rs b/src/bootstrap/src/core/builder/mod.rs index 026c26479d3..ffe3e053e72 100644 --- a/src/bootstrap/src/core/builder/mod.rs +++ b/src/bootstrap/src/core/builder/mod.rs @@ -392,14 +392,14 @@ impl StepDescription { fn is_excluded(&self, builder: &Builder<'_>, pathset: &PathSet) -> bool { if builder.config.skip.iter().any(|e| pathset.has(e, builder.kind)) { if !matches!(builder.config.dry_run, DryRun::SelfCheck) { - println!("Skipping {pathset:?} because it is excluded"); + eprintln!("Skipping {pathset:?} because it is excluded"); } return true; } if !builder.config.skip.is_empty() && !matches!(builder.config.dry_run, DryRun::SelfCheck) { builder.verbose(|| { - println!( + eprintln!( "{:?} not skipped for {:?} -- not in {:?}", pathset, self.name, builder.config.skip ) @@ -1437,11 +1437,11 @@ impl<'a> Builder<'a> { panic!("{}", out); } if let Some(out) = self.cache.get(&step) { - self.verbose_than(1, || println!("{}c {:?}", " ".repeat(stack.len()), step)); + self.verbose_than(1, || eprintln!("{}c {:?}", " ".repeat(stack.len()), step)); return out; } - self.verbose_than(1, || println!("{}> {:?}", " ".repeat(stack.len()), step)); + self.verbose_than(1, || eprintln!("{}> {:?}", " ".repeat(stack.len()), step)); stack.push(Box::new(step.clone())); } @@ -1462,7 +1462,7 @@ impl<'a> Builder<'a> { let step_string = format!("{step:?}"); let brace_index = step_string.find('{').unwrap_or(0); let type_string = type_name::<S>(); - println!( + eprintln!( "[TIMING] {} {} -- {}.{:03}", &type_string.strip_prefix("bootstrap::").unwrap_or(type_string), &step_string[brace_index..], @@ -1479,7 +1479,9 @@ impl<'a> Builder<'a> { let cur_step = stack.pop().expect("step stack empty"); assert_eq!(cur_step.downcast_ref(), Some(&step)); } - self.verbose_than(1, || println!("{}< {:?}", " ".repeat(self.stack.borrow().len()), step)); + self.verbose_than(1, || { + eprintln!("{}< {:?}", " ".repeat(self.stack.borrow().len()), step) + }); self.cache.put(step, out.clone()); out } diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs index b06147055f2..002b990bb52 100644 --- a/src/bootstrap/src/core/config/config.rs +++ b/src/bootstrap/src/core/config/config.rs @@ -565,6 +565,12 @@ impl TargetSelection { self.ends_with("windows-gnu") } + pub fn is_cygwin(&self) -> bool { + self.is_windows() && + // ref. https://cygwin.com/pipermail/cygwin/2022-February/250802.html + env::var("OSTYPE").is_ok_and(|v| v.to_lowercase().contains("cygwin")) + } + /// Path to the file defining the custom target, if any. pub fn filepath(&self) -> Option<&Path> { self.file.as_ref().map(Path::new) @@ -1293,7 +1299,7 @@ impl Config { .map(|change_id| change_id.inner.map(crate::find_recent_config_change_ids)) { if !changes.is_empty() { - println!( + eprintln!( "WARNING: There have been changes to x.py since you last updated:\n{}", crate::human_readable_changes(&changes) ); @@ -1559,7 +1565,7 @@ impl Config { } if cargo_clippy.is_some() && rustc.is_none() { - println!( + eprintln!( "WARNING: Using `build.cargo-clippy` without `build.rustc` usually fails due to toolchain conflict." ); } @@ -1632,7 +1638,6 @@ impl Config { set(&mut config.docs_minification, docs_minification); set(&mut config.docs, docs); set(&mut config.locked_deps, locked_deps); - set(&mut config.vendor, vendor); set(&mut config.full_bootstrap, full_bootstrap); set(&mut config.extended, extended); config.tools = tools; @@ -1711,6 +1716,12 @@ impl Config { config.in_tree_llvm_info = GitInfo::new(false, &config.src.join("src/llvm-project")); config.in_tree_gcc_info = GitInfo::new(false, &config.src.join("src/gcc")); + config.vendor = vendor.unwrap_or( + config.rust_info.is_from_tarball() + && config.src.join("vendor").exists() + && config.src.join(".cargo/config.toml").exists(), + ); + if let Some(rust) = toml.rust { let Rust { optimize: optimize_toml, @@ -1841,7 +1852,7 @@ impl Config { // FIXME: Remove this option at the end of 2024. if parallel_compiler.is_some() { - println!( + eprintln!( "WARNING: The `rust.parallel-compiler` option is deprecated and does nothing. The parallel compiler (with one thread) is now the default" ); } @@ -1873,7 +1884,7 @@ impl Config { if available_backends.contains(&backend) { panic!("Invalid value '{s}' for 'rust.codegen-backends'. Instead, please use '{backend}'."); } else { - println!("HELP: '{s}' for 'rust.codegen-backends' might fail. \ + eprintln!("HELP: '{s}' for 'rust.codegen-backends' might fail. \ Codegen backends are mostly defined without the '{CODEGEN_BACKEND_PREFIX}' prefix. \ In this case, it would be referred to as '{backend}'."); } @@ -1902,7 +1913,7 @@ impl Config { // tests may fail due to using a different channel than the one used by the compiler during tests. if let Some(commit) = &config.download_rustc_commit { if is_user_configured_rust_channel { - println!( + eprintln!( "WARNING: `rust.download-rustc` is enabled. The `rust.channel` option will be overridden by the CI rustc's channel." ); @@ -1992,10 +2003,10 @@ impl Config { if config.llvm_from_ci { let warn = |option: &str| { - println!( + eprintln!( "WARNING: `{option}` will only be used on `compiler/rustc_llvm` build, not for the LLVM build." ); - println!( + eprintln!( "HELP: To use `{option}` for LLVM builds, set `download-ci-llvm` option to false." ); }; @@ -2014,12 +2025,12 @@ impl Config { // if they've chosen a different value. if libzstd.is_some() { - println!( + eprintln!( "WARNING: when using `download-ci-llvm`, the local `llvm.libzstd` option, \ like almost all `llvm.*` options, will be ignored and set by the LLVM CI \ artifacts builder config." ); - println!( + eprintln!( "HELP: To use `llvm.libzstd` for LLVM/LLD builds, set `download-ci-llvm` option to false." ); } @@ -2088,7 +2099,7 @@ impl Config { if available_backends.contains(&backend) { panic!("Invalid value '{s}' for 'target.{triple}.codegen-backends'. Instead, please use '{backend}'."); } else { - println!("HELP: '{s}' for 'target.{triple}.codegen-backends' might fail. \ + eprintln!("HELP: '{s}' for 'target.{triple}.codegen-backends' might fail. \ Codegen backends are mostly defined without the '{CODEGEN_BACKEND_PREFIX}' prefix. \ In this case, it would be referred to as '{backend}'."); } @@ -2304,7 +2315,7 @@ impl Config { if self.dry_run() { return Ok(()); } - self.verbose(|| println!("running: {cmd:?}")); + self.verbose(|| eprintln!("running: {cmd:?}")); build_helper::util::try_run(cmd, self.is_verbose()) } @@ -2479,7 +2490,7 @@ impl Config { // This happens when LLVM submodule is updated in CI, we should disable ci-rustc without an error // to not break CI. For non-CI environments, we should return an error. if CiEnv::is_ci() { - println!("WARNING: LLVM submodule has changes, `download-rustc` will be disabled."); + eprintln!("WARNING: LLVM submodule has changes, `download-rustc` will be disabled."); return None; } else { panic!("ERROR: LLVM submodule has changes, `download-rustc` can't be used."); @@ -2490,8 +2501,8 @@ impl Config { let ci_config_toml = match self.get_builder_toml("ci-rustc") { Ok(ci_config_toml) => ci_config_toml, Err(e) if e.to_string().contains("unknown field") => { - println!("WARNING: CI rustc has some fields that are no longer supported in bootstrap; download-rustc will be disabled."); - println!("HELP: Consider rebasing to a newer commit if available."); + eprintln!("WARNING: CI rustc has some fields that are no longer supported in bootstrap; download-rustc will be disabled."); + eprintln!("HELP: Consider rebasing to a newer commit if available."); return None; }, Err(e) => { @@ -2516,7 +2527,7 @@ impl Config { .is_some_and(|s| s == "1" || s == "true"); if disable_ci_rustc_if_incompatible && res.is_err() { - println!("WARNING: download-rustc is disabled with `DISABLE_CI_RUSTC_IF_INCOMPATIBLE` env."); + eprintln!("WARNING: download-rustc is disabled with `DISABLE_CI_RUSTC_IF_INCOMPATIBLE` env."); return None; } @@ -2701,7 +2712,7 @@ impl Config { return; } - println!("Updating submodule {relative_path}"); + eprintln!("Updating submodule {relative_path}"); self.check_run( helpers::git(Some(&self.src)) .run_always() @@ -2824,7 +2835,7 @@ impl Config { Some(StringOrBool::Bool(true)) => false, Some(StringOrBool::String(s)) if s == "if-unchanged" => { if !self.rust_info.is_managed_git_subrepository() { - println!( + eprintln!( "ERROR: `download-rustc=if-unchanged` is only compatible with Git managed sources." ); crate::exit!(1); @@ -2857,10 +2868,10 @@ impl Config { if if_unchanged { return None; } - println!("ERROR: could not find commit hash for downloading rustc"); - println!("HELP: maybe your repository history is too shallow?"); - println!("HELP: consider setting `rust.download-rustc=false` in config.toml"); - println!("HELP: or fetch enough history to include one upstream commit"); + eprintln!("ERROR: could not find commit hash for downloading rustc"); + eprintln!("HELP: maybe your repository history is too shallow?"); + eprintln!("HELP: consider setting `rust.download-rustc=false` in config.toml"); + eprintln!("HELP: or fetch enough history to include one upstream commit"); crate::exit!(1); } }; @@ -2899,7 +2910,7 @@ impl Config { let if_unchanged = || { if self.rust_info.is_from_tarball() { // Git is needed for running "if-unchanged" logic. - println!( + eprintln!( "WARNING: 'if-unchanged' has no effect on tarball sources; ignoring `download-ci-llvm`." ); return false; @@ -2948,10 +2959,10 @@ impl Config { // Only commits merged by bors will have CI artifacts. let commit = get_closest_merge_commit(Some(&self.src), &self.git_config(), &[]).unwrap(); if commit.is_empty() { - println!("error: could not find commit hash for downloading components from CI"); - println!("help: maybe your repository history is too shallow?"); - println!("help: consider disabling `{option_name}`"); - println!("help: or fetch enough history to include one upstream commit"); + eprintln!("error: could not find commit hash for downloading components from CI"); + eprintln!("help: maybe your repository history is too shallow?"); + eprintln!("help: consider disabling `{option_name}`"); + eprintln!("help: or fetch enough history to include one upstream commit"); crate::exit!(1); } @@ -2963,14 +2974,14 @@ impl Config { if has_changes { if if_unchanged { if self.is_verbose() { - println!( + eprintln!( "warning: saw changes to one of {modified_paths:?} since {commit}; \ ignoring `{option_name}`" ); } return None; } - println!( + eprintln!( "warning: `{option_name}` is enabled, but there are changes to one of {modified_paths:?}" ); } @@ -3007,7 +3018,7 @@ pub(crate) fn check_incompatible_options_for_ci_llvm( ($current:expr, $expected:expr) => { if let Some(current) = &$current { if Some(current) != $expected.as_ref() { - println!( + eprintln!( "WARNING: `llvm.{}` has no effect with `llvm.download-ci-llvm`. \ Current value: {:?}, Expected value(s): {}{:?}", stringify!($expected).replace("_", "-"), @@ -3112,7 +3123,7 @@ fn check_incompatible_options_for_ci_rustc( ($current:expr, $expected:expr, $config_section:expr) => { if let Some(current) = &$current { if Some(current) != $expected.as_ref() { - println!( + eprintln!( "WARNING: `{}` has no effect with `rust.download-rustc`. \ Current value: {:?}, Expected value(s): {}{:?}", format!("{}.{}", $config_section, stringify!($expected).replace("_", "-")), diff --git a/src/bootstrap/src/core/config/flags.rs b/src/bootstrap/src/core/config/flags.rs index bfeb811508c..66b9f5ed84e 100644 --- a/src/bootstrap/src/core/config/flags.rs +++ b/src/bootstrap/src/core/config/flags.rs @@ -196,12 +196,12 @@ impl Flags { if let Ok(HelpVerboseOnly { help: true, verbose: 1.., cmd: subcommand }) = HelpVerboseOnly::try_parse_from(normalize_args(args)) { - println!("NOTE: updating submodules before printing available paths"); + eprintln!("NOTE: updating submodules before printing available paths"); let config = Config::parse(Self::parse(&[String::from("build")])); let build = Build::new(config); let paths = Builder::get_help(&build, subcommand); if let Some(s) = paths { - println!("{s}"); + eprintln!("{s}"); } else { panic!("No paths available for subcommand `{}`", subcommand.as_str()); } diff --git a/src/bootstrap/src/core/download.rs b/src/bootstrap/src/core/download.rs index db35e6907e6..05b91c518cf 100644 --- a/src/bootstrap/src/core/download.rs +++ b/src/bootstrap/src/core/download.rs @@ -77,7 +77,7 @@ impl Config { if self.dry_run() && !cmd.run_always { return true; } - self.verbose(|| println!("running: {cmd:?}")); + self.verbose(|| eprintln!("running: {cmd:?}")); check_run(cmd, self.is_verbose()) } @@ -144,7 +144,7 @@ impl Config { /// Please see <https://nixos.org/patchelf.html> for more information fn fix_bin_or_dylib(&self, fname: &Path) { assert_eq!(SHOULD_FIX_BINS_AND_DYLIBS.get(), Some(&true)); - println!("attempting to patch {}", fname.display()); + eprintln!("attempting to patch {}", fname.display()); // Only build `.nix-deps` once. static NIX_DEPS_DIR: OnceLock<PathBuf> = OnceLock::new(); @@ -206,7 +206,7 @@ impl Config { } fn download_file(&self, url: &str, dest_path: &Path, help_on_error: &str) { - self.verbose(|| println!("download {url}")); + self.verbose(|| eprintln!("download {url}")); // Use a temporary file in case we crash while downloading, to avoid a corrupt download in cache/. let tempfile = self.tempdir().join(dest_path.file_name().unwrap()); // While bootstrap itself only supports http and https downloads, downstream forks might @@ -226,7 +226,7 @@ impl Config { } fn download_http_with_retries(&self, tempfile: &Path, url: &str, help_on_error: &str) { - println!("downloading {url}"); + eprintln!("downloading {url}"); // Try curl. If that fails and we are on windows, fallback to PowerShell. // options should be kept in sync with // src/bootstrap/src/core/download.rs @@ -341,7 +341,7 @@ impl Config { short_path = short_path.strip_prefix(pattern).unwrap_or(short_path); let dst_path = dst.join(short_path); self.verbose(|| { - println!("extracting {} to {}", original_path.display(), dst.display()) + eprintln!("extracting {} to {}", original_path.display(), dst.display()) }); if !t!(member.unpack_in(dst)) { panic!("path traversal attack ??"); @@ -365,7 +365,7 @@ impl Config { pub(crate) fn verify(&self, path: &Path, expected: &str) -> bool { use sha2::Digest; - self.verbose(|| println!("verifying {}", path.display())); + self.verbose(|| eprintln!("verifying {}", path.display())); if self.dry_run() { return false; @@ -391,7 +391,7 @@ impl Config { let verified = checksum == expected; if !verified { - println!( + eprintln!( "invalid checksum: \n\ found: {checksum}\n\ expected: {expected}", @@ -421,7 +421,7 @@ enum DownloadSource { /// Functions that are only ever called once, but named for clarify and to avoid thousand-line functions. impl Config { pub(crate) fn download_clippy(&self) -> PathBuf { - self.verbose(|| println!("downloading stage0 clippy artifacts")); + self.verbose(|| eprintln!("downloading stage0 clippy artifacts")); let date = &self.stage0_metadata.compiler.date; let version = &self.stage0_metadata.compiler.version; @@ -518,7 +518,7 @@ impl Config { } pub(crate) fn download_ci_rustc(&self, commit: &str) { - self.verbose(|| println!("using downloaded stage2 artifacts from CI (commit {commit})")); + self.verbose(|| eprintln!("using downloaded stage2 artifacts from CI (commit {commit})")); let version = self.artifact_version_part(commit); // download-rustc doesn't need its own cargo, it can just use beta's. But it does need the @@ -539,7 +539,7 @@ impl Config { #[cfg(not(feature = "bootstrap-self-test"))] pub(crate) fn download_beta_toolchain(&self) { - self.verbose(|| println!("downloading stage0 beta artifacts")); + self.verbose(|| eprintln!("downloading stage0 beta artifacts")); let date = &self.stage0_metadata.compiler.date; let version = &self.stage0_metadata.compiler.version; @@ -677,7 +677,7 @@ impl Config { return; } else { self.verbose(|| { - println!( + eprintln!( "ignoring cached file {} due to failed verification", tarball.display() ) @@ -776,10 +776,10 @@ download-rustc = false t!(check_incompatible_options_for_ci_llvm(current_config_toml, ci_config_toml)); } Err(e) if e.to_string().contains("unknown field") => { - println!( + eprintln!( "WARNING: CI LLVM has some fields that are no longer supported in bootstrap; download-ci-llvm will be disabled." ); - println!("HELP: Consider rebasing to a newer commit if available."); + eprintln!("HELP: Consider rebasing to a newer commit if available."); } Err(e) => { eprintln!("ERROR: Failed to parse CI LLVM config.toml: {e}"); diff --git a/src/bootstrap/src/core/sanity.rs b/src/bootstrap/src/core/sanity.rs index dcf68cbeeda..71e7f40f032 100644 --- a/src/bootstrap/src/core/sanity.rs +++ b/src/bootstrap/src/core/sanity.rs @@ -237,11 +237,11 @@ than building it. stage0_supported_target_list.intersection(&missing_targets_hashset).collect(); if !duplicated_targets.is_empty() { - println!( + eprintln!( "Following targets supported from the stage0 compiler, please remove them from STAGE0_MISSING_TARGETS list." ); for duplicated_target in duplicated_targets { - println!(" {duplicated_target}"); + eprintln!(" {duplicated_target}"); } std::process::exit(1); } diff --git a/src/bootstrap/src/lib.rs b/src/bootstrap/src/lib.rs index 0ecf61ffcd9..5f778223d7d 100644 --- a/src/bootstrap/src/lib.rs +++ b/src/bootstrap/src/lib.rs @@ -406,11 +406,11 @@ impl Build { .unwrap() .trim(); if local_release.split('.').take(2).eq(version.split('.').take(2)) { - build.verbose(|| println!("auto-detected local-rebuild {local_release}")); + build.verbose(|| eprintln!("auto-detected local-rebuild {local_release}")); build.local_rebuild = true; } - build.verbose(|| println!("finding compilers")); + build.verbose(|| eprintln!("finding compilers")); utils::cc_detect::find(&build); // When running `setup`, the profile is about to change, so any requirements we have now may // be different on the next invocation. Don't check for them until the next time x.py is @@ -418,7 +418,7 @@ impl Build { // // Similarly, for `setup` we don't actually need submodules or cargo metadata. if !matches!(build.config.cmd, Subcommand::Setup { .. }) { - build.verbose(|| println!("running sanity check")); + build.verbose(|| eprintln!("running sanity check")); crate::core::sanity::check(&mut build); // Make sure we update these before gathering metadata so we don't get an error about missing @@ -436,7 +436,7 @@ impl Build { // Now, update all existing submodules. build.update_existing_submodules(); - build.verbose(|| println!("learning about cargo")); + build.verbose(|| eprintln!("learning about cargo")); crate::core::metadata::build(&mut build); } @@ -605,7 +605,7 @@ impl Build { let stamp = dir.join(".stamp"); let mut cleared = false; if mtime(&stamp) < mtime(input) { - self.verbose(|| println!("Dirty - {}", dir.display())); + self.verbose(|| eprintln!("Dirty - {}", dir.display())); let _ = fs::remove_dir_all(dir); cleared = true; } else if stamp.exists() { @@ -890,7 +890,7 @@ impl Build { let executed_at = std::panic::Location::caller(); self.verbose(|| { - println!("running: {command:?} (created at {created_at}, executed at {executed_at})") + eprintln!("running: {command:?} (created at {created_at}, executed at {executed_at})") }); let cmd = command.as_command_mut(); @@ -947,7 +947,7 @@ Executed at: {executed_at}"#, let fail = |message: &str, output: CommandOutput| -> ! { if self.is_verbose() { - println!("{message}"); + eprintln!("{message}"); } else { let (stdout, stderr) = (output.stdout_if_present(), output.stderr_if_present()); // If the command captures output, the user would not see any indication that @@ -957,16 +957,16 @@ Executed at: {executed_at}"#, if let Some(stdout) = output.stdout_if_present().take_if(|s| !s.trim().is_empty()) { - println!("STDOUT:\n{stdout}\n"); + eprintln!("STDOUT:\n{stdout}\n"); } if let Some(stderr) = output.stderr_if_present().take_if(|s| !s.trim().is_empty()) { - println!("STDERR:\n{stderr}\n"); + eprintln!("STDERR:\n{stderr}\n"); } - println!("Command {command:?} has failed. Rerun with -v to see more details."); + eprintln!("Command {command:?} has failed. Rerun with -v to see more details."); } else { - println!("Command has failed. Rerun with -v to see more details."); + eprintln!("Command has failed. Rerun with -v to see more details."); } } exit!(1); @@ -1011,7 +1011,7 @@ Executed at: {executed_at}"#, match self.config.dry_run { DryRun::SelfCheck => (), DryRun::Disabled | DryRun::UserSelected => { - println!("{msg}"); + eprintln!("{msg}"); } } } @@ -1666,7 +1666,7 @@ Executed at: {executed_at}"#, if self.config.dry_run() { return; } - self.verbose_than(1, || println!("Copy/Link {src:?} to {dst:?}")); + self.verbose_than(1, || eprintln!("Copy/Link {src:?} to {dst:?}")); if src == dst { return; } @@ -1775,7 +1775,7 @@ Executed at: {executed_at}"#, return; } let dst = dstdir.join(src.file_name().unwrap()); - self.verbose_than(1, || println!("Install {src:?} to {dst:?}")); + self.verbose_than(1, || eprintln!("Install {src:?} to {dst:?}")); t!(fs::create_dir_all(dstdir)); if !src.exists() { panic!("ERROR: File \"{}\" not found!", src.display()); diff --git a/src/bootstrap/src/utils/cc_detect.rs b/src/bootstrap/src/utils/cc_detect.rs index 0df00469452..e8d5b60948a 100644 --- a/src/bootstrap/src/utils/cc_detect.rs +++ b/src/bootstrap/src/utils/cc_detect.rs @@ -155,15 +155,15 @@ pub fn find_target(build: &Build, target: TargetSelection) { build.cxx.borrow_mut().insert(target, compiler); } - build.verbose(|| println!("CC_{} = {:?}", target.triple, build.cc(target))); - build.verbose(|| println!("CFLAGS_{} = {cflags:?}", target.triple)); + build.verbose(|| eprintln!("CC_{} = {:?}", target.triple, build.cc(target))); + build.verbose(|| eprintln!("CFLAGS_{} = {cflags:?}", target.triple)); if let Ok(cxx) = build.cxx(target) { let cxxflags = build.cflags(target, GitRepo::Rustc, CLang::Cxx); - build.verbose(|| println!("CXX_{} = {cxx:?}", target.triple)); - build.verbose(|| println!("CXXFLAGS_{} = {cxxflags:?}", target.triple)); + build.verbose(|| eprintln!("CXX_{} = {cxx:?}", target.triple)); + build.verbose(|| eprintln!("CXXFLAGS_{} = {cxxflags:?}", target.triple)); } if let Some(ar) = ar { - build.verbose(|| println!("AR_{} = {ar:?}", target.triple)); + build.verbose(|| eprintln!("AR_{} = {ar:?}", target.triple)); build.ar.borrow_mut().insert(target, ar); } diff --git a/src/bootstrap/src/utils/change_tracker.rs b/src/bootstrap/src/utils/change_tracker.rs index 41a541d7269..f4f189c718a 100644 --- a/src/bootstrap/src/utils/change_tracker.rs +++ b/src/bootstrap/src/utils/change_tracker.rs @@ -310,4 +310,9 @@ pub const CONFIG_CHANGE_HISTORY: &[ChangeInfo] = &[ severity: ChangeSeverity::Warning, summary: "Revert `rust.download-rustc` global default to `false` and only use `rust.download-rustc = \"if-unchanged\"` default for library and tools profile. As alt CI rustc is built without debug assertions, `rust.debug-assertions = true` will now inhibit downloading CI rustc.", }, + ChangeInfo { + change_id: 133853, + severity: ChangeSeverity::Info, + summary: "`build.vendor` is now enabled by default for dist/tarball sources when 'vendor' directory and '.cargo/config.toml' file are present.", + }, ]; diff --git a/src/bootstrap/src/utils/helpers.rs b/src/bootstrap/src/utils/helpers.rs index 923cc2dfc28..c0d52fd3430 100644 --- a/src/bootstrap/src/utils/helpers.rs +++ b/src/bootstrap/src/utils/helpers.rs @@ -135,7 +135,7 @@ impl Drop for TimeIt { fn drop(&mut self) { let time = self.1.elapsed(); if !self.0 { - println!("\tfinished in {}.{:03} seconds", time.as_secs(), time.subsec_millis()); + eprintln!("\tfinished in {}.{:03} seconds", time.as_secs(), time.subsec_millis()); } } } @@ -267,12 +267,12 @@ pub fn check_run(cmd: &mut BootstrapCommand, print_cmd_on_fail: bool) -> bool { let status = match cmd.as_command_mut().status() { Ok(status) => status, Err(e) => { - println!("failed to execute command: {cmd:?}\nERROR: {e}"); + eprintln!("failed to execute command: {cmd:?}\nERROR: {e}"); return false; } }; if !status.success() && print_cmd_on_fail { - println!( + eprintln!( "\n\ncommand did not execute successfully: {cmd:?}\n\ expected success, got: {status}\n\n" ); diff --git a/src/bootstrap/src/utils/metrics.rs b/src/bootstrap/src/utils/metrics.rs index b51fd490535..06d3add6281 100644 --- a/src/bootstrap/src/utils/metrics.rs +++ b/src/bootstrap/src/utils/metrics.rs @@ -185,7 +185,7 @@ impl BuildMetrics { if version.format_version == CURRENT_FORMAT_VERSION { t!(serde_json::from_slice::<JsonRoot>(&contents)).invocations } else { - println!( + eprintln!( "WARNING: overriding existing build/metrics.json, as it's not \ compatible with build metrics format version {CURRENT_FORMAT_VERSION}." ); diff --git a/src/bootstrap/src/utils/render_tests.rs b/src/bootstrap/src/utils/render_tests.rs index eb2c8254dc0..7a3ec61c6da 100644 --- a/src/bootstrap/src/utils/render_tests.rs +++ b/src/bootstrap/src/utils/render_tests.rs @@ -56,7 +56,7 @@ fn run_tests(builder: &Builder<'_>, cmd: &mut BootstrapCommand, stream: bool) -> let cmd = cmd.as_command_mut(); cmd.stdout(Stdio::piped()); - builder.verbose(|| println!("running: {cmd:?}")); + builder.verbose(|| eprintln!("running: {cmd:?}")); let mut process = cmd.spawn().unwrap(); @@ -71,7 +71,7 @@ fn run_tests(builder: &Builder<'_>, cmd: &mut BootstrapCommand, stream: bool) -> let result = process.wait_with_output().unwrap(); if !result.status.success() && builder.is_verbose() { - println!( + eprintln!( "\n\ncommand did not execute successfully: {cmd:?}\n\ expected success, got: {}", result.status @@ -135,7 +135,9 @@ impl<'a> Renderer<'a> { if self.up_to_date_tests > 0 { let n = self.up_to_date_tests; let s = if n > 1 { "s" } else { "" }; - println!("help: ignored {n} up-to-date test{s}; use `--force-rerun` to prevent this\n"); + eprintln!( + "help: ignored {n} up-to-date test{s}; use `--force-rerun` to prevent this\n" + ); } } @@ -185,12 +187,12 @@ impl<'a> Renderer<'a> { } fn render_test_outcome_verbose(&self, outcome: Outcome<'_>, test: &TestOutcome) { - print!("test {} ... ", test.name); - self.builder.colored_stdout(|stdout| outcome.write_long(stdout)).unwrap(); + eprint!("test {} ... ", test.name); + self.builder.colored_stderr(|stdout| outcome.write_long(stdout)).unwrap(); if let Some(exec_time) = test.exec_time { - print!(" ({exec_time:.2?})"); + eprint!(" ({exec_time:.2?})"); } - println!(); + eprintln!(); } fn render_test_outcome_terse(&mut self, outcome: Outcome<'_>, test: &TestOutcome) { @@ -198,45 +200,45 @@ impl<'a> Renderer<'a> { if let Some(total) = self.tests_count { let total = total.to_string(); let executed = format!("{:>width$}", self.executed_tests - 1, width = total.len()); - print!(" {executed}/{total}"); + eprint!(" {executed}/{total}"); } - println!(); + eprintln!(); self.terse_tests_in_line = 0; } self.terse_tests_in_line += 1; - self.builder.colored_stdout(|stdout| outcome.write_short(stdout, &test.name)).unwrap(); + self.builder.colored_stderr(|stdout| outcome.write_short(stdout, &test.name)).unwrap(); let _ = std::io::stdout().flush(); } fn render_suite_outcome(&self, outcome: Outcome<'_>, suite: &SuiteOutcome) { // The terse output doesn't end with a newline, so we need to add it ourselves. if !self.builder.config.verbose_tests { - println!(); + eprintln!(); } if !self.failures.is_empty() { - println!("\nfailures:\n"); + eprintln!("\nfailures:\n"); for failure in &self.failures { if failure.stdout.is_some() || failure.message.is_some() { - println!("---- {} stdout ----", failure.name); + eprintln!("---- {} stdout ----", failure.name); if let Some(stdout) = &failure.stdout { - println!("{stdout}"); + eprintln!("{stdout}"); } if let Some(message) = &failure.message { - println!("NOTE: {message}"); + eprintln!("NOTE: {message}"); } } } - println!("\nfailures:"); + eprintln!("\nfailures:"); for failure in &self.failures { - println!(" {}", failure.name); + eprintln!(" {}", failure.name); } } if !self.benches.is_empty() { - println!("\nbenchmarks:"); + eprintln!("\nbenchmarks:"); let mut rows = Vec::new(); for bench in &self.benches { @@ -251,13 +253,13 @@ impl<'a> Renderer<'a> { let max_1 = rows.iter().map(|r| r.1.len()).max().unwrap_or(0); let max_2 = rows.iter().map(|r| r.2.len()).max().unwrap_or(0); for row in &rows { - println!(" {:<max_0$} {:>max_1$} {:>max_2$}", row.0, row.1, row.2); + eprintln!(" {:<max_0$} {:>max_1$} {:>max_2$}", row.0, row.1, row.2); } } - print!("\ntest result: "); - self.builder.colored_stdout(|stdout| outcome.write_long(stdout)).unwrap(); - println!( + eprint!("\ntest result: "); + self.builder.colored_stderr(|stdout| outcome.write_long(stdout)).unwrap(); + eprintln!( ". {} passed; {} failed; {} ignored; {} measured; {} filtered out{time}\n", suite.passed, suite.failed, @@ -274,7 +276,7 @@ impl<'a> Renderer<'a> { fn render_message(&mut self, message: Message) { match message { Message::Suite(SuiteMessage::Started { test_count }) => { - println!("\nrunning {test_count} tests"); + eprintln!("\nrunning {test_count} tests"); self.executed_tests = 0; self.terse_tests_in_line = 0; self.tests_count = Some(test_count); @@ -314,7 +316,7 @@ impl<'a> Renderer<'a> { self.failures.push(outcome); } Message::Test(TestMessage::Timeout { name }) => { - println!("test {name} has been running for a long time"); + eprintln!("test {name} has been running for a long time"); } Message::Test(TestMessage::Started) => {} // Not useful } diff --git a/src/bootstrap/src/utils/tarball.rs b/src/bootstrap/src/utils/tarball.rs index 3c6c7a7fa18..f60498a4872 100644 --- a/src/bootstrap/src/utils/tarball.rs +++ b/src/bootstrap/src/utils/tarball.rs @@ -344,7 +344,7 @@ impl<'a> Tarball<'a> { // For `x install` tarball files aren't needed, so we can speed up the process by not producing them. let compression_profile = if self.builder.kind == Kind::Install { self.builder.verbose(|| { - println!("Forcing dist.compression-profile = 'no-op' for `x install`.") + eprintln!("Forcing dist.compression-profile = 'no-op' for `x install`.") }); // "no-op" indicates that the rust-installer won't produce compressed tarball sources. "no-op" diff --git a/src/ci/docker/host-x86_64/dist-arm-linux/Dockerfile b/src/ci/docker/host-aarch64/dist-arm-linux/Dockerfile index 420c42bc9d8..4a749473004 100644 --- a/src/ci/docker/host-x86_64/dist-arm-linux/Dockerfile +++ b/src/ci/docker/host-aarch64/dist-arm-linux/Dockerfile @@ -19,7 +19,7 @@ RUN sh /scripts/rustbuild-setup.sh WORKDIR /tmp COPY scripts/crosstool-ng-build.sh /scripts/ -COPY host-x86_64/dist-arm-linux/arm-linux-gnueabi.defconfig /tmp/crosstool.defconfig +COPY host-aarch64/dist-arm-linux/arm-linux-gnueabi.defconfig /tmp/crosstool.defconfig RUN /scripts/crosstool-ng-build.sh COPY scripts/sccache.sh /scripts/ diff --git a/src/ci/docker/host-x86_64/dist-arm-linux/arm-linux-gnueabi.defconfig b/src/ci/docker/host-aarch64/dist-arm-linux/arm-linux-gnueabi.defconfig index e7afdbe9d4d..e7afdbe9d4d 100644 --- a/src/ci/docker/host-x86_64/dist-arm-linux/arm-linux-gnueabi.defconfig +++ b/src/ci/docker/host-aarch64/dist-arm-linux/arm-linux-gnueabi.defconfig diff --git a/src/ci/github-actions/jobs.yml b/src/ci/github-actions/jobs.yml index 288b133f0da..959a9580e60 100644 --- a/src/ci/github-actions/jobs.yml +++ b/src/ci/github-actions/jobs.yml @@ -43,7 +43,7 @@ runners: os: windows-2022-16core-64gb <<: *base-job - - &job-aarch64-linux + - &job-linux-8c-aarch64 os: ubuntu-22.04-arm64-8core-32gb envs: @@ -139,10 +139,10 @@ auto: ############################# - image: aarch64-gnu - <<: *job-aarch64-linux + <<: *job-linux-8c-aarch64 - image: aarch64-gnu-debug - <<: *job-aarch64-linux + <<: *job-linux-8c-aarch64 - image: arm-android <<: *job-linux-4c @@ -159,7 +159,7 @@ auto: <<: *job-linux-4c - image: dist-arm-linux - <<: *job-linux-8c + <<: *job-linux-8c-aarch64 - image: dist-armhf-linux <<: *job-linux-4c diff --git a/src/tools/clippy/clippy_lints/src/default.rs b/src/tools/clippy/clippy_lints/src/default.rs index de775b64795..ffdd946aadb 100644 --- a/src/tools/clippy/clippy_lints/src/default.rs +++ b/src/tools/clippy/clippy_lints/src/default.rs @@ -5,7 +5,7 @@ use clippy_utils::{contains_name, get_parent_expr, in_automatically_derived, is_ use rustc_data_structures::fx::FxHashSet; use rustc_errors::Applicability; use rustc_hir::def::Res; -use rustc_hir::{Block, Expr, ExprKind, PatKind, QPath, Stmt, StmtKind}; +use rustc_hir::{Block, Expr, ExprKind, PatKind, QPath, Stmt, StmtKind, StructTailExpr}; use rustc_lint::{LateContext, LateLintPass}; use rustc_middle::ty; use rustc_middle::ty::print::with_forced_trimmed_paths; @@ -285,7 +285,7 @@ fn field_reassigned_by_stmt<'tcx>(this: &Stmt<'tcx>, binding_name: Symbol) -> Op /// Returns whether `expr` is the update syntax base: `Foo { a: 1, .. base }` fn is_update_syntax_base<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) -> bool { if let Some(parent) = get_parent_expr(cx, expr) - && let ExprKind::Struct(_, _, Some(base)) = parent.kind + && let ExprKind::Struct(_, _, StructTailExpr::Base(base)) = parent.kind { base.hir_id == expr.hir_id } else { diff --git a/src/tools/clippy/clippy_lints/src/default_numeric_fallback.rs b/src/tools/clippy/clippy_lints/src/default_numeric_fallback.rs index ef6b141920d..6819ad547f8 100644 --- a/src/tools/clippy/clippy_lints/src/default_numeric_fallback.rs +++ b/src/tools/clippy/clippy_lints/src/default_numeric_fallback.rs @@ -4,7 +4,7 @@ use clippy_utils::source::snippet_opt; use rustc_ast::ast::{LitFloatType, LitIntType, LitKind}; use rustc_errors::Applicability; use rustc_hir::intravisit::{Visitor, walk_expr, walk_stmt}; -use rustc_hir::{Block, Body, ConstContext, Expr, ExprKind, FnRetTy, HirId, Lit, Stmt, StmtKind}; +use rustc_hir::{Block, Body, ConstContext, Expr, ExprKind, FnRetTy, HirId, Lit, Stmt, StmtKind, StructTailExpr}; use rustc_lint::{LateContext, LateLintPass, LintContext}; use rustc_middle::lint::in_external_macro; use rustc_middle::ty::{self, FloatTy, IntTy, PolyFnSig, Ty}; @@ -197,7 +197,7 @@ impl<'tcx> Visitor<'tcx> for NumericFallbackVisitor<'_, 'tcx> { } // Visit base with no bound. - if let Some(base) = base { + if let StructTailExpr::Base(base) = base { self.ty_bounds.push(ExplicitTyBound(false)); self.visit_expr(base); self.ty_bounds.pop(); diff --git a/src/tools/clippy/clippy_lints/src/inconsistent_struct_constructor.rs b/src/tools/clippy/clippy_lints/src/inconsistent_struct_constructor.rs index d386bfca6ba..4fcd2abb769 100644 --- a/src/tools/clippy/clippy_lints/src/inconsistent_struct_constructor.rs +++ b/src/tools/clippy/clippy_lints/src/inconsistent_struct_constructor.rs @@ -3,7 +3,7 @@ use clippy_utils::fulfill_or_allowed; use clippy_utils::source::snippet; use rustc_data_structures::fx::FxHashMap; use rustc_errors::Applicability; -use rustc_hir::{self as hir, ExprKind}; +use rustc_hir::{self as hir, ExprKind, StructTailExpr}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::declare_lint_pass; use rustc_span::symbol::Symbol; @@ -95,7 +95,7 @@ impl<'tcx> LateLintPass<'tcx> for InconsistentStructConstructor { } fields_snippet.push_str(&last_ident.to_string()); - let base_snippet = if let Some(base) = base { + let base_snippet = if let StructTailExpr::Base(base) = base { format!(", ..{}", snippet(cx, base.span, "..")) } else { String::new() diff --git a/src/tools/clippy/clippy_lints/src/init_numbered_fields.rs b/src/tools/clippy/clippy_lints/src/init_numbered_fields.rs index 7f183bb601e..7a14bbfb9e8 100644 --- a/src/tools/clippy/clippy_lints/src/init_numbered_fields.rs +++ b/src/tools/clippy/clippy_lints/src/init_numbered_fields.rs @@ -2,7 +2,7 @@ use clippy_utils::diagnostics::span_lint_and_then; use clippy_utils::source::{snippet_with_applicability, snippet_with_context}; use rustc_errors::Applicability; use rustc_hir::def::{DefKind, Res}; -use rustc_hir::{Expr, ExprKind}; +use rustc_hir::{Expr, ExprKind, StructTailExpr}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::declare_lint_pass; use rustc_span::SyntaxContext; @@ -43,7 +43,7 @@ declare_lint_pass!(NumberedFields => [INIT_NUMBERED_FIELDS]); impl<'tcx> LateLintPass<'tcx> for NumberedFields { fn check_expr(&mut self, cx: &LateContext<'tcx>, e: &'tcx Expr<'_>) { - if let ExprKind::Struct(path, fields @ [field, ..], None) = e.kind + if let ExprKind::Struct(path, fields @ [field, ..], StructTailExpr::None) = e.kind // If the first character of any field is a digit it has to be a tuple. && field.ident.as_str().as_bytes().first().is_some_and(u8::is_ascii_digit) // Type aliases can't be used as functions. diff --git a/src/tools/clippy/clippy_lints/src/loops/never_loop.rs b/src/tools/clippy/clippy_lints/src/loops/never_loop.rs index 1c55e3e22e8..ed9879de13b 100644 --- a/src/tools/clippy/clippy_lints/src/loops/never_loop.rs +++ b/src/tools/clippy/clippy_lints/src/loops/never_loop.rs @@ -5,7 +5,7 @@ use clippy_utils::higher::ForLoop; use clippy_utils::macros::root_macro_call_first_node; use clippy_utils::source::snippet; use rustc_errors::Applicability; -use rustc_hir::{Block, Destination, Expr, ExprKind, HirId, InlineAsmOperand, Pat, Stmt, StmtKind}; +use rustc_hir::{Block, Destination, Expr, ExprKind, HirId, InlineAsmOperand, Pat, Stmt, StmtKind, StructTailExpr}; use rustc_lint::LateContext; use rustc_span::{Span, sym}; use std::iter::once; @@ -164,7 +164,7 @@ fn never_loop_expr<'tcx>( }, ExprKind::Struct(_, fields, base) => { let fields = never_loop_expr_all(cx, fields.iter().map(|f| f.expr), local_labels, main_loop_id); - if let Some(base) = base { + if let StructTailExpr::Base(base) = base { combine_seq(fields, || never_loop_expr(cx, base, local_labels, main_loop_id)) } else { fields diff --git a/src/tools/clippy/clippy_lints/src/needless_pass_by_value.rs b/src/tools/clippy/clippy_lints/src/needless_pass_by_value.rs index cd90d2f90f7..6f3f371a68d 100644 --- a/src/tools/clippy/clippy_lints/src/needless_pass_by_value.rs +++ b/src/tools/clippy/clippy_lints/src/needless_pass_by_value.rs @@ -200,6 +200,7 @@ impl<'tcx> LateLintPass<'tcx> for NeedlessPassByValue { cx.param_env, ty, traits::ObligationCause::dummy_with_span(span), + rustc_hir::Safety::Safe, ) .is_ok() { diff --git a/src/tools/clippy/clippy_lints/src/needless_update.rs b/src/tools/clippy/clippy_lints/src/needless_update.rs index 6a2893cefbd..0cba72bd2c6 100644 --- a/src/tools/clippy/clippy_lints/src/needless_update.rs +++ b/src/tools/clippy/clippy_lints/src/needless_update.rs @@ -1,5 +1,5 @@ use clippy_utils::diagnostics::span_lint; -use rustc_hir::{Expr, ExprKind}; +use rustc_hir::{Expr, ExprKind, StructTailExpr}; use rustc_lint::{LateContext, LateLintPass}; use rustc_middle::ty; use rustc_session::declare_lint_pass; @@ -51,7 +51,7 @@ declare_lint_pass!(NeedlessUpdate => [NEEDLESS_UPDATE]); impl<'tcx> LateLintPass<'tcx> for NeedlessUpdate { fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) { - if let ExprKind::Struct(_, fields, Some(base)) = expr.kind { + if let ExprKind::Struct(_, fields, StructTailExpr::Base(base)) = expr.kind { let ty = cx.typeck_results().expr_ty(expr); if let ty::Adt(def, _) = ty.kind() { if fields.len() == def.non_enum_variant().fields.len() diff --git a/src/tools/clippy/clippy_lints/src/no_effect.rs b/src/tools/clippy/clippy_lints/src/no_effect.rs index 8ecff9c3f9b..9e44bb02c56 100644 --- a/src/tools/clippy/clippy_lints/src/no_effect.rs +++ b/src/tools/clippy/clippy_lints/src/no_effect.rs @@ -8,7 +8,7 @@ use rustc_errors::Applicability; use rustc_hir::def::{DefKind, Res}; use rustc_hir::{ BinOpKind, BlockCheckMode, Expr, ExprKind, HirId, HirIdMap, ItemKind, LocalSource, Node, PatKind, Stmt, StmtKind, - UnsafeSource, is_range_literal, + UnsafeSource, StructTailExpr, is_range_literal, }; use rustc_infer::infer::TyCtxtInferExt as _; use rustc_lint::{LateContext, LateLintPass, LintContext}; @@ -238,7 +238,10 @@ fn has_no_effect(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool { ExprKind::Struct(_, fields, ref base) => { !has_drop(cx, cx.typeck_results().expr_ty(expr)) && fields.iter().all(|field| has_no_effect(cx, field.expr)) - && base.as_ref().is_none_or(|base| has_no_effect(cx, base)) + && match &base { + StructTailExpr::None | StructTailExpr::DefaultFields(_) => true, + StructTailExpr::Base(base) => has_no_effect(cx, base), + } }, ExprKind::Call(callee, args) => { if let ExprKind::Path(ref qpath) = callee.kind { @@ -342,6 +345,10 @@ fn reduce_expression<'a>(cx: &LateContext<'_>, expr: &'a Expr<'a>) -> Option<Vec if has_drop(cx, cx.typeck_results().expr_ty(expr)) { None } else { + let base = match base { + StructTailExpr::Base(base) => Some(base), + StructTailExpr::None | StructTailExpr::DefaultFields(_) => None, + }; Some(fields.iter().map(|f| &f.expr).chain(base).map(Deref::deref).collect()) } }, diff --git a/src/tools/clippy/clippy_lints/src/non_copy_const.rs b/src/tools/clippy/clippy_lints/src/non_copy_const.rs index 5f253b9e5d5..ebd301d5156 100644 --- a/src/tools/clippy/clippy_lints/src/non_copy_const.rs +++ b/src/tools/clippy/clippy_lints/src/non_copy_const.rs @@ -11,7 +11,7 @@ use rustc_hir::{ BodyId, Expr, ExprKind, HirId, Impl, ImplItem, ImplItemKind, Item, ItemKind, Node, TraitItem, TraitItemKind, UnOp, }; use rustc_lint::{LateContext, LateLintPass, Lint}; -use rustc_middle::mir::interpret::{ErrorHandled, EvalToValTreeResult, GlobalId}; +use rustc_middle::mir::interpret::{ErrorHandled, EvalToValTreeResult, GlobalId, ReportedErrorInfo}; use rustc_middle::ty::adjustment::Adjust; use rustc_middle::ty::{self, Ty, TyCtxt}; use rustc_session::impl_lint_pass; @@ -302,7 +302,10 @@ impl<'tcx> NonCopyConst<'tcx> { tcx.const_eval_global_id_for_typeck(typing_env, cid, span) }, Ok(None) => Err(ErrorHandled::TooGeneric(span)), - Err(err) => Err(ErrorHandled::Reported(err.into(), span)), + Err(err) => Err(ErrorHandled::Reported( + ReportedErrorInfo::non_const_eval_error(err), + span, + )), } } } diff --git a/src/tools/clippy/clippy_lints/src/single_range_in_vec_init.rs b/src/tools/clippy/clippy_lints/src/single_range_in_vec_init.rs index 44e585953bf..bb11daecc07 100644 --- a/src/tools/clippy/clippy_lints/src/single_range_in_vec_init.rs +++ b/src/tools/clippy/clippy_lints/src/single_range_in_vec_init.rs @@ -6,7 +6,7 @@ use clippy_utils::source::SpanRangeExt; use clippy_utils::ty::implements_trait; use rustc_ast::{LitIntType, LitKind, UintTy}; use rustc_errors::Applicability; -use rustc_hir::{Expr, ExprKind, LangItem, QPath}; +use rustc_hir::{Expr, ExprKind, LangItem, QPath, StructTailExpr}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::declare_lint_pass; use std::fmt::{self, Display, Formatter}; @@ -86,7 +86,7 @@ impl LateLintPass<'_> for SingleRangeInVecInit { return; }; - let ExprKind::Struct(QPath::LangItem(lang_item, ..), [start, end], None) = inner_expr.kind else { + let ExprKind::Struct(QPath::LangItem(lang_item, ..), [start, end], StructTailExpr::None) = inner_expr.kind else { return; }; diff --git a/src/tools/clippy/clippy_lints/src/unnecessary_struct_initialization.rs b/src/tools/clippy/clippy_lints/src/unnecessary_struct_initialization.rs index afdd3505cdd..0a90d31db7e 100644 --- a/src/tools/clippy/clippy_lints/src/unnecessary_struct_initialization.rs +++ b/src/tools/clippy/clippy_lints/src/unnecessary_struct_initialization.rs @@ -2,7 +2,7 @@ use clippy_utils::diagnostics::span_lint_and_sugg; use clippy_utils::source::snippet; use clippy_utils::ty::is_copy; use clippy_utils::{get_parent_expr, path_to_local}; -use rustc_hir::{BindingMode, Expr, ExprField, ExprKind, Node, PatKind, Path, QPath, UnOp}; +use rustc_hir::{BindingMode, Expr, ExprField, ExprKind, Node, PatKind, Path, QPath, UnOp, StructTailExpr}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::declare_lint_pass; @@ -59,15 +59,15 @@ impl LateLintPass<'_> for UnnecessaryStruct { let field_path = same_path_in_all_fields(cx, expr, fields); let sugg = match (field_path, base) { - (Some(&path), None) => { + (Some(&path), StructTailExpr::None | StructTailExpr::DefaultFields(_)) => { // all fields match, no base given path.span }, - (Some(path), Some(base)) if base_is_suitable(cx, expr, base) && path_matches_base(path, base) => { + (Some(path), StructTailExpr::Base(base)) if base_is_suitable(cx, expr, base) && path_matches_base(path, base) => { // all fields match, has base: ensure that the path of the base matches base.span }, - (None, Some(base)) if fields.is_empty() && base_is_suitable(cx, expr, base) => { + (None, StructTailExpr::Base(base)) if fields.is_empty() && base_is_suitable(cx, expr, base) => { // just the base, no explicit fields base.span }, diff --git a/src/tools/clippy/clippy_lints/src/utils/author.rs b/src/tools/clippy/clippy_lints/src/utils/author.rs index 51001d374b4..311ed427cb9 100644 --- a/src/tools/clippy/clippy_lints/src/utils/author.rs +++ b/src/tools/clippy/clippy_lints/src/utils/author.rs @@ -4,7 +4,7 @@ use rustc_ast::ast::{LitFloatType, LitKind}; use rustc_data_structures::fx::FxHashMap; use rustc_hir::{ self as hir, BindingMode, CaptureBy, Closure, ClosureKind, ConstArg, ConstArgKind, CoroutineKind, - ExprKind, FnRetTy, HirId, Lit, PatKind, QPath, StmtKind, TyKind, + ExprKind, FnRetTy, HirId, Lit, PatKind, QPath, StmtKind, TyKind, StructTailExpr, }; use rustc_lint::{LateContext, LateLintPass, LintContext}; use rustc_session::declare_lint_pass; @@ -598,7 +598,10 @@ impl<'a, 'tcx> PrintVisitor<'a, 'tcx> { }, ExprKind::Struct(qpath, fields, base) => { bind!(self, qpath, fields); - opt_bind!(self, base); + let base = OptionPat::new(match base { + StructTailExpr::Base(base) => Some(self.bind("base", base)), + StructTailExpr::None | StructTailExpr::DefaultFields(_) => None, + }); kind!("Struct({qpath}, {fields}, {base})"); self.qpath(qpath); self.slice(fields, |field| { diff --git a/src/tools/clippy/clippy_utils/src/higher.rs b/src/tools/clippy/clippy_utils/src/higher.rs index 11bbe734844..d216879cbd2 100644 --- a/src/tools/clippy/clippy_utils/src/higher.rs +++ b/src/tools/clippy/clippy_utils/src/higher.rs @@ -8,7 +8,7 @@ use crate::ty::is_type_diagnostic_item; use rustc_ast::ast; use rustc_hir as hir; -use rustc_hir::{Arm, Block, Expr, ExprKind, HirId, LoopSource, MatchSource, Node, Pat, QPath}; +use rustc_hir::{Arm, Block, Expr, ExprKind, StructTailExpr, HirId, LoopSource, MatchSource, Node, Pat, QPath}; use rustc_lint::LateContext; use rustc_span::{Span, sym, symbol}; @@ -236,7 +236,7 @@ impl<'a> Range<'a> { limits: ast::RangeLimits::Closed, }) }, - ExprKind::Struct(path, fields, None) => match (path, fields) { + ExprKind::Struct(path, fields, StructTailExpr::None) => match (path, fields) { (QPath::LangItem(hir::LangItem::RangeFull, ..), []) => Some(Range { start: None, end: None, diff --git a/src/tools/clippy/clippy_utils/src/hir_utils.rs b/src/tools/clippy/clippy_utils/src/hir_utils.rs index 7f3e331e7f6..4be4340862d 100644 --- a/src/tools/clippy/clippy_utils/src/hir_utils.rs +++ b/src/tools/clippy/clippy_utils/src/hir_utils.rs @@ -10,7 +10,7 @@ use rustc_hir::{ AssocItemConstraint, BinOpKind, BindingMode, Block, BodyId, Closure, ConstArg, ConstArgKind, Expr, ExprField, ExprKind, FnRetTy, GenericArg, GenericArgs, HirId, HirIdMap, InlineAsmOperand, LetExpr, Lifetime, LifetimeName, Pat, PatField, PatKind, Path, PathSegment, PrimTy, QPath, Stmt, StmtKind, TraitBoundModifiers, Ty, - TyKind, + TyKind, StructTailExpr, }; use rustc_lexer::{TokenKind, tokenize}; use rustc_lint::LateContext; @@ -380,7 +380,12 @@ impl HirEqInterExpr<'_, '_, '_> { (ExprKind::Ret(l), ExprKind::Ret(r)) => both(l.as_ref(), r.as_ref(), |l, r| self.eq_expr(l, r)), (&ExprKind::Struct(l_path, lf, ref lo), &ExprKind::Struct(r_path, rf, ref ro)) => { self.eq_qpath(l_path, r_path) - && both(lo.as_ref(), ro.as_ref(), |l, r| self.eq_expr(l, r)) + && match (lo, ro) { + (StructTailExpr::Base(l),StructTailExpr::Base(r)) => self.eq_expr(l, r), + (StructTailExpr::None, StructTailExpr::None) => true, + (StructTailExpr::DefaultFields(_), StructTailExpr::DefaultFields(_)) => true, + _ => false, + } && over(lf, rf, |l, r| self.eq_expr_field(l, r)) }, (&ExprKind::Tup(l_tup), &ExprKind::Tup(r_tup)) => self.eq_exprs(l_tup, r_tup), @@ -1017,7 +1022,7 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> { self.hash_expr(f.expr); } - if let Some(e) = *expr { + if let StructTailExpr::Base(e) = *expr { self.hash_expr(e); } }, diff --git a/src/tools/clippy/clippy_utils/src/visitors.rs b/src/tools/clippy/clippy_utils/src/visitors.rs index a79be5ca7d4..351e619d7b1 100644 --- a/src/tools/clippy/clippy_utils/src/visitors.rs +++ b/src/tools/clippy/clippy_utils/src/visitors.rs @@ -7,7 +7,7 @@ use rustc_hir::def::{CtorKind, DefKind, Res}; use rustc_hir::intravisit::{self, Visitor, walk_block, walk_expr}; use rustc_hir::{ AnonConst, Arm, Block, BlockCheckMode, Body, BodyId, Expr, ExprKind, HirId, ItemId, ItemKind, LetExpr, Pat, QPath, - Safety, Stmt, UnOp, UnsafeSource, + Safety, Stmt, UnOp, UnsafeSource, StructTailExpr, }; use rustc_lint::LateContext; use rustc_middle::hir::nested_filter; @@ -663,7 +663,7 @@ pub fn for_each_unconsumed_temporary<'tcx, B>( for field in fields { helper(typeck, true, field.expr, f)?; } - if let Some(default) = default { + if let StructTailExpr::Base(default) = default { helper(typeck, false, default, f)?; } }, diff --git a/src/tools/compiletest/src/compute_diff.rs b/src/tools/compiletest/src/compute_diff.rs index 92c80c27de0..3ace6c5b6d7 100644 --- a/src/tools/compiletest/src/compute_diff.rs +++ b/src/tools/compiletest/src/compute_diff.rs @@ -144,7 +144,7 @@ where } if !wrote_data { - println!("note: diff is identical to nightly rustdoc"); + eprintln!("note: diff is identical to nightly rustdoc"); assert!(diff_output.metadata().unwrap().len() == 0); return false; } else if verbose { diff --git a/src/tools/compiletest/src/debuggers.rs b/src/tools/compiletest/src/debuggers.rs index b605bc813f1..e75c8a5993e 100644 --- a/src/tools/compiletest/src/debuggers.rs +++ b/src/tools/compiletest/src/debuggers.rs @@ -20,7 +20,7 @@ pub(crate) fn configure_gdb(config: &Config) -> Option<Arc<Config>> { } if config.remote_test_client.is_some() && !config.target.contains("android") { - println!( + eprintln!( "WARNING: debuginfo tests are not available when \ testing with remote" ); @@ -28,7 +28,7 @@ pub(crate) fn configure_gdb(config: &Config) -> Option<Arc<Config>> { } if config.target.contains("android") { - println!( + eprintln!( "{} debug-info test uses tcp 5039 port.\ please reserve it", config.target @@ -50,7 +50,7 @@ pub(crate) fn configure_lldb(config: &Config) -> Option<Arc<Config>> { config.lldb_python_dir.as_ref()?; if let Some(350) = config.lldb_version { - println!( + eprintln!( "WARNING: The used version of LLDB (350) has a \ known issue that breaks debuginfo tests. See \ issue #32520 for more information. Skipping all \ diff --git a/src/tools/compiletest/src/lib.rs b/src/tools/compiletest/src/lib.rs index a5a166af33b..9acb7d393b4 100644 --- a/src/tools/compiletest/src/lib.rs +++ b/src/tools/compiletest/src/lib.rs @@ -188,8 +188,8 @@ pub fn parse_config(args: Vec<String>) -> Config { let (argv0, args_) = args.split_first().unwrap(); if args.len() == 1 || args[1] == "-h" || args[1] == "--help" { let message = format!("Usage: {} [OPTIONS] [TESTNAME...]", argv0); - println!("{}", opts.usage(&message)); - println!(); + eprintln!("{}", opts.usage(&message)); + eprintln!(); panic!() } @@ -200,8 +200,8 @@ pub fn parse_config(args: Vec<String>) -> Config { if matches.opt_present("h") || matches.opt_present("help") { let message = format!("Usage: {} [OPTIONS] [TESTNAME...]", argv0); - println!("{}", opts.usage(&message)); - println!(); + eprintln!("{}", opts.usage(&message)); + eprintln!(); panic!() } @@ -508,7 +508,7 @@ pub fn run_tests(config: Arc<Config>) { // easy to miss which tests failed, and as such fail to reproduce // the failure locally. - println!( + eprintln!( "Some tests failed in compiletest suite={}{} mode={} host={} target={}", config.suite, config diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 7b11bf3b121..ca746ed8c55 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -131,7 +131,7 @@ pub fn run(config: Arc<Config>, testpaths: &TestPaths, revision: Option<&str>) { if config.verbose { // We're going to be dumping a lot of info. Start on a new line. - print!("\n\n"); + eprintln!("\n"); } debug!("running {:?}", testpaths.file.display()); let mut props = TestProps::from_file(&testpaths.file, revision, &config); @@ -353,7 +353,7 @@ impl<'test> TestCx<'test> { { self.error(&format!("{} test did not emit an error", self.config.mode)); if self.config.mode == crate::common::Mode::Ui { - println!("note: by default, ui tests are expected not to compile"); + eprintln!("note: by default, ui tests are expected not to compile"); } proc_res.fatal(None, || ()); }; @@ -774,20 +774,20 @@ impl<'test> TestCx<'test> { unexpected.len(), not_found.len() )); - println!("status: {}\ncommand: {}\n", proc_res.status, proc_res.cmdline); + eprintln!("status: {}\ncommand: {}\n", proc_res.status, proc_res.cmdline); if !unexpected.is_empty() { - println!("{}", "--- unexpected errors (from JSON output) ---".green()); + eprintln!("{}", "--- unexpected errors (from JSON output) ---".green()); for error in &unexpected { - println!("{}", error.render_for_expected()); + eprintln!("{}", error.render_for_expected()); } - println!("{}", "---".green()); + eprintln!("{}", "---".green()); } if !not_found.is_empty() { - println!("{}", "--- not found errors (from test file) ---".red()); + eprintln!("{}", "--- not found errors (from test file) ---".red()); for error in ¬_found { - println!("{}", error.render_for_expected()); + eprintln!("{}", error.render_for_expected()); } - println!("{}", "---\n".red()); + eprintln!("{}", "---\n".red()); } panic!("errors differ from expected"); } @@ -1876,18 +1876,18 @@ impl<'test> TestCx<'test> { fn maybe_dump_to_stdout(&self, out: &str, err: &str) { if self.config.verbose { - println!("------stdout------------------------------"); - println!("{}", out); - println!("------stderr------------------------------"); - println!("{}", err); - println!("------------------------------------------"); + eprintln!("------stdout------------------------------"); + eprintln!("{}", out); + eprintln!("------stderr------------------------------"); + eprintln!("{}", err); + eprintln!("------------------------------------------"); } } fn error(&self, err: &str) { match self.revision { - Some(rev) => println!("\nerror in revision `{}`: {}", rev, err), - None => println!("\nerror: {}", err), + Some(rev) => eprintln!("\nerror in revision `{}`: {}", rev, err), + None => eprintln!("\nerror: {}", err), } } @@ -1972,7 +1972,7 @@ impl<'test> TestCx<'test> { if !self.config.has_html_tidy { return; } - println!("info: generating a diff against nightly rustdoc"); + eprintln!("info: generating a diff against nightly rustdoc"); let suffix = self.safe_revision().map_or("nightly".into(), |path| path.to_owned() + "-nightly"); @@ -2082,7 +2082,7 @@ impl<'test> TestCx<'test> { .output() .unwrap(); assert!(output.status.success()); - println!("{}", String::from_utf8_lossy(&output.stdout)); + eprintln!("{}", String::from_utf8_lossy(&output.stdout)); eprintln!("{}", String::from_utf8_lossy(&output.stderr)); } else { use colored::Colorize; @@ -2496,7 +2496,7 @@ impl<'test> TestCx<'test> { )"# ) .replace_all(&output, |caps: &Captures<'_>| { - println!("{}", &caps[0]); + eprintln!("{}", &caps[0]); caps[0].replace(r"\", "/") }) .replace("\r\n", "\n") @@ -2601,14 +2601,14 @@ impl<'test> TestCx<'test> { if let Err(err) = fs::write(&actual_path, &actual) { self.fatal(&format!("failed to write {stream} to `{actual_path:?}`: {err}",)); } - println!("Saved the actual {stream} to {actual_path:?}"); + eprintln!("Saved the actual {stream} to {actual_path:?}"); let expected_path = expected_output_path(self.testpaths, self.revision, &self.config.compare_mode, stream); if !self.config.bless { if expected.is_empty() { - println!("normalized {}:\n{}\n", stream, actual); + eprintln!("normalized {}:\n{}\n", stream, actual); } else { self.show_diff( stream, @@ -2631,10 +2631,10 @@ impl<'test> TestCx<'test> { if let Err(err) = fs::write(&expected_path, &actual) { self.fatal(&format!("failed to write {stream} to `{expected_path:?}`: {err}")); } - println!("Blessing the {stream} of {test_name} in {expected_path:?}"); + eprintln!("Blessing the {stream} of {test_name} in {expected_path:?}"); } - println!("\nThe actual {0} differed from the expected {0}.", stream); + eprintln!("\nThe actual {0} differed from the expected {0}.", stream); if self.config.bless { 0 } else { 1 } } @@ -2783,7 +2783,7 @@ impl<'test> TestCx<'test> { fs::create_dir_all(&incremental_dir).unwrap(); if self.config.verbose { - println!("init_incremental_test: incremental_dir={}", incremental_dir.display()); + eprintln!("init_incremental_test: incremental_dir={}", incremental_dir.display()); } } @@ -2841,7 +2841,7 @@ impl ProcRes { } } - println!( + eprintln!( "status: {}\ncommand: {}\n{}\n{}\n", self.status, self.cmdline, @@ -2852,7 +2852,7 @@ impl ProcRes { pub fn fatal(&self, err: Option<&str>, on_failure: impl FnOnce()) -> ! { if let Some(e) = err { - println!("\nerror: {}", e); + eprintln!("\nerror: {}", e); } self.print_info(); on_failure(); diff --git a/src/tools/compiletest/src/runtest/codegen_units.rs b/src/tools/compiletest/src/runtest/codegen_units.rs index 6c866cbef21..6acd140183d 100644 --- a/src/tools/compiletest/src/runtest/codegen_units.rs +++ b/src/tools/compiletest/src/runtest/codegen_units.rs @@ -64,13 +64,13 @@ impl TestCx<'_> { if !missing.is_empty() { missing.sort(); - println!("\nThese items should have been contained but were not:\n"); + eprintln!("\nThese items should have been contained but were not:\n"); for item in &missing { - println!("{}", item); + eprintln!("{}", item); } - println!("\n"); + eprintln!("\n"); } if !unexpected.is_empty() { @@ -80,24 +80,24 @@ impl TestCx<'_> { sorted }; - println!("\nThese items were contained but should not have been:\n"); + eprintln!("\nThese items were contained but should not have been:\n"); for item in sorted { - println!("{}", item); + eprintln!("{}", item); } - println!("\n"); + eprintln!("\n"); } if !wrong_cgus.is_empty() { wrong_cgus.sort_by_key(|pair| pair.0.name.clone()); - println!("\nThe following items were assigned to wrong codegen units:\n"); + eprintln!("\nThe following items were assigned to wrong codegen units:\n"); for &(ref expected_item, ref actual_item) in &wrong_cgus { - println!("{}", expected_item.name); - println!(" expected: {}", codegen_units_to_str(&expected_item.codegen_units)); - println!(" actual: {}", codegen_units_to_str(&actual_item.codegen_units)); - println!(); + eprintln!("{}", expected_item.name); + eprintln!(" expected: {}", codegen_units_to_str(&expected_item.codegen_units)); + eprintln!(" actual: {}", codegen_units_to_str(&actual_item.codegen_units)); + eprintln!(); } } diff --git a/src/tools/compiletest/src/runtest/debuginfo.rs b/src/tools/compiletest/src/runtest/debuginfo.rs index c621c22ac99..7322e730e53 100644 --- a/src/tools/compiletest/src/runtest/debuginfo.rs +++ b/src/tools/compiletest/src/runtest/debuginfo.rs @@ -260,7 +260,7 @@ impl TestCx<'_> { cmdline, }; if adb.kill().is_err() { - println!("Adb process is already finished."); + eprintln!("Adb process is already finished."); } } else { let rust_src_root = @@ -275,7 +275,7 @@ impl TestCx<'_> { match self.config.gdb_version { Some(version) => { - println!("NOTE: compiletest thinks it is using GDB version {}", version); + eprintln!("NOTE: compiletest thinks it is using GDB version {}", version); if version > extract_gdb_version("7.4").unwrap() { // Add the directory containing the pretty printers to @@ -297,7 +297,7 @@ impl TestCx<'_> { } } _ => { - println!( + eprintln!( "NOTE: compiletest does not know which version of \ GDB it is using" ); @@ -392,10 +392,10 @@ impl TestCx<'_> { match self.config.lldb_version { Some(ref version) => { - println!("NOTE: compiletest thinks it is using LLDB version {}", version); + eprintln!("NOTE: compiletest thinks it is using LLDB version {}", version); } _ => { - println!( + eprintln!( "NOTE: compiletest does not know which version of \ LLDB it is using" ); diff --git a/src/tools/compiletest/src/runtest/incremental.rs b/src/tools/compiletest/src/runtest/incremental.rs index 591aff0defe..4f26786129b 100644 --- a/src/tools/compiletest/src/runtest/incremental.rs +++ b/src/tools/compiletest/src/runtest/incremental.rs @@ -30,7 +30,7 @@ impl TestCx<'_> { assert!(incremental_dir.exists(), "init_incremental_test failed to create incremental dir"); if self.config.verbose { - print!("revision={:?} props={:#?}", revision, self.props); + eprint!("revision={:?} props={:#?}", revision, self.props); } if revision.starts_with("cpass") { diff --git a/src/tools/compiletest/src/runtest/mir_opt.rs b/src/tools/compiletest/src/runtest/mir_opt.rs index d1ec0035744..64a2addaa28 100644 --- a/src/tools/compiletest/src/runtest/mir_opt.rs +++ b/src/tools/compiletest/src/runtest/mir_opt.rs @@ -89,7 +89,7 @@ impl TestCx<'_> { } let expected_string = fs::read_to_string(&expected_file).unwrap(); if dumped_string != expected_string { - print!("{}", write_diff(&expected_string, &dumped_string, 3)); + eprint!("{}", write_diff(&expected_string, &dumped_string, 3)); panic!( "Actual MIR output differs from expected MIR output {}", expected_file.display() diff --git a/src/tools/compiletest/src/runtest/rustdoc_json.rs b/src/tools/compiletest/src/runtest/rustdoc_json.rs index 31fdb0a5d13..84376d346af 100644 --- a/src/tools/compiletest/src/runtest/rustdoc_json.rs +++ b/src/tools/compiletest/src/runtest/rustdoc_json.rs @@ -29,7 +29,7 @@ impl TestCx<'_> { if !res.status.success() { self.fatal_proc_rec_with_ctx("jsondocck failed!", &res, |_| { - println!("Rustdoc Output:"); + eprintln!("Rustdoc Output:"); proc_res.print_info(); }) } diff --git a/src/tools/compiletest/src/runtest/ui.rs b/src/tools/compiletest/src/runtest/ui.rs index 172b1e32aad..bc860bf18c7 100644 --- a/src/tools/compiletest/src/runtest/ui.rs +++ b/src/tools/compiletest/src/runtest/ui.rs @@ -109,10 +109,10 @@ impl TestCx<'_> { } if errors > 0 { - println!("To update references, rerun the tests and pass the `--bless` flag"); + eprintln!("To update references, rerun the tests and pass the `--bless` flag"); let relative_path_to_file = self.testpaths.relative_dir.join(self.testpaths.file.file_name().unwrap()); - println!( + eprintln!( "To only update this specific test, also pass `--test-args {}`", relative_path_to_file.display(), ); diff --git a/src/tools/compiletest/src/util.rs b/src/tools/compiletest/src/util.rs index bff02f1db9f..7b50e62c29b 100644 --- a/src/tools/compiletest/src/util.rs +++ b/src/tools/compiletest/src/util.rs @@ -30,7 +30,7 @@ fn path_div() -> &'static str { pub fn logv(config: &Config, s: String) { debug!("{}", s); if config.verbose { - println!("{}", s); + eprintln!("{}", s); } } diff --git a/src/tools/jsondocck/src/cache.rs b/src/tools/jsondocck/src/cache.rs index 9f95f9fb408..47512039740 100644 --- a/src/tools/jsondocck/src/cache.rs +++ b/src/tools/jsondocck/src/cache.rs @@ -28,7 +28,8 @@ impl Cache { } } - pub fn value(&self) -> &Value { - &self.value + // FIXME: Make this failible, so jsonpath syntax error has line number. + pub fn select(&self, path: &str) -> Vec<&Value> { + jsonpath_lib::select(&self.value, path).unwrap() } } diff --git a/src/tools/jsondocck/src/error.rs b/src/tools/jsondocck/src/error.rs index c4cd79a64fd..0a3e085b405 100644 --- a/src/tools/jsondocck/src/error.rs +++ b/src/tools/jsondocck/src/error.rs @@ -1,29 +1,7 @@ -use std::error::Error; -use std::fmt; - use crate::Command; #[derive(Debug)] -pub enum CkError { - /// A check failed. File didn't exist or failed to match the command - FailedCheck(String, Command), - /// An error triggered by some other error - Induced(Box<dyn Error>), -} - -impl fmt::Display for CkError { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - match self { - CkError::FailedCheck(msg, cmd) => { - write!(f, "Failed check: {} on line {}", msg, cmd.lineno) - } - CkError::Induced(err) => write!(f, "Check failed: {}", err), - } - } -} - -impl<T: Error + 'static> From<T> for CkError { - fn from(err: T) -> CkError { - CkError::Induced(Box::new(err)) - } +pub struct CkError { + pub message: String, + pub command: Command, } diff --git a/src/tools/jsondocck/src/main.rs b/src/tools/jsondocck/src/main.rs index c08bbbc769a..b6a1d7dfa7a 100644 --- a/src/tools/jsondocck/src/main.rs +++ b/src/tools/jsondocck/src/main.rs @@ -1,8 +1,8 @@ use std::borrow::Cow; +use std::process::ExitCode; use std::sync::OnceLock; -use std::{env, fmt, fs}; +use std::{env, fs}; -use jsonpath_lib::select; use regex::{Regex, RegexBuilder}; use serde_json::Value; @@ -14,90 +14,134 @@ use cache::Cache; use config::parse_config; use error::CkError; -fn main() -> Result<(), String> { +fn main() -> ExitCode { let config = parse_config(env::args().collect()); let mut failed = Vec::new(); let mut cache = Cache::new(&config); - let commands = get_commands(&config.template) - .map_err(|_| format!("Jsondocck failed for {}", &config.template))?; + let Ok(commands) = get_commands(&config.template) else { + eprintln!("Jsondocck failed for {}", &config.template); + return ExitCode::FAILURE; + }; for command in commands { - if let Err(e) = check_command(command, &mut cache) { - failed.push(e); + if let Err(message) = check_command(&command, &mut cache) { + failed.push(CkError { command, message }); } } if failed.is_empty() { - Ok(()) + ExitCode::SUCCESS } else { for i in failed { - eprintln!("{}", i); + eprintln!("{}:{}, command failed", config.template, i.command.lineno); + eprintln!("{}", i.message) } - Err(format!("Jsondocck failed for {}", &config.template)) + ExitCode::FAILURE } } #[derive(Debug)] pub struct Command { - negated: bool, kind: CommandKind, - args: Vec<String>, + path: String, lineno: usize, } #[derive(Debug)] -pub enum CommandKind { - Has, - Count, - Is, - IsMany, - Set, +enum CommandKind { + /// `//@ has <path>` + /// + /// Checks the path exists. + HasPath, + + /// `//@ has <path> <value>` + /// + /// Check one thing at the path is equal to the value. + HasValue { value: String }, + + /// `//@ !has <path>` + /// + /// Checks the path doesn't exist. + HasNotPath, + + /// `//@ is <path> <value>` + /// + /// Check the path is the given value. + Is { value: String }, + + /// `//@ is <path> <value> <value>...` + /// + /// Check that the path matches to exactly every given value. + IsMany { values: Vec<String> }, + + /// `//@ !is <path> <value>` + /// + /// Check the path isn't the given value. + IsNot { value: String }, + + /// `//@ count <path> <value>` + /// + /// Check the path has the expected number of matches. + CountIs { expected: usize }, + + /// `//@ set <name> = <path>` + Set { variable: String }, } impl CommandKind { - fn validate(&self, args: &[String], lineno: usize) -> bool { - // FIXME(adotinthevoid): We should "parse, don't validate" here, so we avoid ad-hoc - // indexing in check_command. - let count = match self { - CommandKind::Has => (1..=2).contains(&args.len()), - CommandKind::IsMany => args.len() >= 2, - CommandKind::Count | CommandKind::Is => 2 == args.len(), - CommandKind::Set => 3 == args.len(), - }; + /// Returns both the kind and the path. + /// + /// Returns `None` if the command isn't from jsondocck (e.g. from compiletest). + fn parse<'a>(command_name: &str, negated: bool, args: &'a [String]) -> Option<(Self, &'a str)> { + let kind = match (command_name, negated) { + ("count", false) => { + assert_eq!(args.len(), 2); + let expected = args[1].parse().expect("invalid number for `count`"); + Self::CountIs { expected } + } - if !count { - print_err(&format!("Incorrect number of arguments to `{}`", self), lineno); - return false; - } + ("ismany", false) => { + // FIXME: Make this >= 3, and migrate len(values)==1 cases to @is + assert!(args.len() >= 2, "Not enough args to `ismany`"); + let values = args[1..].to_owned(); + Self::IsMany { values } + } - if let CommandKind::Count = self { - if args[1].parse::<usize>().is_err() { - print_err( - &format!( - "Second argument to `count` must be a valid usize (got `{}`)", - args[1] - ), - lineno, - ); - return false; + ("is", false) => { + assert_eq!(args.len(), 2); + Self::Is { value: args[1].clone() } + } + ("is", true) => { + assert_eq!(args.len(), 2); + Self::IsNot { value: args[1].clone() } } - } - true - } -} + ("set", false) => { + assert_eq!(args.len(), 3); + assert_eq!(args[1], "="); + return Some((Self::Set { variable: args[0].clone() }, &args[2])); + } -impl fmt::Display for CommandKind { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - let text = match self { - CommandKind::Has => "has", - CommandKind::IsMany => "ismany", - CommandKind::Count => "count", - CommandKind::Is => "is", - CommandKind::Set => "set", + ("has", false) => match args { + [_path] => Self::HasPath, + [_path, value] => Self::HasValue { value: value.clone() }, + _ => panic!("`//@ has` must have 2 or 3 arguments, but got {args:?}"), + }, + ("has", true) => { + assert_eq!(args.len(), 1, "args={args:?}"); + Self::HasNotPath + } + + (_, false) if KNOWN_DIRECTIVE_NAMES.contains(&command_name) => { + return None; + } + _ => { + panic!("Invalid command `//@ {}{command_name}`", if negated { "!" } else { "" }) + } }; - write!(f, "{}", text) + + Some((kind, &args[0])) } } @@ -125,8 +169,7 @@ fn print_err(msg: &str, lineno: usize) { // See <https://github.com/rust-lang/rust/issues/125813#issuecomment-2141953780>. include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../compiletest/src/directive-list.rs")); -/// Get a list of commands from a file. Does the work of ensuring the commands -/// are syntactically valid. +/// Get a list of commands from a file. fn get_commands(template: &str) -> Result<Vec<Command>, ()> { let mut commands = Vec::new(); let mut errors = false; @@ -142,217 +185,102 @@ fn get_commands(template: &str) -> Result<Vec<Command>, ()> { let negated = cap.name("negated").unwrap().as_str() == "!"; - let cmd = match cap.name("cmd").unwrap().as_str() { - "has" => CommandKind::Has, - "count" => CommandKind::Count, - "is" => CommandKind::Is, - "ismany" => CommandKind::IsMany, - "set" => CommandKind::Set, - // FIXME: See the comment above the `include!(...)`. - cmd if KNOWN_DIRECTIVE_NAMES.contains(&cmd) => continue, - cmd => { - print_err(&format!("Unrecognized command name `{cmd}`"), lineno); - errors = true; - continue; - } - }; - - let args = cap.name("args").map_or(Some(vec![]), |m| shlex::split(m.as_str())); - - let args = match args { + let args_str = &cap["args"]; + let args = match shlex::split(args_str) { Some(args) => args, None => { - print_err( - &format!( - "Invalid arguments to shlex::split: `{}`", - cap.name("args").unwrap().as_str() - ), - lineno, - ); + print_err(&format!("Invalid arguments to shlex::split: `{args_str}`",), lineno); errors = true; continue; } }; - if !cmd.validate(&args, lineno) { - errors = true; - continue; + if let Some((kind, path)) = CommandKind::parse(&cap["cmd"], negated, &args) { + commands.push(Command { kind, lineno, path: path.to_owned() }) } - - commands.push(Command { negated, kind: cmd, args, lineno }) } if !errors { Ok(commands) } else { Err(()) } } -/// Performs the actual work of ensuring a command passes. Generally assumes the command -/// is syntactically valid. -fn check_command(command: Command, cache: &mut Cache) -> Result<(), CkError> { - // FIXME: Be more granular about why, (e.g. syntax error, count not equal) - let result = match command.kind { - CommandKind::Has => { - match command.args.len() { - // `has <jsonpath>`: Check that `jsonpath` exists. - 1 => { - let val = cache.value(); - let results = select(val, &command.args[0]).unwrap(); - !results.is_empty() - } - // `has <jsonpath> <value>`: Check *any* item matched by `jsonpath` equals `value`. - 2 => { - let val = cache.value().clone(); - let results = select(&val, &command.args[0]).unwrap(); - let pat = string_to_value(&command.args[1], cache); - let has = results.contains(&pat.as_ref()); - // Give better error for when `has` check fails. - if !command.negated && !has { - return Err(CkError::FailedCheck( - format!( - "{} matched to {:?} but didn't have {:?}", - &command.args[0], - results, - pat.as_ref() - ), - command, - )); - } else { - has - } - } - _ => unreachable!(), +/// Performs the actual work of ensuring a command passes. +fn check_command(command: &Command, cache: &mut Cache) -> Result<(), String> { + let matches = cache.select(&command.path); + match &command.kind { + CommandKind::HasPath => { + if matches.is_empty() { + return Err("matched to no values".to_owned()); + } + } + CommandKind::HasNotPath => { + if !matches.is_empty() { + return Err(format!("matched to {matches:?}, but wanted no matches")); + } + } + CommandKind::HasValue { value } => { + let want_value = string_to_value(value, cache); + if !matches.contains(&want_value.as_ref()) { + return Err(format!("matched to {matches:?}, which didn't contain {want_value:?}")); + } + } + CommandKind::Is { value } => { + let want_value = string_to_value(value, cache); + let matched = get_one(&matches)?; + if matched != want_value.as_ref() { + return Err(format!("matched to {matched:?} but want {want_value:?}")); + } + } + CommandKind::IsNot { value } => { + let wantnt_value = string_to_value(value, cache); + let matched = get_one(&matches)?; + if matched == wantnt_value.as_ref() { + return Err(format!("got value {wantnt_value:?}, but want anything else")); } } - // `ismany <path> <jsonpath> <value...>` - CommandKind::IsMany => { - assert!(!command.negated, "`ismany` may not be negated"); - let (query, values) = if let [query, values @ ..] = &command.args[..] { - (query, values) - } else { - unreachable!("Checked in CommandKind::validate") - }; - let val = cache.value(); - let got_values = select(val, &query).unwrap(); + CommandKind::IsMany { values } => { // Serde json doesn't implement Ord or Hash for Value, so we must // use a Vec here. While in theory that makes setwize equality // O(n^2), in practice n will never be large enough to matter. let expected_values = values.iter().map(|v| string_to_value(v, cache)).collect::<Vec<_>>(); - if expected_values.len() != got_values.len() { - return Err(CkError::FailedCheck( - format!( - "Expected {} values, but `{}` matched to {} values ({:?})", - expected_values.len(), - query, - got_values.len(), - got_values - ), - command, + if expected_values.len() != matches.len() { + return Err(format!( + "Expected {} values, but matched to {} values ({:?})", + expected_values.len(), + matches.len(), + matches )); }; - for got_value in got_values { + for got_value in matches { if !expected_values.iter().any(|exp| &**exp == got_value) { - return Err(CkError::FailedCheck( - format!("`{}` has match {:?}, which was not expected", query, got_value), - command, - )); + return Err(format!("has match {got_value:?}, which was not expected",)); } } - true - } - // `count <jsonpath> <count>`: Check that `jsonpath` matches exactly `count` times. - CommandKind::Count => { - assert_eq!(command.args.len(), 2); - let expected: usize = command.args[1].parse().unwrap(); - let val = cache.value(); - let results = select(val, &command.args[0]).unwrap(); - let eq = results.len() == expected; - if !command.negated && !eq { - return Err(CkError::FailedCheck( - format!( - "`{}` matched to `{:?}` with length {}, but expected length {}", - &command.args[0], - results, - results.len(), - expected - ), - command, - )); - } else { - eq - } } - // `has <jsonpath> <value>`: Check` *exactly one* item matched by `jsonpath`, and it equals `value`. - CommandKind::Is => { - assert_eq!(command.args.len(), 2); - let val = cache.value().clone(); - let results = select(&val, &command.args[0]).unwrap(); - let pat = string_to_value(&command.args[1], cache); - let is = results.len() == 1 && results[0] == pat.as_ref(); - if !command.negated && !is { - return Err(CkError::FailedCheck( - format!( - "{} matched to {:?}, but expected {:?}", - &command.args[0], - results, - pat.as_ref() - ), - command, + CommandKind::CountIs { expected } => { + if *expected != matches.len() { + return Err(format!( + "matched to `{matches:?}` with length {}, but expected length {expected}", + matches.len(), )); - } else { - is } } - // `set <name> = <jsonpath>` - CommandKind::Set => { - assert!(!command.negated, "`set` may not be negated"); - assert_eq!(command.args.len(), 3); - assert_eq!(command.args[1], "=", "Expected an `=`"); - let val = cache.value().clone(); - let results = select(&val, &command.args[2]).unwrap(); - assert_eq!( - results.len(), - 1, - "Expected 1 match for `{}` (because of `set`): matched to {:?}", - command.args[2], - results - ); - match results.len() { - 0 => false, - 1 => { - let r = cache.variables.insert(command.args[0].clone(), results[0].clone()); - assert!(r.is_none(), "Name collision: {} is duplicated", command.args[0]); - true - } - _ => { - panic!( - "Got multiple results in `set` for `{}`: {:?}", - &command.args[2], results, - ); - } - } + CommandKind::Set { variable } => { + let value = get_one(&matches)?; + let r = cache.variables.insert(variable.to_owned(), value.clone()); + assert!(r.is_none(), "name collision: {variable:?} is duplicated"); } - }; + } - if result == command.negated { - if command.negated { - Err(CkError::FailedCheck( - format!("`!{} {}` matched when it shouldn't", command.kind, command.args.join(" ")), - command, - )) - } else { - // FIXME: In the future, try 'peeling back' each step, and see at what level the match failed - Err(CkError::FailedCheck( - format!( - "`{} {}` didn't match when it should", - command.kind, - command.args.join(" ") - ), - command, - )) - } - } else { - Ok(()) + Ok(()) +} + +fn get_one<'a>(matches: &[&'a Value]) -> Result<&'a Value, String> { + match matches { + [] => Err("matched to no values".to_owned()), + [matched] => Ok(matched), + _ => Err(format!("matched to multiple values {matches:?}, but want exactly 1")), } } diff --git a/src/tools/miri/src/shims/backtrace.rs b/src/tools/miri/src/shims/backtrace.rs index 64bd546458d..c7b399228bf 100644 --- a/src/tools/miri/src/shims/backtrace.rs +++ b/src/tools/miri/src/shims/backtrace.rs @@ -1,5 +1,4 @@ use rustc_abi::{ExternAbi, Size}; -use rustc_ast::ast::Mutability; use rustc_middle::ty::layout::LayoutOf as _; use rustc_middle::ty::{self, Instance, Ty}; use rustc_span::{BytePos, Loc, Symbol, hygiene}; @@ -179,14 +178,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { match flags { 0 => { - // These are "mutable" allocations as we consider them to be owned by the callee. - let name_alloc = - this.allocate_str(&name, MiriMemoryKind::Rust.into(), Mutability::Mut)?; - let filename_alloc = - this.allocate_str(&filename, MiriMemoryKind::Rust.into(), Mutability::Mut)?; - - this.write_immediate(name_alloc.to_ref(this), &this.project_field(dest, 0)?)?; - this.write_immediate(filename_alloc.to_ref(this), &this.project_field(dest, 1)?)?; + throw_unsup_format!("miri_resolve_frame: v0 is not supported any more"); } 1 => { this.write_scalar( diff --git a/src/tools/miri/src/shims/panic.rs b/src/tools/miri/src/shims/panic.rs index 722c3a2f0c5..93479540009 100644 --- a/src/tools/miri/src/shims/panic.rs +++ b/src/tools/miri/src/shims/panic.rs @@ -12,7 +12,6 @@ //! metadata we remembered when pushing said frame. use rustc_abi::ExternAbi; -use rustc_ast::Mutability; use rustc_middle::{mir, ty}; use rustc_target::spec::PanicStrategy; @@ -161,7 +160,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { let this = self.eval_context_mut(); // First arg: message. - let msg = this.allocate_str(msg, MiriMemoryKind::Machine.into(), Mutability::Not)?; + let msg = this.allocate_str_dedup(msg)?; // Call the lang item. let panic = this.tcx.lang_items().panic_fn().unwrap(); @@ -180,7 +179,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { let this = self.eval_context_mut(); // First arg: message. - let msg = this.allocate_str(msg, MiriMemoryKind::Machine.into(), Mutability::Not)?; + let msg = this.allocate_str_dedup(msg)?; // Call the lang item. let panic = this.tcx.lang_items().panic_nounwind().unwrap(); diff --git a/src/tools/miri/tests/pass/backtrace/backtrace-api-v0.rs b/src/tools/miri/tests/pass/backtrace/backtrace-api-v0.rs deleted file mode 100644 index 3fff7921aff..00000000000 --- a/src/tools/miri/tests/pass/backtrace/backtrace-api-v0.rs +++ /dev/null @@ -1,69 +0,0 @@ -//@normalize-stderr-test: "::<.*>" -> "" - -#[inline(never)] -fn func_a() -> Box<[*mut ()]> { - func_b::<u8>() -} -#[inline(never)] -fn func_b<T>() -> Box<[*mut ()]> { - func_c() -} - -macro_rules! invoke_func_d { - () => { - func_d() - }; -} - -#[inline(never)] -fn func_c() -> Box<[*mut ()]> { - invoke_func_d!() -} -#[inline(never)] -fn func_d() -> Box<[*mut ()]> { - unsafe { miri_get_backtrace(0) } -} - -fn main() { - let mut seen_main = false; - let frames = func_a(); - for frame in frames.iter() { - let miri_frame = unsafe { miri_resolve_frame(*frame, 0) }; - let name = String::from_utf8(miri_frame.name.into()).unwrap(); - let filename = String::from_utf8(miri_frame.filename.into()).unwrap(); - - if name == "func_a" { - assert_eq!(func_a as *mut (), miri_frame.fn_ptr); - } - - // Print every frame to stderr. - let out = format!("{}:{}:{} ({})", filename, miri_frame.lineno, miri_frame.colno, name); - eprintln!("{}", out); - // Print the 'main' frame (and everything before it) to stdout, skipping - // the printing of internal (and possibly fragile) libstd frames. - // Stdout is less normalized so we see more, but it also means we can print less - // as platform differences would lead to test suite failures. - if !seen_main { - println!("{}", out); - seen_main = name == "main"; - } - } -} - -// This goes at the bottom of the file so that we can change it -// without disturbing line numbers of the functions in the backtrace. - -extern "Rust" { - fn miri_get_backtrace(flags: u64) -> Box<[*mut ()]>; - fn miri_resolve_frame(ptr: *mut (), flags: u64) -> MiriFrame; -} - -#[derive(Debug)] -#[repr(C)] -struct MiriFrame { - name: Box<[u8]>, - filename: Box<[u8]>, - lineno: u32, - colno: u32, - fn_ptr: *mut (), -} diff --git a/src/tools/miri/tests/pass/backtrace/backtrace-api-v0.stderr b/src/tools/miri/tests/pass/backtrace/backtrace-api-v0.stderr deleted file mode 100644 index 9849a1aa74e..00000000000 --- a/src/tools/miri/tests/pass/backtrace/backtrace-api-v0.stderr +++ /dev/null @@ -1,18 +0,0 @@ -tests/pass/backtrace/backtrace-api-v0.rs:LL:CC (func_d) -tests/pass/backtrace/backtrace-api-v0.rs:LL:CC (func_c) -tests/pass/backtrace/backtrace-api-v0.rs:LL:CC (func_b) -tests/pass/backtrace/backtrace-api-v0.rs:LL:CC (func_a) -tests/pass/backtrace/backtrace-api-v0.rs:LL:CC (main) -RUSTLIB/core/src/ops/function.rs:LL:CC (<fn() as std::ops::FnOnce<()>>::call_once - shim(fn())) -RUSTLIB/std/src/sys/backtrace.rs:LL:CC (std::sys::backtrace::__rust_begin_short_backtrace) -RUSTLIB/std/src/rt.rs:LL:CC (std::rt::lang_start::{closure#0}) -RUSTLIB/core/src/ops/function.rs:LL:CC (std::ops::function::impls::call_once) -RUSTLIB/std/src/panicking.rs:LL:CC (std::panicking::r#try::do_call) -RUSTLIB/std/src/panicking.rs:LL:CC (std::panicking::r#try) -RUSTLIB/std/src/panic.rs:LL:CC (std::panic::catch_unwind) -RUSTLIB/std/src/rt.rs:LL:CC (std::rt::lang_start_internal::{closure#1}) -RUSTLIB/std/src/panicking.rs:LL:CC (std::panicking::r#try::do_call) -RUSTLIB/std/src/panicking.rs:LL:CC (std::panicking::r#try) -RUSTLIB/std/src/panic.rs:LL:CC (std::panic::catch_unwind) -RUSTLIB/std/src/rt.rs:LL:CC (std::rt::lang_start_internal) -RUSTLIB/std/src/rt.rs:LL:CC (std::rt::lang_start) diff --git a/src/tools/miri/tests/pass/backtrace/backtrace-api-v0.stdout b/src/tools/miri/tests/pass/backtrace/backtrace-api-v0.stdout deleted file mode 100644 index 8c1bc5c353e..00000000000 --- a/src/tools/miri/tests/pass/backtrace/backtrace-api-v0.stdout +++ /dev/null @@ -1,5 +0,0 @@ -tests/pass/backtrace/backtrace-api-v0.rs:24:14 (func_d) -tests/pass/backtrace/backtrace-api-v0.rs:14:9 (func_c) -tests/pass/backtrace/backtrace-api-v0.rs:9:5 (func_b::<u8>) -tests/pass/backtrace/backtrace-api-v0.rs:5:5 (func_a) -tests/pass/backtrace/backtrace-api-v0.rs:29:18 (main) diff --git a/src/tools/nix-dev-shell/envrc-flake b/src/tools/nix-dev-shell/envrc-flake index 9def420f05c..849ed1f4fc5 100644 --- a/src/tools/nix-dev-shell/envrc-flake +++ b/src/tools/nix-dev-shell/envrc-flake @@ -1,7 +1,7 @@ # If you want to use this as an .envrc file to create a shell with necessery components # to develop rustc, use the following command in the root of the rusr checkout: # -# ln -s ./src/tools/nix-dev-shell/envrc-flake ./.envrc && nix flake update --flake ./src/tools/nix-dev-shell && echo .envrc >> .git/info/exclude +# ln -s ./src/tools/nix-dev-shell/envrc-flake ./.envrc && nix flake update --flake ./src/tools/nix-dev-shell if nix flake show path:./src/tools/nix-dev-shell &> /dev/null; then use flake path:./src/tools/nix-dev-shell diff --git a/src/tools/nix-dev-shell/envrc-shell b/src/tools/nix-dev-shell/envrc-shell index fb7231a6c30..d8f900fe86a 100644 --- a/src/tools/nix-dev-shell/envrc-shell +++ b/src/tools/nix-dev-shell/envrc-shell @@ -1,7 +1,7 @@ # If you want to use this as an .envrc file to create a shell with necessery components # to develop rustc, use the following command in the root of the rusr checkout: # -# ln -s ./src/tools/nix-dev-shell/envrc-shell ./.envrc && echo .envrc >> .git/info/exclude +# ln -s ./src/tools/nix-dev-shell/envrc-shell ./.envrc use nix ./src/tools/nix-dev-shell/shell.nix diff --git a/src/tools/nix-dev-shell/flake.nix b/src/tools/nix-dev-shell/flake.nix index 8ab5e097427..1b838bd2f7b 100644 --- a/src/tools/nix-dev-shell/flake.nix +++ b/src/tools/nix-dev-shell/flake.nix @@ -24,9 +24,8 @@ # Avoid creating text files for ICEs. RUSTC_ICE = "0"; # Provide `libstdc++.so.6` for the self-contained lld. - LD_LIBRARY_PATH = "${with pkgs; lib.makeLibraryPath [ - stdenv.cc.cc.lib - ]}"; + # Provide `libz.so.1`. + LD_LIBRARY_PATH = "${with pkgs; lib.makeLibraryPath [stdenv.cc.cc.lib zlib]}"; }; } ); diff --git a/src/tools/nix-dev-shell/shell.nix b/src/tools/nix-dev-shell/shell.nix index 8a5cbb7c89e..a3f5969bd81 100644 --- a/src/tools/nix-dev-shell/shell.nix +++ b/src/tools/nix-dev-shell/shell.nix @@ -13,7 +13,6 @@ pkgs.mkShell { # Avoid creating text files for ICEs. RUSTC_ICE = "0"; # Provide `libstdc++.so.6` for the self-contained lld. - LD_LIBRARY_PATH = "${with pkgs; lib.makeLibraryPath [ - stdenv.cc.cc.lib - ]}"; + # Provide `libz.so.1` + LD_LIBRARY_PATH = "${with pkgs; lib.makeLibraryPath [stdenv.cc.cc.lib zlib]}"; } diff --git a/src/tools/run-make-support/Cargo.toml b/src/tools/run-make-support/Cargo.toml index 3c172b2d956..15ed03ad5c2 100644 --- a/src/tools/run-make-support/Cargo.toml +++ b/src/tools/run-make-support/Cargo.toml @@ -7,7 +7,7 @@ edition = "2021" bstr = "1.6.0" object = "0.36.2" similar = "2.5.0" -wasmparser = { version = "0.216", default-features = false, features = ["std"] } +wasmparser = { version = "0.219", default-features = false, features = ["std"] } regex = "1.8" # 1.8 to avoid memchr 2.6.0, as 2.5.0 is pinned in the workspace gimli = "0.31.0" build_helper = { path = "../../build_helper" } diff --git a/src/tools/rustbook/Cargo.lock b/src/tools/rustbook/Cargo.lock index 024b8f9becb..e8c9c4f4cd1 100644 --- a/src/tools/rustbook/Cargo.lock +++ b/src/tools/rustbook/Cargo.lock @@ -47,9 +47,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.17" +version = "0.6.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23a1e53f0f5d86382dafe1cf314783b2044280f406e7e1506368220ad11b1338" +checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b" dependencies = [ "anstyle", "anstyle-parse", @@ -96,9 +96,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.92" +version = "1.0.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74f37166d7d48a0284b99dd824694c26119c700b53bf0d1540cdb147dbdaaf13" +checksum = "4c95c10ba0b00a02636238b814946408b1322d5ac4760326e6fb8ec956d85775" [[package]] name = "autocfg" @@ -138,9 +138,9 @@ dependencies = [ [[package]] name = "bstr" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40723b8fb387abc38f4f4a37c09073622e41dd12327033091ef8950659e6dc0c" +checksum = "1a68f1f47cdf0ec8ee4b941b2eee2a80cb796db73118c0dd09ac63fbe405be22" dependencies = [ "memchr", "regex-automata", @@ -190,9 +190,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.20" +version = "4.5.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b97f376d85a664d5837dbae44bf546e6477a679ff6610010f17276f686d867e8" +checksum = "fb3b4b9e5a7c7514dfa52869339ee98b3156b0bfb4e8a77c4ff4babb64b1604f" dependencies = [ "clap_builder", "clap_derive", @@ -200,9 +200,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.20" +version = "4.5.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19bc80abd44e4bed93ca373a0704ccbd1b710dc5749406201bb018272808dc54" +checksum = "b17a95aa67cc7b5ebd32aa5370189aa0d79069ef1c64ce893bd30fb24bff20ec" dependencies = [ "anstream", "anstyle", @@ -213,9 +213,9 @@ dependencies = [ [[package]] name = "clap_complete" -version = "4.5.36" +version = "4.5.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86bc73de94bc81e52f3bebec71bc4463e9748f7a59166663e32044669577b0e2" +checksum = "d9647a559c112175f17cf724dc72d3645680a883c58481332779192b0d8e7a01" dependencies = [ "clap", ] @@ -234,9 +234,9 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97" +checksum = "afb84c814227b90d6895e01398aee0d8033c00e7466aca416fb6a8e0eb19d8a7" [[package]] name = "colorchoice" @@ -252,9 +252,9 @@ checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "cpufeatures" -version = "0.2.14" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0" +checksum = "16b80225097f2e5ae4e7179dd2266824648f3e2f49d9134d584b76389d31c4c3" dependencies = [ "libc", ] @@ -312,6 +312,17 @@ dependencies = [ ] [[package]] +name = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] name = "doc-comment" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -360,25 +371,25 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.9" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" +checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d" dependencies = [ "libc", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] name = "fastrand" -version = "2.1.1" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" +checksum = "486f806e73c5707928240ddc295403b1b93c96a02038563881c4a2fd84b81ac4" [[package]] name = "flate2" -version = "1.0.34" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1b589b4dc103969ad3cf85c950899926ec64300a1a46d76c03a6072957036f0" +checksum = "c936bfdafb507ebbf50b8074c54fa31c5be9a1e7e5f467dd659697041407d07c" dependencies = [ "crc32fast", "miniz_oxide", @@ -456,9 +467,9 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.15.0" +version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb" +checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" [[package]] name = "heck" @@ -525,20 +536,149 @@ dependencies = [ ] [[package]] +name = "icu_collections" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locid" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_locid_transform" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01d11ac35de8e40fdeda00d9e1e9d92525f3f9d887cdd7aa81d727596788b54e" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_locid_transform_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_locid_transform_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdc8ff3388f852bede6b579ad4e978ab004f139284d7b28715f773507b946f6e" + +[[package]] +name = "icu_normalizer" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "utf16_iter", + "utf8_iter", + "write16", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8cafbf7aa791e9b22bec55a167906f9e1215fd475cd22adfcf660e03e989516" + +[[package]] +name = "icu_properties" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93d6020766cfc6302c15dbbc9c8778c37e62c14427cb7f6e601d849e092aeef5" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locid_transform", + "icu_properties_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67a8effbc3dd3e4ba1afa8ad918d5684b8868b3b26500753effea8d2eed19569" + +[[package]] +name = "icu_provider" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ed421c8a8ef78d3e2dbc98a973be2f3770cb42b606e3ab18d6237c4dfde68d9" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_provider_macros", + "stable_deref_trait", + "tinystr", + "writeable", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_provider_macros" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] name = "idna" -version = "0.5.0" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e" dependencies = [ - "unicode-bidi", - "unicode-normalization", + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daca1df1c957320b2cf139ac61e7bd64fed304c5040df000a745aa1de3b4ef71" +dependencies = [ + "icu_normalizer", + "icu_properties", ] [[package]] name = "indexmap" -version = "2.6.0" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" +checksum = "62f822373a4fe84d4bb149bf54e584a7f4abec90e072ed49cda0edea5b95471f" dependencies = [ "equivalent", "hashbrown", @@ -552,16 +692,17 @@ checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" [[package]] name = "itoa" -version = "1.0.11" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" +checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" [[package]] name = "js-sys" -version = "0.3.72" +version = "0.3.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a88f1bda2bd75b0452a14784937d796722fdebfe50df998aeb3f0b7603019a9" +checksum = "a865e038f7f6ed956f788f0d7d60c541fff74c7bd74272c5d4cf15c63743e705" dependencies = [ + "once_cell", "wasm-bindgen", ] @@ -573,9 +714,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.161" +version = "0.2.167" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9489c2807c139ffd9c1794f4af0ebe86a828db53ecdc7fea2111d0fed085d1" +checksum = "09d6582e104315a817dff97f75133544b2e094ee22447d2acf4a74e189ba06fc" [[package]] name = "libdbus-sys" @@ -603,6 +744,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" [[package]] +name = "litemap" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ee93343901ab17bd981295f2cf0026d4ad018c7c31ba84549a4ddbb47a45104" + +[[package]] name = "lock_api" version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -646,9 +793,9 @@ dependencies = [ [[package]] name = "mdbook" -version = "0.4.42" +version = "0.4.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7624879735513024d323e7267a0b3a7176aceb0db537939beb4ee31d9e8945e3" +checksum = "fe1f98b8d66e537d2f0ba06e7dec4f44001deec539a2d18bfc102d6a86189148" dependencies = [ "ammonia", "anyhow", @@ -842,9 +989,9 @@ dependencies = [ [[package]] name = "pathdiff" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d61c5ce1153ab5b689d0c074c4e7fc613e942dfb7dd9eea5ab202d2ad91fe361" +checksum = "df94ce210e5bc13cb6651479fa48d14f601d9858cfe0467f43ae157023b938d3" [[package]] name = "percent-encoding" @@ -986,9 +1133,9 @@ checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" [[package]] name = "proc-macro2" -version = "1.0.89" +version = "1.0.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e" +checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" dependencies = [ "unicode-ident", ] @@ -1122,9 +1269,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.8" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "368758f23274712b504848e9d5a6f010445cc8b87a7cdb4d7cbee666c1288da3" +checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" dependencies = [ "aho-corasick", "memchr", @@ -1151,9 +1298,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.38" +version = "0.38.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa260229e6538e52293eeb577aabd09945a09d6d9cc0fc550ed7529056c2e32a" +checksum = "d7f649912bc1495e167a6edee79151c84b1bad49748cb4f1f1167f459f6224f6" dependencies = [ "bitflags 2.6.0", "errno", @@ -1191,18 +1338,18 @@ checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" [[package]] name = "serde" -version = "1.0.214" +version = "1.0.215" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f55c3193aca71c12ad7890f1785d2b73e1b9f63a0bbc353c08ef26fe03fc56b5" +checksum = "6513c1ad0b11a9376da888e3e0baa0077f1aed55c17f50e7b2397136129fb88f" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.214" +version = "1.0.215" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de523f781f095e28fa605cdce0f8307e451cc0fd14e2eb4cd2e98a355b147766" +checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0" dependencies = [ "proc-macro2", "quote", @@ -1211,9 +1358,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.132" +version = "1.0.133" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d726bfaff4b320266d395898905d0eba0345aae23b54aee3a737e260fd46db03" +checksum = "c7fceb2473b9166b2294ef05efcb65a3db80803f0b03ef86a5fc88a2b85ee377" dependencies = [ "itoa", "memchr", @@ -1260,6 +1407,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + +[[package]] name = "string_cache" version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1293,9 +1446,9 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "syn" -version = "2.0.87" +version = "2.0.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d" +checksum = "919d3b74a5dd0ccd15aeb8f93e7006bd9e14c295087c9896a110f490752bcf31" dependencies = [ "proc-macro2", "quote", @@ -1303,6 +1456,17 @@ dependencies = [ ] [[package]] +name = "synstructure" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] name = "syntect" version = "5.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1324,9 +1488,9 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.13.0" +version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0f2c9fc62d0beef6951ccffd757e241266a2c833136efbe35af6cd2567dca5b" +checksum = "28cce251fcbc87fac86a866eeb0d6c2d536fc16d06f184bb61aeae11aa4cee0c" dependencies = [ "cfg-if", "fastrand", @@ -1348,9 +1512,9 @@ dependencies = [ [[package]] name = "terminal_size" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f599bd7ca042cfdf8f4512b277c02ba102247820f9d9d4a9f521f496751a6ef" +checksum = "5352447f921fda68cf61b4101566c0bdb5104eff6804d0678e5227580ab6a4e9" dependencies = [ "rustix", "windows-sys 0.59.0", @@ -1364,18 +1528,18 @@ checksum = "23d434d3f8967a09480fb04132ebe0a3e088c173e6d0ee7897abbdf4eab0f8b9" [[package]] name = "thiserror" -version = "1.0.66" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d171f59dbaa811dbbb1aee1e73db92ec2b122911a48e1390dfe327a821ddede" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.66" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b08be0f17bd307950653ce45db00cd31200d82b624b36e181337d9c7d92765b5" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", @@ -1383,21 +1547,16 @@ dependencies = [ ] [[package]] -name = "tinyvec" -version = "1.8.0" +name = "tinystr" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938" +checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" dependencies = [ - "tinyvec_macros", + "displaydoc", + "zerovec", ] [[package]] -name = "tinyvec_macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" - -[[package]] name = "toml" version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1465,25 +1624,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7e51b68083f157f853b6379db119d1c1be0e6e4dec98101079dec41f6f5cf6df" [[package]] -name = "unicode-bidi" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ab17db44d7388991a428b2ee655ce0c212e862eff1768a455c58f9aad6e7893" - -[[package]] name = "unicode-ident" -version = "1.0.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" - -[[package]] -name = "unicode-normalization" -version = "0.1.24" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956" -dependencies = [ - "tinyvec", -] +checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" [[package]] name = "unicode-width" @@ -1493,9 +1637,9 @@ checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" [[package]] name = "url" -version = "2.5.2" +version = "2.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" +checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60" dependencies = [ "form_urlencoded", "idna", @@ -1509,6 +1653,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" [[package]] +name = "utf16_iter" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + +[[package]] name = "utf8parse" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1538,9 +1694,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.95" +version = "0.2.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e" +checksum = "d15e63b4482863c109d70a7b8706c1e364eb6ea449b201a76c5b89cedcec2d5c" dependencies = [ "cfg-if", "once_cell", @@ -1549,9 +1705,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.95" +version = "0.2.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358" +checksum = "8d36ef12e3aaca16ddd3f67922bc63e48e953f126de60bd33ccc0101ef9998cd" dependencies = [ "bumpalo", "log", @@ -1564,9 +1720,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.95" +version = "0.2.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56" +checksum = "705440e08b42d3e4b36de7d66c944be628d579796b8090bfa3471478a2260051" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -1574,9 +1730,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.95" +version = "0.2.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" +checksum = "98c9ae5a76e46f4deecd0f0255cc223cfa18dc9b261213b8aa0c7b36f61b3f1d" dependencies = [ "proc-macro2", "quote", @@ -1587,9 +1743,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.95" +version = "0.2.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" +checksum = "6ee99da9c5ba11bd675621338ef6fa52296b76b83305e9b6e5c77d4c286d6d49" [[package]] name = "winapi" @@ -1723,6 +1879,42 @@ dependencies = [ ] [[package]] +name = "write16" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" + +[[package]] +name = "writeable" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" + +[[package]] +name = "yoke" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "120e6aef9aa629e3d4f52dc8cc43a015c7724194c97dfaf45180d2daf2b77f40" +dependencies = [ + "serde", + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] name = "zerocopy" version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1742,3 +1934,46 @@ dependencies = [ "quote", "syn", ] + +[[package]] +name = "zerofrom" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cff3ee08c995dee1859d998dea82f7374f2826091dd9cd47def953cae446cd2e" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "595eed982f7d355beb85837f651fa22e90b3c044842dc7f2c2842c086f295808" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zerovec" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa2b893d79df23bfb12d5461018d408ea19dfafe76c2c7ef6d4eba614f8ff079" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] diff --git a/src/tools/tidy/src/deps.rs b/src/tools/tidy/src/deps.rs index 7d3287aaeb9..beeb33b46ff 100644 --- a/src/tools/tidy/src/deps.rs +++ b/src/tools/tidy/src/deps.rs @@ -12,7 +12,8 @@ use cargo_metadata::{Metadata, Package, PackageId}; #[rustfmt::skip] const LICENSES: &[&str] = &[ // tidy-alphabetical-start - "(MIT OR Apache-2.0) AND Unicode-DFS-2016", // unicode_ident + "(MIT OR Apache-2.0) AND Unicode-3.0", // unicode_ident (1.0.14) + "(MIT OR Apache-2.0) AND Unicode-DFS-2016", // unicode_ident (1.0.12) "0BSD OR MIT OR Apache-2.0", // adler license "0BSD", "Apache-2.0 / MIT", @@ -94,7 +95,6 @@ const EXCEPTIONS: ExceptionList = &[ ("dissimilar", "Apache-2.0"), // rustdoc, rustc_lexer (few tests) via expect-test, (dev deps) ("fluent-langneg", "Apache-2.0"), // rustc (fluent translations) ("foldhash", "Zlib"), // rustc - ("instant", "BSD-3-Clause"), // rustc_driver/tracing-subscriber/parking_lot ("mdbook", "MPL-2.0"), // mdbook ("option-ext", "MPL-2.0"), // cargo-miri (via `directories`) ("rustc_apfloat", "Apache-2.0 WITH LLVM-exception"), // rustc (license is the same as LLVM uses) diff --git a/src/tools/tidy/src/issues.txt b/src/tools/tidy/src/issues.txt index 3a021e189f3..25cd32063aa 100644 --- a/src/tools/tidy/src/issues.txt +++ b/src/tools/tidy/src/issues.txt @@ -2295,8 +2295,6 @@ ui/issues/issue-43853.rs ui/issues/issue-4387.rs ui/issues/issue-43910.rs ui/issues/issue-43923.rs -ui/issues/issue-43925.rs -ui/issues/issue-43926.rs ui/issues/issue-43988.rs ui/issues/issue-44023.rs ui/issues/issue-44056.rs @@ -2545,8 +2543,6 @@ ui/issues/issue-6936.rs ui/issues/issue-69455.rs ui/issues/issue-69602-type-err-during-codegen-ice.rs ui/issues/issue-69683.rs -ui/issues/issue-70093/issue-70093-link-directives.rs -ui/issues/issue-70093/issue-70093.rs ui/issues/issue-7012.rs ui/issues/issue-70381.rs ui/issues/issue-7044.rs @@ -2711,11 +2707,15 @@ ui/limits/issue-17913.rs ui/limits/issue-55878.rs ui/limits/issue-69485-var-size-diffs-too-large.rs ui/limits/issue-75158-64.rs +ui/link-native-libs/issue-109144.rs +ui/link-native-libs/issue-43925.rs +ui/link-native-libs/issue-43926.rs +ui/link-native-libs/issue-70093/issue-70093-link-directives.rs +ui/link-native-libs/issue-70093/issue-70093.rs ui/linkage-attr/auxiliary/issue-12133-dylib.rs ui/linkage-attr/auxiliary/issue-12133-dylib2.rs ui/linkage-attr/auxiliary/issue-12133-rlib.rs ui/linkage-attr/issue-10755.rs -ui/linkage-attr/issue-109144.rs ui/linkage-attr/issue-12133-1.rs ui/linkage-attr/issue-12133-2.rs ui/linkage-attr/issue-12133-3.rs diff --git a/src/tools/tidy/src/ui_tests.rs b/src/tools/tidy/src/ui_tests.rs index 11f9d5bb03d..401169c838f 100644 --- a/src/tools/tidy/src/ui_tests.rs +++ b/src/tools/tidy/src/ui_tests.rs @@ -17,7 +17,7 @@ use ignore::Walk; const ENTRY_LIMIT: u32 = 901; // FIXME: The following limits should be reduced eventually. -const ISSUES_ENTRY_LIMIT: u32 = 1672; +const ISSUES_ENTRY_LIMIT: u32 = 1667; const EXPECTED_TEST_FILE_EXTENSIONS: &[&str] = &[ "rs", // test source files diff --git a/tests/coverage/branch/guard.cov-map b/tests/coverage/branch/guard.cov-map index 1ba1c6e1228..7ca499bd847 100644 --- a/tests/coverage/branch/guard.cov-map +++ b/tests/coverage/branch/guard.cov-map @@ -1,35 +1,37 @@ Function name: guard::branch_match_guard -Raw bytes (85): 0x[01, 01, 06, 19, 0d, 05, 09, 0f, 15, 13, 11, 17, 0d, 05, 09, 0d, 01, 0c, 01, 01, 10, 02, 03, 0b, 00, 0c, 15, 01, 14, 02, 0a, 0d, 03, 0e, 00, 0f, 19, 00, 14, 00, 19, 20, 0d, 02, 00, 14, 00, 1e, 0d, 00, 1d, 02, 0a, 11, 03, 0e, 00, 0f, 02, 00, 14, 00, 19, 20, 11, 05, 00, 14, 00, 1e, 11, 00, 1d, 02, 0a, 17, 03, 0e, 02, 0a, 0b, 04, 01, 00, 02] +Raw bytes (89): 0x[01, 01, 08, 05, 0d, 05, 17, 0d, 11, 1f, 17, 05, 09, 0d, 11, 1f, 15, 05, 09, 0d, 01, 0c, 01, 01, 10, 02, 03, 0b, 00, 0c, 15, 01, 14, 02, 0a, 0d, 03, 0e, 00, 0f, 05, 00, 14, 00, 19, 20, 0d, 02, 00, 14, 00, 1e, 0d, 00, 1d, 02, 0a, 11, 03, 0e, 00, 0f, 02, 00, 14, 00, 19, 20, 11, 06, 00, 14, 00, 1e, 11, 00, 1d, 02, 0a, 0e, 03, 0e, 02, 0a, 1b, 04, 01, 00, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 6 -- expression 0 operands: lhs = Counter(6), rhs = Counter(3) -- expression 1 operands: lhs = Counter(1), rhs = Counter(2) -- expression 2 operands: lhs = Expression(3, Add), rhs = Counter(5) -- expression 3 operands: lhs = Expression(4, Add), rhs = Counter(4) -- expression 4 operands: lhs = Expression(5, Add), rhs = Counter(3) -- expression 5 operands: lhs = Counter(1), rhs = Counter(2) +Number of expressions: 8 +- expression 0 operands: lhs = Counter(1), rhs = Counter(3) +- expression 1 operands: lhs = Counter(1), rhs = Expression(5, Add) +- expression 2 operands: lhs = Counter(3), rhs = Counter(4) +- expression 3 operands: lhs = Expression(7, Add), rhs = Expression(5, Add) +- expression 4 operands: lhs = Counter(1), rhs = Counter(2) +- expression 5 operands: lhs = Counter(3), rhs = Counter(4) +- expression 6 operands: lhs = Expression(7, Add), rhs = Counter(5) +- expression 7 operands: lhs = Counter(1), rhs = Counter(2) Number of file 0 mappings: 13 - Code(Counter(0)) at (prev + 12, 1) to (start + 1, 16) - Code(Expression(0, Sub)) at (prev + 3, 11) to (start + 0, 12) - = (c6 - c3) + = (c1 - c3) - Code(Counter(5)) at (prev + 1, 20) to (start + 2, 10) - Code(Counter(3)) at (prev + 3, 14) to (start + 0, 15) -- Code(Counter(6)) at (prev + 0, 20) to (start + 0, 25) +- Code(Counter(1)) at (prev + 0, 20) to (start + 0, 25) - Branch { true: Counter(3), false: Expression(0, Sub) } at (prev + 0, 20) to (start + 0, 30) true = c3 - false = (c6 - c3) + false = (c1 - c3) - Code(Counter(3)) at (prev + 0, 29) to (start + 2, 10) - Code(Counter(4)) at (prev + 3, 14) to (start + 0, 15) - Code(Expression(0, Sub)) at (prev + 0, 20) to (start + 0, 25) - = (c6 - c3) -- Branch { true: Counter(4), false: Counter(1) } at (prev + 0, 20) to (start + 0, 30) + = (c1 - c3) +- Branch { true: Counter(4), false: Expression(1, Sub) } at (prev + 0, 20) to (start + 0, 30) true = c4 - false = c1 + false = (c1 - (c3 + c4)) - Code(Counter(4)) at (prev + 0, 29) to (start + 2, 10) -- Code(Expression(5, Add)) at (prev + 3, 14) to (start + 2, 10) - = (c1 + c2) -- Code(Expression(2, Add)) at (prev + 4, 1) to (start + 0, 2) - = ((((c1 + c2) + c3) + c4) + c5) -Highest counter ID seen: c6 +- Code(Expression(3, Sub)) at (prev + 3, 14) to (start + 2, 10) + = ((c1 + c2) - (c3 + c4)) +- Code(Expression(6, Add)) at (prev + 4, 1) to (start + 0, 2) + = ((c1 + c2) + c5) +Highest counter ID seen: c5 diff --git a/tests/coverage/branch/if-let.cov-map b/tests/coverage/branch/if-let.cov-map index 380765c7af4..773c5392465 100644 --- a/tests/coverage/branch/if-let.cov-map +++ b/tests/coverage/branch/if-let.cov-map @@ -19,14 +19,18 @@ Number of file 0 mappings: 7 Highest counter ID seen: c2 Function name: if_let::if_let_chain -Raw bytes (66): 0x[01, 01, 04, 01, 05, 05, 09, 0f, 0d, 05, 09, 0a, 01, 17, 01, 00, 33, 20, 02, 05, 01, 0c, 00, 13, 02, 00, 11, 00, 12, 01, 00, 16, 00, 17, 20, 0d, 09, 01, 10, 00, 17, 0d, 00, 15, 00, 16, 02, 00, 1a, 00, 1b, 0d, 01, 05, 03, 06, 0f, 03, 0c, 02, 06, 0b, 03, 05, 01, 02] +Raw bytes (74): 0x[01, 01, 08, 01, 05, 01, 1f, 05, 09, 01, 1f, 05, 09, 01, 1f, 05, 09, 05, 09, 0a, 01, 17, 01, 00, 33, 20, 02, 05, 01, 0c, 00, 13, 02, 00, 11, 00, 12, 01, 00, 16, 00, 17, 20, 16, 09, 01, 10, 00, 17, 16, 00, 15, 00, 16, 02, 00, 1a, 00, 1b, 16, 01, 05, 03, 06, 1f, 03, 0c, 02, 06, 01, 03, 05, 01, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 4 +Number of expressions: 8 - expression 0 operands: lhs = Counter(0), rhs = Counter(1) -- expression 1 operands: lhs = Counter(1), rhs = Counter(2) -- expression 2 operands: lhs = Expression(3, Add), rhs = Counter(3) -- expression 3 operands: lhs = Counter(1), rhs = Counter(2) +- expression 1 operands: lhs = Counter(0), rhs = Expression(7, Add) +- expression 2 operands: lhs = Counter(1), rhs = Counter(2) +- expression 3 operands: lhs = Counter(0), rhs = Expression(7, Add) +- expression 4 operands: lhs = Counter(1), rhs = Counter(2) +- expression 5 operands: lhs = Counter(0), rhs = Expression(7, Add) +- expression 6 operands: lhs = Counter(1), rhs = Counter(2) +- expression 7 operands: lhs = Counter(1), rhs = Counter(2) Number of file 0 mappings: 10 - Code(Counter(0)) at (prev + 23, 1) to (start + 0, 51) - Branch { true: Expression(0, Sub), false: Counter(1) } at (prev + 1, 12) to (start + 0, 19) @@ -35,16 +39,17 @@ Number of file 0 mappings: 10 - Code(Expression(0, Sub)) at (prev + 0, 17) to (start + 0, 18) = (c0 - c1) - Code(Counter(0)) at (prev + 0, 22) to (start + 0, 23) -- Branch { true: Counter(3), false: Counter(2) } at (prev + 1, 16) to (start + 0, 23) - true = c3 +- Branch { true: Expression(5, Sub), false: Counter(2) } at (prev + 1, 16) to (start + 0, 23) + true = (c0 - (c1 + c2)) false = c2 -- Code(Counter(3)) at (prev + 0, 21) to (start + 0, 22) +- Code(Expression(5, Sub)) at (prev + 0, 21) to (start + 0, 22) + = (c0 - (c1 + c2)) - Code(Expression(0, Sub)) at (prev + 0, 26) to (start + 0, 27) = (c0 - c1) -- Code(Counter(3)) at (prev + 1, 5) to (start + 3, 6) -- Code(Expression(3, Add)) at (prev + 3, 12) to (start + 2, 6) +- Code(Expression(5, Sub)) at (prev + 1, 5) to (start + 3, 6) + = (c0 - (c1 + c2)) +- Code(Expression(7, Add)) at (prev + 3, 12) to (start + 2, 6) = (c1 + c2) -- Code(Expression(2, Add)) at (prev + 3, 5) to (start + 1, 2) - = ((c1 + c2) + c3) -Highest counter ID seen: c3 +- Code(Counter(0)) at (prev + 3, 5) to (start + 1, 2) +Highest counter ID seen: c2 diff --git a/tests/coverage/branch/if.cov-map b/tests/coverage/branch/if.cov-map index bab982dd44c..3d9a1d2e1ab 100644 --- a/tests/coverage/branch/if.cov-map +++ b/tests/coverage/branch/if.cov-map @@ -1,14 +1,11 @@ Function name: if::branch_and -Raw bytes (60): 0x[01, 01, 06, 05, 09, 0b, 09, 05, 11, 13, 09, 17, 11, 05, 0d, 08, 01, 2b, 01, 01, 10, 05, 03, 08, 00, 09, 20, 09, 02, 00, 08, 00, 09, 09, 00, 0d, 00, 0e, 20, 0d, 11, 00, 0d, 00, 0e, 0d, 00, 0f, 02, 06, 06, 02, 0c, 02, 06, 0e, 03, 01, 00, 02] +Raw bytes (54): 0x[01, 01, 03, 05, 09, 09, 0d, 05, 0d, 08, 01, 2b, 01, 01, 10, 05, 03, 08, 00, 09, 20, 09, 02, 00, 08, 00, 09, 09, 00, 0d, 00, 0e, 20, 0d, 06, 00, 0d, 00, 0e, 0d, 00, 0f, 02, 06, 0a, 02, 0c, 02, 06, 05, 03, 01, 00, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 6 +Number of expressions: 3 - expression 0 operands: lhs = Counter(1), rhs = Counter(2) -- expression 1 operands: lhs = Expression(2, Add), rhs = Counter(2) -- expression 2 operands: lhs = Counter(1), rhs = Counter(4) -- expression 3 operands: lhs = Expression(4, Add), rhs = Counter(2) -- expression 4 operands: lhs = Expression(5, Add), rhs = Counter(4) -- expression 5 operands: lhs = Counter(1), rhs = Counter(3) +- expression 1 operands: lhs = Counter(2), rhs = Counter(3) +- expression 2 operands: lhs = Counter(1), rhs = Counter(3) Number of file 0 mappings: 8 - Code(Counter(0)) at (prev + 43, 1) to (start + 1, 16) - Code(Counter(1)) at (prev + 3, 8) to (start + 0, 9) @@ -16,15 +13,14 @@ Number of file 0 mappings: 8 true = c2 false = (c1 - c2) - Code(Counter(2)) at (prev + 0, 13) to (start + 0, 14) -- Branch { true: Counter(3), false: Counter(4) } at (prev + 0, 13) to (start + 0, 14) +- Branch { true: Counter(3), false: Expression(1, Sub) } at (prev + 0, 13) to (start + 0, 14) true = c3 - false = c4 + false = (c2 - c3) - Code(Counter(3)) at (prev + 0, 15) to (start + 2, 6) -- Code(Expression(1, Sub)) at (prev + 2, 12) to (start + 2, 6) - = ((c1 + c4) - c2) -- Code(Expression(3, Sub)) at (prev + 3, 1) to (start + 0, 2) - = (((c1 + c3) + c4) - c2) -Highest counter ID seen: c4 +- Code(Expression(2, Sub)) at (prev + 2, 12) to (start + 2, 6) + = (c1 - c3) +- Code(Counter(1)) at (prev + 3, 1) to (start + 0, 2) +Highest counter ID seen: c3 Function name: if::branch_not Raw bytes (116): 0x[01, 01, 07, 05, 09, 05, 0d, 05, 0d, 05, 11, 05, 11, 05, 15, 05, 15, 12, 01, 0c, 01, 01, 10, 05, 03, 08, 00, 09, 20, 09, 02, 00, 08, 00, 09, 09, 01, 09, 00, 11, 02, 01, 05, 00, 06, 05, 01, 08, 00, 0a, 20, 0a, 0d, 00, 08, 00, 0a, 0a, 00, 0b, 02, 06, 0d, 02, 05, 00, 06, 05, 01, 08, 00, 0b, 20, 11, 12, 00, 08, 00, 0b, 11, 00, 0c, 02, 06, 12, 02, 05, 00, 06, 05, 01, 08, 00, 0c, 20, 1a, 15, 00, 08, 00, 0c, 1a, 00, 0d, 02, 06, 15, 02, 05, 00, 06, 05, 01, 01, 00, 02] @@ -108,14 +104,16 @@ Number of file 0 mappings: 14 Highest counter ID seen: c4 Function name: if::branch_or -Raw bytes (56): 0x[01, 01, 04, 05, 09, 09, 0d, 0f, 11, 09, 0d, 08, 01, 35, 01, 01, 10, 05, 03, 08, 00, 09, 20, 09, 02, 00, 08, 00, 09, 02, 00, 0d, 00, 0e, 20, 0d, 11, 00, 0d, 00, 0e, 0f, 00, 0f, 02, 06, 11, 02, 0c, 02, 06, 0b, 03, 01, 00, 02] +Raw bytes (60): 0x[01, 01, 06, 05, 09, 05, 17, 09, 0d, 09, 0d, 05, 17, 09, 0d, 08, 01, 35, 01, 01, 10, 05, 03, 08, 00, 09, 20, 09, 02, 00, 08, 00, 09, 02, 00, 0d, 00, 0e, 20, 0d, 12, 00, 0d, 00, 0e, 17, 00, 0f, 02, 06, 12, 02, 0c, 02, 06, 05, 03, 01, 00, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 4 +Number of expressions: 6 - expression 0 operands: lhs = Counter(1), rhs = Counter(2) -- expression 1 operands: lhs = Counter(2), rhs = Counter(3) -- expression 2 operands: lhs = Expression(3, Add), rhs = Counter(4) +- expression 1 operands: lhs = Counter(1), rhs = Expression(5, Add) +- expression 2 operands: lhs = Counter(2), rhs = Counter(3) - expression 3 operands: lhs = Counter(2), rhs = Counter(3) +- expression 4 operands: lhs = Counter(1), rhs = Expression(5, Add) +- expression 5 operands: lhs = Counter(2), rhs = Counter(3) Number of file 0 mappings: 8 - Code(Counter(0)) at (prev + 53, 1) to (start + 1, 16) - Code(Counter(1)) at (prev + 3, 8) to (start + 0, 9) @@ -124,13 +122,13 @@ Number of file 0 mappings: 8 false = (c1 - c2) - Code(Expression(0, Sub)) at (prev + 0, 13) to (start + 0, 14) = (c1 - c2) -- Branch { true: Counter(3), false: Counter(4) } at (prev + 0, 13) to (start + 0, 14) +- Branch { true: Counter(3), false: Expression(4, Sub) } at (prev + 0, 13) to (start + 0, 14) true = c3 - false = c4 -- Code(Expression(3, Add)) at (prev + 0, 15) to (start + 2, 6) + false = (c1 - (c2 + c3)) +- Code(Expression(5, Add)) at (prev + 0, 15) to (start + 2, 6) = (c2 + c3) -- Code(Counter(4)) at (prev + 2, 12) to (start + 2, 6) -- Code(Expression(2, Add)) at (prev + 3, 1) to (start + 0, 2) - = ((c2 + c3) + c4) -Highest counter ID seen: c4 +- Code(Expression(4, Sub)) at (prev + 2, 12) to (start + 2, 6) + = (c1 - (c2 + c3)) +- Code(Counter(1)) at (prev + 3, 1) to (start + 0, 2) +Highest counter ID seen: c3 diff --git a/tests/coverage/branch/lazy-boolean.cov-map b/tests/coverage/branch/lazy-boolean.cov-map index decb847f60e..94522734bcd 100644 --- a/tests/coverage/branch/lazy-boolean.cov-map +++ b/tests/coverage/branch/lazy-boolean.cov-map @@ -34,85 +34,67 @@ Number of file 0 mappings: 6 Highest counter ID seen: c2 Function name: lazy_boolean::chain -Raw bytes (169): 0x[01, 01, 1d, 5b, 0d, 5f, 15, 05, 11, 05, 09, 09, 0d, 6f, 25, 73, 21, 19, 1d, 5b, 67, 5f, 15, 05, 11, 0d, 19, 5b, 67, 5f, 15, 05, 11, 0d, 19, 5b, 63, 5f, 15, 05, 11, 67, 1d, 0d, 19, 5b, 63, 5f, 15, 05, 11, 67, 1d, 0d, 19, 6f, 25, 73, 21, 19, 1d, 13, 01, 24, 01, 01, 10, 02, 04, 09, 00, 0a, 05, 00, 0d, 00, 12, 20, 09, 0e, 00, 0d, 00, 12, 09, 00, 16, 00, 1b, 20, 0d, 12, 00, 16, 00, 1b, 0d, 00, 1f, 00, 24, 20, 11, 15, 00, 1f, 00, 24, 11, 00, 28, 00, 2d, 02, 01, 05, 00, 11, 6b, 03, 09, 00, 0a, 02, 00, 0d, 00, 12, 20, 19, 32, 00, 0d, 00, 12, 32, 00, 16, 00, 1b, 20, 1d, 56, 00, 16, 00, 1b, 56, 00, 1f, 00, 24, 20, 21, 25, 00, 1f, 00, 24, 25, 00, 28, 00, 2d, 6b, 01, 05, 01, 02] +Raw bytes (141): 0x[01, 01, 0f, 05, 09, 09, 0d, 0d, 11, 05, 15, 05, 15, 05, 3b, 15, 19, 05, 3b, 15, 19, 05, 37, 3b, 1d, 15, 19, 05, 37, 3b, 1d, 15, 19, 13, 01, 24, 01, 01, 10, 05, 04, 09, 00, 0a, 05, 00, 0d, 00, 12, 20, 09, 02, 00, 0d, 00, 12, 09, 00, 16, 00, 1b, 20, 0d, 06, 00, 16, 00, 1b, 0d, 00, 1f, 00, 24, 20, 11, 0a, 00, 1f, 00, 24, 11, 00, 28, 00, 2d, 05, 01, 05, 00, 11, 05, 03, 09, 00, 0a, 05, 00, 0d, 00, 12, 20, 15, 12, 00, 0d, 00, 12, 12, 00, 16, 00, 1b, 20, 19, 1e, 00, 16, 00, 1b, 1e, 00, 1f, 00, 24, 20, 1d, 32, 00, 1f, 00, 24, 32, 00, 28, 00, 2d, 05, 01, 05, 01, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 29 -- expression 0 operands: lhs = Expression(22, Add), rhs = Counter(3) -- expression 1 operands: lhs = Expression(23, Add), rhs = Counter(5) -- expression 2 operands: lhs = Counter(1), rhs = Counter(4) -- expression 3 operands: lhs = Counter(1), rhs = Counter(2) -- expression 4 operands: lhs = Counter(2), rhs = Counter(3) -- expression 5 operands: lhs = Expression(27, Add), rhs = Counter(9) -- expression 6 operands: lhs = Expression(28, Add), rhs = Counter(8) -- expression 7 operands: lhs = Counter(6), rhs = Counter(7) -- expression 8 operands: lhs = Expression(22, Add), rhs = Expression(25, Add) -- expression 9 operands: lhs = Expression(23, Add), rhs = Counter(5) -- expression 10 operands: lhs = Counter(1), rhs = Counter(4) -- expression 11 operands: lhs = Counter(3), rhs = Counter(6) -- expression 12 operands: lhs = Expression(22, Add), rhs = Expression(25, Add) -- expression 13 operands: lhs = Expression(23, Add), rhs = Counter(5) -- expression 14 operands: lhs = Counter(1), rhs = Counter(4) -- expression 15 operands: lhs = Counter(3), rhs = Counter(6) -- expression 16 operands: lhs = Expression(22, Add), rhs = Expression(24, Add) -- expression 17 operands: lhs = Expression(23, Add), rhs = Counter(5) -- expression 18 operands: lhs = Counter(1), rhs = Counter(4) -- expression 19 operands: lhs = Expression(25, Add), rhs = Counter(7) -- expression 20 operands: lhs = Counter(3), rhs = Counter(6) -- expression 21 operands: lhs = Expression(22, Add), rhs = Expression(24, Add) -- expression 22 operands: lhs = Expression(23, Add), rhs = Counter(5) -- expression 23 operands: lhs = Counter(1), rhs = Counter(4) -- expression 24 operands: lhs = Expression(25, Add), rhs = Counter(7) -- expression 25 operands: lhs = Counter(3), rhs = Counter(6) -- expression 26 operands: lhs = Expression(27, Add), rhs = Counter(9) -- expression 27 operands: lhs = Expression(28, Add), rhs = Counter(8) -- expression 28 operands: lhs = Counter(6), rhs = Counter(7) +Number of expressions: 15 +- expression 0 operands: lhs = Counter(1), rhs = Counter(2) +- expression 1 operands: lhs = Counter(2), rhs = Counter(3) +- expression 2 operands: lhs = Counter(3), rhs = Counter(4) +- expression 3 operands: lhs = Counter(1), rhs = Counter(5) +- expression 4 operands: lhs = Counter(1), rhs = Counter(5) +- expression 5 operands: lhs = Counter(1), rhs = Expression(14, Add) +- expression 6 operands: lhs = Counter(5), rhs = Counter(6) +- expression 7 operands: lhs = Counter(1), rhs = Expression(14, Add) +- expression 8 operands: lhs = Counter(5), rhs = Counter(6) +- expression 9 operands: lhs = Counter(1), rhs = Expression(13, Add) +- expression 10 operands: lhs = Expression(14, Add), rhs = Counter(7) +- expression 11 operands: lhs = Counter(5), rhs = Counter(6) +- expression 12 operands: lhs = Counter(1), rhs = Expression(13, Add) +- expression 13 operands: lhs = Expression(14, Add), rhs = Counter(7) +- expression 14 operands: lhs = Counter(5), rhs = Counter(6) Number of file 0 mappings: 19 - Code(Counter(0)) at (prev + 36, 1) to (start + 1, 16) -- Code(Expression(0, Sub)) at (prev + 4, 9) to (start + 0, 10) - = (((c1 + c4) + c5) - c3) +- Code(Counter(1)) at (prev + 4, 9) to (start + 0, 10) - Code(Counter(1)) at (prev + 0, 13) to (start + 0, 18) -- Branch { true: Counter(2), false: Expression(3, Sub) } at (prev + 0, 13) to (start + 0, 18) +- Branch { true: Counter(2), false: Expression(0, Sub) } at (prev + 0, 13) to (start + 0, 18) true = c2 false = (c1 - c2) - Code(Counter(2)) at (prev + 0, 22) to (start + 0, 27) -- Branch { true: Counter(3), false: Expression(4, Sub) } at (prev + 0, 22) to (start + 0, 27) +- Branch { true: Counter(3), false: Expression(1, Sub) } at (prev + 0, 22) to (start + 0, 27) true = c3 false = (c2 - c3) - Code(Counter(3)) at (prev + 0, 31) to (start + 0, 36) -- Branch { true: Counter(4), false: Counter(5) } at (prev + 0, 31) to (start + 0, 36) +- Branch { true: Counter(4), false: Expression(2, Sub) } at (prev + 0, 31) to (start + 0, 36) true = c4 - false = c5 + false = (c3 - c4) - Code(Counter(4)) at (prev + 0, 40) to (start + 0, 45) -- Code(Expression(0, Sub)) at (prev + 1, 5) to (start + 0, 17) - = (((c1 + c4) + c5) - c3) -- Code(Expression(26, Add)) at (prev + 3, 9) to (start + 0, 10) - = (((c6 + c7) + c8) + c9) -- Code(Expression(0, Sub)) at (prev + 0, 13) to (start + 0, 18) - = (((c1 + c4) + c5) - c3) -- Branch { true: Counter(6), false: Expression(12, Sub) } at (prev + 0, 13) to (start + 0, 18) +- Code(Counter(1)) at (prev + 1, 5) to (start + 0, 17) +- Code(Counter(1)) at (prev + 3, 9) to (start + 0, 10) +- Code(Counter(1)) at (prev + 0, 13) to (start + 0, 18) +- Branch { true: Counter(5), false: Expression(4, Sub) } at (prev + 0, 13) to (start + 0, 18) + true = c5 + false = (c1 - c5) +- Code(Expression(4, Sub)) at (prev + 0, 22) to (start + 0, 27) + = (c1 - c5) +- Branch { true: Counter(6), false: Expression(7, Sub) } at (prev + 0, 22) to (start + 0, 27) true = c6 - false = (((c1 + c4) + c5) - (c3 + c6)) -- Code(Expression(12, Sub)) at (prev + 0, 22) to (start + 0, 27) - = (((c1 + c4) + c5) - (c3 + c6)) -- Branch { true: Counter(7), false: Expression(21, Sub) } at (prev + 0, 22) to (start + 0, 27) + false = (c1 - (c5 + c6)) +- Code(Expression(7, Sub)) at (prev + 0, 31) to (start + 0, 36) + = (c1 - (c5 + c6)) +- Branch { true: Counter(7), false: Expression(12, Sub) } at (prev + 0, 31) to (start + 0, 36) true = c7 - false = (((c1 + c4) + c5) - ((c3 + c6) + c7)) -- Code(Expression(21, Sub)) at (prev + 0, 31) to (start + 0, 36) - = (((c1 + c4) + c5) - ((c3 + c6) + c7)) -- Branch { true: Counter(8), false: Counter(9) } at (prev + 0, 31) to (start + 0, 36) - true = c8 - false = c9 -- Code(Counter(9)) at (prev + 0, 40) to (start + 0, 45) -- Code(Expression(26, Add)) at (prev + 1, 5) to (start + 1, 2) - = (((c6 + c7) + c8) + c9) -Highest counter ID seen: c9 + false = (c1 - ((c5 + c6) + c7)) +- Code(Expression(12, Sub)) at (prev + 0, 40) to (start + 0, 45) + = (c1 - ((c5 + c6) + c7)) +- Code(Counter(1)) at (prev + 1, 5) to (start + 1, 2) +Highest counter ID seen: c7 Function name: lazy_boolean::nested_mixed -Raw bytes (141): 0x[01, 01, 0f, 05, 09, 05, 1f, 09, 0d, 09, 0d, 1f, 11, 09, 0d, 1f, 11, 09, 0d, 3b, 21, 19, 1d, 05, 15, 15, 19, 05, 19, 3b, 21, 19, 1d, 13, 01, 31, 01, 01, 10, 05, 04, 09, 00, 0a, 05, 00, 0e, 00, 13, 20, 09, 02, 00, 0e, 00, 13, 02, 00, 17, 00, 1d, 20, 0d, 06, 00, 17, 00, 1d, 1f, 00, 23, 00, 28, 20, 11, 1a, 00, 23, 00, 28, 1a, 00, 2c, 00, 33, 05, 01, 05, 00, 11, 37, 03, 09, 00, 0a, 05, 00, 0e, 00, 13, 20, 15, 2a, 00, 0e, 00, 13, 15, 00, 17, 00, 1c, 20, 19, 2e, 00, 17, 00, 1c, 32, 00, 22, 00, 28, 20, 1d, 21, 00, 22, 00, 28, 1d, 00, 2c, 00, 33, 37, 01, 05, 01, 02] +Raw bytes (137): 0x[01, 01, 0d, 05, 09, 05, 1f, 09, 0d, 09, 0d, 1f, 11, 09, 0d, 1f, 11, 09, 0d, 05, 15, 15, 19, 05, 19, 05, 33, 19, 1d, 13, 01, 31, 01, 01, 10, 05, 04, 09, 00, 0a, 05, 00, 0e, 00, 13, 20, 09, 02, 00, 0e, 00, 13, 02, 00, 17, 00, 1d, 20, 0d, 06, 00, 17, 00, 1d, 1f, 00, 23, 00, 28, 20, 11, 1a, 00, 23, 00, 28, 1a, 00, 2c, 00, 33, 05, 01, 05, 00, 11, 05, 03, 09, 00, 0a, 05, 00, 0e, 00, 13, 20, 15, 22, 00, 0e, 00, 13, 15, 00, 17, 00, 1c, 20, 19, 26, 00, 17, 00, 1c, 2a, 00, 22, 00, 28, 20, 1d, 2e, 00, 22, 00, 28, 1d, 00, 2c, 00, 33, 05, 01, 05, 01, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 15 +Number of expressions: 13 - expression 0 operands: lhs = Counter(1), rhs = Counter(2) - expression 1 operands: lhs = Counter(1), rhs = Expression(7, Add) - expression 2 operands: lhs = Counter(2), rhs = Counter(3) @@ -121,13 +103,11 @@ Number of expressions: 15 - expression 5 operands: lhs = Counter(2), rhs = Counter(3) - expression 6 operands: lhs = Expression(7, Add), rhs = Counter(4) - expression 7 operands: lhs = Counter(2), rhs = Counter(3) -- expression 8 operands: lhs = Expression(14, Add), rhs = Counter(8) -- expression 9 operands: lhs = Counter(6), rhs = Counter(7) -- expression 10 operands: lhs = Counter(1), rhs = Counter(5) -- expression 11 operands: lhs = Counter(5), rhs = Counter(6) -- expression 12 operands: lhs = Counter(1), rhs = Counter(6) -- expression 13 operands: lhs = Expression(14, Add), rhs = Counter(8) -- expression 14 operands: lhs = Counter(6), rhs = Counter(7) +- expression 8 operands: lhs = Counter(1), rhs = Counter(5) +- expression 9 operands: lhs = Counter(5), rhs = Counter(6) +- expression 10 operands: lhs = Counter(1), rhs = Counter(6) +- expression 11 operands: lhs = Counter(1), rhs = Expression(12, Add) +- expression 12 operands: lhs = Counter(6), rhs = Counter(7) Number of file 0 mappings: 19 - Code(Counter(0)) at (prev + 49, 1) to (start + 1, 16) - Code(Counter(1)) at (prev + 4, 9) to (start + 0, 10) @@ -148,23 +128,21 @@ Number of file 0 mappings: 19 - Code(Expression(6, Sub)) at (prev + 0, 44) to (start + 0, 51) = ((c2 + c3) - c4) - Code(Counter(1)) at (prev + 1, 5) to (start + 0, 17) -- Code(Expression(13, Add)) at (prev + 3, 9) to (start + 0, 10) - = ((c6 + c7) + c8) +- Code(Counter(1)) at (prev + 3, 9) to (start + 0, 10) - Code(Counter(1)) at (prev + 0, 14) to (start + 0, 19) -- Branch { true: Counter(5), false: Expression(10, Sub) } at (prev + 0, 14) to (start + 0, 19) +- Branch { true: Counter(5), false: Expression(8, Sub) } at (prev + 0, 14) to (start + 0, 19) true = c5 false = (c1 - c5) - Code(Counter(5)) at (prev + 0, 23) to (start + 0, 28) -- Branch { true: Counter(6), false: Expression(11, Sub) } at (prev + 0, 23) to (start + 0, 28) +- Branch { true: Counter(6), false: Expression(9, Sub) } at (prev + 0, 23) to (start + 0, 28) true = c6 false = (c5 - c6) -- Code(Expression(12, Sub)) at (prev + 0, 34) to (start + 0, 40) +- Code(Expression(10, Sub)) at (prev + 0, 34) to (start + 0, 40) = (c1 - c6) -- Branch { true: Counter(7), false: Counter(8) } at (prev + 0, 34) to (start + 0, 40) +- Branch { true: Counter(7), false: Expression(11, Sub) } at (prev + 0, 34) to (start + 0, 40) true = c7 - false = c8 + false = (c1 - (c6 + c7)) - Code(Counter(7)) at (prev + 0, 44) to (start + 0, 51) -- Code(Expression(13, Add)) at (prev + 1, 5) to (start + 1, 2) - = ((c6 + c7) + c8) -Highest counter ID seen: c8 +- Code(Counter(1)) at (prev + 1, 5) to (start + 1, 2) +Highest counter ID seen: c7 diff --git a/tests/coverage/branch/match-arms.cov-map b/tests/coverage/branch/match-arms.cov-map index a93df9814ee..53d0a4edbd0 100644 --- a/tests/coverage/branch/match-arms.cov-map +++ b/tests/coverage/branch/match-arms.cov-map @@ -1,40 +1,45 @@ Function name: match_arms::guards -Raw bytes (88): 0x[01, 01, 08, 07, 00, 0b, 11, 0f, 0d, 05, 09, 17, 25, 1b, 21, 1f, 1d, 03, 19, 0c, 01, 30, 01, 01, 10, 29, 03, 0b, 00, 10, 19, 01, 11, 00, 29, 20, 19, 05, 00, 17, 00, 1b, 1d, 01, 11, 00, 29, 20, 1d, 09, 00, 17, 00, 1b, 21, 01, 11, 00, 29, 20, 21, 0d, 00, 17, 00, 1b, 25, 01, 11, 00, 29, 20, 25, 11, 00, 17, 00, 1b, 03, 01, 0e, 00, 18, 13, 03, 05, 01, 02] +Raw bytes (98): 0x[01, 01, 0d, 11, 19, 27, 19, 2b, 00, 2f, 11, 33, 0d, 05, 09, 1f, 25, 23, 21, 27, 1d, 2b, 00, 2f, 11, 33, 0d, 05, 09, 0c, 01, 30, 01, 01, 10, 11, 03, 0b, 00, 10, 1d, 01, 11, 00, 29, 20, 1d, 05, 00, 17, 00, 1b, 21, 01, 11, 00, 29, 20, 21, 09, 00, 17, 00, 1b, 25, 01, 11, 00, 29, 20, 25, 0d, 00, 17, 00, 1b, 19, 01, 11, 00, 29, 20, 19, 02, 00, 17, 00, 1b, 06, 01, 0e, 00, 18, 1b, 03, 05, 01, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 8 -- expression 0 operands: lhs = Expression(1, Add), rhs = Zero -- expression 1 operands: lhs = Expression(2, Add), rhs = Counter(4) -- expression 2 operands: lhs = Expression(3, Add), rhs = Counter(3) -- expression 3 operands: lhs = Counter(1), rhs = Counter(2) -- expression 4 operands: lhs = Expression(5, Add), rhs = Counter(9) -- expression 5 operands: lhs = Expression(6, Add), rhs = Counter(8) -- expression 6 operands: lhs = Expression(7, Add), rhs = Counter(7) -- expression 7 operands: lhs = Expression(0, Add), rhs = Counter(6) +Number of expressions: 13 +- expression 0 operands: lhs = Counter(4), rhs = Counter(6) +- expression 1 operands: lhs = Expression(9, Add), rhs = Counter(6) +- expression 2 operands: lhs = Expression(10, Add), rhs = Zero +- expression 3 operands: lhs = Expression(11, Add), rhs = Counter(4) +- expression 4 operands: lhs = Expression(12, Add), rhs = Counter(3) +- expression 5 operands: lhs = Counter(1), rhs = Counter(2) +- expression 6 operands: lhs = Expression(7, Add), rhs = Counter(9) +- expression 7 operands: lhs = Expression(8, Add), rhs = Counter(8) +- expression 8 operands: lhs = Expression(9, Add), rhs = Counter(7) +- expression 9 operands: lhs = Expression(10, Add), rhs = Zero +- expression 10 operands: lhs = Expression(11, Add), rhs = Counter(4) +- expression 11 operands: lhs = Expression(12, Add), rhs = Counter(3) +- expression 12 operands: lhs = Counter(1), rhs = Counter(2) Number of file 0 mappings: 12 - Code(Counter(0)) at (prev + 48, 1) to (start + 1, 16) -- Code(Counter(10)) at (prev + 3, 11) to (start + 0, 16) -- Code(Counter(6)) at (prev + 1, 17) to (start + 0, 41) -- Branch { true: Counter(6), false: Counter(1) } at (prev + 0, 23) to (start + 0, 27) - true = c6 - false = c1 +- Code(Counter(4)) at (prev + 3, 11) to (start + 0, 16) - Code(Counter(7)) at (prev + 1, 17) to (start + 0, 41) -- Branch { true: Counter(7), false: Counter(2) } at (prev + 0, 23) to (start + 0, 27) +- Branch { true: Counter(7), false: Counter(1) } at (prev + 0, 23) to (start + 0, 27) true = c7 - false = c2 + false = c1 - Code(Counter(8)) at (prev + 1, 17) to (start + 0, 41) -- Branch { true: Counter(8), false: Counter(3) } at (prev + 0, 23) to (start + 0, 27) +- Branch { true: Counter(8), false: Counter(2) } at (prev + 0, 23) to (start + 0, 27) true = c8 - false = c3 + false = c2 - Code(Counter(9)) at (prev + 1, 17) to (start + 0, 41) -- Branch { true: Counter(9), false: Counter(4) } at (prev + 0, 23) to (start + 0, 27) +- Branch { true: Counter(9), false: Counter(3) } at (prev + 0, 23) to (start + 0, 27) true = c9 - false = c4 -- Code(Expression(0, Add)) at (prev + 1, 14) to (start + 0, 24) - = ((((c1 + c2) + c3) + c4) + Zero) -- Code(Expression(4, Add)) at (prev + 3, 5) to (start + 1, 2) - = ((((((((c1 + c2) + c3) + c4) + Zero) + c6) + c7) + c8) + c9) -Highest counter ID seen: c10 + false = c3 +- Code(Counter(6)) at (prev + 1, 17) to (start + 0, 41) +- Branch { true: Counter(6), false: Expression(0, Sub) } at (prev + 0, 23) to (start + 0, 27) + true = c6 + false = (c4 - c6) +- Code(Expression(1, Sub)) at (prev + 1, 14) to (start + 0, 24) + = (((((c1 + c2) + c3) + c4) + Zero) - c6) +- Code(Expression(6, Add)) at (prev + 3, 5) to (start + 1, 2) + = (((((((c1 + c2) + c3) + c4) + Zero) + c7) + c8) + c9) +Highest counter ID seen: c9 Function name: match_arms::match_arms Raw bytes (45): 0x[01, 01, 03, 05, 07, 0b, 11, 09, 0d, 07, 01, 18, 01, 01, 10, 05, 03, 0b, 00, 10, 09, 01, 11, 00, 21, 0d, 01, 11, 00, 21, 11, 01, 11, 00, 21, 02, 01, 11, 00, 21, 05, 03, 05, 01, 02] diff --git a/tests/coverage/branch/while.cov-map b/tests/coverage/branch/while.cov-map index 305f6bc74d8..5eb08a42803 100644 --- a/tests/coverage/branch/while.cov-map +++ b/tests/coverage/branch/while.cov-map @@ -35,14 +35,14 @@ Number of file 0 mappings: 6 Highest counter ID seen: c2 Function name: while::while_op_and -Raw bytes (56): 0x[01, 01, 04, 05, 09, 03, 0d, 03, 0d, 0d, 11, 08, 01, 1e, 01, 01, 10, 05, 03, 09, 01, 12, 03, 02, 0b, 00, 10, 20, 0a, 0d, 00, 0b, 00, 10, 0a, 00, 14, 00, 19, 20, 09, 11, 00, 14, 00, 19, 09, 00, 1a, 03, 06, 0f, 04, 01, 00, 02] +Raw bytes (56): 0x[01, 01, 04, 05, 09, 03, 0d, 03, 0d, 05, 0d, 08, 01, 1e, 01, 01, 10, 05, 03, 09, 01, 12, 03, 02, 0b, 00, 10, 20, 0a, 0d, 00, 0b, 00, 10, 0a, 00, 14, 00, 19, 20, 09, 0e, 00, 14, 00, 19, 09, 00, 1a, 03, 06, 05, 04, 01, 00, 02] Number of files: 1 - file 0 => global file 1 Number of expressions: 4 - expression 0 operands: lhs = Counter(1), rhs = Counter(2) - expression 1 operands: lhs = Expression(0, Add), rhs = Counter(3) - expression 2 operands: lhs = Expression(0, Add), rhs = Counter(3) -- expression 3 operands: lhs = Counter(3), rhs = Counter(4) +- expression 3 operands: lhs = Counter(1), rhs = Counter(3) Number of file 0 mappings: 8 - Code(Counter(0)) at (prev + 30, 1) to (start + 1, 16) - Code(Counter(1)) at (prev + 3, 9) to (start + 1, 18) @@ -53,13 +53,12 @@ Number of file 0 mappings: 8 false = c3 - Code(Expression(2, Sub)) at (prev + 0, 20) to (start + 0, 25) = ((c1 + c2) - c3) -- Branch { true: Counter(2), false: Counter(4) } at (prev + 0, 20) to (start + 0, 25) +- Branch { true: Counter(2), false: Expression(3, Sub) } at (prev + 0, 20) to (start + 0, 25) true = c2 - false = c4 + false = (c1 - c3) - Code(Counter(2)) at (prev + 0, 26) to (start + 3, 6) -- Code(Expression(3, Add)) at (prev + 4, 1) to (start + 0, 2) - = (c3 + c4) -Highest counter ID seen: c4 +- Code(Counter(1)) at (prev + 4, 1) to (start + 0, 2) +Highest counter ID seen: c3 Function name: while::while_op_or Raw bytes (58): 0x[01, 01, 05, 07, 0d, 05, 09, 05, 0d, 05, 0d, 09, 0d, 08, 01, 29, 01, 01, 10, 05, 03, 09, 01, 12, 03, 02, 0b, 00, 10, 20, 09, 0f, 00, 0b, 00, 10, 0f, 00, 14, 00, 19, 20, 0d, 05, 00, 14, 00, 19, 13, 00, 1a, 03, 06, 05, 04, 01, 00, 02] diff --git a/tests/coverage/closure_macro.cov-map b/tests/coverage/closure_macro.cov-map index aedb924eca8..653848dd6ff 100644 --- a/tests/coverage/closure_macro.cov-map +++ b/tests/coverage/closure_macro.cov-map @@ -25,20 +25,20 @@ Number of file 0 mappings: 6 Highest counter ID seen: c1 Function name: closure_macro::main::{closure#0} -Raw bytes (35): 0x[01, 01, 03, 01, 05, 0b, 0d, 05, 09, 05, 01, 10, 1c, 03, 21, 05, 04, 11, 01, 27, 02, 03, 11, 00, 16, 0d, 00, 17, 00, 1e, 07, 02, 09, 00, 0a] +Raw bytes (35): 0x[01, 01, 03, 01, 05, 01, 0b, 05, 09, 05, 01, 10, 1c, 03, 21, 05, 04, 11, 01, 27, 02, 03, 11, 00, 16, 06, 00, 17, 00, 1e, 01, 02, 09, 00, 0a] Number of files: 1 - file 0 => global file 1 Number of expressions: 3 - expression 0 operands: lhs = Counter(0), rhs = Counter(1) -- expression 1 operands: lhs = Expression(2, Add), rhs = Counter(3) +- expression 1 operands: lhs = Counter(0), rhs = Expression(2, Add) - expression 2 operands: lhs = Counter(1), rhs = Counter(2) Number of file 0 mappings: 5 - Code(Counter(0)) at (prev + 16, 28) to (start + 3, 33) - Code(Counter(1)) at (prev + 4, 17) to (start + 1, 39) - Code(Expression(0, Sub)) at (prev + 3, 17) to (start + 0, 22) = (c0 - c1) -- Code(Counter(3)) at (prev + 0, 23) to (start + 0, 30) -- Code(Expression(1, Add)) at (prev + 2, 9) to (start + 0, 10) - = ((c1 + c2) + c3) -Highest counter ID seen: c3 +- Code(Expression(1, Sub)) at (prev + 0, 23) to (start + 0, 30) + = (c0 - (c1 + c2)) +- Code(Counter(0)) at (prev + 2, 9) to (start + 0, 10) +Highest counter ID seen: c1 diff --git a/tests/coverage/closure_macro_async.cov-map b/tests/coverage/closure_macro_async.cov-map index df4652ac9ce..1bd1460a147 100644 --- a/tests/coverage/closure_macro_async.cov-map +++ b/tests/coverage/closure_macro_async.cov-map @@ -34,20 +34,20 @@ Number of file 0 mappings: 6 Highest counter ID seen: c1 Function name: closure_macro_async::test::{closure#0}::{closure#0} -Raw bytes (35): 0x[01, 01, 03, 01, 05, 0b, 0d, 05, 09, 05, 01, 14, 1c, 03, 21, 05, 04, 11, 01, 27, 02, 03, 11, 00, 16, 0d, 00, 17, 00, 1e, 07, 02, 09, 00, 0a] +Raw bytes (35): 0x[01, 01, 03, 01, 05, 01, 0b, 05, 09, 05, 01, 14, 1c, 03, 21, 05, 04, 11, 01, 27, 02, 03, 11, 00, 16, 06, 00, 17, 00, 1e, 01, 02, 09, 00, 0a] Number of files: 1 - file 0 => global file 1 Number of expressions: 3 - expression 0 operands: lhs = Counter(0), rhs = Counter(1) -- expression 1 operands: lhs = Expression(2, Add), rhs = Counter(3) +- expression 1 operands: lhs = Counter(0), rhs = Expression(2, Add) - expression 2 operands: lhs = Counter(1), rhs = Counter(2) Number of file 0 mappings: 5 - Code(Counter(0)) at (prev + 20, 28) to (start + 3, 33) - Code(Counter(1)) at (prev + 4, 17) to (start + 1, 39) - Code(Expression(0, Sub)) at (prev + 3, 17) to (start + 0, 22) = (c0 - c1) -- Code(Counter(3)) at (prev + 0, 23) to (start + 0, 30) -- Code(Expression(1, Add)) at (prev + 2, 9) to (start + 0, 10) - = ((c1 + c2) + c3) -Highest counter ID seen: c3 +- Code(Expression(1, Sub)) at (prev + 0, 23) to (start + 0, 30) + = (c0 - (c1 + c2)) +- Code(Counter(0)) at (prev + 2, 9) to (start + 0, 10) +Highest counter ID seen: c1 diff --git a/tests/coverage/condition/conditions.cov-map b/tests/coverage/condition/conditions.cov-map index 72f39b88c6a..417637f2d2e 100644 --- a/tests/coverage/condition/conditions.cov-map +++ b/tests/coverage/condition/conditions.cov-map @@ -1,120 +1,103 @@ Function name: conditions::assign_3_and_or -Raw bytes (65): 0x[01, 01, 05, 07, 11, 09, 0d, 01, 05, 05, 09, 01, 09, 09, 01, 1c, 01, 00, 2f, 03, 01, 09, 00, 0a, 01, 00, 0d, 00, 0e, 20, 05, 0a, 00, 0d, 00, 0e, 05, 00, 12, 00, 13, 20, 09, 0e, 00, 12, 00, 13, 12, 00, 17, 00, 18, 20, 0d, 11, 00, 17, 00, 18, 03, 01, 05, 01, 02] +Raw bytes (65): 0x[01, 01, 05, 01, 05, 05, 09, 01, 09, 01, 13, 09, 0d, 09, 01, 1c, 01, 00, 2f, 01, 01, 09, 00, 0a, 01, 00, 0d, 00, 0e, 20, 05, 02, 00, 0d, 00, 0e, 05, 00, 12, 00, 13, 20, 09, 06, 00, 12, 00, 13, 0a, 00, 17, 00, 18, 20, 0d, 0e, 00, 17, 00, 18, 01, 01, 05, 01, 02] Number of files: 1 - file 0 => global file 1 Number of expressions: 5 -- expression 0 operands: lhs = Expression(1, Add), rhs = Counter(4) -- expression 1 operands: lhs = Counter(2), rhs = Counter(3) -- expression 2 operands: lhs = Counter(0), rhs = Counter(1) -- expression 3 operands: lhs = Counter(1), rhs = Counter(2) -- expression 4 operands: lhs = Counter(0), rhs = Counter(2) +- expression 0 operands: lhs = Counter(0), rhs = Counter(1) +- expression 1 operands: lhs = Counter(1), rhs = Counter(2) +- expression 2 operands: lhs = Counter(0), rhs = Counter(2) +- expression 3 operands: lhs = Counter(0), rhs = Expression(4, Add) +- expression 4 operands: lhs = Counter(2), rhs = Counter(3) Number of file 0 mappings: 9 - Code(Counter(0)) at (prev + 28, 1) to (start + 0, 47) -- Code(Expression(0, Add)) at (prev + 1, 9) to (start + 0, 10) - = ((c2 + c3) + c4) +- Code(Counter(0)) at (prev + 1, 9) to (start + 0, 10) - Code(Counter(0)) at (prev + 0, 13) to (start + 0, 14) -- Branch { true: Counter(1), false: Expression(2, Sub) } at (prev + 0, 13) to (start + 0, 14) +- Branch { true: Counter(1), false: Expression(0, Sub) } at (prev + 0, 13) to (start + 0, 14) true = c1 false = (c0 - c1) - Code(Counter(1)) at (prev + 0, 18) to (start + 0, 19) -- Branch { true: Counter(2), false: Expression(3, Sub) } at (prev + 0, 18) to (start + 0, 19) +- Branch { true: Counter(2), false: Expression(1, Sub) } at (prev + 0, 18) to (start + 0, 19) true = c2 false = (c1 - c2) -- Code(Expression(4, Sub)) at (prev + 0, 23) to (start + 0, 24) +- Code(Expression(2, Sub)) at (prev + 0, 23) to (start + 0, 24) = (c0 - c2) -- Branch { true: Counter(3), false: Counter(4) } at (prev + 0, 23) to (start + 0, 24) +- Branch { true: Counter(3), false: Expression(3, Sub) } at (prev + 0, 23) to (start + 0, 24) true = c3 - false = c4 -- Code(Expression(0, Add)) at (prev + 1, 5) to (start + 1, 2) - = ((c2 + c3) + c4) -Highest counter ID seen: c4 + false = (c0 - (c2 + c3)) +- Code(Counter(0)) at (prev + 1, 5) to (start + 1, 2) +Highest counter ID seen: c3 Function name: conditions::assign_3_or_and -Raw bytes (73): 0x[01, 01, 09, 07, 11, 0b, 0d, 05, 09, 01, 05, 01, 05, 01, 23, 05, 11, 01, 23, 05, 11, 09, 01, 17, 01, 00, 2f, 03, 01, 09, 00, 0a, 01, 00, 0d, 00, 0e, 20, 05, 12, 00, 0d, 00, 0e, 12, 00, 12, 00, 13, 20, 1e, 11, 00, 12, 00, 13, 1e, 00, 17, 00, 18, 20, 09, 0d, 00, 17, 00, 18, 03, 01, 05, 01, 02] +Raw bytes (63): 0x[01, 01, 04, 01, 05, 01, 0b, 05, 09, 09, 0d, 09, 01, 17, 01, 00, 2f, 01, 01, 09, 00, 0a, 01, 00, 0d, 00, 0e, 20, 05, 02, 00, 0d, 00, 0e, 02, 00, 12, 00, 13, 20, 09, 06, 00, 12, 00, 13, 09, 00, 17, 00, 18, 20, 0d, 0e, 00, 17, 00, 18, 01, 01, 05, 01, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 9 -- expression 0 operands: lhs = Expression(1, Add), rhs = Counter(4) -- expression 1 operands: lhs = Expression(2, Add), rhs = Counter(3) +Number of expressions: 4 +- expression 0 operands: lhs = Counter(0), rhs = Counter(1) +- expression 1 operands: lhs = Counter(0), rhs = Expression(2, Add) - expression 2 operands: lhs = Counter(1), rhs = Counter(2) -- expression 3 operands: lhs = Counter(0), rhs = Counter(1) -- expression 4 operands: lhs = Counter(0), rhs = Counter(1) -- expression 5 operands: lhs = Counter(0), rhs = Expression(8, Add) -- expression 6 operands: lhs = Counter(1), rhs = Counter(4) -- expression 7 operands: lhs = Counter(0), rhs = Expression(8, Add) -- expression 8 operands: lhs = Counter(1), rhs = Counter(4) +- expression 3 operands: lhs = Counter(2), rhs = Counter(3) Number of file 0 mappings: 9 - Code(Counter(0)) at (prev + 23, 1) to (start + 0, 47) -- Code(Expression(0, Add)) at (prev + 1, 9) to (start + 0, 10) - = (((c1 + c2) + c3) + c4) +- Code(Counter(0)) at (prev + 1, 9) to (start + 0, 10) - Code(Counter(0)) at (prev + 0, 13) to (start + 0, 14) -- Branch { true: Counter(1), false: Expression(4, Sub) } at (prev + 0, 13) to (start + 0, 14) +- Branch { true: Counter(1), false: Expression(0, Sub) } at (prev + 0, 13) to (start + 0, 14) true = c1 false = (c0 - c1) -- Code(Expression(4, Sub)) at (prev + 0, 18) to (start + 0, 19) +- Code(Expression(0, Sub)) at (prev + 0, 18) to (start + 0, 19) = (c0 - c1) -- Branch { true: Expression(7, Sub), false: Counter(4) } at (prev + 0, 18) to (start + 0, 19) - true = (c0 - (c1 + c4)) - false = c4 -- Code(Expression(7, Sub)) at (prev + 0, 23) to (start + 0, 24) - = (c0 - (c1 + c4)) -- Branch { true: Counter(2), false: Counter(3) } at (prev + 0, 23) to (start + 0, 24) +- Branch { true: Counter(2), false: Expression(1, Sub) } at (prev + 0, 18) to (start + 0, 19) true = c2 - false = c3 -- Code(Expression(0, Add)) at (prev + 1, 5) to (start + 1, 2) - = (((c1 + c2) + c3) + c4) -Highest counter ID seen: c4 + false = (c0 - (c1 + c2)) +- Code(Counter(2)) at (prev + 0, 23) to (start + 0, 24) +- Branch { true: Counter(3), false: Expression(3, Sub) } at (prev + 0, 23) to (start + 0, 24) + true = c3 + false = (c2 - c3) +- Code(Counter(0)) at (prev + 1, 5) to (start + 1, 2) +Highest counter ID seen: c3 Function name: conditions::assign_and -Raw bytes (51): 0x[01, 01, 04, 07, 05, 0b, 0d, 01, 09, 01, 05, 07, 01, 0d, 01, 00, 21, 02, 01, 09, 00, 0a, 01, 00, 0d, 00, 0e, 20, 05, 0e, 00, 0d, 00, 0e, 05, 00, 12, 00, 13, 20, 09, 0d, 00, 12, 00, 13, 02, 01, 05, 01, 02] +Raw bytes (47): 0x[01, 01, 02, 01, 05, 05, 09, 07, 01, 0d, 01, 00, 21, 01, 01, 09, 00, 0a, 01, 00, 0d, 00, 0e, 20, 05, 02, 00, 0d, 00, 0e, 05, 00, 12, 00, 13, 20, 09, 06, 00, 12, 00, 13, 01, 01, 05, 01, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 4 -- expression 0 operands: lhs = Expression(1, Add), rhs = Counter(1) -- expression 1 operands: lhs = Expression(2, Add), rhs = Counter(3) -- expression 2 operands: lhs = Counter(0), rhs = Counter(2) -- expression 3 operands: lhs = Counter(0), rhs = Counter(1) +Number of expressions: 2 +- expression 0 operands: lhs = Counter(0), rhs = Counter(1) +- expression 1 operands: lhs = Counter(1), rhs = Counter(2) Number of file 0 mappings: 7 - Code(Counter(0)) at (prev + 13, 1) to (start + 0, 33) -- Code(Expression(0, Sub)) at (prev + 1, 9) to (start + 0, 10) - = (((c0 + c2) + c3) - c1) +- Code(Counter(0)) at (prev + 1, 9) to (start + 0, 10) - Code(Counter(0)) at (prev + 0, 13) to (start + 0, 14) -- Branch { true: Counter(1), false: Expression(3, Sub) } at (prev + 0, 13) to (start + 0, 14) +- Branch { true: Counter(1), false: Expression(0, Sub) } at (prev + 0, 13) to (start + 0, 14) true = c1 false = (c0 - c1) - Code(Counter(1)) at (prev + 0, 18) to (start + 0, 19) -- Branch { true: Counter(2), false: Counter(3) } at (prev + 0, 18) to (start + 0, 19) +- Branch { true: Counter(2), false: Expression(1, Sub) } at (prev + 0, 18) to (start + 0, 19) true = c2 - false = c3 -- Code(Expression(0, Sub)) at (prev + 1, 5) to (start + 1, 2) - = (((c0 + c2) + c3) - c1) -Highest counter ID seen: c3 + false = (c1 - c2) +- Code(Counter(0)) at (prev + 1, 5) to (start + 1, 2) +Highest counter ID seen: c2 Function name: conditions::assign_or -Raw bytes (51): 0x[01, 01, 04, 07, 0d, 05, 09, 01, 05, 01, 05, 07, 01, 12, 01, 00, 20, 03, 01, 09, 00, 0a, 01, 00, 0d, 00, 0e, 20, 05, 0e, 00, 0d, 00, 0e, 0e, 00, 12, 00, 13, 20, 09, 0d, 00, 12, 00, 13, 03, 01, 05, 01, 02] +Raw bytes (49): 0x[01, 01, 03, 01, 05, 01, 0b, 05, 09, 07, 01, 12, 01, 00, 20, 01, 01, 09, 00, 0a, 01, 00, 0d, 00, 0e, 20, 05, 02, 00, 0d, 00, 0e, 02, 00, 12, 00, 13, 20, 09, 06, 00, 12, 00, 13, 01, 01, 05, 01, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 4 -- expression 0 operands: lhs = Expression(1, Add), rhs = Counter(3) -- expression 1 operands: lhs = Counter(1), rhs = Counter(2) -- expression 2 operands: lhs = Counter(0), rhs = Counter(1) -- expression 3 operands: lhs = Counter(0), rhs = Counter(1) +Number of expressions: 3 +- expression 0 operands: lhs = Counter(0), rhs = Counter(1) +- expression 1 operands: lhs = Counter(0), rhs = Expression(2, Add) +- expression 2 operands: lhs = Counter(1), rhs = Counter(2) Number of file 0 mappings: 7 - Code(Counter(0)) at (prev + 18, 1) to (start + 0, 32) -- Code(Expression(0, Add)) at (prev + 1, 9) to (start + 0, 10) - = ((c1 + c2) + c3) +- Code(Counter(0)) at (prev + 1, 9) to (start + 0, 10) - Code(Counter(0)) at (prev + 0, 13) to (start + 0, 14) -- Branch { true: Counter(1), false: Expression(3, Sub) } at (prev + 0, 13) to (start + 0, 14) +- Branch { true: Counter(1), false: Expression(0, Sub) } at (prev + 0, 13) to (start + 0, 14) true = c1 false = (c0 - c1) -- Code(Expression(3, Sub)) at (prev + 0, 18) to (start + 0, 19) +- Code(Expression(0, Sub)) at (prev + 0, 18) to (start + 0, 19) = (c0 - c1) -- Branch { true: Counter(2), false: Counter(3) } at (prev + 0, 18) to (start + 0, 19) +- Branch { true: Counter(2), false: Expression(1, Sub) } at (prev + 0, 18) to (start + 0, 19) true = c2 - false = c3 -- Code(Expression(0, Add)) at (prev + 1, 5) to (start + 1, 2) - = ((c1 + c2) + c3) -Highest counter ID seen: c3 + false = (c0 - (c1 + c2)) +- Code(Counter(0)) at (prev + 1, 5) to (start + 1, 2) +Highest counter ID seen: c2 Function name: conditions::foo Raw bytes (9): 0x[01, 01, 00, 01, 01, 21, 01, 02, 02] @@ -126,26 +109,23 @@ Number of file 0 mappings: 1 Highest counter ID seen: c0 Function name: conditions::func_call -Raw bytes (41): 0x[01, 01, 04, 01, 05, 0b, 05, 0f, 0d, 01, 09, 05, 01, 25, 01, 01, 0a, 20, 05, 02, 01, 09, 00, 0a, 05, 00, 0e, 00, 0f, 20, 09, 0d, 00, 0e, 00, 0f, 06, 01, 01, 00, 02] +Raw bytes (37): 0x[01, 01, 02, 01, 05, 05, 09, 05, 01, 25, 01, 01, 0a, 20, 05, 02, 01, 09, 00, 0a, 05, 00, 0e, 00, 0f, 20, 09, 06, 00, 0e, 00, 0f, 01, 01, 01, 00, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 4 +Number of expressions: 2 - expression 0 operands: lhs = Counter(0), rhs = Counter(1) -- expression 1 operands: lhs = Expression(2, Add), rhs = Counter(1) -- expression 2 operands: lhs = Expression(3, Add), rhs = Counter(3) -- expression 3 operands: lhs = Counter(0), rhs = Counter(2) +- expression 1 operands: lhs = Counter(1), rhs = Counter(2) Number of file 0 mappings: 5 - Code(Counter(0)) at (prev + 37, 1) to (start + 1, 10) - Branch { true: Counter(1), false: Expression(0, Sub) } at (prev + 1, 9) to (start + 0, 10) true = c1 false = (c0 - c1) - Code(Counter(1)) at (prev + 0, 14) to (start + 0, 15) -- Branch { true: Counter(2), false: Counter(3) } at (prev + 0, 14) to (start + 0, 15) +- Branch { true: Counter(2), false: Expression(1, Sub) } at (prev + 0, 14) to (start + 0, 15) true = c2 - false = c3 -- Code(Expression(1, Sub)) at (prev + 1, 1) to (start + 0, 2) - = (((c0 + c2) + c3) - c1) -Highest counter ID seen: c3 + false = (c1 - c2) +- Code(Counter(0)) at (prev + 1, 1) to (start + 0, 2) +Highest counter ID seen: c2 Function name: conditions::simple_assign Raw bytes (9): 0x[01, 01, 00, 01, 01, 08, 01, 03, 02] diff --git a/tests/coverage/conditions.cov-map b/tests/coverage/conditions.cov-map index 21b2ec9a19e..549b8bb0a20 100644 --- a/tests/coverage/conditions.cov-map +++ b/tests/coverage/conditions.cov-map @@ -1,294 +1,192 @@ Function name: conditions::main -Raw bytes (873): 0x[01, 01, b2, 01, 07, 19, 0b, 15, 0f, 11, 09, 0d, 01, 09, 8d, 01, 0d, 8d, 01, 33, 0d, 11, 33, 15, 0d, 11, 2f, 19, 33, 15, 0d, 11, 01, c7, 05, 09, 8d, 01, 03, 21, 03, 47, 21, 89, 01, 03, 4f, db, 03, 89, 01, 21, 25, 03, 5b, d7, 03, 89, 01, db, 03, 29, 21, 25, 77, 2d, 25, 29, 73, 31, 77, 2d, 25, 29, d3, 03, 31, d7, 03, 2d, db, 03, 29, 21, 25, 35, 3d, 35, 93, 01, 3d, 85, 01, 35, 9b, 01, af, 01, 85, 01, 3d, 41, 35, a7, 01, ab, 01, 85, 01, af, 01, 45, 3d, 41, c3, 01, 49, 41, 45, bf, 01, 4d, c3, 01, 49, 41, 45, bb, 03, 35, bf, 03, 4d, c3, 03, 49, c7, 03, 45, cb, 03, 41, cf, 03, 3d, d3, 03, 31, d7, 03, 2d, db, 03, 29, 21, 25, f3, 04, 65, f7, 04, 61, fb, 04, 5d, 55, 59, bb, 03, 35, bf, 03, 4d, c3, 03, 49, c7, 03, 45, cb, 03, 41, cf, 03, 3d, d3, 03, 31, d7, 03, 2d, db, 03, 29, 21, 25, bb, 03, eb, 03, bf, 03, 4d, c3, 03, 49, c7, 03, 45, cb, 03, 41, cf, 03, 3d, d3, 03, 31, d7, 03, 2d, db, 03, 29, 21, 25, 35, 55, bb, 03, fb, 02, bf, 03, 4d, c3, 03, 49, c7, 03, 45, cb, 03, 41, cf, 03, 3d, d3, 03, 31, d7, 03, 2d, db, 03, 29, 21, 25, eb, 03, 81, 01, 35, 55, bb, 03, ab, 03, bf, 03, 4d, c3, 03, 49, c7, 03, 45, cb, 03, 41, cf, 03, 3d, d3, 03, 31, d7, 03, 2d, db, 03, 29, 21, 25, e7, 03, 81, 01, eb, 03, 59, 35, 55, bb, 03, df, 03, bf, 03, 4d, c3, 03, 49, c7, 03, 45, cb, 03, 41, cf, 03, 3d, d3, 03, 31, d7, 03, 2d, db, 03, 29, 21, 25, e3, 03, 81, 01, e7, 03, 5d, eb, 03, 59, 35, 55, ff, 03, 61, 59, 5d, fb, 03, 65, ff, 03, 61, 59, 5d, 87, 04, 79, 83, 05, 75, 87, 05, 71, 69, 6d, f3, 04, 65, f7, 04, 61, fb, 04, 5d, 55, 59, ef, 04, 69, f3, 04, 65, f7, 04, 61, fb, 04, 5d, 55, 59, ef, 04, cb, 04, f3, 04, 65, f7, 04, 61, fb, 04, 5d, 55, 59, 69, 7d, ef, 04, e3, 04, f3, 04, 65, f7, 04, 61, fb, 04, 5d, 55, 59, 87, 05, 7d, 69, 6d, ef, 04, ff, 04, f3, 04, 65, f7, 04, 61, fb, 04, 5d, 55, 59, 83, 05, 7d, 87, 05, 71, 69, 6d, 9b, 05, 75, 6d, 71, 97, 05, 79, 9b, 05, 75, 6d, 71, a3, 05, c7, 05, a7, 05, 89, 01, ab, 05, 85, 01, af, 05, 81, 01, b3, 05, 7d, b7, 05, 79, bb, 05, 75, bf, 05, 71, c3, 05, 6d, 01, 69, 09, 8d, 01, 44, 01, 03, 01, 02, 0c, 05, 02, 0d, 02, 06, 00, 02, 05, 00, 06, 03, 03, 09, 00, 0a, 01, 00, 10, 00, 1d, 09, 01, 09, 01, 0a, 12, 02, 0f, 00, 1c, 8d, 01, 01, 0c, 00, 19, 16, 00, 1d, 00, 2a, 1a, 00, 2e, 00, 3c, 2f, 00, 3d, 02, 0a, 19, 02, 09, 00, 0a, 2b, 01, 09, 01, 12, 36, 03, 09, 00, 0f, 03, 03, 09, 01, 0c, 1d, 01, 0d, 02, 06, 00, 02, 05, 00, 06, 03, 02, 08, 00, 15, 21, 00, 16, 02, 06, 3e, 02, 0f, 00, 1c, 42, 01, 0c, 00, 19, 4a, 00, 1d, 00, 2a, 56, 00, 2e, 00, 3c, 73, 00, 3d, 02, 0a, 31, 02, 09, 00, 0a, 6f, 01, 09, 00, 17, 89, 01, 02, 09, 00, 0f, cf, 03, 03, 08, 00, 0c, 35, 01, 0d, 01, 10, 39, 01, 11, 02, 0a, 00, 02, 09, 00, 0a, 35, 02, 0c, 00, 19, 3d, 00, 1a, 02, 0a, 8a, 01, 04, 11, 00, 1e, 8e, 01, 01, 10, 00, 1d, 96, 01, 00, 21, 00, 2e, a2, 01, 00, 32, 00, 40, bf, 01, 00, 41, 02, 0e, 4d, 02, 0d, 00, 0e, bb, 01, 01, 0d, 00, 1b, 85, 01, 02, 0d, 00, 13, 00, 02, 05, 00, 06, fe, 01, 02, 09, 01, 0c, 51, 01, 0d, 02, 06, 00, 02, 05, 00, 06, ef, 04, 02, 09, 00, 0a, fe, 01, 00, 10, 00, 1d, 55, 00, 1e, 02, 06, a6, 02, 02, 0f, 00, 1c, d2, 02, 01, 0c, 00, 19, 82, 03, 00, 1d, 00, 2a, b6, 03, 00, 2e, 00, 3c, fb, 03, 00, 3d, 02, 0a, 65, 02, 09, 00, 0a, f7, 03, 01, 09, 00, 17, 81, 01, 02, 0d, 02, 0f, 83, 04, 05, 09, 00, 0a, ef, 04, 00, 10, 00, 1d, 69, 00, 1e, 02, 06, a2, 04, 02, 0f, 00, 1c, b6, 04, 01, 0c, 00, 19, ce, 04, 00, 1d, 00, 2a, ea, 04, 00, 2e, 00, 3c, 97, 05, 00, 3d, 02, 0a, 79, 02, 09, 00, 0a, 93, 05, 01, 09, 00, 17, 7d, 02, 09, 00, 0f, 9e, 05, 02, 01, 00, 02] +Raw bytes (545): 0x[01, 01, 4d, 09, 0d, 01, 09, 0d, 71, 0d, 27, 71, 75, 27, 79, 71, 75, 0d, 23, 27, 79, 71, 75, 01, 03, 03, 15, 19, 65, 19, 4f, 65, 69, 4f, 6d, 65, 69, 19, 4b, 4f, 6d, 65, 69, 03, ef, 01, 15, 19, 15, 19, 1d, 25, 29, 59, 29, 7f, 59, 5d, 7f, 61, 59, 5d, 29, 7b, 7f, 61, 59, 5d, 1d, 87, 01, 25, 29, e7, 01, 1d, eb, 01, 29, ef, 01, 25, 15, 19, 31, 35, e7, 01, 1d, eb, 01, 29, ef, 01, 25, 15, 19, e7, 01, f7, 01, eb, 01, 29, ef, 01, 25, 15, 19, 1d, 31, 35, 4d, 35, df, 01, 4d, 51, df, 01, 55, 4d, 51, 35, db, 01, df, 01, 55, 4d, 51, e7, 01, f3, 01, eb, 01, 29, ef, 01, 25, 15, 19, f7, 01, 35, 1d, 31, 39, 3d, 31, 35, af, 02, 39, 31, 35, 3d, 41, 3d, a7, 02, 41, 45, a7, 02, 49, 41, 45, 3d, a3, 02, a7, 02, 49, 41, 45, af, 02, b3, 02, 31, 35, 39, 3d, 44, 01, 03, 01, 02, 0c, 05, 02, 0d, 02, 06, 00, 02, 05, 00, 06, 03, 03, 09, 00, 0a, 01, 00, 10, 00, 1d, 09, 01, 09, 01, 0a, 06, 02, 0f, 00, 1c, 0d, 01, 0c, 00, 19, 0a, 00, 1d, 00, 2a, 0e, 00, 2e, 00, 3c, 23, 00, 3d, 02, 0a, 1e, 02, 09, 00, 0a, 0d, 01, 09, 01, 12, 2a, 03, 09, 00, 0f, 03, 03, 09, 01, 0c, 11, 01, 0d, 02, 06, 00, 02, 05, 00, 06, 03, 02, 08, 00, 15, 15, 00, 16, 02, 06, 2e, 02, 0f, 00, 1c, 19, 01, 0c, 00, 19, 32, 00, 1d, 00, 2a, 36, 00, 2e, 00, 3c, 4b, 00, 3d, 02, 0a, 46, 02, 09, 00, 0a, 19, 01, 09, 00, 17, 52, 02, 09, 00, 0f, ef, 01, 03, 08, 00, 0c, 1d, 01, 0d, 01, 10, 21, 01, 11, 02, 0a, 00, 02, 09, 00, 0a, 1d, 02, 0c, 00, 19, 25, 00, 1a, 02, 0a, 5e, 04, 11, 00, 1e, 29, 01, 10, 00, 1d, 62, 00, 21, 00, 2e, 66, 00, 32, 00, 40, 7b, 00, 41, 02, 0e, 76, 02, 0d, 00, 0e, 29, 01, 0d, 00, 1b, 82, 01, 02, 0d, 00, 13, 00, 02, 05, 00, 06, 9e, 01, 02, 09, 01, 0c, 2d, 01, 0d, 02, 06, 00, 02, 05, 00, 06, af, 02, 02, 09, 00, 0a, 9e, 01, 00, 10, 00, 1d, 31, 00, 1e, 02, 06, ae, 01, 02, 0f, 00, 1c, 35, 01, 0c, 00, 19, c2, 01, 00, 1d, 00, 2a, c6, 01, 00, 2e, 00, 3c, db, 01, 00, 3d, 02, 0a, d6, 01, 02, 09, 00, 0a, 35, 01, 09, 00, 17, e2, 01, 02, 0d, 02, 0f, b3, 02, 05, 09, 00, 0a, af, 02, 00, 10, 00, 1d, 39, 00, 1e, 02, 06, 82, 02, 02, 0f, 00, 1c, 3d, 01, 0c, 00, 19, 8a, 02, 00, 1d, 00, 2a, 8e, 02, 00, 2e, 00, 3c, a3, 02, 00, 3d, 02, 0a, 9e, 02, 02, 09, 00, 0a, 3d, 01, 09, 00, 17, aa, 02, 02, 09, 00, 0f, 01, 02, 01, 00, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 178 -- expression 0 operands: lhs = Expression(1, Add), rhs = Counter(6) -- expression 1 operands: lhs = Expression(2, Add), rhs = Counter(5) -- expression 2 operands: lhs = Expression(3, Add), rhs = Counter(4) -- expression 3 operands: lhs = Counter(2), rhs = Counter(3) -- expression 4 operands: lhs = Counter(0), rhs = Counter(2) -- expression 5 operands: lhs = Counter(35), rhs = Counter(3) -- expression 6 operands: lhs = Counter(35), rhs = Expression(12, Add) -- expression 7 operands: lhs = Counter(3), rhs = Counter(4) -- expression 8 operands: lhs = Expression(12, Add), rhs = Counter(5) -- expression 9 operands: lhs = Counter(3), rhs = Counter(4) -- expression 10 operands: lhs = Expression(11, Add), rhs = Counter(6) -- expression 11 operands: lhs = Expression(12, Add), rhs = Counter(5) -- expression 12 operands: lhs = Counter(3), rhs = Counter(4) -- expression 13 operands: lhs = Counter(0), rhs = Expression(177, Add) -- expression 14 operands: lhs = Counter(2), rhs = Counter(35) -- expression 15 operands: lhs = Expression(0, Add), rhs = Counter(8) -- expression 16 operands: lhs = Expression(0, Add), rhs = Expression(17, Add) -- expression 17 operands: lhs = Counter(8), rhs = Counter(34) -- expression 18 operands: lhs = Expression(0, Add), rhs = Expression(19, Add) -- expression 19 operands: lhs = Expression(118, Add), rhs = Counter(34) -- expression 20 operands: lhs = Counter(8), rhs = Counter(9) -- expression 21 operands: lhs = Expression(0, Add), rhs = Expression(22, Add) -- expression 22 operands: lhs = Expression(117, Add), rhs = Counter(34) -- expression 23 operands: lhs = Expression(118, Add), rhs = Counter(10) -- expression 24 operands: lhs = Counter(8), rhs = Counter(9) -- expression 25 operands: lhs = Expression(29, Add), rhs = Counter(11) -- expression 26 operands: lhs = Counter(9), rhs = Counter(10) -- expression 27 operands: lhs = Expression(28, Add), rhs = Counter(12) -- expression 28 operands: lhs = Expression(29, Add), rhs = Counter(11) -- expression 29 operands: lhs = Counter(9), rhs = Counter(10) -- expression 30 operands: lhs = Expression(116, Add), rhs = Counter(12) -- expression 31 operands: lhs = Expression(117, Add), rhs = Counter(11) -- expression 32 operands: lhs = Expression(118, Add), rhs = Counter(10) -- expression 33 operands: lhs = Counter(8), rhs = Counter(9) -- expression 34 operands: lhs = Counter(13), rhs = Counter(15) -- expression 35 operands: lhs = Counter(13), rhs = Expression(36, Add) -- expression 36 operands: lhs = Counter(15), rhs = Counter(33) -- expression 37 operands: lhs = Counter(13), rhs = Expression(38, Add) -- expression 38 operands: lhs = Expression(43, Add), rhs = Counter(33) -- expression 39 operands: lhs = Counter(15), rhs = Counter(16) -- expression 40 operands: lhs = Counter(13), rhs = Expression(41, Add) -- expression 41 operands: lhs = Expression(42, Add), rhs = Counter(33) -- expression 42 operands: lhs = Expression(43, Add), rhs = Counter(17) -- expression 43 operands: lhs = Counter(15), rhs = Counter(16) -- expression 44 operands: lhs = Expression(48, Add), rhs = Counter(18) -- expression 45 operands: lhs = Counter(16), rhs = Counter(17) -- expression 46 operands: lhs = Expression(47, Add), rhs = Counter(19) -- expression 47 operands: lhs = Expression(48, Add), rhs = Counter(18) -- expression 48 operands: lhs = Counter(16), rhs = Counter(17) -- expression 49 operands: lhs = Expression(110, Add), rhs = Counter(13) -- expression 50 operands: lhs = Expression(111, Add), rhs = Counter(19) -- expression 51 operands: lhs = Expression(112, Add), rhs = Counter(18) -- expression 52 operands: lhs = Expression(113, Add), rhs = Counter(17) -- expression 53 operands: lhs = Expression(114, Add), rhs = Counter(16) -- expression 54 operands: lhs = Expression(115, Add), rhs = Counter(15) -- expression 55 operands: lhs = Expression(116, Add), rhs = Counter(12) -- expression 56 operands: lhs = Expression(117, Add), rhs = Counter(11) -- expression 57 operands: lhs = Expression(118, Add), rhs = Counter(10) -- expression 58 operands: lhs = Counter(8), rhs = Counter(9) -- expression 59 operands: lhs = Expression(156, Add), rhs = Counter(25) -- expression 60 operands: lhs = Expression(157, Add), rhs = Counter(24) -- expression 61 operands: lhs = Expression(158, Add), rhs = Counter(23) -- expression 62 operands: lhs = Counter(21), rhs = Counter(22) -- expression 63 operands: lhs = Expression(110, Add), rhs = Counter(13) -- expression 64 operands: lhs = Expression(111, Add), rhs = Counter(19) -- expression 65 operands: lhs = Expression(112, Add), rhs = Counter(18) -- expression 66 operands: lhs = Expression(113, Add), rhs = Counter(17) -- expression 67 operands: lhs = Expression(114, Add), rhs = Counter(16) -- expression 68 operands: lhs = Expression(115, Add), rhs = Counter(15) -- expression 69 operands: lhs = Expression(116, Add), rhs = Counter(12) -- expression 70 operands: lhs = Expression(117, Add), rhs = Counter(11) -- expression 71 operands: lhs = Expression(118, Add), rhs = Counter(10) -- expression 72 operands: lhs = Counter(8), rhs = Counter(9) -- expression 73 operands: lhs = Expression(110, Add), rhs = Expression(122, Add) -- expression 74 operands: lhs = Expression(111, Add), rhs = Counter(19) -- expression 75 operands: lhs = Expression(112, Add), rhs = Counter(18) -- expression 76 operands: lhs = Expression(113, Add), rhs = Counter(17) -- expression 77 operands: lhs = Expression(114, Add), rhs = Counter(16) -- expression 78 operands: lhs = Expression(115, Add), rhs = Counter(15) -- expression 79 operands: lhs = Expression(116, Add), rhs = Counter(12) -- expression 80 operands: lhs = Expression(117, Add), rhs = Counter(11) -- expression 81 operands: lhs = Expression(118, Add), rhs = Counter(10) -- expression 82 operands: lhs = Counter(8), rhs = Counter(9) -- expression 83 operands: lhs = Counter(13), rhs = Counter(21) -- expression 84 operands: lhs = Expression(110, Add), rhs = Expression(94, Add) -- expression 85 operands: lhs = Expression(111, Add), rhs = Counter(19) -- expression 86 operands: lhs = Expression(112, Add), rhs = Counter(18) -- expression 87 operands: lhs = Expression(113, Add), rhs = Counter(17) -- expression 88 operands: lhs = Expression(114, Add), rhs = Counter(16) -- expression 89 operands: lhs = Expression(115, Add), rhs = Counter(15) -- expression 90 operands: lhs = Expression(116, Add), rhs = Counter(12) -- expression 91 operands: lhs = Expression(117, Add), rhs = Counter(11) -- expression 92 operands: lhs = Expression(118, Add), rhs = Counter(10) -- expression 93 operands: lhs = Counter(8), rhs = Counter(9) -- expression 94 operands: lhs = Expression(122, Add), rhs = Counter(32) -- expression 95 operands: lhs = Counter(13), rhs = Counter(21) -- expression 96 operands: lhs = Expression(110, Add), rhs = Expression(106, Add) -- expression 97 operands: lhs = Expression(111, Add), rhs = Counter(19) -- expression 98 operands: lhs = Expression(112, Add), rhs = Counter(18) -- expression 99 operands: lhs = Expression(113, Add), rhs = Counter(17) -- expression 100 operands: lhs = Expression(114, Add), rhs = Counter(16) -- expression 101 operands: lhs = Expression(115, Add), rhs = Counter(15) -- expression 102 operands: lhs = Expression(116, Add), rhs = Counter(12) -- expression 103 operands: lhs = Expression(117, Add), rhs = Counter(11) -- expression 104 operands: lhs = Expression(118, Add), rhs = Counter(10) -- expression 105 operands: lhs = Counter(8), rhs = Counter(9) -- expression 106 operands: lhs = Expression(121, Add), rhs = Counter(32) -- expression 107 operands: lhs = Expression(122, Add), rhs = Counter(22) -- expression 108 operands: lhs = Counter(13), rhs = Counter(21) -- expression 109 operands: lhs = Expression(110, Add), rhs = Expression(119, Add) -- expression 110 operands: lhs = Expression(111, Add), rhs = Counter(19) -- expression 111 operands: lhs = Expression(112, Add), rhs = Counter(18) -- expression 112 operands: lhs = Expression(113, Add), rhs = Counter(17) -- expression 113 operands: lhs = Expression(114, Add), rhs = Counter(16) -- expression 114 operands: lhs = Expression(115, Add), rhs = Counter(15) -- expression 115 operands: lhs = Expression(116, Add), rhs = Counter(12) -- expression 116 operands: lhs = Expression(117, Add), rhs = Counter(11) -- expression 117 operands: lhs = Expression(118, Add), rhs = Counter(10) -- expression 118 operands: lhs = Counter(8), rhs = Counter(9) -- expression 119 operands: lhs = Expression(120, Add), rhs = Counter(32) -- expression 120 operands: lhs = Expression(121, Add), rhs = Counter(23) -- expression 121 operands: lhs = Expression(122, Add), rhs = Counter(22) -- expression 122 operands: lhs = Counter(13), rhs = Counter(21) -- expression 123 operands: lhs = Expression(127, Add), rhs = Counter(24) -- expression 124 operands: lhs = Counter(22), rhs = Counter(23) -- expression 125 operands: lhs = Expression(126, Add), rhs = Counter(25) -- expression 126 operands: lhs = Expression(127, Add), rhs = Counter(24) -- expression 127 operands: lhs = Counter(22), rhs = Counter(23) -- expression 128 operands: lhs = Expression(129, Add), rhs = Counter(30) -- expression 129 operands: lhs = Expression(160, Add), rhs = Counter(29) -- expression 130 operands: lhs = Expression(161, Add), rhs = Counter(28) -- expression 131 operands: lhs = Counter(26), rhs = Counter(27) -- expression 132 operands: lhs = Expression(156, Add), rhs = Counter(25) -- expression 133 operands: lhs = Expression(157, Add), rhs = Counter(24) -- expression 134 operands: lhs = Expression(158, Add), rhs = Counter(23) -- expression 135 operands: lhs = Counter(21), rhs = Counter(22) -- expression 136 operands: lhs = Expression(155, Add), rhs = Counter(26) -- expression 137 operands: lhs = Expression(156, Add), rhs = Counter(25) -- expression 138 operands: lhs = Expression(157, Add), rhs = Counter(24) -- expression 139 operands: lhs = Expression(158, Add), rhs = Counter(23) -- expression 140 operands: lhs = Counter(21), rhs = Counter(22) -- expression 141 operands: lhs = Expression(155, Add), rhs = Expression(146, Add) -- expression 142 operands: lhs = Expression(156, Add), rhs = Counter(25) -- expression 143 operands: lhs = Expression(157, Add), rhs = Counter(24) -- expression 144 operands: lhs = Expression(158, Add), rhs = Counter(23) -- expression 145 operands: lhs = Counter(21), rhs = Counter(22) -- expression 146 operands: lhs = Counter(26), rhs = Counter(31) -- expression 147 operands: lhs = Expression(155, Add), rhs = Expression(152, Add) -- expression 148 operands: lhs = Expression(156, Add), rhs = Counter(25) -- expression 149 operands: lhs = Expression(157, Add), rhs = Counter(24) -- expression 150 operands: lhs = Expression(158, Add), rhs = Counter(23) -- expression 151 operands: lhs = Counter(21), rhs = Counter(22) -- expression 152 operands: lhs = Expression(161, Add), rhs = Counter(31) -- expression 153 operands: lhs = Counter(26), rhs = Counter(27) -- expression 154 operands: lhs = Expression(155, Add), rhs = Expression(159, Add) -- expression 155 operands: lhs = Expression(156, Add), rhs = Counter(25) -- expression 156 operands: lhs = Expression(157, Add), rhs = Counter(24) -- expression 157 operands: lhs = Expression(158, Add), rhs = Counter(23) -- expression 158 operands: lhs = Counter(21), rhs = Counter(22) -- expression 159 operands: lhs = Expression(160, Add), rhs = Counter(31) -- expression 160 operands: lhs = Expression(161, Add), rhs = Counter(28) -- expression 161 operands: lhs = Counter(26), rhs = Counter(27) -- expression 162 operands: lhs = Expression(166, Add), rhs = Counter(29) -- expression 163 operands: lhs = Counter(27), rhs = Counter(28) -- expression 164 operands: lhs = Expression(165, Add), rhs = Counter(30) -- expression 165 operands: lhs = Expression(166, Add), rhs = Counter(29) -- expression 166 operands: lhs = Counter(27), rhs = Counter(28) -- expression 167 operands: lhs = Expression(168, Add), rhs = Expression(177, Add) -- expression 168 operands: lhs = Expression(169, Add), rhs = Counter(34) -- expression 169 operands: lhs = Expression(170, Add), rhs = Counter(33) -- expression 170 operands: lhs = Expression(171, Add), rhs = Counter(32) -- expression 171 operands: lhs = Expression(172, Add), rhs = Counter(31) -- expression 172 operands: lhs = Expression(173, Add), rhs = Counter(30) -- expression 173 operands: lhs = Expression(174, Add), rhs = Counter(29) -- expression 174 operands: lhs = Expression(175, Add), rhs = Counter(28) -- expression 175 operands: lhs = Expression(176, Add), rhs = Counter(27) -- expression 176 operands: lhs = Counter(0), rhs = Counter(26) -- expression 177 operands: lhs = Counter(2), rhs = Counter(35) +Number of expressions: 77 +- expression 0 operands: lhs = Counter(2), rhs = Counter(3) +- expression 1 operands: lhs = Counter(0), rhs = Counter(2) +- expression 2 operands: lhs = Counter(3), rhs = Counter(28) +- expression 3 operands: lhs = Counter(3), rhs = Expression(9, Add) +- expression 4 operands: lhs = Counter(28), rhs = Counter(29) +- expression 5 operands: lhs = Expression(9, Add), rhs = Counter(30) +- expression 6 operands: lhs = Counter(28), rhs = Counter(29) +- expression 7 operands: lhs = Counter(3), rhs = Expression(8, Add) +- expression 8 operands: lhs = Expression(9, Add), rhs = Counter(30) +- expression 9 operands: lhs = Counter(28), rhs = Counter(29) +- expression 10 operands: lhs = Counter(0), rhs = Expression(0, Add) +- expression 11 operands: lhs = Expression(0, Add), rhs = Counter(5) +- expression 12 operands: lhs = Counter(6), rhs = Counter(25) +- expression 13 operands: lhs = Counter(6), rhs = Expression(19, Add) +- expression 14 operands: lhs = Counter(25), rhs = Counter(26) +- expression 15 operands: lhs = Expression(19, Add), rhs = Counter(27) +- expression 16 operands: lhs = Counter(25), rhs = Counter(26) +- expression 17 operands: lhs = Counter(6), rhs = Expression(18, Add) +- expression 18 operands: lhs = Expression(19, Add), rhs = Counter(27) +- expression 19 operands: lhs = Counter(25), rhs = Counter(26) +- expression 20 operands: lhs = Expression(0, Add), rhs = Expression(59, Add) +- expression 21 operands: lhs = Counter(5), rhs = Counter(6) +- expression 22 operands: lhs = Counter(5), rhs = Counter(6) +- expression 23 operands: lhs = Counter(7), rhs = Counter(9) +- expression 24 operands: lhs = Counter(10), rhs = Counter(22) +- expression 25 operands: lhs = Counter(10), rhs = Expression(31, Add) +- expression 26 operands: lhs = Counter(22), rhs = Counter(23) +- expression 27 operands: lhs = Expression(31, Add), rhs = Counter(24) +- expression 28 operands: lhs = Counter(22), rhs = Counter(23) +- expression 29 operands: lhs = Counter(10), rhs = Expression(30, Add) +- expression 30 operands: lhs = Expression(31, Add), rhs = Counter(24) +- expression 31 operands: lhs = Counter(22), rhs = Counter(23) +- expression 32 operands: lhs = Counter(7), rhs = Expression(33, Add) +- expression 33 operands: lhs = Counter(9), rhs = Counter(10) +- expression 34 operands: lhs = Expression(57, Add), rhs = Counter(7) +- expression 35 operands: lhs = Expression(58, Add), rhs = Counter(10) +- expression 36 operands: lhs = Expression(59, Add), rhs = Counter(9) +- expression 37 operands: lhs = Counter(5), rhs = Counter(6) +- expression 38 operands: lhs = Counter(12), rhs = Counter(13) +- expression 39 operands: lhs = Expression(57, Add), rhs = Counter(7) +- expression 40 operands: lhs = Expression(58, Add), rhs = Counter(10) +- expression 41 operands: lhs = Expression(59, Add), rhs = Counter(9) +- expression 42 operands: lhs = Counter(5), rhs = Counter(6) +- expression 43 operands: lhs = Expression(57, Add), rhs = Expression(61, Add) +- expression 44 operands: lhs = Expression(58, Add), rhs = Counter(10) +- expression 45 operands: lhs = Expression(59, Add), rhs = Counter(9) +- expression 46 operands: lhs = Counter(5), rhs = Counter(6) +- expression 47 operands: lhs = Counter(7), rhs = Counter(12) +- expression 48 operands: lhs = Counter(13), rhs = Counter(19) +- expression 49 operands: lhs = Counter(13), rhs = Expression(55, Add) +- expression 50 operands: lhs = Counter(19), rhs = Counter(20) +- expression 51 operands: lhs = Expression(55, Add), rhs = Counter(21) +- expression 52 operands: lhs = Counter(19), rhs = Counter(20) +- expression 53 operands: lhs = Counter(13), rhs = Expression(54, Add) +- expression 54 operands: lhs = Expression(55, Add), rhs = Counter(21) +- expression 55 operands: lhs = Counter(19), rhs = Counter(20) +- expression 56 operands: lhs = Expression(57, Add), rhs = Expression(60, Add) +- expression 57 operands: lhs = Expression(58, Add), rhs = Counter(10) +- expression 58 operands: lhs = Expression(59, Add), rhs = Counter(9) +- expression 59 operands: lhs = Counter(5), rhs = Counter(6) +- expression 60 operands: lhs = Expression(61, Add), rhs = Counter(13) +- expression 61 operands: lhs = Counter(7), rhs = Counter(12) +- expression 62 operands: lhs = Counter(14), rhs = Counter(15) +- expression 63 operands: lhs = Counter(12), rhs = Counter(13) +- expression 64 operands: lhs = Expression(75, Add), rhs = Counter(14) +- expression 65 operands: lhs = Counter(12), rhs = Counter(13) +- expression 66 operands: lhs = Counter(15), rhs = Counter(16) +- expression 67 operands: lhs = Counter(15), rhs = Expression(73, Add) +- expression 68 operands: lhs = Counter(16), rhs = Counter(17) +- expression 69 operands: lhs = Expression(73, Add), rhs = Counter(18) +- expression 70 operands: lhs = Counter(16), rhs = Counter(17) +- expression 71 operands: lhs = Counter(15), rhs = Expression(72, Add) +- expression 72 operands: lhs = Expression(73, Add), rhs = Counter(18) +- expression 73 operands: lhs = Counter(16), rhs = Counter(17) +- expression 74 operands: lhs = Expression(75, Add), rhs = Expression(76, Add) +- expression 75 operands: lhs = Counter(12), rhs = Counter(13) +- expression 76 operands: lhs = Counter(14), rhs = Counter(15) Number of file 0 mappings: 68 - Code(Counter(0)) at (prev + 3, 1) to (start + 2, 12) - Code(Counter(1)) at (prev + 2, 13) to (start + 2, 6) - Code(Zero) at (prev + 2, 5) to (start + 0, 6) - Code(Expression(0, Add)) at (prev + 3, 9) to (start + 0, 10) - = ((((c2 + c3) + c4) + c5) + c6) + = (c2 + c3) - Code(Counter(0)) at (prev + 0, 16) to (start + 0, 29) - Code(Counter(2)) at (prev + 1, 9) to (start + 1, 10) -- Code(Expression(4, Sub)) at (prev + 2, 15) to (start + 0, 28) +- Code(Expression(1, Sub)) at (prev + 2, 15) to (start + 0, 28) = (c0 - c2) -- Code(Counter(35)) at (prev + 1, 12) to (start + 0, 25) -- Code(Expression(5, Sub)) at (prev + 0, 29) to (start + 0, 42) - = (c35 - c3) -- Code(Expression(6, Sub)) at (prev + 0, 46) to (start + 0, 60) - = (c35 - (c3 + c4)) -- Code(Expression(11, Add)) at (prev + 0, 61) to (start + 2, 10) - = ((c3 + c4) + c5) -- Code(Counter(6)) at (prev + 2, 9) to (start + 0, 10) -- Code(Expression(10, Add)) at (prev + 1, 9) to (start + 1, 18) - = (((c3 + c4) + c5) + c6) -- Code(Expression(13, Sub)) at (prev + 3, 9) to (start + 0, 15) - = (c0 - (c2 + c35)) +- Code(Counter(3)) at (prev + 1, 12) to (start + 0, 25) +- Code(Expression(2, Sub)) at (prev + 0, 29) to (start + 0, 42) + = (c3 - c28) +- Code(Expression(3, Sub)) at (prev + 0, 46) to (start + 0, 60) + = (c3 - (c28 + c29)) +- Code(Expression(8, Add)) at (prev + 0, 61) to (start + 2, 10) + = ((c28 + c29) + c30) +- Code(Expression(7, Sub)) at (prev + 2, 9) to (start + 0, 10) + = (c3 - ((c28 + c29) + c30)) +- Code(Counter(3)) at (prev + 1, 9) to (start + 1, 18) +- Code(Expression(10, Sub)) at (prev + 3, 9) to (start + 0, 15) + = (c0 - (c2 + c3)) - Code(Expression(0, Add)) at (prev + 3, 9) to (start + 1, 12) - = ((((c2 + c3) + c4) + c5) + c6) -- Code(Counter(7)) at (prev + 1, 13) to (start + 2, 6) + = (c2 + c3) +- Code(Counter(4)) at (prev + 1, 13) to (start + 2, 6) - Code(Zero) at (prev + 2, 5) to (start + 0, 6) - Code(Expression(0, Add)) at (prev + 2, 8) to (start + 0, 21) - = ((((c2 + c3) + c4) + c5) + c6) -- Code(Counter(8)) at (prev + 0, 22) to (start + 2, 6) -- Code(Expression(15, Sub)) at (prev + 2, 15) to (start + 0, 28) - = (((((c2 + c3) + c4) + c5) + c6) - c8) -- Code(Expression(16, Sub)) at (prev + 1, 12) to (start + 0, 25) - = (((((c2 + c3) + c4) + c5) + c6) - (c8 + c34)) -- Code(Expression(18, Sub)) at (prev + 0, 29) to (start + 0, 42) - = (((((c2 + c3) + c4) + c5) + c6) - ((c8 + c9) + c34)) -- Code(Expression(21, Sub)) at (prev + 0, 46) to (start + 0, 60) - = (((((c2 + c3) + c4) + c5) + c6) - (((c8 + c9) + c10) + c34)) -- Code(Expression(28, Add)) at (prev + 0, 61) to (start + 2, 10) - = ((c9 + c10) + c11) -- Code(Counter(12)) at (prev + 2, 9) to (start + 0, 10) -- Code(Expression(27, Add)) at (prev + 1, 9) to (start + 0, 23) - = (((c9 + c10) + c11) + c12) -- Code(Counter(34)) at (prev + 2, 9) to (start + 0, 15) -- Code(Expression(115, Add)) at (prev + 3, 8) to (start + 0, 12) - = ((((c8 + c9) + c10) + c11) + c12) -- Code(Counter(13)) at (prev + 1, 13) to (start + 1, 16) -- Code(Counter(14)) at (prev + 1, 17) to (start + 2, 10) + = (c2 + c3) +- Code(Counter(5)) at (prev + 0, 22) to (start + 2, 6) +- Code(Expression(11, Sub)) at (prev + 2, 15) to (start + 0, 28) + = ((c2 + c3) - c5) +- Code(Counter(6)) at (prev + 1, 12) to (start + 0, 25) +- Code(Expression(12, Sub)) at (prev + 0, 29) to (start + 0, 42) + = (c6 - c25) +- Code(Expression(13, Sub)) at (prev + 0, 46) to (start + 0, 60) + = (c6 - (c25 + c26)) +- Code(Expression(18, Add)) at (prev + 0, 61) to (start + 2, 10) + = ((c25 + c26) + c27) +- Code(Expression(17, Sub)) at (prev + 2, 9) to (start + 0, 10) + = (c6 - ((c25 + c26) + c27)) +- Code(Counter(6)) at (prev + 1, 9) to (start + 0, 23) +- Code(Expression(20, Sub)) at (prev + 2, 9) to (start + 0, 15) + = ((c2 + c3) - (c5 + c6)) +- Code(Expression(59, Add)) at (prev + 3, 8) to (start + 0, 12) + = (c5 + c6) +- Code(Counter(7)) at (prev + 1, 13) to (start + 1, 16) +- Code(Counter(8)) at (prev + 1, 17) to (start + 2, 10) - Code(Zero) at (prev + 2, 9) to (start + 0, 10) -- Code(Counter(13)) at (prev + 2, 12) to (start + 0, 25) -- Code(Counter(15)) at (prev + 0, 26) to (start + 2, 10) -- Code(Expression(34, Sub)) at (prev + 4, 17) to (start + 0, 30) - = (c13 - c15) -- Code(Expression(35, Sub)) at (prev + 1, 16) to (start + 0, 29) - = (c13 - (c15 + c33)) -- Code(Expression(37, Sub)) at (prev + 0, 33) to (start + 0, 46) - = (c13 - ((c15 + c16) + c33)) -- Code(Expression(40, Sub)) at (prev + 0, 50) to (start + 0, 64) - = (c13 - (((c15 + c16) + c17) + c33)) -- Code(Expression(47, Add)) at (prev + 0, 65) to (start + 2, 14) - = ((c16 + c17) + c18) -- Code(Counter(19)) at (prev + 2, 13) to (start + 0, 14) -- Code(Expression(46, Add)) at (prev + 1, 13) to (start + 0, 27) - = (((c16 + c17) + c18) + c19) -- Code(Counter(33)) at (prev + 2, 13) to (start + 0, 19) +- Code(Counter(7)) at (prev + 2, 12) to (start + 0, 25) +- Code(Counter(9)) at (prev + 0, 26) to (start + 2, 10) +- Code(Expression(23, Sub)) at (prev + 4, 17) to (start + 0, 30) + = (c7 - c9) +- Code(Counter(10)) at (prev + 1, 16) to (start + 0, 29) +- Code(Expression(24, Sub)) at (prev + 0, 33) to (start + 0, 46) + = (c10 - c22) +- Code(Expression(25, Sub)) at (prev + 0, 50) to (start + 0, 64) + = (c10 - (c22 + c23)) +- Code(Expression(30, Add)) at (prev + 0, 65) to (start + 2, 14) + = ((c22 + c23) + c24) +- Code(Expression(29, Sub)) at (prev + 2, 13) to (start + 0, 14) + = (c10 - ((c22 + c23) + c24)) +- Code(Counter(10)) at (prev + 1, 13) to (start + 0, 27) +- Code(Expression(32, Sub)) at (prev + 2, 13) to (start + 0, 19) + = (c7 - (c9 + c10)) - Code(Zero) at (prev + 2, 5) to (start + 0, 6) -- Code(Expression(63, Sub)) at (prev + 2, 9) to (start + 1, 12) - = ((((((((((c8 + c9) + c10) + c11) + c12) + c15) + c16) + c17) + c18) + c19) - c13) -- Code(Counter(20)) at (prev + 1, 13) to (start + 2, 6) +- Code(Expression(39, Sub)) at (prev + 2, 9) to (start + 1, 12) + = ((((c5 + c6) + c9) + c10) - c7) +- Code(Counter(11)) at (prev + 1, 13) to (start + 2, 6) - Code(Zero) at (prev + 2, 5) to (start + 0, 6) -- Code(Expression(155, Add)) at (prev + 2, 9) to (start + 0, 10) - = ((((c21 + c22) + c23) + c24) + c25) -- Code(Expression(63, Sub)) at (prev + 0, 16) to (start + 0, 29) - = ((((((((((c8 + c9) + c10) + c11) + c12) + c15) + c16) + c17) + c18) + c19) - c13) -- Code(Counter(21)) at (prev + 0, 30) to (start + 2, 6) -- Code(Expression(73, Sub)) at (prev + 2, 15) to (start + 0, 28) - = ((((((((((c8 + c9) + c10) + c11) + c12) + c15) + c16) + c17) + c18) + c19) - (c13 + c21)) -- Code(Expression(84, Sub)) at (prev + 1, 12) to (start + 0, 25) - = ((((((((((c8 + c9) + c10) + c11) + c12) + c15) + c16) + c17) + c18) + c19) - ((c13 + c21) + c32)) -- Code(Expression(96, Sub)) at (prev + 0, 29) to (start + 0, 42) - = ((((((((((c8 + c9) + c10) + c11) + c12) + c15) + c16) + c17) + c18) + c19) - (((c13 + c21) + c22) + c32)) -- Code(Expression(109, Sub)) at (prev + 0, 46) to (start + 0, 60) - = ((((((((((c8 + c9) + c10) + c11) + c12) + c15) + c16) + c17) + c18) + c19) - ((((c13 + c21) + c22) + c23) + c32)) -- Code(Expression(126, Add)) at (prev + 0, 61) to (start + 2, 10) - = ((c22 + c23) + c24) -- Code(Counter(25)) at (prev + 2, 9) to (start + 0, 10) -- Code(Expression(125, Add)) at (prev + 1, 9) to (start + 0, 23) - = (((c22 + c23) + c24) + c25) -- Code(Counter(32)) at (prev + 2, 13) to (start + 2, 15) -- Code(Expression(128, Add)) at (prev + 5, 9) to (start + 0, 10) - = ((((c26 + c27) + c28) + c29) + c30) -- Code(Expression(155, Add)) at (prev + 0, 16) to (start + 0, 29) - = ((((c21 + c22) + c23) + c24) + c25) -- Code(Counter(26)) at (prev + 0, 30) to (start + 2, 6) -- Code(Expression(136, Sub)) at (prev + 2, 15) to (start + 0, 28) - = (((((c21 + c22) + c23) + c24) + c25) - c26) -- Code(Expression(141, Sub)) at (prev + 1, 12) to (start + 0, 25) - = (((((c21 + c22) + c23) + c24) + c25) - (c26 + c31)) -- Code(Expression(147, Sub)) at (prev + 0, 29) to (start + 0, 42) - = (((((c21 + c22) + c23) + c24) + c25) - ((c26 + c27) + c31)) -- Code(Expression(154, Sub)) at (prev + 0, 46) to (start + 0, 60) - = (((((c21 + c22) + c23) + c24) + c25) - (((c26 + c27) + c28) + c31)) -- Code(Expression(165, Add)) at (prev + 0, 61) to (start + 2, 10) - = ((c27 + c28) + c29) -- Code(Counter(30)) at (prev + 2, 9) to (start + 0, 10) -- Code(Expression(164, Add)) at (prev + 1, 9) to (start + 0, 23) - = (((c27 + c28) + c29) + c30) -- Code(Counter(31)) at (prev + 2, 9) to (start + 0, 15) -- Code(Expression(167, Sub)) at (prev + 2, 1) to (start + 0, 2) - = ((((((((((c0 + c26) + c27) + c28) + c29) + c30) + c31) + c32) + c33) + c34) - (c2 + c35)) -Highest counter ID seen: c35 +- Code(Expression(75, Add)) at (prev + 2, 9) to (start + 0, 10) + = (c12 + c13) +- Code(Expression(39, Sub)) at (prev + 0, 16) to (start + 0, 29) + = ((((c5 + c6) + c9) + c10) - c7) +- Code(Counter(12)) at (prev + 0, 30) to (start + 2, 6) +- Code(Expression(43, Sub)) at (prev + 2, 15) to (start + 0, 28) + = ((((c5 + c6) + c9) + c10) - (c7 + c12)) +- Code(Counter(13)) at (prev + 1, 12) to (start + 0, 25) +- Code(Expression(48, Sub)) at (prev + 0, 29) to (start + 0, 42) + = (c13 - c19) +- Code(Expression(49, Sub)) at (prev + 0, 46) to (start + 0, 60) + = (c13 - (c19 + c20)) +- Code(Expression(54, Add)) at (prev + 0, 61) to (start + 2, 10) + = ((c19 + c20) + c21) +- Code(Expression(53, Sub)) at (prev + 2, 9) to (start + 0, 10) + = (c13 - ((c19 + c20) + c21)) +- Code(Counter(13)) at (prev + 1, 9) to (start + 0, 23) +- Code(Expression(56, Sub)) at (prev + 2, 13) to (start + 2, 15) + = ((((c5 + c6) + c9) + c10) - ((c7 + c12) + c13)) +- Code(Expression(76, Add)) at (prev + 5, 9) to (start + 0, 10) + = (c14 + c15) +- Code(Expression(75, Add)) at (prev + 0, 16) to (start + 0, 29) + = (c12 + c13) +- Code(Counter(14)) at (prev + 0, 30) to (start + 2, 6) +- Code(Expression(64, Sub)) at (prev + 2, 15) to (start + 0, 28) + = ((c12 + c13) - c14) +- Code(Counter(15)) at (prev + 1, 12) to (start + 0, 25) +- Code(Expression(66, Sub)) at (prev + 0, 29) to (start + 0, 42) + = (c15 - c16) +- Code(Expression(67, Sub)) at (prev + 0, 46) to (start + 0, 60) + = (c15 - (c16 + c17)) +- Code(Expression(72, Add)) at (prev + 0, 61) to (start + 2, 10) + = ((c16 + c17) + c18) +- Code(Expression(71, Sub)) at (prev + 2, 9) to (start + 0, 10) + = (c15 - ((c16 + c17) + c18)) +- Code(Counter(15)) at (prev + 1, 9) to (start + 0, 23) +- Code(Expression(74, Sub)) at (prev + 2, 9) to (start + 0, 15) + = ((c12 + c13) - (c14 + c15)) +- Code(Counter(0)) at (prev + 2, 1) to (start + 0, 2) +Highest counter ID seen: c15 diff --git a/tests/coverage/continue.cov-map b/tests/coverage/continue.cov-map index 55313d7db49..eb968fbb747 100644 --- a/tests/coverage/continue.cov-map +++ b/tests/coverage/continue.cov-map @@ -1,5 +1,5 @@ Function name: continue::main -Raw bytes (210): 0x[01, 01, 1c, 07, 09, 01, 05, 03, 0d, 1f, 15, 0d, 11, 1b, 19, 1f, 15, 0d, 11, 33, 21, 19, 1d, 2f, 25, 33, 21, 19, 1d, 47, 2d, 25, 29, 43, 31, 47, 2d, 25, 29, 5b, 39, 31, 35, 57, 3d, 5b, 39, 31, 35, 35, 39, 3d, 41, 6b, 45, 3d, 41, 45, 49, 1e, 01, 03, 01, 03, 12, 03, 04, 0e, 00, 13, 0a, 01, 0f, 00, 16, 05, 02, 11, 00, 19, 09, 02, 12, 04, 0e, 1b, 06, 0e, 00, 13, 16, 01, 0f, 00, 16, 15, 01, 16, 02, 0e, 11, 04, 11, 00, 19, 15, 03, 09, 00, 0e, 2f, 02, 0e, 00, 13, 2a, 01, 0f, 00, 16, 1d, 01, 15, 02, 0e, 21, 04, 11, 00, 19, 1d, 03, 09, 00, 0e, 43, 02, 0e, 00, 13, 3e, 01, 0c, 00, 13, 29, 01, 0d, 00, 15, 2d, 01, 0a, 01, 0e, 57, 03, 0e, 00, 13, 52, 01, 0f, 00, 16, 39, 01, 16, 02, 0e, 35, 03, 12, 02, 0e, 5f, 04, 09, 00, 0e, 6b, 02, 0e, 00, 13, 66, 01, 0f, 00, 16, 41, 01, 16, 02, 0e, 49, 04, 11, 00, 16, 41, 03, 09, 00, 0e, 6f, 02, 0d, 01, 02] +Raw bytes (210): 0x[01, 01, 1c, 07, 09, 01, 05, 03, 0d, 1f, 15, 0d, 11, 1b, 19, 1f, 15, 0d, 11, 33, 21, 19, 1d, 2f, 25, 33, 21, 19, 1d, 47, 2d, 25, 29, 43, 31, 47, 2d, 25, 29, 5b, 39, 31, 35, 57, 3d, 5b, 39, 31, 35, 35, 39, 3d, 41, 6b, 45, 3d, 41, 3d, 45, 1e, 01, 03, 01, 03, 12, 03, 04, 0e, 00, 13, 0a, 01, 0f, 00, 16, 05, 02, 11, 00, 19, 09, 02, 12, 04, 0e, 1b, 06, 0e, 00, 13, 16, 01, 0f, 00, 16, 15, 01, 16, 02, 0e, 11, 04, 11, 00, 19, 15, 03, 09, 00, 0e, 2f, 02, 0e, 00, 13, 2a, 01, 0f, 00, 16, 1d, 01, 15, 02, 0e, 21, 04, 11, 00, 19, 1d, 03, 09, 00, 0e, 43, 02, 0e, 00, 13, 3e, 01, 0c, 00, 13, 29, 01, 0d, 00, 15, 2d, 01, 0a, 01, 0e, 57, 03, 0e, 00, 13, 52, 01, 0f, 00, 16, 39, 01, 16, 02, 0e, 35, 03, 12, 02, 0e, 5f, 04, 09, 00, 0e, 6b, 02, 0e, 00, 13, 66, 01, 0f, 00, 16, 41, 01, 16, 02, 0e, 6e, 04, 11, 00, 16, 41, 03, 09, 00, 0e, 3d, 02, 0d, 01, 02] Number of files: 1 - file 0 => global file 1 Number of expressions: 28 @@ -30,7 +30,7 @@ Number of expressions: 28 - expression 24 operands: lhs = Counter(15), rhs = Counter(16) - expression 25 operands: lhs = Expression(26, Add), rhs = Counter(17) - expression 26 operands: lhs = Counter(15), rhs = Counter(16) -- expression 27 operands: lhs = Counter(17), rhs = Counter(18) +- expression 27 operands: lhs = Counter(15), rhs = Counter(17) Number of file 0 mappings: 30 - Code(Counter(0)) at (prev + 3, 1) to (start + 3, 18) - Code(Expression(0, Add)) at (prev + 4, 14) to (start + 0, 19) @@ -72,9 +72,9 @@ Number of file 0 mappings: 30 - Code(Expression(25, Sub)) at (prev + 1, 15) to (start + 0, 22) = ((c15 + c16) - c17) - Code(Counter(16)) at (prev + 1, 22) to (start + 2, 14) -- Code(Counter(18)) at (prev + 4, 17) to (start + 0, 22) +- Code(Expression(27, Sub)) at (prev + 4, 17) to (start + 0, 22) + = (c15 - c17) - Code(Counter(16)) at (prev + 3, 9) to (start + 0, 14) -- Code(Expression(27, Add)) at (prev + 2, 13) to (start + 1, 2) - = (c17 + c18) -Highest counter ID seen: c18 +- Code(Counter(15)) at (prev + 2, 13) to (start + 1, 2) +Highest counter ID seen: c16 diff --git a/tests/coverage/coroutine.cov-map b/tests/coverage/coroutine.cov-map index 21f6787e9f2..7457a528a86 100644 --- a/tests/coverage/coroutine.cov-map +++ b/tests/coverage/coroutine.cov-map @@ -13,18 +13,14 @@ Number of file 0 mappings: 4 Highest counter ID seen: c1 Function name: coroutine::main -Raw bytes (65): 0x[01, 01, 08, 07, 0d, 05, 09, 11, 15, 11, 1f, 15, 19, 15, 19, 11, 1f, 15, 19, 09, 01, 13, 01, 02, 16, 01, 08, 0b, 00, 2e, 11, 01, 2b, 00, 2d, 03, 01, 0e, 00, 35, 11, 02, 0b, 00, 2e, 0a, 01, 22, 00, 27, 1a, 00, 2c, 00, 2e, 1f, 01, 0e, 00, 35, 1a, 02, 01, 00, 02] +Raw bytes (57): 0x[01, 01, 04, 07, 0d, 05, 09, 11, 19, 11, 15, 09, 01, 13, 01, 02, 16, 01, 08, 0b, 00, 2e, 11, 01, 2b, 00, 2d, 03, 01, 0e, 00, 35, 11, 02, 0b, 00, 2e, 0a, 01, 22, 00, 27, 15, 00, 2c, 00, 2e, 0e, 01, 0e, 00, 35, 15, 02, 01, 00, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 8 +Number of expressions: 4 - expression 0 operands: lhs = Expression(1, Add), rhs = Counter(3) - expression 1 operands: lhs = Counter(1), rhs = Counter(2) -- expression 2 operands: lhs = Counter(4), rhs = Counter(5) -- expression 3 operands: lhs = Counter(4), rhs = Expression(7, Add) -- expression 4 operands: lhs = Counter(5), rhs = Counter(6) -- expression 5 operands: lhs = Counter(5), rhs = Counter(6) -- expression 6 operands: lhs = Counter(4), rhs = Expression(7, Add) -- expression 7 operands: lhs = Counter(5), rhs = Counter(6) +- expression 2 operands: lhs = Counter(4), rhs = Counter(6) +- expression 3 operands: lhs = Counter(4), rhs = Counter(5) Number of file 0 mappings: 9 - Code(Counter(0)) at (prev + 19, 1) to (start + 2, 22) - Code(Counter(0)) at (prev + 8, 11) to (start + 0, 46) @@ -33,14 +29,12 @@ Number of file 0 mappings: 9 = ((c1 + c2) + c3) - Code(Counter(4)) at (prev + 2, 11) to (start + 0, 46) - Code(Expression(2, Sub)) at (prev + 1, 34) to (start + 0, 39) + = (c4 - c6) +- Code(Counter(5)) at (prev + 0, 44) to (start + 0, 46) +- Code(Expression(3, Sub)) at (prev + 1, 14) to (start + 0, 53) = (c4 - c5) -- Code(Expression(6, Sub)) at (prev + 0, 44) to (start + 0, 46) - = (c4 - (c5 + c6)) -- Code(Expression(7, Add)) at (prev + 1, 14) to (start + 0, 53) - = (c5 + c6) -- Code(Expression(6, Sub)) at (prev + 2, 1) to (start + 0, 2) - = (c4 - (c5 + c6)) -Highest counter ID seen: c4 +- Code(Counter(5)) at (prev + 2, 1) to (start + 0, 2) +Highest counter ID seen: c5 Function name: coroutine::main::{closure#0} Raw bytes (14): 0x[01, 01, 00, 02, 01, 16, 08, 01, 1f, 05, 02, 10, 01, 06] diff --git a/tests/coverage/inline.cov-map b/tests/coverage/inline.cov-map index 1b5b45695dc..39ba2b2d99b 100644 --- a/tests/coverage/inline.cov-map +++ b/tests/coverage/inline.cov-map @@ -41,7 +41,7 @@ Number of file 0 mappings: 1 Highest counter ID seen: c0 Function name: inline::permutate::<char> -Raw bytes (54): 0x[01, 01, 05, 01, 05, 01, 0b, 05, 0d, 13, 0d, 05, 09, 08, 01, 0f, 01, 02, 0e, 05, 02, 0f, 02, 06, 02, 02, 0f, 00, 14, 11, 01, 0d, 00, 0e, 06, 00, 12, 00, 16, 11, 00, 17, 04, 0a, 0d, 05, 0c, 02, 06, 0f, 03, 01, 00, 02] +Raw bytes (54): 0x[01, 01, 05, 01, 05, 01, 0b, 05, 0d, 13, 0d, 01, 09, 08, 01, 0f, 01, 02, 0e, 05, 02, 0f, 02, 06, 02, 02, 0f, 00, 14, 11, 01, 0d, 00, 0e, 0d, 00, 12, 00, 16, 11, 00, 17, 04, 0a, 06, 05, 0c, 02, 06, 0e, 03, 01, 00, 02] Number of files: 1 - file 0 => global file 1 Number of expressions: 5 @@ -49,19 +49,19 @@ Number of expressions: 5 - expression 1 operands: lhs = Counter(0), rhs = Expression(2, Add) - expression 2 operands: lhs = Counter(1), rhs = Counter(3) - expression 3 operands: lhs = Expression(4, Add), rhs = Counter(3) -- expression 4 operands: lhs = Counter(1), rhs = Counter(2) +- expression 4 operands: lhs = Counter(0), rhs = Counter(2) Number of file 0 mappings: 8 - Code(Counter(0)) at (prev + 15, 1) to (start + 2, 14) - Code(Counter(1)) at (prev + 2, 15) to (start + 2, 6) - Code(Expression(0, Sub)) at (prev + 2, 15) to (start + 0, 20) = (c0 - c1) - Code(Counter(4)) at (prev + 1, 13) to (start + 0, 14) -- Code(Expression(1, Sub)) at (prev + 0, 18) to (start + 0, 22) - = (c0 - (c1 + c3)) +- Code(Counter(3)) at (prev + 0, 18) to (start + 0, 22) - Code(Counter(4)) at (prev + 0, 23) to (start + 4, 10) -- Code(Counter(3)) at (prev + 5, 12) to (start + 2, 6) -- Code(Expression(3, Add)) at (prev + 3, 1) to (start + 0, 2) - = ((c1 + c2) + c3) +- Code(Expression(1, Sub)) at (prev + 5, 12) to (start + 2, 6) + = (c0 - (c1 + c3)) +- Code(Expression(3, Sub)) at (prev + 3, 1) to (start + 0, 2) + = ((c0 + c2) - c3) Highest counter ID seen: c4 Function name: inline::permutations::<char> diff --git a/tests/coverage/loops_branches.cov-map b/tests/coverage/loops_branches.cov-map index 14707701d8a..0279a1a5157 100644 --- a/tests/coverage/loops_branches.cov-map +++ b/tests/coverage/loops_branches.cov-map @@ -1,42 +1,32 @@ Function name: <loops_branches::DebugTest as core::fmt::Debug>::fmt -Raw bytes (174): 0x[01, 01, 22, 05, 00, 2f, 7b, 67, 00, 77, 19, 01, 15, 05, 21, 2f, 05, 67, 00, 77, 19, 01, 15, 2f, 7b, 67, 00, 77, 19, 01, 15, 05, 21, 67, 7b, 77, 19, 01, 15, 05, 21, 67, 5b, 77, 19, 01, 15, 7b, 00, 05, 21, 67, 7b, 77, 19, 01, 15, 05, 21, 77, 7b, 01, 15, 05, 21, 83, 01, 05, 87, 01, 15, 01, 11, 14, 01, 09, 05, 01, 10, 05, 02, 10, 00, 15, 00, 01, 17, 00, 1b, 00, 00, 1c, 00, 1e, 02, 01, 0d, 00, 0e, 05, 01, 0d, 00, 1e, 11, 00, 1e, 00, 1f, 00, 01, 10, 01, 0a, 2a, 03, 0d, 00, 0e, 1a, 00, 12, 00, 17, 2a, 01, 10, 00, 14, 62, 01, 14, 00, 19, 00, 01, 1b, 00, 1f, 00, 00, 20, 00, 22, 4e, 01, 11, 00, 12, 62, 01, 11, 00, 22, 72, 00, 22, 00, 23, 00, 01, 14, 01, 0e, 21, 03, 09, 00, 0f, 7e, 01, 05, 00, 06] +Raw bytes (152): 0x[01, 01, 18, 05, 00, 27, 57, 53, 00, 01, 1d, 11, 19, 27, 11, 53, 00, 01, 1d, 27, 57, 53, 00, 01, 1d, 11, 19, 53, 57, 01, 1d, 11, 19, 53, 47, 01, 1d, 57, 00, 11, 19, 53, 57, 01, 1d, 11, 19, 5f, 19, 11, 15, 14, 01, 09, 05, 01, 10, 05, 02, 10, 00, 15, 00, 01, 17, 00, 1b, 00, 00, 1c, 00, 1e, 02, 01, 0d, 00, 0e, 05, 01, 0d, 00, 1e, 11, 00, 1e, 00, 1f, 00, 01, 10, 01, 0a, 22, 03, 0d, 00, 0e, 16, 00, 12, 00, 17, 22, 01, 10, 00, 14, 4e, 01, 14, 00, 19, 00, 01, 1b, 00, 1f, 00, 00, 20, 00, 22, 3e, 01, 11, 00, 12, 4e, 01, 11, 00, 22, 15, 00, 22, 00, 23, 00, 01, 14, 01, 0e, 19, 03, 09, 00, 0f, 5b, 01, 05, 00, 06] Number of files: 1 - file 0 => global file 1 -Number of expressions: 34 +Number of expressions: 24 - expression 0 operands: lhs = Counter(1), rhs = Zero -- expression 1 operands: lhs = Expression(11, Add), rhs = Expression(30, Add) -- expression 2 operands: lhs = Expression(25, Add), rhs = Zero -- expression 3 operands: lhs = Expression(29, Add), rhs = Counter(6) -- expression 4 operands: lhs = Counter(0), rhs = Counter(5) -- expression 5 operands: lhs = Counter(1), rhs = Counter(8) -- expression 6 operands: lhs = Expression(11, Add), rhs = Counter(1) -- expression 7 operands: lhs = Expression(25, Add), rhs = Zero -- expression 8 operands: lhs = Expression(29, Add), rhs = Counter(6) -- expression 9 operands: lhs = Counter(0), rhs = Counter(5) -- expression 10 operands: lhs = Expression(11, Add), rhs = Expression(30, Add) -- expression 11 operands: lhs = Expression(25, Add), rhs = Zero -- expression 12 operands: lhs = Expression(29, Add), rhs = Counter(6) -- expression 13 operands: lhs = Counter(0), rhs = Counter(5) -- expression 14 operands: lhs = Counter(1), rhs = Counter(8) -- expression 15 operands: lhs = Expression(25, Add), rhs = Expression(30, Add) -- expression 16 operands: lhs = Expression(29, Add), rhs = Counter(6) -- expression 17 operands: lhs = Counter(0), rhs = Counter(5) -- expression 18 operands: lhs = Counter(1), rhs = Counter(8) -- expression 19 operands: lhs = Expression(25, Add), rhs = Expression(22, Add) -- expression 20 operands: lhs = Expression(29, Add), rhs = Counter(6) -- expression 21 operands: lhs = Counter(0), rhs = Counter(5) -- expression 22 operands: lhs = Expression(30, Add), rhs = Zero -- expression 23 operands: lhs = Counter(1), rhs = Counter(8) -- expression 24 operands: lhs = Expression(25, Add), rhs = Expression(30, Add) -- expression 25 operands: lhs = Expression(29, Add), rhs = Counter(6) -- expression 26 operands: lhs = Counter(0), rhs = Counter(5) -- expression 27 operands: lhs = Counter(1), rhs = Counter(8) -- expression 28 operands: lhs = Expression(29, Add), rhs = Expression(30, Add) -- expression 29 operands: lhs = Counter(0), rhs = Counter(5) -- expression 30 operands: lhs = Counter(1), rhs = Counter(8) -- expression 31 operands: lhs = Expression(32, Add), rhs = Counter(1) -- expression 32 operands: lhs = Expression(33, Add), rhs = Counter(5) -- expression 33 operands: lhs = Counter(0), rhs = Counter(4) +- expression 1 operands: lhs = Expression(9, Add), rhs = Expression(21, Add) +- expression 2 operands: lhs = Expression(20, Add), rhs = Zero +- expression 3 operands: lhs = Counter(0), rhs = Counter(7) +- expression 4 operands: lhs = Counter(4), rhs = Counter(6) +- expression 5 operands: lhs = Expression(9, Add), rhs = Counter(4) +- expression 6 operands: lhs = Expression(20, Add), rhs = Zero +- expression 7 operands: lhs = Counter(0), rhs = Counter(7) +- expression 8 operands: lhs = Expression(9, Add), rhs = Expression(21, Add) +- expression 9 operands: lhs = Expression(20, Add), rhs = Zero +- expression 10 operands: lhs = Counter(0), rhs = Counter(7) +- expression 11 operands: lhs = Counter(4), rhs = Counter(6) +- expression 12 operands: lhs = Expression(20, Add), rhs = Expression(21, Add) +- expression 13 operands: lhs = Counter(0), rhs = Counter(7) +- expression 14 operands: lhs = Counter(4), rhs = Counter(6) +- expression 15 operands: lhs = Expression(20, Add), rhs = Expression(17, Add) +- expression 16 operands: lhs = Counter(0), rhs = Counter(7) +- expression 17 operands: lhs = Expression(21, Add), rhs = Zero +- expression 18 operands: lhs = Counter(4), rhs = Counter(6) +- expression 19 operands: lhs = Expression(20, Add), rhs = Expression(21, Add) +- expression 20 operands: lhs = Counter(0), rhs = Counter(7) +- expression 21 operands: lhs = Counter(4), rhs = Counter(6) +- expression 22 operands: lhs = Expression(23, Add), rhs = Counter(6) +- expression 23 operands: lhs = Counter(4), rhs = Counter(5) Number of file 0 mappings: 20 - Code(Counter(0)) at (prev + 9, 5) to (start + 1, 16) - Code(Counter(1)) at (prev + 2, 16) to (start + 0, 21) @@ -47,57 +37,57 @@ Number of file 0 mappings: 20 - Code(Counter(1)) at (prev + 1, 13) to (start + 0, 30) - Code(Counter(4)) at (prev + 0, 30) to (start + 0, 31) - Code(Zero) at (prev + 1, 16) to (start + 1, 10) -- Code(Expression(10, Sub)) at (prev + 3, 13) to (start + 0, 14) - = ((((c0 + c5) + c6) + Zero) - (c1 + c8)) -- Code(Expression(6, Sub)) at (prev + 0, 18) to (start + 0, 23) - = ((((c0 + c5) + c6) + Zero) - c1) -- Code(Expression(10, Sub)) at (prev + 1, 16) to (start + 0, 20) - = ((((c0 + c5) + c6) + Zero) - (c1 + c8)) -- Code(Expression(24, Sub)) at (prev + 1, 20) to (start + 0, 25) - = (((c0 + c5) + c6) - (c1 + c8)) +- Code(Expression(8, Sub)) at (prev + 3, 13) to (start + 0, 14) + = (((c0 + c7) + Zero) - (c4 + c6)) +- Code(Expression(5, Sub)) at (prev + 0, 18) to (start + 0, 23) + = (((c0 + c7) + Zero) - c4) +- Code(Expression(8, Sub)) at (prev + 1, 16) to (start + 0, 20) + = (((c0 + c7) + Zero) - (c4 + c6)) +- Code(Expression(19, Sub)) at (prev + 1, 20) to (start + 0, 25) + = ((c0 + c7) - (c4 + c6)) - Code(Zero) at (prev + 1, 27) to (start + 0, 31) - Code(Zero) at (prev + 0, 32) to (start + 0, 34) -- Code(Expression(19, Sub)) at (prev + 1, 17) to (start + 0, 18) - = (((c0 + c5) + c6) - ((c1 + c8) + Zero)) -- Code(Expression(24, Sub)) at (prev + 1, 17) to (start + 0, 34) - = (((c0 + c5) + c6) - (c1 + c8)) -- Code(Expression(28, Sub)) at (prev + 0, 34) to (start + 0, 35) - = ((c0 + c5) - (c1 + c8)) +- Code(Expression(15, Sub)) at (prev + 1, 17) to (start + 0, 18) + = ((c0 + c7) - ((c4 + c6) + Zero)) +- Code(Expression(19, Sub)) at (prev + 1, 17) to (start + 0, 34) + = ((c0 + c7) - (c4 + c6)) +- Code(Counter(5)) at (prev + 0, 34) to (start + 0, 35) - Code(Zero) at (prev + 1, 20) to (start + 1, 14) -- Code(Counter(8)) at (prev + 3, 9) to (start + 0, 15) -- Code(Expression(31, Sub)) at (prev + 1, 5) to (start + 0, 6) - = (((c0 + c4) + c5) - c1) -Highest counter ID seen: c8 +- Code(Counter(6)) at (prev + 3, 9) to (start + 0, 15) +- Code(Expression(22, Add)) at (prev + 1, 5) to (start + 0, 6) + = ((c4 + c5) + c6) +Highest counter ID seen: c6 Function name: <loops_branches::DisplayTest as core::fmt::Display>::fmt -Raw bytes (152): 0x[01, 01, 18, 01, 00, 01, 00, 23, 15, 27, 11, 00, 0d, 27, 11, 00, 0d, 23, 15, 27, 11, 00, 0d, 4b, 15, 4f, 11, 00, 0d, 4b, 43, 4f, 11, 00, 0d, 15, 00, 4b, 15, 4f, 11, 00, 0d, 5f, 15, 00, 11, 5f, 21, 00, 11, 14, 01, 22, 05, 01, 11, 00, 01, 12, 01, 0a, 02, 02, 10, 00, 15, 00, 01, 17, 00, 1b, 00, 00, 1c, 00, 1e, 06, 01, 0d, 00, 0e, 02, 01, 0d, 00, 1e, 21, 00, 1e, 00, 1f, 1e, 02, 0d, 00, 0e, 23, 00, 12, 00, 17, 1e, 01, 10, 00, 15, 00, 00, 16, 01, 0e, 46, 02, 14, 00, 19, 00, 01, 1b, 00, 1f, 00, 00, 20, 00, 22, 36, 01, 11, 00, 12, 46, 01, 11, 00, 22, 52, 00, 22, 00, 23, 15, 03, 09, 00, 0f, 5b, 01, 05, 00, 06] +Raw bytes (154): 0x[01, 01, 19, 01, 00, 01, 00, 2b, 63, 2f, 0d, 01, 00, 11, 15, 2b, 11, 2f, 0d, 01, 00, 2b, 63, 2f, 0d, 01, 00, 11, 15, 57, 63, 01, 0d, 11, 15, 57, 4b, 01, 0d, 63, 00, 11, 15, 57, 63, 01, 0d, 11, 15, 63, 21, 11, 15, 14, 01, 22, 05, 01, 11, 00, 01, 12, 01, 0a, 02, 02, 10, 00, 15, 00, 01, 17, 00, 1b, 00, 00, 1c, 00, 1e, 06, 01, 0d, 00, 0e, 02, 01, 0d, 00, 1e, 11, 00, 1e, 00, 1f, 26, 02, 0d, 00, 0e, 1a, 00, 12, 00, 17, 26, 01, 10, 00, 15, 00, 00, 16, 01, 0e, 52, 02, 14, 00, 19, 00, 01, 1b, 00, 1f, 00, 00, 20, 00, 22, 42, 01, 11, 00, 12, 52, 01, 11, 00, 22, 21, 00, 22, 00, 23, 15, 03, 09, 00, 0f, 5f, 01, 05, 00, 06] Number of files: 1 - file 0 => global file 1 -Number of expressions: 24 +Number of expressions: 25 - expression 0 operands: lhs = Counter(0), rhs = Zero - expression 1 operands: lhs = Counter(0), rhs = Zero -- expression 2 operands: lhs = Expression(8, Add), rhs = Counter(5) -- expression 3 operands: lhs = Expression(9, Add), rhs = Counter(4) -- expression 4 operands: lhs = Zero, rhs = Counter(3) -- expression 5 operands: lhs = Expression(9, Add), rhs = Counter(4) -- expression 6 operands: lhs = Zero, rhs = Counter(3) -- expression 7 operands: lhs = Expression(8, Add), rhs = Counter(5) -- expression 8 operands: lhs = Expression(9, Add), rhs = Counter(4) -- expression 9 operands: lhs = Zero, rhs = Counter(3) -- expression 10 operands: lhs = Expression(18, Add), rhs = Counter(5) -- expression 11 operands: lhs = Expression(19, Add), rhs = Counter(4) -- expression 12 operands: lhs = Zero, rhs = Counter(3) -- expression 13 operands: lhs = Expression(18, Add), rhs = Expression(16, Add) -- expression 14 operands: lhs = Expression(19, Add), rhs = Counter(4) -- expression 15 operands: lhs = Zero, rhs = Counter(3) -- expression 16 operands: lhs = Counter(5), rhs = Zero -- expression 17 operands: lhs = Expression(18, Add), rhs = Counter(5) -- expression 18 operands: lhs = Expression(19, Add), rhs = Counter(4) -- expression 19 operands: lhs = Zero, rhs = Counter(3) -- expression 20 operands: lhs = Expression(23, Add), rhs = Counter(5) -- expression 21 operands: lhs = Zero, rhs = Counter(4) -- expression 22 operands: lhs = Expression(23, Add), rhs = Counter(8) -- expression 23 operands: lhs = Zero, rhs = Counter(4) +- expression 2 operands: lhs = Expression(10, Add), rhs = Expression(24, Add) +- expression 3 operands: lhs = Expression(11, Add), rhs = Counter(3) +- expression 4 operands: lhs = Counter(0), rhs = Zero +- expression 5 operands: lhs = Counter(4), rhs = Counter(5) +- expression 6 operands: lhs = Expression(10, Add), rhs = Counter(4) +- expression 7 operands: lhs = Expression(11, Add), rhs = Counter(3) +- expression 8 operands: lhs = Counter(0), rhs = Zero +- expression 9 operands: lhs = Expression(10, Add), rhs = Expression(24, Add) +- expression 10 operands: lhs = Expression(11, Add), rhs = Counter(3) +- expression 11 operands: lhs = Counter(0), rhs = Zero +- expression 12 operands: lhs = Counter(4), rhs = Counter(5) +- expression 13 operands: lhs = Expression(21, Add), rhs = Expression(24, Add) +- expression 14 operands: lhs = Counter(0), rhs = Counter(3) +- expression 15 operands: lhs = Counter(4), rhs = Counter(5) +- expression 16 operands: lhs = Expression(21, Add), rhs = Expression(18, Add) +- expression 17 operands: lhs = Counter(0), rhs = Counter(3) +- expression 18 operands: lhs = Expression(24, Add), rhs = Zero +- expression 19 operands: lhs = Counter(4), rhs = Counter(5) +- expression 20 operands: lhs = Expression(21, Add), rhs = Expression(24, Add) +- expression 21 operands: lhs = Counter(0), rhs = Counter(3) +- expression 22 operands: lhs = Counter(4), rhs = Counter(5) +- expression 23 operands: lhs = Expression(24, Add), rhs = Counter(8) +- expression 24 operands: lhs = Counter(4), rhs = Counter(5) Number of file 0 mappings: 20 - Code(Counter(0)) at (prev + 34, 5) to (start + 1, 17) - Code(Zero) at (prev + 1, 18) to (start + 1, 10) @@ -109,27 +99,26 @@ Number of file 0 mappings: 20 = (c0 - Zero) - Code(Expression(0, Sub)) at (prev + 1, 13) to (start + 0, 30) = (c0 - Zero) -- Code(Counter(8)) at (prev + 0, 30) to (start + 0, 31) -- Code(Expression(7, Sub)) at (prev + 2, 13) to (start + 0, 14) - = (((Zero + c3) + c4) - c5) -- Code(Expression(8, Add)) at (prev + 0, 18) to (start + 0, 23) - = ((Zero + c3) + c4) -- Code(Expression(7, Sub)) at (prev + 1, 16) to (start + 0, 21) - = (((Zero + c3) + c4) - c5) +- Code(Counter(4)) at (prev + 0, 30) to (start + 0, 31) +- Code(Expression(9, Sub)) at (prev + 2, 13) to (start + 0, 14) + = (((c0 + Zero) + c3) - (c4 + c5)) +- Code(Expression(6, Sub)) at (prev + 0, 18) to (start + 0, 23) + = (((c0 + Zero) + c3) - c4) +- Code(Expression(9, Sub)) at (prev + 1, 16) to (start + 0, 21) + = (((c0 + Zero) + c3) - (c4 + c5)) - Code(Zero) at (prev + 0, 22) to (start + 1, 14) -- Code(Expression(17, Sub)) at (prev + 2, 20) to (start + 0, 25) - = (((Zero + c3) + c4) - c5) +- Code(Expression(20, Sub)) at (prev + 2, 20) to (start + 0, 25) + = ((c0 + c3) - (c4 + c5)) - Code(Zero) at (prev + 1, 27) to (start + 0, 31) - Code(Zero) at (prev + 0, 32) to (start + 0, 34) -- Code(Expression(13, Sub)) at (prev + 1, 17) to (start + 0, 18) - = (((Zero + c3) + c4) - (c5 + Zero)) -- Code(Expression(17, Sub)) at (prev + 1, 17) to (start + 0, 34) - = (((Zero + c3) + c4) - c5) -- Code(Expression(20, Sub)) at (prev + 0, 34) to (start + 0, 35) - = ((Zero + c4) - c5) +- Code(Expression(16, Sub)) at (prev + 1, 17) to (start + 0, 18) + = ((c0 + c3) - ((c4 + c5) + Zero)) +- Code(Expression(20, Sub)) at (prev + 1, 17) to (start + 0, 34) + = ((c0 + c3) - (c4 + c5)) +- Code(Counter(8)) at (prev + 0, 34) to (start + 0, 35) - Code(Counter(5)) at (prev + 3, 9) to (start + 0, 15) -- Code(Expression(22, Add)) at (prev + 1, 5) to (start + 0, 6) - = ((Zero + c4) + c8) +- Code(Expression(23, Add)) at (prev + 1, 5) to (start + 0, 6) + = ((c4 + c5) + c8) Highest counter ID seen: c8 Function name: loops_branches::main diff --git a/tests/coverage/mcdc/condition-limit.cov-map b/tests/coverage/mcdc/condition-limit.cov-map index 19716878600..8ff5d6360f6 100644 --- a/tests/coverage/mcdc/condition-limit.cov-map +++ b/tests/coverage/mcdc/condition-limit.cov-map @@ -1,54 +1,16 @@ Function name: condition_limit::accept_7_conditions -Raw bytes (237): 0x[01, 01, 2e, 01, 05, 05, 09, 05, 09, 05, 7b, 09, 0d, 05, 7b, 09, 0d, 05, 77, 7b, 11, 09, 0d, 05, 77, 7b, 11, 09, 0d, 05, 73, 77, 15, 7b, 11, 09, 0d, 05, 73, 77, 15, 7b, 11, 09, 0d, 05, 6f, 73, 19, 77, 15, 7b, 11, 09, 0d, 05, 6f, 73, 19, 77, 15, 7b, 11, 09, 0d, 83, 01, 05, a7, 01, 21, ab, 01, 19, af, 01, 15, b3, 01, 11, b7, 01, 0d, 01, 09, 9f, 01, 05, a3, 01, 21, a7, 01, 1d, ab, 01, 19, af, 01, 15, b3, 01, 11, b7, 01, 0d, 01, 09, 12, 01, 07, 01, 02, 09, 28, 08, 07, 02, 08, 00, 27, 30, 05, 02, 01, 07, 00, 00, 08, 00, 09, 05, 00, 0d, 00, 0e, 30, 0a, 09, 07, 06, 00, 00, 0d, 00, 0e, 0a, 00, 12, 00, 13, 30, 16, 0d, 06, 05, 00, 00, 12, 00, 13, 16, 00, 17, 00, 18, 30, 2a, 11, 05, 04, 00, 00, 17, 00, 18, 2a, 00, 1c, 00, 1d, 30, 46, 15, 04, 03, 00, 00, 1c, 00, 1d, 46, 00, 21, 00, 22, 30, 6a, 19, 03, 02, 00, 00, 21, 00, 22, 6a, 00, 26, 00, 27, 30, 1d, 21, 02, 00, 00, 00, 26, 00, 27, 1d, 00, 28, 02, 06, 7e, 02, 05, 00, 06, 9a, 01, 01, 01, 00, 02] +Raw bytes (147): 0x[01, 01, 08, 01, 05, 05, 09, 09, 0d, 0d, 11, 11, 15, 15, 19, 19, 1d, 01, 1d, 12, 01, 07, 01, 02, 09, 28, 08, 07, 02, 08, 00, 27, 30, 05, 02, 01, 07, 00, 00, 08, 00, 09, 05, 00, 0d, 00, 0e, 30, 09, 06, 07, 06, 00, 00, 0d, 00, 0e, 09, 00, 12, 00, 13, 30, 0d, 0a, 06, 05, 00, 00, 12, 00, 13, 0d, 00, 17, 00, 18, 30, 11, 0e, 05, 04, 00, 00, 17, 00, 18, 11, 00, 1c, 00, 1d, 30, 15, 12, 04, 03, 00, 00, 1c, 00, 1d, 15, 00, 21, 00, 22, 30, 19, 16, 03, 02, 00, 00, 21, 00, 22, 19, 00, 26, 00, 27, 30, 1d, 1a, 02, 00, 00, 00, 26, 00, 27, 1d, 00, 28, 02, 06, 1e, 02, 05, 00, 06, 01, 01, 01, 00, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 46 +Number of expressions: 8 - expression 0 operands: lhs = Counter(0), rhs = Counter(1) - expression 1 operands: lhs = Counter(1), rhs = Counter(2) -- expression 2 operands: lhs = Counter(1), rhs = Counter(2) -- expression 3 operands: lhs = Counter(1), rhs = Expression(30, Add) -- expression 4 operands: lhs = Counter(2), rhs = Counter(3) -- expression 5 operands: lhs = Counter(1), rhs = Expression(30, Add) -- expression 6 operands: lhs = Counter(2), rhs = Counter(3) -- expression 7 operands: lhs = Counter(1), rhs = Expression(29, Add) -- expression 8 operands: lhs = Expression(30, Add), rhs = Counter(4) -- expression 9 operands: lhs = Counter(2), rhs = Counter(3) -- expression 10 operands: lhs = Counter(1), rhs = Expression(29, Add) -- expression 11 operands: lhs = Expression(30, Add), rhs = Counter(4) -- expression 12 operands: lhs = Counter(2), rhs = Counter(3) -- expression 13 operands: lhs = Counter(1), rhs = Expression(28, Add) -- expression 14 operands: lhs = Expression(29, Add), rhs = Counter(5) -- expression 15 operands: lhs = Expression(30, Add), rhs = Counter(4) -- expression 16 operands: lhs = Counter(2), rhs = Counter(3) -- expression 17 operands: lhs = Counter(1), rhs = Expression(28, Add) -- expression 18 operands: lhs = Expression(29, Add), rhs = Counter(5) -- expression 19 operands: lhs = Expression(30, Add), rhs = Counter(4) -- expression 20 operands: lhs = Counter(2), rhs = Counter(3) -- expression 21 operands: lhs = Counter(1), rhs = Expression(27, Add) -- expression 22 operands: lhs = Expression(28, Add), rhs = Counter(6) -- expression 23 operands: lhs = Expression(29, Add), rhs = Counter(5) -- expression 24 operands: lhs = Expression(30, Add), rhs = Counter(4) -- expression 25 operands: lhs = Counter(2), rhs = Counter(3) -- expression 26 operands: lhs = Counter(1), rhs = Expression(27, Add) -- expression 27 operands: lhs = Expression(28, Add), rhs = Counter(6) -- expression 28 operands: lhs = Expression(29, Add), rhs = Counter(5) -- expression 29 operands: lhs = Expression(30, Add), rhs = Counter(4) -- expression 30 operands: lhs = Counter(2), rhs = Counter(3) -- expression 31 operands: lhs = Expression(32, Add), rhs = Counter(1) -- expression 32 operands: lhs = Expression(41, Add), rhs = Counter(8) -- expression 33 operands: lhs = Expression(42, Add), rhs = Counter(6) -- expression 34 operands: lhs = Expression(43, Add), rhs = Counter(5) -- expression 35 operands: lhs = Expression(44, Add), rhs = Counter(4) -- expression 36 operands: lhs = Expression(45, Add), rhs = Counter(3) -- expression 37 operands: lhs = Counter(0), rhs = Counter(2) -- expression 38 operands: lhs = Expression(39, Add), rhs = Counter(1) -- expression 39 operands: lhs = Expression(40, Add), rhs = Counter(8) -- expression 40 operands: lhs = Expression(41, Add), rhs = Counter(7) -- expression 41 operands: lhs = Expression(42, Add), rhs = Counter(6) -- expression 42 operands: lhs = Expression(43, Add), rhs = Counter(5) -- expression 43 operands: lhs = Expression(44, Add), rhs = Counter(4) -- expression 44 operands: lhs = Expression(45, Add), rhs = Counter(3) -- expression 45 operands: lhs = Counter(0), rhs = Counter(2) +- expression 2 operands: lhs = Counter(2), rhs = Counter(3) +- expression 3 operands: lhs = Counter(3), rhs = Counter(4) +- expression 4 operands: lhs = Counter(4), rhs = Counter(5) +- expression 5 operands: lhs = Counter(5), rhs = Counter(6) +- expression 6 operands: lhs = Counter(6), rhs = Counter(7) +- expression 7 operands: lhs = Counter(0), rhs = Counter(7) Number of file 0 mappings: 18 - Code(Counter(0)) at (prev + 7, 1) to (start + 2, 9) - MCDCDecision { bitmap_idx: 8, conditions_num: 7 } at (prev + 2, 8) to (start + 0, 39) @@ -56,38 +18,32 @@ Number of file 0 mappings: 18 true = c1 false = (c0 - c1) - Code(Counter(1)) at (prev + 0, 13) to (start + 0, 14) -- MCDCBranch { true: Expression(2, Sub), false: Counter(2), condition_id: 7, true_next_id: 6, false_next_id: 0 } at (prev + 0, 13) to (start + 0, 14) - true = (c1 - c2) - false = c2 -- Code(Expression(2, Sub)) at (prev + 0, 18) to (start + 0, 19) - = (c1 - c2) -- MCDCBranch { true: Expression(5, Sub), false: Counter(3), condition_id: 6, true_next_id: 5, false_next_id: 0 } at (prev + 0, 18) to (start + 0, 19) - true = (c1 - (c2 + c3)) - false = c3 -- Code(Expression(5, Sub)) at (prev + 0, 23) to (start + 0, 24) - = (c1 - (c2 + c3)) -- MCDCBranch { true: Expression(10, Sub), false: Counter(4), condition_id: 5, true_next_id: 4, false_next_id: 0 } at (prev + 0, 23) to (start + 0, 24) - true = (c1 - ((c2 + c3) + c4)) - false = c4 -- Code(Expression(10, Sub)) at (prev + 0, 28) to (start + 0, 29) - = (c1 - ((c2 + c3) + c4)) -- MCDCBranch { true: Expression(17, Sub), false: Counter(5), condition_id: 4, true_next_id: 3, false_next_id: 0 } at (prev + 0, 28) to (start + 0, 29) - true = (c1 - (((c2 + c3) + c4) + c5)) - false = c5 -- Code(Expression(17, Sub)) at (prev + 0, 33) to (start + 0, 34) - = (c1 - (((c2 + c3) + c4) + c5)) -- MCDCBranch { true: Expression(26, Sub), false: Counter(6), condition_id: 3, true_next_id: 2, false_next_id: 0 } at (prev + 0, 33) to (start + 0, 34) - true = (c1 - ((((c2 + c3) + c4) + c5) + c6)) - false = c6 -- Code(Expression(26, Sub)) at (prev + 0, 38) to (start + 0, 39) - = (c1 - ((((c2 + c3) + c4) + c5) + c6)) -- MCDCBranch { true: Counter(7), false: Counter(8), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 38) to (start + 0, 39) +- MCDCBranch { true: Counter(2), false: Expression(1, Sub), condition_id: 7, true_next_id: 6, false_next_id: 0 } at (prev + 0, 13) to (start + 0, 14) + true = c2 + false = (c1 - c2) +- Code(Counter(2)) at (prev + 0, 18) to (start + 0, 19) +- MCDCBranch { true: Counter(3), false: Expression(2, Sub), condition_id: 6, true_next_id: 5, false_next_id: 0 } at (prev + 0, 18) to (start + 0, 19) + true = c3 + false = (c2 - c3) +- Code(Counter(3)) at (prev + 0, 23) to (start + 0, 24) +- MCDCBranch { true: Counter(4), false: Expression(3, Sub), condition_id: 5, true_next_id: 4, false_next_id: 0 } at (prev + 0, 23) to (start + 0, 24) + true = c4 + false = (c3 - c4) +- Code(Counter(4)) at (prev + 0, 28) to (start + 0, 29) +- MCDCBranch { true: Counter(5), false: Expression(4, Sub), condition_id: 4, true_next_id: 3, false_next_id: 0 } at (prev + 0, 28) to (start + 0, 29) + true = c5 + false = (c4 - c5) +- Code(Counter(5)) at (prev + 0, 33) to (start + 0, 34) +- MCDCBranch { true: Counter(6), false: Expression(5, Sub), condition_id: 3, true_next_id: 2, false_next_id: 0 } at (prev + 0, 33) to (start + 0, 34) + true = c6 + false = (c5 - c6) +- Code(Counter(6)) at (prev + 0, 38) to (start + 0, 39) +- MCDCBranch { true: Counter(7), false: Expression(6, Sub), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 38) to (start + 0, 39) true = c7 - false = c8 + false = (c6 - c7) - Code(Counter(7)) at (prev + 0, 40) to (start + 2, 6) -- Code(Expression(31, Sub)) at (prev + 2, 5) to (start + 0, 6) - = (((((((c0 + c2) + c3) + c4) + c5) + c6) + c8) - c1) -- Code(Expression(38, Sub)) at (prev + 1, 1) to (start + 0, 2) - = ((((((((c0 + c2) + c3) + c4) + c5) + c6) + c7) + c8) - c1) -Highest counter ID seen: c8 +- Code(Expression(7, Sub)) at (prev + 2, 5) to (start + 0, 6) + = (c0 - c7) +- Code(Counter(0)) at (prev + 1, 1) to (start + 0, 2) +Highest counter ID seen: c7 diff --git a/tests/coverage/mcdc/if.cov-map b/tests/coverage/mcdc/if.cov-map index acb8aac63de..771351f649f 100644 --- a/tests/coverage/mcdc/if.cov-map +++ b/tests/coverage/mcdc/if.cov-map @@ -1,14 +1,11 @@ Function name: if::mcdc_check_a -Raw bytes (68): 0x[01, 01, 06, 01, 05, 0b, 05, 01, 0d, 13, 05, 17, 0d, 01, 09, 08, 01, 0f, 01, 01, 09, 28, 03, 02, 01, 08, 00, 0e, 30, 05, 02, 01, 02, 00, 00, 08, 00, 09, 05, 00, 0d, 00, 0e, 30, 09, 0d, 02, 00, 00, 00, 0d, 00, 0e, 09, 00, 0f, 02, 06, 06, 02, 0c, 02, 06, 0e, 03, 01, 00, 02] +Raw bytes (62): 0x[01, 01, 03, 01, 05, 05, 09, 01, 09, 08, 01, 0f, 01, 01, 09, 28, 03, 02, 01, 08, 00, 0e, 30, 05, 02, 01, 02, 00, 00, 08, 00, 09, 05, 00, 0d, 00, 0e, 30, 09, 06, 02, 00, 00, 00, 0d, 00, 0e, 09, 00, 0f, 02, 06, 0a, 02, 0c, 02, 06, 01, 03, 01, 00, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 6 +Number of expressions: 3 - expression 0 operands: lhs = Counter(0), rhs = Counter(1) -- expression 1 operands: lhs = Expression(2, Add), rhs = Counter(1) -- expression 2 operands: lhs = Counter(0), rhs = Counter(3) -- expression 3 operands: lhs = Expression(4, Add), rhs = Counter(1) -- expression 4 operands: lhs = Expression(5, Add), rhs = Counter(3) -- expression 5 operands: lhs = Counter(0), rhs = Counter(2) +- expression 1 operands: lhs = Counter(1), rhs = Counter(2) +- expression 2 operands: lhs = Counter(0), rhs = Counter(2) Number of file 0 mappings: 8 - Code(Counter(0)) at (prev + 15, 1) to (start + 1, 9) - MCDCDecision { bitmap_idx: 3, conditions_num: 2 } at (prev + 1, 8) to (start + 0, 14) @@ -16,27 +13,23 @@ Number of file 0 mappings: 8 true = c1 false = (c0 - c1) - Code(Counter(1)) at (prev + 0, 13) to (start + 0, 14) -- MCDCBranch { true: Counter(2), false: Counter(3), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 13) to (start + 0, 14) +- MCDCBranch { true: Counter(2), false: Expression(1, Sub), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 13) to (start + 0, 14) true = c2 - false = c3 + false = (c1 - c2) - Code(Counter(2)) at (prev + 0, 15) to (start + 2, 6) -- Code(Expression(1, Sub)) at (prev + 2, 12) to (start + 2, 6) - = ((c0 + c3) - c1) -- Code(Expression(3, Sub)) at (prev + 3, 1) to (start + 0, 2) - = (((c0 + c2) + c3) - c1) -Highest counter ID seen: c3 +- Code(Expression(2, Sub)) at (prev + 2, 12) to (start + 2, 6) + = (c0 - c2) +- Code(Counter(0)) at (prev + 3, 1) to (start + 0, 2) +Highest counter ID seen: c2 Function name: if::mcdc_check_b -Raw bytes (68): 0x[01, 01, 06, 01, 05, 0b, 05, 01, 0d, 13, 05, 17, 0d, 01, 09, 08, 01, 17, 01, 01, 09, 28, 03, 02, 01, 08, 00, 0e, 30, 05, 02, 01, 02, 00, 00, 08, 00, 09, 05, 00, 0d, 00, 0e, 30, 09, 0d, 02, 00, 00, 00, 0d, 00, 0e, 09, 00, 0f, 02, 06, 06, 02, 0c, 02, 06, 0e, 03, 01, 00, 02] +Raw bytes (62): 0x[01, 01, 03, 01, 05, 05, 09, 01, 09, 08, 01, 17, 01, 01, 09, 28, 03, 02, 01, 08, 00, 0e, 30, 05, 02, 01, 02, 00, 00, 08, 00, 09, 05, 00, 0d, 00, 0e, 30, 09, 06, 02, 00, 00, 00, 0d, 00, 0e, 09, 00, 0f, 02, 06, 0a, 02, 0c, 02, 06, 01, 03, 01, 00, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 6 +Number of expressions: 3 - expression 0 operands: lhs = Counter(0), rhs = Counter(1) -- expression 1 operands: lhs = Expression(2, Add), rhs = Counter(1) -- expression 2 operands: lhs = Counter(0), rhs = Counter(3) -- expression 3 operands: lhs = Expression(4, Add), rhs = Counter(1) -- expression 4 operands: lhs = Expression(5, Add), rhs = Counter(3) -- expression 5 operands: lhs = Counter(0), rhs = Counter(2) +- expression 1 operands: lhs = Counter(1), rhs = Counter(2) +- expression 2 operands: lhs = Counter(0), rhs = Counter(2) Number of file 0 mappings: 8 - Code(Counter(0)) at (prev + 23, 1) to (start + 1, 9) - MCDCDecision { bitmap_idx: 3, conditions_num: 2 } at (prev + 1, 8) to (start + 0, 14) @@ -44,27 +37,23 @@ Number of file 0 mappings: 8 true = c1 false = (c0 - c1) - Code(Counter(1)) at (prev + 0, 13) to (start + 0, 14) -- MCDCBranch { true: Counter(2), false: Counter(3), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 13) to (start + 0, 14) +- MCDCBranch { true: Counter(2), false: Expression(1, Sub), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 13) to (start + 0, 14) true = c2 - false = c3 + false = (c1 - c2) - Code(Counter(2)) at (prev + 0, 15) to (start + 2, 6) -- Code(Expression(1, Sub)) at (prev + 2, 12) to (start + 2, 6) - = ((c0 + c3) - c1) -- Code(Expression(3, Sub)) at (prev + 3, 1) to (start + 0, 2) - = (((c0 + c2) + c3) - c1) -Highest counter ID seen: c3 +- Code(Expression(2, Sub)) at (prev + 2, 12) to (start + 2, 6) + = (c0 - c2) +- Code(Counter(0)) at (prev + 3, 1) to (start + 0, 2) +Highest counter ID seen: c2 Function name: if::mcdc_check_both -Raw bytes (68): 0x[01, 01, 06, 01, 05, 0b, 05, 01, 0d, 13, 05, 17, 0d, 01, 09, 08, 01, 1f, 01, 01, 09, 28, 03, 02, 01, 08, 00, 0e, 30, 05, 02, 01, 02, 00, 00, 08, 00, 09, 05, 00, 0d, 00, 0e, 30, 09, 0d, 02, 00, 00, 00, 0d, 00, 0e, 09, 00, 0f, 02, 06, 06, 02, 0c, 02, 06, 0e, 03, 01, 00, 02] +Raw bytes (62): 0x[01, 01, 03, 01, 05, 05, 09, 01, 09, 08, 01, 1f, 01, 01, 09, 28, 03, 02, 01, 08, 00, 0e, 30, 05, 02, 01, 02, 00, 00, 08, 00, 09, 05, 00, 0d, 00, 0e, 30, 09, 06, 02, 00, 00, 00, 0d, 00, 0e, 09, 00, 0f, 02, 06, 0a, 02, 0c, 02, 06, 01, 03, 01, 00, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 6 +Number of expressions: 3 - expression 0 operands: lhs = Counter(0), rhs = Counter(1) -- expression 1 operands: lhs = Expression(2, Add), rhs = Counter(1) -- expression 2 operands: lhs = Counter(0), rhs = Counter(3) -- expression 3 operands: lhs = Expression(4, Add), rhs = Counter(1) -- expression 4 operands: lhs = Expression(5, Add), rhs = Counter(3) -- expression 5 operands: lhs = Counter(0), rhs = Counter(2) +- expression 1 operands: lhs = Counter(1), rhs = Counter(2) +- expression 2 operands: lhs = Counter(0), rhs = Counter(2) Number of file 0 mappings: 8 - Code(Counter(0)) at (prev + 31, 1) to (start + 1, 9) - MCDCDecision { bitmap_idx: 3, conditions_num: 2 } at (prev + 1, 8) to (start + 0, 14) @@ -72,27 +61,23 @@ Number of file 0 mappings: 8 true = c1 false = (c0 - c1) - Code(Counter(1)) at (prev + 0, 13) to (start + 0, 14) -- MCDCBranch { true: Counter(2), false: Counter(3), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 13) to (start + 0, 14) +- MCDCBranch { true: Counter(2), false: Expression(1, Sub), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 13) to (start + 0, 14) true = c2 - false = c3 + false = (c1 - c2) - Code(Counter(2)) at (prev + 0, 15) to (start + 2, 6) -- Code(Expression(1, Sub)) at (prev + 2, 12) to (start + 2, 6) - = ((c0 + c3) - c1) -- Code(Expression(3, Sub)) at (prev + 3, 1) to (start + 0, 2) - = (((c0 + c2) + c3) - c1) -Highest counter ID seen: c3 +- Code(Expression(2, Sub)) at (prev + 2, 12) to (start + 2, 6) + = (c0 - c2) +- Code(Counter(0)) at (prev + 3, 1) to (start + 0, 2) +Highest counter ID seen: c2 Function name: if::mcdc_check_neither -Raw bytes (68): 0x[01, 01, 06, 01, 05, 0b, 05, 01, 0d, 13, 05, 17, 0d, 01, 09, 08, 01, 07, 01, 01, 09, 28, 03, 02, 01, 08, 00, 0e, 30, 05, 02, 01, 02, 00, 00, 08, 00, 09, 05, 00, 0d, 00, 0e, 30, 09, 0d, 02, 00, 00, 00, 0d, 00, 0e, 09, 00, 0f, 02, 06, 06, 02, 0c, 02, 06, 0e, 03, 01, 00, 02] +Raw bytes (62): 0x[01, 01, 03, 01, 05, 05, 09, 01, 09, 08, 01, 07, 01, 01, 09, 28, 03, 02, 01, 08, 00, 0e, 30, 05, 02, 01, 02, 00, 00, 08, 00, 09, 05, 00, 0d, 00, 0e, 30, 09, 06, 02, 00, 00, 00, 0d, 00, 0e, 09, 00, 0f, 02, 06, 0a, 02, 0c, 02, 06, 01, 03, 01, 00, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 6 +Number of expressions: 3 - expression 0 operands: lhs = Counter(0), rhs = Counter(1) -- expression 1 operands: lhs = Expression(2, Add), rhs = Counter(1) -- expression 2 operands: lhs = Counter(0), rhs = Counter(3) -- expression 3 operands: lhs = Expression(4, Add), rhs = Counter(1) -- expression 4 operands: lhs = Expression(5, Add), rhs = Counter(3) -- expression 5 operands: lhs = Counter(0), rhs = Counter(2) +- expression 1 operands: lhs = Counter(1), rhs = Counter(2) +- expression 2 operands: lhs = Counter(0), rhs = Counter(2) Number of file 0 mappings: 8 - Code(Counter(0)) at (prev + 7, 1) to (start + 1, 9) - MCDCDecision { bitmap_idx: 3, conditions_num: 2 } at (prev + 1, 8) to (start + 0, 14) @@ -100,32 +85,27 @@ Number of file 0 mappings: 8 true = c1 false = (c0 - c1) - Code(Counter(1)) at (prev + 0, 13) to (start + 0, 14) -- MCDCBranch { true: Counter(2), false: Counter(3), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 13) to (start + 0, 14) +- MCDCBranch { true: Counter(2), false: Expression(1, Sub), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 13) to (start + 0, 14) true = c2 - false = c3 + false = (c1 - c2) - Code(Counter(2)) at (prev + 0, 15) to (start + 2, 6) -- Code(Expression(1, Sub)) at (prev + 2, 12) to (start + 2, 6) - = ((c0 + c3) - c1) -- Code(Expression(3, Sub)) at (prev + 3, 1) to (start + 0, 2) - = (((c0 + c2) + c3) - c1) -Highest counter ID seen: c3 +- Code(Expression(2, Sub)) at (prev + 2, 12) to (start + 2, 6) + = (c0 - c2) +- Code(Counter(0)) at (prev + 3, 1) to (start + 0, 2) +Highest counter ID seen: c2 Function name: if::mcdc_check_not_tree_decision -Raw bytes (93): 0x[01, 01, 0b, 01, 05, 01, 2b, 05, 09, 05, 09, 17, 2b, 01, 11, 05, 09, 23, 2b, 27, 11, 01, 0d, 05, 09, 0a, 01, 31, 01, 03, 0a, 28, 05, 03, 03, 08, 00, 15, 30, 05, 02, 01, 02, 03, 00, 09, 00, 0a, 02, 00, 0e, 00, 0f, 30, 09, 06, 03, 02, 00, 00, 0e, 00, 0f, 2b, 00, 14, 00, 15, 30, 0d, 11, 02, 00, 00, 00, 14, 00, 15, 0d, 00, 16, 02, 06, 12, 02, 0c, 02, 06, 1e, 03, 01, 00, 02] +Raw bytes (85): 0x[01, 01, 07, 01, 05, 01, 17, 05, 09, 05, 09, 17, 0d, 05, 09, 01, 0d, 0a, 01, 31, 01, 03, 0a, 28, 05, 03, 03, 08, 00, 15, 30, 05, 02, 01, 02, 03, 00, 09, 00, 0a, 02, 00, 0e, 00, 0f, 30, 09, 06, 03, 02, 00, 00, 0e, 00, 0f, 17, 00, 14, 00, 15, 30, 0d, 12, 02, 00, 00, 00, 14, 00, 15, 0d, 00, 16, 02, 06, 1a, 02, 0c, 02, 06, 01, 03, 01, 00, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 11 +Number of expressions: 7 - expression 0 operands: lhs = Counter(0), rhs = Counter(1) -- expression 1 operands: lhs = Counter(0), rhs = Expression(10, Add) +- expression 1 operands: lhs = Counter(0), rhs = Expression(5, Add) - expression 2 operands: lhs = Counter(1), rhs = Counter(2) - expression 3 operands: lhs = Counter(1), rhs = Counter(2) -- expression 4 operands: lhs = Expression(5, Add), rhs = Expression(10, Add) -- expression 5 operands: lhs = Counter(0), rhs = Counter(4) -- expression 6 operands: lhs = Counter(1), rhs = Counter(2) -- expression 7 operands: lhs = Expression(8, Add), rhs = Expression(10, Add) -- expression 8 operands: lhs = Expression(9, Add), rhs = Counter(4) -- expression 9 operands: lhs = Counter(0), rhs = Counter(3) -- expression 10 operands: lhs = Counter(1), rhs = Counter(2) +- expression 4 operands: lhs = Expression(5, Add), rhs = Counter(3) +- expression 5 operands: lhs = Counter(1), rhs = Counter(2) +- expression 6 operands: lhs = Counter(0), rhs = Counter(3) Number of file 0 mappings: 10 - Code(Counter(0)) at (prev + 49, 1) to (start + 3, 10) - MCDCDecision { bitmap_idx: 5, conditions_num: 3 } at (prev + 3, 8) to (start + 0, 21) @@ -137,33 +117,30 @@ Number of file 0 mappings: 10 - MCDCBranch { true: Counter(2), false: Expression(1, Sub), condition_id: 3, true_next_id: 2, false_next_id: 0 } at (prev + 0, 14) to (start + 0, 15) true = c2 false = (c0 - (c1 + c2)) -- Code(Expression(10, Add)) at (prev + 0, 20) to (start + 0, 21) +- Code(Expression(5, Add)) at (prev + 0, 20) to (start + 0, 21) = (c1 + c2) -- MCDCBranch { true: Counter(3), false: Counter(4), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 20) to (start + 0, 21) +- MCDCBranch { true: Counter(3), false: Expression(4, Sub), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 20) to (start + 0, 21) true = c3 - false = c4 + false = ((c1 + c2) - c3) - Code(Counter(3)) at (prev + 0, 22) to (start + 2, 6) -- Code(Expression(4, Sub)) at (prev + 2, 12) to (start + 2, 6) - = ((c0 + c4) - (c1 + c2)) -- Code(Expression(7, Sub)) at (prev + 3, 1) to (start + 0, 2) - = (((c0 + c3) + c4) - (c1 + c2)) -Highest counter ID seen: c4 +- Code(Expression(6, Sub)) at (prev + 2, 12) to (start + 2, 6) + = (c0 - c3) +- Code(Counter(0)) at (prev + 3, 1) to (start + 0, 2) +Highest counter ID seen: c3 Function name: if::mcdc_check_tree_decision -Raw bytes (91): 0x[01, 01, 0a, 01, 05, 05, 09, 05, 09, 09, 0d, 17, 05, 01, 11, 1f, 05, 23, 11, 27, 0d, 01, 09, 0a, 01, 27, 01, 03, 09, 28, 04, 03, 03, 08, 00, 15, 30, 05, 02, 01, 02, 00, 00, 08, 00, 09, 05, 00, 0e, 00, 0f, 30, 09, 0a, 02, 00, 03, 00, 0e, 00, 0f, 0a, 00, 13, 00, 14, 30, 0d, 11, 03, 00, 00, 00, 13, 00, 14, 0f, 00, 16, 02, 06, 12, 02, 0c, 02, 06, 1a, 03, 01, 00, 02] +Raw bytes (87): 0x[01, 01, 08, 01, 05, 05, 09, 05, 09, 05, 1f, 09, 0d, 09, 0d, 01, 1f, 09, 0d, 0a, 01, 27, 01, 03, 09, 28, 04, 03, 03, 08, 00, 15, 30, 05, 02, 01, 02, 00, 00, 08, 00, 09, 05, 00, 0e, 00, 0f, 30, 09, 0a, 02, 00, 03, 00, 0e, 00, 0f, 0a, 00, 13, 00, 14, 30, 0d, 0e, 03, 00, 00, 00, 13, 00, 14, 1f, 00, 16, 02, 06, 1a, 02, 0c, 02, 06, 01, 03, 01, 00, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 10 +Number of expressions: 8 - expression 0 operands: lhs = Counter(0), rhs = Counter(1) - expression 1 operands: lhs = Counter(1), rhs = Counter(2) - expression 2 operands: lhs = Counter(1), rhs = Counter(2) -- expression 3 operands: lhs = Counter(2), rhs = Counter(3) -- expression 4 operands: lhs = Expression(5, Add), rhs = Counter(1) -- expression 5 operands: lhs = Counter(0), rhs = Counter(4) -- expression 6 operands: lhs = Expression(7, Add), rhs = Counter(1) -- expression 7 operands: lhs = Expression(8, Add), rhs = Counter(4) -- expression 8 operands: lhs = Expression(9, Add), rhs = Counter(3) -- expression 9 operands: lhs = Counter(0), rhs = Counter(2) +- expression 3 operands: lhs = Counter(1), rhs = Expression(7, Add) +- expression 4 operands: lhs = Counter(2), rhs = Counter(3) +- expression 5 operands: lhs = Counter(2), rhs = Counter(3) +- expression 6 operands: lhs = Counter(0), rhs = Expression(7, Add) +- expression 7 operands: lhs = Counter(2), rhs = Counter(3) Number of file 0 mappings: 10 - Code(Counter(0)) at (prev + 39, 1) to (start + 3, 9) - MCDCDecision { bitmap_idx: 4, conditions_num: 3 } at (prev + 3, 8) to (start + 0, 21) @@ -176,38 +153,32 @@ Number of file 0 mappings: 10 false = (c1 - c2) - Code(Expression(2, Sub)) at (prev + 0, 19) to (start + 0, 20) = (c1 - c2) -- MCDCBranch { true: Counter(3), false: Counter(4), condition_id: 3, true_next_id: 0, false_next_id: 0 } at (prev + 0, 19) to (start + 0, 20) +- MCDCBranch { true: Counter(3), false: Expression(3, Sub), condition_id: 3, true_next_id: 0, false_next_id: 0 } at (prev + 0, 19) to (start + 0, 20) true = c3 - false = c4 -- Code(Expression(3, Add)) at (prev + 0, 22) to (start + 2, 6) + false = (c1 - (c2 + c3)) +- Code(Expression(7, Add)) at (prev + 0, 22) to (start + 2, 6) = (c2 + c3) -- Code(Expression(4, Sub)) at (prev + 2, 12) to (start + 2, 6) - = ((c0 + c4) - c1) -- Code(Expression(6, Sub)) at (prev + 3, 1) to (start + 0, 2) - = ((((c0 + c2) + c3) + c4) - c1) -Highest counter ID seen: c4 +- Code(Expression(6, Sub)) at (prev + 2, 12) to (start + 2, 6) + = (c0 - (c2 + c3)) +- Code(Counter(0)) at (prev + 3, 1) to (start + 0, 2) +Highest counter ID seen: c3 Function name: if::mcdc_nested_if -Raw bytes (130): 0x[01, 01, 10, 01, 05, 01, 3f, 05, 09, 05, 09, 3f, 0d, 05, 09, 3f, 0d, 05, 09, 0d, 15, 01, 3f, 05, 09, 33, 3f, 37, 15, 3b, 11, 01, 0d, 05, 09, 0e, 01, 3b, 01, 01, 09, 28, 03, 02, 01, 08, 00, 0e, 30, 05, 02, 01, 00, 02, 00, 08, 00, 09, 02, 00, 0d, 00, 0e, 30, 09, 26, 02, 00, 00, 00, 0d, 00, 0e, 3f, 01, 09, 01, 0d, 28, 06, 02, 01, 0c, 00, 12, 30, 1a, 0d, 01, 02, 00, 00, 0c, 00, 0d, 1a, 00, 11, 00, 12, 30, 11, 15, 02, 00, 00, 00, 11, 00, 12, 11, 00, 13, 02, 0a, 23, 02, 09, 00, 0a, 26, 01, 0c, 02, 06, 2e, 03, 01, 00, 02] +Raw bytes (120): 0x[01, 01, 0b, 01, 05, 01, 2b, 05, 09, 05, 09, 2b, 0d, 05, 09, 0d, 11, 2b, 11, 05, 09, 01, 2b, 05, 09, 0e, 01, 3b, 01, 01, 09, 28, 03, 02, 01, 08, 00, 0e, 30, 05, 02, 01, 00, 02, 00, 08, 00, 09, 02, 00, 0d, 00, 0e, 30, 09, 26, 02, 00, 00, 00, 0d, 00, 0e, 2b, 01, 09, 01, 0d, 28, 06, 02, 01, 0c, 00, 12, 30, 0d, 12, 01, 02, 00, 00, 0c, 00, 0d, 0d, 00, 11, 00, 12, 30, 11, 1a, 02, 00, 00, 00, 11, 00, 12, 11, 00, 13, 02, 0a, 1e, 02, 09, 00, 0a, 26, 01, 0c, 02, 06, 01, 03, 01, 00, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 16 +Number of expressions: 11 - expression 0 operands: lhs = Counter(0), rhs = Counter(1) -- expression 1 operands: lhs = Counter(0), rhs = Expression(15, Add) +- expression 1 operands: lhs = Counter(0), rhs = Expression(10, Add) - expression 2 operands: lhs = Counter(1), rhs = Counter(2) - expression 3 operands: lhs = Counter(1), rhs = Counter(2) -- expression 4 operands: lhs = Expression(15, Add), rhs = Counter(3) +- expression 4 operands: lhs = Expression(10, Add), rhs = Counter(3) - expression 5 operands: lhs = Counter(1), rhs = Counter(2) -- expression 6 operands: lhs = Expression(15, Add), rhs = Counter(3) -- expression 7 operands: lhs = Counter(1), rhs = Counter(2) -- expression 8 operands: lhs = Counter(3), rhs = Counter(5) -- expression 9 operands: lhs = Counter(0), rhs = Expression(15, Add) +- expression 6 operands: lhs = Counter(3), rhs = Counter(4) +- expression 7 operands: lhs = Expression(10, Add), rhs = Counter(4) +- expression 8 operands: lhs = Counter(1), rhs = Counter(2) +- expression 9 operands: lhs = Counter(0), rhs = Expression(10, Add) - expression 10 operands: lhs = Counter(1), rhs = Counter(2) -- expression 11 operands: lhs = Expression(12, Add), rhs = Expression(15, Add) -- expression 12 operands: lhs = Expression(13, Add), rhs = Counter(5) -- expression 13 operands: lhs = Expression(14, Add), rhs = Counter(4) -- expression 14 operands: lhs = Counter(0), rhs = Counter(3) -- expression 15 operands: lhs = Counter(1), rhs = Counter(2) Number of file 0 mappings: 14 - Code(Counter(0)) at (prev + 59, 1) to (start + 1, 9) - MCDCDecision { bitmap_idx: 3, conditions_num: 2 } at (prev + 1, 8) to (start + 0, 14) @@ -219,23 +190,21 @@ Number of file 0 mappings: 14 - MCDCBranch { true: Counter(2), false: Expression(9, Sub), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 13) to (start + 0, 14) true = c2 false = (c0 - (c1 + c2)) -- Code(Expression(15, Add)) at (prev + 1, 9) to (start + 1, 13) +- Code(Expression(10, Add)) at (prev + 1, 9) to (start + 1, 13) = (c1 + c2) - MCDCDecision { bitmap_idx: 6, conditions_num: 2 } at (prev + 1, 12) to (start + 0, 18) -- MCDCBranch { true: Expression(6, Sub), false: Counter(3), condition_id: 1, true_next_id: 2, false_next_id: 0 } at (prev + 0, 12) to (start + 0, 13) - true = ((c1 + c2) - c3) - false = c3 -- Code(Expression(6, Sub)) at (prev + 0, 17) to (start + 0, 18) - = ((c1 + c2) - c3) -- MCDCBranch { true: Counter(4), false: Counter(5), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 17) to (start + 0, 18) +- MCDCBranch { true: Counter(3), false: Expression(4, Sub), condition_id: 1, true_next_id: 2, false_next_id: 0 } at (prev + 0, 12) to (start + 0, 13) + true = c3 + false = ((c1 + c2) - c3) +- Code(Counter(3)) at (prev + 0, 17) to (start + 0, 18) +- MCDCBranch { true: Counter(4), false: Expression(6, Sub), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 17) to (start + 0, 18) true = c4 - false = c5 + false = (c3 - c4) - Code(Counter(4)) at (prev + 0, 19) to (start + 2, 10) -- Code(Expression(8, Add)) at (prev + 2, 9) to (start + 0, 10) - = (c3 + c5) +- Code(Expression(7, Sub)) at (prev + 2, 9) to (start + 0, 10) + = ((c1 + c2) - c4) - Code(Expression(9, Sub)) at (prev + 1, 12) to (start + 2, 6) = (c0 - (c1 + c2)) -- Code(Expression(11, Sub)) at (prev + 3, 1) to (start + 0, 2) - = ((((c0 + c3) + c4) + c5) - (c1 + c2)) -Highest counter ID seen: c5 +- Code(Counter(0)) at (prev + 3, 1) to (start + 0, 2) +Highest counter ID seen: c4 diff --git a/tests/coverage/mcdc/inlined_expressions.cov-map b/tests/coverage/mcdc/inlined_expressions.cov-map index 92ec60dc23c..6a112b66e88 100644 --- a/tests/coverage/mcdc/inlined_expressions.cov-map +++ b/tests/coverage/mcdc/inlined_expressions.cov-map @@ -1,12 +1,10 @@ Function name: inlined_expressions::inlined_instance -Raw bytes (54): 0x[01, 01, 04, 01, 05, 0b, 05, 0f, 0d, 01, 09, 06, 01, 08, 01, 01, 06, 28, 03, 02, 01, 05, 00, 0b, 30, 05, 02, 01, 02, 00, 00, 05, 00, 06, 05, 00, 0a, 00, 0b, 30, 09, 0d, 02, 00, 00, 00, 0a, 00, 0b, 06, 01, 01, 00, 02] +Raw bytes (50): 0x[01, 01, 02, 01, 05, 05, 09, 06, 01, 08, 01, 01, 06, 28, 03, 02, 01, 05, 00, 0b, 30, 05, 02, 01, 02, 00, 00, 05, 00, 06, 05, 00, 0a, 00, 0b, 30, 09, 06, 02, 00, 00, 00, 0a, 00, 0b, 01, 01, 01, 00, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 4 +Number of expressions: 2 - expression 0 operands: lhs = Counter(0), rhs = Counter(1) -- expression 1 operands: lhs = Expression(2, Add), rhs = Counter(1) -- expression 2 operands: lhs = Expression(3, Add), rhs = Counter(3) -- expression 3 operands: lhs = Counter(0), rhs = Counter(2) +- expression 1 operands: lhs = Counter(1), rhs = Counter(2) Number of file 0 mappings: 6 - Code(Counter(0)) at (prev + 8, 1) to (start + 1, 6) - MCDCDecision { bitmap_idx: 3, conditions_num: 2 } at (prev + 1, 5) to (start + 0, 11) @@ -14,10 +12,9 @@ Number of file 0 mappings: 6 true = c1 false = (c0 - c1) - Code(Counter(1)) at (prev + 0, 10) to (start + 0, 11) -- MCDCBranch { true: Counter(2), false: Counter(3), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 10) to (start + 0, 11) +- MCDCBranch { true: Counter(2), false: Expression(1, Sub), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 10) to (start + 0, 11) true = c2 - false = c3 -- Code(Expression(1, Sub)) at (prev + 1, 1) to (start + 0, 2) - = (((c0 + c2) + c3) - c1) -Highest counter ID seen: c3 + false = (c1 - c2) +- Code(Counter(0)) at (prev + 1, 1) to (start + 0, 2) +Highest counter ID seen: c2 diff --git a/tests/coverage/mcdc/nested_if.cov-map b/tests/coverage/mcdc/nested_if.cov-map index 72daecabc77..72c7d68840d 100644 --- a/tests/coverage/mcdc/nested_if.cov-map +++ b/tests/coverage/mcdc/nested_if.cov-map @@ -1,24 +1,22 @@ Function name: nested_if::doubly_nested_if_in_condition -Raw bytes (172): 0x[01, 01, 10, 01, 05, 05, 09, 05, 09, 05, 27, 09, 19, 19, 1d, 19, 1d, 23, 27, 05, 1d, 09, 19, 09, 0d, 33, 05, 01, 15, 3b, 05, 3f, 15, 01, 11, 14, 01, 0f, 01, 01, 09, 28, 09, 02, 01, 08, 00, 4e, 30, 05, 02, 01, 02, 00, 00, 08, 00, 09, 30, 11, 15, 02, 00, 00, 00, 0d, 00, 4e, 05, 00, 10, 00, 11, 28, 06, 02, 00, 10, 00, 36, 30, 09, 0a, 01, 00, 02, 00, 10, 00, 11, 30, 0d, 21, 02, 00, 00, 00, 15, 00, 36, 0a, 00, 18, 00, 19, 28, 03, 02, 00, 18, 00, 1e, 30, 19, 0e, 01, 02, 00, 00, 18, 00, 19, 19, 00, 1d, 00, 1e, 30, 1a, 1d, 02, 00, 00, 00, 1d, 00, 1e, 1a, 00, 21, 00, 25, 1e, 00, 2f, 00, 34, 2b, 00, 39, 00, 3e, 21, 00, 48, 00, 4c, 11, 00, 4f, 02, 06, 2e, 02, 0c, 02, 06, 36, 03, 01, 00, 02] +Raw bytes (168): 0x[01, 01, 0e, 01, 05, 05, 09, 05, 09, 05, 13, 09, 19, 19, 1d, 05, 1f, 09, 1d, 09, 0d, 2b, 05, 01, 15, 33, 05, 37, 15, 01, 11, 14, 01, 0f, 01, 01, 09, 28, 09, 02, 01, 08, 00, 4e, 30, 05, 02, 01, 02, 00, 00, 08, 00, 09, 30, 11, 15, 02, 00, 00, 00, 0d, 00, 4e, 05, 00, 10, 00, 11, 28, 06, 02, 00, 10, 00, 36, 30, 09, 0a, 01, 00, 02, 00, 10, 00, 11, 30, 0d, 21, 02, 00, 00, 00, 15, 00, 36, 0a, 00, 18, 00, 19, 28, 03, 02, 00, 18, 00, 1e, 30, 19, 0e, 01, 02, 00, 00, 18, 00, 19, 19, 00, 1d, 00, 1e, 30, 1d, 16, 02, 00, 00, 00, 1d, 00, 1e, 1d, 00, 21, 00, 25, 1a, 00, 2f, 00, 34, 23, 00, 39, 00, 3e, 21, 00, 48, 00, 4c, 11, 00, 4f, 02, 06, 26, 02, 0c, 02, 06, 2e, 03, 01, 00, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 16 +Number of expressions: 14 - expression 0 operands: lhs = Counter(0), rhs = Counter(1) - expression 1 operands: lhs = Counter(1), rhs = Counter(2) - expression 2 operands: lhs = Counter(1), rhs = Counter(2) -- expression 3 operands: lhs = Counter(1), rhs = Expression(9, Add) +- expression 3 operands: lhs = Counter(1), rhs = Expression(4, Add) - expression 4 operands: lhs = Counter(2), rhs = Counter(6) - expression 5 operands: lhs = Counter(6), rhs = Counter(7) -- expression 6 operands: lhs = Counter(6), rhs = Counter(7) -- expression 7 operands: lhs = Expression(8, Add), rhs = Expression(9, Add) -- expression 8 operands: lhs = Counter(1), rhs = Counter(7) -- expression 9 operands: lhs = Counter(2), rhs = Counter(6) -- expression 10 operands: lhs = Counter(2), rhs = Counter(3) +- expression 6 operands: lhs = Counter(1), rhs = Expression(7, Add) +- expression 7 operands: lhs = Counter(2), rhs = Counter(7) +- expression 8 operands: lhs = Counter(2), rhs = Counter(3) +- expression 9 operands: lhs = Expression(10, Add), rhs = Counter(1) +- expression 10 operands: lhs = Counter(0), rhs = Counter(5) - expression 11 operands: lhs = Expression(12, Add), rhs = Counter(1) -- expression 12 operands: lhs = Counter(0), rhs = Counter(5) -- expression 13 operands: lhs = Expression(14, Add), rhs = Counter(1) -- expression 14 operands: lhs = Expression(15, Add), rhs = Counter(5) -- expression 15 operands: lhs = Counter(0), rhs = Counter(4) +- expression 12 operands: lhs = Expression(13, Add), rhs = Counter(5) +- expression 13 operands: lhs = Counter(0), rhs = Counter(4) Number of file 0 mappings: 20 - Code(Counter(0)) at (prev + 15, 1) to (start + 1, 9) - MCDCDecision { bitmap_idx: 9, conditions_num: 2 } at (prev + 1, 8) to (start + 0, 78) @@ -43,20 +41,19 @@ Number of file 0 mappings: 20 true = c6 false = (c1 - (c2 + c6)) - Code(Counter(6)) at (prev + 0, 29) to (start + 0, 30) -- MCDCBranch { true: Expression(6, Sub), false: Counter(7), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 29) to (start + 0, 30) - true = (c6 - c7) - false = c7 -- Code(Expression(6, Sub)) at (prev + 0, 33) to (start + 0, 37) - = (c6 - c7) -- Code(Expression(7, Sub)) at (prev + 0, 47) to (start + 0, 52) - = ((c1 + c7) - (c2 + c6)) -- Code(Expression(10, Add)) at (prev + 0, 57) to (start + 0, 62) +- MCDCBranch { true: Counter(7), false: Expression(5, Sub), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 29) to (start + 0, 30) + true = c7 + false = (c6 - c7) +- Code(Counter(7)) at (prev + 0, 33) to (start + 0, 37) +- Code(Expression(6, Sub)) at (prev + 0, 47) to (start + 0, 52) + = (c1 - (c2 + c7)) +- Code(Expression(8, Add)) at (prev + 0, 57) to (start + 0, 62) = (c2 + c3) - Code(Counter(8)) at (prev + 0, 72) to (start + 0, 76) - Code(Counter(4)) at (prev + 0, 79) to (start + 2, 6) -- Code(Expression(11, Sub)) at (prev + 2, 12) to (start + 2, 6) +- Code(Expression(9, Sub)) at (prev + 2, 12) to (start + 2, 6) = ((c0 + c5) - c1) -- Code(Expression(13, Sub)) at (prev + 3, 1) to (start + 0, 2) +- Code(Expression(11, Sub)) at (prev + 3, 1) to (start + 0, 2) = (((c0 + c4) + c5) - c1) Highest counter ID seen: c8 @@ -109,30 +106,28 @@ Number of file 0 mappings: 14 Highest counter ID seen: c5 Function name: nested_if::nested_in_then_block_in_condition -Raw bytes (180): 0x[01, 01, 14, 01, 05, 05, 09, 05, 09, 05, 3b, 09, 0d, 09, 0d, 3b, 11, 09, 0d, 11, 15, 11, 15, 2f, 11, 3b, 15, 09, 0d, 05, 3b, 09, 0d, 43, 05, 01, 1d, 4b, 05, 4f, 1d, 01, 19, 14, 01, 22, 01, 01, 09, 28, 09, 02, 01, 08, 00, 4b, 30, 05, 02, 01, 02, 00, 00, 08, 00, 09, 30, 19, 1d, 02, 00, 00, 00, 0d, 00, 4b, 05, 00, 10, 00, 11, 28, 03, 02, 00, 10, 00, 16, 30, 09, 0a, 01, 00, 02, 00, 10, 00, 11, 0a, 00, 15, 00, 16, 30, 0d, 36, 02, 00, 00, 00, 15, 00, 16, 3b, 00, 1c, 00, 1d, 28, 06, 02, 00, 1c, 00, 22, 30, 11, 1a, 01, 02, 00, 00, 1c, 00, 1d, 11, 00, 21, 00, 22, 30, 26, 15, 02, 00, 00, 00, 21, 00, 22, 26, 00, 25, 00, 29, 2a, 00, 33, 00, 38, 36, 00, 44, 00, 49, 19, 00, 4c, 02, 06, 3e, 02, 0c, 02, 06, 46, 03, 01, 00, 02] +Raw bytes (176): 0x[01, 01, 12, 01, 05, 05, 09, 05, 09, 05, 33, 09, 0d, 09, 0d, 33, 11, 09, 0d, 11, 15, 33, 15, 09, 0d, 05, 33, 09, 0d, 3b, 05, 01, 1d, 43, 05, 47, 1d, 01, 19, 14, 01, 22, 01, 01, 09, 28, 09, 02, 01, 08, 00, 4b, 30, 05, 02, 01, 02, 00, 00, 08, 00, 09, 30, 19, 1d, 02, 00, 00, 00, 0d, 00, 4b, 05, 00, 10, 00, 11, 28, 03, 02, 00, 10, 00, 16, 30, 09, 0a, 01, 00, 02, 00, 10, 00, 11, 0a, 00, 15, 00, 16, 30, 0d, 2e, 02, 00, 00, 00, 15, 00, 16, 33, 00, 1c, 00, 1d, 28, 06, 02, 00, 1c, 00, 22, 30, 11, 1a, 01, 02, 00, 00, 1c, 00, 1d, 11, 00, 21, 00, 22, 30, 15, 22, 02, 00, 00, 00, 21, 00, 22, 15, 00, 25, 00, 29, 26, 00, 33, 00, 38, 2e, 00, 44, 00, 49, 19, 00, 4c, 02, 06, 36, 02, 0c, 02, 06, 3e, 03, 01, 00, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 20 +Number of expressions: 18 - expression 0 operands: lhs = Counter(0), rhs = Counter(1) - expression 1 operands: lhs = Counter(1), rhs = Counter(2) - expression 2 operands: lhs = Counter(1), rhs = Counter(2) -- expression 3 operands: lhs = Counter(1), rhs = Expression(14, Add) +- expression 3 operands: lhs = Counter(1), rhs = Expression(12, Add) - expression 4 operands: lhs = Counter(2), rhs = Counter(3) - expression 5 operands: lhs = Counter(2), rhs = Counter(3) -- expression 6 operands: lhs = Expression(14, Add), rhs = Counter(4) +- expression 6 operands: lhs = Expression(12, Add), rhs = Counter(4) - expression 7 operands: lhs = Counter(2), rhs = Counter(3) - expression 8 operands: lhs = Counter(4), rhs = Counter(5) -- expression 9 operands: lhs = Counter(4), rhs = Counter(5) -- expression 10 operands: lhs = Expression(11, Add), rhs = Counter(4) -- expression 11 operands: lhs = Expression(14, Add), rhs = Counter(5) +- expression 9 operands: lhs = Expression(12, Add), rhs = Counter(5) +- expression 10 operands: lhs = Counter(2), rhs = Counter(3) +- expression 11 operands: lhs = Counter(1), rhs = Expression(12, Add) - expression 12 operands: lhs = Counter(2), rhs = Counter(3) -- expression 13 operands: lhs = Counter(1), rhs = Expression(14, Add) -- expression 14 operands: lhs = Counter(2), rhs = Counter(3) +- expression 13 operands: lhs = Expression(14, Add), rhs = Counter(1) +- expression 14 operands: lhs = Counter(0), rhs = Counter(7) - expression 15 operands: lhs = Expression(16, Add), rhs = Counter(1) -- expression 16 operands: lhs = Counter(0), rhs = Counter(7) -- expression 17 operands: lhs = Expression(18, Add), rhs = Counter(1) -- expression 18 operands: lhs = Expression(19, Add), rhs = Counter(7) -- expression 19 operands: lhs = Counter(0), rhs = Counter(6) +- expression 16 operands: lhs = Expression(17, Add), rhs = Counter(7) +- expression 17 operands: lhs = Counter(0), rhs = Counter(6) Number of file 0 mappings: 20 - Code(Counter(0)) at (prev + 34, 1) to (start + 1, 9) - MCDCDecision { bitmap_idx: 9, conditions_num: 2 } at (prev + 1, 8) to (start + 0, 75) @@ -149,29 +144,28 @@ Number of file 0 mappings: 20 false = (c1 - c2) - Code(Expression(2, Sub)) at (prev + 0, 21) to (start + 0, 22) = (c1 - c2) -- MCDCBranch { true: Counter(3), false: Expression(13, Sub), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 21) to (start + 0, 22) +- MCDCBranch { true: Counter(3), false: Expression(11, Sub), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 21) to (start + 0, 22) true = c3 false = (c1 - (c2 + c3)) -- Code(Expression(14, Add)) at (prev + 0, 28) to (start + 0, 29) +- Code(Expression(12, Add)) at (prev + 0, 28) to (start + 0, 29) = (c2 + c3) - MCDCDecision { bitmap_idx: 6, conditions_num: 2 } at (prev + 0, 28) to (start + 0, 34) - MCDCBranch { true: Counter(4), false: Expression(6, Sub), condition_id: 1, true_next_id: 2, false_next_id: 0 } at (prev + 0, 28) to (start + 0, 29) true = c4 false = ((c2 + c3) - c4) - Code(Counter(4)) at (prev + 0, 33) to (start + 0, 34) -- MCDCBranch { true: Expression(9, Sub), false: Counter(5), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 33) to (start + 0, 34) - true = (c4 - c5) - false = c5 -- Code(Expression(9, Sub)) at (prev + 0, 37) to (start + 0, 41) - = (c4 - c5) -- Code(Expression(10, Sub)) at (prev + 0, 51) to (start + 0, 56) - = (((c2 + c3) + c5) - c4) -- Code(Expression(13, Sub)) at (prev + 0, 68) to (start + 0, 73) +- MCDCBranch { true: Counter(5), false: Expression(8, Sub), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 33) to (start + 0, 34) + true = c5 + false = (c4 - c5) +- Code(Counter(5)) at (prev + 0, 37) to (start + 0, 41) +- Code(Expression(9, Sub)) at (prev + 0, 51) to (start + 0, 56) + = ((c2 + c3) - c5) +- Code(Expression(11, Sub)) at (prev + 0, 68) to (start + 0, 73) = (c1 - (c2 + c3)) - Code(Counter(6)) at (prev + 0, 76) to (start + 2, 6) -- Code(Expression(15, Sub)) at (prev + 2, 12) to (start + 2, 6) +- Code(Expression(13, Sub)) at (prev + 2, 12) to (start + 2, 6) = ((c0 + c7) - c1) -- Code(Expression(17, Sub)) at (prev + 3, 1) to (start + 0, 2) +- Code(Expression(15, Sub)) at (prev + 3, 1) to (start + 0, 2) = (((c0 + c6) + c7) - c1) Highest counter ID seen: c7 diff --git a/tests/coverage/mcdc/non_control_flow.cov-map b/tests/coverage/mcdc/non_control_flow.cov-map index 0edeff9a586..c282d53c5ac 100644 --- a/tests/coverage/mcdc/non_control_flow.cov-map +++ b/tests/coverage/mcdc/non_control_flow.cov-map @@ -1,124 +1,107 @@ Function name: non_control_flow::assign_3 -Raw bytes (89): 0x[01, 01, 09, 07, 11, 0b, 0d, 05, 09, 01, 05, 01, 05, 01, 23, 05, 11, 01, 23, 05, 11, 0a, 01, 16, 01, 00, 28, 03, 01, 09, 00, 0a, 01, 00, 0d, 00, 0e, 28, 04, 03, 00, 0d, 00, 18, 30, 05, 12, 01, 00, 02, 00, 0d, 00, 0e, 12, 00, 12, 00, 13, 30, 1e, 11, 02, 03, 00, 00, 12, 00, 13, 1e, 00, 17, 00, 18, 30, 09, 0d, 03, 00, 00, 00, 17, 00, 18, 03, 01, 05, 01, 02] +Raw bytes (79): 0x[01, 01, 04, 01, 05, 01, 0b, 05, 09, 09, 0d, 0a, 01, 16, 01, 00, 28, 01, 01, 09, 00, 0a, 01, 00, 0d, 00, 0e, 28, 04, 03, 00, 0d, 00, 18, 30, 05, 02, 01, 00, 02, 00, 0d, 00, 0e, 02, 00, 12, 00, 13, 30, 09, 06, 02, 03, 00, 00, 12, 00, 13, 09, 00, 17, 00, 18, 30, 0d, 0e, 03, 00, 00, 00, 17, 00, 18, 01, 01, 05, 01, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 9 -- expression 0 operands: lhs = Expression(1, Add), rhs = Counter(4) -- expression 1 operands: lhs = Expression(2, Add), rhs = Counter(3) +Number of expressions: 4 +- expression 0 operands: lhs = Counter(0), rhs = Counter(1) +- expression 1 operands: lhs = Counter(0), rhs = Expression(2, Add) - expression 2 operands: lhs = Counter(1), rhs = Counter(2) -- expression 3 operands: lhs = Counter(0), rhs = Counter(1) -- expression 4 operands: lhs = Counter(0), rhs = Counter(1) -- expression 5 operands: lhs = Counter(0), rhs = Expression(8, Add) -- expression 6 operands: lhs = Counter(1), rhs = Counter(4) -- expression 7 operands: lhs = Counter(0), rhs = Expression(8, Add) -- expression 8 operands: lhs = Counter(1), rhs = Counter(4) +- expression 3 operands: lhs = Counter(2), rhs = Counter(3) Number of file 0 mappings: 10 - Code(Counter(0)) at (prev + 22, 1) to (start + 0, 40) -- Code(Expression(0, Add)) at (prev + 1, 9) to (start + 0, 10) - = (((c1 + c2) + c3) + c4) +- Code(Counter(0)) at (prev + 1, 9) to (start + 0, 10) - Code(Counter(0)) at (prev + 0, 13) to (start + 0, 14) - MCDCDecision { bitmap_idx: 4, conditions_num: 3 } at (prev + 0, 13) to (start + 0, 24) -- MCDCBranch { true: Counter(1), false: Expression(4, Sub), condition_id: 1, true_next_id: 0, false_next_id: 2 } at (prev + 0, 13) to (start + 0, 14) +- MCDCBranch { true: Counter(1), false: Expression(0, Sub), condition_id: 1, true_next_id: 0, false_next_id: 2 } at (prev + 0, 13) to (start + 0, 14) true = c1 false = (c0 - c1) -- Code(Expression(4, Sub)) at (prev + 0, 18) to (start + 0, 19) +- Code(Expression(0, Sub)) at (prev + 0, 18) to (start + 0, 19) = (c0 - c1) -- MCDCBranch { true: Expression(7, Sub), false: Counter(4), condition_id: 2, true_next_id: 3, false_next_id: 0 } at (prev + 0, 18) to (start + 0, 19) - true = (c0 - (c1 + c4)) - false = c4 -- Code(Expression(7, Sub)) at (prev + 0, 23) to (start + 0, 24) - = (c0 - (c1 + c4)) -- MCDCBranch { true: Counter(2), false: Counter(3), condition_id: 3, true_next_id: 0, false_next_id: 0 } at (prev + 0, 23) to (start + 0, 24) +- MCDCBranch { true: Counter(2), false: Expression(1, Sub), condition_id: 2, true_next_id: 3, false_next_id: 0 } at (prev + 0, 18) to (start + 0, 19) true = c2 - false = c3 -- Code(Expression(0, Add)) at (prev + 1, 5) to (start + 1, 2) - = (((c1 + c2) + c3) + c4) -Highest counter ID seen: c4 + false = (c0 - (c1 + c2)) +- Code(Counter(2)) at (prev + 0, 23) to (start + 0, 24) +- MCDCBranch { true: Counter(3), false: Expression(3, Sub), condition_id: 3, true_next_id: 0, false_next_id: 0 } at (prev + 0, 23) to (start + 0, 24) + true = c3 + false = (c2 - c3) +- Code(Counter(0)) at (prev + 1, 5) to (start + 1, 2) +Highest counter ID seen: c3 Function name: non_control_flow::assign_3_bis -Raw bytes (81): 0x[01, 01, 05, 07, 11, 09, 0d, 01, 05, 05, 09, 01, 09, 0a, 01, 1b, 01, 00, 2c, 03, 01, 09, 00, 0a, 01, 00, 0d, 00, 0e, 28, 05, 03, 00, 0d, 00, 18, 30, 05, 0a, 01, 03, 02, 00, 0d, 00, 0e, 05, 00, 12, 00, 13, 30, 09, 0e, 03, 00, 02, 00, 12, 00, 13, 12, 00, 17, 00, 18, 30, 0d, 11, 02, 00, 00, 00, 17, 00, 18, 03, 01, 05, 01, 02] +Raw bytes (81): 0x[01, 01, 05, 01, 05, 05, 09, 01, 09, 01, 13, 09, 0d, 0a, 01, 1b, 01, 00, 2c, 01, 01, 09, 00, 0a, 01, 00, 0d, 00, 0e, 28, 05, 03, 00, 0d, 00, 18, 30, 05, 02, 01, 03, 02, 00, 0d, 00, 0e, 05, 00, 12, 00, 13, 30, 09, 06, 03, 00, 02, 00, 12, 00, 13, 0a, 00, 17, 00, 18, 30, 0d, 0e, 02, 00, 00, 00, 17, 00, 18, 01, 01, 05, 01, 02] Number of files: 1 - file 0 => global file 1 Number of expressions: 5 -- expression 0 operands: lhs = Expression(1, Add), rhs = Counter(4) -- expression 1 operands: lhs = Counter(2), rhs = Counter(3) -- expression 2 operands: lhs = Counter(0), rhs = Counter(1) -- expression 3 operands: lhs = Counter(1), rhs = Counter(2) -- expression 4 operands: lhs = Counter(0), rhs = Counter(2) +- expression 0 operands: lhs = Counter(0), rhs = Counter(1) +- expression 1 operands: lhs = Counter(1), rhs = Counter(2) +- expression 2 operands: lhs = Counter(0), rhs = Counter(2) +- expression 3 operands: lhs = Counter(0), rhs = Expression(4, Add) +- expression 4 operands: lhs = Counter(2), rhs = Counter(3) Number of file 0 mappings: 10 - Code(Counter(0)) at (prev + 27, 1) to (start + 0, 44) -- Code(Expression(0, Add)) at (prev + 1, 9) to (start + 0, 10) - = ((c2 + c3) + c4) +- Code(Counter(0)) at (prev + 1, 9) to (start + 0, 10) - Code(Counter(0)) at (prev + 0, 13) to (start + 0, 14) - MCDCDecision { bitmap_idx: 5, conditions_num: 3 } at (prev + 0, 13) to (start + 0, 24) -- MCDCBranch { true: Counter(1), false: Expression(2, Sub), condition_id: 1, true_next_id: 3, false_next_id: 2 } at (prev + 0, 13) to (start + 0, 14) +- MCDCBranch { true: Counter(1), false: Expression(0, Sub), condition_id: 1, true_next_id: 3, false_next_id: 2 } at (prev + 0, 13) to (start + 0, 14) true = c1 false = (c0 - c1) - Code(Counter(1)) at (prev + 0, 18) to (start + 0, 19) -- MCDCBranch { true: Counter(2), false: Expression(3, Sub), condition_id: 3, true_next_id: 0, false_next_id: 2 } at (prev + 0, 18) to (start + 0, 19) +- MCDCBranch { true: Counter(2), false: Expression(1, Sub), condition_id: 3, true_next_id: 0, false_next_id: 2 } at (prev + 0, 18) to (start + 0, 19) true = c2 false = (c1 - c2) -- Code(Expression(4, Sub)) at (prev + 0, 23) to (start + 0, 24) +- Code(Expression(2, Sub)) at (prev + 0, 23) to (start + 0, 24) = (c0 - c2) -- MCDCBranch { true: Counter(3), false: Counter(4), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 23) to (start + 0, 24) +- MCDCBranch { true: Counter(3), false: Expression(3, Sub), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 23) to (start + 0, 24) true = c3 - false = c4 -- Code(Expression(0, Add)) at (prev + 1, 5) to (start + 1, 2) - = ((c2 + c3) + c4) -Highest counter ID seen: c4 + false = (c0 - (c2 + c3)) +- Code(Counter(0)) at (prev + 1, 5) to (start + 1, 2) +Highest counter ID seen: c3 Function name: non_control_flow::assign_and -Raw bytes (64): 0x[01, 01, 04, 07, 05, 0b, 0d, 01, 09, 01, 05, 08, 01, 0c, 01, 00, 21, 02, 01, 09, 00, 0a, 01, 00, 0d, 00, 0e, 28, 03, 02, 00, 0d, 00, 13, 30, 05, 0e, 01, 02, 00, 00, 0d, 00, 0e, 05, 00, 12, 00, 13, 30, 09, 0d, 02, 00, 00, 00, 12, 00, 13, 02, 01, 05, 01, 02] +Raw bytes (60): 0x[01, 01, 02, 01, 05, 05, 09, 08, 01, 0c, 01, 00, 21, 01, 01, 09, 00, 0a, 01, 00, 0d, 00, 0e, 28, 03, 02, 00, 0d, 00, 13, 30, 05, 02, 01, 02, 00, 00, 0d, 00, 0e, 05, 00, 12, 00, 13, 30, 09, 06, 02, 00, 00, 00, 12, 00, 13, 01, 01, 05, 01, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 4 -- expression 0 operands: lhs = Expression(1, Add), rhs = Counter(1) -- expression 1 operands: lhs = Expression(2, Add), rhs = Counter(3) -- expression 2 operands: lhs = Counter(0), rhs = Counter(2) -- expression 3 operands: lhs = Counter(0), rhs = Counter(1) +Number of expressions: 2 +- expression 0 operands: lhs = Counter(0), rhs = Counter(1) +- expression 1 operands: lhs = Counter(1), rhs = Counter(2) Number of file 0 mappings: 8 - Code(Counter(0)) at (prev + 12, 1) to (start + 0, 33) -- Code(Expression(0, Sub)) at (prev + 1, 9) to (start + 0, 10) - = (((c0 + c2) + c3) - c1) +- Code(Counter(0)) at (prev + 1, 9) to (start + 0, 10) - Code(Counter(0)) at (prev + 0, 13) to (start + 0, 14) - MCDCDecision { bitmap_idx: 3, conditions_num: 2 } at (prev + 0, 13) to (start + 0, 19) -- MCDCBranch { true: Counter(1), false: Expression(3, Sub), condition_id: 1, true_next_id: 2, false_next_id: 0 } at (prev + 0, 13) to (start + 0, 14) +- MCDCBranch { true: Counter(1), false: Expression(0, Sub), condition_id: 1, true_next_id: 2, false_next_id: 0 } at (prev + 0, 13) to (start + 0, 14) true = c1 false = (c0 - c1) - Code(Counter(1)) at (prev + 0, 18) to (start + 0, 19) -- MCDCBranch { true: Counter(2), false: Counter(3), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 18) to (start + 0, 19) +- MCDCBranch { true: Counter(2), false: Expression(1, Sub), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 18) to (start + 0, 19) true = c2 - false = c3 -- Code(Expression(0, Sub)) at (prev + 1, 5) to (start + 1, 2) - = (((c0 + c2) + c3) - c1) -Highest counter ID seen: c3 + false = (c1 - c2) +- Code(Counter(0)) at (prev + 1, 5) to (start + 1, 2) +Highest counter ID seen: c2 Function name: non_control_flow::assign_or -Raw bytes (64): 0x[01, 01, 04, 07, 0d, 05, 09, 01, 05, 01, 05, 08, 01, 11, 01, 00, 20, 03, 01, 09, 00, 0a, 01, 00, 0d, 00, 0e, 28, 03, 02, 00, 0d, 00, 13, 30, 05, 0e, 01, 00, 02, 00, 0d, 00, 0e, 0e, 00, 12, 00, 13, 30, 09, 0d, 02, 00, 00, 00, 12, 00, 13, 03, 01, 05, 01, 02] +Raw bytes (62): 0x[01, 01, 03, 01, 05, 01, 0b, 05, 09, 08, 01, 11, 01, 00, 20, 01, 01, 09, 00, 0a, 01, 00, 0d, 00, 0e, 28, 03, 02, 00, 0d, 00, 13, 30, 05, 02, 01, 00, 02, 00, 0d, 00, 0e, 02, 00, 12, 00, 13, 30, 09, 06, 02, 00, 00, 00, 12, 00, 13, 01, 01, 05, 01, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 4 -- expression 0 operands: lhs = Expression(1, Add), rhs = Counter(3) -- expression 1 operands: lhs = Counter(1), rhs = Counter(2) -- expression 2 operands: lhs = Counter(0), rhs = Counter(1) -- expression 3 operands: lhs = Counter(0), rhs = Counter(1) +Number of expressions: 3 +- expression 0 operands: lhs = Counter(0), rhs = Counter(1) +- expression 1 operands: lhs = Counter(0), rhs = Expression(2, Add) +- expression 2 operands: lhs = Counter(1), rhs = Counter(2) Number of file 0 mappings: 8 - Code(Counter(0)) at (prev + 17, 1) to (start + 0, 32) -- Code(Expression(0, Add)) at (prev + 1, 9) to (start + 0, 10) - = ((c1 + c2) + c3) +- Code(Counter(0)) at (prev + 1, 9) to (start + 0, 10) - Code(Counter(0)) at (prev + 0, 13) to (start + 0, 14) - MCDCDecision { bitmap_idx: 3, conditions_num: 2 } at (prev + 0, 13) to (start + 0, 19) -- MCDCBranch { true: Counter(1), false: Expression(3, Sub), condition_id: 1, true_next_id: 0, false_next_id: 2 } at (prev + 0, 13) to (start + 0, 14) +- MCDCBranch { true: Counter(1), false: Expression(0, Sub), condition_id: 1, true_next_id: 0, false_next_id: 2 } at (prev + 0, 13) to (start + 0, 14) true = c1 false = (c0 - c1) -- Code(Expression(3, Sub)) at (prev + 0, 18) to (start + 0, 19) +- Code(Expression(0, Sub)) at (prev + 0, 18) to (start + 0, 19) = (c0 - c1) -- MCDCBranch { true: Counter(2), false: Counter(3), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 18) to (start + 0, 19) +- MCDCBranch { true: Counter(2), false: Expression(1, Sub), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 18) to (start + 0, 19) true = c2 - false = c3 -- Code(Expression(0, Add)) at (prev + 1, 5) to (start + 1, 2) - = ((c1 + c2) + c3) -Highest counter ID seen: c3 + false = (c0 - (c1 + c2)) +- Code(Counter(0)) at (prev + 1, 5) to (start + 1, 2) +Highest counter ID seen: c2 Function name: non_control_flow::foo Raw bytes (9): 0x[01, 01, 00, 01, 01, 25, 01, 02, 02] @@ -130,14 +113,12 @@ Number of file 0 mappings: 1 Highest counter ID seen: c0 Function name: non_control_flow::func_call -Raw bytes (54): 0x[01, 01, 04, 01, 05, 0b, 05, 0f, 0d, 01, 09, 06, 01, 29, 01, 01, 0a, 28, 03, 02, 01, 09, 00, 0f, 30, 05, 02, 01, 02, 00, 00, 09, 00, 0a, 05, 00, 0e, 00, 0f, 30, 09, 0d, 02, 00, 00, 00, 0e, 00, 0f, 06, 01, 01, 00, 02] +Raw bytes (50): 0x[01, 01, 02, 01, 05, 05, 09, 06, 01, 29, 01, 01, 0a, 28, 03, 02, 01, 09, 00, 0f, 30, 05, 02, 01, 02, 00, 00, 09, 00, 0a, 05, 00, 0e, 00, 0f, 30, 09, 06, 02, 00, 00, 00, 0e, 00, 0f, 01, 01, 01, 00, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 4 +Number of expressions: 2 - expression 0 operands: lhs = Counter(0), rhs = Counter(1) -- expression 1 operands: lhs = Expression(2, Add), rhs = Counter(1) -- expression 2 operands: lhs = Expression(3, Add), rhs = Counter(3) -- expression 3 operands: lhs = Counter(0), rhs = Counter(2) +- expression 1 operands: lhs = Counter(1), rhs = Counter(2) Number of file 0 mappings: 6 - Code(Counter(0)) at (prev + 41, 1) to (start + 1, 10) - MCDCDecision { bitmap_idx: 3, conditions_num: 2 } at (prev + 1, 9) to (start + 0, 15) @@ -145,66 +126,46 @@ Number of file 0 mappings: 6 true = c1 false = (c0 - c1) - Code(Counter(1)) at (prev + 0, 14) to (start + 0, 15) -- MCDCBranch { true: Counter(2), false: Counter(3), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 14) to (start + 0, 15) +- MCDCBranch { true: Counter(2), false: Expression(1, Sub), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 14) to (start + 0, 15) true = c2 - false = c3 -- Code(Expression(1, Sub)) at (prev + 1, 1) to (start + 0, 2) - = (((c0 + c2) + c3) - c1) -Highest counter ID seen: c3 + false = (c1 - c2) +- Code(Counter(0)) at (prev + 1, 1) to (start + 0, 2) +Highest counter ID seen: c2 Function name: non_control_flow::right_comb_tree -Raw bytes (139): 0x[01, 01, 13, 07, 05, 0b, 19, 0f, 15, 13, 11, 17, 0d, 01, 09, 01, 05, 05, 09, 05, 09, 05, 4b, 09, 0d, 05, 4b, 09, 0d, 05, 47, 4b, 11, 09, 0d, 05, 47, 4b, 11, 09, 0d, 0e, 01, 20, 01, 00, 41, 02, 01, 09, 00, 0a, 01, 00, 0d, 00, 0e, 28, 06, 05, 00, 0d, 00, 2a, 30, 05, 1a, 01, 02, 00, 00, 0d, 00, 0e, 05, 00, 13, 00, 14, 30, 22, 09, 02, 03, 00, 00, 13, 00, 14, 22, 00, 19, 00, 1a, 30, 2e, 0d, 03, 04, 00, 00, 19, 00, 1a, 2e, 00, 1f, 00, 20, 30, 42, 11, 04, 05, 00, 00, 1f, 00, 20, 42, 00, 24, 00, 27, 30, 15, 19, 05, 00, 00, 00, 24, 00, 27, 02, 01, 05, 01, 02] +Raw bytes (111): 0x[01, 01, 05, 01, 05, 05, 09, 09, 0d, 0d, 11, 11, 15, 0e, 01, 20, 01, 00, 41, 01, 01, 09, 00, 0a, 01, 00, 0d, 00, 0e, 28, 06, 05, 00, 0d, 00, 2a, 30, 05, 02, 01, 02, 00, 00, 0d, 00, 0e, 05, 00, 13, 00, 14, 30, 09, 06, 02, 03, 00, 00, 13, 00, 14, 09, 00, 19, 00, 1a, 30, 0d, 0a, 03, 04, 00, 00, 19, 00, 1a, 0d, 00, 1f, 00, 20, 30, 11, 0e, 04, 05, 00, 00, 1f, 00, 20, 11, 00, 24, 00, 27, 30, 15, 12, 05, 00, 00, 00, 24, 00, 27, 01, 01, 05, 01, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 19 -- expression 0 operands: lhs = Expression(1, Add), rhs = Counter(1) -- expression 1 operands: lhs = Expression(2, Add), rhs = Counter(6) -- expression 2 operands: lhs = Expression(3, Add), rhs = Counter(5) -- expression 3 operands: lhs = Expression(4, Add), rhs = Counter(4) -- expression 4 operands: lhs = Expression(5, Add), rhs = Counter(3) -- expression 5 operands: lhs = Counter(0), rhs = Counter(2) -- expression 6 operands: lhs = Counter(0), rhs = Counter(1) -- expression 7 operands: lhs = Counter(1), rhs = Counter(2) -- expression 8 operands: lhs = Counter(1), rhs = Counter(2) -- expression 9 operands: lhs = Counter(1), rhs = Expression(18, Add) -- expression 10 operands: lhs = Counter(2), rhs = Counter(3) -- expression 11 operands: lhs = Counter(1), rhs = Expression(18, Add) -- expression 12 operands: lhs = Counter(2), rhs = Counter(3) -- expression 13 operands: lhs = Counter(1), rhs = Expression(17, Add) -- expression 14 operands: lhs = Expression(18, Add), rhs = Counter(4) -- expression 15 operands: lhs = Counter(2), rhs = Counter(3) -- expression 16 operands: lhs = Counter(1), rhs = Expression(17, Add) -- expression 17 operands: lhs = Expression(18, Add), rhs = Counter(4) -- expression 18 operands: lhs = Counter(2), rhs = Counter(3) +Number of expressions: 5 +- expression 0 operands: lhs = Counter(0), rhs = Counter(1) +- expression 1 operands: lhs = Counter(1), rhs = Counter(2) +- expression 2 operands: lhs = Counter(2), rhs = Counter(3) +- expression 3 operands: lhs = Counter(3), rhs = Counter(4) +- expression 4 operands: lhs = Counter(4), rhs = Counter(5) Number of file 0 mappings: 14 - Code(Counter(0)) at (prev + 32, 1) to (start + 0, 65) -- Code(Expression(0, Sub)) at (prev + 1, 9) to (start + 0, 10) - = ((((((c0 + c2) + c3) + c4) + c5) + c6) - c1) +- Code(Counter(0)) at (prev + 1, 9) to (start + 0, 10) - Code(Counter(0)) at (prev + 0, 13) to (start + 0, 14) - MCDCDecision { bitmap_idx: 6, conditions_num: 5 } at (prev + 0, 13) to (start + 0, 42) -- MCDCBranch { true: Counter(1), false: Expression(6, Sub), condition_id: 1, true_next_id: 2, false_next_id: 0 } at (prev + 0, 13) to (start + 0, 14) +- MCDCBranch { true: Counter(1), false: Expression(0, Sub), condition_id: 1, true_next_id: 2, false_next_id: 0 } at (prev + 0, 13) to (start + 0, 14) true = c1 false = (c0 - c1) - Code(Counter(1)) at (prev + 0, 19) to (start + 0, 20) -- MCDCBranch { true: Expression(8, Sub), false: Counter(2), condition_id: 2, true_next_id: 3, false_next_id: 0 } at (prev + 0, 19) to (start + 0, 20) - true = (c1 - c2) - false = c2 -- Code(Expression(8, Sub)) at (prev + 0, 25) to (start + 0, 26) - = (c1 - c2) -- MCDCBranch { true: Expression(11, Sub), false: Counter(3), condition_id: 3, true_next_id: 4, false_next_id: 0 } at (prev + 0, 25) to (start + 0, 26) - true = (c1 - (c2 + c3)) - false = c3 -- Code(Expression(11, Sub)) at (prev + 0, 31) to (start + 0, 32) - = (c1 - (c2 + c3)) -- MCDCBranch { true: Expression(16, Sub), false: Counter(4), condition_id: 4, true_next_id: 5, false_next_id: 0 } at (prev + 0, 31) to (start + 0, 32) - true = (c1 - ((c2 + c3) + c4)) - false = c4 -- Code(Expression(16, Sub)) at (prev + 0, 36) to (start + 0, 39) - = (c1 - ((c2 + c3) + c4)) -- MCDCBranch { true: Counter(5), false: Counter(6), condition_id: 5, true_next_id: 0, false_next_id: 0 } at (prev + 0, 36) to (start + 0, 39) +- MCDCBranch { true: Counter(2), false: Expression(1, Sub), condition_id: 2, true_next_id: 3, false_next_id: 0 } at (prev + 0, 19) to (start + 0, 20) + true = c2 + false = (c1 - c2) +- Code(Counter(2)) at (prev + 0, 25) to (start + 0, 26) +- MCDCBranch { true: Counter(3), false: Expression(2, Sub), condition_id: 3, true_next_id: 4, false_next_id: 0 } at (prev + 0, 25) to (start + 0, 26) + true = c3 + false = (c2 - c3) +- Code(Counter(3)) at (prev + 0, 31) to (start + 0, 32) +- MCDCBranch { true: Counter(4), false: Expression(3, Sub), condition_id: 4, true_next_id: 5, false_next_id: 0 } at (prev + 0, 31) to (start + 0, 32) + true = c4 + false = (c3 - c4) +- Code(Counter(4)) at (prev + 0, 36) to (start + 0, 39) +- MCDCBranch { true: Counter(5), false: Expression(4, Sub), condition_id: 5, true_next_id: 0, false_next_id: 0 } at (prev + 0, 36) to (start + 0, 39) true = c5 - false = c6 -- Code(Expression(0, Sub)) at (prev + 1, 5) to (start + 1, 2) - = ((((((c0 + c2) + c3) + c4) + c5) + c6) - c1) -Highest counter ID seen: c6 + false = (c4 - c5) +- Code(Counter(0)) at (prev + 1, 5) to (start + 1, 2) +Highest counter ID seen: c5 diff --git a/tests/coverage/try_error_result.cov-map b/tests/coverage/try_error_result.cov-map index 7fbd2cc642e..f90b73592bd 100644 --- a/tests/coverage/try_error_result.cov-map +++ b/tests/coverage/try_error_result.cov-map @@ -55,18 +55,15 @@ Number of file 0 mappings: 4 Highest counter ID seen: c1 Function name: try_error_result::test1 -Raw bytes (75): 0x[01, 01, 08, 07, 09, 01, 00, 03, 0d, 03, 13, 0d, 11, 1b, 00, 1f, 00, 0d, 15, 0b, 01, 0d, 01, 02, 17, 03, 07, 09, 00, 0e, 0a, 02, 09, 04, 1a, 11, 06, 0d, 00, 29, 15, 00, 29, 00, 2a, 00, 01, 0d, 00, 2a, 00, 00, 2a, 00, 2b, 0e, 04, 0d, 00, 2a, 00, 00, 2a, 00, 2b, 0d, 03, 05, 00, 0b, 17, 01, 01, 00, 02] +Raw bytes (69): 0x[01, 01, 05, 07, 09, 01, 00, 03, 0d, 03, 13, 0d, 11, 0b, 01, 0d, 01, 02, 17, 03, 07, 09, 00, 0e, 0a, 02, 09, 04, 1a, 11, 06, 0d, 00, 29, 15, 00, 29, 00, 2a, 00, 01, 0d, 00, 2a, 00, 00, 2a, 00, 2b, 0e, 04, 0d, 00, 2a, 00, 00, 2a, 00, 2b, 0d, 03, 05, 00, 0b, 01, 01, 01, 00, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 8 +Number of expressions: 5 - expression 0 operands: lhs = Expression(1, Add), rhs = Counter(2) - expression 1 operands: lhs = Counter(0), rhs = Zero - expression 2 operands: lhs = Expression(0, Add), rhs = Counter(3) - expression 3 operands: lhs = Expression(0, Add), rhs = Expression(4, Add) - expression 4 operands: lhs = Counter(3), rhs = Counter(4) -- expression 5 operands: lhs = Expression(6, Add), rhs = Zero -- expression 6 operands: lhs = Expression(7, Add), rhs = Zero -- expression 7 operands: lhs = Counter(3), rhs = Counter(5) Number of file 0 mappings: 11 - Code(Counter(0)) at (prev + 13, 1) to (start + 2, 23) - Code(Expression(0, Add)) at (prev + 7, 9) to (start + 0, 14) @@ -81,8 +78,7 @@ Number of file 0 mappings: 11 = (((c0 + Zero) + c2) - (c3 + c4)) - Code(Zero) at (prev + 0, 42) to (start + 0, 43) - Code(Counter(3)) at (prev + 3, 5) to (start + 0, 11) -- Code(Expression(5, Add)) at (prev + 1, 1) to (start + 0, 2) - = (((c3 + c5) + Zero) + Zero) +- Code(Counter(0)) at (prev + 1, 1) to (start + 0, 2) Highest counter ID seen: c5 Function name: try_error_result::test2 diff --git a/tests/coverage/unicode.cov-map b/tests/coverage/unicode.cov-map index 630ab4ce47e..0a4e367bb9e 100644 --- a/tests/coverage/unicode.cov-map +++ b/tests/coverage/unicode.cov-map @@ -1,14 +1,10 @@ Function name: unicode::main -Raw bytes (61): 0x[01, 01, 06, 01, 05, 0b, 09, 01, 11, 13, 09, 17, 11, 01, 0d, 09, 01, 0e, 01, 00, 0b, 05, 01, 09, 00, 0c, 03, 00, 10, 00, 1b, 05, 00, 1c, 00, 28, 01, 02, 08, 00, 25, 09, 00, 29, 00, 46, 0d, 00, 47, 02, 06, 06, 02, 05, 00, 06, 0e, 02, 05, 01, 02] +Raw bytes (53): 0x[01, 01, 02, 01, 05, 01, 0d, 09, 01, 0e, 01, 00, 0b, 05, 01, 09, 00, 0c, 03, 00, 10, 00, 1b, 05, 00, 1c, 00, 28, 01, 02, 08, 00, 25, 09, 00, 29, 00, 46, 0d, 00, 47, 02, 06, 06, 02, 05, 00, 06, 01, 02, 05, 01, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 6 +Number of expressions: 2 - expression 0 operands: lhs = Counter(0), rhs = Counter(1) -- expression 1 operands: lhs = Expression(2, Add), rhs = Counter(2) -- expression 2 operands: lhs = Counter(0), rhs = Counter(4) -- expression 3 operands: lhs = Expression(4, Add), rhs = Counter(2) -- expression 4 operands: lhs = Expression(5, Add), rhs = Counter(4) -- expression 5 operands: lhs = Counter(0), rhs = Counter(3) +- expression 1 operands: lhs = Counter(0), rhs = Counter(3) Number of file 0 mappings: 9 - Code(Counter(0)) at (prev + 14, 1) to (start + 0, 11) - Code(Counter(1)) at (prev + 1, 9) to (start + 0, 12) @@ -19,9 +15,8 @@ Number of file 0 mappings: 9 - Code(Counter(2)) at (prev + 0, 41) to (start + 0, 70) - Code(Counter(3)) at (prev + 0, 71) to (start + 2, 6) - Code(Expression(1, Sub)) at (prev + 2, 5) to (start + 0, 6) - = ((c0 + c4) - c2) -- Code(Expression(3, Sub)) at (prev + 2, 5) to (start + 1, 2) - = (((c0 + c3) + c4) - c2) + = (c0 - c3) +- Code(Counter(0)) at (prev + 2, 5) to (start + 1, 2) Highest counter ID seen: c3 Function name: unicode::ä»– (unused) diff --git a/tests/coverage/while_early_ret.cov-map b/tests/coverage/while_early_ret.cov-map index ade770597e2..554056fa801 100644 --- a/tests/coverage/while_early_ret.cov-map +++ b/tests/coverage/while_early_ret.cov-map @@ -1,12 +1,12 @@ Function name: while_early_ret::main -Raw bytes (59): 0x[01, 01, 05, 01, 05, 03, 09, 01, 09, 13, 11, 09, 0d, 09, 01, 05, 01, 01, 1b, 03, 03, 09, 02, 0a, 06, 05, 0d, 02, 0e, 0a, 06, 15, 02, 16, 0d, 04, 15, 00, 1b, 11, 04, 15, 00, 1b, 05, 03, 0a, 03, 0a, 09, 06, 05, 00, 0b, 0f, 01, 01, 00, 02] +Raw bytes (59): 0x[01, 01, 05, 01, 05, 03, 09, 01, 09, 01, 13, 09, 0d, 09, 01, 05, 01, 01, 1b, 03, 03, 09, 02, 0a, 06, 05, 0d, 02, 0e, 0a, 06, 15, 02, 16, 0d, 04, 15, 00, 1b, 0e, 04, 15, 00, 1b, 05, 03, 0a, 03, 0a, 09, 06, 05, 00, 0b, 01, 01, 01, 00, 02] Number of files: 1 - file 0 => global file 1 Number of expressions: 5 - expression 0 operands: lhs = Counter(0), rhs = Counter(1) - expression 1 operands: lhs = Expression(0, Add), rhs = Counter(2) - expression 2 operands: lhs = Counter(0), rhs = Counter(2) -- expression 3 operands: lhs = Expression(4, Add), rhs = Counter(4) +- expression 3 operands: lhs = Counter(0), rhs = Expression(4, Add) - expression 4 operands: lhs = Counter(2), rhs = Counter(3) Number of file 0 mappings: 9 - Code(Counter(0)) at (prev + 5, 1) to (start + 1, 27) @@ -17,10 +17,10 @@ Number of file 0 mappings: 9 - Code(Expression(2, Sub)) at (prev + 6, 21) to (start + 2, 22) = (c0 - c2) - Code(Counter(3)) at (prev + 4, 21) to (start + 0, 27) -- Code(Counter(4)) at (prev + 4, 21) to (start + 0, 27) +- Code(Expression(3, Sub)) at (prev + 4, 21) to (start + 0, 27) + = (c0 - (c2 + c3)) - Code(Counter(1)) at (prev + 3, 10) to (start + 3, 10) - Code(Counter(2)) at (prev + 6, 5) to (start + 0, 11) -- Code(Expression(3, Add)) at (prev + 1, 1) to (start + 0, 2) - = ((c2 + c3) + c4) -Highest counter ID seen: c4 +- Code(Counter(0)) at (prev + 1, 1) to (start + 0, 2) +Highest counter ID seen: c3 diff --git a/tests/coverage/yield.cov-map b/tests/coverage/yield.cov-map index e01ec8f9edb..868fec4b107 100644 --- a/tests/coverage/yield.cov-map +++ b/tests/coverage/yield.cov-map @@ -1,19 +1,13 @@ Function name: yield::main -Raw bytes (106): 0x[01, 01, 0b, 05, 00, 0d, 11, 0d, 23, 11, 15, 11, 15, 0d, 23, 11, 15, 0d, 23, 11, 15, 19, 1d, 25, 29, 10, 01, 07, 01, 01, 16, 01, 07, 0b, 00, 2e, 0d, 01, 27, 00, 29, 03, 01, 0e, 00, 34, 0d, 02, 0b, 00, 2e, 06, 01, 22, 00, 27, 1e, 00, 2c, 00, 2e, 23, 01, 0e, 00, 34, 1e, 03, 09, 00, 16, 1e, 08, 0b, 00, 2e, 21, 01, 27, 00, 29, 27, 01, 0e, 00, 34, 21, 02, 0b, 00, 2e, 2d, 01, 27, 00, 29, 2b, 01, 0e, 00, 34, 2d, 02, 01, 00, 02] +Raw bytes (94): 0x[01, 01, 05, 05, 00, 0d, 15, 0d, 11, 19, 1d, 25, 29, 10, 01, 07, 01, 01, 16, 01, 07, 0b, 00, 2e, 0d, 01, 27, 00, 29, 03, 01, 0e, 00, 34, 0d, 02, 0b, 00, 2e, 06, 01, 22, 00, 27, 11, 00, 2c, 00, 2e, 0a, 01, 0e, 00, 34, 11, 03, 09, 00, 16, 11, 08, 0b, 00, 2e, 21, 01, 27, 00, 29, 0f, 01, 0e, 00, 34, 21, 02, 0b, 00, 2e, 2d, 01, 27, 00, 29, 13, 01, 0e, 00, 34, 2d, 02, 01, 00, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 11 +Number of expressions: 5 - expression 0 operands: lhs = Counter(1), rhs = Zero -- expression 1 operands: lhs = Counter(3), rhs = Counter(4) -- expression 2 operands: lhs = Counter(3), rhs = Expression(8, Add) -- expression 3 operands: lhs = Counter(4), rhs = Counter(5) -- expression 4 operands: lhs = Counter(4), rhs = Counter(5) -- expression 5 operands: lhs = Counter(3), rhs = Expression(8, Add) -- expression 6 operands: lhs = Counter(4), rhs = Counter(5) -- expression 7 operands: lhs = Counter(3), rhs = Expression(8, Add) -- expression 8 operands: lhs = Counter(4), rhs = Counter(5) -- expression 9 operands: lhs = Counter(6), rhs = Counter(7) -- expression 10 operands: lhs = Counter(9), rhs = Counter(10) +- expression 1 operands: lhs = Counter(3), rhs = Counter(5) +- expression 2 operands: lhs = Counter(3), rhs = Counter(4) +- expression 3 operands: lhs = Counter(6), rhs = Counter(7) +- expression 4 operands: lhs = Counter(9), rhs = Counter(10) Number of file 0 mappings: 16 - Code(Counter(0)) at (prev + 7, 1) to (start + 1, 22) - Code(Counter(0)) at (prev + 7, 11) to (start + 0, 46) @@ -22,21 +16,18 @@ Number of file 0 mappings: 16 = (c1 + Zero) - Code(Counter(3)) at (prev + 2, 11) to (start + 0, 46) - Code(Expression(1, Sub)) at (prev + 1, 34) to (start + 0, 39) + = (c3 - c5) +- Code(Counter(4)) at (prev + 0, 44) to (start + 0, 46) +- Code(Expression(2, Sub)) at (prev + 1, 14) to (start + 0, 52) = (c3 - c4) -- Code(Expression(7, Sub)) at (prev + 0, 44) to (start + 0, 46) - = (c3 - (c4 + c5)) -- Code(Expression(8, Add)) at (prev + 1, 14) to (start + 0, 52) - = (c4 + c5) -- Code(Expression(7, Sub)) at (prev + 3, 9) to (start + 0, 22) - = (c3 - (c4 + c5)) -- Code(Expression(7, Sub)) at (prev + 8, 11) to (start + 0, 46) - = (c3 - (c4 + c5)) +- Code(Counter(4)) at (prev + 3, 9) to (start + 0, 22) +- Code(Counter(4)) at (prev + 8, 11) to (start + 0, 46) - Code(Counter(8)) at (prev + 1, 39) to (start + 0, 41) -- Code(Expression(9, Add)) at (prev + 1, 14) to (start + 0, 52) +- Code(Expression(3, Add)) at (prev + 1, 14) to (start + 0, 52) = (c6 + c7) - Code(Counter(8)) at (prev + 2, 11) to (start + 0, 46) - Code(Counter(11)) at (prev + 1, 39) to (start + 0, 41) -- Code(Expression(10, Add)) at (prev + 1, 14) to (start + 0, 52) +- Code(Expression(4, Add)) at (prev + 1, 14) to (start + 0, 52) = (c9 + c10) - Code(Counter(11)) at (prev + 2, 1) to (start + 0, 2) Highest counter ID seen: c11 diff --git a/tests/crashes/131227.rs b/tests/crashes/131227.rs deleted file mode 100644 index f46185b5b4a..00000000000 --- a/tests/crashes/131227.rs +++ /dev/null @@ -1,16 +0,0 @@ -//@ known-bug: #131227 -//@ compile-flags: -Zmir-opt-level=3 - -static mut G: () = (); - -fn myfunc() -> i32 { - let var = &raw mut G; - if var.is_null() { - return 0; - } - 0 -} - -fn main() { - myfunc(); -} diff --git a/tests/run-make/const-trait-stable-toolchain/const-super-trait-nightly-disabled.stderr b/tests/run-make/const-trait-stable-toolchain/const-super-trait-nightly-disabled.stderr new file mode 100644 index 00000000000..596f7c510be --- /dev/null +++ b/tests/run-make/const-trait-stable-toolchain/const-super-trait-nightly-disabled.stderr @@ -0,0 +1,66 @@ +error: `~const` is not allowed here + --> const-super-trait.rs:7:12 + | +LL | trait Bar: ~const Foo {} + | ^^^^^^ + | +note: this trait is not a `#[const_trait]`, so it cannot have `~const` trait bounds + --> const-super-trait.rs:7:1 + | +LL | trait Bar: ~const Foo {} + | ^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0658]: const trait impls are experimental + --> const-super-trait.rs:7:12 + | +LL | trait Bar: ~const Foo {} + | ^^^^^^ + | + = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information + = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: const trait impls are experimental + --> const-super-trait.rs:9:17 + | +LL | const fn foo<T: ~const Bar>(x: &T) { + | ^^^^^^ + | + = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information + = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error: `~const` can only be applied to `#[const_trait]` traits + --> const-super-trait.rs:7:12 + | +LL | trait Bar: ~const Foo {} + | ^^^^^^ can't be applied to `Foo` + | +help: enable `#![feature(const_trait_impl)]` in your crate and mark `Foo` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Foo { + | ++++++++++++++ + +error: `~const` can only be applied to `#[const_trait]` traits + --> const-super-trait.rs:9:17 + | +LL | const fn foo<T: ~const Bar>(x: &T) { + | ^^^^^^ can't be applied to `Bar` + | +help: enable `#![feature(const_trait_impl)]` in your crate and mark `Bar` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Bar: ~const Foo {} + | ++++++++++++++ + +error[E0015]: cannot call non-const fn `<T as Foo>::a` in constant functions + --> const-super-trait.rs:10:7 + | +LL | x.a(); + | ^^^ + | + = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants + +error: aborting due to 6 previous errors + +Some errors have detailed explanations: E0015, E0658. +For more information about an error, try `rustc --explain E0015`. diff --git a/tests/run-make/const-trait-stable-toolchain/const-super-trait-nightly-enabled.stderr b/tests/run-make/const-trait-stable-toolchain/const-super-trait-nightly-enabled.stderr new file mode 100644 index 00000000000..7235278d1bd --- /dev/null +++ b/tests/run-make/const-trait-stable-toolchain/const-super-trait-nightly-enabled.stderr @@ -0,0 +1,45 @@ +error: `~const` is not allowed here + --> const-super-trait.rs:7:12 + | +LL | trait Bar: ~const Foo {} + | ^^^^^^ + | +note: this trait is not a `#[const_trait]`, so it cannot have `~const` trait bounds + --> const-super-trait.rs:7:1 + | +LL | trait Bar: ~const Foo {} + | ^^^^^^^^^^^^^^^^^^^^^^^^ + +error: `~const` can only be applied to `#[const_trait]` traits + --> const-super-trait.rs:7:12 + | +LL | trait Bar: ~const Foo {} + | ^^^^^^ can't be applied to `Foo` + | +help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Foo { + | ++++++++++++++ + +error: `~const` can only be applied to `#[const_trait]` traits + --> const-super-trait.rs:9:17 + | +LL | const fn foo<T: ~const Bar>(x: &T) { + | ^^^^^^ can't be applied to `Bar` + | +help: mark `Bar` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Bar: ~const Foo {} + | ++++++++++++++ + +error[E0015]: cannot call non-const fn `<T as Foo>::a` in constant functions + --> const-super-trait.rs:10:7 + | +LL | x.a(); + | ^^^ + | + = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0015`. diff --git a/tests/run-make/const-trait-stable-toolchain/const-super-trait-stable-disabled.stderr b/tests/run-make/const-trait-stable-toolchain/const-super-trait-stable-disabled.stderr new file mode 100644 index 00000000000..eacdaf5e369 --- /dev/null +++ b/tests/run-make/const-trait-stable-toolchain/const-super-trait-stable-disabled.stderr @@ -0,0 +1,64 @@ +error: `~const` is not allowed here + --> const-super-trait.rs:7:12 + | +7 | trait Bar: ~const Foo {} + | ^^^^^^ + | +note: this trait is not a `#[const_trait]`, so it cannot have `~const` trait bounds + --> const-super-trait.rs:7:1 + | +7 | trait Bar: ~const Foo {} + | ^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0658]: const trait impls are experimental + --> const-super-trait.rs:7:12 + | +7 | trait Bar: ~const Foo {} + | ^^^^^^ + | + = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information + +error[E0658]: const trait impls are experimental + --> const-super-trait.rs:9:17 + | +9 | const fn foo<T: ~const Bar>(x: &T) { + | ^^^^^^ + | + = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information + +error: `~const` can only be applied to `#[const_trait]` traits + --> const-super-trait.rs:7:12 + | +7 | trait Bar: ~const Foo {} + | ^^^^^^ can't be applied to `Foo` + | +note: `Foo` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> const-super-trait.rs:3:1 + | +3 | trait Foo { + | ^^^^^^^^^ + +error: `~const` can only be applied to `#[const_trait]` traits + --> const-super-trait.rs:9:17 + | +9 | const fn foo<T: ~const Bar>(x: &T) { + | ^^^^^^ can't be applied to `Bar` + | +note: `Bar` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> const-super-trait.rs:7:1 + | +7 | trait Bar: ~const Foo {} + | ^^^^^^^^^^^^^^^^^^^^^ + +error[E0015]: cannot call non-const fn `<T as Foo>::a` in constant functions + --> const-super-trait.rs:10:7 + | +10 | x.a(); + | ^^^ + | + = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants + +error: aborting due to 6 previous errors + +Some errors have detailed explanations: E0015, E0658. +For more information about an error, try `rustc --explain E0015`. diff --git a/tests/run-make/const-trait-stable-toolchain/const-super-trait-stable-enabled.stderr b/tests/run-make/const-trait-stable-toolchain/const-super-trait-stable-enabled.stderr new file mode 100644 index 00000000000..9ddec6e422c --- /dev/null +++ b/tests/run-make/const-trait-stable-toolchain/const-super-trait-stable-enabled.stderr @@ -0,0 +1,54 @@ +error: `~const` is not allowed here + --> const-super-trait.rs:7:12 + | +7 | trait Bar: ~const Foo {} + | ^^^^^^ + | +note: this trait is not a `#[const_trait]`, so it cannot have `~const` trait bounds + --> const-super-trait.rs:7:1 + | +7 | trait Bar: ~const Foo {} + | ^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0554]: `#![feature]` may not be used on the NIGHTLY release channel + --> const-super-trait.rs:1:30 + | +1 | #![cfg_attr(feature_enabled, feature(const_trait_impl))] + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: `~const` can only be applied to `#[const_trait]` traits + --> const-super-trait.rs:7:12 + | +7 | trait Bar: ~const Foo {} + | ^^^^^^ can't be applied to `Foo` + | +note: `Foo` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> const-super-trait.rs:3:1 + | +3 | trait Foo { + | ^^^^^^^^^ + +error: `~const` can only be applied to `#[const_trait]` traits + --> const-super-trait.rs:9:17 + | +9 | const fn foo<T: ~const Bar>(x: &T) { + | ^^^^^^ can't be applied to `Bar` + | +note: `Bar` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> const-super-trait.rs:7:1 + | +7 | trait Bar: ~const Foo {} + | ^^^^^^^^^^^^^^^^^^^^^ + +error[E0015]: cannot call non-const fn `<T as Foo>::a` in constant functions + --> const-super-trait.rs:10:7 + | +10 | x.a(); + | ^^^ + | + = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants + +error: aborting due to 5 previous errors + +Some errors have detailed explanations: E0015, E0554. +For more information about an error, try `rustc --explain E0015`. diff --git a/tests/run-make/const-trait-stable-toolchain/const-super-trait.rs b/tests/run-make/const-trait-stable-toolchain/const-super-trait.rs new file mode 100644 index 00000000000..b2ee96d79f7 --- /dev/null +++ b/tests/run-make/const-trait-stable-toolchain/const-super-trait.rs @@ -0,0 +1,13 @@ +#![cfg_attr(feature_enabled, feature(const_trait_impl))] + +trait Foo { + fn a(&self); +} + +trait Bar: ~const Foo {} + +const fn foo<T: ~const Bar>(x: &T) { + x.a(); +} + +fn main() {} diff --git a/tests/run-make/const-trait-stable-toolchain/rmake.rs b/tests/run-make/const-trait-stable-toolchain/rmake.rs new file mode 100644 index 00000000000..241de11ed59 --- /dev/null +++ b/tests/run-make/const-trait-stable-toolchain/rmake.rs @@ -0,0 +1,59 @@ +// Test output of const super trait errors in both stable and nightly. +// We don't want to provide suggestions on stable that only make sense in nightly. + +use run_make_support::{diff, rustc}; + +fn main() { + let out = rustc() + .input("const-super-trait.rs") + .env("RUSTC_BOOTSTRAP", "-1") + .cfg("feature_enabled") + .run_fail() + .assert_stderr_not_contains( + "as `#[const_trait]` to allow it to have `const` implementations", + ) + .stderr_utf8(); + diff() + .expected_file("const-super-trait-stable-enabled.stderr") + .normalize( + "may not be used on the .* release channel", + "may not be used on the NIGHTLY release channel", + ) + .actual_text("(rustc)", &out) + .run(); + let out = rustc() + .input("const-super-trait.rs") + .cfg("feature_enabled") + .ui_testing() + .run_fail() + .assert_stderr_not_contains("enable `#![feature(const_trait_impl)]` in your crate and mark") + .assert_stderr_contains("as `#[const_trait]` to allow it to have `const` implementations") + .stderr_utf8(); + diff() + .expected_file("const-super-trait-nightly-enabled.stderr") + .actual_text("(rustc)", &out) + .run(); + let out = rustc() + .input("const-super-trait.rs") + .env("RUSTC_BOOTSTRAP", "-1") + .run_fail() + .assert_stderr_not_contains("enable `#![feature(const_trait_impl)]` in your crate and mark") + .assert_stderr_not_contains( + "as `#[const_trait]` to allow it to have `const` implementations", + ) + .stderr_utf8(); + diff() + .expected_file("const-super-trait-stable-disabled.stderr") + .actual_text("(rustc)", &out) + .run(); + let out = rustc() + .input("const-super-trait.rs") + .ui_testing() + .run_fail() + .assert_stderr_contains("enable `#![feature(const_trait_impl)]` in your crate and mark") + .stderr_utf8(); + diff() + .expected_file("const-super-trait-nightly-disabled.stderr") + .actual_text("(rustc)", &out) + .run(); +} diff --git a/tests/run-make/libs-through-symlinks/Makefile b/tests/run-make/libs-through-symlinks/Makefile index 592eae663a4..c6ff566a0e8 100644 --- a/tests/run-make/libs-through-symlinks/Makefile +++ b/tests/run-make/libs-through-symlinks/Makefile @@ -3,10 +3,20 @@ include ../tools.mk # ignore-windows +# The option -n for the AIX ln command has a different purpose than it does +# on Linux. On Linux, the -n option is used to treat the destination path as +# normal file if it is a symbolic link to a directory, which is the default +# behavior of the AIX ln command. +ifeq ($(UNAME),AIX) +LN_FLAGS := -sf +else +LN_FLAGS := -nsf +endif + NAME := $(shell $(RUSTC) --print file-names foo.rs) all: mkdir -p $(TMPDIR)/outdir $(RUSTC) foo.rs -o $(TMPDIR)/outdir/$(NAME) - ln -nsf outdir/$(NAME) $(TMPDIR) + ln $(LN_FLAGS) outdir/$(NAME) $(TMPDIR) RUSTC_LOG=rustc_metadata::loader $(RUSTC) bar.rs diff --git a/tests/rustdoc-ui/issues/issue-107918.rs b/tests/rustdoc-ui/issues/duplicate-panic-impl-107918.rs index 19d53f84cb6..ec35b52e33b 100644 --- a/tests/rustdoc-ui/issues/issue-107918.rs +++ b/tests/rustdoc-ui/issues/duplicate-panic-impl-107918.rs @@ -2,6 +2,7 @@ //@ compile-flags: --document-private-items //@ build-pass //@ only-linux +// https://github.com/rust-lang/rust/issues/107918 #![no_std] #![no_main] diff --git a/tests/rustdoc-ui/issues/issue-110900.rs b/tests/rustdoc-ui/issues/ice-associated-type-bounds-110900.rs index 5a896167083..4fa60f8878d 100644 --- a/tests/rustdoc-ui/issues/issue-110900.rs +++ b/tests/rustdoc-ui/issues/ice-associated-type-bounds-110900.rs @@ -1,4 +1,5 @@ //@ check-pass +// https://github.com/rust-lang/rust/issues/110900 #![crate_type="lib"] diff --git a/tests/rustdoc-ui/issues/issue-106213.rs b/tests/rustdoc-ui/issues/ice-bare-dyn-106213.rs index 5c3a8390252..c954162589d 100644 --- a/tests/rustdoc-ui/issues/issue-106213.rs +++ b/tests/rustdoc-ui/issues/ice-bare-dyn-106213.rs @@ -1,5 +1,6 @@ //@ compile-flags: --document-private-items //@ edition:2021 +// https://github.com/rust-lang/rust/issues/106213 fn use_avx() -> dyn { //~^ ERROR at least one trait is required for an object type diff --git a/tests/rustdoc-ui/issues/issue-106213.stderr b/tests/rustdoc-ui/issues/ice-bare-dyn-106213.stderr index fa79fe2e71c..b029fee510e 100644 --- a/tests/rustdoc-ui/issues/issue-106213.stderr +++ b/tests/rustdoc-ui/issues/ice-bare-dyn-106213.stderr @@ -1,5 +1,5 @@ error[E0224]: at least one trait is required for an object type - --> $DIR/issue-106213.rs:4:17 + --> $DIR/ice-bare-dyn-106213.rs:5:17 | LL | fn use_avx() -> dyn { | ^^^ diff --git a/tests/rustdoc-ui/issues/issue-105742.rs b/tests/rustdoc-ui/issues/ice-generic-type-alias-105742.rs index bd8ec4e8b58..027574923c7 100644 --- a/tests/rustdoc-ui/issues/issue-105742.rs +++ b/tests/rustdoc-ui/issues/ice-generic-type-alias-105742.rs @@ -1,4 +1,5 @@ //@ compile-flags: -Znormalize-docs +// https://github.com/rust-lang/rust/issues/105742 use std::ops::Index; pub fn next<'a, T>(s: &'a mut dyn SVec<Item = T, Output = T>) { diff --git a/tests/rustdoc-ui/issues/issue-105742.stderr b/tests/rustdoc-ui/issues/ice-generic-type-alias-105742.stderr index 0f09d637f38..06a1cf6b118 100644 --- a/tests/rustdoc-ui/issues/issue-105742.stderr +++ b/tests/rustdoc-ui/issues/ice-generic-type-alias-105742.stderr @@ -1,11 +1,11 @@ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:15:21 + --> $DIR/ice-generic-type-alias-105742.rs:16:21 | LL | <Self as SVec>::Item, | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ -- @@ -15,13 +15,13 @@ LL | <Self as SVec>::Item<'a>, | ++++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:15:21 + --> $DIR/ice-generic-type-alias-105742.rs:16:21 | LL | <Self as SVec>::Item, | ^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ - @@ -31,13 +31,13 @@ LL | <Self as SVec>::Item<T>, | +++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:26:37 + --> $DIR/ice-generic-type-alias-105742.rs:27:37 | LL | Output = <Index<<Self as SVec>::Item, | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ -- @@ -47,13 +47,13 @@ LL | Output = <Index<<Self as SVec>::Item<'a>, | ++++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:26:37 + --> $DIR/ice-generic-type-alias-105742.rs:27:37 | LL | Output = <Index<<Self as SVec>::Item, | ^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ - @@ -63,13 +63,13 @@ LL | Output = <Index<<Self as SVec>::Item<T>, | +++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:37:30 + --> $DIR/ice-generic-type-alias-105742.rs:38:30 | LL | Output = <Self as SVec>::Item> as SVec>::Item, | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ -- @@ -79,13 +79,13 @@ LL | Output = <Self as SVec>::Item<'a>> as SVec>::Item, | ++++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:37:30 + --> $DIR/ice-generic-type-alias-105742.rs:38:30 | LL | Output = <Self as SVec>::Item> as SVec>::Item, | ^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ - @@ -95,13 +95,13 @@ LL | Output = <Self as SVec>::Item<T>> as SVec>::Item, | +++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:37:46 + --> $DIR/ice-generic-type-alias-105742.rs:38:46 | LL | Output = <Self as SVec>::Item> as SVec>::Item, | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ -- @@ -111,13 +111,13 @@ LL | Output = <Self as SVec>::Item> as SVec>::Item<'a>, | ++++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:37:46 + --> $DIR/ice-generic-type-alias-105742.rs:38:46 | LL | Output = <Self as SVec>::Item> as SVec>::Item, | ^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ - @@ -127,13 +127,13 @@ LL | Output = <Self as SVec>::Item> as SVec>::Item<T>, | +++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:4:40 + --> $DIR/ice-generic-type-alias-105742.rs:5:40 | LL | pub fn next<'a, T>(s: &'a mut dyn SVec<Item = T, Output = T>) { | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ -- @@ -143,13 +143,13 @@ LL | pub fn next<'a, T>(s: &'a mut dyn SVec<Item<'_> = T, Output = T>) { | ++++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:4:40 + --> $DIR/ice-generic-type-alias-105742.rs:5:40 | LL | pub fn next<'a, T>(s: &'a mut dyn SVec<Item = T, Output = T>) { | ^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ - @@ -159,13 +159,13 @@ LL | pub fn next<'a, T>(s: &'a mut dyn SVec<Item<T> = T, Output = T>) { | +++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:15:21 + --> $DIR/ice-generic-type-alias-105742.rs:16:21 | LL | <Self as SVec>::Item, | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ -- @@ -176,13 +176,13 @@ LL | <Self as SVec>::Item<'a>, | ++++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:15:21 + --> $DIR/ice-generic-type-alias-105742.rs:16:21 | LL | <Self as SVec>::Item, | ^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ - @@ -193,13 +193,13 @@ LL | <Self as SVec>::Item<T>, | +++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:26:37 + --> $DIR/ice-generic-type-alias-105742.rs:27:37 | LL | Output = <Index<<Self as SVec>::Item, | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ -- @@ -210,13 +210,13 @@ LL | Output = <Index<<Self as SVec>::Item<'a>, | ++++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:26:37 + --> $DIR/ice-generic-type-alias-105742.rs:27:37 | LL | Output = <Index<<Self as SVec>::Item, | ^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ - @@ -227,13 +227,13 @@ LL | Output = <Index<<Self as SVec>::Item<T>, | +++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:37:30 + --> $DIR/ice-generic-type-alias-105742.rs:38:30 | LL | Output = <Self as SVec>::Item> as SVec>::Item, | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ -- @@ -244,13 +244,13 @@ LL | Output = <Self as SVec>::Item<'a>> as SVec>::Item, | ++++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:37:30 + --> $DIR/ice-generic-type-alias-105742.rs:38:30 | LL | Output = <Self as SVec>::Item> as SVec>::Item, | ^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ - @@ -261,13 +261,13 @@ LL | Output = <Self as SVec>::Item<T>> as SVec>::Item, | +++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:37:46 + --> $DIR/ice-generic-type-alias-105742.rs:38:46 | LL | Output = <Self as SVec>::Item> as SVec>::Item, | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ -- @@ -278,13 +278,13 @@ LL | Output = <Self as SVec>::Item> as SVec>::Item<'a>, | ++++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:37:46 + --> $DIR/ice-generic-type-alias-105742.rs:38:46 | LL | Output = <Self as SVec>::Item> as SVec>::Item, | ^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ - @@ -295,13 +295,13 @@ LL | Output = <Self as SVec>::Item> as SVec>::Item<T>, | +++ error[E0038]: the trait `SVec` cannot be made into an object - --> $DIR/issue-105742.rs:4:31 + --> $DIR/ice-generic-type-alias-105742.rs:5:31 | LL | pub fn next<'a, T>(s: &'a mut dyn SVec<Item = T, Output = T>) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `SVec` cannot be made into an object | note: for a trait to be "dyn-compatible" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> - --> $DIR/issue-105742.rs:14:17 + --> $DIR/ice-generic-type-alias-105742.rs:15:17 | LL | pub trait SVec: Index< | ____________----__^ @@ -329,13 +329,13 @@ LL | pub fn next<'a, T>(s: &'a mut impl SVec<Item = T, Output = T>) { | ~~~~ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:15:21 + --> $DIR/ice-generic-type-alias-105742.rs:16:21 | LL | <Self as SVec>::Item, | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ -- @@ -346,13 +346,13 @@ LL | <Self as SVec>::Item<'a>, | ++++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:15:21 + --> $DIR/ice-generic-type-alias-105742.rs:16:21 | LL | <Self as SVec>::Item, | ^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ - @@ -363,13 +363,13 @@ LL | <Self as SVec>::Item<T>, | +++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:26:37 + --> $DIR/ice-generic-type-alias-105742.rs:27:37 | LL | Output = <Index<<Self as SVec>::Item, | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ -- @@ -380,13 +380,13 @@ LL | Output = <Index<<Self as SVec>::Item<'a>, | ++++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:26:37 + --> $DIR/ice-generic-type-alias-105742.rs:27:37 | LL | Output = <Index<<Self as SVec>::Item, | ^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ - @@ -397,13 +397,13 @@ LL | Output = <Index<<Self as SVec>::Item<T>, | +++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:37:30 + --> $DIR/ice-generic-type-alias-105742.rs:38:30 | LL | Output = <Self as SVec>::Item> as SVec>::Item, | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ -- @@ -414,13 +414,13 @@ LL | Output = <Self as SVec>::Item<'a>> as SVec>::Item, | ++++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:37:30 + --> $DIR/ice-generic-type-alias-105742.rs:38:30 | LL | Output = <Self as SVec>::Item> as SVec>::Item, | ^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ - @@ -431,13 +431,13 @@ LL | Output = <Self as SVec>::Item<T>> as SVec>::Item, | +++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:37:46 + --> $DIR/ice-generic-type-alias-105742.rs:38:46 | LL | Output = <Self as SVec>::Item> as SVec>::Item, | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ -- @@ -448,13 +448,13 @@ LL | Output = <Self as SVec>::Item> as SVec>::Item<'a>, | ++++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:37:46 + --> $DIR/ice-generic-type-alias-105742.rs:38:46 | LL | Output = <Self as SVec>::Item> as SVec>::Item, | ^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ - @@ -465,13 +465,13 @@ LL | Output = <Self as SVec>::Item> as SVec>::Item<T>, | +++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:15:21 + --> $DIR/ice-generic-type-alias-105742.rs:16:21 | LL | <Self as SVec>::Item, | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ -- @@ -482,13 +482,13 @@ LL | <Self as SVec>::Item<'a>, | ++++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:15:21 + --> $DIR/ice-generic-type-alias-105742.rs:16:21 | LL | <Self as SVec>::Item, | ^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ - @@ -499,13 +499,13 @@ LL | <Self as SVec>::Item<T>, | +++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:26:37 + --> $DIR/ice-generic-type-alias-105742.rs:27:37 | LL | Output = <Index<<Self as SVec>::Item, | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ -- @@ -516,13 +516,13 @@ LL | Output = <Index<<Self as SVec>::Item<'a>, | ++++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:26:37 + --> $DIR/ice-generic-type-alias-105742.rs:27:37 | LL | Output = <Index<<Self as SVec>::Item, | ^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ - @@ -533,13 +533,13 @@ LL | Output = <Index<<Self as SVec>::Item<T>, | +++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:37:30 + --> $DIR/ice-generic-type-alias-105742.rs:38:30 | LL | Output = <Self as SVec>::Item> as SVec>::Item, | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ -- @@ -550,13 +550,13 @@ LL | Output = <Self as SVec>::Item<'a>> as SVec>::Item, | ++++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:37:30 + --> $DIR/ice-generic-type-alias-105742.rs:38:30 | LL | Output = <Self as SVec>::Item> as SVec>::Item, | ^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ - @@ -567,13 +567,13 @@ LL | Output = <Self as SVec>::Item<T>> as SVec>::Item, | +++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:37:46 + --> $DIR/ice-generic-type-alias-105742.rs:38:46 | LL | Output = <Self as SVec>::Item> as SVec>::Item, | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ -- @@ -584,13 +584,13 @@ LL | Output = <Self as SVec>::Item> as SVec>::Item<'a>, | ++++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:37:46 + --> $DIR/ice-generic-type-alias-105742.rs:38:46 | LL | Output = <Self as SVec>::Item> as SVec>::Item, | ^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ - @@ -601,13 +601,13 @@ LL | Output = <Self as SVec>::Item> as SVec>::Item<T>, | +++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:61:38 + --> $DIR/ice-generic-type-alias-105742.rs:62:38 | LL | fn len(&self) -> <Self as SVec>::Item; | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ -- @@ -617,13 +617,13 @@ LL | fn len(&self) -> <Self as SVec>::Item<'_>; | ++++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:61:38 + --> $DIR/ice-generic-type-alias-105742.rs:62:38 | LL | fn len(&self) -> <Self as SVec>::Item; | ^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ - diff --git a/tests/rustdoc-ui/issues/ice-impl-fn-generic-105737.rs b/tests/rustdoc-ui/issues/ice-impl-fn-generic-105737.rs new file mode 100644 index 00000000000..651fd9ab4b8 --- /dev/null +++ b/tests/rustdoc-ui/issues/ice-impl-fn-generic-105737.rs @@ -0,0 +1,5 @@ +// https://github.com/rust-lang/rust/issues/105737 +impl Vec<lol> {} +//~^ ERROR + +pub fn lol() {} diff --git a/tests/rustdoc-ui/issues/issue-105737.stderr b/tests/rustdoc-ui/issues/ice-impl-fn-generic-105737.stderr index 2c63c345e46..49cbebc91d9 100644 --- a/tests/rustdoc-ui/issues/issue-105737.stderr +++ b/tests/rustdoc-ui/issues/ice-impl-fn-generic-105737.stderr @@ -1,5 +1,5 @@ error[E0747]: constant provided when a type was expected - --> $DIR/issue-105737.rs:1:10 + --> $DIR/ice-impl-fn-generic-105737.rs:2:10 | LL | impl Vec<lol> {} | ^^^ diff --git a/tests/rustdoc-ui/issues/issue-101076.rs b/tests/rustdoc-ui/issues/ice-macro-hidden-exported-macro-defid-101076.rs index f9b93c408fd..0c9a8b9175b 100644 --- a/tests/rustdoc-ui/issues/issue-101076.rs +++ b/tests/rustdoc-ui/issues/ice-macro-hidden-exported-macro-defid-101076.rs @@ -1,4 +1,5 @@ //@ check-pass +// https://github.com/rust-lang/rust/issues/101076 const _: () = { #[macro_export] diff --git a/tests/rustdoc-ui/issues/issue-106226.rs b/tests/rustdoc-ui/issues/ice-placeholder-type-alias-106226.rs index 71b497a9adc..71b497a9adc 100644 --- a/tests/rustdoc-ui/issues/issue-106226.rs +++ b/tests/rustdoc-ui/issues/ice-placeholder-type-alias-106226.rs diff --git a/tests/rustdoc-ui/issues/issue-106226.stderr b/tests/rustdoc-ui/issues/ice-placeholder-type-alias-106226.stderr index 4d063b46188..e9080925450 100644 --- a/tests/rustdoc-ui/issues/issue-106226.stderr +++ b/tests/rustdoc-ui/issues/ice-placeholder-type-alias-106226.stderr @@ -1,5 +1,5 @@ error[E0121]: the placeholder `_` is not allowed within types on item signatures for type aliases - --> $DIR/issue-106226.rs:2:11 + --> $DIR/ice-placeholder-type-alias-106226.rs:2:11 | LL | type F = [_; ()]; | ^ not allowed in type signatures diff --git a/tests/rustdoc-ui/issues/ice-raw-str-105334.rs b/tests/rustdoc-ui/issues/ice-raw-str-105334.rs new file mode 100644 index 00000000000..f18f0456fdd --- /dev/null +++ b/tests/rustdoc-ui/issues/ice-raw-str-105334.rs @@ -0,0 +1,3 @@ +// https://github.com/rust-lang/rust/issues/105334 +impl Vec< br##"*.."## > {} +//~^ ERROR diff --git a/tests/rustdoc-ui/issues/issue-105334.stderr b/tests/rustdoc-ui/issues/ice-raw-str-105334.stderr index d992b219b3b..2096757fbb9 100644 --- a/tests/rustdoc-ui/issues/issue-105334.stderr +++ b/tests/rustdoc-ui/issues/ice-raw-str-105334.stderr @@ -1,5 +1,5 @@ error[E0747]: constant provided when a type was expected - --> $DIR/issue-105334.rs:1:11 + --> $DIR/ice-raw-str-105334.rs:2:11 | LL | impl Vec< br##"*.."## > {} | ^^^^^^^^^^^ diff --git a/tests/rustdoc-ui/issues/issue-102986.rs b/tests/rustdoc-ui/issues/ice-typeof-102986.rs index 001784ac285..8fcbfffe172 100644 --- a/tests/rustdoc-ui/issues/issue-102986.rs +++ b/tests/rustdoc-ui/issues/ice-typeof-102986.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/102986 struct Struct { y: (typeof("hey"),), //~^ `typeof` is a reserved keyword but unimplemented diff --git a/tests/rustdoc-ui/issues/issue-102986.stderr b/tests/rustdoc-ui/issues/ice-typeof-102986.stderr index d91f93f394a..20dbb2661bc 100644 --- a/tests/rustdoc-ui/issues/issue-102986.stderr +++ b/tests/rustdoc-ui/issues/ice-typeof-102986.stderr @@ -1,5 +1,5 @@ error[E0516]: `typeof` is a reserved keyword but unimplemented - --> $DIR/issue-102986.rs:2:9 + --> $DIR/ice-typeof-102986.rs:3:9 | LL | y: (typeof("hey"),), | ^^^^^^^^^^^^^ reserved keyword diff --git a/tests/rustdoc-ui/issues/issue-103997.rs b/tests/rustdoc-ui/issues/ice-unresolved-self-103997.rs index ebd1d2e4447..b6ba4e48cff 100644 --- a/tests/rustdoc-ui/issues/issue-103997.rs +++ b/tests/rustdoc-ui/issues/ice-unresolved-self-103997.rs @@ -1,4 +1,5 @@ //@ check-pass +// https://github.com/rust-lang/rust/issues/103997 pub fn foo() {} diff --git a/tests/rustdoc-ui/issues/issue-103997.stderr b/tests/rustdoc-ui/issues/ice-unresolved-self-103997.stderr index c06db91496f..9cb64079c61 100644 --- a/tests/rustdoc-ui/issues/issue-103997.stderr +++ b/tests/rustdoc-ui/issues/ice-unresolved-self-103997.stderr @@ -1,5 +1,5 @@ warning: unresolved link to `Self::foo` - --> $DIR/issue-103997.rs:5:13 + --> $DIR/ice-unresolved-self-103997.rs:6:13 | LL | /// [`foo`](Self::foo) | ^^^^^^^^^ no item named `Self` in scope diff --git a/tests/rustdoc-ui/issues/issue-105334.rs b/tests/rustdoc-ui/issues/issue-105334.rs deleted file mode 100644 index ee1adc6a029..00000000000 --- a/tests/rustdoc-ui/issues/issue-105334.rs +++ /dev/null @@ -1,2 +0,0 @@ -impl Vec< br##"*.."## > {} -//~^ ERROR diff --git a/tests/rustdoc-ui/issues/issue-105737.rs b/tests/rustdoc-ui/issues/issue-105737.rs deleted file mode 100644 index 154f069d8ff..00000000000 --- a/tests/rustdoc-ui/issues/issue-105737.rs +++ /dev/null @@ -1,4 +0,0 @@ -impl Vec<lol> {} -//~^ ERROR - -pub fn lol() {} diff --git a/tests/ui-fulldeps/lexer/unicode-version.rs b/tests/ui-fulldeps/lexer/unicode-version.rs new file mode 100644 index 00000000000..cd02b952895 --- /dev/null +++ b/tests/ui-fulldeps/lexer/unicode-version.rs @@ -0,0 +1,27 @@ +// This test is used to validate which version of Unicode is used for parsing +// identifiers. If the Unicode version changes, it should also be updated in +// the reference at +// https://github.com/rust-lang/reference/blob/HEAD/src/identifiers.md. + +//@ run-pass +//@ check-run-results +//@ ignore-cross-compile +//@ reference: ident.unicode +//@ reference: ident.normalization + +#![feature(rustc_private)] + +extern crate rustc_driver; +extern crate rustc_lexer; +extern crate rustc_parse; + +fn main() { + println!("Checking if Unicode version changed."); + println!( + "If the Unicode version changes are intentional, \ + it should also be updated in the reference at \ + https://github.com/rust-lang/reference/blob/HEAD/src/identifiers.md." + ); + println!("Unicode XID version is: {:?}", rustc_lexer::UNICODE_XID_VERSION); + println!("Unicode normalization version is: {:?}", rustc_parse::UNICODE_NORMALIZATION_VERSION); +} diff --git a/tests/ui-fulldeps/lexer/unicode-version.run.stdout b/tests/ui-fulldeps/lexer/unicode-version.run.stdout new file mode 100644 index 00000000000..f32c8365cdf --- /dev/null +++ b/tests/ui-fulldeps/lexer/unicode-version.run.stdout @@ -0,0 +1,4 @@ +Checking if Unicode version changed. +If the Unicode version changes are intentional, it should also be updated in the reference at https://github.com/rust-lang/reference/blob/HEAD/src/identifiers.md. +Unicode XID version is: (16, 0, 0) +Unicode normalization version is: (16, 0, 0) diff --git a/tests/ui/asm/naked-functions.rs b/tests/ui/asm/naked-functions.rs index 5c58f1498cc..e7e5d84f2a5 100644 --- a/tests/ui/asm/naked-functions.rs +++ b/tests/ui/asm/naked-functions.rs @@ -219,7 +219,6 @@ pub unsafe extern "C" fn compatible_must_use_attributes() -> u64 { #[export_name = "exported_function_name"] #[link_section = ".custom_section"] -#[no_mangle] #[naked] pub unsafe extern "C" fn compatible_ffi_attributes_1() { naked_asm!("", options(raw)); diff --git a/tests/ui/async-await/async-closures/call-once-deduction.rs b/tests/ui/async-await/async-closures/call-once-deduction.rs new file mode 100644 index 00000000000..41d92bc3d78 --- /dev/null +++ b/tests/ui/async-await/async-closures/call-once-deduction.rs @@ -0,0 +1,14 @@ +//@ edition: 2021 +//@ check-pass + +#![feature(async_closure, async_fn_traits, unboxed_closures)] + +fn bar<F, O>(_: F) +where + F: AsyncFnOnce<(), CallOnceFuture = O>, +{ +} + +fn main() { + bar(async move || {}); +} diff --git a/tests/ui/attributes/mixed_export_name_and_no_mangle.fixed b/tests/ui/attributes/mixed_export_name_and_no_mangle.fixed new file mode 100644 index 00000000000..7224d4289e3 --- /dev/null +++ b/tests/ui/attributes/mixed_export_name_and_no_mangle.fixed @@ -0,0 +1,14 @@ +// issue: rust-lang/rust#47446 +//@ run-rustfix +//@ check-pass + +#![warn(unused_attributes)] +//~^ WARN `#[no_mangle]` attribute may not be used in combination with `#[export_name]` [unused_attributes] +#[export_name = "foo"] +pub fn bar() {} + +//~^ WARN `#[unsafe(no_mangle)]` attribute may not be used in combination with `#[export_name]` [unused_attributes] +#[export_name = "baz"] +pub fn bak() {} + +fn main() {} diff --git a/tests/ui/attributes/mixed_export_name_and_no_mangle.rs b/tests/ui/attributes/mixed_export_name_and_no_mangle.rs new file mode 100644 index 00000000000..149a7904e1e --- /dev/null +++ b/tests/ui/attributes/mixed_export_name_and_no_mangle.rs @@ -0,0 +1,16 @@ +// issue: rust-lang/rust#47446 +//@ run-rustfix +//@ check-pass + +#![warn(unused_attributes)] +#[no_mangle] +//~^ WARN `#[no_mangle]` attribute may not be used in combination with `#[export_name]` [unused_attributes] +#[export_name = "foo"] +pub fn bar() {} + +#[unsafe(no_mangle)] +//~^ WARN `#[unsafe(no_mangle)]` attribute may not be used in combination with `#[export_name]` [unused_attributes] +#[export_name = "baz"] +pub fn bak() {} + +fn main() {} diff --git a/tests/ui/attributes/mixed_export_name_and_no_mangle.stderr b/tests/ui/attributes/mixed_export_name_and_no_mangle.stderr new file mode 100644 index 00000000000..ba63127ba2d --- /dev/null +++ b/tests/ui/attributes/mixed_export_name_and_no_mangle.stderr @@ -0,0 +1,39 @@ +warning: `#[no_mangle]` attribute may not be used in combination with `#[export_name]` + --> $DIR/mixed_export_name_and_no_mangle.rs:6:1 + | +LL | #[no_mangle] + | ^^^^^^^^^^^^ `#[no_mangle]` is ignored + | +note: `#[export_name]` takes precedence + --> $DIR/mixed_export_name_and_no_mangle.rs:8:1 + | +LL | #[export_name = "foo"] + | ^^^^^^^^^^^^^^^^^^^^^^ +note: the lint level is defined here + --> $DIR/mixed_export_name_and_no_mangle.rs:5:9 + | +LL | #![warn(unused_attributes)] + | ^^^^^^^^^^^^^^^^^ +help: remove the `#[no_mangle]` attribute + | +LL - #[no_mangle] + | + +warning: `#[unsafe(no_mangle)]` attribute may not be used in combination with `#[export_name]` + --> $DIR/mixed_export_name_and_no_mangle.rs:11:1 + | +LL | #[unsafe(no_mangle)] + | ^^^^^^^^^^^^^^^^^^^^ `#[unsafe(no_mangle)]` is ignored + | +note: `#[export_name]` takes precedence + --> $DIR/mixed_export_name_and_no_mangle.rs:13:1 + | +LL | #[export_name = "baz"] + | ^^^^^^^^^^^^^^^^^^^^^^ +help: remove the `#[unsafe(no_mangle)]` attribute + | +LL - #[unsafe(no_mangle)] + | + +warning: 2 warnings emitted + diff --git a/tests/ui/check-cfg/target_feature.stderr b/tests/ui/check-cfg/target_feature.stderr index 2674a97a551..3df1545cd4a 100644 --- a/tests/ui/check-cfg/target_feature.stderr +++ b/tests/ui/check-cfg/target_feature.stderr @@ -153,6 +153,7 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE"); `popcnt` `power10-vector` `power8-altivec` +`power8-crypto` `power8-vector` `power9-altivec` `power9-vector` diff --git a/tests/ui/const-generics/generic_const_exprs/unevaluated-const-ice-119731.stderr b/tests/ui/const-generics/generic_const_exprs/unevaluated-const-ice-119731.stderr index 4eb374b2020..30a45ce377e 100644 --- a/tests/ui/const-generics/generic_const_exprs/unevaluated-const-ice-119731.stderr +++ b/tests/ui/const-generics/generic_const_exprs/unevaluated-const-ice-119731.stderr @@ -72,20 +72,6 @@ help: add `#![feature(adt_const_params)]` to the crate attributes to enable more LL + #![feature(adt_const_params)] | -note: erroneous constant encountered - --> $DIR/unevaluated-const-ice-119731.rs:22:19 - | -LL | impl v17<512, v0> { - | ^^ - -note: erroneous constant encountered - --> $DIR/unevaluated-const-ice-119731.rs:22:19 - | -LL | impl v17<512, v0> { - | ^^ - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - error: maximum number of nodes exceeded in constant v20::v17::<v10, v2>::{constant#0} --> $DIR/unevaluated-const-ice-119731.rs:28:37 | diff --git a/tests/ui/consts/const-integer-bool-ops.stderr b/tests/ui/consts/const-integer-bool-ops.stderr index d58a8e93ff6..4e503e5a5c0 100644 --- a/tests/ui/consts/const-integer-bool-ops.stderr +++ b/tests/ui/consts/const-integer-bool-ops.stderr @@ -16,12 +16,6 @@ error[E0308]: mismatched types LL | const X: usize = 42 && 39; | ^^^^^^^^ expected `usize`, found `bool` -note: erroneous constant encountered - --> $DIR/const-integer-bool-ops.rs:8:18 - | -LL | const ARR: [i32; X] = [99; 34]; - | ^ - error[E0308]: mismatched types --> $DIR/const-integer-bool-ops.rs:10:19 | @@ -40,12 +34,6 @@ error[E0308]: mismatched types LL | const X1: usize = 42 || 39; | ^^^^^^^^ expected `usize`, found `bool` -note: erroneous constant encountered - --> $DIR/const-integer-bool-ops.rs:17:19 - | -LL | const ARR1: [i32; X1] = [99; 47]; - | ^^ - error[E0308]: mismatched types --> $DIR/const-integer-bool-ops.rs:19:19 | @@ -64,12 +52,6 @@ error[E0308]: mismatched types LL | const X2: usize = -42 || -39; | ^^^^^^^^^^ expected `usize`, found `bool` -note: erroneous constant encountered - --> $DIR/const-integer-bool-ops.rs:26:19 - | -LL | const ARR2: [i32; X2] = [99; 18446744073709551607]; - | ^^ - error[E0308]: mismatched types --> $DIR/const-integer-bool-ops.rs:28:19 | @@ -88,84 +70,42 @@ error[E0308]: mismatched types LL | const X3: usize = -42 && -39; | ^^^^^^^^^^ expected `usize`, found `bool` -note: erroneous constant encountered - --> $DIR/const-integer-bool-ops.rs:35:19 - | -LL | const ARR3: [i32; X3] = [99; 6]; - | ^^ - error[E0308]: mismatched types --> $DIR/const-integer-bool-ops.rs:37:18 | LL | const Y: usize = 42.0 == 42.0; | ^^^^^^^^^^^^ expected `usize`, found `bool` -note: erroneous constant encountered - --> $DIR/const-integer-bool-ops.rs:40:19 - | -LL | const ARRR: [i32; Y] = [99; 1]; - | ^ - error[E0308]: mismatched types --> $DIR/const-integer-bool-ops.rs:42:19 | LL | const Y1: usize = 42.0 >= 42.0; | ^^^^^^^^^^^^ expected `usize`, found `bool` -note: erroneous constant encountered - --> $DIR/const-integer-bool-ops.rs:45:20 - | -LL | const ARRR1: [i32; Y1] = [99; 1]; - | ^^ - error[E0308]: mismatched types --> $DIR/const-integer-bool-ops.rs:47:19 | LL | const Y2: usize = 42.0 <= 42.0; | ^^^^^^^^^^^^ expected `usize`, found `bool` -note: erroneous constant encountered - --> $DIR/const-integer-bool-ops.rs:50:20 - | -LL | const ARRR2: [i32; Y2] = [99; 1]; - | ^^ - error[E0308]: mismatched types --> $DIR/const-integer-bool-ops.rs:52:19 | LL | const Y3: usize = 42.0 > 42.0; | ^^^^^^^^^^^ expected `usize`, found `bool` -note: erroneous constant encountered - --> $DIR/const-integer-bool-ops.rs:55:20 - | -LL | const ARRR3: [i32; Y3] = [99; 0]; - | ^^ - error[E0308]: mismatched types --> $DIR/const-integer-bool-ops.rs:57:19 | LL | const Y4: usize = 42.0 < 42.0; | ^^^^^^^^^^^ expected `usize`, found `bool` -note: erroneous constant encountered - --> $DIR/const-integer-bool-ops.rs:60:20 - | -LL | const ARRR4: [i32; Y4] = [99; 0]; - | ^^ - error[E0308]: mismatched types --> $DIR/const-integer-bool-ops.rs:62:19 | LL | const Y5: usize = 42.0 != 42.0; | ^^^^^^^^^^^^ expected `usize`, found `bool` -note: erroneous constant encountered - --> $DIR/const-integer-bool-ops.rs:65:20 - | -LL | const ARRR5: [i32; Y5] = [99; 0]; - | ^^ - error: aborting due to 18 previous errors For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/consts/const-mut-refs/issue-76510.stderr b/tests/ui/consts/const-mut-refs/issue-76510.stderr index a63be676fda..aff86e83578 100644 --- a/tests/ui/consts/const-mut-refs/issue-76510.stderr +++ b/tests/ui/consts/const-mut-refs/issue-76510.stderr @@ -4,12 +4,6 @@ error[E0764]: mutable references are not allowed in the final value of constants LL | const S: &'static mut str = &mut " hello "; | ^^^^^^^^^^^^^^ -note: erroneous constant encountered - --> $DIR/issue-76510.rs:7:70 - | -LL | let s = transmute::<(*const u8, usize), &ManuallyDrop<str>>((S.as_ptr(), 3)); - | ^ - error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0764`. diff --git a/tests/ui/consts/const-try.stderr b/tests/ui/consts/const-try.stderr index abb03a74c82..4209ca1d526 100644 --- a/tests/ui/consts/const-try.stderr +++ b/tests/ui/consts/const-try.stderr @@ -2,7 +2,7 @@ error: const `impl` for trait `FromResidual` which is not marked with `#[const_t --> $DIR/const-try.rs:15:12 | LL | impl const FromResidual<Error> for TryMe { - | ^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^ this trait is not `const` | = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: adding a non-const method body in the future would be a breaking change @@ -11,7 +11,7 @@ error: const `impl` for trait `Try` which is not marked with `#[const_trait]` --> $DIR/const-try.rs:22:12 | LL | impl const Try for TryMe { - | ^^^ + | ^^^ this trait is not `const` | = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: adding a non-const method body in the future would be a breaking change diff --git a/tests/ui/consts/const-tup-index-span.stderr b/tests/ui/consts/const-tup-index-span.stderr index 2a3f0cfb06d..792e18aa8fd 100644 --- a/tests/ui/consts/const-tup-index-span.stderr +++ b/tests/ui/consts/const-tup-index-span.stderr @@ -11,12 +11,6 @@ help: use a trailing comma to create a tuple with one element LL | const TUP: (usize,) = (5usize << 64,); | + ++ -note: erroneous constant encountered - --> $DIR/const-tup-index-span.rs:6:18 - | -LL | const ARR: [i32; TUP.0] = []; - | ^^^ - error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/consts/fn_trait_refs.stderr b/tests/ui/consts/fn_trait_refs.stderr index bb7ff76b125..e0dbecff8e5 100644 --- a/tests/ui/consts/fn_trait_refs.stderr +++ b/tests/ui/consts/fn_trait_refs.stderr @@ -14,110 +14,145 @@ error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/fn_trait_refs.rs:14:8 | LL | T: ~const Fn<()> + ~const Destruct, - | ^^^^^^ + | ^^^^^^ can't be applied to `Fn` + | +note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/fn_trait_refs.rs:14:8 | LL | T: ~const Fn<()> + ~const Destruct, - | ^^^^^^ + | ^^^^^^ can't be applied to `Fn` | +note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/fn_trait_refs.rs:14:8 | LL | T: ~const Fn<()> + ~const Destruct, - | ^^^^^^ + | ^^^^^^ can't be applied to `Fn` | +note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/fn_trait_refs.rs:21:8 | LL | T: ~const FnMut<()> + ~const Destruct, - | ^^^^^^ + | ^^^^^^ can't be applied to `FnMut` + | +note: `FnMut` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/fn_trait_refs.rs:21:8 | LL | T: ~const FnMut<()> + ~const Destruct, - | ^^^^^^ + | ^^^^^^ can't be applied to `FnMut` | +note: `FnMut` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/fn_trait_refs.rs:21:8 | LL | T: ~const FnMut<()> + ~const Destruct, - | ^^^^^^ + | ^^^^^^ can't be applied to `FnMut` | +note: `FnMut` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/fn_trait_refs.rs:28:8 | LL | T: ~const FnOnce<()>, - | ^^^^^^ + | ^^^^^^ can't be applied to `FnOnce` + | +note: `FnOnce` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/fn_trait_refs.rs:28:8 | LL | T: ~const FnOnce<()>, - | ^^^^^^ + | ^^^^^^ can't be applied to `FnOnce` | +note: `FnOnce` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/fn_trait_refs.rs:28:8 | LL | T: ~const FnOnce<()>, - | ^^^^^^ + | ^^^^^^ can't be applied to `FnOnce` | +note: `FnOnce` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/fn_trait_refs.rs:35:8 | LL | T: ~const Fn<()> + ~const Destruct, - | ^^^^^^ + | ^^^^^^ can't be applied to `Fn` + | +note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/fn_trait_refs.rs:35:8 | LL | T: ~const Fn<()> + ~const Destruct, - | ^^^^^^ + | ^^^^^^ can't be applied to `Fn` | +note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/fn_trait_refs.rs:35:8 | LL | T: ~const Fn<()> + ~const Destruct, - | ^^^^^^ + | ^^^^^^ can't be applied to `Fn` | +note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/fn_trait_refs.rs:49:8 | LL | T: ~const FnMut<()> + ~const Destruct, - | ^^^^^^ + | ^^^^^^ can't be applied to `FnMut` + | +note: `FnMut` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/fn_trait_refs.rs:49:8 | LL | T: ~const FnMut<()> + ~const Destruct, - | ^^^^^^ + | ^^^^^^ can't be applied to `FnMut` | +note: `FnMut` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/fn_trait_refs.rs:49:8 | LL | T: ~const FnMut<()> + ~const Destruct, - | ^^^^^^ + | ^^^^^^ can't be applied to `FnMut` | +note: `FnMut` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0277]: the trait bound `fn() -> i32 {one}: const Destruct` is not satisfied diff --git a/tests/ui/consts/issue-54954.stderr b/tests/ui/consts/issue-54954.stderr index ed6aa9c44a3..b8c983eb7b8 100644 --- a/tests/ui/consts/issue-54954.stderr +++ b/tests/ui/consts/issue-54954.stderr @@ -19,24 +19,6 @@ LL | | core::mem::size_of::<T>() LL | | } | |_____- `Tt::const_val` defined here -note: erroneous constant encountered - --> $DIR/issue-54954.rs:11:15 - | -LL | fn f(z: [f32; ARR_LEN]) -> [f32; ARR_LEN] { - | ^^^^^^^ - -note: erroneous constant encountered - --> $DIR/issue-54954.rs:11:34 - | -LL | fn f(z: [f32; ARR_LEN]) -> [f32; ARR_LEN] { - | ^^^^^^^ - -note: erroneous constant encountered - --> $DIR/issue-54954.rs:16:22 - | -LL | let _ = f([1f32; ARR_LEN]); - | ^^^^^^^ - error: aborting due to 2 previous errors Some errors have detailed explanations: E0379, E0790. diff --git a/tests/ui/consts/missing_assoc_const_type2.stderr b/tests/ui/consts/missing_assoc_const_type2.stderr index 3279a077464..1255ca2d102 100644 --- a/tests/ui/consts/missing_assoc_const_type2.stderr +++ b/tests/ui/consts/missing_assoc_const_type2.stderr @@ -4,11 +4,5 @@ error: missing type for `const` item LL | const FIRST: = 10; | ^ help: provide a type for the associated constant: `u8` -note: erroneous constant encountered - --> $DIR/missing_assoc_const_type2.rs:18:5 - | -LL | TwoDigits::FIRST as usize - | ^^^^^^^^^^^^^^^^ - error: aborting due to 1 previous error diff --git a/tests/ui/consts/promoted-type-error-issue-133968.rs b/tests/ui/consts/promoted-type-error-issue-133968.rs new file mode 100644 index 00000000000..52c0d48ab5b --- /dev/null +++ b/tests/ui/consts/promoted-type-error-issue-133968.rs @@ -0,0 +1,7 @@ +struct B<T: ?Sized + Send + 'static> { + x: &'static T, +} +static STR: &'static [u8] = "a b"; //~ERROR: mismatched types +static C: &B<[u8]> = &B { x: STR }; + +fn main() {} diff --git a/tests/ui/consts/promoted-type-error-issue-133968.stderr b/tests/ui/consts/promoted-type-error-issue-133968.stderr new file mode 100644 index 00000000000..24f1268e4b6 --- /dev/null +++ b/tests/ui/consts/promoted-type-error-issue-133968.stderr @@ -0,0 +1,16 @@ +error[E0308]: mismatched types + --> $DIR/promoted-type-error-issue-133968.rs:4:29 + | +LL | static STR: &'static [u8] = "a b"; + | ^^^^^ expected `&[u8]`, found `&str` + | + = note: expected reference `&'static [u8]` + found reference `&'static str` +help: consider adding a leading `b` + | +LL | static STR: &'static [u8] = b"a b"; + | + + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/consts/rustc-impl-const-stability.stderr b/tests/ui/consts/rustc-impl-const-stability.stderr index 4a58b5c8603..19c6bb5907f 100644 --- a/tests/ui/consts/rustc-impl-const-stability.stderr +++ b/tests/ui/consts/rustc-impl-const-stability.stderr @@ -2,7 +2,7 @@ error: const `impl` for trait `Default` which is not marked with `#[const_trait] --> $DIR/rustc-impl-const-stability.rs:15:12 | LL | impl const Default for Data { - | ^^^^^^^ + | ^^^^^^^ this trait is not `const` | = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: adding a non-const method body in the future would be a breaking change diff --git a/tests/ui/consts/unstable-const-fn-in-libcore.stderr b/tests/ui/consts/unstable-const-fn-in-libcore.stderr index f40c1871e90..32693edbfcb 100644 --- a/tests/ui/consts/unstable-const-fn-in-libcore.stderr +++ b/tests/ui/consts/unstable-const-fn-in-libcore.stderr @@ -2,14 +2,19 @@ error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/unstable-const-fn-in-libcore.rs:19:32 | LL | const fn unwrap_or_else<F: ~const FnOnce() -> T>(self, f: F) -> T { - | ^^^^^^ + | ^^^^^^ can't be applied to `FnOnce` + | +note: `FnOnce` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/unstable-const-fn-in-libcore.rs:19:32 | LL | const fn unwrap_or_else<F: ~const FnOnce() -> T>(self, f: F) -> T { - | ^^^^^^ + | ^^^^^^ can't be applied to `FnOnce` | +note: `FnOnce` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0015]: cannot call non-const closure in constant functions diff --git a/tests/ui/dataflow_const_prop/ptr-in-switch-int-issue-131227.rs b/tests/ui/dataflow_const_prop/ptr-in-switch-int-issue-131227.rs new file mode 100644 index 00000000000..7a55e13d0ee --- /dev/null +++ b/tests/ui/dataflow_const_prop/ptr-in-switch-int-issue-131227.rs @@ -0,0 +1,19 @@ +//! Issue: <https://github.com/rust-lang/rust/issues/131227> +//! Test that constant propagation in SwitchInt does not crash +//! when encountering a ptr-to-int transmute. + +//@ check-pass +//@ compile-flags: -Zmir-enable-passes=+InstSimplify-before-inline,+DataflowConstProp + +#![crate_type = "lib"] + +static mut G: i32 = 0; + +pub fn myfunc() -> i32 { + let var = &raw mut G; + let u: usize = unsafe { std::mem::transmute(var) }; + match u { + 0 => 0, + _ => 1, + } +} diff --git a/tests/ui/destructuring-assignment/struct_destructure_fail.stderr b/tests/ui/destructuring-assignment/struct_destructure_fail.stderr index 4c4f0663eeb..58f8e97dea0 100644 --- a/tests/ui/destructuring-assignment/struct_destructure_fail.stderr +++ b/tests/ui/destructuring-assignment/struct_destructure_fail.stderr @@ -12,17 +12,6 @@ error: functional record updates are not allowed in destructuring assignments LL | Struct { a, ..d } = Struct { a: 1, b: 2 }; | ^ help: consider removing the trailing pattern -error[E0797]: base expression required after `..` - --> $DIR/struct_destructure_fail.rs:15:19 - | -LL | Struct { a, .. }; - | ^ - | -help: add a base expression here - | -LL | Struct { a, ../* expr */ }; - | ++++++++++ - error[E0026]: struct `Struct` does not have a field named `c` --> $DIR/struct_destructure_fail.rs:10:20 | @@ -48,6 +37,17 @@ help: or always ignore missing fields here LL | Struct { a, .. } = Struct { a: 1, b: 2 }; | ~~~~~~ +error[E0797]: base expression required after `..` + --> $DIR/struct_destructure_fail.rs:15:19 + | +LL | Struct { a, .. }; + | ^ + | +help: add a base expression here + | +LL | Struct { a, ../* expr */ }; + | ++++++++++ + error: aborting due to 5 previous errors Some errors have detailed explanations: E0026, E0027, E0797. diff --git a/tests/ui/enum-discriminant/issue-41394.stderr b/tests/ui/enum-discriminant/issue-41394.stderr index 9bf4fc79b1b..e81562df04f 100644 --- a/tests/ui/enum-discriminant/issue-41394.stderr +++ b/tests/ui/enum-discriminant/issue-41394.stderr @@ -6,12 +6,6 @@ LL | A = "" + 1 | | | &str -note: erroneous constant encountered - --> $DIR/issue-41394.rs:7:9 - | -LL | A = Foo::A as isize - | ^^^^^^^^^^^^^^^ - error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0369`. diff --git a/tests/ui/feature-gates/feature-gate-default-field-values.rs b/tests/ui/feature-gates/feature-gate-default-field-values.rs new file mode 100644 index 00000000000..d2e41a71602 --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-default-field-values.rs @@ -0,0 +1,106 @@ +#![feature(generic_const_exprs)] +#![allow(unused_variables, dead_code, incomplete_features)] + +pub struct S; + +#[derive(Default)] +pub struct Foo { + pub bar: S = S, //~ ERROR default values on fields are experimental + pub baz: i32 = 42 + 3, //~ ERROR default values on fields are experimental +} + +#[derive(Default)] +pub enum Bar { + #[default] + Foo { //~ ERROR the `#[default]` attribute may only be used on unit enum variants + bar: S = S, //~ ERROR default values on fields are experimental + baz: i32 = 42 + 3, //~ ERROR default values on fields are experimental + } +} + +#[derive(Default)] +pub struct Qux<A, const C: i32> { + bar: S = Qux::<A, C>::S, //~ ERROR default values on fields are experimental + baz: i32 = foo(), //~ ERROR default values on fields are experimental + bat: i32 = <Qux<A, C> as T>::K, //~ ERROR default values on fields are experimental + bay: i32 = C, //~ ERROR default values on fields are experimental + bak: Vec<A> = Vec::new(), //~ ERROR default values on fields are experimental +} + +impl<A, const C: i32> Qux<A, C> { + const S: S = S; +} + +trait T { + const K: i32; +} + +impl<A, const C: i32> T for Qux<A, C> { + const K: i32 = 2; +} + +const fn foo() -> i32 { + 42 +} + +#[derive(Default)] +pub struct Opt { + mandatory: Option<()>, + optional: () = (), //~ ERROR default values on fields are experimental +} + +#[derive(Default)] +pub enum OptEnum { + #[default] + Variant { //~ ERROR the `#[default]` attribute may only be used on unit enum variants + mandatory: Option<()>, + optional: () = (), //~ ERROR default values on fields are experimental + } +} + +fn main () { + let x = Foo { .. }; //~ ERROR base expression required after `..` + let y = Foo::default(); + let z = Foo { baz: 1, .. }; //~ ERROR base expression required after `..` + + assert_eq!(45, x.baz); + assert_eq!(45, y.baz); + assert_eq!(1, z.baz); + + let x = Bar::Foo { .. }; //~ ERROR base expression required after `..` + let y = Bar::default(); + let z = Bar::Foo { baz: 1, .. }; //~ ERROR base expression required after `..` + + assert!(matches!(Bar::Foo { bar: S, baz: 45 }, x)); + assert!(matches!(Bar::Foo { bar: S, baz: 45 }, y)); + assert!(matches!(Bar::Foo { bar: S, baz: 1 }, z)); + + let x = Qux::<i32, 4> { .. }; //~ ERROR base expression required after `..` + assert!(matches!(Qux::<i32, 4> { bar: S, baz: 42, bat: 2, bay: 4, .. }, x)); + //~^ ERROR base expression required after `..` + assert!(x.bak.is_empty()); + let y = Opt { mandatory: None, .. }; + //~^ ERROR base expression required after `..` + assert!(matches!(Opt::default(), y)); + let z = Opt::default(); + assert!(matches!(Opt { mandatory: None, .. }, z)); + //~^ ERROR base expression required after `..` + assert!(matches!(Opt { .. }, z)); + //~^ ERROR base expression required after `..` + assert!(matches!(Opt { optional: (), .. }, z)); + //~^ ERROR base expression required after `..` + assert!(matches!(Opt { optional: (), mandatory: None, .. }, z)); + //~^ ERROR base expression required after `..` + let y = OptEnum::Variant { mandatory: None, .. }; + //~^ ERROR base expression required after `..` + assert!(matches!(OptEnum::default(), y)); + let z = OptEnum::default(); + assert!(matches!(OptEnum::Variant { mandatory: None, .. }, z)); + //~^ ERROR base expression required after `..` + assert!(matches!(OptEnum::Variant { .. }, z)); + //~^ ERROR base expression required after `..` + assert!(matches!(OptEnum::Variant { optional: (), .. }, z)); + //~^ ERROR base expression required after `..` + assert!(matches!(OptEnum::Variant { optional: (), mandatory: None, .. }, z)); + //~^ ERROR base expression required after `..` +} diff --git a/tests/ui/feature-gates/feature-gate-default-field-values.stderr b/tests/ui/feature-gates/feature-gate-default-field-values.stderr new file mode 100644 index 00000000000..d882c322c8e --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-default-field-values.stderr @@ -0,0 +1,318 @@ +error: the `#[default]` attribute may only be used on unit enum variants + --> $DIR/feature-gate-default-field-values.rs:15:5 + | +LL | Foo { + | ^^^ + | + = help: consider a manual implementation of `Default` + +error: the `#[default]` attribute may only be used on unit enum variants + --> $DIR/feature-gate-default-field-values.rs:55:5 + | +LL | Variant { + | ^^^^^^^ + | + = help: consider a manual implementation of `Default` + +error[E0658]: default values on fields are experimental + --> $DIR/feature-gate-default-field-values.rs:8:15 + | +LL | pub bar: S = S, + | ^^^^ + | + = note: see issue #132162 <https://github.com/rust-lang/rust/issues/132162> for more information + = help: add `#![feature(default_field_values)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: default values on fields are experimental + --> $DIR/feature-gate-default-field-values.rs:9:17 + | +LL | pub baz: i32 = 42 + 3, + | ^^^^^^^^^ + | + = note: see issue #132162 <https://github.com/rust-lang/rust/issues/132162> for more information + = help: add `#![feature(default_field_values)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: default values on fields are experimental + --> $DIR/feature-gate-default-field-values.rs:16:15 + | +LL | bar: S = S, + | ^^^^ + | + = note: see issue #132162 <https://github.com/rust-lang/rust/issues/132162> for more information + = help: add `#![feature(default_field_values)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: default values on fields are experimental + --> $DIR/feature-gate-default-field-values.rs:17:17 + | +LL | baz: i32 = 42 + 3, + | ^^^^^^^^^ + | + = note: see issue #132162 <https://github.com/rust-lang/rust/issues/132162> for more information + = help: add `#![feature(default_field_values)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: default values on fields are experimental + --> $DIR/feature-gate-default-field-values.rs:23:11 + | +LL | bar: S = Qux::<A, C>::S, + | ^^^^^^^^^^^^^^^^^ + | + = note: see issue #132162 <https://github.com/rust-lang/rust/issues/132162> for more information + = help: add `#![feature(default_field_values)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: default values on fields are experimental + --> $DIR/feature-gate-default-field-values.rs:24:13 + | +LL | baz: i32 = foo(), + | ^^^^^^^^ + | + = note: see issue #132162 <https://github.com/rust-lang/rust/issues/132162> for more information + = help: add `#![feature(default_field_values)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: default values on fields are experimental + --> $DIR/feature-gate-default-field-values.rs:25:13 + | +LL | bat: i32 = <Qux<A, C> as T>::K, + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #132162 <https://github.com/rust-lang/rust/issues/132162> for more information + = help: add `#![feature(default_field_values)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: default values on fields are experimental + --> $DIR/feature-gate-default-field-values.rs:26:13 + | +LL | bay: i32 = C, + | ^^^^ + | + = note: see issue #132162 <https://github.com/rust-lang/rust/issues/132162> for more information + = help: add `#![feature(default_field_values)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: default values on fields are experimental + --> $DIR/feature-gate-default-field-values.rs:27:16 + | +LL | bak: Vec<A> = Vec::new(), + | ^^^^^^^^^^^^^ + | + = note: see issue #132162 <https://github.com/rust-lang/rust/issues/132162> for more information + = help: add `#![feature(default_field_values)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: default values on fields are experimental + --> $DIR/feature-gate-default-field-values.rs:49:17 + | +LL | optional: () = (), + | ^^^^^ + | + = note: see issue #132162 <https://github.com/rust-lang/rust/issues/132162> for more information + = help: add `#![feature(default_field_values)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: default values on fields are experimental + --> $DIR/feature-gate-default-field-values.rs:57:21 + | +LL | optional: () = (), + | ^^^^^ + | + = note: see issue #132162 <https://github.com/rust-lang/rust/issues/132162> for more information + = help: add `#![feature(default_field_values)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0797]: base expression required after `..` + --> $DIR/feature-gate-default-field-values.rs:62:21 + | +LL | let x = Foo { .. }; + | ^ + | + = help: add `#![feature(default_field_values)]` to the crate attributes to enable default values on `struct` fields +help: add a base expression here + | +LL | let x = Foo { ../* expr */ }; + | ++++++++++ + +error[E0797]: base expression required after `..` + --> $DIR/feature-gate-default-field-values.rs:64:29 + | +LL | let z = Foo { baz: 1, .. }; + | ^ + | + = help: add `#![feature(default_field_values)]` to the crate attributes to enable default values on `struct` fields +help: add a base expression here + | +LL | let z = Foo { baz: 1, ../* expr */ }; + | ++++++++++ + +error[E0797]: base expression required after `..` + --> $DIR/feature-gate-default-field-values.rs:70:26 + | +LL | let x = Bar::Foo { .. }; + | ^ + | + = help: add `#![feature(default_field_values)]` to the crate attributes to enable default values on `struct` fields +help: add a base expression here + | +LL | let x = Bar::Foo { ../* expr */ }; + | ++++++++++ + +error[E0797]: base expression required after `..` + --> $DIR/feature-gate-default-field-values.rs:72:34 + | +LL | let z = Bar::Foo { baz: 1, .. }; + | ^ + | + = help: add `#![feature(default_field_values)]` to the crate attributes to enable default values on `struct` fields +help: add a base expression here + | +LL | let z = Bar::Foo { baz: 1, ../* expr */ }; + | ++++++++++ + +error[E0797]: base expression required after `..` + --> $DIR/feature-gate-default-field-values.rs:78:31 + | +LL | let x = Qux::<i32, 4> { .. }; + | ^ + | + = help: add `#![feature(default_field_values)]` to the crate attributes to enable default values on `struct` fields +help: add a base expression here + | +LL | let x = Qux::<i32, 4> { ../* expr */ }; + | ++++++++++ + +error[E0797]: base expression required after `..` + --> $DIR/feature-gate-default-field-values.rs:79:73 + | +LL | assert!(matches!(Qux::<i32, 4> { bar: S, baz: 42, bat: 2, bay: 4, .. }, x)); + | ^ + | + = help: add `#![feature(default_field_values)]` to the crate attributes to enable default values on `struct` fields +help: add a base expression here + | +LL | assert!(matches!(Qux::<i32, 4> { bar: S, baz: 42, bat: 2, bay: 4, ../* expr */ }, x)); + | ++++++++++ + +error[E0797]: base expression required after `..` + --> $DIR/feature-gate-default-field-values.rs:82:38 + | +LL | let y = Opt { mandatory: None, .. }; + | ^ + | + = help: add `#![feature(default_field_values)]` to the crate attributes to enable default values on `struct` fields +help: add a base expression here + | +LL | let y = Opt { mandatory: None, ../* expr */ }; + | ++++++++++ + +error[E0797]: base expression required after `..` + --> $DIR/feature-gate-default-field-values.rs:86:47 + | +LL | assert!(matches!(Opt { mandatory: None, .. }, z)); + | ^ + | + = help: add `#![feature(default_field_values)]` to the crate attributes to enable default values on `struct` fields +help: add a base expression here + | +LL | assert!(matches!(Opt { mandatory: None, ../* expr */ }, z)); + | ++++++++++ + +error[E0797]: base expression required after `..` + --> $DIR/feature-gate-default-field-values.rs:88:30 + | +LL | assert!(matches!(Opt { .. }, z)); + | ^ + | +help: add a base expression here + | +LL | assert!(matches!(Opt { ../* expr */ }, z)); + | ++++++++++ + +error[E0797]: base expression required after `..` + --> $DIR/feature-gate-default-field-values.rs:90:44 + | +LL | assert!(matches!(Opt { optional: (), .. }, z)); + | ^ + | +help: add a base expression here + | +LL | assert!(matches!(Opt { optional: (), ../* expr */ }, z)); + | ++++++++++ + +error[E0797]: base expression required after `..` + --> $DIR/feature-gate-default-field-values.rs:92:61 + | +LL | assert!(matches!(Opt { optional: (), mandatory: None, .. }, z)); + | ^ + | +help: remove the `..` as all the fields are already present + | +LL - assert!(matches!(Opt { optional: (), mandatory: None, .. }, z)); +LL + assert!(matches!(Opt { optional: (), mandatory: None, }, z)); + | + +error[E0797]: base expression required after `..` + --> $DIR/feature-gate-default-field-values.rs:94:51 + | +LL | let y = OptEnum::Variant { mandatory: None, .. }; + | ^ + | + = help: add `#![feature(default_field_values)]` to the crate attributes to enable default values on `struct` fields +help: add a base expression here + | +LL | let y = OptEnum::Variant { mandatory: None, ../* expr */ }; + | ++++++++++ + +error[E0797]: base expression required after `..` + --> $DIR/feature-gate-default-field-values.rs:98:60 + | +LL | assert!(matches!(OptEnum::Variant { mandatory: None, .. }, z)); + | ^ + | + = help: add `#![feature(default_field_values)]` to the crate attributes to enable default values on `struct` fields +help: add a base expression here + | +LL | assert!(matches!(OptEnum::Variant { mandatory: None, ../* expr */ }, z)); + | ++++++++++ + +error[E0797]: base expression required after `..` + --> $DIR/feature-gate-default-field-values.rs:100:43 + | +LL | assert!(matches!(OptEnum::Variant { .. }, z)); + | ^ + | +help: add a base expression here + | +LL | assert!(matches!(OptEnum::Variant { ../* expr */ }, z)); + | ++++++++++ + +error[E0797]: base expression required after `..` + --> $DIR/feature-gate-default-field-values.rs:102:57 + | +LL | assert!(matches!(OptEnum::Variant { optional: (), .. }, z)); + | ^ + | +help: add a base expression here + | +LL | assert!(matches!(OptEnum::Variant { optional: (), ../* expr */ }, z)); + | ++++++++++ + +error[E0797]: base expression required after `..` + --> $DIR/feature-gate-default-field-values.rs:104:74 + | +LL | assert!(matches!(OptEnum::Variant { optional: (), mandatory: None, .. }, z)); + | ^ + | +help: remove the `..` as all the fields are already present + | +LL - assert!(matches!(OptEnum::Variant { optional: (), mandatory: None, .. }, z)); +LL + assert!(matches!(OptEnum::Variant { optional: (), mandatory: None, }, z)); + | + +error: aborting due to 29 previous errors + +Some errors have detailed explanations: E0658, E0797. +For more information about an error, try `rustc --explain E0658`. diff --git a/tests/ui/impl-trait/normalize-tait-in-const.stderr b/tests/ui/impl-trait/normalize-tait-in-const.stderr index 1dd84f10ad8..0f79cefeaec 100644 --- a/tests/ui/impl-trait/normalize-tait-in-const.stderr +++ b/tests/ui/impl-trait/normalize-tait-in-const.stderr @@ -2,14 +2,19 @@ error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/normalize-tait-in-const.rs:26:35 | LL | const fn with_positive<F: for<'a> ~const Fn(&'a Alias<'a>) + ~const Destruct>(fun: F) { - | ^^^^^^ + | ^^^^^^ can't be applied to `Fn` + | +note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/normalize-tait-in-const.rs:26:35 | LL | const fn with_positive<F: for<'a> ~const Fn(&'a Alias<'a>) + ~const Destruct>(fun: F) { - | ^^^^^^ + | ^^^^^^ can't be applied to `Fn` | +note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0277]: the trait bound `for<'a, 'b> fn(&'a foo::Alias<'b>) {foo}: const Destruct` is not satisfied diff --git a/tests/ui/layout/base-layout-is-sized-ice-123078.stderr b/tests/ui/layout/base-layout-is-sized-ice-123078.stderr index ee7f5162552..455bd2cbf8b 100644 --- a/tests/ui/layout/base-layout-is-sized-ice-123078.stderr +++ b/tests/ui/layout/base-layout-is-sized-ice-123078.stderr @@ -25,12 +25,6 @@ LL | const C: S = unsafe { std::mem::transmute(()) }; = note: source type: `()` (0 bits) = note: target type: `S` (size can vary because of [u8]) -note: erroneous constant encountered - --> $DIR/base-layout-is-sized-ice-123078.rs:13:5 - | -LL | C; - | ^ - error: aborting due to 2 previous errors Some errors have detailed explanations: E0277, E0512. diff --git a/tests/ui/linkage-attr/auxiliary/link-cfg-works-transitive-dylib.rs b/tests/ui/link-native-libs/auxiliary/link-cfg-works-transitive-dylib.rs index 0d927117d81..0d927117d81 100644 --- a/tests/ui/linkage-attr/auxiliary/link-cfg-works-transitive-dylib.rs +++ b/tests/ui/link-native-libs/auxiliary/link-cfg-works-transitive-dylib.rs diff --git a/tests/ui/linkage-attr/auxiliary/link-cfg-works-transitive-rlib.rs b/tests/ui/link-native-libs/auxiliary/link-cfg-works-transitive-rlib.rs index 49a46b202e4..49a46b202e4 100644 --- a/tests/ui/linkage-attr/auxiliary/link-cfg-works-transitive-rlib.rs +++ b/tests/ui/link-native-libs/auxiliary/link-cfg-works-transitive-rlib.rs diff --git a/tests/ui/native-library-link-flags/empty-kind-1.rs b/tests/ui/link-native-libs/empty-kind-1.rs index d9b8d8a7f7d..d9b8d8a7f7d 100644 --- a/tests/ui/native-library-link-flags/empty-kind-1.rs +++ b/tests/ui/link-native-libs/empty-kind-1.rs diff --git a/tests/ui/native-library-link-flags/empty-kind-1.stderr b/tests/ui/link-native-libs/empty-kind-1.stderr index 3e5b0549339..3e5b0549339 100644 --- a/tests/ui/native-library-link-flags/empty-kind-1.stderr +++ b/tests/ui/link-native-libs/empty-kind-1.stderr diff --git a/tests/ui/native-library-link-flags/empty-kind-2.rs b/tests/ui/link-native-libs/empty-kind-2.rs index 16cb3b917e4..16cb3b917e4 100644 --- a/tests/ui/native-library-link-flags/empty-kind-2.rs +++ b/tests/ui/link-native-libs/empty-kind-2.rs diff --git a/tests/ui/native-library-link-flags/empty-kind-2.stderr b/tests/ui/link-native-libs/empty-kind-2.stderr index 3e5b0549339..3e5b0549339 100644 --- a/tests/ui/native-library-link-flags/empty-kind-2.stderr +++ b/tests/ui/link-native-libs/empty-kind-2.stderr diff --git a/tests/ui/linkage-attr/issue-109144.rs b/tests/ui/link-native-libs/issue-109144.rs index 2f740e55389..2f740e55389 100644 --- a/tests/ui/linkage-attr/issue-109144.rs +++ b/tests/ui/link-native-libs/issue-109144.rs diff --git a/tests/ui/linkage-attr/issue-109144.stderr b/tests/ui/link-native-libs/issue-109144.stderr index 0748d94189c..0748d94189c 100644 --- a/tests/ui/linkage-attr/issue-109144.stderr +++ b/tests/ui/link-native-libs/issue-109144.stderr diff --git a/tests/ui/issues/issue-43925.rs b/tests/ui/link-native-libs/issue-43925.rs index 1a210887154..1a210887154 100644 --- a/tests/ui/issues/issue-43925.rs +++ b/tests/ui/link-native-libs/issue-43925.rs diff --git a/tests/ui/issues/issue-43925.stderr b/tests/ui/link-native-libs/issue-43925.stderr index 7cc347c6163..7cc347c6163 100644 --- a/tests/ui/issues/issue-43925.stderr +++ b/tests/ui/link-native-libs/issue-43925.stderr diff --git a/tests/ui/issues/issue-43926.rs b/tests/ui/link-native-libs/issue-43926.rs index 6d3003552dc..6d3003552dc 100644 --- a/tests/ui/issues/issue-43926.rs +++ b/tests/ui/link-native-libs/issue-43926.rs diff --git a/tests/ui/issues/issue-43926.stderr b/tests/ui/link-native-libs/issue-43926.stderr index 7c5c50a38a9..7c5c50a38a9 100644 --- a/tests/ui/issues/issue-43926.stderr +++ b/tests/ui/link-native-libs/issue-43926.stderr diff --git a/tests/ui/issues/issue-70093/issue-70093-link-directives.rs b/tests/ui/link-native-libs/issue-70093/issue-70093-link-directives.rs index 9c60affbccd..9c60affbccd 100644 --- a/tests/ui/issues/issue-70093/issue-70093-link-directives.rs +++ b/tests/ui/link-native-libs/issue-70093/issue-70093-link-directives.rs diff --git a/tests/ui/issues/issue-70093/issue-70093.rs b/tests/ui/link-native-libs/issue-70093/issue-70093.rs index 86974239338..86974239338 100644 --- a/tests/ui/issues/issue-70093/issue-70093.rs +++ b/tests/ui/link-native-libs/issue-70093/issue-70093.rs diff --git a/tests/ui/linkage-attr/kind-framework.rs b/tests/ui/link-native-libs/kind-framework.rs index c2f90809e03..c2f90809e03 100644 --- a/tests/ui/linkage-attr/kind-framework.rs +++ b/tests/ui/link-native-libs/kind-framework.rs diff --git a/tests/ui/linkage-attr/kind-framework.stderr b/tests/ui/link-native-libs/kind-framework.stderr index 93dacd68e29..93dacd68e29 100644 --- a/tests/ui/linkage-attr/kind-framework.stderr +++ b/tests/ui/link-native-libs/kind-framework.stderr diff --git a/tests/ui/native-library-link-flags/link-arg-error.rs b/tests/ui/link-native-libs/link-arg-error.rs index 4defb108178..4defb108178 100644 --- a/tests/ui/native-library-link-flags/link-arg-error.rs +++ b/tests/ui/link-native-libs/link-arg-error.rs diff --git a/tests/ui/native-library-link-flags/link-arg-error.stderr b/tests/ui/link-native-libs/link-arg-error.stderr index e1d01e14152..e1d01e14152 100644 --- a/tests/ui/native-library-link-flags/link-arg-error.stderr +++ b/tests/ui/link-native-libs/link-arg-error.stderr diff --git a/tests/ui/native-library-link-flags/link-arg-from-rs.rs b/tests/ui/link-native-libs/link-arg-from-rs.rs index 4a6017fea33..4a6017fea33 100644 --- a/tests/ui/native-library-link-flags/link-arg-from-rs.rs +++ b/tests/ui/link-native-libs/link-arg-from-rs.rs diff --git a/tests/ui/native-library-link-flags/link-arg-from-rs.stderr b/tests/ui/link-native-libs/link-arg-from-rs.stderr index f31e15f1da6..f31e15f1da6 100644 --- a/tests/ui/native-library-link-flags/link-arg-from-rs.stderr +++ b/tests/ui/link-native-libs/link-arg-from-rs.stderr diff --git a/tests/ui/linkage-attr/link-attr-validation-early.rs b/tests/ui/link-native-libs/link-attr-validation-early.rs index b9a835fb5e9..b9a835fb5e9 100644 --- a/tests/ui/linkage-attr/link-attr-validation-early.rs +++ b/tests/ui/link-native-libs/link-attr-validation-early.rs diff --git a/tests/ui/linkage-attr/link-attr-validation-early.stderr b/tests/ui/link-native-libs/link-attr-validation-early.stderr index 24ad9d825f8..24ad9d825f8 100644 --- a/tests/ui/linkage-attr/link-attr-validation-early.stderr +++ b/tests/ui/link-native-libs/link-attr-validation-early.stderr diff --git a/tests/ui/linkage-attr/link-attr-validation-late.rs b/tests/ui/link-native-libs/link-attr-validation-late.rs index 34f720dd2d3..34f720dd2d3 100644 --- a/tests/ui/linkage-attr/link-attr-validation-late.rs +++ b/tests/ui/link-native-libs/link-attr-validation-late.rs diff --git a/tests/ui/linkage-attr/link-attr-validation-late.stderr b/tests/ui/link-native-libs/link-attr-validation-late.stderr index 1ad5fbaf7de..1ad5fbaf7de 100644 --- a/tests/ui/linkage-attr/link-attr-validation-late.stderr +++ b/tests/ui/link-native-libs/link-attr-validation-late.stderr diff --git a/tests/ui/linkage-attr/link-cfg-works.rs b/tests/ui/link-native-libs/link-cfg-works.rs index 7b936bc43b1..7b936bc43b1 100644 --- a/tests/ui/linkage-attr/link-cfg-works.rs +++ b/tests/ui/link-native-libs/link-cfg-works.rs diff --git a/tests/ui/manual/manual-link-bad-form.rs b/tests/ui/link-native-libs/manual-link-bad-form.rs index 0f5723adec9..0f5723adec9 100644 --- a/tests/ui/manual/manual-link-bad-form.rs +++ b/tests/ui/link-native-libs/manual-link-bad-form.rs diff --git a/tests/ui/manual/manual-link-bad-form.stderr b/tests/ui/link-native-libs/manual-link-bad-form.stderr index 7fd7a1066b4..7fd7a1066b4 100644 --- a/tests/ui/manual/manual-link-bad-form.stderr +++ b/tests/ui/link-native-libs/manual-link-bad-form.stderr diff --git a/tests/ui/manual/manual-link-bad-kind.rs b/tests/ui/link-native-libs/manual-link-bad-kind.rs index d070faa6574..d070faa6574 100644 --- a/tests/ui/manual/manual-link-bad-kind.rs +++ b/tests/ui/link-native-libs/manual-link-bad-kind.rs diff --git a/tests/ui/manual/manual-link-bad-kind.stderr b/tests/ui/link-native-libs/manual-link-bad-kind.stderr index 647c4c61e02..647c4c61e02 100644 --- a/tests/ui/manual/manual-link-bad-kind.stderr +++ b/tests/ui/link-native-libs/manual-link-bad-kind.stderr diff --git a/tests/ui/manual/manual-link-bad-search-path.rs b/tests/ui/link-native-libs/manual-link-bad-search-path.rs index c9ced4734fc..c9ced4734fc 100644 --- a/tests/ui/manual/manual-link-bad-search-path.rs +++ b/tests/ui/link-native-libs/manual-link-bad-search-path.rs diff --git a/tests/ui/manual/manual-link-bad-search-path.stderr b/tests/ui/link-native-libs/manual-link-bad-search-path.stderr index 2c0649ea152..2c0649ea152 100644 --- a/tests/ui/manual/manual-link-bad-search-path.stderr +++ b/tests/ui/link-native-libs/manual-link-bad-search-path.stderr diff --git a/tests/ui/manual/manual-link-framework.rs b/tests/ui/link-native-libs/manual-link-framework.rs index 43cdda0a4e6..43cdda0a4e6 100644 --- a/tests/ui/manual/manual-link-framework.rs +++ b/tests/ui/link-native-libs/manual-link-framework.rs diff --git a/tests/ui/manual/manual-link-framework.stderr b/tests/ui/link-native-libs/manual-link-framework.stderr index 38d2302a48d..38d2302a48d 100644 --- a/tests/ui/manual/manual-link-framework.stderr +++ b/tests/ui/link-native-libs/manual-link-framework.stderr diff --git a/tests/ui/manual/manual-link-unsupported-kind.rs b/tests/ui/link-native-libs/manual-link-unsupported-kind.rs index b5b9e3e6577..b5b9e3e6577 100644 --- a/tests/ui/manual/manual-link-unsupported-kind.rs +++ b/tests/ui/link-native-libs/manual-link-unsupported-kind.rs diff --git a/tests/ui/manual/manual-link-unsupported-kind.stderr b/tests/ui/link-native-libs/manual-link-unsupported-kind.stderr index ae4a1ec9a95..ae4a1ec9a95 100644 --- a/tests/ui/manual/manual-link-unsupported-kind.stderr +++ b/tests/ui/link-native-libs/manual-link-unsupported-kind.stderr diff --git a/tests/ui/native-library-link-flags/modifiers-bad.blank.stderr b/tests/ui/link-native-libs/modifiers-bad.blank.stderr index ea36af0b4cf..ea36af0b4cf 100644 --- a/tests/ui/native-library-link-flags/modifiers-bad.blank.stderr +++ b/tests/ui/link-native-libs/modifiers-bad.blank.stderr diff --git a/tests/ui/native-library-link-flags/modifiers-bad.no-prefix.stderr b/tests/ui/link-native-libs/modifiers-bad.no-prefix.stderr index ea36af0b4cf..ea36af0b4cf 100644 --- a/tests/ui/native-library-link-flags/modifiers-bad.no-prefix.stderr +++ b/tests/ui/link-native-libs/modifiers-bad.no-prefix.stderr diff --git a/tests/ui/native-library-link-flags/modifiers-bad.prefix-only.stderr b/tests/ui/link-native-libs/modifiers-bad.prefix-only.stderr index 1e701374688..1e701374688 100644 --- a/tests/ui/native-library-link-flags/modifiers-bad.prefix-only.stderr +++ b/tests/ui/link-native-libs/modifiers-bad.prefix-only.stderr diff --git a/tests/ui/native-library-link-flags/modifiers-bad.rs b/tests/ui/link-native-libs/modifiers-bad.rs index 185201e0d84..185201e0d84 100644 --- a/tests/ui/native-library-link-flags/modifiers-bad.rs +++ b/tests/ui/link-native-libs/modifiers-bad.rs diff --git a/tests/ui/native-library-link-flags/modifiers-bad.unknown.stderr b/tests/ui/link-native-libs/modifiers-bad.unknown.stderr index 75950ad9c64..75950ad9c64 100644 --- a/tests/ui/native-library-link-flags/modifiers-bad.unknown.stderr +++ b/tests/ui/link-native-libs/modifiers-bad.unknown.stderr diff --git a/tests/ui/native-library-link-flags/modifiers-override-2.rs b/tests/ui/link-native-libs/modifiers-override-2.rs index a462a741ac6..a462a741ac6 100644 --- a/tests/ui/native-library-link-flags/modifiers-override-2.rs +++ b/tests/ui/link-native-libs/modifiers-override-2.rs diff --git a/tests/ui/native-library-link-flags/modifiers-override-2.stderr b/tests/ui/link-native-libs/modifiers-override-2.stderr index aa5b59c5b6f..aa5b59c5b6f 100644 --- a/tests/ui/native-library-link-flags/modifiers-override-2.stderr +++ b/tests/ui/link-native-libs/modifiers-override-2.stderr diff --git a/tests/ui/native-library-link-flags/modifiers-override-3.rs b/tests/ui/link-native-libs/modifiers-override-3.rs index d05735ad616..d05735ad616 100644 --- a/tests/ui/native-library-link-flags/modifiers-override-3.rs +++ b/tests/ui/link-native-libs/modifiers-override-3.rs diff --git a/tests/ui/native-library-link-flags/modifiers-override-3.stderr b/tests/ui/link-native-libs/modifiers-override-3.stderr index 3eb9459f6f3..3eb9459f6f3 100644 --- a/tests/ui/native-library-link-flags/modifiers-override-3.stderr +++ b/tests/ui/link-native-libs/modifiers-override-3.stderr diff --git a/tests/ui/native-library-link-flags/modifiers-override.rs b/tests/ui/link-native-libs/modifiers-override.rs index cd2d003664a..cd2d003664a 100644 --- a/tests/ui/native-library-link-flags/modifiers-override.rs +++ b/tests/ui/link-native-libs/modifiers-override.rs diff --git a/tests/ui/native-library-link-flags/modifiers-override.stderr b/tests/ui/link-native-libs/modifiers-override.stderr index 64427651e9f..64427651e9f 100644 --- a/tests/ui/native-library-link-flags/modifiers-override.stderr +++ b/tests/ui/link-native-libs/modifiers-override.stderr diff --git a/tests/ui/native-library-link-flags/msvc-non-utf8-output.rs b/tests/ui/link-native-libs/msvc-non-utf8-output.rs index 659a832247a..659a832247a 100644 --- a/tests/ui/native-library-link-flags/msvc-non-utf8-output.rs +++ b/tests/ui/link-native-libs/msvc-non-utf8-output.rs diff --git a/tests/ui/native-library-link-flags/msvc-non-utf8-output.stderr b/tests/ui/link-native-libs/msvc-non-utf8-output.stderr index 7f3ef376447..7f3ef376447 100644 --- a/tests/ui/native-library-link-flags/msvc-non-utf8-output.stderr +++ b/tests/ui/link-native-libs/msvc-non-utf8-output.stderr diff --git a/tests/ui/native-library-link-flags/suggest-libname-only-1.rs b/tests/ui/link-native-libs/suggest-libname-only-1.rs index 328181fb5cb..328181fb5cb 100644 --- a/tests/ui/native-library-link-flags/suggest-libname-only-1.rs +++ b/tests/ui/link-native-libs/suggest-libname-only-1.rs diff --git a/tests/ui/native-library-link-flags/suggest-libname-only-1.stderr b/tests/ui/link-native-libs/suggest-libname-only-1.stderr index e142835a9d6..e142835a9d6 100644 --- a/tests/ui/native-library-link-flags/suggest-libname-only-1.stderr +++ b/tests/ui/link-native-libs/suggest-libname-only-1.stderr diff --git a/tests/ui/native-library-link-flags/suggest-libname-only-2.rs b/tests/ui/link-native-libs/suggest-libname-only-2.rs index 7ed106e4ab4..7ed106e4ab4 100644 --- a/tests/ui/native-library-link-flags/suggest-libname-only-2.rs +++ b/tests/ui/link-native-libs/suggest-libname-only-2.rs diff --git a/tests/ui/native-library-link-flags/suggest-libname-only-2.stderr b/tests/ui/link-native-libs/suggest-libname-only-2.stderr index 392d2f01f61..392d2f01f61 100644 --- a/tests/ui/native-library-link-flags/suggest-libname-only-2.stderr +++ b/tests/ui/link-native-libs/suggest-libname-only-2.stderr diff --git a/tests/ui/linkage-attr/uikit-framework.rs b/tests/ui/link-native-libs/uikit-framework.rs index fca0332384a..fca0332384a 100644 --- a/tests/ui/linkage-attr/uikit-framework.rs +++ b/tests/ui/link-native-libs/uikit-framework.rs diff --git a/tests/ui/parser/struct-default-values-and-missing-field-separator.fixed b/tests/ui/parser/struct-default-values-and-missing-field-separator.fixed deleted file mode 100644 index be6ed053c6e..00000000000 --- a/tests/ui/parser/struct-default-values-and-missing-field-separator.fixed +++ /dev/null @@ -1,35 +0,0 @@ -//@ run-rustfix -#![allow(dead_code)] - -enum E { - A, -} - -struct S { - field1: i32, //~ ERROR default values on `struct` fields aren't supported - field2: E, //~ ERROR default values on `struct` fields aren't supported - field3: i32, //~ ERROR default values on `struct` fields aren't supported - field4: i32, //~ ERROR default values on `struct` fields aren't supported - field5: E, //~ ERROR default values on `struct` fields aren't supported - field6: E, //~ ERROR default values on `struct` fields aren't supported -} - -struct S1 { - field1: i32, //~ ERROR expected `,`, or `}`, found `field2` - field2: E, //~ ERROR expected `,`, or `}`, found `field3` - field3: i32, //~ ERROR default values on `struct` fields aren't supported - field4: i32, //~ ERROR default values on `struct` fields aren't supported - field5: E, //~ ERROR default values on `struct` fields aren't supported - field6: E, //~ ERROR default values on `struct` fields aren't supported -} - -struct S2 { - field1 : i32, //~ ERROR expected `:`, found `=` - field2: E, //~ ERROR expected `:`, found `;` -} - -const fn foo(_: i32) -> E { - E::A -} - -fn main() {} diff --git a/tests/ui/parser/struct-default-values-and-missing-field-separator.rs b/tests/ui/parser/struct-default-values-and-missing-field-separator.rs index 7900d397a5d..bb9de98bddb 100644 --- a/tests/ui/parser/struct-default-values-and-missing-field-separator.rs +++ b/tests/ui/parser/struct-default-values-and-missing-field-separator.rs @@ -1,4 +1,3 @@ -//@ run-rustfix #![allow(dead_code)] enum E { @@ -6,21 +5,21 @@ enum E { } struct S { - field1: i32 = 42, //~ ERROR default values on `struct` fields aren't supported - field2: E = E::A, //~ ERROR default values on `struct` fields aren't supported - field3: i32 = 1 + 2, //~ ERROR default values on `struct` fields aren't supported - field4: i32 = { 1 + 2 }, //~ ERROR default values on `struct` fields aren't supported - field5: E = foo(42), //~ ERROR default values on `struct` fields aren't supported - field6: E = { foo(42) }, //~ ERROR default values on `struct` fields aren't supported + field1: i32 = 42, //~ ERROR default values on fields are experimental + field2: E = E::A, //~ ERROR default values on fields are experimental + field3: i32 = 1 + 2, //~ ERROR default values on fields are experimental + field4: i32 = { 1 + 2 }, //~ ERROR default values on fields are experimental + field5: E = foo(42), //~ ERROR default values on fields are experimental + field6: E = { foo(42) }, //~ ERROR default values on fields are experimental } struct S1 { field1: i32 //~ ERROR expected `,`, or `}`, found `field2` field2: E //~ ERROR expected `,`, or `}`, found `field3` - field3: i32 = 1 + 2, //~ ERROR default values on `struct` fields aren't supported - field4: i32 = { 1 + 2 }, //~ ERROR default values on `struct` fields aren't supported - field5: E = foo(42), //~ ERROR default values on `struct` fields aren't supported - field6: E = { foo(42) }, //~ ERROR default values on `struct` fields aren't supported + field3: i32 = 1 + 2, //~ ERROR default values on fields are experimental + field4: i32 = { 1 + 2 }, //~ ERROR default values on fields are experimental + field5: E = foo(42), //~ ERROR default values on fields are experimental + field6: E = { foo(42) }, //~ ERROR default values on fields are experimental } struct S2 { diff --git a/tests/ui/parser/struct-default-values-and-missing-field-separator.stderr b/tests/ui/parser/struct-default-values-and-missing-field-separator.stderr index 1fb57ab11f9..fdd9f0d6dce 100644 --- a/tests/ui/parser/struct-default-values-and-missing-field-separator.stderr +++ b/tests/ui/parser/struct-default-values-and-missing-field-separator.stderr @@ -1,152 +1,133 @@ -error: default values on `struct` fields aren't supported - --> $DIR/struct-default-values-and-missing-field-separator.rs:9:16 +error: expected `,`, or `}`, found `field2` + --> $DIR/struct-default-values-and-missing-field-separator.rs:17:16 | -LL | field1: i32 = 42, - | ^^^^^ +LL | field1: i32 + | ^ help: try adding a comma: `,` + +error: expected `,`, or `}`, found `field3` + --> $DIR/struct-default-values-and-missing-field-separator.rs:18:14 + | +LL | field2: E + | ^ help: try adding a comma: `,` + +error: expected `:`, found `=` + --> $DIR/struct-default-values-and-missing-field-separator.rs:26:12 + | +LL | field1 = i32, + | ^ + | | + | expected `:` + | help: field names and their types are separated with `:` + +error: expected `:`, found `;` + --> $DIR/struct-default-values-and-missing-field-separator.rs:27:11 | -help: remove this unsupported default value +LL | field2; E, + | ^ + | | + | expected `:` + | help: field names and their types are separated with `:` + +error[E0658]: default values on fields are experimental + --> $DIR/struct-default-values-and-missing-field-separator.rs:8:16 | -LL - field1: i32 = 42, -LL + field1: i32, +LL | field1: i32 = 42, + | ^^^^^ | + = note: see issue #132162 <https://github.com/rust-lang/rust/issues/132162> for more information + = help: add `#![feature(default_field_values)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error: default values on `struct` fields aren't supported - --> $DIR/struct-default-values-and-missing-field-separator.rs:10:14 +error[E0658]: default values on fields are experimental + --> $DIR/struct-default-values-and-missing-field-separator.rs:9:14 | LL | field2: E = E::A, | ^^^^^^^ | -help: remove this unsupported default value - | -LL - field2: E = E::A, -LL + field2: E, - | + = note: see issue #132162 <https://github.com/rust-lang/rust/issues/132162> for more information + = help: add `#![feature(default_field_values)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error: default values on `struct` fields aren't supported - --> $DIR/struct-default-values-and-missing-field-separator.rs:11:16 +error[E0658]: default values on fields are experimental + --> $DIR/struct-default-values-and-missing-field-separator.rs:10:16 | LL | field3: i32 = 1 + 2, | ^^^^^^^^ | -help: remove this unsupported default value - | -LL - field3: i32 = 1 + 2, -LL + field3: i32, - | + = note: see issue #132162 <https://github.com/rust-lang/rust/issues/132162> for more information + = help: add `#![feature(default_field_values)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error: default values on `struct` fields aren't supported - --> $DIR/struct-default-values-and-missing-field-separator.rs:12:16 +error[E0658]: default values on fields are experimental + --> $DIR/struct-default-values-and-missing-field-separator.rs:11:16 | LL | field4: i32 = { 1 + 2 }, | ^^^^^^^^^^^^ | -help: remove this unsupported default value - | -LL - field4: i32 = { 1 + 2 }, -LL + field4: i32, - | + = note: see issue #132162 <https://github.com/rust-lang/rust/issues/132162> for more information + = help: add `#![feature(default_field_values)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error: default values on `struct` fields aren't supported - --> $DIR/struct-default-values-and-missing-field-separator.rs:13:14 +error[E0658]: default values on fields are experimental + --> $DIR/struct-default-values-and-missing-field-separator.rs:12:14 | LL | field5: E = foo(42), | ^^^^^^^^^^ | -help: remove this unsupported default value - | -LL - field5: E = foo(42), -LL + field5: E, - | + = note: see issue #132162 <https://github.com/rust-lang/rust/issues/132162> for more information + = help: add `#![feature(default_field_values)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error: default values on `struct` fields aren't supported - --> $DIR/struct-default-values-and-missing-field-separator.rs:14:14 +error[E0658]: default values on fields are experimental + --> $DIR/struct-default-values-and-missing-field-separator.rs:13:14 | LL | field6: E = { foo(42) }, | ^^^^^^^^^^^^^^ | -help: remove this unsupported default value - | -LL - field6: E = { foo(42) }, -LL + field6: E, - | - -error: expected `,`, or `}`, found `field2` - --> $DIR/struct-default-values-and-missing-field-separator.rs:18:16 - | -LL | field1: i32 - | ^ help: try adding a comma: `,` - -error: expected `,`, or `}`, found `field3` - --> $DIR/struct-default-values-and-missing-field-separator.rs:19:14 - | -LL | field2: E - | ^ help: try adding a comma: `,` + = note: see issue #132162 <https://github.com/rust-lang/rust/issues/132162> for more information + = help: add `#![feature(default_field_values)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error: default values on `struct` fields aren't supported - --> $DIR/struct-default-values-and-missing-field-separator.rs:20:16 +error[E0658]: default values on fields are experimental + --> $DIR/struct-default-values-and-missing-field-separator.rs:19:16 | LL | field3: i32 = 1 + 2, | ^^^^^^^^ | -help: remove this unsupported default value - | -LL - field3: i32 = 1 + 2, -LL + field3: i32, - | + = note: see issue #132162 <https://github.com/rust-lang/rust/issues/132162> for more information + = help: add `#![feature(default_field_values)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error: default values on `struct` fields aren't supported - --> $DIR/struct-default-values-and-missing-field-separator.rs:21:16 +error[E0658]: default values on fields are experimental + --> $DIR/struct-default-values-and-missing-field-separator.rs:20:16 | LL | field4: i32 = { 1 + 2 }, | ^^^^^^^^^^^^ | -help: remove this unsupported default value - | -LL - field4: i32 = { 1 + 2 }, -LL + field4: i32, - | + = note: see issue #132162 <https://github.com/rust-lang/rust/issues/132162> for more information + = help: add `#![feature(default_field_values)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error: default values on `struct` fields aren't supported - --> $DIR/struct-default-values-and-missing-field-separator.rs:22:14 +error[E0658]: default values on fields are experimental + --> $DIR/struct-default-values-and-missing-field-separator.rs:21:14 | LL | field5: E = foo(42), | ^^^^^^^^^^ | -help: remove this unsupported default value - | -LL - field5: E = foo(42), -LL + field5: E, - | + = note: see issue #132162 <https://github.com/rust-lang/rust/issues/132162> for more information + = help: add `#![feature(default_field_values)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error: default values on `struct` fields aren't supported - --> $DIR/struct-default-values-and-missing-field-separator.rs:23:14 +error[E0658]: default values on fields are experimental + --> $DIR/struct-default-values-and-missing-field-separator.rs:22:14 | LL | field6: E = { foo(42) }, | ^^^^^^^^^^^^^^ | -help: remove this unsupported default value - | -LL - field6: E = { foo(42) }, -LL + field6: E, - | - -error: expected `:`, found `=` - --> $DIR/struct-default-values-and-missing-field-separator.rs:27:12 - | -LL | field1 = i32, - | ^ - | | - | expected `:` - | help: field names and their types are separated with `:` - -error: expected `:`, found `;` - --> $DIR/struct-default-values-and-missing-field-separator.rs:28:11 - | -LL | field2; E, - | ^ - | | - | expected `:` - | help: field names and their types are separated with `:` + = note: see issue #132162 <https://github.com/rust-lang/rust/issues/132162> for more information + = help: add `#![feature(default_field_values)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error: aborting due to 14 previous errors +For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/range/issue-54505-no-std.rs b/tests/ui/range/issue-54505-no-std.rs index a1595685372..0c913f766b7 100644 --- a/tests/ui/range/issue-54505-no-std.rs +++ b/tests/ui/range/issue-54505-no-std.rs @@ -38,6 +38,7 @@ fn main() { take_range(..); //~^ ERROR mismatched types [E0308] + //~| HELP you might have meant //~| HELP consider borrowing here //~| SUGGESTION &( diff --git a/tests/ui/range/issue-54505-no-std.stderr b/tests/ui/range/issue-54505-no-std.stderr index f15a0ae6138..2aa1d584046 100644 --- a/tests/ui/range/issue-54505-no-std.stderr +++ b/tests/ui/range/issue-54505-no-std.stderr @@ -53,13 +53,18 @@ note: function defined here | LL | fn take_range(_r: &impl RangeBounds<i8>) {} | ^^^^^^^^^^ ------------------------- +help: you might have meant to use `..` to skip providing a value for expected fields, but this is only supported on non-tuple struct literals when `#![feature(default_field_values)]` is enabled; it is instead interpreted as a `std::ops::RangeFull` literal + --> $DIR/issue-54505-no-std.rs:39:16 + | +LL | take_range(..); + | ^^ help: consider borrowing here | LL | take_range(&(..)); | ++ + error[E0308]: mismatched types - --> $DIR/issue-54505-no-std.rs:44:16 + --> $DIR/issue-54505-no-std.rs:45:16 | LL | take_range(0..=1); | ---------- ^^^^^ expected `&_`, found `RangeInclusive<{integer}>` @@ -79,7 +84,7 @@ LL | take_range(&(0..=1)); | ++ + error[E0308]: mismatched types - --> $DIR/issue-54505-no-std.rs:49:16 + --> $DIR/issue-54505-no-std.rs:50:16 | LL | take_range(..5); | ---------- ^^^ expected `&_`, found `RangeTo<{integer}>` @@ -99,7 +104,7 @@ LL | take_range(&(..5)); | ++ + error[E0308]: mismatched types - --> $DIR/issue-54505-no-std.rs:54:16 + --> $DIR/issue-54505-no-std.rs:55:16 | LL | take_range(..=42); | ---------- ^^^^^ expected `&_`, found `RangeToInclusive<{integer}>` diff --git a/tests/ui/range/issue-54505.fixed b/tests/ui/range/issue-54505.fixed index 054d3c2cf5e..08a2682140a 100644 --- a/tests/ui/range/issue-54505.fixed +++ b/tests/ui/range/issue-54505.fixed @@ -23,6 +23,7 @@ fn main() { take_range(&(..)); //~^ ERROR mismatched types [E0308] + //~| HELP you might have meant //~| HELP consider borrowing here //~| SUGGESTION &( diff --git a/tests/ui/range/issue-54505.rs b/tests/ui/range/issue-54505.rs index f5cec831760..0a9d7083e4f 100644 --- a/tests/ui/range/issue-54505.rs +++ b/tests/ui/range/issue-54505.rs @@ -23,6 +23,7 @@ fn main() { take_range(..); //~^ ERROR mismatched types [E0308] + //~| HELP you might have meant //~| HELP consider borrowing here //~| SUGGESTION &( diff --git a/tests/ui/range/issue-54505.stderr b/tests/ui/range/issue-54505.stderr index 0e959fc05e2..291e097e865 100644 --- a/tests/ui/range/issue-54505.stderr +++ b/tests/ui/range/issue-54505.stderr @@ -53,13 +53,18 @@ note: function defined here | LL | fn take_range(_r: &impl RangeBounds<i8>) {} | ^^^^^^^^^^ ------------------------- +help: you might have meant to use `..` to skip providing a value for expected fields, but this is only supported on non-tuple struct literals when `#![feature(default_field_values)]` is enabled; it is instead interpreted as a `std::ops::RangeFull` literal + --> $DIR/issue-54505.rs:24:16 + | +LL | take_range(..); + | ^^ help: consider borrowing here | LL | take_range(&(..)); | ++ + error[E0308]: mismatched types - --> $DIR/issue-54505.rs:29:16 + --> $DIR/issue-54505.rs:30:16 | LL | take_range(0..=1); | ---------- ^^^^^ expected `&_`, found `RangeInclusive<{integer}>` @@ -79,7 +84,7 @@ LL | take_range(&(0..=1)); | ++ + error[E0308]: mismatched types - --> $DIR/issue-54505.rs:34:16 + --> $DIR/issue-54505.rs:35:16 | LL | take_range(..5); | ---------- ^^^ expected `&_`, found `RangeTo<{integer}>` @@ -99,7 +104,7 @@ LL | take_range(&(..5)); | ++ + error[E0308]: mismatched types - --> $DIR/issue-54505.rs:39:16 + --> $DIR/issue-54505.rs:40:16 | LL | take_range(..=42); | ---------- ^^^^^ expected `&_`, found `RangeToInclusive<{integer}>` diff --git a/tests/ui/resolve/generic-params-from-outer-item-in-const-item.default.stderr b/tests/ui/resolve/generic-params-from-outer-item-in-const-item.default.stderr index c7e9df10d41..fbb9ede8aa1 100644 --- a/tests/ui/resolve/generic-params-from-outer-item-in-const-item.default.stderr +++ b/tests/ui/resolve/generic-params-from-outer-item-in-const-item.default.stderr @@ -29,20 +29,6 @@ LL | const _: u32 = T::C; | = note: a `const` is a separate item from the item that contains it -note: erroneous constant encountered - --> $DIR/generic-params-from-outer-item-in-const-item.rs:22:9 - | -LL | I - | ^ - -note: erroneous constant encountered - --> $DIR/generic-params-from-outer-item-in-const-item.rs:22:9 - | -LL | I - | ^ - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0401`. diff --git a/tests/ui/resolve/generic-params-from-outer-item-in-const-item.generic_const_items.stderr b/tests/ui/resolve/generic-params-from-outer-item-in-const-item.generic_const_items.stderr index 64c436d3ceb..60aa94038c3 100644 --- a/tests/ui/resolve/generic-params-from-outer-item-in-const-item.generic_const_items.stderr +++ b/tests/ui/resolve/generic-params-from-outer-item-in-const-item.generic_const_items.stderr @@ -35,20 +35,6 @@ LL | const _: u32 = T::C; | = note: a `const` is a separate item from the item that contains it -note: erroneous constant encountered - --> $DIR/generic-params-from-outer-item-in-const-item.rs:22:9 - | -LL | I - | ^ - -note: erroneous constant encountered - --> $DIR/generic-params-from-outer-item-in-const-item.rs:22:9 - | -LL | I - | ^ - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0401`. diff --git a/tests/ui/resolve/issue-50599.stderr b/tests/ui/resolve/issue-50599.stderr index 427dc9f2049..24fb3d580b8 100644 --- a/tests/ui/resolve/issue-50599.stderr +++ b/tests/ui/resolve/issue-50599.stderr @@ -20,12 +20,6 @@ LL - const M: usize = (f64::from(N) * std::f64::LOG10_2) as usize; LL + const M: usize = (f64::from(N) * LOG10_2) as usize; | -note: erroneous constant encountered - --> $DIR/issue-50599.rs:4:29 - | -LL | let mut digits = [0u32; M]; - | ^ - error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0425`. diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/avoid-invalid-mir.stderr b/tests/ui/rfcs/rfc-2497-if-let-chains/avoid-invalid-mir.stderr index eab2604d4c0..606f808f093 100644 --- a/tests/ui/rfcs/rfc-2497-if-let-chains/avoid-invalid-mir.stderr +++ b/tests/ui/rfcs/rfc-2497-if-let-chains/avoid-invalid-mir.stderr @@ -6,11 +6,5 @@ LL | !let y = 42; | = note: only supported directly in conditions of `if` and `while` expressions -note: erroneous constant encountered - --> $DIR/avoid-invalid-mir.rs:11:13 - | -LL | x: [(); N] - | ^ - error: aborting due to 1 previous error diff --git a/tests/ui/rfcs/rfc-2627-raw-dylib/invalid-dlltool.rs b/tests/ui/rfcs/rfc-2627-raw-dylib/invalid-dlltool.rs index bcf6dda7a44..057242246f0 100644 --- a/tests/ui/rfcs/rfc-2627-raw-dylib/invalid-dlltool.rs +++ b/tests/ui/rfcs/rfc-2627-raw-dylib/invalid-dlltool.rs @@ -1,7 +1,7 @@ // Tests that failing to run dlltool will raise an error. //@ needs-dlltool -//@ compile-flags: --crate-type lib --emit link -Cdlltool=does_not_exit.exe +//@ compile-flags: --crate-type lib --emit link -Cdlltool=does_not_exist.exe #[link(name = "foo", kind = "raw-dylib")] extern "C" { fn f(x: i32); diff --git a/tests/ui/rfcs/rfc-2627-raw-dylib/invalid-dlltool.stderr b/tests/ui/rfcs/rfc-2627-raw-dylib/invalid-dlltool.stderr index 9dbeee49f53..4bbad9b30a7 100644 --- a/tests/ui/rfcs/rfc-2627-raw-dylib/invalid-dlltool.stderr +++ b/tests/ui/rfcs/rfc-2627-raw-dylib/invalid-dlltool.stderr @@ -1,4 +1,4 @@ -error: Error calling dlltool 'does_not_exit.exe': program not found +error: Error calling dlltool 'does_not_exist.exe': program not found error: aborting due to 1 previous error diff --git a/tests/ui/runtime/on-broken-pipe/auxiliary/assert-sigpipe-disposition.rs b/tests/ui/runtime/on-broken-pipe/auxiliary/assert-sigpipe-disposition.rs index 117f6134b4e..229408fb724 100644 --- a/tests/ui/runtime/on-broken-pipe/auxiliary/assert-sigpipe-disposition.rs +++ b/tests/ui/runtime/on-broken-pipe/auxiliary/assert-sigpipe-disposition.rs @@ -25,7 +25,14 @@ fn start(argc: isize, argv: *const *const u8) -> isize { let actual = unsafe { let mut actual: libc::sigaction = std::mem::zeroed(); libc::sigaction(libc::SIGPIPE, std::ptr::null(), &mut actual); - actual.sa_sigaction + #[cfg(not(target_os = "aix"))] + { + actual.sa_sigaction + } + #[cfg(target_os = "aix")] + { + actual.sa_union.__su_sigaction as libc::sighandler_t + } }; assert_eq!(actual, expected, "actual and expected SIGPIPE disposition in child differs"); diff --git a/tests/ui/runtime/on-broken-pipe/auxiliary/sigpipe-utils.rs b/tests/ui/runtime/on-broken-pipe/auxiliary/sigpipe-utils.rs index 3d93d50ca3f..d16a2b4d8c8 100644 --- a/tests/ui/runtime/on-broken-pipe/auxiliary/sigpipe-utils.rs +++ b/tests/ui/runtime/on-broken-pipe/auxiliary/sigpipe-utils.rs @@ -20,7 +20,14 @@ pub fn assert_sigpipe_handler(expected_handler: SignalHandler) { let actual = unsafe { let mut actual: libc::sigaction = std::mem::zeroed(); libc::sigaction(libc::SIGPIPE, std::ptr::null(), &mut actual); - actual.sa_sigaction + #[cfg(not(target_os = "aix"))] + { + actual.sa_sigaction + } + #[cfg(target_os = "aix")] + { + actual.sa_union.__su_sigaction as libc::sighandler_t + } }; let expected = match expected_handler { diff --git a/tests/ui/runtime/signal-alternate-stack-cleanup.rs b/tests/ui/runtime/signal-alternate-stack-cleanup.rs index f2af86be0a5..8fce0928273 100644 --- a/tests/ui/runtime/signal-alternate-stack-cleanup.rs +++ b/tests/ui/runtime/signal-alternate-stack-cleanup.rs @@ -29,7 +29,14 @@ fn main() { // Install signal handler that runs on alternate signal stack. let mut action: sigaction = std::mem::zeroed(); action.sa_flags = (SA_ONSTACK | SA_SIGINFO) as _; - action.sa_sigaction = signal_handler as sighandler_t; + #[cfg(not(target_os = "aix"))] + { + action.sa_sigaction = signal_handler as sighandler_t; + } + #[cfg(target_os = "aix")] + { + action.sa_union.__su_sigaction = signal_handler as sighandler_t; + } sigaction(SIGWINCH, &action, std::ptr::null_mut()); // Send SIGWINCH on exit. diff --git a/tests/ui/self/arbitrary-self-from-method-substs-ice.stderr b/tests/ui/self/arbitrary-self-from-method-substs-ice.stderr index e4991823d28..cf4c219215e 100644 --- a/tests/ui/self/arbitrary-self-from-method-substs-ice.stderr +++ b/tests/ui/self/arbitrary-self-from-method-substs-ice.stderr @@ -17,12 +17,6 @@ LL | const fn get<R: Deref<Target = Self>>(self: R) -> u32 { LL | } | - value is dropped here -note: erroneous constant encountered - --> $DIR/arbitrary-self-from-method-substs-ice.rs:24:5 - | -LL | FOO; - | ^^^ - error[E0801]: invalid generic `self` parameter type: `R` --> $DIR/arbitrary-self-from-method-substs-ice.rs:10:49 | diff --git a/tests/ui/specialization/const_trait_impl.stderr b/tests/ui/specialization/const_trait_impl.stderr index 607fc06823e..3e1260ff09c 100644 --- a/tests/ui/specialization/const_trait_impl.stderr +++ b/tests/ui/specialization/const_trait_impl.stderr @@ -2,42 +2,57 @@ error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/const_trait_impl.rs:34:9 | LL | impl<T: ~const Default> const A for T { - | ^^^^^^ + | ^^^^^^ can't be applied to `Default` + | +note: `Default` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/default.rs:LL:COL error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/const_trait_impl.rs:40:9 | LL | impl<T: ~const Default + ~const Sup> const A for T { - | ^^^^^^ + | ^^^^^^ can't be applied to `Default` + | +note: `Default` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/default.rs:LL:COL error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/const_trait_impl.rs:46:9 | LL | impl<T: ~const Default + ~const Sub> const A for T { - | ^^^^^^ + | ^^^^^^ can't be applied to `Default` + | +note: `Default` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/default.rs:LL:COL error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/const_trait_impl.rs:40:9 | LL | impl<T: ~const Default + ~const Sup> const A for T { - | ^^^^^^ + | ^^^^^^ can't be applied to `Default` | +note: `Default` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/default.rs:LL:COL = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/const_trait_impl.rs:34:9 | LL | impl<T: ~const Default> const A for T { - | ^^^^^^ + | ^^^^^^ can't be applied to `Default` | +note: `Default` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/default.rs:LL:COL = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/const_trait_impl.rs:46:9 | LL | impl<T: ~const Default + ~const Sub> const A for T { - | ^^^^^^ + | ^^^^^^ can't be applied to `Default` | +note: `Default` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/default.rs:LL:COL = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: aborting due to 6 previous errors diff --git a/tests/ui/stats/input-stats.stderr b/tests/ui/stats/input-stats.stderr index 2adbcfab612..e3bc68a2134 100644 --- a/tests/ui/stats/input-stats.stderr +++ b/tests/ui/stats/input-stats.stderr @@ -20,8 +20,8 @@ ast-stats-1 Stmt 160 ( 2.4%) 5 32 ast-stats-1 - Let 32 ( 0.5%) 1 ast-stats-1 - MacCall 32 ( 0.5%) 1 ast-stats-1 - Expr 96 ( 1.4%) 3 -ast-stats-1 FieldDef 176 ( 2.6%) 2 88 ast-stats-1 Block 192 ( 2.9%) 6 32 +ast-stats-1 FieldDef 208 ( 3.1%) 2 104 ast-stats-1 Variant 208 ( 3.1%) 2 104 ast-stats-1 AssocItem 352 ( 5.3%) 4 88 ast-stats-1 - Type 176 ( 2.6%) 2 @@ -29,7 +29,7 @@ ast-stats-1 - Fn 176 ( 2.6%) 2 ast-stats-1 GenericBound 352 ( 5.3%) 4 88 ast-stats-1 - Trait 352 ( 5.3%) 4 ast-stats-1 GenericParam 480 ( 7.2%) 5 96 -ast-stats-1 Pat 504 ( 7.6%) 7 72 +ast-stats-1 Pat 504 ( 7.5%) 7 72 ast-stats-1 - Struct 72 ( 1.1%) 1 ast-stats-1 - Wild 72 ( 1.1%) 1 ast-stats-1 - Ident 360 ( 5.4%) 5 @@ -39,13 +39,13 @@ ast-stats-1 - Match 72 ( 1.1%) 1 ast-stats-1 - Struct 72 ( 1.1%) 1 ast-stats-1 - Lit 144 ( 2.2%) 2 ast-stats-1 - Block 216 ( 3.2%) 3 -ast-stats-1 PathSegment 744 (11.2%) 31 24 +ast-stats-1 PathSegment 744 (11.1%) 31 24 ast-stats-1 Ty 896 (13.4%) 14 64 ast-stats-1 - Ref 64 ( 1.0%) 1 ast-stats-1 - Ptr 64 ( 1.0%) 1 ast-stats-1 - ImplicitSelf 128 ( 1.9%) 2 ast-stats-1 - Path 640 ( 9.6%) 10 -ast-stats-1 Item 1_224 (18.4%) 9 136 +ast-stats-1 Item 1_224 (18.3%) 9 136 ast-stats-1 - ForeignMod 136 ( 2.0%) 1 ast-stats-1 - Trait 136 ( 2.0%) 1 ast-stats-1 - Impl 136 ( 2.0%) 1 @@ -53,7 +53,7 @@ ast-stats-1 - Enum 136 ( 2.0%) 1 ast-stats-1 - Fn 272 ( 4.1%) 2 ast-stats-1 - Use 408 ( 6.1%) 3 ast-stats-1 ---------------------------------------------------------------- -ast-stats-1 Total 6_664 116 +ast-stats-1 Total 6_696 116 ast-stats-1 ast-stats-2 POST EXPANSION AST STATS ast-stats-2 Name Accumulated Size Count Item Size @@ -70,7 +70,7 @@ ast-stats-2 - Fn 88 ( 1.2%) 1 ast-stats-2 Arm 96 ( 1.3%) 2 48 ast-stats-2 FnDecl 120 ( 1.6%) 5 24 ast-stats-2 InlineAsm 120 ( 1.6%) 1 120 -ast-stats-2 Attribute 128 ( 1.8%) 4 32 +ast-stats-2 Attribute 128 ( 1.7%) 4 32 ast-stats-2 - DocComment 32 ( 0.4%) 1 ast-stats-2 - Normal 96 ( 1.3%) 3 ast-stats-2 Param 160 ( 2.2%) 4 40 @@ -78,33 +78,33 @@ ast-stats-2 Stmt 160 ( 2.2%) 5 32 ast-stats-2 - Let 32 ( 0.4%) 1 ast-stats-2 - Semi 32 ( 0.4%) 1 ast-stats-2 - Expr 96 ( 1.3%) 3 -ast-stats-2 FieldDef 176 ( 2.4%) 2 88 ast-stats-2 Block 192 ( 2.6%) 6 32 +ast-stats-2 FieldDef 208 ( 2.8%) 2 104 ast-stats-2 Variant 208 ( 2.8%) 2 104 ast-stats-2 AssocItem 352 ( 4.8%) 4 88 ast-stats-2 - Type 176 ( 2.4%) 2 ast-stats-2 - Fn 176 ( 2.4%) 2 ast-stats-2 GenericBound 352 ( 4.8%) 4 88 ast-stats-2 - Trait 352 ( 4.8%) 4 -ast-stats-2 GenericParam 480 ( 6.6%) 5 96 +ast-stats-2 GenericParam 480 ( 6.5%) 5 96 ast-stats-2 Pat 504 ( 6.9%) 7 72 ast-stats-2 - Struct 72 ( 1.0%) 1 ast-stats-2 - Wild 72 ( 1.0%) 1 ast-stats-2 - Ident 360 ( 4.9%) 5 -ast-stats-2 Expr 648 ( 8.9%) 9 72 +ast-stats-2 Expr 648 ( 8.8%) 9 72 ast-stats-2 - Path 72 ( 1.0%) 1 ast-stats-2 - Match 72 ( 1.0%) 1 ast-stats-2 - Struct 72 ( 1.0%) 1 ast-stats-2 - InlineAsm 72 ( 1.0%) 1 ast-stats-2 - Lit 144 ( 2.0%) 2 -ast-stats-2 - Block 216 ( 3.0%) 3 +ast-stats-2 - Block 216 ( 2.9%) 3 ast-stats-2 PathSegment 864 (11.8%) 36 24 -ast-stats-2 Ty 896 (12.3%) 14 64 +ast-stats-2 Ty 896 (12.2%) 14 64 ast-stats-2 - Ref 64 ( 0.9%) 1 ast-stats-2 - Ptr 64 ( 0.9%) 1 -ast-stats-2 - ImplicitSelf 128 ( 1.8%) 2 -ast-stats-2 - Path 640 ( 8.8%) 10 -ast-stats-2 Item 1_496 (20.5%) 11 136 +ast-stats-2 - ImplicitSelf 128 ( 1.7%) 2 +ast-stats-2 - Path 640 ( 8.7%) 10 +ast-stats-2 Item 1_496 (20.4%) 11 136 ast-stats-2 - Enum 136 ( 1.9%) 1 ast-stats-2 - Trait 136 ( 1.9%) 1 ast-stats-2 - Impl 136 ( 1.9%) 1 @@ -113,7 +113,7 @@ ast-stats-2 - ForeignMod 136 ( 1.9%) 1 ast-stats-2 - Fn 272 ( 3.7%) 2 ast-stats-2 - Use 544 ( 7.4%) 4 ast-stats-2 ---------------------------------------------------------------- -ast-stats-2 Total 7_312 127 +ast-stats-2 Total 7_344 127 ast-stats-2 hir-stats HIR STATS hir-stats Name Accumulated Size Count Item Size @@ -138,9 +138,9 @@ hir-stats Stmt 96 ( 1.1%) 3 32 hir-stats - Let 32 ( 0.4%) 1 hir-stats - Semi 32 ( 0.4%) 1 hir-stats - Expr 32 ( 0.4%) 1 -hir-stats FieldDef 112 ( 1.3%) 2 56 hir-stats FnDecl 120 ( 1.3%) 3 40 hir-stats Attribute 128 ( 1.4%) 4 32 +hir-stats FieldDef 128 ( 1.4%) 2 64 hir-stats GenericArgs 144 ( 1.6%) 3 48 hir-stats Variant 144 ( 1.6%) 2 72 hir-stats GenericBound 256 ( 2.9%) 4 64 @@ -163,7 +163,7 @@ hir-stats - Struct 64 ( 0.7%) 1 hir-stats - InlineAsm 64 ( 0.7%) 1 hir-stats - Lit 128 ( 1.4%) 2 hir-stats - Block 384 ( 4.3%) 6 -hir-stats Item 968 (10.9%) 11 88 +hir-stats Item 968 (10.8%) 11 88 hir-stats - Enum 88 ( 1.0%) 1 hir-stats - Trait 88 ( 1.0%) 1 hir-stats - Impl 88 ( 1.0%) 1 @@ -174,5 +174,5 @@ hir-stats - Use 352 ( 3.9%) 4 hir-stats Path 1_240 (13.9%) 31 40 hir-stats PathSegment 1_920 (21.5%) 40 48 hir-stats ---------------------------------------------------------------- -hir-stats Total 8_920 180 +hir-stats Total 8_936 180 hir-stats diff --git a/tests/ui/structs/auxiliary/struct_field_default.rs b/tests/ui/structs/auxiliary/struct_field_default.rs new file mode 100644 index 00000000000..b315df5dba2 --- /dev/null +++ b/tests/ui/structs/auxiliary/struct_field_default.rs @@ -0,0 +1,5 @@ +#![feature(default_field_values)] + +pub struct A { + pub a: isize = 42, +} diff --git a/tests/ui/structs/default-field-values-failures.rs b/tests/ui/structs/default-field-values-failures.rs new file mode 100644 index 00000000000..0ac071d91d6 --- /dev/null +++ b/tests/ui/structs/default-field-values-failures.rs @@ -0,0 +1,64 @@ +#![feature(default_field_values)] + +#[derive(Debug)] +pub struct S; + +#[derive(Debug, Default)] +pub struct Foo { + pub bar: S = S, + pub baz: i32 = 42 + 3, +} + +#[derive(Debug, Default)] +pub struct Bar { + pub bar: S, //~ ERROR the trait bound `S: Default` is not satisfied + pub baz: i32 = 42 + 3, +} + +#[derive(Default)] +pub struct Qux<const C: i32> { + bar: S = Self::S, //~ ERROR generic `Self` types are currently not permitted in anonymous constants + baz: i32 = foo(), + bat: i32 = <Qux<{ C }> as T>::K, //~ ERROR generic parameters may not be used in const operations + bay: i32 = C, +} + +pub struct Rak(i32 = 42); //~ ERROR default fields are not supported in tuple structs + +impl<const C: i32> Qux<C> { + const S: S = S; +} + +trait T { + const K: i32; +} + +impl<const C: i32> T for Qux<C> { + const K: i32 = 2; +} + +const fn foo() -> i32 { + 42 +} + +#[derive(Debug, Default)] +enum E { + #[default] + Variant {} //~ ERROR the `#[default]` attribute may only be used on unit enum variants +} + +fn main () { + let _ = Foo { .. }; // ok + let _ = Foo::default(); // ok + let _ = Bar { .. }; //~ ERROR mandatory field + let _ = Bar::default(); // silenced + let _ = Bar { bar: S, .. }; // ok + let _ = Qux::<4> { .. }; + let _ = Rak(..); //~ ERROR E0308 + //~^ you might have meant to use `..` to skip providing + let _ = Rak(0, ..); //~ ERROR E0061 + //~^ you might have meant to use `..` to skip providing + let _ = Rak(.., 0); //~ ERROR E0061 + //~^ you might have meant to use `..` to skip providing + let _ = Rak { .. }; // ok +} diff --git a/tests/ui/structs/default-field-values-failures.stderr b/tests/ui/structs/default-field-values-failures.stderr new file mode 100644 index 00000000000..5b9d2df5a5d --- /dev/null +++ b/tests/ui/structs/default-field-values-failures.stderr @@ -0,0 +1,118 @@ +error: the `#[default]` attribute may only be used on unit enum variants or variants where every field has a default value + --> $DIR/default-field-values-failures.rs:47:5 + | +LL | Variant {} + | ^^^^^^^ + | + = help: consider a manual implementation of `Default` + +error: generic parameters may not be used in const operations + --> $DIR/default-field-values-failures.rs:22:23 + | +LL | bat: i32 = <Qux<{ C }> as T>::K, + | ^ cannot perform const operation using `C` + | + = help: const parameters may only be used as standalone arguments, i.e. `C` + = help: add `#![feature(generic_const_exprs)]` to allow generic const expressions + +error: default fields are not supported in tuple structs + --> $DIR/default-field-values-failures.rs:26:22 + | +LL | pub struct Rak(i32 = 42); + | ^^ default fields are only supported on structs + +error: generic `Self` types are currently not permitted in anonymous constants + --> $DIR/default-field-values-failures.rs:20:14 + | +LL | bar: S = Self::S, + | ^^^^ + +error[E0277]: the trait bound `S: Default` is not satisfied + --> $DIR/default-field-values-failures.rs:14:5 + | +LL | #[derive(Debug, Default)] + | ------- in this derive macro expansion +LL | pub struct Bar { +LL | pub bar: S, + | ^^^^^^^^^^ the trait `Default` is not implemented for `S` + | + = note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider annotating `S` with `#[derive(Default)]` + | +LL + #[derive(Default)] +LL | pub struct S; + | + +error: missing mandatory field `bar` + --> $DIR/default-field-values-failures.rs:53:21 + | +LL | let _ = Bar { .. }; + | ^ + +error[E0308]: mismatched types + --> $DIR/default-field-values-failures.rs:57:17 + | +LL | let _ = Rak(..); + | --- ^^ expected `i32`, found `RangeFull` + | | + | arguments to this struct are incorrect + | +note: tuple struct defined here + --> $DIR/default-field-values-failures.rs:26:12 + | +LL | pub struct Rak(i32 = 42); + | ^^^ +help: you might have meant to use `..` to skip providing a value for expected fields, but this is only supported on non-tuple struct literals; it is instead interpreted as a `std::ops::RangeFull` literal + --> $DIR/default-field-values-failures.rs:57:17 + | +LL | let _ = Rak(..); + | ^^ + +error[E0061]: this struct takes 1 argument but 2 arguments were supplied + --> $DIR/default-field-values-failures.rs:59:13 + | +LL | let _ = Rak(0, ..); + | ^^^ -- unexpected argument #2 of type `RangeFull` + | +help: you might have meant to use `..` to skip providing a value for expected fields, but this is only supported on non-tuple struct literals; it is instead interpreted as a `std::ops::RangeFull` literal + --> $DIR/default-field-values-failures.rs:59:20 + | +LL | let _ = Rak(0, ..); + | ^^ +note: tuple struct defined here + --> $DIR/default-field-values-failures.rs:26:12 + | +LL | pub struct Rak(i32 = 42); + | ^^^ +help: remove the extra argument + | +LL - let _ = Rak(0, ..); +LL + let _ = Rak(0); + | + +error[E0061]: this struct takes 1 argument but 2 arguments were supplied + --> $DIR/default-field-values-failures.rs:61:13 + | +LL | let _ = Rak(.., 0); + | ^^^ -- unexpected argument #1 of type `RangeFull` + | +help: you might have meant to use `..` to skip providing a value for expected fields, but this is only supported on non-tuple struct literals; it is instead interpreted as a `std::ops::RangeFull` literal + --> $DIR/default-field-values-failures.rs:61:17 + | +LL | let _ = Rak(.., 0); + | ^^ +note: tuple struct defined here + --> $DIR/default-field-values-failures.rs:26:12 + | +LL | pub struct Rak(i32 = 42); + | ^^^ +help: remove the extra argument + | +LL - let _ = Rak(.., 0); +LL + let _ = Rak(0); + | + +error: aborting due to 9 previous errors + +Some errors have detailed explanations: E0061, E0277, E0308. +For more information about an error, try `rustc --explain E0061`. diff --git a/tests/ui/structs/default-field-values-invalid-const.rs b/tests/ui/structs/default-field-values-invalid-const.rs new file mode 100644 index 00000000000..203a712868b --- /dev/null +++ b/tests/ui/structs/default-field-values-invalid-const.rs @@ -0,0 +1,16 @@ +#![feature(default_field_values, generic_const_exprs)] +#![allow(incomplete_features)] + +pub struct Bat { + pub bax: u8 = panic!("asdf"), + //~^ ERROR evaluation of constant value failed +} + +pub struct Baz<const C: u8> { + pub bax: u8 = 130 + C, // ok + pub bat: u8 = 130 + 130, + //~^ ERROR evaluation of `Baz::<C>::bat::{constant#0}` failed + pub bay: u8 = 1, // ok +} + +fn main() {} diff --git a/tests/ui/structs/default-field-values-invalid-const.stderr b/tests/ui/structs/default-field-values-invalid-const.stderr new file mode 100644 index 00000000000..47f25a1f38e --- /dev/null +++ b/tests/ui/structs/default-field-values-invalid-const.stderr @@ -0,0 +1,17 @@ +error[E0080]: evaluation of constant value failed + --> $DIR/default-field-values-invalid-const.rs:5:19 + | +LL | pub bax: u8 = panic!("asdf"), + | ^^^^^^^^^^^^^^ the evaluated program panicked at 'asdf', $DIR/default-field-values-invalid-const.rs:5:19 + | + = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0080]: evaluation of `Baz::<C>::bat::{constant#0}` failed + --> $DIR/default-field-values-invalid-const.rs:11:19 + | +LL | pub bat: u8 = 130 + 130, + | ^^^^^^^^^ attempt to compute `130_u8 + 130_u8`, which would overflow + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0080`. diff --git a/tests/ui/structs/default-field-values-support.rs b/tests/ui/structs/default-field-values-support.rs new file mode 100644 index 00000000000..da0379af94b --- /dev/null +++ b/tests/ui/structs/default-field-values-support.rs @@ -0,0 +1,74 @@ +//@ run-pass +//@ aux-build:struct_field_default.rs +#![feature(default_field_values, generic_const_exprs)] +#![allow(unused_variables, dead_code, incomplete_features)] + +extern crate struct_field_default as xc; + +pub struct S; + +#[derive(Default)] +pub struct Foo { + pub bar: S = S, + pub baz: i32 = 42 + 3, +} + +#[derive(Default)] +pub enum Bar { + #[default] + Foo { + bar: S = S, + baz: i32 = 42 + 3, + } +} + +#[derive(Default)] +pub struct Qux<A, const C: i32> { + bar: S = Qux::<A, C>::S, + baz: i32 = foo(), + bat: i32 = <Qux<A, C> as T>::K, + baq: i32 = Self::K, + bay: i32 = C, + bak: Vec<A> = Vec::new(), +} + +impl<A, const C: i32> Qux<A, C> { + const S: S = S; +} + +trait T { + const K: i32; +} + +impl<A, const C: i32> T for Qux<A, C> { + const K: i32 = 2; +} + +const fn foo() -> i32 { + 42 +} + +fn main () { + let x = Foo { .. }; + let y = Foo::default(); + let z = Foo { baz: 1, .. }; + + assert_eq!(45, x.baz); + assert_eq!(45, y.baz); + assert_eq!(1, z.baz); + + let x = Bar::Foo { .. }; + let y = Bar::default(); + let z = Bar::Foo { baz: 1, .. }; + + assert!(matches!(Bar::Foo { bar: S, baz: 45 }, x)); + assert!(matches!(Bar::Foo { bar: S, baz: 45 }, y)); + assert!(matches!(Bar::Foo { bar: S, baz: 1 }, z)); + + let x = Qux::<i32, 4> { .. }; + assert!(matches!(Qux::<i32, 4> { bar: S, baz: 42, bat: 2, baq: 2, bay: 4, .. }, x)); + assert!(x.bak.is_empty()); + + let x = xc::A { .. }; + assert!(matches!(xc::A { a: 42 }, x)); +} diff --git a/tests/ui/thir-print/thir-tree-match.stdout b/tests/ui/thir-print/thir-tree-match.stdout index d56f15fb221..916f296ccfc 100644 --- a/tests/ui/thir-print/thir-tree-match.stdout +++ b/tests/ui/thir-print/thir-tree-match.stdout @@ -92,7 +92,7 @@ body: adt_def: AdtDef { did: DefId(0:10 ~ thir_tree_match[fcf8]::Foo) - variants: [VariantDef { def_id: DefId(0:11 ~ thir_tree_match[fcf8]::Foo::FooOne), ctor: Some((Fn, DefId(0:12 ~ thir_tree_match[fcf8]::Foo::FooOne::{constructor#0}))), name: "FooOne", discr: Relative(0), fields: [FieldDef { did: DefId(0:13 ~ thir_tree_match[fcf8]::Foo::FooOne::0), name: "0", vis: Restricted(DefId(0:0 ~ thir_tree_match[fcf8])), safety: Safe }], tainted: None, flags: }, VariantDef { def_id: DefId(0:14 ~ thir_tree_match[fcf8]::Foo::FooTwo), ctor: Some((Const, DefId(0:15 ~ thir_tree_match[fcf8]::Foo::FooTwo::{constructor#0}))), name: "FooTwo", discr: Relative(1), fields: [], tainted: None, flags: }] + variants: [VariantDef { def_id: DefId(0:11 ~ thir_tree_match[fcf8]::Foo::FooOne), ctor: Some((Fn, DefId(0:12 ~ thir_tree_match[fcf8]::Foo::FooOne::{constructor#0}))), name: "FooOne", discr: Relative(0), fields: [FieldDef { did: DefId(0:13 ~ thir_tree_match[fcf8]::Foo::FooOne::0), name: "0", vis: Restricted(DefId(0:0 ~ thir_tree_match[fcf8])), safety: Safe, value: None }], tainted: None, flags: }, VariantDef { def_id: DefId(0:14 ~ thir_tree_match[fcf8]::Foo::FooTwo), ctor: Some((Const, DefId(0:15 ~ thir_tree_match[fcf8]::Foo::FooTwo::{constructor#0}))), name: "FooTwo", discr: Relative(1), fields: [], tainted: None, flags: }] flags: IS_ENUM repr: ReprOptions { int: None, align: None, pack: None, flags: , field_shuffle_seed: 3477539199540094892 } args: [] @@ -154,7 +154,7 @@ body: adt_def: AdtDef { did: DefId(0:10 ~ thir_tree_match[fcf8]::Foo) - variants: [VariantDef { def_id: DefId(0:11 ~ thir_tree_match[fcf8]::Foo::FooOne), ctor: Some((Fn, DefId(0:12 ~ thir_tree_match[fcf8]::Foo::FooOne::{constructor#0}))), name: "FooOne", discr: Relative(0), fields: [FieldDef { did: DefId(0:13 ~ thir_tree_match[fcf8]::Foo::FooOne::0), name: "0", vis: Restricted(DefId(0:0 ~ thir_tree_match[fcf8])), safety: Safe }], tainted: None, flags: }, VariantDef { def_id: DefId(0:14 ~ thir_tree_match[fcf8]::Foo::FooTwo), ctor: Some((Const, DefId(0:15 ~ thir_tree_match[fcf8]::Foo::FooTwo::{constructor#0}))), name: "FooTwo", discr: Relative(1), fields: [], tainted: None, flags: }] + variants: [VariantDef { def_id: DefId(0:11 ~ thir_tree_match[fcf8]::Foo::FooOne), ctor: Some((Fn, DefId(0:12 ~ thir_tree_match[fcf8]::Foo::FooOne::{constructor#0}))), name: "FooOne", discr: Relative(0), fields: [FieldDef { did: DefId(0:13 ~ thir_tree_match[fcf8]::Foo::FooOne::0), name: "0", vis: Restricted(DefId(0:0 ~ thir_tree_match[fcf8])), safety: Safe, value: None }], tainted: None, flags: }, VariantDef { def_id: DefId(0:14 ~ thir_tree_match[fcf8]::Foo::FooTwo), ctor: Some((Const, DefId(0:15 ~ thir_tree_match[fcf8]::Foo::FooTwo::{constructor#0}))), name: "FooTwo", discr: Relative(1), fields: [], tainted: None, flags: }] flags: IS_ENUM repr: ReprOptions { int: None, align: None, pack: None, flags: , field_shuffle_seed: 3477539199540094892 } args: [] @@ -206,7 +206,7 @@ body: adt_def: AdtDef { did: DefId(0:10 ~ thir_tree_match[fcf8]::Foo) - variants: [VariantDef { def_id: DefId(0:11 ~ thir_tree_match[fcf8]::Foo::FooOne), ctor: Some((Fn, DefId(0:12 ~ thir_tree_match[fcf8]::Foo::FooOne::{constructor#0}))), name: "FooOne", discr: Relative(0), fields: [FieldDef { did: DefId(0:13 ~ thir_tree_match[fcf8]::Foo::FooOne::0), name: "0", vis: Restricted(DefId(0:0 ~ thir_tree_match[fcf8])), safety: Safe }], tainted: None, flags: }, VariantDef { def_id: DefId(0:14 ~ thir_tree_match[fcf8]::Foo::FooTwo), ctor: Some((Const, DefId(0:15 ~ thir_tree_match[fcf8]::Foo::FooTwo::{constructor#0}))), name: "FooTwo", discr: Relative(1), fields: [], tainted: None, flags: }] + variants: [VariantDef { def_id: DefId(0:11 ~ thir_tree_match[fcf8]::Foo::FooOne), ctor: Some((Fn, DefId(0:12 ~ thir_tree_match[fcf8]::Foo::FooOne::{constructor#0}))), name: "FooOne", discr: Relative(0), fields: [FieldDef { did: DefId(0:13 ~ thir_tree_match[fcf8]::Foo::FooOne::0), name: "0", vis: Restricted(DefId(0:0 ~ thir_tree_match[fcf8])), safety: Safe, value: None }], tainted: None, flags: }, VariantDef { def_id: DefId(0:14 ~ thir_tree_match[fcf8]::Foo::FooTwo), ctor: Some((Const, DefId(0:15 ~ thir_tree_match[fcf8]::Foo::FooTwo::{constructor#0}))), name: "FooTwo", discr: Relative(1), fields: [], tainted: None, flags: }] flags: IS_ENUM repr: ReprOptions { int: None, align: None, pack: None, flags: , field_shuffle_seed: 3477539199540094892 } args: [] diff --git a/tests/ui/traits/const-traits/call-const-trait-method-pass.stderr b/tests/ui/traits/const-traits/call-const-trait-method-pass.stderr index 1e48a0331cc..ef494bde98c 100644 --- a/tests/ui/traits/const-traits/call-const-trait-method-pass.stderr +++ b/tests/ui/traits/const-traits/call-const-trait-method-pass.stderr @@ -2,7 +2,7 @@ error: const `impl` for trait `PartialEq` which is not marked with `#[const_trai --> $DIR/call-const-trait-method-pass.rs:15:12 | LL | impl const PartialEq for Int { - | ^^^^^^^^^ + | ^^^^^^^^^ this trait is not `const` | = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: adding a non-const method body in the future would be a breaking change diff --git a/tests/ui/traits/const-traits/call-generic-in-impl.stderr b/tests/ui/traits/const-traits/call-generic-in-impl.stderr index 52ee04425b2..58d0997f5a3 100644 --- a/tests/ui/traits/const-traits/call-generic-in-impl.stderr +++ b/tests/ui/traits/const-traits/call-generic-in-impl.stderr @@ -2,14 +2,19 @@ error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/call-generic-in-impl.rs:10:9 | LL | impl<T: ~const PartialEq> const MyPartialEq for T { - | ^^^^^^ + | ^^^^^^ can't be applied to `PartialEq` + | +note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/cmp.rs:LL:COL error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/call-generic-in-impl.rs:10:9 | LL | impl<T: ~const PartialEq> const MyPartialEq for T { - | ^^^^^^ + | ^^^^^^ can't be applied to `PartialEq` | +note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/cmp.rs:LL:COL = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0015]: cannot call non-const fn `<T as PartialEq>::eq` in constant functions diff --git a/tests/ui/traits/const-traits/call-generic-method-chain.stderr b/tests/ui/traits/const-traits/call-generic-method-chain.stderr index 21fb19daad4..d7a2a186494 100644 --- a/tests/ui/traits/const-traits/call-generic-method-chain.stderr +++ b/tests/ui/traits/const-traits/call-generic-method-chain.stderr @@ -2,7 +2,7 @@ error: const `impl` for trait `PartialEq` which is not marked with `#[const_trai --> $DIR/call-generic-method-chain.rs:11:12 | LL | impl const PartialEq for S { - | ^^^^^^^^^ + | ^^^^^^^^^ this trait is not `const` | = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: adding a non-const method body in the future would be a breaking change @@ -11,28 +11,38 @@ error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/call-generic-method-chain.rs:20:25 | LL | const fn equals_self<T: ~const PartialEq>(t: &T) -> bool { - | ^^^^^^ + | ^^^^^^ can't be applied to `PartialEq` + | +note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/cmp.rs:LL:COL error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/call-generic-method-chain.rs:20:25 | LL | const fn equals_self<T: ~const PartialEq>(t: &T) -> bool { - | ^^^^^^ + | ^^^^^^ can't be applied to `PartialEq` | +note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/cmp.rs:LL:COL = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/call-generic-method-chain.rs:24:33 | LL | const fn equals_self_wrapper<T: ~const PartialEq>(t: &T) -> bool { - | ^^^^^^ + | ^^^^^^ can't be applied to `PartialEq` + | +note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/cmp.rs:LL:COL error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/call-generic-method-chain.rs:24:33 | LL | const fn equals_self_wrapper<T: ~const PartialEq>(t: &T) -> bool { - | ^^^^^^ + | ^^^^^^ can't be applied to `PartialEq` | +note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/cmp.rs:LL:COL = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0015]: cannot call non-const operator in constant functions diff --git a/tests/ui/traits/const-traits/call-generic-method-dup-bound.stderr b/tests/ui/traits/const-traits/call-generic-method-dup-bound.stderr index 845949a38bf..90465d0a5b2 100644 --- a/tests/ui/traits/const-traits/call-generic-method-dup-bound.stderr +++ b/tests/ui/traits/const-traits/call-generic-method-dup-bound.stderr @@ -2,7 +2,7 @@ error: const `impl` for trait `PartialEq` which is not marked with `#[const_trai --> $DIR/call-generic-method-dup-bound.rs:9:12 | LL | impl const PartialEq for S { - | ^^^^^^^^^ + | ^^^^^^^^^ this trait is not `const` | = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: adding a non-const method body in the future would be a breaking change @@ -11,28 +11,38 @@ error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/call-generic-method-dup-bound.rs:20:37 | LL | const fn equals_self<T: PartialEq + ~const PartialEq>(t: &T) -> bool { - | ^^^^^^ + | ^^^^^^ can't be applied to `PartialEq` + | +note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/cmp.rs:LL:COL error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/call-generic-method-dup-bound.rs:20:37 | LL | const fn equals_self<T: PartialEq + ~const PartialEq>(t: &T) -> bool { - | ^^^^^^ + | ^^^^^^ can't be applied to `PartialEq` | +note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/cmp.rs:LL:COL = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/call-generic-method-dup-bound.rs:27:30 | LL | const fn equals_self2<T: A + ~const PartialEq>(t: &T) -> bool { - | ^^^^^^ + | ^^^^^^ can't be applied to `PartialEq` + | +note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/cmp.rs:LL:COL error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/call-generic-method-dup-bound.rs:27:30 | LL | const fn equals_self2<T: A + ~const PartialEq>(t: &T) -> bool { - | ^^^^^^ + | ^^^^^^ can't be applied to `PartialEq` | +note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/cmp.rs:LL:COL = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0015]: cannot call non-const operator in constant functions diff --git a/tests/ui/traits/const-traits/call-generic-method-pass.stderr b/tests/ui/traits/const-traits/call-generic-method-pass.stderr index 0c0037e36b8..a7626a4e99d 100644 --- a/tests/ui/traits/const-traits/call-generic-method-pass.stderr +++ b/tests/ui/traits/const-traits/call-generic-method-pass.stderr @@ -2,7 +2,7 @@ error: const `impl` for trait `PartialEq` which is not marked with `#[const_trai --> $DIR/call-generic-method-pass.rs:11:12 | LL | impl const PartialEq for S { - | ^^^^^^^^^ + | ^^^^^^^^^ this trait is not `const` | = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: adding a non-const method body in the future would be a breaking change @@ -11,14 +11,19 @@ error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/call-generic-method-pass.rs:20:25 | LL | const fn equals_self<T: ~const PartialEq>(t: &T) -> bool { - | ^^^^^^ + | ^^^^^^ can't be applied to `PartialEq` + | +note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/cmp.rs:LL:COL error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/call-generic-method-pass.rs:20:25 | LL | const fn equals_self<T: ~const PartialEq>(t: &T) -> bool { - | ^^^^^^ + | ^^^^^^ can't be applied to `PartialEq` | +note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/cmp.rs:LL:COL = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0015]: cannot call non-const operator in constant functions diff --git a/tests/ui/traits/const-traits/const-bounds-non-const-trait.stderr b/tests/ui/traits/const-traits/const-bounds-non-const-trait.stderr index 2436c97ccf2..f97d3a9181e 100644 --- a/tests/ui/traits/const-traits/const-bounds-non-const-trait.stderr +++ b/tests/ui/traits/const-traits/const-bounds-non-const-trait.stderr @@ -2,21 +2,35 @@ error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/const-bounds-non-const-trait.rs:6:21 | LL | const fn perform<T: ~const NonConst>() {} - | ^^^^^^ + | ^^^^^^ can't be applied to `NonConst` + | +help: mark `NonConst` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait NonConst {} + | ++++++++++++++ error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/const-bounds-non-const-trait.rs:6:21 | LL | const fn perform<T: ~const NonConst>() {} - | ^^^^^^ + | ^^^^^^ can't be applied to `NonConst` | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: mark `NonConst` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait NonConst {} + | ++++++++++++++ error: `const` can only be applied to `#[const_trait]` traits --> $DIR/const-bounds-non-const-trait.rs:10:15 | LL | fn operate<T: const NonConst>() {} - | ^^^^^ + | ^^^^^ can't be applied to `NonConst` + | +help: mark `NonConst` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait NonConst {} + | ++++++++++++++ error: aborting due to 3 previous errors diff --git a/tests/ui/traits/const-traits/const-closure-parse-not-item.stderr b/tests/ui/traits/const-traits/const-closure-parse-not-item.stderr index 0970cd5225f..57afa2257b7 100644 --- a/tests/ui/traits/const-traits/const-closure-parse-not-item.stderr +++ b/tests/ui/traits/const-traits/const-closure-parse-not-item.stderr @@ -2,22 +2,29 @@ error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/const-closure-parse-not-item.rs:7:25 | LL | const fn test() -> impl ~const Fn() { - | ^^^^^^ + | ^^^^^^ can't be applied to `Fn` + | +note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/const-closure-parse-not-item.rs:7:25 | LL | const fn test() -> impl ~const Fn() { - | ^^^^^^ + | ^^^^^^ can't be applied to `Fn` | +note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/const-closure-parse-not-item.rs:7:25 | LL | const fn test() -> impl ~const Fn() { - | ^^^^^^ + | ^^^^^^ can't be applied to `Fn` | +note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: aborting due to 3 previous errors diff --git a/tests/ui/traits/const-traits/const-closure-trait-method-fail.stderr b/tests/ui/traits/const-traits/const-closure-trait-method-fail.stderr index a76dc3e82af..2a97846ccb4 100644 --- a/tests/ui/traits/const-traits/const-closure-trait-method-fail.stderr +++ b/tests/ui/traits/const-traits/const-closure-trait-method-fail.stderr @@ -2,14 +2,19 @@ error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/const-closure-trait-method-fail.rs:14:32 | LL | const fn need_const_closure<T: ~const FnOnce(()) -> i32>(x: T) -> i32 { - | ^^^^^^ + | ^^^^^^ can't be applied to `FnOnce` + | +note: `FnOnce` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/const-closure-trait-method-fail.rs:14:32 | LL | const fn need_const_closure<T: ~const FnOnce(()) -> i32>(x: T) -> i32 { - | ^^^^^^ + | ^^^^^^ can't be applied to `FnOnce` | +note: `FnOnce` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0015]: cannot call non-const closure in constant functions diff --git a/tests/ui/traits/const-traits/const-closure-trait-method.stderr b/tests/ui/traits/const-traits/const-closure-trait-method.stderr index d37ff3d727c..9c63b7e63a6 100644 --- a/tests/ui/traits/const-traits/const-closure-trait-method.stderr +++ b/tests/ui/traits/const-traits/const-closure-trait-method.stderr @@ -2,14 +2,19 @@ error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/const-closure-trait-method.rs:14:32 | LL | const fn need_const_closure<T: ~const FnOnce(()) -> i32>(x: T) -> i32 { - | ^^^^^^ + | ^^^^^^ can't be applied to `FnOnce` + | +note: `FnOnce` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/const-closure-trait-method.rs:14:32 | LL | const fn need_const_closure<T: ~const FnOnce(()) -> i32>(x: T) -> i32 { - | ^^^^^^ + | ^^^^^^ can't be applied to `FnOnce` | +note: `FnOnce` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0015]: cannot call non-const closure in constant functions diff --git a/tests/ui/traits/const-traits/const-closures.stderr b/tests/ui/traits/const-traits/const-closures.stderr index 8ceaae16d8e..92f3ba20820 100644 --- a/tests/ui/traits/const-traits/const-closures.stderr +++ b/tests/ui/traits/const-traits/const-closures.stderr @@ -2,56 +2,76 @@ error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/const-closures.rs:8:12 | LL | F: ~const FnOnce() -> u8, - | ^^^^^^ + | ^^^^^^ can't be applied to `FnOnce` + | +note: `FnOnce` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/const-closures.rs:9:12 | LL | F: ~const FnMut() -> u8, - | ^^^^^^ + | ^^^^^^ can't be applied to `FnMut` + | +note: `FnMut` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/const-closures.rs:10:12 | LL | F: ~const Fn() -> u8, - | ^^^^^^ + | ^^^^^^ can't be applied to `Fn` + | +note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/const-closures.rs:8:12 | LL | F: ~const FnOnce() -> u8, - | ^^^^^^ + | ^^^^^^ can't be applied to `FnOnce` | +note: `FnOnce` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/const-closures.rs:9:12 | LL | F: ~const FnMut() -> u8, - | ^^^^^^ + | ^^^^^^ can't be applied to `FnMut` | +note: `FnMut` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/const-closures.rs:10:12 | LL | F: ~const Fn() -> u8, - | ^^^^^^ + | ^^^^^^ can't be applied to `Fn` | +note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/const-closures.rs:23:20 | LL | const fn answer<F: ~const Fn() -> u8>(f: &F) -> u8 { - | ^^^^^^ + | ^^^^^^ can't be applied to `Fn` + | +note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/const-closures.rs:23:20 | LL | const fn answer<F: ~const Fn() -> u8>(f: &F) -> u8 { - | ^^^^^^ + | ^^^^^^ can't be applied to `Fn` | +note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0015]: cannot call non-const closure in constant functions diff --git a/tests/ui/traits/const-traits/const-impl-requires-const-trait.stderr b/tests/ui/traits/const-traits/const-impl-requires-const-trait.stderr index bcaae381949..c728eda069e 100644 --- a/tests/ui/traits/const-traits/const-impl-requires-const-trait.stderr +++ b/tests/ui/traits/const-traits/const-impl-requires-const-trait.stderr @@ -1,14 +1,15 @@ error: const `impl` for trait `A` which is not marked with `#[const_trait]` --> $DIR/const-impl-requires-const-trait.rs:6:12 | -LL | pub trait A {} - | - help: mark `A` as const: `#[const_trait]` -LL | LL | impl const A for () {} - | ^ + | ^ this trait is not `const` | = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: adding a non-const method body in the future would be a breaking change +help: mark `A` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] pub trait A {} + | ++++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/traits/const-traits/const_derives/derive-const-gate.stderr b/tests/ui/traits/const-traits/const_derives/derive-const-gate.stderr index 95f6f32f21d..fae871a4c85 100644 --- a/tests/ui/traits/const-traits/const_derives/derive-const-gate.stderr +++ b/tests/ui/traits/const-traits/const_derives/derive-const-gate.stderr @@ -11,7 +11,7 @@ error: const `impl` for trait `Default` which is not marked with `#[const_trait] --> $DIR/derive-const-gate.rs:1:16 | LL | #[derive_const(Default)] - | ^^^^^^^ + | ^^^^^^^ this trait is not `const` | = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: adding a non-const method body in the future would be a breaking change diff --git a/tests/ui/traits/const-traits/const_derives/derive-const-non-const-type.stderr b/tests/ui/traits/const-traits/const_derives/derive-const-non-const-type.stderr index 9492000a563..8a6401afcf1 100644 --- a/tests/ui/traits/const-traits/const_derives/derive-const-non-const-type.stderr +++ b/tests/ui/traits/const-traits/const_derives/derive-const-non-const-type.stderr @@ -2,7 +2,7 @@ error: const `impl` for trait `Default` which is not marked with `#[const_trait] --> $DIR/derive-const-non-const-type.rs:10:16 | LL | #[derive_const(Default)] - | ^^^^^^^ + | ^^^^^^^ this trait is not `const` | = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: adding a non-const method body in the future would be a breaking change diff --git a/tests/ui/traits/const-traits/const_derives/derive-const-use.stderr b/tests/ui/traits/const-traits/const_derives/derive-const-use.stderr index 6f4fc90f636..3b06f4d801a 100644 --- a/tests/ui/traits/const-traits/const_derives/derive-const-use.stderr +++ b/tests/ui/traits/const-traits/const_derives/derive-const-use.stderr @@ -14,7 +14,7 @@ error: const `impl` for trait `Default` which is not marked with `#[const_trait] --> $DIR/derive-const-use.rs:7:12 | LL | impl const Default for A { - | ^^^^^^^ + | ^^^^^^^ this trait is not `const` | = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: adding a non-const method body in the future would be a breaking change @@ -23,7 +23,7 @@ error: const `impl` for trait `Default` which is not marked with `#[const_trait] --> $DIR/derive-const-use.rs:15:16 | LL | #[derive_const(Default, PartialEq)] - | ^^^^^^^ + | ^^^^^^^ this trait is not `const` | = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: adding a non-const method body in the future would be a breaking change @@ -33,7 +33,7 @@ error: const `impl` for trait `PartialEq` which is not marked with `#[const_trai --> $DIR/derive-const-use.rs:11:12 | LL | impl const PartialEq for A { - | ^^^^^^^^^ + | ^^^^^^^^^ this trait is not `const` | = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: adding a non-const method body in the future would be a breaking change @@ -42,7 +42,7 @@ error: const `impl` for trait `PartialEq` which is not marked with `#[const_trai --> $DIR/derive-const-use.rs:15:25 | LL | #[derive_const(Default, PartialEq)] - | ^^^^^^^^^ + | ^^^^^^^^^ this trait is not `const` | = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: adding a non-const method body in the future would be a breaking change diff --git a/tests/ui/traits/const-traits/const_derives/derive-const-with-params.stderr b/tests/ui/traits/const-traits/const_derives/derive-const-with-params.stderr index 21cf64f89ea..6b1405712ef 100644 --- a/tests/ui/traits/const-traits/const_derives/derive-const-with-params.stderr +++ b/tests/ui/traits/const-traits/const_derives/derive-const-with-params.stderr @@ -2,13 +2,16 @@ error: const `impl` for trait `PartialEq` which is not marked with `#[const_trai --> $DIR/derive-const-with-params.rs:7:16 | LL | #[derive_const(PartialEq)] - | ^^^^^^^^^ + | ^^^^^^^^^ this trait is not `const` | = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: adding a non-const method body in the future would be a breaking change = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info) error: `~const` can only be applied to `#[const_trait]` traits + | +note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/cmp.rs:LL:COL error[E0015]: cannot call non-const operator in constant functions --> $DIR/derive-const-with-params.rs:8:23 diff --git a/tests/ui/traits/const-traits/effects/ice-112822-expected-type-for-param.stderr b/tests/ui/traits/const-traits/effects/ice-112822-expected-type-for-param.stderr index 879d966b1f9..280f8807f5f 100644 --- a/tests/ui/traits/const-traits/effects/ice-112822-expected-type-for-param.stderr +++ b/tests/ui/traits/const-traits/effects/ice-112822-expected-type-for-param.stderr @@ -12,22 +12,29 @@ error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/ice-112822-expected-type-for-param.rs:3:25 | LL | const fn test() -> impl ~const Fn() { - | ^^^^^^ + | ^^^^^^ can't be applied to `Fn` + | +note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/ice-112822-expected-type-for-param.rs:3:25 | LL | const fn test() -> impl ~const Fn() { - | ^^^^^^ + | ^^^^^^ can't be applied to `Fn` | +note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/ice-112822-expected-type-for-param.rs:3:25 | LL | const fn test() -> impl ~const Fn() { - | ^^^^^^ + | ^^^^^^ can't be applied to `Fn` | +note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0015]: cannot call non-const operator in constant functions diff --git a/tests/ui/traits/const-traits/effects/spec-effectvar-ice.stderr b/tests/ui/traits/const-traits/effects/spec-effectvar-ice.stderr index 5659102c5e5..474d96698d5 100644 --- a/tests/ui/traits/const-traits/effects/spec-effectvar-ice.stderr +++ b/tests/ui/traits/const-traits/effects/spec-effectvar-ice.stderr @@ -1,32 +1,39 @@ error: const `impl` for trait `Foo` which is not marked with `#[const_trait]` --> $DIR/spec-effectvar-ice.rs:10:15 | -LL | trait Foo {} - | - help: mark `Foo` as const: `#[const_trait]` -LL | LL | impl<T> const Foo for T {} - | ^^^ + | ^^^ this trait is not `const` | = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: adding a non-const method body in the future would be a breaking change +help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Foo {} + | ++++++++++++++ error: const `impl` for trait `Foo` which is not marked with `#[const_trait]` --> $DIR/spec-effectvar-ice.rs:13:15 | -LL | trait Foo {} - | - help: mark `Foo` as const: `#[const_trait]` -... LL | impl<T> const Foo for T where T: const Specialize {} - | ^^^ + | ^^^ this trait is not `const` | = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: adding a non-const method body in the future would be a breaking change +help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Foo {} + | ++++++++++++++ error: `const` can only be applied to `#[const_trait]` traits --> $DIR/spec-effectvar-ice.rs:13:34 | LL | impl<T> const Foo for T where T: const Specialize {} - | ^^^^^ + | ^^^^^ can't be applied to `Specialize` + | +help: mark `Specialize` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Specialize {} + | ++++++++++++++ error: specialization impl does not specialize any associated items --> $DIR/spec-effectvar-ice.rs:13:1 diff --git a/tests/ui/traits/const-traits/ice-119717-constant-lifetime.stderr b/tests/ui/traits/const-traits/ice-119717-constant-lifetime.stderr index 9e22422ad3b..5af263de28c 100644 --- a/tests/ui/traits/const-traits/ice-119717-constant-lifetime.stderr +++ b/tests/ui/traits/const-traits/ice-119717-constant-lifetime.stderr @@ -2,7 +2,7 @@ error: const `impl` for trait `FromResidual` which is not marked with `#[const_t --> $DIR/ice-119717-constant-lifetime.rs:6:15 | LL | impl<T> const FromResidual for T { - | ^^^^^^^^^^^^ + | ^^^^^^^^^^^^ this trait is not `const` | = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: adding a non-const method body in the future would be a breaking change diff --git a/tests/ui/traits/const-traits/ice-123664-unexpected-bound-var.stderr b/tests/ui/traits/const-traits/ice-123664-unexpected-bound-var.stderr index 1178c90fce5..821b257af88 100644 --- a/tests/ui/traits/const-traits/ice-123664-unexpected-bound-var.stderr +++ b/tests/ui/traits/const-traits/ice-123664-unexpected-bound-var.stderr @@ -2,14 +2,19 @@ error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/ice-123664-unexpected-bound-var.rs:4:27 | LL | const fn with_positive<F: ~const Fn()>() {} - | ^^^^^^ + | ^^^^^^ can't be applied to `Fn` + | +note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/ice-123664-unexpected-bound-var.rs:4:27 | LL | const fn with_positive<F: ~const Fn()>() {} - | ^^^^^^ + | ^^^^^^ can't be applied to `Fn` | +note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: aborting due to 2 previous errors diff --git a/tests/ui/traits/const-traits/ice-126148-failed-to-normalize.stderr b/tests/ui/traits/const-traits/ice-126148-failed-to-normalize.stderr index 9bd493e5fdb..41f99c2d375 100644 --- a/tests/ui/traits/const-traits/ice-126148-failed-to-normalize.stderr +++ b/tests/ui/traits/const-traits/ice-126148-failed-to-normalize.stderr @@ -2,7 +2,7 @@ error: const `impl` for trait `FromResidual` which is not marked with `#[const_t --> $DIR/ice-126148-failed-to-normalize.rs:8:12 | LL | impl const FromResidual<Error> for TryMe {} - | ^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^ this trait is not `const` | = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: adding a non-const method body in the future would be a breaking change @@ -19,7 +19,7 @@ error: const `impl` for trait `Try` which is not marked with `#[const_trait]` --> $DIR/ice-126148-failed-to-normalize.rs:12:12 | LL | impl const Try for TryMe { - | ^^^ + | ^^^ this trait is not `const` | = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: adding a non-const method body in the future would be a breaking change diff --git a/tests/ui/traits/const-traits/non-const-op-in-closure-in-const.stderr b/tests/ui/traits/const-traits/non-const-op-in-closure-in-const.stderr index 837effb7ca4..4ddb1e8c5a9 100644 --- a/tests/ui/traits/const-traits/non-const-op-in-closure-in-const.stderr +++ b/tests/ui/traits/const-traits/non-const-op-in-closure-in-const.stderr @@ -2,14 +2,19 @@ error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/non-const-op-in-closure-in-const.rs:10:44 | LL | impl<A, B> const Convert<B> for A where B: ~const From<A> { - | ^^^^^^ + | ^^^^^^ can't be applied to `From` + | +note: `From` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/convert/mod.rs:LL:COL error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/non-const-op-in-closure-in-const.rs:10:44 | LL | impl<A, B> const Convert<B> for A where B: ~const From<A> { - | ^^^^^^ + | ^^^^^^ can't be applied to `From` | +note: `From` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/convert/mod.rs:LL:COL = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0015]: cannot call non-const fn `<B as From<A>>::from` in constant functions diff --git a/tests/ui/traits/const-traits/super-traits-fail-2.nn.stderr b/tests/ui/traits/const-traits/super-traits-fail-2.nn.stderr index e7f54b4c5bd..51b88cf8702 100644 --- a/tests/ui/traits/const-traits/super-traits-fail-2.nn.stderr +++ b/tests/ui/traits/const-traits/super-traits-fail-2.nn.stderr @@ -14,23 +14,36 @@ error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/super-traits-fail-2.rs:11:12 | LL | trait Bar: ~const Foo {} - | ^^^^^^ + | ^^^^^^ can't be applied to `Foo` + | +help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Foo { + | ++++++++++++++ error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/super-traits-fail-2.rs:11:12 | LL | trait Bar: ~const Foo {} - | ^^^^^^ + | ^^^^^^ can't be applied to `Foo` | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Foo { + | ++++++++++++++ error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/super-traits-fail-2.rs:11:12 | LL | trait Bar: ~const Foo {} - | ^^^^^^ + | ^^^^^^ can't be applied to `Foo` | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Foo { + | ++++++++++++++ error[E0015]: cannot call non-const fn `<T as Foo>::a` in constant functions --> $DIR/super-traits-fail-2.rs:20:7 diff --git a/tests/ui/traits/const-traits/super-traits-fail-2.ny.stderr b/tests/ui/traits/const-traits/super-traits-fail-2.ny.stderr index a09fe81f716..38fb6f05412 100644 --- a/tests/ui/traits/const-traits/super-traits-fail-2.ny.stderr +++ b/tests/ui/traits/const-traits/super-traits-fail-2.ny.stderr @@ -2,39 +2,60 @@ error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/super-traits-fail-2.rs:11:12 | LL | trait Bar: ~const Foo {} - | ^^^^^^ + | ^^^^^^ can't be applied to `Foo` + | +help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Foo { + | ++++++++++++++ error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/super-traits-fail-2.rs:11:12 | LL | trait Bar: ~const Foo {} - | ^^^^^^ + | ^^^^^^ can't be applied to `Foo` | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Foo { + | ++++++++++++++ error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/super-traits-fail-2.rs:11:12 | LL | trait Bar: ~const Foo {} - | ^^^^^^ + | ^^^^^^ can't be applied to `Foo` | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Foo { + | ++++++++++++++ error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/super-traits-fail-2.rs:11:12 | LL | trait Bar: ~const Foo {} - | ^^^^^^ + | ^^^^^^ can't be applied to `Foo` | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Foo { + | ++++++++++++++ error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/super-traits-fail-2.rs:11:12 | LL | trait Bar: ~const Foo {} - | ^^^^^^ + | ^^^^^^ can't be applied to `Foo` | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Foo { + | ++++++++++++++ error[E0015]: cannot call non-const fn `<T as Foo>::a` in constant functions --> $DIR/super-traits-fail-2.rs:20:7 diff --git a/tests/ui/traits/const-traits/super-traits-fail-3.nnn.stderr b/tests/ui/traits/const-traits/super-traits-fail-3.nnn.stderr new file mode 100644 index 00000000000..fd802fde5bd --- /dev/null +++ b/tests/ui/traits/const-traits/super-traits-fail-3.nnn.stderr @@ -0,0 +1,102 @@ +error: `~const` is not allowed here + --> $DIR/super-traits-fail-3.rs:23:12 + | +LL | trait Bar: ~const Foo {} + | ^^^^^^ + | +note: this trait is not a `#[const_trait]`, so it cannot have `~const` trait bounds + --> $DIR/super-traits-fail-3.rs:23:1 + | +LL | trait Bar: ~const Foo {} + | ^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0658]: const trait impls are experimental + --> $DIR/super-traits-fail-3.rs:23:12 + | +LL | trait Bar: ~const Foo {} + | ^^^^^^ + | + = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information + = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: const trait impls are experimental + --> $DIR/super-traits-fail-3.rs:32:17 + | +LL | const fn foo<T: ~const Bar>(x: &T) { + | ^^^^^^ + | + = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information + = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error: `~const` can only be applied to `#[const_trait]` traits + --> $DIR/super-traits-fail-3.rs:23:12 + | +LL | trait Bar: ~const Foo {} + | ^^^^^^ can't be applied to `Foo` + | +help: enable `#![feature(const_trait_impl)]` in your crate and mark `Foo` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Foo { + | ++++++++++++++ + +error: `~const` can only be applied to `#[const_trait]` traits + --> $DIR/super-traits-fail-3.rs:23:12 + | +LL | trait Bar: ~const Foo {} + | ^^^^^^ can't be applied to `Foo` + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: enable `#![feature(const_trait_impl)]` in your crate and mark `Foo` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Foo { + | ++++++++++++++ + +error: `~const` can only be applied to `#[const_trait]` traits + --> $DIR/super-traits-fail-3.rs:23:12 + | +LL | trait Bar: ~const Foo {} + | ^^^^^^ can't be applied to `Foo` + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: enable `#![feature(const_trait_impl)]` in your crate and mark `Foo` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Foo { + | ++++++++++++++ + +error: `~const` can only be applied to `#[const_trait]` traits + --> $DIR/super-traits-fail-3.rs:32:17 + | +LL | const fn foo<T: ~const Bar>(x: &T) { + | ^^^^^^ can't be applied to `Bar` + | +help: enable `#![feature(const_trait_impl)]` in your crate and mark `Bar` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Bar: ~const Foo {} + | ++++++++++++++ + +error: `~const` can only be applied to `#[const_trait]` traits + --> $DIR/super-traits-fail-3.rs:32:17 + | +LL | const fn foo<T: ~const Bar>(x: &T) { + | ^^^^^^ can't be applied to `Bar` + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: enable `#![feature(const_trait_impl)]` in your crate and mark `Bar` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Bar: ~const Foo {} + | ++++++++++++++ + +error[E0015]: cannot call non-const fn `<T as Foo>::a` in constant functions + --> $DIR/super-traits-fail-3.rs:36:7 + | +LL | x.a(); + | ^^^ + | + = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants + +error: aborting due to 9 previous errors + +Some errors have detailed explanations: E0015, E0658. +For more information about an error, try `rustc --explain E0015`. diff --git a/tests/ui/traits/const-traits/super-traits-fail-3.nny.stderr b/tests/ui/traits/const-traits/super-traits-fail-3.nny.stderr new file mode 100644 index 00000000000..fd802fde5bd --- /dev/null +++ b/tests/ui/traits/const-traits/super-traits-fail-3.nny.stderr @@ -0,0 +1,102 @@ +error: `~const` is not allowed here + --> $DIR/super-traits-fail-3.rs:23:12 + | +LL | trait Bar: ~const Foo {} + | ^^^^^^ + | +note: this trait is not a `#[const_trait]`, so it cannot have `~const` trait bounds + --> $DIR/super-traits-fail-3.rs:23:1 + | +LL | trait Bar: ~const Foo {} + | ^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0658]: const trait impls are experimental + --> $DIR/super-traits-fail-3.rs:23:12 + | +LL | trait Bar: ~const Foo {} + | ^^^^^^ + | + = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information + = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: const trait impls are experimental + --> $DIR/super-traits-fail-3.rs:32:17 + | +LL | const fn foo<T: ~const Bar>(x: &T) { + | ^^^^^^ + | + = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information + = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error: `~const` can only be applied to `#[const_trait]` traits + --> $DIR/super-traits-fail-3.rs:23:12 + | +LL | trait Bar: ~const Foo {} + | ^^^^^^ can't be applied to `Foo` + | +help: enable `#![feature(const_trait_impl)]` in your crate and mark `Foo` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Foo { + | ++++++++++++++ + +error: `~const` can only be applied to `#[const_trait]` traits + --> $DIR/super-traits-fail-3.rs:23:12 + | +LL | trait Bar: ~const Foo {} + | ^^^^^^ can't be applied to `Foo` + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: enable `#![feature(const_trait_impl)]` in your crate and mark `Foo` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Foo { + | ++++++++++++++ + +error: `~const` can only be applied to `#[const_trait]` traits + --> $DIR/super-traits-fail-3.rs:23:12 + | +LL | trait Bar: ~const Foo {} + | ^^^^^^ can't be applied to `Foo` + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: enable `#![feature(const_trait_impl)]` in your crate and mark `Foo` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Foo { + | ++++++++++++++ + +error: `~const` can only be applied to `#[const_trait]` traits + --> $DIR/super-traits-fail-3.rs:32:17 + | +LL | const fn foo<T: ~const Bar>(x: &T) { + | ^^^^^^ can't be applied to `Bar` + | +help: enable `#![feature(const_trait_impl)]` in your crate and mark `Bar` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Bar: ~const Foo {} + | ++++++++++++++ + +error: `~const` can only be applied to `#[const_trait]` traits + --> $DIR/super-traits-fail-3.rs:32:17 + | +LL | const fn foo<T: ~const Bar>(x: &T) { + | ^^^^^^ can't be applied to `Bar` + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: enable `#![feature(const_trait_impl)]` in your crate and mark `Bar` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Bar: ~const Foo {} + | ++++++++++++++ + +error[E0015]: cannot call non-const fn `<T as Foo>::a` in constant functions + --> $DIR/super-traits-fail-3.rs:36:7 + | +LL | x.a(); + | ^^^ + | + = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants + +error: aborting due to 9 previous errors + +Some errors have detailed explanations: E0015, E0658. +For more information about an error, try `rustc --explain E0015`. diff --git a/tests/ui/traits/const-traits/super-traits-fail-3.ny.stderr b/tests/ui/traits/const-traits/super-traits-fail-3.ny.stderr deleted file mode 100644 index a880c2a2206..00000000000 --- a/tests/ui/traits/const-traits/super-traits-fail-3.ny.stderr +++ /dev/null @@ -1,49 +0,0 @@ -error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/super-traits-fail-3.rs:13:12 - | -LL | trait Bar: ~const Foo {} - | ^^^^^^ - -error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/super-traits-fail-3.rs:13:12 - | -LL | trait Bar: ~const Foo {} - | ^^^^^^ - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/super-traits-fail-3.rs:13:12 - | -LL | trait Bar: ~const Foo {} - | ^^^^^^ - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/super-traits-fail-3.rs:13:12 - | -LL | trait Bar: ~const Foo {} - | ^^^^^^ - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/super-traits-fail-3.rs:13:12 - | -LL | trait Bar: ~const Foo {} - | ^^^^^^ - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error[E0015]: cannot call non-const fn `<T as Foo>::a` in constant functions - --> $DIR/super-traits-fail-3.rs:24:7 - | -LL | x.a(); - | ^^^ - | - = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants - -error: aborting due to 6 previous errors - -For more information about this error, try `rustc --explain E0015`. diff --git a/tests/ui/traits/const-traits/super-traits-fail-3.nyn.stderr b/tests/ui/traits/const-traits/super-traits-fail-3.nyn.stderr new file mode 100644 index 00000000000..8abda1c8f8a --- /dev/null +++ b/tests/ui/traits/const-traits/super-traits-fail-3.nyn.stderr @@ -0,0 +1,53 @@ +error[E0658]: const trait impls are experimental + --> $DIR/super-traits-fail-3.rs:23:12 + | +LL | trait Bar: ~const Foo {} + | ^^^^^^ + | + = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information + = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: const trait impls are experimental + --> $DIR/super-traits-fail-3.rs:32:17 + | +LL | const fn foo<T: ~const Bar>(x: &T) { + | ^^^^^^ + | + = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information + = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: `const_trait` is a temporary placeholder for marking a trait that is suitable for `const` `impls` and all default bodies as `const`, which may be removed or renamed in the future. + --> $DIR/super-traits-fail-3.rs:15:37 + | +LL | #[cfg_attr(any(yyy, yyn, nyy, nyn), const_trait)] + | ^^^^^^^^^^^ + | + = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information + = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: `const_trait` is a temporary placeholder for marking a trait that is suitable for `const` `impls` and all default bodies as `const`, which may be removed or renamed in the future. + --> $DIR/super-traits-fail-3.rs:21:37 + | +LL | #[cfg_attr(any(yyy, yny, nyy, nyn), const_trait)] + | ^^^^^^^^^^^ + | + = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information + = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: cannot call conditionally-const method `<T as Foo>::a` in constant functions + --> $DIR/super-traits-fail-3.rs:36:5 + | +LL | x.a(); + | ^^^^^ + | + = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information + = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error: aborting due to 5 previous errors + +For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/traits/const-traits/super-traits-fail-3.nyy.stderr b/tests/ui/traits/const-traits/super-traits-fail-3.nyy.stderr new file mode 100644 index 00000000000..8abda1c8f8a --- /dev/null +++ b/tests/ui/traits/const-traits/super-traits-fail-3.nyy.stderr @@ -0,0 +1,53 @@ +error[E0658]: const trait impls are experimental + --> $DIR/super-traits-fail-3.rs:23:12 + | +LL | trait Bar: ~const Foo {} + | ^^^^^^ + | + = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information + = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: const trait impls are experimental + --> $DIR/super-traits-fail-3.rs:32:17 + | +LL | const fn foo<T: ~const Bar>(x: &T) { + | ^^^^^^ + | + = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information + = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: `const_trait` is a temporary placeholder for marking a trait that is suitable for `const` `impls` and all default bodies as `const`, which may be removed or renamed in the future. + --> $DIR/super-traits-fail-3.rs:15:37 + | +LL | #[cfg_attr(any(yyy, yyn, nyy, nyn), const_trait)] + | ^^^^^^^^^^^ + | + = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information + = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: `const_trait` is a temporary placeholder for marking a trait that is suitable for `const` `impls` and all default bodies as `const`, which may be removed or renamed in the future. + --> $DIR/super-traits-fail-3.rs:21:37 + | +LL | #[cfg_attr(any(yyy, yny, nyy, nyn), const_trait)] + | ^^^^^^^^^^^ + | + = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information + = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: cannot call conditionally-const method `<T as Foo>::a` in constant functions + --> $DIR/super-traits-fail-3.rs:36:5 + | +LL | x.a(); + | ^^^^^ + | + = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information + = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error: aborting due to 5 previous errors + +For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/traits/const-traits/super-traits-fail-3.rs b/tests/ui/traits/const-traits/super-traits-fail-3.rs index bd95ae8d96a..aa27554e7f8 100644 --- a/tests/ui/traits/const-traits/super-traits-fail-3.rs +++ b/tests/ui/traits/const-traits/super-traits-fail-3.rs @@ -1,29 +1,42 @@ //@ compile-flags: -Znext-solver -#![feature(const_trait_impl)] +#![cfg_attr(any(yyy, yyn, yny, ynn), feature(const_trait_impl))] -//@ revisions: yy yn ny nn -//@[yy] check-pass +//@ revisions: yyy yyn yny ynn nyy nyn nny nnn +//@[yyy] check-pass +/// yyy: feature enabled, Foo is const, Bar is const +/// yyn: feature enabled, Foo is const, Bar is not const +/// yny: feature enabled, Foo is not const, Bar is const +/// ynn: feature enabled, Foo is not const, Bar is not const +/// nyy: feature not enabled, Foo is const, Bar is const +/// nyn: feature not enabled, Foo is const, Bar is not const +/// nny: feature not enabled, Foo is not const, Bar is const +/// nnn: feature not enabled, Foo is not const, Bar is not const -#[cfg_attr(any(yy, yn), const_trait)] +#[cfg_attr(any(yyy, yyn, nyy, nyn), const_trait)] +//[nyy,nyn]~^ ERROR: `const_trait` is a temporary placeholder for marking a trait that is suitable for `const` `impls` and all default bodies as `const`, which may be removed or renamed in the future trait Foo { fn a(&self); } -#[cfg_attr(any(yy, ny), const_trait)] +#[cfg_attr(any(yyy, yny, nyy, nyn), const_trait)] +//[nyy,nyn]~^ ERROR: `const_trait` is a temporary placeholder for marking a trait that is suitable for `const` `impls` and all default bodies as `const`, which may be removed or renamed in the future trait Bar: ~const Foo {} -//[ny,nn]~^ ERROR: `~const` can only be applied to `#[const_trait]` -//[ny,nn]~| ERROR: `~const` can only be applied to `#[const_trait]` -//[ny,nn]~| ERROR: `~const` can only be applied to `#[const_trait]` -//[ny]~| ERROR: `~const` can only be applied to `#[const_trait]` -//[ny]~| ERROR: `~const` can only be applied to `#[const_trait]` -//[yn,nn]~^^^^^^ ERROR: `~const` is not allowed here +//[yny,ynn,nny,nnn]~^ ERROR: `~const` can only be applied to `#[const_trait]` +//[yny,ynn,nny,nnn]~| ERROR: `~const` can only be applied to `#[const_trait]` +//[yny,ynn,nny,nnn]~| ERROR: `~const` can only be applied to `#[const_trait]` +//[yny]~^^^^ ERROR: `~const` can only be applied to `#[const_trait]` +//[yny]~| ERROR: `~const` can only be applied to `#[const_trait]` +//[yyn,ynn,nny,nnn]~^^^^^^ ERROR: `~const` is not allowed here +//[nyy,nyn,nny,nnn]~^^^^^^^ ERROR: const trait impls are experimental const fn foo<T: ~const Bar>(x: &T) { - //[yn,nn]~^ ERROR: `~const` can only be applied to `#[const_trait]` - //[yn,nn]~| ERROR: `~const` can only be applied to `#[const_trait]` + //[yyn,ynn,nny,nnn]~^ ERROR: `~const` can only be applied to `#[const_trait]` + //[yyn,ynn,nny,nnn]~| ERROR: `~const` can only be applied to `#[const_trait]` + //[nyy,nyn,nny,nnn]~^^^ ERROR: const trait impls are experimental x.a(); - //[yn]~^ ERROR: the trait bound `T: ~const Foo` is not satisfied - //[nn,ny]~^^ ERROR: cannot call non-const fn `<T as Foo>::a` in constant functions + //[yyn]~^ ERROR: the trait bound `T: ~const Foo` is not satisfied + //[ynn,yny,nny,nnn]~^^ ERROR: cannot call non-const fn `<T as Foo>::a` in constant functions + //[nyy,nyn]~^^^ ERROR: cannot call conditionally-const method `<T as Foo>::a` in constant functions } fn main() {} diff --git a/tests/ui/traits/const-traits/super-traits-fail-3.nn.stderr b/tests/ui/traits/const-traits/super-traits-fail-3.ynn.stderr index 599b8c826f7..16424696eeb 100644 --- a/tests/ui/traits/const-traits/super-traits-fail-3.nn.stderr +++ b/tests/ui/traits/const-traits/super-traits-fail-3.ynn.stderr @@ -1,53 +1,75 @@ error: `~const` is not allowed here - --> $DIR/super-traits-fail-3.rs:13:12 + --> $DIR/super-traits-fail-3.rs:23:12 | LL | trait Bar: ~const Foo {} | ^^^^^^ | note: this trait is not a `#[const_trait]`, so it cannot have `~const` trait bounds - --> $DIR/super-traits-fail-3.rs:13:1 + --> $DIR/super-traits-fail-3.rs:23:1 | LL | trait Bar: ~const Foo {} | ^^^^^^^^^^^^^^^^^^^^^^^^ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/super-traits-fail-3.rs:13:12 + --> $DIR/super-traits-fail-3.rs:23:12 | LL | trait Bar: ~const Foo {} - | ^^^^^^ + | ^^^^^^ can't be applied to `Foo` + | +help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Foo { + | ++++++++++++++ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/super-traits-fail-3.rs:13:12 + --> $DIR/super-traits-fail-3.rs:23:12 | LL | trait Bar: ~const Foo {} - | ^^^^^^ + | ^^^^^^ can't be applied to `Foo` | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Foo { + | ++++++++++++++ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/super-traits-fail-3.rs:13:12 + --> $DIR/super-traits-fail-3.rs:23:12 | LL | trait Bar: ~const Foo {} - | ^^^^^^ + | ^^^^^^ can't be applied to `Foo` | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Foo { + | ++++++++++++++ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/super-traits-fail-3.rs:21:17 + --> $DIR/super-traits-fail-3.rs:32:17 | LL | const fn foo<T: ~const Bar>(x: &T) { - | ^^^^^^ + | ^^^^^^ can't be applied to `Bar` + | +help: mark `Bar` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Bar: ~const Foo {} + | ++++++++++++++ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/super-traits-fail-3.rs:21:17 + --> $DIR/super-traits-fail-3.rs:32:17 | LL | const fn foo<T: ~const Bar>(x: &T) { - | ^^^^^^ + | ^^^^^^ can't be applied to `Bar` | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: mark `Bar` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Bar: ~const Foo {} + | ++++++++++++++ error[E0015]: cannot call non-const fn `<T as Foo>::a` in constant functions - --> $DIR/super-traits-fail-3.rs:24:7 + --> $DIR/super-traits-fail-3.rs:36:7 | LL | x.a(); | ^^^ diff --git a/tests/ui/traits/const-traits/super-traits-fail-3.yny.stderr b/tests/ui/traits/const-traits/super-traits-fail-3.yny.stderr new file mode 100644 index 00000000000..c81544c4bf5 --- /dev/null +++ b/tests/ui/traits/const-traits/super-traits-fail-3.yny.stderr @@ -0,0 +1,70 @@ +error: `~const` can only be applied to `#[const_trait]` traits + --> $DIR/super-traits-fail-3.rs:23:12 + | +LL | trait Bar: ~const Foo {} + | ^^^^^^ can't be applied to `Foo` + | +help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Foo { + | ++++++++++++++ + +error: `~const` can only be applied to `#[const_trait]` traits + --> $DIR/super-traits-fail-3.rs:23:12 + | +LL | trait Bar: ~const Foo {} + | ^^^^^^ can't be applied to `Foo` + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Foo { + | ++++++++++++++ + +error: `~const` can only be applied to `#[const_trait]` traits + --> $DIR/super-traits-fail-3.rs:23:12 + | +LL | trait Bar: ~const Foo {} + | ^^^^^^ can't be applied to `Foo` + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Foo { + | ++++++++++++++ + +error: `~const` can only be applied to `#[const_trait]` traits + --> $DIR/super-traits-fail-3.rs:23:12 + | +LL | trait Bar: ~const Foo {} + | ^^^^^^ can't be applied to `Foo` + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Foo { + | ++++++++++++++ + +error: `~const` can only be applied to `#[const_trait]` traits + --> $DIR/super-traits-fail-3.rs:23:12 + | +LL | trait Bar: ~const Foo {} + | ^^^^^^ can't be applied to `Foo` + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Foo { + | ++++++++++++++ + +error[E0015]: cannot call non-const fn `<T as Foo>::a` in constant functions + --> $DIR/super-traits-fail-3.rs:36:7 + | +LL | x.a(); + | ^^^ + | + = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants + +error: aborting due to 6 previous errors + +For more information about this error, try `rustc --explain E0015`. diff --git a/tests/ui/traits/const-traits/super-traits-fail-3.yn.stderr b/tests/ui/traits/const-traits/super-traits-fail-3.yyn.stderr index ecee348222d..3270611dace 100644 --- a/tests/ui/traits/const-traits/super-traits-fail-3.yn.stderr +++ b/tests/ui/traits/const-traits/super-traits-fail-3.yyn.stderr @@ -1,31 +1,40 @@ error: `~const` is not allowed here - --> $DIR/super-traits-fail-3.rs:13:12 + --> $DIR/super-traits-fail-3.rs:23:12 | LL | trait Bar: ~const Foo {} | ^^^^^^ | note: this trait is not a `#[const_trait]`, so it cannot have `~const` trait bounds - --> $DIR/super-traits-fail-3.rs:13:1 + --> $DIR/super-traits-fail-3.rs:23:1 | LL | trait Bar: ~const Foo {} | ^^^^^^^^^^^^^^^^^^^^^^^^ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/super-traits-fail-3.rs:21:17 + --> $DIR/super-traits-fail-3.rs:32:17 | LL | const fn foo<T: ~const Bar>(x: &T) { - | ^^^^^^ + | ^^^^^^ can't be applied to `Bar` + | +help: mark `Bar` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Bar: ~const Foo {} + | ++++++++++++++ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/super-traits-fail-3.rs:21:17 + --> $DIR/super-traits-fail-3.rs:32:17 | LL | const fn foo<T: ~const Bar>(x: &T) { - | ^^^^^^ + | ^^^^^^ can't be applied to `Bar` | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: mark `Bar` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Bar: ~const Foo {} + | ++++++++++++++ error[E0277]: the trait bound `T: ~const Foo` is not satisfied - --> $DIR/super-traits-fail-3.rs:24:7 + --> $DIR/super-traits-fail-3.rs:36:7 | LL | x.a(); | ^ diff --git a/tests/ui/traits/const-traits/trait-default-body-stability.stderr b/tests/ui/traits/const-traits/trait-default-body-stability.stderr index b471cb81c3b..77b81211e81 100644 --- a/tests/ui/traits/const-traits/trait-default-body-stability.stderr +++ b/tests/ui/traits/const-traits/trait-default-body-stability.stderr @@ -2,7 +2,7 @@ error: const `impl` for trait `Try` which is not marked with `#[const_trait]` --> $DIR/trait-default-body-stability.rs:19:12 | LL | impl const Try for T { - | ^^^ + | ^^^ this trait is not `const` | = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: adding a non-const method body in the future would be a breaking change @@ -11,7 +11,7 @@ error: const `impl` for trait `FromResidual` which is not marked with `#[const_t --> $DIR/trait-default-body-stability.rs:34:12 | LL | impl const FromResidual for T { - | ^^^^^^^^^^^^ + | ^^^^^^^^^^^^ this trait is not `const` | = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: adding a non-const method body in the future would be a breaking change diff --git a/tests/ui/type/type-dependent-def-issue-49241.stderr b/tests/ui/type/type-dependent-def-issue-49241.stderr index 4e55618e5cb..cf372dc5968 100644 --- a/tests/ui/type/type-dependent-def-issue-49241.stderr +++ b/tests/ui/type/type-dependent-def-issue-49241.stderr @@ -9,12 +9,6 @@ help: consider using `let` instead of `const` LL | let l: usize = v.count(); | ~~~ -note: erroneous constant encountered - --> $DIR/type-dependent-def-issue-49241.rs:4:18 - | -LL | let s: [u32; l] = v.into_iter().collect(); - | ^ - error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0435`. diff --git a/tests/ui/unsafe-fields/copy-trait.rs b/tests/ui/unsafe-fields/copy-trait.rs new file mode 100644 index 00000000000..fb09ed02e3f --- /dev/null +++ b/tests/ui/unsafe-fields/copy-trait.rs @@ -0,0 +1,41 @@ +//@ compile-flags: --crate-type=lib + +#![feature(unsafe_fields)] +#![allow(incomplete_features)] +#![deny(missing_copy_implementations)] + +mod good_safe_impl { + enum SafeEnum { + Safe(u8), + } + + impl Copy for SafeEnum {} +} + +mod bad_safe_impl { + enum UnsafeEnum { + Safe(u8), + Unsafe { unsafe field: u8 }, + } + + impl Copy for UnsafeEnum {} + //~^ ERROR the trait `Copy` requires an `unsafe impl` declaration +} + +mod good_unsafe_impl { + enum UnsafeEnum { + Safe(u8), + Unsafe { unsafe field: u8 }, + } + + unsafe impl Copy for UnsafeEnum {} +} + +mod bad_unsafe_impl { + enum SafeEnum { + Safe(u8), + } + + unsafe impl Copy for SafeEnum {} + //~^ ERROR implementing the trait `Copy` is not unsafe +} diff --git a/tests/ui/unsafe-fields/copy-trait.stderr b/tests/ui/unsafe-fields/copy-trait.stderr new file mode 100644 index 00000000000..5952f8c89c1 --- /dev/null +++ b/tests/ui/unsafe-fields/copy-trait.stderr @@ -0,0 +1,28 @@ +error[E0200]: the trait `Copy` requires an `unsafe impl` declaration + --> $DIR/copy-trait.rs:21:5 + | +LL | impl Copy for UnsafeEnum {} + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: the trait `Copy` cannot be safely implemented for `bad_safe_impl::UnsafeEnum` because it has unsafe fields. Review the invariants of those fields before adding an `unsafe impl` +help: add `unsafe` to this trait implementation + | +LL | unsafe impl Copy for UnsafeEnum {} + | ++++++ + +error[E0199]: implementing the trait `Copy` is not unsafe + --> $DIR/copy-trait.rs:39:5 + | +LL | unsafe impl Copy for SafeEnum {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: remove `unsafe` from this trait implementation + | +LL - unsafe impl Copy for SafeEnum {} +LL + impl Copy for SafeEnum {} + | + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0199, E0200. +For more information about an error, try `rustc --explain E0199`. diff --git a/triagebot.toml b/triagebot.toml index c5dbd538f6c..665108cccd3 100644 --- a/triagebot.toml +++ b/triagebot.toml @@ -983,6 +983,13 @@ cc = ["@Zalathar"] [mentions."src/tools/opt-dist"] cc = ["@kobzol"] +[mentions."tests/ui-fulldeps/lexer/unicode-version.run.stdout"] +message = """If the Unicode version changes are intentional, +it should also be updated in the reference at +https://github.com/rust-lang/reference/blob/HEAD/src/identifiers.md. +""" +cc = ["@ehuss"] + [assign] warn_non_default_branch = true contributing_url = "https://rustc-dev-guide.rust-lang.org/getting-started.html" @@ -1004,9 +1011,11 @@ compiler = [ "@lcnr", "@Nadrieril", "@nnethercote", + "@Noratrieb", "@oli-obk", "@petrochenkov", "@pnkfelix", + "@SparrowLii", "@wesleywiser", ] libs = [ |
