diff --git a/Cargo.lock b/Cargo.lock index c2e635b4cfe65..70bf7173d6a70 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -80,9 +80,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.20" +version = "0.6.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ae563653d1938f79b1ab1b5e668c87c76a9930414574a6583a7b7e11a8e6192" +checksum = "301af1932e46185686725e0fad2f8f2aa7da69dd70bf6ecc44d6b703844a3933" dependencies = [ "anstyle", "anstyle-parse", @@ -119,18 +119,18 @@ dependencies = [ [[package]] name = "anstyle-query" -version = "1.1.4" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e231f6134f61b71076a3eab506c379d4f36122f2af15a9ff04415ea4c3339e2" +checksum = "6c8bdeb6047d8983be085bab0ba1472e6dc604e7041dbf6fcd5e71523014fae9" dependencies = [ - "windows-sys 0.60.2", + "windows-sys 0.59.0", ] [[package]] name = "anstyle-svg" -version = "0.1.10" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc03a770ef506fe1396c0e476120ac0e6523cf14b74218dd5f18cd6833326fa9" +checksum = "0a43964079ef399480603125d5afae2b219aceffb77478956e25f17b9bc3435c" dependencies = [ "anstyle", "anstyle-lossy", @@ -141,20 +141,20 @@ dependencies = [ [[package]] name = "anstyle-wincon" -version = "3.0.10" +version = "3.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e0633414522a32ffaac8ac6cc8f748e090c5717661fddeea04219e2344f5f2a" +checksum = "403f75924867bb1033c59fbf0797484329750cfbe3c4325cd33127941fabc882" dependencies = [ "anstyle", "once_cell_polyfill", - "windows-sys 0.60.2", + "windows-sys 0.59.0", ] [[package]] name = "anyhow" -version = "1.0.99" +version = "1.0.98" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0674a1ddeecb70197781e945de4b3b8ffb61fa939a5597bcf48503737663100" +checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487" [[package]] name = "ar_archive_writer" @@ -162,7 +162,7 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7eb93bbb63b9c227414f6eb3a0adfddca591a8ce1e9b60661bb08969b87e340b" dependencies = [ - "object 0.37.3", + "object 0.37.1", ] [[package]] @@ -204,7 +204,7 @@ dependencies = [ "rustc-hash 2.1.1", "serde", "serde_derive", - "syn 2.0.106", + "syn 2.0.104", ] [[package]] @@ -266,9 +266,9 @@ dependencies = [ [[package]] name = "bitflags" -version = "2.9.3" +version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34efbcccd345379ca2868b2b2c9d3782e9cc58ba87bc7d79d5b53d9c9ae6f25d" +checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967" [[package]] name = "blake3" @@ -353,9 +353,9 @@ checksum = "175812e0be2bccb6abe50bb8d566126198344f707e304f45c648fd8f2cc0365e" [[package]] name = "camino" -version = "1.1.11" +version = "1.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d07aa9a93b00c76f71bc35d598bed923f6d4f3a9ca5c24b7737ae1a292841c0" +checksum = "0da45bc31171d8d6960122e222a67740df867c1dd53b4d51caa297084c185cab" dependencies = [ "serde", ] @@ -421,7 +421,7 @@ dependencies = [ "serde", "serde-untagged", "serde-value", - "thiserror 2.0.15", + "thiserror 2.0.12", "toml 0.8.23", "unicode-xid", "url", @@ -453,7 +453,7 @@ dependencies = [ "semver", "serde", "serde_json", - "thiserror 2.0.15", + "thiserror 2.0.12", ] [[package]] @@ -518,9 +518,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.45" +version = "4.5.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fc0e74a703892159f5ae7d3aac52c8e6c392f5ae5f359c70b5881d60aaac318" +checksum = "be92d32e80243a54711e5d7ce823c35c41c9d929dc4ab58e1276f625841aadf9" dependencies = [ "clap_builder", "clap_derive", @@ -538,9 +538,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.44" +version = "4.5.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3e7f4214277f3c7aa526a59dd3fbe306a370daee1f8b7b8c987069cd8e888a8" +checksum = "707eab41e9622f9139419d573eca0900137718000c517d47da73045f54331c3d" dependencies = [ "anstream", "anstyle", @@ -550,14 +550,14 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.45" +version = "4.5.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14cb31bb0a7d536caef2639baa7fad459e15c3144efefa6dbd1c84562c4739f6" +checksum = "ef4f52386a59ca4c860f7393bcf8abd8dfd91ecccc0f774635ff68e92eeef491" dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.104", ] [[package]] @@ -720,7 +720,7 @@ dependencies = [ "nom", "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.104", ] [[package]] @@ -907,9 +907,9 @@ dependencies = [ [[package]] name = "curl" -version = "0.4.49" +version = "0.4.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79fc3b6dd0b87ba36e565715bf9a2ced221311db47bd18011676f24a6066edbc" +checksum = "9e2d5c8f48d9c0c23250e52b55e82a6ab4fdba6650c931f5a0a57a43abda812b" dependencies = [ "curl-sys", "libc", @@ -922,9 +922,9 @@ dependencies = [ [[package]] name = "curl-sys" -version = "0.4.83+curl-8.15.0" +version = "0.4.82+curl-8.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5830daf304027db10c82632a464879d46a3f7c4ba17a31592657ad16c719b483" +checksum = "c4d63638b5ec65f1a4ae945287b3fd035be4554bbaf211901159c9a2a74fb5be" dependencies = [ "cc", "libc", @@ -962,7 +962,7 @@ dependencies = [ "proc-macro2", "quote", "scratch", - "syn 2.0.106", + "syn 2.0.104", ] [[package]] @@ -976,7 +976,7 @@ dependencies = [ "indexmap", "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.104", ] [[package]] @@ -995,7 +995,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.106", + "syn 2.0.104", ] [[package]] @@ -1019,7 +1019,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.106", + "syn 2.0.104", ] [[package]] @@ -1030,7 +1030,7 @@ checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" dependencies = [ "darling_core", "quote", - "syn 2.0.106", + "syn 2.0.104", ] [[package]] @@ -1056,13 +1056,13 @@ version = "0.1.92" [[package]] name = "derive-where" -version = "1.6.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef941ded77d15ca19b40374869ac6000af1c9f2a4c0f3d4c70926287e6364a8f" +checksum = "510c292c8cf384b1a340b816a9a6cf2599eb8f566a44949024af88418000c50b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.104", ] [[package]] @@ -1083,7 +1083,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.104", ] [[package]] @@ -1093,7 +1093,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab63b0e2bf4d5928aff72e83a7dace85d7bba5fe12dcc3c5a572d78caffd3f3c" dependencies = [ "derive_builder_core", - "syn 2.0.106", + "syn 2.0.104", ] [[package]] @@ -1105,7 +1105,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.104", ] [[package]] @@ -1160,7 +1160,7 @@ checksum = "e01a3366d27ee9890022452ee61b2b63a67e6f13f58900b651ff5665f0bb1fab" dependencies = [ "libc", "option-ext", - "redox_users 0.5.2", + "redox_users 0.5.0", "windows-sys 0.60.2", ] @@ -1183,7 +1183,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.104", ] [[package]] @@ -1194,9 +1194,9 @@ checksum = "8975ffdaa0ef3661bfe02dbdcc06c9f829dfafe6a3c474de366a8d5e44276921" [[package]] name = "dyn-clone" -version = "1.0.19" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c7a8fb8a9fbf66c1f703fe16184d10ca0ee9d23be5b4436400408ba54a95005" +checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555" [[package]] name = "either" @@ -1374,7 +1374,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "54f0d287c53ffd184d04d8677f590f4ac5379785529e5e08b1c8083acdd5c198" dependencies = [ "memchr", - "thiserror 2.0.15", + "thiserror 2.0.12", ] [[package]] @@ -1471,9 +1471,9 @@ dependencies = [ [[package]] name = "getopts" -version = "0.2.24" +version = "0.2.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfe4fbac503b8d1f88e6676011885f34b7174f46e59956bba534ba83abded4df" +checksum = "cba6ae63eb948698e300f645f87c70f76630d505f23b8907cf1e193ee85048c1" dependencies = [ "unicode-width 0.2.1", ] @@ -1540,9 +1540,9 @@ dependencies = [ [[package]] name = "glob" -version = "0.3.3" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280" +checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" [[package]] name = "globset" @@ -1568,9 +1568,9 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.15.5" +version = "0.15.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" +checksum = "5971ac85611da7067dbfcabef3c70ebb5606018acd9e2a3903a0da507521e0d5" dependencies = [ "allocator-api2", "equivalent", @@ -1852,9 +1852,9 @@ dependencies = [ [[package]] name = "indenter" -version = "0.3.4" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "964de6e86d545b246d84badc0fef527924ace5134f30641c203ef52ba83f58d5" +checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683" [[package]] name = "indexmap" @@ -1929,16 +1929,16 @@ dependencies = [ [[package]] name = "ipc-channel" -version = "0.20.1" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1700f6b8b9f00cdd675f32fbb3a5be882213140dfe045805273221ca266c43f8" +checksum = "5b1c98b70019c830a1fc39cecfe1f60ff99c4122f0a189697c810c90ec545c14" dependencies = [ "bincode", "crossbeam-channel", "fnv", "libc", "mio", - "rand 0.9.2", + "rand 0.9.1", "serde", "tempfile", "uuid", @@ -1987,7 +1987,7 @@ checksum = "03343451ff899767262ec32146f6d559dd759fdadf42ff0e227c7c48f72594b4" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.104", ] [[package]] @@ -2037,15 +2037,15 @@ dependencies = [ [[package]] name = "jsonpath-rust" -version = "1.0.4" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "633a7320c4bb672863a3782e89b9094ad70285e097ff6832cddd0ec615beadfa" +checksum = "7d057f8fd19e20c3f14d3663983397155739b6bc1148dc5cd4c4a1a5b3130eb0" dependencies = [ "pest", "pest_derive", "regex", "serde_json", - "thiserror 2.0.15", + "thiserror 2.0.12", ] [[package]] @@ -2133,7 +2133,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "07033963ba89ebaf1584d767badaa2e8fcec21aedea6b8c0346d487d49c28667" dependencies = [ "cfg-if", - "windows-targets 0.53.3", + "windows-targets 0.53.2", ] [[package]] @@ -2144,9 +2144,9 @@ checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" [[package]] name = "libredox" -version = "0.1.9" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "391290121bad3d37fbddad76d8f5d1c1c314cfc646d143d7e07a3086ddff0ce3" +checksum = "4488594b9328dee448adb906d8b126d9b7deb7cf5c22161ee591610bb1be83c0" dependencies = [ "bitflags", "libc", @@ -2275,7 +2275,7 @@ checksum = "88a9689d8d44bf9964484516275f5cd4c9b59457a6940c1d5d0ecbb94510a36b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.104", ] [[package]] @@ -2360,11 +2360,11 @@ dependencies = [ [[package]] name = "miow" -version = "0.6.1" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "536bfad37a309d62069485248eeaba1e8d9853aaf951caaeaed0585a95346f08" +checksum = "359f76430b20a79f9e20e115b3428614e654f04fab314482fc0fda0ebd3c6044" dependencies = [ - "windows-sys 0.60.2", + "windows-sys 0.48.0", ] [[package]] @@ -2386,7 +2386,7 @@ dependencies = [ "libloading", "measureme", "nix", - "rand 0.9.2", + "rand 0.9.1", "regex", "rustc_version", "serde", @@ -2581,9 +2581,9 @@ dependencies = [ [[package]] name = "object" -version = "0.37.3" +version = "0.37.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe" +checksum = "03fd943161069e1768b4b3d050890ba48730e590f57e56d4aa04e7e090e61b4a" dependencies = [ "crc32fast", "flate2", @@ -2591,7 +2591,7 @@ dependencies = [ "indexmap", "memchr", "ruzstd 0.8.1", - "wasmparser 0.236.1", + "wasmparser 0.234.0", ] [[package]] @@ -2772,7 +2772,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1db05f56d34358a8b1066f67cbb203ee3e7ed2ba674a6263a1d5ec6db2204323" dependencies = [ "memchr", - "thiserror 2.0.15", + "thiserror 2.0.12", "ucd-trie", ] @@ -2796,7 +2796,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.104", ] [[package]] @@ -2946,9 +2946,9 @@ checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" [[package]] name = "proc-macro2" -version = "1.0.101" +version = "1.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de" +checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" dependencies = [ "unicode-ident", ] @@ -3020,9 +3020,9 @@ dependencies = [ [[package]] name = "rand" -version = "0.9.2" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" +checksum = "9fbfd9d094a40bf3ae768db9361049ace4c0e04a4fd6b359518bd7b73a73dd97" dependencies = [ "rand_chacha 0.9.0", "rand_core 0.9.3", @@ -3086,9 +3086,9 @@ dependencies = [ [[package]] name = "rayon" -version = "1.11.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "368f01d005bf8fd9b1206fb6fa653e6c4a81ceb1466406b81792d87c5677a58f" +checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" dependencies = [ "either", "rayon-core", @@ -3096,9 +3096,9 @@ dependencies = [ [[package]] name = "rayon-core" -version = "1.13.0" +version = "1.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91" +checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" dependencies = [ "crossbeam-deque", "crossbeam-utils", @@ -3106,9 +3106,9 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.5.17" +version = "0.5.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5407465600fb0548f1442edf71dd20683c6ed326200ace4b1ef0763521bb3b77" +checksum = "0d04b7d0ee6b4a0207a0a7adb104d23ecb0b47d6beae7152d0fa34b692b29fd6" dependencies = [ "bitflags", ] @@ -3126,13 +3126,13 @@ dependencies = [ [[package]] name = "redox_users" -version = "0.5.2" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4e608c6638b9c18977b00b475ac1f28d14e84b27d8d42f70e0bf1e3dec127ac" +checksum = "dd6f9d3d47bdd2ad6945c5015a226ec6155d0bcdfd8f7cd29f86b71f8de99d2b" dependencies = [ "getrandom 0.2.16", "libredox", - "thiserror 2.0.15", + "thiserror 2.0.12", ] [[package]] @@ -3152,7 +3152,7 @@ checksum = "1165225c21bff1f3bbce98f5a1f889949bc902d3575308cc7b0de30b4f6d27c7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.104", ] [[package]] @@ -3229,7 +3229,7 @@ dependencies = [ "build_helper", "gimli 0.32.0", "libc", - "object 0.37.3", + "object 0.37.1", "regex", "serde_json", "similar", @@ -3251,9 +3251,9 @@ dependencies = [ [[package]] name = "rustc-demangle" -version = "0.1.26" +version = "0.1.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56f7d92ca342cea22a06f2121d944b4fd82af56988c270852495420f961d4ace" +checksum = "989e6739f80c4ad5b13e0fd7fe89531180375b18520cc8c82080e4dc4035b84f" [[package]] name = "rustc-hash" @@ -3315,7 +3315,7 @@ name = "rustc_abi" version = "0.0.0" dependencies = [ "bitflags", - "rand 0.9.2", + "rand 0.9.1", "rand_xoshiro", "rustc_data_structures", "rustc_error_messages", @@ -3521,7 +3521,7 @@ dependencies = [ "itertools", "libc", "measureme", - "object 0.37.3", + "object 0.37.1", "rustc-demangle", "rustc_abi", "rustc_ast", @@ -3559,7 +3559,7 @@ dependencies = [ "cc", "itertools", "libc", - "object 0.37.3", + "object 0.37.1", "pathdiff", "regex", "rustc_abi", @@ -3814,7 +3814,7 @@ dependencies = [ "fluent-syntax", "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.104", "unic-langid", ] @@ -3940,7 +3940,7 @@ dependencies = [ name = "rustc_incremental" version = "0.0.0" dependencies = [ - "rand 0.9.2", + "rand 0.9.1", "rustc_ast", "rustc_data_structures", "rustc_errors", @@ -3974,7 +3974,7 @@ version = "0.0.0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.104", ] [[package]] @@ -4119,7 +4119,7 @@ version = "0.0.0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.104", "synstructure", ] @@ -4539,7 +4539,7 @@ dependencies = [ "bitflags", "getopts", "libc", - "rand 0.9.2", + "rand 0.9.1", "rustc_abi", "rustc_ast", "rustc_data_structures", @@ -4603,7 +4603,7 @@ name = "rustc_target" version = "0.0.0" dependencies = [ "bitflags", - "object 0.37.3", + "object 0.37.1", "rustc_abi", "rustc_data_structures", "rustc_error_messages", @@ -4626,7 +4626,7 @@ dependencies = [ "crossbeam-deque", "crossbeam-utils", "libc", - "rand 0.9.2", + "rand 0.9.1", "rand_xorshift", "scoped-tls", "smallvec", @@ -4743,7 +4743,7 @@ version = "0.0.0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.104", "synstructure", ] @@ -4825,9 +4825,9 @@ dependencies = [ [[package]] name = "rustfix" -version = "0.8.7" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82fa69b198d894d84e23afde8e9ab2af4400b2cba20d6bf2b428a8b01c222c5a" +checksum = "81864b097046da5df3758fdc6e4822bbb70afa06317e8ca45ea1b51cb8c5e5a4" dependencies = [ "serde", "serde_json", @@ -4842,7 +4842,7 @@ dependencies = [ "proc-macro2", "quote", "serde", - "syn 2.0.106", + "syn 2.0.104", ] [[package]] @@ -4889,9 +4889,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.22" +version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" +checksum = "8a0d197bd2c9dc6e53b84da9556a69ba4cdfab8619eb41a8bd1cc2027a0f6b1d" [[package]] name = "ruzstd" @@ -4957,7 +4957,7 @@ dependencies = [ "proc-macro2", "quote", "serde_derive_internals", - "syn 2.0.106", + "syn 2.0.104", ] [[package]] @@ -5004,9 +5004,9 @@ dependencies = [ [[package]] name = "serde-untagged" -version = "0.1.8" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34836a629bcbc6f1afdf0907a744870039b1e14c0561cb26094fa683b158eff3" +checksum = "299d9c19d7d466db4ab10addd5703e4c615dec2a5a16dbbafe191045e87ee66e" dependencies = [ "erased-serde", "serde", @@ -5031,7 +5031,7 @@ checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.104", ] [[package]] @@ -5042,14 +5042,14 @@ checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.104", ] [[package]] name = "serde_json" -version = "1.0.142" +version = "1.0.141" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "030fedb782600dcbd6f02d479bf0d817ac3bb40d644745b769d6a96bc3afc5a7" +checksum = "30b9eff21ebe718216c6ec64e1d9ac57087aad11efc64e32002bce4a0d4c03d3" dependencies = [ "itoa", "memchr", @@ -5133,12 +5133,12 @@ checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" [[package]] name = "socket2" -version = "0.6.0" +version = "0.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "233504af464074f9d066d7b5416c5f9b894a5862a6506e306f7b816cdd6f1807" +checksum = "e22376abed350d73dd1cd119b57ffccad95b4e585a7cda43e286245ce23c0678" dependencies = [ "libc", - "windows-sys 0.59.0", + "windows-sys 0.52.0", ] [[package]] @@ -5278,9 +5278,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.106" +version = "2.0.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6" +checksum = "17b6f705963418cdb9927482fa304bc562ece2fdd4f616084c50b7023b435a40" dependencies = [ "proc-macro2", "quote", @@ -5295,7 +5295,7 @@ checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.104", ] [[package]] @@ -5391,7 +5391,7 @@ version = "0.1.0" dependencies = [ "indicatif", "num", - "rand 0.9.2", + "rand 0.9.1", "rand_chacha 0.9.0", "rayon", ] @@ -5413,11 +5413,11 @@ dependencies = [ [[package]] name = "thiserror" -version = "2.0.15" +version = "2.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80d76d3f064b981389ecb4b6b7f45a0bf9fdac1d5b9204c7bd6714fecc302850" +checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708" dependencies = [ - "thiserror-impl 2.0.15", + "thiserror-impl 2.0.12", ] [[package]] @@ -5428,18 +5428,18 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.104", ] [[package]] name = "thiserror-impl" -version = "2.0.15" +version = "2.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d29feb33e986b6ea906bd9c3559a856983f92371b3eaa5e83782a351623de0" +checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.104", ] [[package]] @@ -5616,7 +5616,7 @@ checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.104", ] [[package]] @@ -5799,7 +5799,7 @@ checksum = "a1249a628de3ad34b821ecb1001355bca3940bcb2f88558f1a8bd82e977f75b5" dependencies = [ "proc-macro-hack", "quote", - "syn 2.0.106", + "syn 2.0.104", "unic-langid-impl", ] @@ -5937,9 +5937,9 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "uuid" -version = "1.18.0" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f33196643e165781c20a5ead5582283a7dacbb87855d867fbc2df3f81eddc1be" +checksum = "3cf4199d1e5d15ddd86a694e4d0dffa9c323ce759fea589f00fef9d81cc1931d" dependencies = [ "getrandom 0.3.3", "js-sys", @@ -5991,9 +5991,9 @@ dependencies = [ [[package]] name = "wasi-preview1-component-adapter-provider" -version = "36.0.1" +version = "36.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20689c88791776219f78c2529700d15e6a9bd57a27858c62e9ef8487956b571c" +checksum = "4da2ec25ddcaf86d98cd2e1928af72963bc24318cf22fee36c61953bc5fd9f28" [[package]] name = "wasm-bindgen" @@ -6017,7 +6017,7 @@ dependencies = [ "log", "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.104", "wasm-bindgen-shared", ] @@ -6039,7 +6039,7 @@ checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.104", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -6122,6 +6122,15 @@ dependencies = [ "indexmap", ] +[[package]] +name = "wasmparser" +version = "0.234.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be22e5a8f600afce671dd53c8d2dd26b4b7aa810fd18ae27dfc49737f3e02fc5" +dependencies = [ + "bitflags", +] + [[package]] name = "wasmparser" version = "0.236.1" @@ -6296,7 +6305,7 @@ checksum = "2bbd5b46c938e506ecbce286b6628a02171d56153ba733b6c741fc627ec9579b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.104", ] [[package]] @@ -6307,7 +6316,7 @@ checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.104", ] [[package]] @@ -6318,7 +6327,7 @@ checksum = "053c4c462dc91d3b1504c6fe5a726dd15e216ba718e84a0e46a88fbe5ded3515" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.104", ] [[package]] @@ -6329,7 +6338,7 @@ checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.104", ] [[package]] @@ -6385,6 +6394,15 @@ dependencies = [ "windows-link", ] +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", +] + [[package]] name = "windows-sys" version = "0.52.0" @@ -6409,7 +6427,22 @@ version = "0.60.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" dependencies = [ - "windows-targets 0.53.3", + "windows-targets 0.53.2", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", ] [[package]] @@ -6430,11 +6463,10 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.53.3" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5fe6031c4041849d7c496a8ded650796e7b6ecc19df1a431c1a363342e5dc91" +checksum = "c66f69fcc9ce11da9966ddb31a40968cad001c5bedeb5c2b82ede4253ab48aef" dependencies = [ - "windows-link", "windows_aarch64_gnullvm 0.53.0", "windows_aarch64_msvc 0.53.0", "windows_i686_gnu 0.53.0", @@ -6454,6 +6486,12 @@ dependencies = [ "windows-link", ] +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + [[package]] name = "windows_aarch64_gnullvm" version = "0.52.6" @@ -6466,6 +6504,12 @@ version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764" +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + [[package]] name = "windows_aarch64_msvc" version = "0.52.6" @@ -6478,6 +6522,12 @@ version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c" +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + [[package]] name = "windows_i686_gnu" version = "0.52.6" @@ -6502,6 +6552,12 @@ version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11" +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + [[package]] name = "windows_i686_msvc" version = "0.52.6" @@ -6514,6 +6570,12 @@ version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d" +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + [[package]] name = "windows_x86_64_gnu" version = "0.52.6" @@ -6526,6 +6588,12 @@ version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + [[package]] name = "windows_x86_64_gnullvm" version = "0.52.6" @@ -6538,6 +6606,12 @@ version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57" +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + [[package]] name = "windows_x86_64_msvc" version = "0.52.6" @@ -6678,7 +6752,7 @@ checksum = "38da3c9736e16c5d3c8c597a9aaa5d1fa565d0532ae05e27c24aa62fb32c0ab6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.104", "synstructure", ] @@ -6699,7 +6773,7 @@ checksum = "9ecf5b4cc5364572d7f4c329661bcc82724222973f2cab6f050a4e5c22f75181" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.104", ] [[package]] @@ -6719,7 +6793,7 @@ checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.104", "synstructure", ] @@ -6736,9 +6810,9 @@ dependencies = [ [[package]] name = "zerovec" -version = "0.11.4" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7aa2bd55086f1ab526693ecbe444205da57e25f4489879da80635a46d90e73b" +checksum = "4a05eb080e015ba39cc9e23bbe5e7fb04d5fb040350f99f34e338d5fdd294428" dependencies = [ "yoke", "zerofrom", @@ -6753,5 +6827,5 @@ checksum = "5b96237efa0c878c64bd89c436f661be4e46b2f3eff1ebb976f7ef2321d2f58f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.104", ] diff --git a/compiler/rustc_hir_analysis/messages.ftl b/compiler/rustc_hir_analysis/messages.ftl index 06f2ec512ab1f..5a0deec7ceac0 100644 --- a/compiler/rustc_hir_analysis/messages.ftl +++ b/compiler/rustc_hir_analysis/messages.ftl @@ -117,6 +117,11 @@ 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_conflict_impl_drop_and_pin_drop = conflict implementation of `Drop::drop` and `Drop::pin_drop` + .drop_label = `drop(&mut self)` implemented here + .pin_drop_label = `pin_drop(&pin mut self)` implemented here + .suggestion = remove this implementation + hir_analysis_const_bound_for_non_const_trait = `{$modifier}` can only be applied to `const` traits .label = can't be applied to `{$trait_name}` .note = `{$trait_name}` can't be used with `{$modifier}` because it isn't `const` diff --git a/compiler/rustc_hir_analysis/src/check/always_applicable.rs b/compiler/rustc_hir_analysis/src/check/always_applicable.rs index 58c3020f60ede..d706ae5b5b480 100644 --- a/compiler/rustc_hir_analysis/src/check/always_applicable.rs +++ b/compiler/rustc_hir_analysis/src/check/always_applicable.rs @@ -7,11 +7,13 @@ use rustc_data_structures::fx::FxHashSet; use rustc_errors::codes::*; use rustc_errors::{ErrorGuaranteed, struct_span_code_err}; +use rustc_hir as hir; use rustc_infer::infer::{RegionResolutionError, TyCtxtInferExt}; use rustc_infer::traits::{ObligationCause, ObligationCauseCode}; use rustc_middle::span_bug; use rustc_middle::ty::util::CheckRegions; use rustc_middle::ty::{self, GenericArgsRef, Ty, TyCtxt, TypingMode}; +use rustc_span::sym; use rustc_trait_selection::regions::InferCtxtRegionExt; use rustc_trait_selection::traits::{self, ObligationCtxt}; @@ -70,7 +72,11 @@ pub(crate) fn check_drop_impl( drop_impl_did, adt_def.did(), adt_to_impl_args, - ) + )?; + + check_drop_xor_pin_drop(tcx, drop_impl_did)?; + + Ok(()) } _ => { span_bug!(tcx.def_span(drop_impl_did), "incoherent impl of Drop"); @@ -294,3 +300,58 @@ fn ensure_impl_predicates_are_implied_by_item_defn<'tcx>( Ok(()) } + +/// This function checks at least and at most one of `Drop::drop` and `Drop::pin_drop` is implemented. +fn check_drop_xor_pin_drop<'tcx>( + tcx: TyCtxt<'tcx>, + drop_impl_did: LocalDefId, +) -> Result<(), ErrorGuaranteed> { + let item_impl = tcx.hir_expect_item(drop_impl_did).expect_impl(); + let mut drop_span = None; + let mut pin_drop_span = None; + for &impl_item_id in item_impl.items { + let impl_item = tcx.hir_impl_item(impl_item_id); + if let hir::ImplItemKind::Fn(fn_sig, _) = impl_item.kind { + match impl_item.ident.name { + sym::drop => drop_span = Some(fn_sig.span), + sym::pin_drop => pin_drop_span = Some(fn_sig.span), + _ => {} + } + } + } + + match (drop_span, pin_drop_span) { + (None, None) => { + if tcx.features().pin_ergonomics() { + return Err(tcx.dcx().emit_err(crate::errors::MissingOneOfTraitItem { + span: tcx.def_span(drop_impl_did), + note: None, + missing_items_msg: "drop`, `pin_drop".to_string(), + })); + } else { + return Err(tcx + .dcx() + .span_delayed_bug(tcx.def_span(drop_impl_did), "missing `Drop::drop`")); + } + } + // FIXME(pin_ergonomics): reject `Drop::drop` for types that support pin-projection. + (Some(_span), None) => {} + (None, Some(span)) => { + if !tcx.features().pin_ergonomics() { + return Err(tcx.dcx().span_delayed_bug( + span, + "`Drop::pin_drop` should be guarded by the library feature gate", + )); + } + // FIXME(pin_ergonomics): reject `Drop::pin_drop` for types that don't support pin-projection. + } + (Some(drop_span), Some(pin_drop_span)) => { + return Err(tcx.dcx().emit_err(crate::errors::ConflictImplDropAndPinDrop { + span: tcx.def_span(drop_impl_did), + drop_span, + pin_drop_span, + })); + } + } + Ok(()) +} diff --git a/compiler/rustc_hir_analysis/src/check/check.rs b/compiler/rustc_hir_analysis/src/check/check.rs index 886ebddc75c97..f81f2fc4e8c4b 100644 --- a/compiler/rustc_hir_analysis/src/check/check.rs +++ b/compiler/rustc_hir_analysis/src/check/check.rs @@ -26,6 +26,7 @@ use rustc_middle::ty::{ TypeVisitable, TypeVisitableExt, fold_regions, }; use rustc_session::lint::builtin::UNINHABITED_STATIC; +use rustc_span::sym; use rustc_target::spec::{AbiMap, AbiMapping}; use rustc_trait_selection::error_reporting::InferCtxtErrorExt; use rustc_trait_selection::error_reporting::traits::on_unimplemented::OnUnimplementedDirective; diff --git a/compiler/rustc_hir_analysis/src/check/mod.rs b/compiler/rustc_hir_analysis/src/check/mod.rs index e70d5505aae36..2b666ad50f15e 100644 --- a/compiler/rustc_hir_analysis/src/check/mod.rs +++ b/compiler/rustc_hir_analysis/src/check/mod.rs @@ -92,7 +92,7 @@ use rustc_middle::ty::{ use rustc_middle::{bug, span_bug}; use rustc_session::parse::feature_err; use rustc_span::def_id::CRATE_DEF_ID; -use rustc_span::{BytePos, DUMMY_SP, Ident, Span, Symbol, kw, sym}; +use rustc_span::{BytePos, DUMMY_SP, Ident, Span, Symbol, kw}; use rustc_trait_selection::error_reporting::InferCtxtErrorExt; use rustc_trait_selection::error_reporting::infer::ObligationCauseExt as _; use rustc_trait_selection::error_reporting::traits::suggestions::ReturnsVisitor; diff --git a/compiler/rustc_hir_analysis/src/errors.rs b/compiler/rustc_hir_analysis/src/errors.rs index 3b6367219b7ff..e4bc85f2a2665 100644 --- a/compiler/rustc_hir_analysis/src/errors.rs +++ b/compiler/rustc_hir_analysis/src/errors.rs @@ -1707,3 +1707,14 @@ pub(crate) struct AsyncDropWithoutSyncDrop { #[primary_span] pub span: Span, } + +#[derive(Diagnostic)] +#[diag(hir_analysis_conflict_impl_drop_and_pin_drop)] +pub(crate) struct ConflictImplDropAndPinDrop { + #[primary_span] + pub span: Span, + #[label(hir_analysis_drop_label)] + pub drop_span: Span, + #[label(hir_analysis_pin_drop_label)] + pub pin_drop_span: Span, +} diff --git a/compiler/rustc_hir_typeck/src/callee.rs b/compiler/rustc_hir_typeck/src/callee.rs index f59fcab46661f..5d01ebb04961e 100644 --- a/compiler/rustc_hir_typeck/src/callee.rs +++ b/compiler/rustc_hir_typeck/src/callee.rs @@ -37,9 +37,13 @@ pub(crate) fn check_legal_trait_for_method_call( receiver: Option, expr_span: Span, trait_id: DefId, - _body_id: DefId, + body_id: DefId, ) -> Result<(), ErrorGuaranteed> { - if tcx.is_lang_item(trait_id, LangItem::Drop) { + if tcx.is_lang_item(trait_id, LangItem::Drop) + // Allow calling `Drop::pin_drop` in `Drop::drop` + && let Some(parent) = tcx.opt_parent(body_id) + && !tcx.is_lang_item(parent, LangItem::Drop) + { let sugg = if let Some(receiver) = receiver.filter(|s| !s.is_empty()) { errors::ExplicitDestructorCallSugg::Snippet { lo: expr_span.shrink_to_lo(), diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index 4fef65f46b1fd..315cfde390405 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -1650,6 +1650,7 @@ symbols! { pic, pie, pin, + pin_drop, pin_ergonomics, pin_macro, platform_intrinsics, diff --git a/library/core/src/ops/drop.rs b/library/core/src/ops/drop.rs index 7125bf54701bb..7f7714c4a554a 100644 --- a/library/core/src/ops/drop.rs +++ b/library/core/src/ops/drop.rs @@ -1,3 +1,5 @@ +use crate::pin::Pin; + /// Custom code within the destructor. /// /// When a value is no longer needed, Rust will run a "destructor" on that value. @@ -237,5 +239,27 @@ pub const trait Drop { /// [`mem::drop`]: drop /// [`ptr::drop_in_place`]: crate::ptr::drop_in_place #[stable(feature = "rust1", since = "1.0.0")] - fn drop(&mut self); + #[rustc_default_body_unstable(feature = "pin_ergonomics", issue = "130494")] + fn drop(&mut self) { + // SAFETY: `self` is pinned till after dropped. + Drop::pin_drop(unsafe { Pin::new_unchecked(self) }) + } + + /// Execute the destructor for this type, but different to [`Drop::drop`], it requires `self` + /// to be pinned. + /// + /// By implementing this method instead of [`Drop::drop`], the receiver type [`Pin<&mut Self>`] + /// makes sure that the value is pinned until it is deallocated (See [`std::pin` module docs] for + /// more details), which enables us to support field projections of `Self` type safely. + /// + /// At least and at most one of [`Drop::drop`] and [`Drop::pin_drop`] should be implemented. + /// + // FIXME(pin_ergonomics): add requirements: `pin_drop` must be and must only be used + // for types that support pin-projection. + /// [`Drop::drop`]: crate::ops::Drop::drop + /// [`Drop::pin_drop`]: crate::ops::Drop::pin_drop + /// [`Pin<&mut Self>`]: crate::pin::Pin + /// [`std::pin` module docs]: crate::pin + #[unstable(feature = "pin_ergonomics", issue = "130494")] + fn pin_drop(self: Pin<&mut Self>) {} } diff --git a/tests/codegen-units/item-collection/drop-glue-eager.rs b/tests/codegen-units/item-collection/drop-glue-eager.rs index cc0ea701e66f3..9c768692bb8f6 100644 --- a/tests/codegen-units/item-collection/drop-glue-eager.rs +++ b/tests/codegen-units/item-collection/drop-glue-eager.rs @@ -10,6 +10,7 @@ struct StructWithDrop { impl Drop for StructWithDrop { //~ MONO_ITEM fn ::drop + //~ MONO_ITEM fn ::pin_drop fn drop(&mut self) {} } @@ -24,6 +25,7 @@ enum EnumWithDrop { impl Drop for EnumWithDrop { //~ MONO_ITEM fn ::drop + //~ MONO_ITEM fn ::pin_drop fn drop(&mut self) {} } @@ -34,6 +36,7 @@ enum EnumNoDrop { // We should be able to monomorphize drops for struct with lifetimes. impl<'a> Drop for StructWithDropAndLt<'a> { //~ MONO_ITEM fn as std::ops::Drop>::drop + //~ MONO_ITEM fn as std::ops::Drop>::pin_drop fn drop(&mut self) {} } @@ -52,5 +55,6 @@ struct StructWithLtAndPredicate<'a: 'a> { // We should be able to monomorphize drops for struct with lifetimes. impl<'a> Drop for StructWithLtAndPredicate<'a> { //~ MONO_ITEM fn as std::ops::Drop>::drop + //~ MONO_ITEM fn as std::ops::Drop>::pin_drop fn drop(&mut self) {} } diff --git a/tests/codegen-units/item-collection/drop_in_place_intrinsic.rs b/tests/codegen-units/item-collection/drop_in_place_intrinsic.rs index ef8f916539395..00fe4c3413a29 100644 --- a/tests/codegen-units/item-collection/drop_in_place_intrinsic.rs +++ b/tests/codegen-units/item-collection/drop_in_place_intrinsic.rs @@ -9,6 +9,7 @@ struct StructWithDtor(u32); impl Drop for StructWithDtor { //~ MONO_ITEM fn ::drop + //~ MONO_ITEM fn ::pin_drop fn drop(&mut self) {} } diff --git a/tests/codegen-units/item-collection/generic-drop-glue.rs b/tests/codegen-units/item-collection/generic-drop-glue.rs index b4c6c231e3d62..7b7d536938f2d 100644 --- a/tests/codegen-units/item-collection/generic-drop-glue.rs +++ b/tests/codegen-units/item-collection/generic-drop-glue.rs @@ -39,6 +39,7 @@ struct NonGenericWithDrop(#[allow(dead_code)] i32); impl Drop for NonGenericWithDrop { //~ MONO_ITEM fn ::drop + //~ MONO_ITEM fn ::pin_drop fn drop(&mut self) {} } diff --git a/tests/codegen-units/item-collection/non-generic-closures.rs b/tests/codegen-units/item-collection/non-generic-closures.rs index 2d9c461e6fd2d..cba53e6905882 100644 --- a/tests/codegen-units/item-collection/non-generic-closures.rs +++ b/tests/codegen-units/item-collection/non-generic-closures.rs @@ -74,5 +74,6 @@ struct PresentDrop; impl Drop for PresentDrop { //~ MONO_ITEM fn ::drop @@ non_generic_closures-cgu.0[External] + //~ MONO_ITEM fn ::pin_drop @@ non_generic_closures-cgu.0[External] fn drop(&mut self) {} } diff --git a/tests/codegen-units/item-collection/non-generic-drop-glue.rs b/tests/codegen-units/item-collection/non-generic-drop-glue.rs index d83336f4d78d9..4722374fcad4c 100644 --- a/tests/codegen-units/item-collection/non-generic-drop-glue.rs +++ b/tests/codegen-units/item-collection/non-generic-drop-glue.rs @@ -11,6 +11,7 @@ struct StructWithDrop { impl Drop for StructWithDrop { //~ MONO_ITEM fn ::drop + //~ MONO_ITEM fn ::pin_drop fn drop(&mut self) {} } @@ -25,6 +26,7 @@ enum EnumWithDrop { impl Drop for EnumWithDrop { //~ MONO_ITEM fn ::drop + //~ MONO_ITEM fn ::pin_drop fn drop(&mut self) {} } diff --git a/tests/codegen-units/item-collection/transitive-drop-glue.rs b/tests/codegen-units/item-collection/transitive-drop-glue.rs index 844d74526f413..914a47348a7d0 100644 --- a/tests/codegen-units/item-collection/transitive-drop-glue.rs +++ b/tests/codegen-units/item-collection/transitive-drop-glue.rs @@ -13,6 +13,7 @@ struct Leaf; impl Drop for Leaf { //~ MONO_ITEM fn ::drop + //~ MONO_ITEM fn ::pin_drop fn drop(&mut self) {} } diff --git a/tests/codegen-units/item-collection/tuple-drop-glue.rs b/tests/codegen-units/item-collection/tuple-drop-glue.rs index 4380735597a4e..8482b997d8355 100644 --- a/tests/codegen-units/item-collection/tuple-drop-glue.rs +++ b/tests/codegen-units/item-collection/tuple-drop-glue.rs @@ -9,6 +9,7 @@ struct Dropped; impl Drop for Dropped { //~ MONO_ITEM fn ::drop + //~ MONO_ITEM fn ::pin_drop fn drop(&mut self) {} } diff --git a/tests/crashes/122630.rs b/tests/crashes/122630.rs deleted file mode 100644 index e66624431c510..0000000000000 --- a/tests/crashes/122630.rs +++ /dev/null @@ -1,22 +0,0 @@ -//@ known-bug: #122630 -//@ compile-flags: -Zvalidate-mir - -use std::ops::Coroutine; - -const FOO_SIZE: usize = 1024; -struct Foo([u8; FOO_SIZE]); - -impl Drop for Foo { - fn move_before_yield_with_noop() -> impl Coroutine {} -} - -fn overlap_move_points() -> impl Coroutine { - static || { - let first = Foo([0; FOO_SIZE]); - yield; - let second = first; - yield; - let second = first; - yield; - } -} diff --git a/tests/ui/associated-types/associated-types-for-unimpl-trait.fixed b/tests/ui/associated-types/associated-types-for-unimpl-trait.fixed index ae4d0107aee52..bce6148f9e199 100644 --- a/tests/ui/associated-types/associated-types-for-unimpl-trait.fixed +++ b/tests/ui/associated-types/associated-types-for-unimpl-trait.fixed @@ -8,7 +8,7 @@ trait Get { } trait Other { - fn uhoh(&self, foo: U, bar: ::Value) where Self: Sized, Self: Get {} + fn uhoh(&self, foo: U, bar: ::Value) where Self: Sized, Self: Get, Self: Get {} //~^ ERROR the trait bound `Self: Get` is not satisfied //~| ERROR the trait bound `Self: Get` is not satisfied } diff --git a/tests/ui/async-await/async-drop/unexpected-sort.rs b/tests/ui/async-await/async-drop/unexpected-sort.rs index 659e21eb24119..acfbe229da311 100644 --- a/tests/ui/async-await/async-drop/unexpected-sort.rs +++ b/tests/ui/async-await/async-drop/unexpected-sort.rs @@ -6,10 +6,12 @@ #![feature(async_drop)] use std::future::AsyncDrop; struct a; -impl Drop for a { //~ ERROR: not all trait items implemented, missing: `drop` +impl Drop for a { + //~^ ERROR: not all trait items implemented, missing: `drop` fn b() {} //~ ERROR: method `b` is not a member of trait `Drop` } -impl AsyncDrop for a { //~ ERROR: not all trait items implemented, missing: `drop` +impl AsyncDrop for a { + //~^ ERROR: not all trait items implemented, missing: `drop` type c = (); //~^ ERROR: type `c` is not a member of trait `AsyncDrop` } diff --git a/tests/ui/async-await/async-drop/unexpected-sort.stderr b/tests/ui/async-await/async-drop/unexpected-sort.stderr index a6e4f9fd57307..c526487c5ea5a 100644 --- a/tests/ui/async-await/async-drop/unexpected-sort.stderr +++ b/tests/ui/async-await/async-drop/unexpected-sort.stderr @@ -1,11 +1,11 @@ error[E0407]: method `b` is not a member of trait `Drop` - --> $DIR/unexpected-sort.rs:10:5 + --> $DIR/unexpected-sort.rs:11:5 | LL | fn b() {} | ^^^^^^^^^ not a member of trait `Drop` error[E0437]: type `c` is not a member of trait `AsyncDrop` - --> $DIR/unexpected-sort.rs:13:5 + --> $DIR/unexpected-sort.rs:15:5 | LL | type c = (); | ^^^^^^^^^^^^ not a member of trait `AsyncDrop` @@ -13,13 +13,20 @@ LL | type c = (); error[E0046]: not all trait items implemented, missing: `drop` --> $DIR/unexpected-sort.rs:9:1 | -LL | impl Drop for a { - | ^^^^^^^^^^^^^^^ missing `drop` in implementation +LL | / impl Drop for a { +LL | | +LL | | fn b() {} +LL | | } + | |_^ | - = help: implement the missing item: `fn drop(&mut self) { todo!() }` + = note: default implementation of `drop` is unstable + = note: use of unstable library feature `pin_ergonomics` + = note: see issue #130494 for more information + = help: add `#![feature(pin_ergonomics)]` 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[E0046]: not all trait items implemented, missing: `drop` - --> $DIR/unexpected-sort.rs:12:1 + --> $DIR/unexpected-sort.rs:13:1 | LL | impl AsyncDrop for a { | ^^^^^^^^^^^^^^^^^^^^ missing `drop` in implementation diff --git a/tests/ui/coroutine/missing-drop-in-Drop.rs b/tests/ui/coroutine/missing-drop-in-Drop.rs new file mode 100644 index 0000000000000..51db803a38d70 --- /dev/null +++ b/tests/ui/coroutine/missing-drop-in-Drop.rs @@ -0,0 +1,42 @@ +// issue #122630: ICE Assignment between coroutine saved locals whose storage is not +// marked as conflicting +//@ compile-flags: -Zvalidate-mir + +use std::ops::Coroutine; +//~^ ERROR use of unstable library feature `coroutine_trait` + +const FOO_SIZE: usize = 1024; +struct Foo([u8; FOO_SIZE]); + +impl Drop for Foo { + //~^ ERROR not all trait items implemented, missing: `drop` + fn move_before_yield_with_noop() -> impl Coroutine {} + //~^ ERROR method `move_before_yield_with_noop` is not a member of trait `Drop` + //~| ERROR use of unstable library feature `coroutine_trait` + //~| ERROR use of unstable library feature `coroutine_trait` + //~| ERROR use of unstable library feature `coroutine_trait` + //~| ERROR the trait bound `(): Coroutine` is not satisfied +} + +fn overlap_move_points() -> impl Coroutine { + //~^ ERROR use of unstable library feature `coroutine_trait` + //~| ERROR use of unstable library feature `coroutine_trait` + //~| ERROR use of unstable library feature `coroutine_trait` + static || { + //~^ ERROR coroutine syntax is experimental + let first = Foo([0; FOO_SIZE]); + yield; + //~^ ERROR yield syntax is experimental + //~| ERROR yield syntax is experimental + //~| ERROR `yield` can only be used in `#[coroutine]` closures, or `gen` blocks + let second = first; + yield; + //~^ ERROR yield syntax is experimental + //~| ERROR yield syntax is experimental + let second = first; //~ ERROR use of moved value: `first` + yield; + //~^ ERROR yield syntax is experimental + //~| ERROR yield syntax is experimental + } +} +//~^ ERROR `main` function not found diff --git a/tests/ui/coroutine/missing-drop-in-Drop.stderr b/tests/ui/coroutine/missing-drop-in-Drop.stderr new file mode 100644 index 0000000000000..6c62de26d3e78 --- /dev/null +++ b/tests/ui/coroutine/missing-drop-in-Drop.stderr @@ -0,0 +1,212 @@ +error[E0407]: method `move_before_yield_with_noop` is not a member of trait `Drop` + --> $DIR/missing-drop-in-Drop.rs:13:5 + | +LL | fn move_before_yield_with_noop() -> impl Coroutine {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not a member of trait `Drop` + +error[E0658]: yield syntax is experimental + --> $DIR/missing-drop-in-Drop.rs:28:9 + | +LL | yield; + | ^^^^^ + | + = note: see issue #43122 for more information + = help: add `#![feature(yield_expr)]` 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]: yield syntax is experimental + --> $DIR/missing-drop-in-Drop.rs:33:9 + | +LL | yield; + | ^^^^^ + | + = note: see issue #43122 for more information + = help: add `#![feature(yield_expr)]` 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]: yield syntax is experimental + --> $DIR/missing-drop-in-Drop.rs:37:9 + | +LL | yield; + | ^^^^^ + | + = note: see issue #43122 for more information + = help: add `#![feature(yield_expr)]` 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]: coroutine syntax is experimental + --> $DIR/missing-drop-in-Drop.rs:25:5 + | +LL | static || { + | ^^^^^^ + | + = note: see issue #43122 for more information + = help: add `#![feature(coroutines)]` 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]: yield syntax is experimental + --> $DIR/missing-drop-in-Drop.rs:28:9 + | +LL | yield; + | ^^^^^ + | + = note: see issue #43122 for more information + = help: add `#![feature(yield_expr)]` 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: `yield` can only be used in `#[coroutine]` closures, or `gen` blocks + --> $DIR/missing-drop-in-Drop.rs:28:9 + | +LL | yield; + | ^^^^^ + | +help: use `#[coroutine]` to make this closure a coroutine + | +LL | #[coroutine] static || { + | ++++++++++++ + +error[E0658]: yield syntax is experimental + --> $DIR/missing-drop-in-Drop.rs:33:9 + | +LL | yield; + | ^^^^^ + | + = note: see issue #43122 for more information + = help: add `#![feature(yield_expr)]` 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]: yield syntax is experimental + --> $DIR/missing-drop-in-Drop.rs:37:9 + | +LL | yield; + | ^^^^^ + | + = note: see issue #43122 for more information + = help: add `#![feature(yield_expr)]` 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[E0601]: `main` function not found in crate `missing_drop_in_Drop` + --> $DIR/missing-drop-in-Drop.rs:41:2 + | +LL | } + | ^ consider adding a `main` function to `$DIR/missing-drop-in-Drop.rs` + +error[E0658]: use of unstable library feature `coroutine_trait` + --> $DIR/missing-drop-in-Drop.rs:5:5 + | +LL | use std::ops::Coroutine; + | ^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #43122 for more information + = help: add `#![feature(coroutine_trait)]` 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]: use of unstable library feature `coroutine_trait` + --> $DIR/missing-drop-in-Drop.rs:21:34 + | +LL | fn overlap_move_points() -> impl Coroutine { + | ^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #43122 for more information + = help: add `#![feature(coroutine_trait)]` 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]: use of unstable library feature `coroutine_trait` + --> $DIR/missing-drop-in-Drop.rs:13:46 + | +LL | fn move_before_yield_with_noop() -> impl Coroutine {} + | ^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #43122 for more information + = help: add `#![feature(coroutine_trait)]` 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[E0046]: not all trait items implemented, missing: `drop` + --> $DIR/missing-drop-in-Drop.rs:11:1 + | +LL | / impl Drop for Foo { +LL | | +LL | | fn move_before_yield_with_noop() -> impl Coroutine {} +... | +LL | | } + | |_^ + | + = note: default implementation of `drop` is unstable + = note: use of unstable library feature `pin_ergonomics` + = note: see issue #130494 for more information + = help: add `#![feature(pin_ergonomics)]` 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]: use of unstable library feature `coroutine_trait` + --> $DIR/missing-drop-in-Drop.rs:21:44 + | +LL | fn overlap_move_points() -> impl Coroutine { + | ^^^^^^^^^^ + | + = note: see issue #43122 for more information + = help: add `#![feature(coroutine_trait)]` 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]: use of unstable library feature `coroutine_trait` + --> $DIR/missing-drop-in-Drop.rs:13:56 + | +LL | fn move_before_yield_with_noop() -> impl Coroutine {} + | ^^^^^^^^^^ + | + = note: see issue #43122 for more information + = help: add `#![feature(coroutine_trait)]` 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[E0277]: the trait bound `(): Coroutine` is not satisfied + --> $DIR/missing-drop-in-Drop.rs:13:41 + | +LL | fn move_before_yield_with_noop() -> impl Coroutine {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Coroutine` is not implemented for `()` + +error[E0658]: use of unstable library feature `coroutine_trait` + --> $DIR/missing-drop-in-Drop.rs:13:56 + | +LL | fn move_before_yield_with_noop() -> impl Coroutine {} + | ^^^^^^^^^^ + | + = note: see issue #43122 for more information + = help: add `#![feature(coroutine_trait)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error[E0658]: use of unstable library feature `coroutine_trait` + --> $DIR/missing-drop-in-Drop.rs:21:44 + | +LL | fn overlap_move_points() -> impl Coroutine { + | ^^^^^^^^^^ + | + = note: see issue #43122 for more information + = help: add `#![feature(coroutine_trait)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error[E0382]: use of moved value: `first` + --> $DIR/missing-drop-in-Drop.rs:36:22 + | +LL | let first = Foo([0; FOO_SIZE]); + | ----- move occurs because `first` has type `Foo`, which does not implement the `Copy` trait +... +LL | let second = first; + | ----- value moved here +... +LL | let second = first; + | ^^^^^ value used here after move + | +note: if `Foo` implemented `Clone`, you could clone the value + --> $DIR/missing-drop-in-Drop.rs:9:1 + | +LL | struct Foo([u8; FOO_SIZE]); + | ^^^^^^^^^^ consider implementing `Clone` for this type +... +LL | let second = first; + | ----- you could clone this value + +error: aborting due to 20 previous errors + +Some errors have detailed explanations: E0046, E0277, E0382, E0407, E0601, E0658. +For more information about an error, try `rustc --explain E0046`. diff --git a/tests/ui/drop/missing-drop-method.stderr b/tests/ui/drop/missing-drop-method.stderr index 1128f33e627b3..64d06ac289266 100644 --- a/tests/ui/drop/missing-drop-method.stderr +++ b/tests/ui/drop/missing-drop-method.stderr @@ -2,9 +2,13 @@ error[E0046]: not all trait items implemented, missing: `drop` --> $DIR/missing-drop-method.rs:2:1 | LL | impl Drop for DropNoMethod {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `drop` in implementation + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = help: implement the missing item: `fn drop(&mut self) { todo!() }` + = note: default implementation of `drop` is unstable + = note: use of unstable library feature `pin_ergonomics` + = note: see issue #130494 for more information + = help: add `#![feature(pin_ergonomics)]` 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 1 previous error diff --git a/tests/ui/drop/nonsense-drop-impl-issue-139278.stderr b/tests/ui/drop/nonsense-drop-impl-issue-139278.stderr index 825e883fa6d8a..eeecc3e854805 100644 --- a/tests/ui/drop/nonsense-drop-impl-issue-139278.stderr +++ b/tests/ui/drop/nonsense-drop-impl-issue-139278.stderr @@ -7,10 +7,16 @@ LL | const SPLOK: u32 = 0; error[E0046]: not all trait items implemented, missing: `drop` --> $DIR/nonsense-drop-impl-issue-139278.rs:4:1 | -LL | impl Drop for Foo { - | ^^^^^^^^^^^^^^^^^ missing `drop` in implementation +LL | / impl Drop for Foo { +LL | | const SPLOK: u32 = 0; +LL | | } + | |_^ | - = help: implement the missing item: `fn drop(&mut self) { todo!() }` + = note: default implementation of `drop` is unstable + = note: use of unstable library feature `pin_ergonomics` + = note: see issue #130494 for more information + = help: add `#![feature(pin_ergonomics)]` 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 2 previous errors diff --git a/tests/ui/dropck/unconstrained_const_param_on_drop.stderr b/tests/ui/dropck/unconstrained_const_param_on_drop.stderr index 515637dd47fc3..ebdebb344549d 100644 --- a/tests/ui/dropck/unconstrained_const_param_on_drop.stderr +++ b/tests/ui/dropck/unconstrained_const_param_on_drop.stderr @@ -14,9 +14,13 @@ error[E0046]: not all trait items implemented, missing: `drop` --> $DIR/unconstrained_const_param_on_drop.rs:3:1 | LL | impl Drop for Foo {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `drop` in implementation + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = help: implement the missing item: `fn drop(&mut self) { todo!() }` + = note: default implementation of `drop` is unstable + = note: use of unstable library feature `pin_ergonomics` + = note: see issue #130494 for more information + = help: add `#![feature(pin_ergonomics)]` 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[E0207]: the const parameter `UNUSED` is not constrained by the impl trait, self type, or predicates --> $DIR/unconstrained_const_param_on_drop.rs:3:6 diff --git a/tests/ui/feature-gates/feature-gate-pin_ergonomics.rs b/tests/ui/feature-gates/feature-gate-pin_ergonomics.rs index 7746654555dd8..40df08e765f03 100644 --- a/tests/ui/feature-gates/feature-gate-pin_ergonomics.rs +++ b/tests/ui/feature-gates/feature-gate-pin_ergonomics.rs @@ -5,12 +5,17 @@ use std::pin::Pin; struct Foo; impl Foo { - fn foo(self: Pin<&mut Self>) { - } + fn foo(self: Pin<&mut Self>) {} fn foo_sugar(&pin mut self) {} //~ ERROR pinned reference syntax is experimental fn foo_sugar_const(&pin const self) {} //~ ERROR pinned reference syntax is experimental } +impl Drop for Foo { + //~^ ERROR not all trait items implemented, missing: `drop` + fn pin_drop(&pin mut self) {} //~ ERROR pinned reference syntax is experimental + //~^ ERROR use of unstable library feature `pin_ergonomics` [E0658] +} + fn foo(mut x: Pin<&mut Foo>) { Foo::foo_sugar(x.as_mut()); Foo::foo_sugar_const(x.as_ref()); @@ -54,12 +59,15 @@ mod not_compiled { struct Foo; impl Foo { - fn foo(self: Pin<&mut Self>) { - } + fn foo(self: Pin<&mut Self>) {} fn foo_sugar(&pin mut self) {} //~ ERROR pinned reference syntax is experimental fn foo_sugar_const(&pin const self) {} //~ ERROR pinned reference syntax is experimental } + impl Drop for Foo { + fn pin_drop(&pin mut self) {} //~ ERROR pinned reference syntax is experimental + } + fn foo(mut x: Pin<&mut Foo>) { Foo::foo_sugar(x.as_mut()); Foo::foo_sugar_const(x.as_ref()); diff --git a/tests/ui/feature-gates/feature-gate-pin_ergonomics.stderr b/tests/ui/feature-gates/feature-gate-pin_ergonomics.stderr index a8890254facea..6794443bb26fc 100644 --- a/tests/ui/feature-gates/feature-gate-pin_ergonomics.stderr +++ b/tests/ui/feature-gates/feature-gate-pin_ergonomics.stderr @@ -1,5 +1,5 @@ error[E0658]: pinned reference syntax is experimental - --> $DIR/feature-gate-pin_ergonomics.rs:10:19 + --> $DIR/feature-gate-pin_ergonomics.rs:9:19 | LL | fn foo_sugar(&pin mut self) {} | ^^^ @@ -9,7 +9,7 @@ LL | fn foo_sugar(&pin mut self) {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: pinned reference syntax is experimental - --> $DIR/feature-gate-pin_ergonomics.rs:11:25 + --> $DIR/feature-gate-pin_ergonomics.rs:10:25 | LL | fn foo_sugar_const(&pin const self) {} | ^^^ @@ -19,7 +19,17 @@ LL | fn foo_sugar_const(&pin const self) {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: pinned reference syntax is experimental - --> $DIR/feature-gate-pin_ergonomics.rs:17:14 + --> $DIR/feature-gate-pin_ergonomics.rs:15:18 + | +LL | fn pin_drop(&pin mut self) {} + | ^^^ + | + = note: see issue #130494 for more information + = help: add `#![feature(pin_ergonomics)]` 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]: pinned reference syntax is experimental + --> $DIR/feature-gate-pin_ergonomics.rs:22:14 | LL | let _y: &pin mut Foo = x; | ^^^ @@ -29,7 +39,7 @@ LL | let _y: &pin mut Foo = x; = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: pinned reference syntax is experimental - --> $DIR/feature-gate-pin_ergonomics.rs:21:14 + --> $DIR/feature-gate-pin_ergonomics.rs:26:14 | LL | let _y: &pin const Foo = x; | ^^^ @@ -39,7 +49,7 @@ LL | let _y: &pin const Foo = x; = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: pinned reference syntax is experimental - --> $DIR/feature-gate-pin_ergonomics.rs:24:18 + --> $DIR/feature-gate-pin_ergonomics.rs:29:18 | LL | fn foo_sugar(_: &pin mut Foo) {} | ^^^ @@ -49,7 +59,7 @@ LL | fn foo_sugar(_: &pin mut Foo) {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: pinned reference syntax is experimental - --> $DIR/feature-gate-pin_ergonomics.rs:36:18 + --> $DIR/feature-gate-pin_ergonomics.rs:41:18 | LL | fn baz_sugar(_: &pin const Foo) {} | ^^^ @@ -59,7 +69,7 @@ LL | fn baz_sugar(_: &pin const Foo) {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: pinned reference syntax is experimental - --> $DIR/feature-gate-pin_ergonomics.rs:39:31 + --> $DIR/feature-gate-pin_ergonomics.rs:44:31 | LL | let mut x: Pin<&mut _> = &pin mut Foo; | ^^^ @@ -69,7 +79,7 @@ LL | let mut x: Pin<&mut _> = &pin mut Foo; = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: pinned reference syntax is experimental - --> $DIR/feature-gate-pin_ergonomics.rs:44:23 + --> $DIR/feature-gate-pin_ergonomics.rs:49:23 | LL | let x: Pin<&_> = &pin const Foo; | ^^^ @@ -79,7 +89,7 @@ LL | let x: Pin<&_> = &pin const Foo; = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: pinned reference syntax is experimental - --> $DIR/feature-gate-pin_ergonomics.rs:59:23 + --> $DIR/feature-gate-pin_ergonomics.rs:63:23 | LL | fn foo_sugar(&pin mut self) {} | ^^^ @@ -89,7 +99,7 @@ LL | fn foo_sugar(&pin mut self) {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: pinned reference syntax is experimental - --> $DIR/feature-gate-pin_ergonomics.rs:60:29 + --> $DIR/feature-gate-pin_ergonomics.rs:64:29 | LL | fn foo_sugar_const(&pin const self) {} | ^^^ @@ -99,7 +109,17 @@ LL | fn foo_sugar_const(&pin const self) {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: pinned reference syntax is experimental - --> $DIR/feature-gate-pin_ergonomics.rs:66:18 + --> $DIR/feature-gate-pin_ergonomics.rs:68:22 + | +LL | fn pin_drop(&pin mut self) {} + | ^^^ + | + = note: see issue #130494 for more information + = help: add `#![feature(pin_ergonomics)]` 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]: pinned reference syntax is experimental + --> $DIR/feature-gate-pin_ergonomics.rs:74:18 | LL | let _y: &pin mut Foo = x; | ^^^ @@ -109,7 +129,7 @@ LL | let _y: &pin mut Foo = x; = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: pinned reference syntax is experimental - --> $DIR/feature-gate-pin_ergonomics.rs:69:22 + --> $DIR/feature-gate-pin_ergonomics.rs:77:22 | LL | fn foo_sugar(_: &pin mut Foo) {} | ^^^ @@ -119,7 +139,7 @@ LL | fn foo_sugar(_: &pin mut Foo) {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: pinned reference syntax is experimental - --> $DIR/feature-gate-pin_ergonomics.rs:81:22 + --> $DIR/feature-gate-pin_ergonomics.rs:89:22 | LL | fn baz_sugar(_: &pin const Foo) {} | ^^^ @@ -129,7 +149,7 @@ LL | fn baz_sugar(_: &pin const Foo) {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: pinned reference syntax is experimental - --> $DIR/feature-gate-pin_ergonomics.rs:84:35 + --> $DIR/feature-gate-pin_ergonomics.rs:92:35 | LL | let mut x: Pin<&mut _> = &pin mut Foo; | ^^^ @@ -139,7 +159,7 @@ LL | let mut x: Pin<&mut _> = &pin mut Foo; = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: pinned reference syntax is experimental - --> $DIR/feature-gate-pin_ergonomics.rs:89:27 + --> $DIR/feature-gate-pin_ergonomics.rs:97:27 | LL | let x: Pin<&_> = &pin const Foo; | ^^^ @@ -148,8 +168,34 @@ LL | let x: Pin<&_> = &pin const Foo; = help: add `#![feature(pin_ergonomics)]` 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]: use of unstable library feature `pin_ergonomics` + --> $DIR/feature-gate-pin_ergonomics.rs:15:5 + | +LL | fn pin_drop(&pin mut self) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #130494 for more information + = help: add `#![feature(pin_ergonomics)]` 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[E0046]: not all trait items implemented, missing: `drop` + --> $DIR/feature-gate-pin_ergonomics.rs:13:1 + | +LL | / impl Drop for Foo { +LL | | +LL | | fn pin_drop(&pin mut self) {} +LL | | +LL | | } + | |_^ + | + = note: default implementation of `drop` is unstable + = note: use of unstable library feature `pin_ergonomics` + = note: see issue #130494 for more information + = help: add `#![feature(pin_ergonomics)]` 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[E0382]: use of moved value: `x` - --> $DIR/feature-gate-pin_ergonomics.rs:28:9 + --> $DIR/feature-gate-pin_ergonomics.rs:33:9 | LL | fn bar(x: Pin<&mut Foo>) { | - move occurs because `x` has type `Pin<&mut Foo>`, which does not implement the `Copy` trait @@ -159,7 +205,7 @@ LL | foo(x); | ^ value used here after move | note: consider changing this parameter type in function `foo` to borrow instead if owning the value isn't necessary - --> $DIR/feature-gate-pin_ergonomics.rs:14:15 + --> $DIR/feature-gate-pin_ergonomics.rs:19:15 | LL | fn foo(mut x: Pin<&mut Foo>) { | --- ^^^^^^^^^^^^^ this parameter takes ownership of the value @@ -167,7 +213,7 @@ LL | fn foo(mut x: Pin<&mut Foo>) { | in this function error[E0382]: use of moved value: `x` - --> $DIR/feature-gate-pin_ergonomics.rs:33:5 + --> $DIR/feature-gate-pin_ergonomics.rs:38:5 | LL | fn baz(mut x: Pin<&mut Foo>) { | ----- move occurs because `x` has type `Pin<&mut Foo>`, which does not implement the `Copy` trait @@ -179,14 +225,14 @@ LL | x.foo(); note: `Foo::foo` takes ownership of the receiver `self`, which moves `x` --> $DIR/feature-gate-pin_ergonomics.rs:8:12 | -LL | fn foo(self: Pin<&mut Self>) { +LL | fn foo(self: Pin<&mut Self>) {} | ^^^^ help: consider reborrowing the `Pin` instead of moving it | LL | x.as_mut().foo(); | +++++++++ -error: aborting due to 17 previous errors +error: aborting due to 21 previous errors -Some errors have detailed explanations: E0382, E0658. -For more information about an error, try `rustc --explain E0382`. +Some errors have detailed explanations: E0046, E0382, E0658. +For more information about an error, try `rustc --explain E0046`. diff --git a/tests/ui/lifetimes/issue-105507.fixed b/tests/ui/lifetimes/issue-105507.fixed index a3c4e5784b872..46d4f14a2457e 100644 --- a/tests/ui/lifetimes/issue-105507.fixed +++ b/tests/ui/lifetimes/issue-105507.fixed @@ -31,7 +31,7 @@ impl ProjectedMyTrait for T fn require_trait(_: T) {} -fn foo(wrap: Wrapper<'_, Option>, wrap1: Wrapper<'_, Option>) { +fn foo(wrap: Wrapper<'_, Option>, wrap1: Wrapper<'_, Option>) { //~^ HELP consider restricting the type parameter to the `'static` lifetime //~| HELP consider restricting the type parameter to the `'static` lifetime require_trait(wrap); diff --git a/tests/ui/parser/expr-as-stmt.fixed b/tests/ui/parser/expr-as-stmt.fixed index b3a491200ed10..bfae55047ed1b 100644 --- a/tests/ui/parser/expr-as-stmt.fixed +++ b/tests/ui/parser/expr-as-stmt.fixed @@ -66,7 +66,7 @@ fn asteroids() -> impl FnOnce() -> bool { // https://github.com/rust-lang/rust/issues/105179 fn r#match() -> i32 { - (match () { () => 1 }) + match () { () => 1 } //~ ERROR expected expression, found `+` + ((match () { () => 1 })) + match () { () => 1 } //~ ERROR expected expression, found `+` //~^ ERROR mismatched types } @@ -82,7 +82,7 @@ fn matches() -> bool { (match () { _ => true }) && match () { _ => true }; //~ ERROR mismatched types //~^ ERROR expected `;`, found keyword `match` (match () { _ => true }) && true; //~ ERROR mismatched types - (match () { _ => true }) && true //~ ERROR mismatched types + ((match () { _ => true })) && true //~ ERROR mismatched types //~^ ERROR mismatched types } fn main() {} diff --git a/tests/ui/pin-ergonomics/pinned-drop-check.rs b/tests/ui/pin-ergonomics/pinned-drop-check.rs new file mode 100644 index 0000000000000..cc8ff32f04388 --- /dev/null +++ b/tests/ui/pin-ergonomics/pinned-drop-check.rs @@ -0,0 +1,76 @@ +//@ edition:2024 +#![feature(pin_ergonomics)] +#![allow(incomplete_features)] + +// This test ensures that at least and at most one of `drop` and `pin_drop` +// are implemented for types that implement `Drop`. + +mod drop_only { + struct Foo; + + impl Drop for Foo { + fn drop(&mut self) {} // ok, only `drop` is implemented + } +} + +mod pin_drop_only { + struct Foo; + + impl Drop for Foo { + fn pin_drop(&pin mut self) {} // ok, only `pin_drop` is implemented + } +} + +mod both { + struct Foo; + + impl Drop for Foo { + //~^ ERROR conflict implementation of `Drop::drop` and `Drop::pin_drop` + fn drop(&mut self) {} + fn pin_drop(&pin mut self) {} + } +} + +mod neither { + struct Foo; + + impl Drop for Foo {} //~ ERROR not all trait items implemented, missing one of: `drop`, `pin_drop` [E0046] +} + +mod drop_wrong_type { + struct Foo; + + impl Drop for Foo { + fn drop(&pin mut self) {} //~ ERROR method `drop` has an incompatible type for trait [E0053] + } +} + +mod pin_drop_wrong_type { + struct Foo; + + impl Drop for Foo { + fn pin_drop(&mut self) {} //~ ERROR method `pin_drop` has an incompatible type for trait [E0053] + } +} + +mod explicit_call_pin_drop { + struct Foo; + + impl Drop for Foo { + fn drop(&mut self) { + Drop::pin_drop(todo!()); //~ ERROR explicit use of destructor method [E0040] + } + } +} + +mod explicit_call_drop { + struct Foo; + + impl Drop for Foo { + fn pin_drop(&pin mut self) { + Drop::drop(todo!()); //~ ERROR explicit use of destructor method [E0040] + } + } +} + +fn main() {} diff --git a/tests/ui/pin-ergonomics/pinned-drop-check.stderr b/tests/ui/pin-ergonomics/pinned-drop-check.stderr new file mode 100644 index 0000000000000..6af12d3b8d2ea --- /dev/null +++ b/tests/ui/pin-ergonomics/pinned-drop-check.stderr @@ -0,0 +1,67 @@ +error: conflict implementation of `Drop::drop` and `Drop::pin_drop` + --> $DIR/pinned-drop-check.rs:27:5 + | +LL | impl Drop for Foo { + | ^^^^^^^^^^^^^^^^^ +LL | +LL | fn drop(&mut self) {} + | ------------------ `drop(&mut self)` implemented here +LL | fn pin_drop(&pin mut self) {} + | -------------------------- `pin_drop(&pin mut self)` implemented here + +error[E0046]: not all trait items implemented, missing one of: `drop`, `pin_drop` + --> $DIR/pinned-drop-check.rs:37:5 + | +LL | impl Drop for Foo {} + | ^^^^^^^^^^^^^^^^^ missing one of `drop`, `pin_drop` in implementation + +error[E0053]: method `drop` has an incompatible type for trait + --> $DIR/pinned-drop-check.rs:44:17 + | +LL | fn drop(&pin mut self) {} + | ^^^^^^^^^^^^^ expected `&mut drop_wrong_type::Foo`, found `Pin<&mut drop_wrong_type::Foo>` + | + = note: expected signature `fn(&mut drop_wrong_type::Foo)` + found signature `fn(Pin<&mut drop_wrong_type::Foo>)` +help: change the self-receiver type to match the trait + | +LL - fn drop(&pin mut self) {} +LL + fn drop(&mut self) {} + | + +error[E0053]: method `pin_drop` has an incompatible type for trait + --> $DIR/pinned-drop-check.rs:52:21 + | +LL | fn pin_drop(&mut self) {} + | ^^^^^^^^^ expected `Pin<&mut pin_drop_wrong_type::Foo>`, found `&mut pin_drop_wrong_type::Foo` + | + = note: expected signature `fn(Pin<&mut pin_drop_wrong_type::Foo>)` + found signature `fn(&mut pin_drop_wrong_type::Foo)` +help: change the self-receiver type to match the trait + | +LL - fn pin_drop(&mut self) {} +LL + fn pin_drop(self: Pin<&mut pin_drop_wrong_type::Foo>) {} + | + +error[E0040]: explicit use of destructor method + --> $DIR/pinned-drop-check.rs:61:13 + | +LL | Drop::pin_drop(todo!()); + | ^^^^^^^^^^^^^^ + | | + | explicit destructor calls not allowed + | help: consider using `drop` function: `drop` + +error[E0040]: explicit use of destructor method + --> $DIR/pinned-drop-check.rs:71:13 + | +LL | Drop::drop(todo!()); + | ^^^^^^^^^^ + | | + | explicit destructor calls not allowed + | help: consider using `drop` function: `drop` + +error: aborting due to 6 previous errors + +Some errors have detailed explanations: E0040, E0046, E0053. +For more information about an error, try `rustc --explain E0040`. diff --git a/tests/ui/pin-ergonomics/pinned-drop.rs b/tests/ui/pin-ergonomics/pinned-drop.rs new file mode 100644 index 0000000000000..a748429c0b1ad --- /dev/null +++ b/tests/ui/pin-ergonomics/pinned-drop.rs @@ -0,0 +1,51 @@ +//@ run-pass +//@ edition:2024 +#![feature(pin_ergonomics)] +#![allow(incomplete_features)] + +use std::pin::Pin; +use std::sync::Arc; +use std::sync::atomic::{AtomicBool, Ordering}; +use std::task::{Context, Poll, Waker}; + +struct Foo { + dropped: Arc, +} + +impl Foo { + fn new(dropped: Arc) -> Self { + Self { dropped } + } +} + +impl Drop for Foo { + fn pin_drop(self: Pin<&mut Self>) { + self.dropped.store(true, Ordering::Relaxed); + } +} + +impl Future for Foo { + type Output = (); + + fn poll(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll { + Poll::Ready(()) + } +} + +fn block_on>(mut f: F) -> T { + let waker = Waker::noop(); + let mut cx = Context::from_waker(waker); + + let f = &pin mut f; + loop { + if let Poll::Ready(ret) = f.poll(&mut cx) { + break ret; + } + } +} + +fn main() { + let dropped = Arc::new(AtomicBool::new(false)); + block_on(Foo::new(dropped.clone())); + assert!(dropped.load(Ordering::Relaxed)); +} diff --git a/tests/ui/suggestions/missing-bound-in-derive-copy-impl-2.fixed b/tests/ui/suggestions/missing-bound-in-derive-copy-impl-2.fixed index 8a2be310e0d81..99433f7332042 100644 --- a/tests/ui/suggestions/missing-bound-in-derive-copy-impl-2.fixed +++ b/tests/ui/suggestions/missing-bound-in-derive-copy-impl-2.fixed @@ -8,7 +8,7 @@ pub struct Vector2 { } #[derive(Debug, Copy, Clone)] -pub struct AABB { +pub struct AABB { pub loc: Vector2, //~ ERROR the trait bound `K: Copy` is not satisfied //~^ ERROR the trait bound `K: Copy` is not satisfied //~| ERROR the trait bound `K: Copy` is not satisfied diff --git a/tests/ui/suggestions/missing-bound-in-derive-copy-impl-3.fixed b/tests/ui/suggestions/missing-bound-in-derive-copy-impl-3.fixed index 74df1d7c7cfdd..6da3e351ffbdd 100644 --- a/tests/ui/suggestions/missing-bound-in-derive-copy-impl-3.fixed +++ b/tests/ui/suggestions/missing-bound-in-derive-copy-impl-3.fixed @@ -8,7 +8,7 @@ pub struct Vector2{ } #[derive(Debug, Copy, Clone)] //~ ERROR the trait `Copy` cannot be implemented for this type -pub struct AABB{ +pub struct AABB{ pub loc: Vector2, //~ ERROR `K` doesn't implement `Debug` //~^ ERROR `K` doesn't implement `Debug` pub size: Vector2 //~ ERROR `K` doesn't implement `Debug` diff --git a/tests/ui/suggestions/trait-impl-bound-suggestions.fixed b/tests/ui/suggestions/trait-impl-bound-suggestions.fixed index 49793b4b6f47e..9d3168f5acd68 100644 --- a/tests/ui/suggestions/trait-impl-bound-suggestions.fixed +++ b/tests/ui/suggestions/trait-impl-bound-suggestions.fixed @@ -10,7 +10,7 @@ struct ConstrainedStruct { } #[allow(dead_code)] -trait InsufficientlyConstrainedGeneric where Self: Sized, X: std::marker::Copy { +trait InsufficientlyConstrainedGeneric where Self: Sized, X: std::marker::Copy, X: std::marker::Copy { fn return_the_constrained_type(&self, x: X) -> ConstrainedStruct { //~^ ERROR the trait bound `X: Copy` is not satisfied ConstrainedStruct { x } @@ -20,7 +20,7 @@ trait InsufficientlyConstrainedGeneric where Self: Sized, X: std::marker:: // Regression test for #120838 #[allow(dead_code)] -trait InsufficientlyConstrainedGenericWithEmptyWhere where Self: Sized, X: std::marker::Copy { +trait InsufficientlyConstrainedGenericWithEmptyWhere where Self: Sized, X: std::marker::Copy, X: std::marker::Copy { fn return_the_constrained_type(&self, x: X) -> ConstrainedStruct { //~^ ERROR the trait bound `X: Copy` is not satisfied ConstrainedStruct { x }