aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.lock117
-rw-r--r--crates/ra_assists/src/ast_editor.rs30
-rw-r--r--crates/ra_assists/src/lib.rs2
-rw-r--r--crates/ra_assists/src/move_bounds.rs135
-rw-r--r--crates/ra_hir/src/marks.rs1
-rw-r--r--crates/ra_hir/src/nameres.rs3
-rw-r--r--crates/ra_hir/src/nameres/collector.rs48
-rw-r--r--crates/ra_hir/src/nameres/raw.rs13
-rw-r--r--crates/ra_hir/src/nameres/tests/macros.rs64
-rw-r--r--crates/ra_project_model/src/lib.rs2
-rw-r--r--crates/ra_syntax/src/ast/generated.rs1
-rw-r--r--crates/ra_syntax/src/grammar.ron1
-rw-r--r--docs/user/features.md10
13 files changed, 351 insertions, 76 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 27e0a82af..904d46b94 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -32,7 +32,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
32 32
33[[package]] 33[[package]]
34name = "backtrace" 34name = "backtrace"
35version = "0.3.35" 35version = "0.3.37"
36source = "registry+https://github.com/rust-lang/crates.io-index" 36source = "registry+https://github.com/rust-lang/crates.io-index"
37dependencies = [ 37dependencies = [
38 "backtrace-sys 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)", 38 "backtrace-sys 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -78,7 +78,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
78 78
79[[package]] 79[[package]]
80name = "bstr" 80name = "bstr"
81version = "0.2.7" 81version = "0.2.8"
82source = "registry+https://github.com/rust-lang/crates.io-index" 82source = "registry+https://github.com/rust-lang/crates.io-index"
83dependencies = [ 83dependencies = [
84 "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", 84 "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -176,7 +176,7 @@ dependencies = [
176 176
177[[package]] 177[[package]]
178name = "chrono" 178name = "chrono"
179version = "0.4.7" 179version = "0.4.9"
180source = "registry+https://github.com/rust-lang/crates.io-index" 180source = "registry+https://github.com/rust-lang/crates.io-index"
181dependencies = [ 181dependencies = [
182 "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", 182 "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -223,7 +223,7 @@ dependencies = [
223 "encode_unicode 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", 223 "encode_unicode 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
224 "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 224 "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
225 "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", 225 "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
226 "regex 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", 226 "regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
227 "termios 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 227 "termios 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
228 "unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", 228 "unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
229 "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", 229 "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -252,15 +252,6 @@ dependencies = [
252 252
253[[package]] 253[[package]]
254name = "crossbeam-deque" 254name = "crossbeam-deque"
255version = "0.6.3"
256source = "registry+https://github.com/rust-lang/crates.io-index"
257dependencies = [
258 "crossbeam-epoch 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
259 "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
260]
261
262[[package]]
263name = "crossbeam-deque"
264version = "0.7.1" 255version = "0.7.1"
265source = "registry+https://github.com/rust-lang/crates.io-index" 256source = "registry+https://github.com/rust-lang/crates.io-index"
266dependencies = [ 257dependencies = [
@@ -303,7 +294,7 @@ name = "derive-new"
303version = "0.5.8" 294version = "0.5.8"
304source = "registry+https://github.com/rust-lang/crates.io-index" 295source = "registry+https://github.com/rust-lang/crates.io-index"
305dependencies = [ 296dependencies = [
306 "proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", 297 "proc-macro2 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
307 "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", 298 "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
308 "syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", 299 "syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
309] 300]
@@ -346,7 +337,7 @@ name = "failure"
346version = "0.1.5" 337version = "0.1.5"
347source = "registry+https://github.com/rust-lang/crates.io-index" 338source = "registry+https://github.com/rust-lang/crates.io-index"
348dependencies = [ 339dependencies = [
349 "backtrace 0.3.35 (registry+https://github.com/rust-lang/crates.io-index)", 340 "backtrace 0.3.37 (registry+https://github.com/rust-lang/crates.io-index)",
350 "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", 341 "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
351] 342]
352 343
@@ -363,12 +354,13 @@ dependencies = [
363 354
364[[package]] 355[[package]]
365name = "filetime" 356name = "filetime"
366version = "0.2.5" 357version = "0.2.7"
367source = "registry+https://github.com/rust-lang/crates.io-index" 358source = "registry+https://github.com/rust-lang/crates.io-index"
368dependencies = [ 359dependencies = [
369 "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", 360 "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
370 "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", 361 "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
371 "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", 362 "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)",
363 "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
372] 364]
373 365
374[[package]] 366[[package]]
@@ -381,10 +373,10 @@ name = "flexi_logger"
381version = "0.14.3" 373version = "0.14.3"
382source = "registry+https://github.com/rust-lang/crates.io-index" 374source = "registry+https://github.com/rust-lang/crates.io-index"
383dependencies = [ 375dependencies = [
384 "chrono 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", 376 "chrono 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)",
385 "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", 377 "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
386 "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", 378 "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
387 "regex 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", 379 "regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
388 "yansi 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", 380 "yansi 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
389] 381]
390 382
@@ -468,10 +460,10 @@ version = "0.4.4"
468source = "registry+https://github.com/rust-lang/crates.io-index" 460source = "registry+https://github.com/rust-lang/crates.io-index"
469dependencies = [ 461dependencies = [
470 "aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)", 462 "aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)",
471 "bstr 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", 463 "bstr 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
472 "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", 464 "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
473 "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", 465 "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
474 "regex 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", 466 "regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
475] 467]
476 468
477[[package]] 469[[package]]
@@ -506,7 +498,7 @@ dependencies = [
506 "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 498 "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
507 "number_prefix 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", 499 "number_prefix 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
508 "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", 500 "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
509 "regex 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", 501 "regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
510] 502]
511 503
512[[package]] 504[[package]]
@@ -749,11 +741,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
749 741
750[[package]] 742[[package]]
751name = "notify" 743name = "notify"
752version = "4.0.12" 744version = "4.0.13"
753source = "registry+https://github.com/rust-lang/crates.io-index" 745source = "registry+https://github.com/rust-lang/crates.io-index"
754dependencies = [ 746dependencies = [
755 "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 747 "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
756 "filetime 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", 748 "filetime 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
757 "fsevent 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 749 "fsevent 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
758 "fsevent-sys 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", 750 "fsevent-sys 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
759 "inotify 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", 751 "inotify 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -800,7 +792,7 @@ dependencies = [
800 792
801[[package]] 793[[package]]
802name = "once_cell" 794name = "once_cell"
803version = "1.0.1" 795version = "1.0.2"
804source = "registry+https://github.com/rust-lang/crates.io-index" 796source = "registry+https://github.com/rust-lang/crates.io-index"
805 797
806[[package]] 798[[package]]
@@ -847,7 +839,7 @@ version = "0.1.6"
847source = "registry+https://github.com/rust-lang/crates.io-index" 839source = "registry+https://github.com/rust-lang/crates.io-index"
848dependencies = [ 840dependencies = [
849 "proc-macro-hack 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)", 841 "proc-macro-hack 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
850 "proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", 842 "proc-macro2 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
851 "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", 843 "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
852 "syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", 844 "syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
853] 845]
@@ -876,7 +868,7 @@ name = "proc-macro-hack"
876version = "0.5.9" 868version = "0.5.9"
877source = "registry+https://github.com/rust-lang/crates.io-index" 869source = "registry+https://github.com/rust-lang/crates.io-index"
878dependencies = [ 870dependencies = [
879 "proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", 871 "proc-macro2 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
880 "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", 872 "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
881 "syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", 873 "syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
882] 874]
@@ -891,7 +883,7 @@ dependencies = [
891 883
892[[package]] 884[[package]]
893name = "proc-macro2" 885name = "proc-macro2"
894version = "1.0.1" 886version = "1.0.2"
895source = "registry+https://github.com/rust-lang/crates.io-index" 887source = "registry+https://github.com/rust-lang/crates.io-index"
896dependencies = [ 888dependencies = [
897 "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", 889 "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -911,7 +903,7 @@ dependencies = [
911 "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", 903 "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
912 "rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 904 "rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
913 "rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 905 "rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
914 "regex-syntax 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", 906 "regex-syntax 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)",
915] 907]
916 908
917[[package]] 909[[package]]
@@ -932,7 +924,7 @@ name = "quote"
932version = "1.0.2" 924version = "1.0.2"
933source = "registry+https://github.com/rust-lang/crates.io-index" 925source = "registry+https://github.com/rust-lang/crates.io-index"
934dependencies = [ 926dependencies = [
935 "proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", 927 "proc-macro2 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
936] 928]
937 929
938[[package]] 930[[package]]
@@ -947,7 +939,7 @@ dependencies = [
947 "format-buf 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", 939 "format-buf 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
948 "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", 940 "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
949 "join_to_string 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", 941 "join_to_string 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
950 "once_cell 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", 942 "once_cell 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
951 "ra_db 0.1.0", 943 "ra_db 0.1.0",
952 "ra_fmt 0.1.0", 944 "ra_fmt 0.1.0",
953 "ra_hir 0.1.0", 945 "ra_hir 0.1.0",
@@ -1017,7 +1009,7 @@ dependencies = [
1017 "insta 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", 1009 "insta 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
1018 "lalrpop-intern 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)", 1010 "lalrpop-intern 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)",
1019 "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", 1011 "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
1020 "once_cell 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", 1012 "once_cell 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
1021 "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", 1013 "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
1022 "ra_arena 0.1.0", 1014 "ra_arena 0.1.0",
1023 "ra_db 0.1.0", 1015 "ra_db 0.1.0",
@@ -1049,12 +1041,12 @@ dependencies = [
1049 "ra_syntax 0.1.0", 1041 "ra_syntax 0.1.0",
1050 "ra_text_edit 0.1.0", 1042 "ra_text_edit 0.1.0",
1051 "rand 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", 1043 "rand 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
1052 "rayon 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 1044 "rayon 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
1053 "relative-path 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 1045 "relative-path 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
1054 "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", 1046 "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
1055 "superslice 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", 1047 "superslice 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
1056 "test_utils 0.1.0", 1048 "test_utils 0.1.0",
1057 "unicase 2.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 1049 "unicase 2.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
1058] 1050]
1059 1051
1060[[package]] 1052[[package]]
@@ -1108,11 +1100,11 @@ dependencies = [
1108name = "ra_prof" 1100name = "ra_prof"
1109version = "0.1.0" 1101version = "0.1.0"
1110dependencies = [ 1102dependencies = [
1111 "backtrace 0.3.35 (registry+https://github.com/rust-lang/crates.io-index)", 1103 "backtrace 0.3.37 (registry+https://github.com/rust-lang/crates.io-index)",
1112 "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", 1104 "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
1113 "jemalloc-ctl 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", 1105 "jemalloc-ctl 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
1114 "jemallocator 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", 1106 "jemallocator 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
1115 "once_cell 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", 1107 "once_cell 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
1116] 1108]
1117 1109
1118[[package]] 1110[[package]]
@@ -1165,7 +1157,7 @@ version = "0.1.0"
1165dependencies = [ 1157dependencies = [
1166 "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", 1158 "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)",
1167 "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", 1159 "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
1168 "proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", 1160 "proc-macro2 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
1169 "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", 1161 "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
1170 "ron 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", 1162 "ron 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
1171 "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", 1163 "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1187,7 +1179,7 @@ dependencies = [
1187 "crossbeam-channel 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", 1179 "crossbeam-channel 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
1188 "jod-thread 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 1180 "jod-thread 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
1189 "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", 1181 "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
1190 "notify 4.0.12 (registry+https://github.com/rust-lang/crates.io-index)", 1182 "notify 4.0.13 (registry+https://github.com/rust-lang/crates.io-index)",
1191 "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", 1183 "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
1192 "relative-path 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 1184 "relative-path 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
1193 "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", 1185 "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1347,20 +1339,20 @@ dependencies = [
1347 1339
1348[[package]] 1340[[package]]
1349name = "rayon" 1341name = "rayon"
1350version = "1.1.0" 1342version = "1.2.0"
1351source = "registry+https://github.com/rust-lang/crates.io-index" 1343source = "registry+https://github.com/rust-lang/crates.io-index"
1352dependencies = [ 1344dependencies = [
1353 "crossbeam-deque 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", 1345 "crossbeam-deque 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
1354 "either 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)", 1346 "either 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
1355 "rayon-core 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", 1347 "rayon-core 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
1356] 1348]
1357 1349
1358[[package]] 1350[[package]]
1359name = "rayon-core" 1351name = "rayon-core"
1360version = "1.5.0" 1352version = "1.6.0"
1361source = "registry+https://github.com/rust-lang/crates.io-index" 1353source = "registry+https://github.com/rust-lang/crates.io-index"
1362dependencies = [ 1354dependencies = [
1363 "crossbeam-deque 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", 1355 "crossbeam-deque 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
1364 "crossbeam-queue 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", 1356 "crossbeam-queue 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
1365 "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", 1357 "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
1366 "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 1358 "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1382,18 +1374,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
1382 1374
1383[[package]] 1375[[package]]
1384name = "regex" 1376name = "regex"
1385version = "1.2.1" 1377version = "1.3.1"
1386source = "registry+https://github.com/rust-lang/crates.io-index" 1378source = "registry+https://github.com/rust-lang/crates.io-index"
1387dependencies = [ 1379dependencies = [
1388 "aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)", 1380 "aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)",
1389 "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", 1381 "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
1390 "regex-syntax 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", 1382 "regex-syntax 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)",
1391 "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", 1383 "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
1392] 1384]
1393 1385
1394[[package]] 1386[[package]]
1395name = "regex-syntax" 1387name = "regex-syntax"
1396version = "0.6.11" 1388version = "0.6.12"
1397source = "registry+https://github.com/rust-lang/crates.io-index" 1389source = "registry+https://github.com/rust-lang/crates.io-index"
1398 1390
1399[[package]] 1391[[package]]
@@ -1477,7 +1469,7 @@ version = "0.13.1"
1477source = "registry+https://github.com/rust-lang/crates.io-index" 1469source = "registry+https://github.com/rust-lang/crates.io-index"
1478dependencies = [ 1470dependencies = [
1479 "heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 1471 "heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
1480 "proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", 1472 "proc-macro2 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
1481 "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", 1473 "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
1482 "syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", 1474 "syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
1483] 1475]
@@ -1522,7 +1514,7 @@ name = "serde_derive"
1522version = "1.0.99" 1514version = "1.0.99"
1523source = "registry+https://github.com/rust-lang/crates.io-index" 1515source = "registry+https://github.com/rust-lang/crates.io-index"
1524dependencies = [ 1516dependencies = [
1525 "proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", 1517 "proc-macro2 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
1526 "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", 1518 "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
1527 "syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", 1519 "syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
1528] 1520]
@@ -1542,7 +1534,7 @@ name = "serde_repr"
1542version = "0.1.5" 1534version = "0.1.5"
1543source = "registry+https://github.com/rust-lang/crates.io-index" 1535source = "registry+https://github.com/rust-lang/crates.io-index"
1544dependencies = [ 1536dependencies = [
1545 "proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", 1537 "proc-macro2 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
1546 "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", 1538 "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
1547 "syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", 1539 "syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
1548] 1540]
@@ -1607,7 +1599,7 @@ name = "syn"
1607version = "1.0.5" 1599version = "1.0.5"
1608source = "registry+https://github.com/rust-lang/crates.io-index" 1600source = "registry+https://github.com/rust-lang/crates.io-index"
1609dependencies = [ 1601dependencies = [
1610 "proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", 1602 "proc-macro2 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
1611 "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", 1603 "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
1612 "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", 1604 "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
1613] 1605]
@@ -1694,7 +1686,7 @@ dependencies = [
1694 1686
1695[[package]] 1687[[package]]
1696name = "unicase" 1688name = "unicase"
1697version = "2.4.0" 1689version = "2.5.1"
1698source = "registry+https://github.com/rust-lang/crates.io-index" 1690source = "registry+https://github.com/rust-lang/crates.io-index"
1699dependencies = [ 1691dependencies = [
1700 "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", 1692 "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1847,13 +1839,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
1847"checksum arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "b8d73f9beda665eaa98ab9e4f7442bd4e7de6652587de55b2525e52e29c1b0ba" 1839"checksum arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "b8d73f9beda665eaa98ab9e4f7442bd4e7de6652587de55b2525e52e29c1b0ba"
1848"checksum atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "1803c647a3ec87095e7ae7acfca019e98de5ec9a7d01343f611cf3152ed71a90" 1840"checksum atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "1803c647a3ec87095e7ae7acfca019e98de5ec9a7d01343f611cf3152ed71a90"
1849"checksum autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "b671c8fb71b457dd4ae18c4ba1e59aa81793daacc361d82fcd410cef0d491875" 1841"checksum autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "b671c8fb71b457dd4ae18c4ba1e59aa81793daacc361d82fcd410cef0d491875"
1850"checksum backtrace 0.3.35 (registry+https://github.com/rust-lang/crates.io-index)" = "1371048253fa3bac6704bfd6bbfc922ee9bdcee8881330d40f308b81cc5adc55" 1842"checksum backtrace 0.3.37 (registry+https://github.com/rust-lang/crates.io-index)" = "5180c5a20655b14a819b652fd2378fa5f1697b6c9ddad3e695c2f9cedf6df4e2"
1851"checksum backtrace-sys 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)" = "82a830b4ef2d1124a711c71d263c5abdc710ef8e907bd508c88be475cebc422b" 1843"checksum backtrace-sys 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)" = "82a830b4ef2d1124a711c71d263c5abdc710ef8e907bd508c88be475cebc422b"
1852"checksum base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e" 1844"checksum base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e"
1853"checksum bit-set 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e84c238982c4b1e1ee668d136c510c67a13465279c0cb367ea6baf6310620a80" 1845"checksum bit-set 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e84c238982c4b1e1ee668d136c510c67a13465279c0cb367ea6baf6310620a80"
1854"checksum bit-vec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f59bbe95d4e52a6398ec21238d31577f2b28a9d86807f06ca59d191d8440d0bb" 1846"checksum bit-vec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f59bbe95d4e52a6398ec21238d31577f2b28a9d86807f06ca59d191d8440d0bb"
1855"checksum bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3d155346769a6855b86399e9bc3814ab343cd3d62c7e985113d46a0ec3c281fd" 1847"checksum bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3d155346769a6855b86399e9bc3814ab343cd3d62c7e985113d46a0ec3c281fd"
1856"checksum bstr 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "94cdf78eb7e94c566c1f5dbe2abf8fc70a548fc902942a48c4b3a98b48ca9ade" 1848"checksum bstr 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8d6c2c5b58ab920a4f5aeaaca34b4488074e8cc7596af94e6f8c6ff247c60245"
1857"checksum byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c3dd8985a7111efc5c80b44e23ecdd8c007de8ade3b96595387e812b957cf5" 1849"checksum byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c3dd8985a7111efc5c80b44e23ecdd8c007de8ade3b96595387e812b957cf5"
1858"checksum c2-chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7d64d04786e0f528460fc884753cf8dddcc466be308f6026f8e355c41a0e4101" 1850"checksum c2-chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7d64d04786e0f528460fc884753cf8dddcc466be308f6026f8e355c41a0e4101"
1859"checksum cargo_metadata 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "700b3731fd7d357223d0000f4dbf1808401b694609035c3c411fbc0cd375c426" 1851"checksum cargo_metadata 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "700b3731fd7d357223d0000f4dbf1808401b694609035c3c411fbc0cd375c426"
@@ -1864,14 +1856,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
1864"checksum chalk-macros 0.1.1 (git+https://github.com/rust-lang/chalk.git)" = "<none>" 1856"checksum chalk-macros 0.1.1 (git+https://github.com/rust-lang/chalk.git)" = "<none>"
1865"checksum chalk-rust-ir 0.1.0 (git+https://github.com/rust-lang/chalk.git)" = "<none>" 1857"checksum chalk-rust-ir 0.1.0 (git+https://github.com/rust-lang/chalk.git)" = "<none>"
1866"checksum chalk-solve 0.1.0 (git+https://github.com/rust-lang/chalk.git)" = "<none>" 1858"checksum chalk-solve 0.1.0 (git+https://github.com/rust-lang/chalk.git)" = "<none>"
1867"checksum chrono 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "77d81f58b7301084de3b958691458a53c3f7e0b1d702f77e550b6a88e3a88abe" 1859"checksum chrono 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e8493056968583b0193c1bb04d6f7684586f3726992d6c573261941a895dbd68"
1868"checksum clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9" 1860"checksum clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9"
1869"checksum clicolors-control 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "90082ee5dcdd64dc4e9e0d37fbf3ee325419e39c0092191e0393df65518f741e" 1861"checksum clicolors-control 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "90082ee5dcdd64dc4e9e0d37fbf3ee325419e39c0092191e0393df65518f741e"
1870"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" 1862"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f"
1871"checksum console 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b147390a412132d75d10dd3b7b175a69cf5fd95032f7503c7091b8831ba10242" 1863"checksum console 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b147390a412132d75d10dd3b7b175a69cf5fd95032f7503c7091b8831ba10242"
1872"checksum crossbeam 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2d818a4990769aac0c7ff1360e233ef3a41adcb009ebb2036bf6915eb0f6b23c" 1864"checksum crossbeam 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2d818a4990769aac0c7ff1360e233ef3a41adcb009ebb2036bf6915eb0f6b23c"
1873"checksum crossbeam-channel 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c8ec7fcd21571dc78f96cc96243cab8d8f035247c3efd16c687be154c3fa9efa" 1865"checksum crossbeam-channel 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c8ec7fcd21571dc78f96cc96243cab8d8f035247c3efd16c687be154c3fa9efa"
1874"checksum crossbeam-deque 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "05e44b8cf3e1a625844d1750e1f7820da46044ff6d28f4d43e455ba3e5bb2c13"
1875"checksum crossbeam-deque 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b18cd2e169ad86297e6bc0ad9aa679aee9daa4f19e8163860faf7c164e4f5a71" 1866"checksum crossbeam-deque 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b18cd2e169ad86297e6bc0ad9aa679aee9daa4f19e8163860faf7c164e4f5a71"
1876"checksum crossbeam-epoch 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "fedcd6772e37f3da2a9af9bf12ebe046c0dfe657992377b4df982a2b54cd37a9" 1867"checksum crossbeam-epoch 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "fedcd6772e37f3da2a9af9bf12ebe046c0dfe657992377b4df982a2b54cd37a9"
1877"checksum crossbeam-queue 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7c979cd6cfe72335896575c6b5688da489e420d36a27a0b9eb0c73db574b4a4b" 1868"checksum crossbeam-queue 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7c979cd6cfe72335896575c6b5688da489e420d36a27a0b9eb0c73db574b4a4b"
@@ -1885,7 +1876,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
1885"checksum encode_unicode 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" 1876"checksum encode_unicode 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f"
1886"checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2" 1877"checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2"
1887"checksum failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea1063915fd7ef4309e222a5a07cf9c319fb9c7836b1f89b85458672dbb127e1" 1878"checksum failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea1063915fd7ef4309e222a5a07cf9c319fb9c7836b1f89b85458672dbb127e1"
1888"checksum filetime 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "2f8c63033fcba1f51ef744505b3cad42510432b904c062afa67ad7ece008429d" 1879"checksum filetime 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "6bd7380b54ced79dda72ecc35cc4fbbd1da6bba54afaa37e96fd1c2a308cd469"
1889"checksum fixedbitset 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "86d4de0081402f5e88cdac65c8dcdcc73118c1a7a465e2a05f0da05843a8ea33" 1880"checksum fixedbitset 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "86d4de0081402f5e88cdac65c8dcdcc73118c1a7a465e2a05f0da05843a8ea33"
1890"checksum flexi_logger 0.14.3 (registry+https://github.com/rust-lang/crates.io-index)" = "66473c1b6a0d2a72f6ed983d33021a4c744a1d179e6f4265867b7d0a9dd679c5" 1881"checksum flexi_logger 0.14.3 (registry+https://github.com/rust-lang/crates.io-index)" = "66473c1b6a0d2a72f6ed983d33021a4c744a1d179e6f4265867b7d0a9dd679c5"
1891"checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" 1882"checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3"
@@ -1933,12 +1924,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
1933"checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" 1924"checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919"
1934"checksum net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88" 1925"checksum net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88"
1935"checksum nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9667ddcc6cc8a43afc9b7917599d7216aa09c463919ea32c59ed6cac8bc945" 1926"checksum nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9667ddcc6cc8a43afc9b7917599d7216aa09c463919ea32c59ed6cac8bc945"
1936"checksum notify 4.0.12 (registry+https://github.com/rust-lang/crates.io-index)" = "3572d71f13ea8ed41867accd971fd564aa75934cf7a1fae03ddb8c74a8a49943" 1927"checksum notify 4.0.13 (registry+https://github.com/rust-lang/crates.io-index)" = "1191efa2b8fe041decb55c238a125b7a1aeb6fad7a525133a02be5ec949ff3cb"
1937"checksum num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "b85e541ef8255f6cf42bbfe4ef361305c6c135d10919ecc26126c4e5ae94bc09" 1928"checksum num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "b85e541ef8255f6cf42bbfe4ef361305c6c135d10919ecc26126c4e5ae94bc09"
1938"checksum num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "6ba9a427cfca2be13aa6f6403b0b7e7368fe982bfa16fccc450ce74c46cd9b32" 1929"checksum num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "6ba9a427cfca2be13aa6f6403b0b7e7368fe982bfa16fccc450ce74c46cd9b32"
1939"checksum num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bcef43580c035376c0705c42792c294b66974abbfd2789b511784023f71f3273" 1930"checksum num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bcef43580c035376c0705c42792c294b66974abbfd2789b511784023f71f3273"
1940"checksum number_prefix 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "dbf9993e59c894e3c08aa1c2712914e9e6bf1fcbfc6bef283e2183df345a4fee" 1931"checksum number_prefix 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "dbf9993e59c894e3c08aa1c2712914e9e6bf1fcbfc6bef283e2183df345a4fee"
1941"checksum once_cell 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c9192c5a4c3b5488dae8d3886ef9df6b5eb246d36323dc7a5078595a154e7771" 1932"checksum once_cell 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bd38c1bb51148ca239ec38ef1bb4f7570d432861f03e91774d53b01c2ba2132f"
1942"checksum ordermap 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "a86ed3f5f244b372d6b1a00b72ef7f8876d0bc6a78a4c9985c53614041512063" 1933"checksum ordermap 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "a86ed3f5f244b372d6b1a00b72ef7f8876d0bc6a78a4c9985c53614041512063"
1943"checksum parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f842b1982eb6c2fe34036a4fbfb06dd185a3f5c8edfaacdf7d1ea10b07de6252" 1934"checksum parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f842b1982eb6c2fe34036a4fbfb06dd185a3f5c8edfaacdf7d1ea10b07de6252"
1944"checksum parking_lot_core 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b876b1b9e7ac6e1a74a6da34d25c42e17e8862aa409cbbbdcfc8d86c6f3bc62b" 1935"checksum parking_lot_core 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b876b1b9e7ac6e1a74a6da34d25c42e17e8862aa409cbbbdcfc8d86c6f3bc62b"
@@ -1949,7 +1940,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
1949"checksum ppv-lite86 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e3cbf9f658cdb5000fcf6f362b8ea2ba154b9f146a61c7a20d647034c6b6561b" 1940"checksum ppv-lite86 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e3cbf9f658cdb5000fcf6f362b8ea2ba154b9f146a61c7a20d647034c6b6561b"
1950"checksum proc-macro-hack 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e688f31d92ffd7c1ddc57a1b4e6d773c0f2a14ee437a4b0a4f5a69c80eb221c8" 1941"checksum proc-macro-hack 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e688f31d92ffd7c1ddc57a1b4e6d773c0f2a14ee437a4b0a4f5a69c80eb221c8"
1951"checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" 1942"checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759"
1952"checksum proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4c5c2380ae88876faae57698be9e9775e3544decad214599c3a6266cca6ac802" 1943"checksum proc-macro2 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "175a40b9cf564ce9bf050654633dbf339978706b8ead1a907bb970b63185dd95"
1953"checksum proptest 0.9.4 (registry+https://github.com/rust-lang/crates.io-index)" = "cf147e022eacf0c8a054ab864914a7602618adba841d800a9a9868a5237a529f" 1944"checksum proptest 0.9.4 (registry+https://github.com/rust-lang/crates.io-index)" = "cf147e022eacf0c8a054ab864914a7602618adba841d800a9a9868a5237a529f"
1954"checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" 1945"checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0"
1955"checksum quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" 1946"checksum quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1"
@@ -1971,12 +1962,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
1971"checksum rand_pcg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "abf9b09b01790cfe0364f52bf32995ea3c39f4d2dd011eac241d2914146d0b44" 1962"checksum rand_pcg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "abf9b09b01790cfe0364f52bf32995ea3c39f4d2dd011eac241d2914146d0b44"
1972"checksum rand_pcg 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3e196346cbbc5c70c77e7b4926147ee8e383a38ee4d15d58a08098b169e492b6" 1963"checksum rand_pcg 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3e196346cbbc5c70c77e7b4926147ee8e383a38ee4d15d58a08098b169e492b6"
1973"checksum rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" 1964"checksum rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c"
1974"checksum rayon 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a4b0186e22767d5b9738a05eab7c6ac90b15db17e5b5f9bd87976dd7d89a10a4" 1965"checksum rayon 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "83a27732a533a1be0a0035a111fe76db89ad312f6f0347004c220c57f209a123"
1975"checksum rayon-core 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ebbe0df8435ac0c397d467b6cad6d25543d06e8a019ef3f6af3c384597515bd2" 1966"checksum rayon-core 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "98dcf634205083b17d0861252431eb2acbfb698ab7478a2d20de07954f47ec7b"
1976"checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" 1967"checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2"
1977"checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84" 1968"checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84"
1978"checksum regex 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88c3d9193984285d544df4a30c23a4e62ead42edf70a4452ceb76dac1ce05c26" 1969"checksum regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dc220bd33bdce8f093101afe22a037b8eb0e5af33592e6a9caafff0d4cb81cbd"
1979"checksum regex-syntax 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)" = "b143cceb2ca5e56d5671988ef8b15615733e7ee16cd348e064333b251b89343f" 1970"checksum regex-syntax 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)" = "11a7e20d1cce64ef2fed88b66d347f88bd9babb82845b2b858f3edbf59a4f716"
1980"checksum relative-path 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0e7790c7f1cc73d831d28dc5a7deb316a006e7848e6a7f467cdb10a0a9e0fb1c" 1971"checksum relative-path 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0e7790c7f1cc73d831d28dc5a7deb316a006e7848e6a7f467cdb10a0a9e0fb1c"
1981"checksum remove_dir_all 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4a83fa3702a688b9359eccba92d153ac33fd2e8462f9e0e3fdf155239ea7792e" 1972"checksum remove_dir_all 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4a83fa3702a688b9359eccba92d153ac33fd2e8462f9e0e3fdf155239ea7792e"
1982"checksum ron 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2ece421e0c4129b90e4a35b6f625e472e96c552136f5093a2f4fa2bbb75a62d5" 1973"checksum ron 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2ece421e0c4129b90e4a35b6f625e472e96c552136f5093a2f4fa2bbb75a62d5"
@@ -2011,7 +2002,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
2011"checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" 2002"checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b"
2012"checksum threadpool 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e2f0c90a5f3459330ac8bc0d2f879c693bb7a2f59689c1083fc4ef83834da865" 2003"checksum threadpool 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e2f0c90a5f3459330ac8bc0d2f879c693bb7a2f59689c1083fc4ef83834da865"
2013"checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" 2004"checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f"
2014"checksum unicase 2.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a84e5511b2a947f3ae965dcb29b13b7b1691b6e7332cf5dbc1744138d5acb7f6" 2005"checksum unicase 2.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2e2e6bd1e59e56598518beb94fd6db628ded570326f0a98c679a304bd9f00150"
2015"checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" 2006"checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5"
2016"checksum unicode-normalization 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "141339a08b982d942be2ca06ff8b076563cbe223d1befd5450716790d44e2426" 2007"checksum unicode-normalization 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "141339a08b982d942be2ca06ff8b076563cbe223d1befd5450716790d44e2426"
2017"checksum unicode-segmentation 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1967f4cdfc355b37fd76d2a954fb2ed3871034eb4f26d60537d88795cfc332a9" 2008"checksum unicode-segmentation 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1967f4cdfc355b37fd76d2a954fb2ed3871034eb4f26d60537d88795cfc332a9"
diff --git a/crates/ra_assists/src/ast_editor.rs b/crates/ra_assists/src/ast_editor.rs
index 048478662..a710edce8 100644
--- a/crates/ra_assists/src/ast_editor.rs
+++ b/crates/ra_assists/src/ast_editor.rs
@@ -297,6 +297,11 @@ impl AstBuilder<ast::Path> {
297 ast_node_from_file_text(text) 297 ast_node_from_file_text(text)
298 } 298 }
299 299
300 pub fn from_name(name: ast::Name) -> ast::Path {
301 let name = name.syntax().to_string();
302 Self::from_text(name.as_str())
303 }
304
300 pub fn from_pieces(enum_name: ast::Name, var_name: ast::Name) -> ast::Path { 305 pub fn from_pieces(enum_name: ast::Name, var_name: ast::Name) -> ast::Path {
301 Self::from_text(&format!("{}::{}", enum_name.syntax(), var_name.syntax())) 306 Self::from_text(&format!("{}::{}", enum_name.syntax(), var_name.syntax()))
302 } 307 }
@@ -380,6 +385,31 @@ impl AstBuilder<ast::MatchArmList> {
380 } 385 }
381} 386}
382 387
388impl AstBuilder<ast::WherePred> {
389 fn from_text(text: &str) -> ast::WherePred {
390 ast_node_from_file_text(&format!("fn f() where {} {{ }}", text))
391 }
392
393 pub fn from_pieces(
394 path: ast::Path,
395 bounds: impl Iterator<Item = ast::TypeBound>,
396 ) -> ast::WherePred {
397 let bounds = bounds.map(|b| b.syntax().to_string()).collect::<Vec<_>>().join(" + ");
398 Self::from_text(&format!("{}: {}", path.syntax(), bounds))
399 }
400}
401
402impl AstBuilder<ast::WhereClause> {
403 fn from_text(text: &str) -> ast::WhereClause {
404 ast_node_from_file_text(&format!("fn f() where {} {{ }}", text))
405 }
406
407 pub fn from_predicates(preds: impl Iterator<Item = ast::WherePred>) -> ast::WhereClause {
408 let preds = preds.map(|p| p.syntax().to_string()).collect::<Vec<_>>().join(", ");
409 Self::from_text(preds.as_str())
410 }
411}
412
383fn ast_node_from_file_text<N: AstNode>(text: &str) -> N { 413fn ast_node_from_file_text<N: AstNode>(text: &str) -> N {
384 let parse = SourceFile::parse(text); 414 let parse = SourceFile::parse(text);
385 let res = parse.tree().syntax().descendants().find_map(N::cast).unwrap(); 415 let res = parse.tree().syntax().descendants().find_map(N::cast).unwrap();
diff --git a/crates/ra_assists/src/lib.rs b/crates/ra_assists/src/lib.rs
index 03eec73ad..10ccc345c 100644
--- a/crates/ra_assists/src/lib.rs
+++ b/crates/ra_assists/src/lib.rs
@@ -102,6 +102,7 @@ mod remove_dbg;
102pub mod auto_import; 102pub mod auto_import;
103mod add_missing_impl_members; 103mod add_missing_impl_members;
104mod move_guard; 104mod move_guard;
105mod move_bounds;
105 106
106fn all_assists<DB: HirDatabase>() -> &'static [fn(AssistCtx<DB>) -> Option<Assist>] { 107fn all_assists<DB: HirDatabase>() -> &'static [fn(AssistCtx<DB>) -> Option<Assist>] {
107 &[ 108 &[
@@ -123,6 +124,7 @@ fn all_assists<DB: HirDatabase>() -> &'static [fn(AssistCtx<DB>) -> Option<Assis
123 inline_local_variable::inline_local_varialbe, 124 inline_local_variable::inline_local_varialbe,
124 move_guard::move_guard_to_arm_body, 125 move_guard::move_guard_to_arm_body,
125 move_guard::move_arm_cond_to_match_guard, 126 move_guard::move_arm_cond_to_match_guard,
127 move_bounds::move_bounds_to_where_clause,
126 ] 128 ]
127} 129}
128 130
diff --git a/crates/ra_assists/src/move_bounds.rs b/crates/ra_assists/src/move_bounds.rs
new file mode 100644
index 000000000..526de1d98
--- /dev/null
+++ b/crates/ra_assists/src/move_bounds.rs
@@ -0,0 +1,135 @@
1use hir::db::HirDatabase;
2use ra_syntax::{
3 ast::{self, AstNode, NameOwner, TypeBoundsOwner},
4 SyntaxElement,
5 SyntaxKind::*,
6 TextRange,
7};
8
9use crate::{ast_editor::AstBuilder, Assist, AssistCtx, AssistId};
10
11pub(crate) fn move_bounds_to_where_clause(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> {
12 let type_param_list = ctx.node_at_offset::<ast::TypeParamList>()?;
13
14 let mut type_params = type_param_list.type_params();
15 if type_params.all(|p| p.type_bound_list().is_none()) {
16 return None;
17 }
18
19 let parent = type_param_list.syntax().parent()?;
20 if parent.children_with_tokens().find(|it| it.kind() == WHERE_CLAUSE).is_some() {
21 return None;
22 }
23
24 let anchor: SyntaxElement = match parent.kind() {
25 FN_DEF => ast::FnDef::cast(parent)?.body()?.syntax().clone().into(),
26 TRAIT_DEF => ast::TraitDef::cast(parent)?.item_list()?.syntax().clone().into(),
27 IMPL_BLOCK => ast::ImplBlock::cast(parent)?.item_list()?.syntax().clone().into(),
28 ENUM_DEF => ast::EnumDef::cast(parent)?.variant_list()?.syntax().clone().into(),
29 STRUCT_DEF => parent
30 .children_with_tokens()
31 .find(|it| it.kind() == RECORD_FIELD_DEF_LIST || it.kind() == SEMI)?,
32 _ => return None,
33 };
34
35 ctx.add_action(
36 AssistId("move_bounds_to_where_clause"),
37 "move_bounds_to_where_clause",
38 |edit| {
39 let type_params = type_param_list.type_params().collect::<Vec<_>>();
40
41 for param in &type_params {
42 if let Some(bounds) = param.type_bound_list() {
43 let colon = param
44 .syntax()
45 .children_with_tokens()
46 .find(|it| it.kind() == COLON)
47 .unwrap();
48 let start = colon.text_range().start();
49 let end = bounds.syntax().text_range().end();
50 edit.delete(TextRange::from_to(start, end));
51 }
52 }
53
54 let predicates = type_params.iter().filter_map(build_predicate);
55 let where_clause = AstBuilder::<ast::WhereClause>::from_predicates(predicates);
56
57 let to_insert = match anchor.prev_sibling_or_token() {
58 Some(ref elem) if elem.kind() == WHITESPACE => {
59 format!("{} ", where_clause.syntax())
60 }
61 _ => format!(" {}", where_clause.syntax()),
62 };
63 edit.insert(anchor.text_range().start(), to_insert);
64 edit.target(type_param_list.syntax().text_range());
65 },
66 );
67
68 ctx.build()
69}
70
71fn build_predicate(param: &ast::TypeParam) -> Option<ast::WherePred> {
72 let path = AstBuilder::<ast::Path>::from_name(param.name()?);
73 let predicate =
74 AstBuilder::<ast::WherePred>::from_pieces(path, param.type_bound_list()?.bounds());
75 Some(predicate)
76}
77
78#[cfg(test)]
79mod tests {
80 use super::*;
81
82 use crate::helpers::check_assist;
83
84 #[test]
85 fn move_bounds_to_where_clause_fn() {
86 check_assist(
87 move_bounds_to_where_clause,
88 r#"
89 fn foo<T: u32, <|>F: FnOnce(T) -> T>() {}
90 "#,
91 r#"
92 fn foo<T, <|>F>() where T: u32, F: FnOnce(T) -> T {}
93 "#,
94 );
95 }
96
97 #[test]
98 fn move_bounds_to_where_clause_impl() {
99 check_assist(
100 move_bounds_to_where_clause,
101 r#"
102 impl<U: u32, <|>T> A<U, T> {}
103 "#,
104 r#"
105 impl<U, <|>T> A<U, T> where U: u32 {}
106 "#,
107 );
108 }
109
110 #[test]
111 fn move_bounds_to_where_clause_struct() {
112 check_assist(
113 move_bounds_to_where_clause,
114 r#"
115 struct A<<|>T: Iterator<Item = u32>> {}
116 "#,
117 r#"
118 struct A<<|>T> where T: Iterator<Item = u32> {}
119 "#,
120 );
121 }
122
123 #[test]
124 fn move_bounds_to_where_clause_tuple_struct() {
125 check_assist(
126 move_bounds_to_where_clause,
127 r#"
128 struct Pair<<|>T: u32>(T, T);
129 "#,
130 r#"
131 struct Pair<<|>T>(T, T) where T: u32;
132 "#,
133 );
134 }
135}
diff --git a/crates/ra_hir/src/marks.rs b/crates/ra_hir/src/marks.rs
index 5b15eee90..2e1d35c8c 100644
--- a/crates/ra_hir/src/marks.rs
+++ b/crates/ra_hir/src/marks.rs
@@ -11,4 +11,5 @@ test_utils::marks!(
11 match_ergonomics_ref 11 match_ergonomics_ref
12 trait_resolution_on_fn_type 12 trait_resolution_on_fn_type
13 infer_while_let 13 infer_while_let
14 macro_rules_from_other_crates_are_visible_with_macro_use
14); 15);
diff --git a/crates/ra_hir/src/nameres.rs b/crates/ra_hir/src/nameres.rs
index bbdc606cd..f69179bf6 100644
--- a/crates/ra_hir/src/nameres.rs
+++ b/crates/ra_hir/src/nameres.rs
@@ -101,6 +101,8 @@ pub struct CrateDefMap {
101 /// However, do we want to put it as a global variable? 101 /// However, do we want to put it as a global variable?
102 poison_macros: FxHashSet<MacroDefId>, 102 poison_macros: FxHashSet<MacroDefId>,
103 103
104 exported_macros: FxHashMap<Name, MacroDefId>,
105
104 diagnostics: Vec<DefDiagnostic>, 106 diagnostics: Vec<DefDiagnostic>,
105} 107}
106 108
@@ -245,6 +247,7 @@ impl CrateDefMap {
245 root, 247 root,
246 modules, 248 modules,
247 poison_macros: FxHashSet::default(), 249 poison_macros: FxHashSet::default(),
250 exported_macros: FxHashMap::default(),
248 diagnostics: Vec::new(), 251 diagnostics: Vec::new(),
249 } 252 }
250 }; 253 };
diff --git a/crates/ra_hir/src/nameres/collector.rs b/crates/ra_hir/src/nameres/collector.rs
index 7da2dcdff..5d1c42926 100644
--- a/crates/ra_hir/src/nameres/collector.rs
+++ b/crates/ra_hir/src/nameres/collector.rs
@@ -157,11 +157,42 @@ where
157 // crate root, even if the parent modules is **not** visible. 157 // crate root, even if the parent modules is **not** visible.
158 if export { 158 if export {
159 self.update(self.def_map.root, None, &[(name.clone(), def.clone())]); 159 self.update(self.def_map.root, None, &[(name.clone(), def.clone())]);
160
161 // Exported macros are collected in crate level ready for
162 // glob import with `#[macro_use]`.
163 self.def_map.exported_macros.insert(name.clone(), macro_id);
160 } 164 }
161 self.update(module_id, None, &[(name.clone(), def)]); 165 self.update(module_id, None, &[(name.clone(), def)]);
162 self.global_macro_scope.insert(name, macro_id); 166 self.global_macro_scope.insert(name, macro_id);
163 } 167 }
164 168
169 /// Import macros from `#[macro_use] extern crate`.
170 ///
171 /// They are non-scoped, and will only be inserted into mutable `global_macro_scope`.
172 fn import_macros_from_extern_crate(&mut self, import: &raw::ImportData) {
173 log::debug!(
174 "importing macros from extern crate: {:?} ({:?})",
175 import,
176 self.def_map.edition,
177 );
178
179 let res = self.def_map.resolve_name_in_extern_prelude(
180 &import
181 .path
182 .as_ident()
183 .expect("extern crate should have been desugared to one-element path"),
184 );
185
186 if let Some(ModuleDef::Module(m)) = res.take_types() {
187 tested_by!(macro_rules_from_other_crates_are_visible_with_macro_use);
188
189 let item_map = self.db.crate_def_map(m.krate);
190 for (name, &macro_id) in &item_map.exported_macros {
191 self.global_macro_scope.insert(name.clone(), macro_id);
192 }
193 }
194 }
195
165 fn resolve_imports(&mut self) -> ReachedFixedPoint { 196 fn resolve_imports(&mut self) -> ReachedFixedPoint {
166 let mut imports = std::mem::replace(&mut self.unresolved_imports, Vec::new()); 197 let mut imports = std::mem::replace(&mut self.unresolved_imports, Vec::new());
167 let mut resolved = Vec::new(); 198 let mut resolved = Vec::new();
@@ -494,11 +525,17 @@ where
494 for item in items { 525 for item in items {
495 match *item { 526 match *item {
496 raw::RawItem::Module(m) => self.collect_module(&self.raw_items[m]), 527 raw::RawItem::Module(m) => self.collect_module(&self.raw_items[m]),
497 raw::RawItem::Import(import) => self.def_collector.unresolved_imports.push(( 528 raw::RawItem::Import(import_id) => {
498 self.module_id, 529 let import = self.raw_items[import_id].clone();
499 import, 530 // This should be processed eagerly instead of deferred to resolving.
500 self.raw_items[import].clone(), 531 // Otherwise, since it will only mutate `global_macro_scope`
501 )), 532 // without `update` names in `mod`s, unresolved macros cannot be expanded.
533 if import.is_extern_crate && import.is_macro_use {
534 self.def_collector.import_macros_from_extern_crate(&import);
535 }
536
537 self.def_collector.unresolved_imports.push((self.module_id, import_id, import));
538 }
502 raw::RawItem::Def(def) => self.define_def(&self.raw_items[def]), 539 raw::RawItem::Def(def) => self.define_def(&self.raw_items[def]),
503 raw::RawItem::Macro(mac) => self.collect_macro(&self.raw_items[mac]), 540 raw::RawItem::Macro(mac) => self.collect_macro(&self.raw_items[mac]),
504 } 541 }
@@ -860,6 +897,7 @@ mod tests {
860 root, 897 root,
861 modules, 898 modules,
862 poison_macros: FxHashSet::default(), 899 poison_macros: FxHashSet::default(),
900 exported_macros: FxHashMap::default(),
863 diagnostics: Vec::new(), 901 diagnostics: Vec::new(),
864 } 902 }
865 }; 903 };
diff --git a/crates/ra_hir/src/nameres/raw.rs b/crates/ra_hir/src/nameres/raw.rs
index 2f973359f..129b047eb 100644
--- a/crates/ra_hir/src/nameres/raw.rs
+++ b/crates/ra_hir/src/nameres/raw.rs
@@ -154,6 +154,7 @@ pub struct ImportData {
154 pub(super) is_glob: bool, 154 pub(super) is_glob: bool,
155 pub(super) is_prelude: bool, 155 pub(super) is_prelude: bool,
156 pub(super) is_extern_crate: bool, 156 pub(super) is_extern_crate: bool,
157 pub(super) is_macro_use: bool,
157} 158}
158 159
159#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 160#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
@@ -293,8 +294,14 @@ impl RawItemsCollector {
293 let is_prelude = use_item.has_atom_attr("prelude_import"); 294 let is_prelude = use_item.has_atom_attr("prelude_import");
294 295
295 Path::expand_use_item(&use_item, |path, use_tree, is_glob, alias| { 296 Path::expand_use_item(&use_item, |path, use_tree, is_glob, alias| {
296 let import_data = 297 let import_data = ImportData {
297 ImportData { path, alias, is_glob, is_prelude, is_extern_crate: false }; 298 path,
299 alias,
300 is_glob,
301 is_prelude,
302 is_extern_crate: false,
303 is_macro_use: false,
304 };
298 self.push_import(current_module, import_data, Either::A(AstPtr::new(use_tree))); 305 self.push_import(current_module, import_data, Either::A(AstPtr::new(use_tree)));
299 }) 306 })
300 } 307 }
@@ -307,12 +314,14 @@ impl RawItemsCollector {
307 if let Some(name_ref) = extern_crate.name_ref() { 314 if let Some(name_ref) = extern_crate.name_ref() {
308 let path = Path::from_name_ref(&name_ref); 315 let path = Path::from_name_ref(&name_ref);
309 let alias = extern_crate.alias().and_then(|a| a.name()).map(|it| it.as_name()); 316 let alias = extern_crate.alias().and_then(|a| a.name()).map(|it| it.as_name());
317 let is_macro_use = extern_crate.has_atom_attr("macro_use");
310 let import_data = ImportData { 318 let import_data = ImportData {
311 path, 319 path,
312 alias, 320 alias,
313 is_glob: false, 321 is_glob: false,
314 is_prelude: false, 322 is_prelude: false,
315 is_extern_crate: true, 323 is_extern_crate: true,
324 is_macro_use,
316 }; 325 };
317 self.push_import(current_module, import_data, Either::B(AstPtr::new(&extern_crate))); 326 self.push_import(current_module, import_data, Either::B(AstPtr::new(&extern_crate)));
318 } 327 }
diff --git a/crates/ra_hir/src/nameres/tests/macros.rs b/crates/ra_hir/src/nameres/tests/macros.rs
index 631df2cef..ebfefe273 100644
--- a/crates/ra_hir/src/nameres/tests/macros.rs
+++ b/crates/ra_hir/src/nameres/tests/macros.rs
@@ -99,14 +99,14 @@ fn macro_rules_from_other_crates_are_visible() {
99fn unexpanded_macro_should_expand_by_fixedpoint_loop() { 99fn unexpanded_macro_should_expand_by_fixedpoint_loop() {
100 let map = def_map_with_crate_graph( 100 let map = def_map_with_crate_graph(
101 " 101 "
102 //- /main.rs 102 //- /main.rs
103 macro_rules! baz { 103 macro_rules! baz {
104 () => { 104 () => {
105 use foo::bar; 105 use foo::bar;
106 } 106 }
107 } 107 }
108 108
109 foo!(); 109 foo!();
110 bar!(); 110 bar!();
111 baz!(); 111 baz!();
112 112
@@ -114,7 +114,7 @@ fn unexpanded_macro_should_expand_by_fixedpoint_loop() {
114 #[macro_export] 114 #[macro_export]
115 macro_rules! foo { 115 macro_rules! foo {
116 () => { 116 () => {
117 struct Foo { field: u32 } 117 struct Foo { field: u32 }
118 } 118 }
119 } 119 }
120 #[macro_export] 120 #[macro_export]
@@ -137,3 +137,57 @@ fn unexpanded_macro_should_expand_by_fixedpoint_loop() {
137 ⋮foo: m 137 ⋮foo: m
138 "###); 138 "###);
139} 139}
140
141#[test]
142fn macro_rules_from_other_crates_are_visible_with_macro_use() {
143 covers!(macro_rules_from_other_crates_are_visible_with_macro_use);
144 let map = def_map_with_crate_graph(
145 "
146 //- /main.rs
147 #[macro_use]
148 extern crate foo;
149
150 structs!(Foo);
151 structs_priv!(Bar);
152 structs_not_exported!(MacroNotResolved1);
153 crate::structs!(MacroNotResolved2);
154
155 mod bar;
156
157 //- /bar.rs
158 structs!(Baz);
159 crate::structs!(MacroNotResolved3);
160
161 //- /lib.rs
162 #[macro_export]
163 macro_rules! structs {
164 ($i:ident) => { struct $i; }
165 }
166
167 macro_rules! structs_not_exported {
168 ($i:ident) => { struct $i; }
169 }
170
171 mod priv_mod {
172 #[macro_export]
173 macro_rules! structs_priv {
174 ($i:ident) => { struct $i; }
175 }
176 }
177 ",
178 crate_graph! {
179 "main": ("/main.rs", ["foo"]),
180 "foo": ("/lib.rs", []),
181 },
182 );
183 assert_snapshot!(map, @r###"
184 ⋮crate
185 ⋮Bar: t v
186 ⋮Foo: t v
187 ⋮bar: t
188 ⋮foo: t
189
190 ⋮crate::bar
191 ⋮Baz: t v
192 "###);
193}
diff --git a/crates/ra_project_model/src/lib.rs b/crates/ra_project_model/src/lib.rs
index 676dc4941..9b2f534e7 100644
--- a/crates/ra_project_model/src/lib.rs
+++ b/crates/ra_project_model/src/lib.rs
@@ -153,7 +153,7 @@ impl ProjectWorkspace {
153 if let Some(file_id) = load(krate.root(&sysroot)) { 153 if let Some(file_id) = load(krate.root(&sysroot)) {
154 sysroot_crates.insert( 154 sysroot_crates.insert(
155 krate, 155 krate,
156 crate_graph.add_crate_root(file_id, Edition::Edition2015), 156 crate_graph.add_crate_root(file_id, Edition::Edition2018),
157 ); 157 );
158 } 158 }
159 } 159 }
diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs
index e2a92ae60..bcf753f78 100644
--- a/crates/ra_syntax/src/ast/generated.rs
+++ b/crates/ra_syntax/src/ast/generated.rs
@@ -934,6 +934,7 @@ impl AstNode for ExternCrateItem {
934 &self.syntax 934 &self.syntax
935 } 935 }
936} 936}
937impl ast::AttrsOwner for ExternCrateItem {}
937impl ExternCrateItem { 938impl ExternCrateItem {
938 pub fn name_ref(&self) -> Option<NameRef> { 939 pub fn name_ref(&self) -> Option<NameRef> {
939 AstChildren::new(&self.syntax).next() 940 AstChildren::new(&self.syntax).next()
diff --git a/crates/ra_syntax/src/grammar.ron b/crates/ra_syntax/src/grammar.ron
index c14ee0e85..3e6c2d3f3 100644
--- a/crates/ra_syntax/src/grammar.ron
+++ b/crates/ra_syntax/src/grammar.ron
@@ -669,6 +669,7 @@ Grammar(
669 collections: [("use_trees", "UseTree")] 669 collections: [("use_trees", "UseTree")]
670 ), 670 ),
671 "ExternCrateItem": ( 671 "ExternCrateItem": (
672 traits: ["AttrsOwner"],
672 options: ["NameRef", "Alias"], 673 options: ["NameRef", "Alias"],
673 ), 674 ),
674 "ArgList": ( 675 "ArgList": (
diff --git a/docs/user/features.md b/docs/user/features.md
index b6e6008c4..1034a5117 100644
--- a/docs/user/features.md
+++ b/docs/user/features.md
@@ -435,6 +435,16 @@ fn f() {
435} 435}
436``` 436```
437 437
438- Move type bounds to where clause
439
440```rust
441// before:
442fn foo<T: u32, F: FnOnce(T) -> T>() {}
443
444// after:
445fn foo<T, F>() where T: u32, F: FnOnce(T) -> T {}
446```
447
438### Magic Completions 448### Magic Completions
439 449
440In addition to usual reference completion, rust-analyzer provides some ✨magic✨ 450In addition to usual reference completion, rust-analyzer provides some ✨magic✨