From 5baba86fe554424e8a58e3f1a3f29c258fce3296 Mon Sep 17 00:00:00 2001 From: Seiichi Uchida Date: Fri, 6 Sep 2019 22:41:03 +0900 Subject: [PATCH 1/3] Update rustc-ap-* crates to 581.0.0 (#3783) --- Cargo.lock | 129 ++++++++++++++++++++----------- Cargo.toml | 6 +- src/attr.rs | 2 +- src/expr.rs | 4 +- src/items.rs | 92 ++++++++++++++-------- src/macros.rs | 15 ++-- src/modules.rs | 4 +- src/modules/visitor.rs | 9 +-- src/patterns.rs | 41 ++++++++-- src/spanned.rs | 2 +- src/utils.rs | 4 +- src/visitor.rs | 29 ++++--- tests/source/existential_type.rs | 12 +-- tests/source/issue-2863.rs | 4 +- tests/target/existential_type.rs | 12 +-- tests/target/issue-2863.rs | 4 +- 16 files changed, 235 insertions(+), 134 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 260613753c9..9dcc509bba9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -396,6 +396,15 @@ dependencies = [ "rand 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "kernel32-sys" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "lazy_static" version = "1.3.0" @@ -691,21 +700,21 @@ dependencies = [ [[package]] name = "rustc-ap-arena" -version = "546.0.0" +version = "581.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rustc-ap-rustc_data_structures 546.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-rustc_data_structures 581.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rustc-ap-graphviz" -version = "546.0.0" +version = "581.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "rustc-ap-rustc_data_structures" -version = "546.0.0" +version = "581.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", @@ -716,8 +725,8 @@ dependencies = [ "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-graphviz 546.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-serialize 546.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-graphviz 581.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-serialize 581.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-rayon 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-rayon-core 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -727,27 +736,31 @@ dependencies = [ [[package]] name = "rustc-ap-rustc_errors" -version = "546.0.0" +version = "581.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "annotate-snippets 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-rustc_data_structures 546.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-serialize 546.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-syntax_pos 546.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-rustc_data_structures 581.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-serialize 581.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-syntax_pos 581.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "term_size 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "termcolor 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rustc-ap-rustc_lexer" -version = "546.0.0" +version = "581.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] name = "rustc-ap-rustc_macros" -version = "546.0.0" +version = "581.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -759,19 +772,19 @@ dependencies = [ [[package]] name = "rustc-ap-rustc_target" -version = "546.0.0" +version = "581.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-rustc_data_structures 546.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-serialize 546.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-syntax_pos 546.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-rustc_data_structures 581.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-serialize 581.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-syntax_pos 581.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rustc-ap-serialize" -version = "546.0.0" +version = "581.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -780,33 +793,33 @@ dependencies = [ [[package]] name = "rustc-ap-syntax" -version = "546.0.0" +version = "581.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-rustc_data_structures 546.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-rustc_errors 546.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-rustc_lexer 546.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-rustc_macros 546.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-rustc_target 546.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-serialize 546.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-syntax_pos 546.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-rustc_data_structures 581.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-rustc_errors 581.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-rustc_lexer 581.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-rustc_macros 581.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-rustc_target 581.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-serialize 581.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-syntax_pos 581.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "scoped-tls 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rustc-ap-syntax_pos" -version = "546.0.0" +version = "581.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-arena 546.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-rustc_data_structures 546.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-rustc_macros 546.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-serialize 546.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-arena 581.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-rustc_data_structures 581.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-rustc_macros 581.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-serialize 581.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "scoped-tls 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -886,9 +899,9 @@ dependencies = [ "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-rustc_target 546.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-syntax 546.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-syntax_pos 546.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-rustc_target 581.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-syntax 581.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-syntax_pos 581.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-workspace-hack 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustfmt-config_proc_macro 0.1.2", "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1042,6 +1055,16 @@ dependencies = [ "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "term_size" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "termcolor" version = "1.0.5" @@ -1094,6 +1117,11 @@ name = "unicode-xid" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "unicode-xid" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "unicode_categories" version = "0.1.1" @@ -1119,6 +1147,11 @@ dependencies = [ "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "winapi" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "winapi" version = "0.3.7" @@ -1128,6 +1161,11 @@ dependencies = [ "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "winapi-build" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" @@ -1203,6 +1241,7 @@ dependencies = [ "checksum itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5b8467d9c1cebe26feb08c640139247fac215782d35371ade9a2136ed6085358" "checksum itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "501266b7edd0174f8530248f87f99c88fbe60ca4ef3dd486835b8d8d53136f7f" "checksum jobserver 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "f74e73053eaf95399bf926e48fc7a2a3ce50bd0eaaa2357d391e95b2dcdd4f10" +"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" "checksum lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc5729f27f159ddd61f4df6228e827e86643d4d3e7c32183cb30a1c08f604a14" "checksum libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)" = "d44e80633f007889c7eff624b709ab43c92d708caad982295768a7b13ca3b5eb" "checksum lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "62ebf1391f6acad60e5c8b43706dde4582df75c06698ab44511d15016bc2442c" @@ -1238,16 +1277,16 @@ dependencies = [ "checksum redox_users 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3fe5204c3a17e97dde73f285d49be585df59ed84b50a872baf416e73b62c3828" "checksum regex 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6b23da8dfd98a84bd7e08700190a5d9f7d2d38abd4369dd1dae651bc40bfd2cc" "checksum regex-syntax 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "cd5485bf1523a9ed51c4964273f22f63f24e31632adb5dad134f488f86a3875c" -"checksum rustc-ap-arena 546.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4dc2e1e68b64268c543bfa6e63e3c0d9ea58074c71396f42f76931f35a9287f9" -"checksum rustc-ap-graphviz 546.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c108d647ce0dd46477b048eafff5a6273b5652e02d47424b0cd684147379c811" -"checksum rustc-ap-rustc_data_structures 546.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "656771744e0783cb8e4481e3b8b1f975687610aaf18833b898018111a0e0e582" -"checksum rustc-ap-rustc_errors 546.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e37064f6624bc799bfaa2968b61ee6880926dea2a8bba69f18aef6c8e69c9604" -"checksum rustc-ap-rustc_lexer 546.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ef5bc0a971823637ea23a857f0ef1467f44b1e05d71968821f83a0abe53e0fe3" -"checksum rustc-ap-rustc_macros 546.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b90037e3336fe8835f468db44d0848ae10d9cc8533ae89b55828883f905b7e80" -"checksum rustc-ap-rustc_target 546.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cadf9ca07315eab3a7a21f63872f9cc81e250fd6ede0419c24f8926ade73a45d" -"checksum rustc-ap-serialize 546.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "61673783f2089e01033ffa82d1988f55175402071b31253a358292e1624d4602" -"checksum rustc-ap-syntax 546.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "28f3dd1346d5b0269c07a4a78855e309a298ab569c9c1302d4d4f57f8eee4e84" -"checksum rustc-ap-syntax_pos 546.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "45e67b526dbda3a0c7dab91c8947d43685e7697f52686a4949da3c179cd7c979" +"checksum rustc-ap-arena 581.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e4efec6ece174df54e4605c3c229b5a8885355f9f8988cabbc24aa99dbc27f27" +"checksum rustc-ap-graphviz 581.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b01d685fc49fb05676a8829c7a9fa1759c441f1430384c32c8b42462409535f3" +"checksum rustc-ap-rustc_data_structures 581.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2e43082631e0b3782c216d02d7d86a221b58834a1b3ba2b686aa84309bd65ed9" +"checksum rustc-ap-rustc_errors 581.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1ad386fc563e7e5ab47d78eaf2ee37d430e1e6c0ca67a23df70fdee9c4bdf673" +"checksum rustc-ap-rustc_lexer 581.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c3820240b53041ee8932c866aaf9c877e3a55af31a2f5c333077b853e9bed2ac" +"checksum rustc-ap-rustc_macros 581.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "89b0931fe770efb7bc659e1900ef80d7bc8efeb4a36af94c5a89bea9e0230989" +"checksum rustc-ap-rustc_target 581.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "26a3d9de9e308ba21add5f92bc2dfd014f3ea06932df7ba10ac23c83c0c9bc03" +"checksum rustc-ap-serialize 581.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1e9f98141be65d2cc0bc8eb11e89bda9d4cec9ddf69dd46120c8f3840f9b5adc" +"checksum rustc-ap-syntax 581.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5643c677373d8fa1f19c93ce7b42f5628818964d4d3d7dc6ac191b2b6170e91b" +"checksum rustc-ap-syntax_pos 581.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1508b6dc46181580787b30876bc8cc1c76ca5851aec05d08e0065cd16c635736" "checksum rustc-demangle 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "a7f4dccf6f4891ebcc0c39f9b6eb1a83b9bf5d747cb439ec6fba4f3b977038af" "checksum rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7540fc8b0c49f096ee9c961cda096467dce8084bec6bdca2fc83895fd9b28cb8" "checksum rustc-rayon 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0d2e07e19601f21c59aad953c2632172ba70cb27e685771514ea66e4062b3363" @@ -1273,6 +1312,7 @@ dependencies = [ "checksum syn 0.15.42 (registry+https://github.com/rust-lang/crates.io-index)" = "eadc09306ca51a40555dd6fc2b415538e9e18bc9f870e47b1a524a79fe2dcf5e" "checksum synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "02353edf96d6e4dc81aea2d8490a7e9db177bf8acb0e951c24940bf866cb313f" "checksum term 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0dd90505d5006a4422d3520b30c781d480b3f36768c2fa2187c3e950bc110464" +"checksum term_size 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9e5b9a66db815dcfd2da92db471106457082577c3c278d4138ab3e3b4e189327" "checksum termcolor 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "96d6098003bde162e4277c70665bd87c326f5a0c3f3fbfb285787fa482d54e6e" "checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" "checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" @@ -1281,11 +1321,14 @@ dependencies = [ "checksum unicode-segmentation 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1967f4cdfc355b37fd76d2a954fb2ed3871034eb4f26d60537d88795cfc332a9" "checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526" "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" +"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" "checksum unicode_categories 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e" "checksum utf8-ranges 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "9d50aa7650df78abf942826607c62468ce18d9019673d4a2ebe1865dbb96ffde" "checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" "checksum walkdir 2.2.9 (registry+https://github.com/rust-lang/crates.io-index)" = "9658c94fa8b940eab2250bd5a457f9c48b748420d71293b165c8cdbe2f55f71e" +"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" "checksum winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "f10e386af2b13e47c89e7236a7a14a086791a2b88ebad6df9bf42040195cf770" +"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" "checksum winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7168bab6e1daee33b4557efd0e95d5ca70a03706d39fa5f3fe7a236f584b03c9" "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/Cargo.toml b/Cargo.toml index 3c623ff4edc..27cf07c1332 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -48,9 +48,9 @@ env_logger = "0.6" getopts = "0.2" derive-new = "0.5" cargo_metadata = "0.8" -rustc-ap-rustc_target = "546.0.0" -rustc-ap-syntax = "546.0.0" -rustc-ap-syntax_pos = "546.0.0" +rustc-ap-rustc_target = "581.0.0" +rustc-ap-syntax = "581.0.0" +rustc-ap-syntax_pos = "581.0.0" failure = "0.1.3" bytecount = "0.5" unicode-width = "0.1.5" diff --git a/src/attr.rs b/src/attr.rs index 1c9092ea629..7270215ccbb 100644 --- a/src/attr.rs +++ b/src/attr.rs @@ -340,7 +340,7 @@ impl Rewrite for ast::Attribute { let literal_str = literal.as_str(); let doc_comment_formatter = - DocCommentFormatter::new(literal_str.get(), comment_style); + DocCommentFormatter::new(&*literal_str, comment_style); let doc_comment = format!("{}", doc_comment_formatter); return rewrite_doc_comment( &doc_comment, diff --git a/src/expr.rs b/src/expr.rs index 9030d876b40..02bf1fa20e4 100644 --- a/src/expr.rs +++ b/src/expr.rs @@ -1316,8 +1316,8 @@ pub(crate) fn can_be_overflowed_expr( context.config.overflow_delimited_expr() || (context.use_block_indent() && args_len == 1) } - ast::ExprKind::Mac(ref macro_) => { - match (macro_.node.delim, context.config.overflow_delimited_expr()) { + ast::ExprKind::Mac(ref mac) => { + match (mac.delim, context.config.overflow_delimited_expr()) { (ast::MacDelimiter::Bracket, true) | (ast::MacDelimiter::Brace, true) => true, _ => context.use_block_indent() && args_len == 1, } diff --git a/src/items.rs b/src/items.rs index 0943122b090..613f9b5b729 100644 --- a/src/items.rs +++ b/src/items.rs @@ -473,8 +473,8 @@ impl<'a> FmtVisitor<'a> { let discr_ident_lens: Vec = enum_def .variants .iter() - .filter(|var| var.node.disr_expr.is_some()) - .map(|var| rewrite_ident(&self.get_context(), var.node.ident).len()) + .filter(|var| var.disr_expr.is_some()) + .map(|var| rewrite_ident(&self.get_context(), var.ident).len()) .collect(); // cut the list at the point of longest discrim shorter than the threshold // All of the discrims under the threshold will get padded, and all above - left as is. @@ -491,8 +491,8 @@ impl<'a> FmtVisitor<'a> { "}", ",", |f| { - if !f.node.attrs.is_empty() { - f.node.attrs[0].span.lo() + if !f.attrs.is_empty() { + f.attrs[0].span.lo() } else { f.span.lo() } @@ -533,8 +533,8 @@ impl<'a> FmtVisitor<'a> { one_line_width: usize, pad_discrim_ident_to: usize, ) -> Option { - if contains_skip(&field.node.attrs) { - let lo = field.node.attrs[0].span.lo(); + if contains_skip(&field.attrs) { + let lo = field.attrs[0].span.lo(); let span = mk_sp(lo, field.span.hi()); return Some(self.snippet(span).to_owned()); } @@ -542,25 +542,24 @@ impl<'a> FmtVisitor<'a> { let context = self.get_context(); // 1 = ',' let shape = self.shape().sub_width(1)?; - let attrs_str = field.node.attrs.rewrite(&context, shape)?; + let attrs_str = field.attrs.rewrite(&context, shape)?; let lo = field - .node .attrs .last() .map_or(field.span.lo(), |attr| attr.span.hi()); let span = mk_sp(lo, field.span.lo()); - let variant_body = match field.node.data { + let variant_body = match field.data { ast::VariantData::Tuple(..) | ast::VariantData::Struct(..) => format_struct( &context, &StructParts::from_variant(field), self.block_indent, Some(one_line_width), )?, - ast::VariantData::Unit(..) => rewrite_ident(&context, field.node.ident).to_owned(), + ast::VariantData::Unit(..) => rewrite_ident(&context, field.ident).to_owned(), }; - let variant_body = if let Some(ref expr) = field.node.disr_expr { + let variant_body = if let Some(ref expr) = field.disr_expr { let lhs = format!("{:1$} =", variant_body, pad_discrim_ident_to); rewrite_assign_rhs_with( &context, @@ -585,27 +584,27 @@ impl<'a> FmtVisitor<'a> { buffer.push((self.buffer.clone(), item.clone())); self.buffer.clear(); } - // type -> existential -> const -> macro -> method + // type -> opaque -> const -> macro -> method use crate::ast::ImplItemKind::*; fn need_empty_line(a: &ast::ImplItemKind, b: &ast::ImplItemKind) -> bool { match (a, b) { - (Type(..), Type(..)) + (TyAlias(..), TyAlias(..)) | (Const(..), Const(..)) - | (Existential(..), Existential(..)) => false, + | (OpaqueTy(..), OpaqueTy(..)) => false, _ => true, } } buffer.sort_by(|(_, a), (_, b)| match (&a.node, &b.node) { - (Type(..), Type(..)) + (TyAlias(..), TyAlias(..)) | (Const(..), Const(..)) | (Macro(..), Macro(..)) - | (Existential(..), Existential(..)) => a.ident.as_str().cmp(&b.ident.as_str()), + | (OpaqueTy(..), OpaqueTy(..)) => a.ident.as_str().cmp(&b.ident.as_str()), (Method(..), Method(..)) => a.span.lo().cmp(&b.span.lo()), - (Type(..), _) => Ordering::Less, - (_, Type(..)) => Ordering::Greater, - (Existential(..), _) => Ordering::Less, - (_, Existential(..)) => Ordering::Greater, + (TyAlias(..), _) => Ordering::Less, + (_, TyAlias(..)) => Ordering::Greater, + (OpaqueTy(..), _) => Ordering::Less, + (_, OpaqueTy(..)) => Ordering::Greater, (Const(..), _) => Ordering::Less, (_, Const(..)) => Ordering::Greater, (Macro(..), _) => Ordering::Less, @@ -920,9 +919,9 @@ impl<'a> StructParts<'a> { fn from_variant(variant: &'a ast::Variant) -> Self { StructParts { prefix: "", - ident: variant.node.ident, + ident: variant.ident, vis: &DEFAULT_VISIBILITY, - def: &variant.node.data, + def: &variant.data, generics: None, span: variant.span, } @@ -1517,7 +1516,7 @@ pub(crate) fn rewrite_type_alias( rewrite_type_item(context, indent, "type", " =", ident, ty, generics, vis) } -pub(crate) fn rewrite_existential_type( +pub(crate) fn rewrite_opaque_type( context: &RewriteContext<'_>, indent: Indent, ident: ast::Ident, @@ -1528,8 +1527,8 @@ pub(crate) fn rewrite_existential_type( rewrite_type_item( context, indent, - "existential type", - ":", + "type", + " =", ident, generic_bounds, generics, @@ -1786,15 +1785,42 @@ pub(crate) fn rewrite_associated_type( } } -pub(crate) fn rewrite_existential_impl_type( +struct OpaqueType<'a> { + bounds: &'a ast::GenericBounds, +} + +impl<'a> Rewrite for OpaqueType<'a> { + fn rewrite(&self, context: &RewriteContext<'_>, shape: Shape) -> Option { + let shape = shape.offset_left(5)?; // `impl ` + self.bounds + .rewrite(context, shape) + .map(|s| format!("impl {}", s)) + } +} + +pub(crate) fn rewrite_opaque_impl_type( context: &RewriteContext<'_>, ident: ast::Ident, generics: &ast::Generics, generic_bounds: &ast::GenericBounds, indent: Indent, ) -> Option { - rewrite_associated_type(ident, None, generics, Some(generic_bounds), context, indent) - .map(|s| format!("existential {}", s)) + let ident_str = rewrite_ident(context, ident); + // 5 = "type " + let generics_shape = Shape::indented(indent, context.config).offset_left(5)?; + let generics_str = rewrite_generics(context, ident_str, generics, generics_shape)?; + let prefix = format!("type {} =", generics_str); + let rhs = OpaqueType { + bounds: generic_bounds, + }; + + rewrite_assign_rhs( + context, + &prefix, + &rhs, + Shape::indented(indent, context.config).sub_width(1)?, + ) + .map(|s| s + ";") } pub(crate) fn rewrite_associated_impl_type( @@ -1877,7 +1903,7 @@ fn get_missing_arg_comments( (comment_before_colon, comment_after_colon) } -impl Rewrite for ast::Arg { +impl Rewrite for ast::Param { fn rewrite(&self, context: &RewriteContext<'_>, shape: Shape) -> Option { if let Some(ref explicit_self) = self.to_self() { rewrite_explicit_self(context, explicit_self) @@ -1941,7 +1967,7 @@ fn rewrite_explicit_self( } } -pub(crate) fn span_lo_for_arg(arg: &ast::Arg) -> BytePos { +pub(crate) fn span_lo_for_arg(arg: &ast::Param) -> BytePos { if is_named_arg(arg) { arg.pat.span.lo() } else { @@ -1949,7 +1975,7 @@ pub(crate) fn span_lo_for_arg(arg: &ast::Arg) -> BytePos { } } -pub(crate) fn span_hi_for_arg(context: &RewriteContext<'_>, arg: &ast::Arg) -> BytePos { +pub(crate) fn span_hi_for_arg(context: &RewriteContext<'_>, arg: &ast::Param) -> BytePos { match arg.ty.node { ast::TyKind::Infer if context.snippet(arg.ty.span) == "_" => arg.ty.span.hi(), ast::TyKind::Infer if is_named_arg(arg) => arg.pat.span.hi(), @@ -1957,7 +1983,7 @@ pub(crate) fn span_hi_for_arg(context: &RewriteContext<'_>, arg: &ast::Arg) -> B } } -pub(crate) fn is_named_arg(arg: &ast::Arg) -> bool { +pub(crate) fn is_named_arg(arg: &ast::Param) -> bool { if let ast::PatKind::Ident(_, ident, _) = arg.pat.node { ident.name != symbol::kw::Invalid } else { @@ -2349,7 +2375,7 @@ impl WhereClauseOption { fn rewrite_args( context: &RewriteContext<'_>, - args: &[ast::Arg], + args: &[ast::Param], one_line_budget: usize, multi_line_budget: usize, indent: Indent, diff --git a/src/macros.rs b/src/macros.rs index dfc27c5fa5a..08f83b7e826 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -199,7 +199,7 @@ pub(crate) fn rewrite_macro( ) -> Option { let should_skip = context .skip_context - .skip_macro(&context.snippet(mac.node.path.span).to_owned()); + .skip_macro(&context.snippet(mac.path.span).to_owned()); if should_skip { None } else { @@ -235,7 +235,7 @@ fn check_keyword<'a, 'b: 'a>(parser: &'a mut Parser<'b>) -> Option { { parser.bump(); let macro_arg = - MacroArg::Keyword(ast::Ident::with_empty_ctxt(keyword), parser.prev_span); + MacroArg::Keyword(ast::Ident::with_dummy_span(keyword), parser.prev_span); return Some(macro_arg); } } @@ -259,7 +259,7 @@ fn rewrite_macro_inner( let original_style = macro_style(mac, context); - let macro_name = rewrite_macro_name(context, &mac.node.path, extra_ident); + let macro_name = rewrite_macro_name(context, &mac.path, extra_ident); let style = if FORCED_BRACKET_MACROS.contains(&¯o_name[..]) && !is_nested_macro { DelimToken::Bracket @@ -267,7 +267,7 @@ fn rewrite_macro_inner( original_style }; - let ts: TokenStream = mac.node.stream(); + let ts: TokenStream = mac.stream(); let has_comment = contains_comment(context.snippet(mac.span)); if ts.is_empty() && !has_comment { return match style { @@ -1190,8 +1190,8 @@ fn next_space(tok: &TokenKind) -> SpaceState { /// when the macro is not an instance of `try!` (or parsing the inner expression /// failed). pub(crate) fn convert_try_mac(mac: &ast::Mac, context: &RewriteContext<'_>) -> Option { - if &mac.node.path.to_string() == "try" { - let ts: TokenStream = mac.node.tts.clone(); + if &mac.path.to_string() == "try" { + let ts: TokenStream = mac.tts.clone(); let mut parser = new_parser_from_tts(context.parse_session, ts.trees().collect()); Some(ast::Expr { @@ -1532,7 +1532,7 @@ fn rewrite_macro_with_items( Some(result) } -const RUST_KW: [Symbol; 60] = [ +const RUST_KW: [Symbol; 59] = [ kw::PathRoot, kw::DollarCrate, kw::Underscore, @@ -1591,6 +1591,5 @@ const RUST_KW: [Symbol; 60] = [ kw::Auto, kw::Catch, kw::Default, - kw::Existential, kw::Union, ]; diff --git a/src/modules.rs b/src/modules.rs index 655d17d47a0..0c1ea008f68 100644 --- a/src/modules.rs +++ b/src/modules.rs @@ -442,7 +442,7 @@ fn parse_inner_attributes<'a>(parser: &mut parser::Parser<'a>) -> PResult<'a, Ve } TokenKind::DocComment(s) => { // we need to get the position of this token before we bump. - let attr = attr::mk_sugared_doc_attr(attr::mk_attr_id(), s, parser.token.span); + let attr = attr::mk_sugared_doc_attr(s, parser.token.span); if attr.style == ast::AttrStyle::Inner { attrs.push(attr); parser.bump(); @@ -478,7 +478,7 @@ fn parse_mod_items<'a>(parser: &mut parser::Parser<'a>, inner_lo: Span) -> PResu fn is_cfg_if(item: &ast::Item) -> bool { match item.node { ast::ItemKind::Mac(ref mac) => { - if let Some(first_segment) = mac.node.path.segments.first() { + if let Some(first_segment) = mac.path.segments.first() { if first_segment.ident.name == Symbol::intern("cfg_if") { return true; } diff --git a/src/modules/visitor.rs b/src/modules/visitor.rs index 48b56d4d102..34b7e346334 100644 --- a/src/modules/visitor.rs +++ b/src/modules/visitor.rs @@ -54,7 +54,7 @@ impl<'a, 'ast: 'a> CfgIfVisitor<'a> { // extern crate cfg_if; // cfg_if! {..} // ``` - match mac.node.path.segments.first() { + match mac.path.segments.first() { Some(first_segment) => { if first_segment.ident.name != Symbol::intern("cfg_if") { return Err("Expected cfg_if"); @@ -65,11 +65,8 @@ impl<'a, 'ast: 'a> CfgIfVisitor<'a> { } }; - let mut parser = stream_to_parser_with_base_dir( - self.parse_sess, - mac.node.tts.clone(), - self.base_dir.clone(), - ); + let mut parser = + stream_to_parser_with_base_dir(self.parse_sess, mac.tts.clone(), self.base_dir.clone()); parser.cfg_mods = false; let mut process_if_cfg = true; diff --git a/src/patterns.rs b/src/patterns.rs index a0493be0f1c..96d45c6ac55 100644 --- a/src/patterns.rs +++ b/src/patterns.rs @@ -1,13 +1,13 @@ use syntax::ast::{self, BindingMode, FieldPat, Pat, PatKind, RangeEnd, RangeSyntax}; use syntax::ptr; -use syntax::source_map::{self, BytePos, Span}; +use syntax::source_map::{BytePos, Span}; use crate::comment::{combine_strs_with_missing_comments, FindUncommented}; use crate::config::lists::*; use crate::expr::{can_be_overflowed_expr, rewrite_unary_prefix, wrap_struct_field}; use crate::lists::{ - itemize_list, shape_for_tactic, struct_lit_formatting, struct_lit_shape, struct_lit_tactic, - write_list, + definitive_tactic, itemize_list, shape_for_tactic, struct_lit_formatting, struct_lit_shape, + struct_lit_tactic, write_list, ListFormatting, Separator, }; use crate::macros::{rewrite_macro, MacroPosition}; use crate::overflow; @@ -51,12 +51,39 @@ fn is_short_pattern_inner(pat: &ast::Pat) -> bool { ast::PatKind::Box(ref p) | ast::PatKind::Ref(ref p, _) | ast::PatKind::Paren(ref p) => { is_short_pattern_inner(&*p) } + PatKind::Or(ref pats) => pats.iter().all(|p| is_short_pattern_inner(p)), } } impl Rewrite for Pat { fn rewrite(&self, context: &RewriteContext<'_>, shape: Shape) -> Option { match self.node { + PatKind::Or(ref pats) => { + let pat_items = itemize_list( + context.snippet_provider, + pats.iter(), + "", + "|", + |pat| pat.span().lo(), + |pat| pat.span().hi(), + |pat| pat.rewrite(context, shape), + self.span.lo(), + self.span.hi(), + false, + ); + let pat_vec: Vec<_> = pat_items.collect(); + let tactic = definitive_tactic( + &pat_vec, + ListTactic::HorizontalVertical, + Separator::VerticalBar, + shape.width, + ); + let fmt = ListFormatting::new(shape, context.config) + .tactic(tactic) + .trailing_separator(SeparatorTactic::Never) + .separator(" |"); + write_list(&pat_vec, &fmt) + } PatKind::Box(ref pat) => rewrite_unary_prefix(context, "box ", &**pat, shape), PatKind::Ident(binding_mode, ident, ref sub_pat) => { let (prefix, mutability) = match binding_mode { @@ -154,7 +181,7 @@ impl Rewrite for Pat { fn rewrite_struct_pat( path: &ast::Path, - fields: &[source_map::Spanned], + fields: &[ast::FieldPat], ellipsis: bool, span: Span, context: &RewriteContext<'_>, @@ -180,14 +207,14 @@ fn rewrite_struct_pat( terminator, ",", |f| { - if f.node.attrs.is_empty() { + if f.attrs.is_empty() { f.span.lo() } else { - f.node.attrs.first().unwrap().span.lo() + f.attrs.first().unwrap().span.lo() } }, |f| f.span.hi(), - |f| f.node.rewrite(context, v_shape), + |f| f.rewrite(context, v_shape), context.snippet_provider.span_after(span, "{"), span.hi(), false, diff --git a/src/spanned.rs b/src/spanned.rs index 00dd24a0f06..bbdee6ccf4b 100644 --- a/src/spanned.rs +++ b/src/spanned.rs @@ -104,7 +104,7 @@ impl Spanned for ast::Arm { } } -impl Spanned for ast::Arg { +impl Spanned for ast::Param { fn span(&self) -> Span { if crate::items::is_named_arg(self) { mk_sp(self.pat.span.lo(), self.ty.span.hi()) diff --git a/src/utils.rs b/src/utils.rs index 498608d4179..5b0d94e4780 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -8,7 +8,7 @@ use syntax::ast::{ VisibilityKind, }; use syntax::ptr; -use syntax::source_map::{BytePos, Span, NO_EXPANSION}; +use syntax::source_map::{BytePos, Span, SyntaxContext}; use syntax::symbol::{sym, Symbol}; use syntax_pos::ExpnId; use unicode_width::UnicodeWidthStr; @@ -335,7 +335,7 @@ macro_rules! source { } pub(crate) fn mk_sp(lo: BytePos, hi: BytePos) -> Span { - Span::new(lo, hi, NO_EXPANSION) + Span::new(lo, hi, SyntaxContext::root()) } // Returns `true` if the given span does not intersect with file lines. diff --git a/src/visitor.rs b/src/visitor.rs index dec39489a5e..831fd56819f 100644 --- a/src/visitor.rs +++ b/src/visitor.rs @@ -11,8 +11,8 @@ use crate::config::{BraceStyle, Config}; use crate::coverage::transform_missing_snippet; use crate::items::{ format_impl, format_trait, format_trait_alias, is_mod_decl, is_use_item, - rewrite_associated_impl_type, rewrite_associated_type, rewrite_existential_impl_type, - rewrite_existential_type, rewrite_extern_crate, rewrite_type_alias, FnBraceStyle, FnSig, + rewrite_associated_impl_type, rewrite_associated_type, rewrite_extern_crate, + rewrite_opaque_impl_type, rewrite_opaque_type, rewrite_type_alias, FnBraceStyle, FnSig, StaticParts, StructParts, }; use crate::macros::{rewrite_macro, rewrite_macro_def, MacroPosition}; @@ -97,11 +97,20 @@ impl<'b, 'a: 'b> FmtVisitor<'a> { fn visit_stmt(&mut self, stmt: &Stmt<'_>) { debug!( - "visit_stmt: {:?} {:?}", + "visit_stmt: {:?} {:?} `{}`", self.source_map.lookup_char_pos(stmt.span().lo()), - self.source_map.lookup_char_pos(stmt.span().hi()) + self.source_map.lookup_char_pos(stmt.span().hi()), + self.snippet(stmt.span()), ); + // https://github.com/rust-lang/rust/issues/63679. + let is_all_semicolons = + |snippet: &str| snippet.chars().all(|c| c.is_whitespace() || c == ';'); + if is_all_semicolons(&self.snippet(stmt.span())) { + self.last_pos = stmt.span().hi(); + return; + } + match stmt.as_ast_node().node { ast::StmtKind::Item(ref item) => { self.visit_item(item); @@ -468,7 +477,7 @@ impl<'b, 'a: 'b> FmtVisitor<'a> { Some(&inner_attrs), ) } - ast::ItemKind::Ty(ref ty, ref generics) => { + ast::ItemKind::TyAlias(ref ty, ref generics) => { let rewrite = rewrite_type_alias( &self.get_context(), self.block_indent, @@ -479,8 +488,8 @@ impl<'b, 'a: 'b> FmtVisitor<'a> { ); self.push_rewrite(item.span, rewrite); } - ast::ItemKind::Existential(ref generic_bounds, ref generics) => { - let rewrite = rewrite_existential_type( + ast::ItemKind::OpaqueTy(ref generic_bounds, ref generics) => { + let rewrite = rewrite_opaque_type( &self.get_context(), self.block_indent, item.ident, @@ -576,7 +585,7 @@ impl<'b, 'a: 'b> FmtVisitor<'a> { ); } ast::ImplItemKind::Const(..) => self.visit_static(&StaticParts::from_impl_item(ii)), - ast::ImplItemKind::Type(ref ty) => { + ast::ImplItemKind::TyAlias(ref ty) => { let rewrite = rewrite_associated_impl_type( ii.ident, ii.defaultness, @@ -587,8 +596,8 @@ impl<'b, 'a: 'b> FmtVisitor<'a> { ); self.push_rewrite(ii.span, rewrite); } - ast::ImplItemKind::Existential(ref generic_bounds) => { - let rewrite = rewrite_existential_impl_type( + ast::ImplItemKind::OpaqueTy(ref generic_bounds) => { + let rewrite = rewrite_opaque_impl_type( &self.get_context(), ii.ident, &ii.generics, diff --git a/tests/source/existential_type.rs b/tests/source/existential_type.rs index cbffbd99fd8..92412fca879 100644 --- a/tests/source/existential_type.rs +++ b/tests/source/existential_type.rs @@ -1,15 +1,15 @@ -// Existential type. +// Opaque type. - #![feature(existential_type)] + #![feature(type_alias_impl_trait)] -pub existential type Adder +pub type Adder where T: Clone, F: Copy - : Fn(T) -> T; + = impl Fn(T) -> T; -pub existential type Adderrr: Fn( T ) -> T; +pub type Adderrr = impl Fn( T ) -> T; impl Foo for Bar { -existential type E : Trait; +type E = impl Trait; } diff --git a/tests/source/issue-2863.rs b/tests/source/issue-2863.rs index 792ffdbac24..1bda857be76 100644 --- a/tests/source/issue-2863.rs +++ b/tests/source/issue-2863.rs @@ -1,7 +1,7 @@ // rustfmt-reorder_impl_items: true impl IntoIterator for SafeVec { - existential type F: Trait; + type F = impl Trait; type IntoIter = self::IntoIter; type Item = T; // comment on foo() @@ -19,7 +19,7 @@ impl IntoIterator for SafeVec { fn foo6() {println!("hello, world");} fn foo7() {println!("hello, world");} type BarFoo = u32; - existential type E: Trait; + type E = impl Trait; const AnotherConst: i32 = 100; fn foo8() {println!("hello, world");} } diff --git a/tests/target/existential_type.rs b/tests/target/existential_type.rs index 806220502e0..869ffda2378 100644 --- a/tests/target/existential_type.rs +++ b/tests/target/existential_type.rs @@ -1,15 +1,15 @@ -// Existential type. +// Opaque type. -#![feature(existential_type)] +#![feature(type_alias_impl_trait)] -pub existential type Adder +pub type Adder where T: Clone, F: Copy, -: Fn(T) -> T; += Fn(T) -> T; -pub existential type Adderrr: Fn(T) -> T; +pub type Adderrr = Fn(T) -> T; impl Foo for Bar { - existential type E: Trait; + type E = impl Trait; } diff --git a/tests/target/issue-2863.rs b/tests/target/issue-2863.rs index a53628e3ea9..35a80f7a621 100644 --- a/tests/target/issue-2863.rs +++ b/tests/target/issue-2863.rs @@ -9,8 +9,8 @@ impl IntoIterator for SafeVec { type IntoIter = self::IntoIter; type Item = T; - existential type E: Trait; - existential type F: Trait; + type E = impl Trait; + type F = impl Trait; const AnotherConst: i32 = 100; const SomeConst: i32 = 100; From d5944c9af78c855505a03d880afb92b64567d17d Mon Sep 17 00:00:00 2001 From: topecongiro Date: Fri, 6 Sep 2019 22:48:39 +0900 Subject: [PATCH 2/3] Update CHANGELOG.md --- CHANGELOG.md | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1232d6e374d..add442f350f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,9 +2,27 @@ ## [Unreleased] +## [1.4.7] 2019-09-06 + +### Added + +- Add `--config` command line option. + +### Changed + +- Update `rustc-ap-*` crates to 581.0.0. +- rustfmt now do not warn against trailing whitespaces inside macro calls. + +### Fixed + +- Fix `merge_imports` generating invalid code. +- Fix removing discriminant values on enum variants. +- Fix modules defined inside `cfg_if!` not being formatted. +- Fix minor formatting issues. + ## [1.4.6] 2019-08-28 -## Added +### Added - Add `--message-format` command line option to `cargo-fmt`. - Add `-l,--files-with-diff` command line option to `rustfmt`. From 6fec3a69ec44a8fcc4a0c4e2c2c223da4f0b0161 Mon Sep 17 00:00:00 2001 From: topecongiro Date: Fri, 6 Sep 2019 22:51:13 +0900 Subject: [PATCH 3/3] Release v1.4.7 --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9dcc509bba9..6609a4df3dd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -882,7 +882,7 @@ dependencies = [ [[package]] name = "rustfmt-nightly" -version = "1.4.6" +version = "1.4.7" dependencies = [ "annotate-snippets 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/Cargo.toml b/Cargo.toml index 27cf07c1332..50ee8a01d94 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rustfmt-nightly" -version = "1.4.6" +version = "1.4.7" authors = ["Nicholas Cameron ", "The Rustfmt developers"] description = "Tool to find and fix Rust formatting issues" repository = "https://github.com/rust-lang/rustfmt"