diff options
89 files changed, 1925 insertions, 1262 deletions
diff --git a/Cargo.lock b/Cargo.lock index cfb081e18..56fb4aad3 100644 --- a/Cargo.lock +++ b/Cargo.lock | |||
@@ -32,7 +32,7 @@ name = "atty" | |||
32 | version = "0.2.11" | 32 | version = "0.2.11" |
33 | source = "registry+https://github.com/rust-lang/crates.io-index" | 33 | source = "registry+https://github.com/rust-lang/crates.io-index" |
34 | dependencies = [ | 34 | dependencies = [ |
35 | "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", | 35 | "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", |
36 | "termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)", | 36 | "termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)", |
37 | "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", | 37 | "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", |
38 | ] | 38 | ] |
@@ -50,7 +50,7 @@ dependencies = [ | |||
50 | "autocfg 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", | 50 | "autocfg 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", |
51 | "backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", | 51 | "backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", |
52 | "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", | 52 | "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", |
53 | "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", | 53 | "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", |
54 | "rustc-demangle 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", | 54 | "rustc-demangle 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", |
55 | "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", | 55 | "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", |
56 | ] | 56 | ] |
@@ -61,7 +61,7 @@ version = "0.1.28" | |||
61 | source = "registry+https://github.com/rust-lang/crates.io-index" | 61 | source = "registry+https://github.com/rust-lang/crates.io-index" |
62 | dependencies = [ | 62 | dependencies = [ |
63 | "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", | 63 | "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", |
64 | "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", | 64 | "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", |
65 | ] | 65 | ] |
66 | 66 | ||
67 | [[package]] | 67 | [[package]] |
@@ -111,14 +111,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
111 | 111 | ||
112 | [[package]] | 112 | [[package]] |
113 | name = "cargo_metadata" | 113 | name = "cargo_metadata" |
114 | version = "0.6.4" | 114 | version = "0.7.0" |
115 | source = "git+https://github.com/oli-obk/cargo_metadata.git?rev=f73e27b24e#f73e27b24e92cd9b520a78497cd1017b70a6c99a" | 115 | source = "registry+https://github.com/rust-lang/crates.io-index" |
116 | dependencies = [ | 116 | dependencies = [ |
117 | "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", | 117 | "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", |
118 | "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", | 118 | "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", |
119 | "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", | 119 | "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", |
120 | "serde_derive 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", | 120 | "serde_derive 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", |
121 | "serde_json 1.0.34 (registry+https://github.com/rust-lang/crates.io-index)", | 121 | "serde_json 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)", |
122 | ] | 122 | ] |
123 | 123 | ||
124 | [[package]] | 124 | [[package]] |
@@ -156,6 +156,17 @@ dependencies = [ | |||
156 | ] | 156 | ] |
157 | 157 | ||
158 | [[package]] | 158 | [[package]] |
159 | name = "clicolors-control" | ||
160 | version = "1.0.0" | ||
161 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
162 | dependencies = [ | ||
163 | "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", | ||
164 | "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||
165 | "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", | ||
166 | "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", | ||
167 | ] | ||
168 | |||
169 | [[package]] | ||
159 | name = "cloudabi" | 170 | name = "cloudabi" |
160 | version = "0.0.3" | 171 | version = "0.0.3" |
161 | source = "registry+https://github.com/rust-lang/crates.io-index" | 172 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -164,6 +175,23 @@ dependencies = [ | |||
164 | ] | 175 | ] |
165 | 176 | ||
166 | [[package]] | 177 | [[package]] |
178 | name = "console" | ||
179 | version = "0.7.3" | ||
180 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
181 | dependencies = [ | ||
182 | "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", | ||
183 | "clicolors-control 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||
184 | "encode_unicode 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", | ||
185 | "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||
186 | "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", | ||
187 | "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", | ||
188 | "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||
189 | "termios 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", | ||
190 | "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", | ||
191 | "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", | ||
192 | ] | ||
193 | |||
194 | [[package]] | ||
167 | name = "crossbeam-channel" | 195 | name = "crossbeam-channel" |
168 | version = "0.3.6" | 196 | version = "0.3.6" |
169 | source = "registry+https://github.com/rust-lang/crates.io-index" | 197 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -220,7 +248,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
220 | dependencies = [ | 248 | dependencies = [ |
221 | "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", | 249 | "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", |
222 | "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", | 250 | "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", |
223 | "syn 0.15.24 (registry+https://github.com/rust-lang/crates.io-index)", | 251 | "syn 0.15.25 (registry+https://github.com/rust-lang/crates.io-index)", |
224 | ] | 252 | ] |
225 | 253 | ||
226 | [[package]] | 254 | [[package]] |
@@ -260,6 +288,11 @@ dependencies = [ | |||
260 | ] | 288 | ] |
261 | 289 | ||
262 | [[package]] | 290 | [[package]] |
291 | name = "encode_unicode" | ||
292 | version = "0.3.5" | ||
293 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
294 | |||
295 | [[package]] | ||
263 | name = "error-chain" | 296 | name = "error-chain" |
264 | version = "0.12.0" | 297 | version = "0.12.0" |
265 | source = "registry+https://github.com/rust-lang/crates.io-index" | 298 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -283,7 +316,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
283 | dependencies = [ | 316 | dependencies = [ |
284 | "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", | 317 | "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", |
285 | "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", | 318 | "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", |
286 | "syn 0.15.24 (registry+https://github.com/rust-lang/crates.io-index)", | 319 | "syn 0.15.25 (registry+https://github.com/rust-lang/crates.io-index)", |
287 | "synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", | 320 | "synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", |
288 | ] | 321 | ] |
289 | 322 | ||
@@ -337,10 +370,10 @@ version = "0.1.0" | |||
337 | dependencies = [ | 370 | dependencies = [ |
338 | "crossbeam-channel 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", | 371 | "crossbeam-channel 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", |
339 | "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", | 372 | "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", |
340 | "languageserver-types 0.53.1 (registry+https://github.com/rust-lang/crates.io-index)", | ||
341 | "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", | 373 | "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", |
374 | "lsp-types 0.54.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||
342 | "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", | 375 | "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", |
343 | "serde_json 1.0.34 (registry+https://github.com/rust-lang/crates.io-index)", | 376 | "serde_json 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)", |
344 | ] | 377 | ] |
345 | 378 | ||
346 | [[package]] | 379 | [[package]] |
@@ -394,6 +427,20 @@ version = "1.0.2" | |||
394 | source = "registry+https://github.com/rust-lang/crates.io-index" | 427 | source = "registry+https://github.com/rust-lang/crates.io-index" |
395 | 428 | ||
396 | [[package]] | 429 | [[package]] |
430 | name = "insta" | ||
431 | version = "0.1.4" | ||
432 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
433 | dependencies = [ | ||
434 | "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", | ||
435 | "console 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", | ||
436 | "difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||
437 | "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", | ||
438 | "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||
439 | "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", | ||
440 | "serde_json 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)", | ||
441 | ] | ||
442 | |||
443 | [[package]] | ||
397 | name = "itertools" | 444 | name = "itertools" |
398 | version = "0.8.0" | 445 | version = "0.8.0" |
399 | source = "registry+https://github.com/rust-lang/crates.io-index" | 446 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -412,28 +459,13 @@ version = "0.1.3" | |||
412 | source = "registry+https://github.com/rust-lang/crates.io-index" | 459 | source = "registry+https://github.com/rust-lang/crates.io-index" |
413 | 460 | ||
414 | [[package]] | 461 | [[package]] |
415 | name = "languageserver-types" | ||
416 | version = "0.53.1" | ||
417 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
418 | dependencies = [ | ||
419 | "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", | ||
420 | "num-derive 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", | ||
421 | "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", | ||
422 | "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", | ||
423 | "serde_derive 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", | ||
424 | "serde_json 1.0.34 (registry+https://github.com/rust-lang/crates.io-index)", | ||
425 | "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", | ||
426 | "url_serde 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||
427 | ] | ||
428 | |||
429 | [[package]] | ||
430 | name = "lazy_static" | 462 | name = "lazy_static" |
431 | version = "1.2.0" | 463 | version = "1.2.0" |
432 | source = "registry+https://github.com/rust-lang/crates.io-index" | 464 | source = "registry+https://github.com/rust-lang/crates.io-index" |
433 | 465 | ||
434 | [[package]] | 466 | [[package]] |
435 | name = "libc" | 467 | name = "libc" |
436 | version = "0.2.46" | 468 | version = "0.2.47" |
437 | source = "registry+https://github.com/rust-lang/crates.io-index" | 469 | source = "registry+https://github.com/rust-lang/crates.io-index" |
438 | 470 | ||
439 | [[package]] | 471 | [[package]] |
@@ -454,6 +486,21 @@ dependencies = [ | |||
454 | ] | 486 | ] |
455 | 487 | ||
456 | [[package]] | 488 | [[package]] |
489 | name = "lsp-types" | ||
490 | version = "0.54.0" | ||
491 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
492 | dependencies = [ | ||
493 | "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", | ||
494 | "num-derive 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", | ||
495 | "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", | ||
496 | "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", | ||
497 | "serde_derive 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", | ||
498 | "serde_json 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)", | ||
499 | "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", | ||
500 | "url_serde 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||
501 | ] | ||
502 | |||
503 | [[package]] | ||
457 | name = "maplit" | 504 | name = "maplit" |
458 | version = "1.0.1" | 505 | version = "1.0.1" |
459 | source = "registry+https://github.com/rust-lang/crates.io-index" | 506 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -469,7 +516,7 @@ version = "2.1.2" | |||
469 | source = "registry+https://github.com/rust-lang/crates.io-index" | 516 | source = "registry+https://github.com/rust-lang/crates.io-index" |
470 | dependencies = [ | 517 | dependencies = [ |
471 | "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", | 518 | "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", |
472 | "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", | 519 | "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", |
473 | "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", | 520 | "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", |
474 | ] | 521 | ] |
475 | 522 | ||
@@ -478,7 +525,7 @@ name = "memmap" | |||
478 | version = "0.6.2" | 525 | version = "0.6.2" |
479 | source = "registry+https://github.com/rust-lang/crates.io-index" | 526 | source = "registry+https://github.com/rust-lang/crates.io-index" |
480 | dependencies = [ | 527 | dependencies = [ |
481 | "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", | 528 | "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", |
482 | "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", | 529 | "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", |
483 | ] | 530 | ] |
484 | 531 | ||
@@ -500,7 +547,7 @@ dependencies = [ | |||
500 | "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", | 547 | "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", |
501 | "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", | 548 | "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", |
502 | "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", | 549 | "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", |
503 | "syn 0.15.24 (registry+https://github.com/rust-lang/crates.io-index)", | 550 | "syn 0.15.25 (registry+https://github.com/rust-lang/crates.io-index)", |
504 | ] | 551 | ] |
505 | 552 | ||
506 | [[package]] | 553 | [[package]] |
@@ -521,7 +568,7 @@ name = "num_cpus" | |||
521 | version = "1.9.0" | 568 | version = "1.9.0" |
522 | source = "registry+https://github.com/rust-lang/crates.io-index" | 569 | source = "registry+https://github.com/rust-lang/crates.io-index" |
523 | dependencies = [ | 570 | dependencies = [ |
524 | "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", | 571 | "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", |
525 | ] | 572 | ] |
526 | 573 | ||
527 | [[package]] | 574 | [[package]] |
@@ -546,7 +593,7 @@ name = "parking_lot_core" | |||
546 | version = "0.4.0" | 593 | version = "0.4.0" |
547 | source = "registry+https://github.com/rust-lang/crates.io-index" | 594 | source = "registry+https://github.com/rust-lang/crates.io-index" |
548 | dependencies = [ | 595 | dependencies = [ |
549 | "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", | 596 | "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", |
550 | "rand 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", | 597 | "rand 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", |
551 | "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", | 598 | "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", |
552 | "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", | 599 | "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", |
@@ -584,7 +631,7 @@ dependencies = [ | |||
584 | "pest_meta 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", | 631 | "pest_meta 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", |
585 | "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", | 632 | "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", |
586 | "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", | 633 | "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", |
587 | "syn 0.15.24 (registry+https://github.com/rust-lang/crates.io-index)", | 634 | "syn 0.15.25 (registry+https://github.com/rust-lang/crates.io-index)", |
588 | ] | 635 | ] |
589 | 636 | ||
590 | [[package]] | 637 | [[package]] |
@@ -660,7 +707,7 @@ dependencies = [ | |||
660 | "ra_syntax 0.1.0", | 707 | "ra_syntax 0.1.0", |
661 | "relative-path 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", | 708 | "relative-path 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", |
662 | "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", | 709 | "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", |
663 | "salsa 0.9.1 (git+https://github.com/matklad/salsa?branch=panic-hooks)", | 710 | "salsa 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", |
664 | "test_utils 0.1.0", | 711 | "test_utils 0.1.0", |
665 | ] | 712 | ] |
666 | 713 | ||
@@ -679,7 +726,7 @@ dependencies = [ | |||
679 | "ra_syntax 0.1.0", | 726 | "ra_syntax 0.1.0", |
680 | "relative-path 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", | 727 | "relative-path 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", |
681 | "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", | 728 | "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", |
682 | "salsa 0.9.1 (git+https://github.com/matklad/salsa?branch=panic-hooks)", | 729 | "salsa 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", |
683 | "test_utils 0.1.0", | 730 | "test_utils 0.1.0", |
684 | ] | 731 | ] |
685 | 732 | ||
@@ -688,6 +735,7 @@ name = "ra_ide_api" | |||
688 | version = "0.1.0" | 735 | version = "0.1.0" |
689 | dependencies = [ | 736 | dependencies = [ |
690 | "fst 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", | 737 | "fst 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", |
738 | "insta 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", | ||
691 | "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", | 739 | "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", |
692 | "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", | 740 | "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", |
693 | "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", | 741 | "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", |
@@ -699,7 +747,7 @@ dependencies = [ | |||
699 | "rayon 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", | 747 | "rayon 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", |
700 | "relative-path 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", | 748 | "relative-path 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", |
701 | "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", | 749 | "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", |
702 | "salsa 0.9.1 (git+https://github.com/matklad/salsa?branch=panic-hooks)", | 750 | "salsa 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", |
703 | "test_utils 0.1.0", | 751 | "test_utils 0.1.0", |
704 | "unicase 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", | 752 | "unicase 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", |
705 | ] | 753 | ] |
@@ -708,6 +756,7 @@ dependencies = [ | |||
708 | name = "ra_ide_api_light" | 756 | name = "ra_ide_api_light" |
709 | version = "0.1.0" | 757 | version = "0.1.0" |
710 | dependencies = [ | 758 | dependencies = [ |
759 | "insta 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", | ||
711 | "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", | 760 | "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", |
712 | "join_to_string 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", | 761 | "join_to_string 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", |
713 | "proptest 0.8.7 (registry+https://github.com/rust-lang/crates.io-index)", | 762 | "proptest 0.8.7 (registry+https://github.com/rust-lang/crates.io-index)", |
@@ -722,7 +771,7 @@ dependencies = [ | |||
722 | name = "ra_lsp_server" | 771 | name = "ra_lsp_server" |
723 | version = "0.1.0" | 772 | version = "0.1.0" |
724 | dependencies = [ | 773 | dependencies = [ |
725 | "cargo_metadata 0.6.4 (git+https://github.com/oli-obk/cargo_metadata.git?rev=f73e27b24e)", | 774 | "cargo_metadata 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", |
726 | "crossbeam-channel 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", | 775 | "crossbeam-channel 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", |
727 | "drop_bomb 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", | 776 | "drop_bomb 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", |
728 | "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", | 777 | "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", |
@@ -730,8 +779,8 @@ dependencies = [ | |||
730 | "flexi_logger 0.10.4 (registry+https://github.com/rust-lang/crates.io-index)", | 779 | "flexi_logger 0.10.4 (registry+https://github.com/rust-lang/crates.io-index)", |
731 | "gen_lsp_server 0.1.0", | 780 | "gen_lsp_server 0.1.0", |
732 | "im 12.2.0 (registry+https://github.com/rust-lang/crates.io-index)", | 781 | "im 12.2.0 (registry+https://github.com/rust-lang/crates.io-index)", |
733 | "languageserver-types 0.53.1 (registry+https://github.com/rust-lang/crates.io-index)", | ||
734 | "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", | 782 | "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", |
783 | "lsp-types 0.54.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||
735 | "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", | 784 | "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", |
736 | "ra_arena 0.1.0", | 785 | "ra_arena 0.1.0", |
737 | "ra_ide_api 0.1.0", | 786 | "ra_ide_api 0.1.0", |
@@ -742,7 +791,7 @@ dependencies = [ | |||
742 | "relative-path 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", | 791 | "relative-path 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", |
743 | "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", | 792 | "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", |
744 | "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", | 793 | "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", |
745 | "serde_json 1.0.34 (registry+https://github.com/rust-lang/crates.io-index)", | 794 | "serde_json 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)", |
746 | "tempfile 3.0.5 (registry+https://github.com/rust-lang/crates.io-index)", | 795 | "tempfile 3.0.5 (registry+https://github.com/rust-lang/crates.io-index)", |
747 | "test_utils 0.1.0", | 796 | "test_utils 0.1.0", |
748 | "thread_worker 0.1.0", | 797 | "thread_worker 0.1.0", |
@@ -760,7 +809,7 @@ dependencies = [ | |||
760 | "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", | 809 | "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", |
761 | "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", | 810 | "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", |
762 | "ra_text_edit 0.1.0", | 811 | "ra_text_edit 0.1.0", |
763 | "rowan 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", | 812 | "rowan 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", |
764 | "smol_str 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", | 813 | "smol_str 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", |
765 | "test_utils 0.1.0", | 814 | "test_utils 0.1.0", |
766 | "text_unit 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", | 815 | "text_unit 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", |
@@ -798,7 +847,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
798 | dependencies = [ | 847 | dependencies = [ |
799 | "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", | 848 | "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", |
800 | "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", | 849 | "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", |
801 | "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", | 850 | "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", |
802 | "rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", | 851 | "rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", |
803 | "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", | 852 | "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", |
804 | ] | 853 | ] |
@@ -809,7 +858,7 @@ version = "0.6.4" | |||
809 | source = "registry+https://github.com/rust-lang/crates.io-index" | 858 | source = "registry+https://github.com/rust-lang/crates.io-index" |
810 | dependencies = [ | 859 | dependencies = [ |
811 | "autocfg 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", | 860 | "autocfg 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", |
812 | "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", | 861 | "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", |
813 | "rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", | 862 | "rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", |
814 | "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", | 863 | "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", |
815 | "rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", | 864 | "rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", |
@@ -865,7 +914,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
865 | dependencies = [ | 914 | dependencies = [ |
866 | "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", | 915 | "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", |
867 | "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", | 916 | "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", |
868 | "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", | 917 | "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", |
869 | "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", | 918 | "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", |
870 | "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", | 919 | "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", |
871 | "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", | 920 | "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", |
@@ -905,7 +954,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
905 | dependencies = [ | 954 | dependencies = [ |
906 | "crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", | 955 | "crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", |
907 | "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", | 956 | "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", |
908 | "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", | 957 | "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", |
909 | "num_cpus 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)", | 958 | "num_cpus 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)", |
910 | ] | 959 | ] |
911 | 960 | ||
@@ -975,7 +1024,7 @@ dependencies = [ | |||
975 | 1024 | ||
976 | [[package]] | 1025 | [[package]] |
977 | name = "rowan" | 1026 | name = "rowan" |
978 | version = "0.3.0" | 1027 | version = "0.3.1" |
979 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1028 | source = "registry+https://github.com/rust-lang/crates.io-index" |
980 | dependencies = [ | 1029 | dependencies = [ |
981 | "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", | 1030 | "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", |
@@ -1022,8 +1071,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
1022 | 1071 | ||
1023 | [[package]] | 1072 | [[package]] |
1024 | name = "salsa" | 1073 | name = "salsa" |
1025 | version = "0.9.1" | 1074 | version = "0.9.2" |
1026 | source = "git+https://github.com/matklad/salsa?branch=panic-hooks#88313c80302c831ebc7601912ab3f11ad37e6bc2" | 1075 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1027 | dependencies = [ | 1076 | dependencies = [ |
1028 | "derive-new 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", | 1077 | "derive-new 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", |
1029 | "indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", | 1078 | "indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", |
@@ -1076,12 +1125,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
1076 | dependencies = [ | 1125 | dependencies = [ |
1077 | "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", | 1126 | "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", |
1078 | "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", | 1127 | "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", |
1079 | "syn 0.15.24 (registry+https://github.com/rust-lang/crates.io-index)", | 1128 | "syn 0.15.25 (registry+https://github.com/rust-lang/crates.io-index)", |
1080 | ] | 1129 | ] |
1081 | 1130 | ||
1082 | [[package]] | 1131 | [[package]] |
1083 | name = "serde_json" | 1132 | name = "serde_json" |
1084 | version = "1.0.34" | 1133 | version = "1.0.35" |
1085 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1134 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1086 | dependencies = [ | 1135 | dependencies = [ |
1087 | "itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", | 1136 | "itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", |
@@ -1141,7 +1190,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
1141 | 1190 | ||
1142 | [[package]] | 1191 | [[package]] |
1143 | name = "syn" | 1192 | name = "syn" |
1144 | version = "0.15.24" | 1193 | version = "0.15.25" |
1145 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1194 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1146 | dependencies = [ | 1195 | dependencies = [ |
1147 | "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", | 1196 | "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", |
@@ -1156,7 +1205,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
1156 | dependencies = [ | 1205 | dependencies = [ |
1157 | "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", | 1206 | "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", |
1158 | "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", | 1207 | "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", |
1159 | "syn 0.15.24 (registry+https://github.com/rust-lang/crates.io-index)", | 1208 | "syn 0.15.25 (registry+https://github.com/rust-lang/crates.io-index)", |
1160 | "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", | 1209 | "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", |
1161 | ] | 1210 | ] |
1162 | 1211 | ||
@@ -1166,7 +1215,7 @@ version = "3.0.5" | |||
1166 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1215 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1167 | dependencies = [ | 1216 | dependencies = [ |
1168 | "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", | 1217 | "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", |
1169 | "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", | 1218 | "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", |
1170 | "rand 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", | 1219 | "rand 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", |
1171 | "redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)", | 1220 | "redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)", |
1172 | "remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", | 1221 | "remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", |
@@ -1187,7 +1236,7 @@ dependencies = [ | |||
1187 | "pest_derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", | 1236 | "pest_derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", |
1188 | "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", | 1237 | "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", |
1189 | "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", | 1238 | "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", |
1190 | "serde_json 1.0.34 (registry+https://github.com/rust-lang/crates.io-index)", | 1239 | "serde_json 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)", |
1191 | "slug 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", | 1240 | "slug 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", |
1192 | "unic-segment 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", | 1241 | "unic-segment 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", |
1193 | "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", | 1242 | "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", |
@@ -1209,18 +1258,26 @@ name = "termion" | |||
1209 | version = "1.5.1" | 1258 | version = "1.5.1" |
1210 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1259 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1211 | dependencies = [ | 1260 | dependencies = [ |
1212 | "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", | 1261 | "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", |
1213 | "redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)", | 1262 | "redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)", |
1214 | "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", | 1263 | "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", |
1215 | ] | 1264 | ] |
1216 | 1265 | ||
1217 | [[package]] | 1266 | [[package]] |
1267 | name = "termios" | ||
1268 | version = "0.3.1" | ||
1269 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
1270 | dependencies = [ | ||
1271 | "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", | ||
1272 | ] | ||
1273 | |||
1274 | [[package]] | ||
1218 | name = "test_utils" | 1275 | name = "test_utils" |
1219 | version = "0.1.0" | 1276 | version = "0.1.0" |
1220 | dependencies = [ | 1277 | dependencies = [ |
1221 | "difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", | 1278 | "difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", |
1222 | "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", | 1279 | "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", |
1223 | "serde_json 1.0.34 (registry+https://github.com/rust-lang/crates.io-index)", | 1280 | "serde_json 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)", |
1224 | "text_unit 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", | 1281 | "text_unit 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", |
1225 | ] | 1282 | ] |
1226 | 1283 | ||
@@ -1270,7 +1327,7 @@ name = "time" | |||
1270 | version = "0.1.42" | 1327 | version = "0.1.42" |
1271 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1328 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1272 | dependencies = [ | 1329 | dependencies = [ |
1273 | "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", | 1330 | "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", |
1274 | "redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)", | 1331 | "redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)", |
1275 | "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", | 1332 | "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", |
1276 | ] | 1333 | ] |
@@ -1433,7 +1490,7 @@ name = "wait-timeout" | |||
1433 | version = "0.1.5" | 1490 | version = "0.1.5" |
1434 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1491 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1435 | dependencies = [ | 1492 | dependencies = [ |
1436 | "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", | 1493 | "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", |
1437 | ] | 1494 | ] |
1438 | 1495 | ||
1439 | [[package]] | 1496 | [[package]] |
@@ -1489,12 +1546,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
1489 | "checksum block-buffer 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a076c298b9ecdb530ed9d967e74a6027d6a7478924520acddcddc24c1c8ab3ab" | 1546 | "checksum block-buffer 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a076c298b9ecdb530ed9d967e74a6027d6a7478924520acddcddc24c1c8ab3ab" |
1490 | "checksum byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "560c32574a12a89ecd91f5e742165893f86e3ab98d21f8ea548658eb9eef5f40" | 1547 | "checksum byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "560c32574a12a89ecd91f5e742165893f86e3ab98d21f8ea548658eb9eef5f40" |
1491 | "checksum byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "94f88df23a25417badc922ab0f5716cc1330e87f71ddd9203b3a3ccd9cedf75d" | 1548 | "checksum byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "94f88df23a25417badc922ab0f5716cc1330e87f71ddd9203b3a3ccd9cedf75d" |
1492 | "checksum cargo_metadata 0.6.4 (git+https://github.com/oli-obk/cargo_metadata.git?rev=f73e27b24e)" = "<none>" | 1549 | "checksum cargo_metadata 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "95932a7ed5f2308fc00a46d2aa8eb1b06b402c896c2df424916ee730ba610c2e" |
1493 | "checksum cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4a8b715cb4597106ea87c7c84b2f1d452c7492033765df7f32651e66fcf749" | 1550 | "checksum cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4a8b715cb4597106ea87c7c84b2f1d452c7492033765df7f32651e66fcf749" |
1494 | "checksum cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "082bb9b28e00d3c9d39cc03e64ce4cea0f1bb9b3fde493f0cbc008472d22bdf4" | 1551 | "checksum cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "082bb9b28e00d3c9d39cc03e64ce4cea0f1bb9b3fde493f0cbc008472d22bdf4" |
1495 | "checksum chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "45912881121cb26fad7c38c17ba7daa18764771836b34fab7d3fbd93ed633878" | 1552 | "checksum chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "45912881121cb26fad7c38c17ba7daa18764771836b34fab7d3fbd93ed633878" |
1496 | "checksum clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b957d88f4b6a63b9d70d5f454ac8011819c6efa7727858f458ab71c756ce2d3e" | 1553 | "checksum clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b957d88f4b6a63b9d70d5f454ac8011819c6efa7727858f458ab71c756ce2d3e" |
1554 | "checksum clicolors-control 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "73abfd4c73d003a674ce5d2933fca6ce6c42480ea84a5ffe0a2dc39ed56300f9" | ||
1497 | "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" | 1555 | "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" |
1556 | "checksum console 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ecc3753530b959618f617b0cd6494526008d98687f1af5d8f9fa83fa9cdbb594" | ||
1498 | "checksum crossbeam-channel 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "137bc235f622ffaa0428e3854e24acb53291fc0b3ff6fb2cb75a8be6fb02f06b" | 1557 | "checksum crossbeam-channel 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "137bc235f622ffaa0428e3854e24acb53291fc0b3ff6fb2cb75a8be6fb02f06b" |
1499 | "checksum crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f739f8c5363aca78cfb059edf753d8f0d36908c348f3d8d1503f03d8b75d9cf3" | 1558 | "checksum crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f739f8c5363aca78cfb059edf753d8f0d36908c348f3d8d1503f03d8b75d9cf3" |
1500 | "checksum crossbeam-epoch 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "927121f5407de9956180ff5e936fe3cf4324279280001cd56b669d28ee7e9150" | 1559 | "checksum crossbeam-epoch 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "927121f5407de9956180ff5e936fe3cf4324279280001cd56b669d28ee7e9150" |
@@ -1507,6 +1566,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
1507 | "checksum drop_bomb 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "69b26e475fd29098530e709294e94e661974c851aed42512793f120fed4e199f" | 1566 | "checksum drop_bomb 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "69b26e475fd29098530e709294e94e661974c851aed42512793f120fed4e199f" |
1508 | "checksum either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3be565ca5c557d7f59e7cfcf1844f9e3033650c929c6566f511e8005f205c1d0" | 1567 | "checksum either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3be565ca5c557d7f59e7cfcf1844f9e3033650c929c6566f511e8005f205c1d0" |
1509 | "checksum ena 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f56c93cc076508c549d9bb747f79aa9b4eb098be7b8cad8830c3137ef52d1e00" | 1568 | "checksum ena 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f56c93cc076508c549d9bb747f79aa9b4eb098be7b8cad8830c3137ef52d1e00" |
1569 | "checksum encode_unicode 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "90b2c9496c001e8cb61827acdefad780795c42264c137744cae6f7d9e3450abd" | ||
1510 | "checksum error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "07e791d3be96241c77c43846b665ef1384606da2cd2a48730abe606a12906e02" | 1570 | "checksum error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "07e791d3be96241c77c43846b665ef1384606da2cd2a48730abe606a12906e02" |
1511 | "checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2" | 1571 | "checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2" |
1512 | "checksum failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea1063915fd7ef4309e222a5a07cf9c319fb9c7836b1f89b85458672dbb127e1" | 1572 | "checksum failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea1063915fd7ef4309e222a5a07cf9c319fb9c7836b1f89b85458672dbb127e1" |
@@ -1523,14 +1583,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
1523 | "checksum idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e" | 1583 | "checksum idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e" |
1524 | "checksum im 12.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ae9c7f9bb8aee47fc16d535a705f7867a9fc83bb822e5e1043bb98e77ffeed3c" | 1584 | "checksum im 12.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ae9c7f9bb8aee47fc16d535a705f7867a9fc83bb822e5e1043bb98e77ffeed3c" |
1525 | "checksum indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7e81a7c05f79578dbc15793d8b619db9ba32b4577003ef3af1a91c416798c58d" | 1585 | "checksum indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7e81a7c05f79578dbc15793d8b619db9ba32b4577003ef3af1a91c416798c58d" |
1586 | "checksum insta 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "60e94ba6dd3521d953caeed96f6ba06f4cdc9e30e398b3ee7acdd680294f87dc" | ||
1526 | "checksum itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5b8467d9c1cebe26feb08c640139247fac215782d35371ade9a2136ed6085358" | 1587 | "checksum itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5b8467d9c1cebe26feb08c640139247fac215782d35371ade9a2136ed6085358" |
1527 | "checksum itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1306f3464951f30e30d12373d31c79fbd52d236e5e896fd92f96ec7babbbe60b" | 1588 | "checksum itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1306f3464951f30e30d12373d31c79fbd52d236e5e896fd92f96ec7babbbe60b" |
1528 | "checksum join_to_string 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4dc7a5290e8c2606ce2be49f456d50f69173cb96d1541e4f66e34ac8b331a98f" | 1589 | "checksum join_to_string 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4dc7a5290e8c2606ce2be49f456d50f69173cb96d1541e4f66e34ac8b331a98f" |
1529 | "checksum languageserver-types 0.53.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7c01845f71b8b3b3557a8179af4434a4b2570829da12371f05272d28183a06ce" | ||
1530 | "checksum lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a374c89b9db55895453a74c1e38861d9deec0b01b405a82516e9d5de4820dea1" | 1590 | "checksum lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a374c89b9db55895453a74c1e38861d9deec0b01b405a82516e9d5de4820dea1" |
1531 | "checksum libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)" = "023a4cd09b2ff695f9734c1934145a315594b7986398496841c7031a5a1bbdbd" | 1591 | "checksum libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)" = "48450664a984b25d5b479554c29cc04e3150c97aa4c01da5604a2d4ed9151476" |
1532 | "checksum lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "62ebf1391f6acad60e5c8b43706dde4582df75c06698ab44511d15016bc2442c" | 1592 | "checksum lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "62ebf1391f6acad60e5c8b43706dde4582df75c06698ab44511d15016bc2442c" |
1533 | "checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6" | 1593 | "checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6" |
1594 | "checksum lsp-types 0.54.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a252cc2be87d9329dd91c505a951996b3263582ba304870960faaae77b642183" | ||
1534 | "checksum maplit 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "08cbb6b4fef96b6d77bfc40ec491b1690c779e77b05cd9f07f787ed376fd4c43" | 1595 | "checksum maplit 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "08cbb6b4fef96b6d77bfc40ec491b1690c779e77b05cd9f07f787ed376fd4c43" |
1535 | "checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" | 1596 | "checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" |
1536 | "checksum memchr 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "db4c41318937f6e76648f42826b1d9ade5c09cafb5aef7e351240a70f39206e9" | 1597 | "checksum memchr 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "db4c41318937f6e76648f42826b1d9ade5c09cafb5aef7e351240a70f39206e9" |
@@ -1573,20 +1634,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
1573 | "checksum relative-path 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0e7790c7f1cc73d831d28dc5a7deb316a006e7848e6a7f467cdb10a0a9e0fb1c" | 1634 | "checksum relative-path 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0e7790c7f1cc73d831d28dc5a7deb316a006e7848e6a7f467cdb10a0a9e0fb1c" |
1574 | "checksum remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3488ba1b9a2084d38645c4c08276a1752dcbf2c7130d74f1569681ad5d2799c5" | 1635 | "checksum remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3488ba1b9a2084d38645c4c08276a1752dcbf2c7130d74f1569681ad5d2799c5" |
1575 | "checksum ron 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d9cb28ade964585205aaca1f3d41a6297f72e1ad097b49c4bbde033ef86b38d7" | 1636 | "checksum ron 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d9cb28ade964585205aaca1f3d41a6297f72e1ad097b49c4bbde033ef86b38d7" |
1576 | "checksum rowan 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4df666a130f870e6ac76fa525b0b6d984cfeee8f4cd675f2a125f0aced79c5f7" | 1637 | "checksum rowan 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "660069534501214380ab070b979f4b41e8cf3a5279ae07d0e949675efbd595bd" |
1577 | "checksum rustc-demangle 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "adacaae16d02b6ec37fdc7acfcddf365978de76d1983d3ee22afc260e1ca9619" | 1638 | "checksum rustc-demangle 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "adacaae16d02b6ec37fdc7acfcddf365978de76d1983d3ee22afc260e1ca9619" |
1578 | "checksum rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7540fc8b0c49f096ee9c961cda096467dce8084bec6bdca2fc83895fd9b28cb8" | 1639 | "checksum rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7540fc8b0c49f096ee9c961cda096467dce8084bec6bdca2fc83895fd9b28cb8" |
1579 | "checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" | 1640 | "checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" |
1580 | "checksum rusty-fork 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9591f190d2852720b679c21f66ad929f9f1d7bb09d1193c26167586029d8489c" | 1641 | "checksum rusty-fork 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9591f190d2852720b679c21f66ad929f9f1d7bb09d1193c26167586029d8489c" |
1581 | "checksum ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "eb9e9b8cde282a9fe6a42dd4681319bfb63f121b8a8ee9439c6f4107e58a46f7" | 1642 | "checksum ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "eb9e9b8cde282a9fe6a42dd4681319bfb63f121b8a8ee9439c6f4107e58a46f7" |
1582 | "checksum salsa 0.9.1 (git+https://github.com/matklad/salsa?branch=panic-hooks)" = "<none>" | 1643 | "checksum salsa 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c73fd43ecb8ec5fbe64828ced981075b828109f011620d0fa1b66e9e983ceb84" |
1583 | "checksum same-file 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8f20c4be53a8a1ff4c1f1b2bd14570d2f634628709752f0702ecdd2b3f9a5267" | 1644 | "checksum same-file 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8f20c4be53a8a1ff4c1f1b2bd14570d2f634628709752f0702ecdd2b3f9a5267" |
1584 | "checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" | 1645 | "checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" |
1585 | "checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" | 1646 | "checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" |
1586 | "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" | 1647 | "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" |
1587 | "checksum serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)" = "0e732ed5a5592c17d961555e3b552985baf98d50ce418b7b655f31f6ba7eb1b7" | 1648 | "checksum serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)" = "0e732ed5a5592c17d961555e3b552985baf98d50ce418b7b655f31f6ba7eb1b7" |
1588 | "checksum serde_derive 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)" = "b4d6115a3ca25c224e409185325afc16a0d5aaaabc15c42b09587d6f1ba39a5b" | 1649 | "checksum serde_derive 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)" = "b4d6115a3ca25c224e409185325afc16a0d5aaaabc15c42b09587d6f1ba39a5b" |
1589 | "checksum serde_json 1.0.34 (registry+https://github.com/rust-lang/crates.io-index)" = "bdf540260cfee6da923831f4776ddc495ada940c30117977c70f1313a6130545" | 1650 | "checksum serde_json 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)" = "dfb1277d4d0563e4593e0b8b5d23d744d277b55d2bc0bf1c38d0d8a6589d38aa" |
1590 | "checksum sha-1 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "51b9d1f3b5de8a167ab06834a7c883bd197f2191e1dda1a22d9ccfeedbf9aded" | 1651 | "checksum sha-1 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "51b9d1f3b5de8a167ab06834a7c883bd197f2191e1dda1a22d9ccfeedbf9aded" |
1591 | "checksum slug 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b3bc762e6a4b6c6fcaade73e77f9ebc6991b676f88bb2358bddb56560f073373" | 1652 | "checksum slug 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b3bc762e6a4b6c6fcaade73e77f9ebc6991b676f88bb2358bddb56560f073373" |
1592 | "checksum smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = "b73ea3738b47563803ef814925e69be00799a8c07420be8b996f8e98fb2336db" | 1653 | "checksum smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = "b73ea3738b47563803ef814925e69be00799a8c07420be8b996f8e98fb2336db" |
@@ -1594,12 +1655,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
1594 | "checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" | 1655 | "checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" |
1595 | "checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550" | 1656 | "checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550" |
1596 | "checksum superslice 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b50b13d42370e0f5fc62eafdd5c2d20065eaf5458dab215ff3e20e63eea96b30" | 1657 | "checksum superslice 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b50b13d42370e0f5fc62eafdd5c2d20065eaf5458dab215ff3e20e63eea96b30" |
1597 | "checksum syn 0.15.24 (registry+https://github.com/rust-lang/crates.io-index)" = "734ecc29cd36e8123850d9bf21dfd62ef8300aaa8f879aabaa899721808be37c" | 1658 | "checksum syn 0.15.25 (registry+https://github.com/rust-lang/crates.io-index)" = "71b7693d9626935a362a3d1d4e59380800a919ebfa478d77a4f49e2a6d2c3ad5" |
1598 | "checksum synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "73687139bf99285483c96ac0add482c3776528beac1d97d444f6e91f203a2015" | 1659 | "checksum synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "73687139bf99285483c96ac0add482c3776528beac1d97d444f6e91f203a2015" |
1599 | "checksum tempfile 3.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "7e91405c14320e5c79b3d148e1c86f40749a36e490642202a31689cb1a3452b2" | 1660 | "checksum tempfile 3.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "7e91405c14320e5c79b3d148e1c86f40749a36e490642202a31689cb1a3452b2" |
1600 | "checksum tera 0.11.20 (registry+https://github.com/rust-lang/crates.io-index)" = "4b505279e19d8f7d24b1a9dc58327c9c36174b1a2c7ebdeac70792d017cb64f3" | 1661 | "checksum tera 0.11.20 (registry+https://github.com/rust-lang/crates.io-index)" = "4b505279e19d8f7d24b1a9dc58327c9c36174b1a2c7ebdeac70792d017cb64f3" |
1601 | "checksum teraron 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0d89ad4617d1dec55331067fadaa041e813479e1779616f3d3ce9308bf46184e" | 1662 | "checksum teraron 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0d89ad4617d1dec55331067fadaa041e813479e1779616f3d3ce9308bf46184e" |
1602 | "checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096" | 1663 | "checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096" |
1664 | "checksum termios 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "72b620c5ea021d75a735c943269bb07d30c9b77d6ac6b236bc8b5c496ef05625" | ||
1603 | "checksum text_unit 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "158bb1c22b638b1da3c95a8ad9f061ea40d4d39fd0301be3a520f92efeeb189e" | 1665 | "checksum text_unit 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "158bb1c22b638b1da3c95a8ad9f061ea40d4d39fd0301be3a520f92efeeb189e" |
1604 | "checksum textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "307686869c93e71f94da64286f9a9524c0f308a9e1c87a583de8e9c9039ad3f6" | 1666 | "checksum textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "307686869c93e71f94da64286f9a9524c0f308a9e1c87a583de8e9c9039ad3f6" |
1605 | "checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" | 1667 | "checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" |
diff --git a/Cargo.toml b/Cargo.toml index 85aaa23b9..c5155e899 100644 --- a/Cargo.toml +++ b/Cargo.toml | |||
@@ -6,5 +6,3 @@ incremental = true | |||
6 | debug = true | 6 | debug = true |
7 | 7 | ||
8 | [patch.'crates-io'] | 8 | [patch.'crates-io'] |
9 | cargo_metadata = { git = "https://github.com/oli-obk/cargo_metadata.git", rev="f73e27b24e" } | ||
10 | salsa = { git = "https://github.com/matklad/salsa", branch = "panic-hooks" } | ||
diff --git a/crates/gen_lsp_server/Cargo.toml b/crates/gen_lsp_server/Cargo.toml index a421a3e0b..041151741 100644 --- a/crates/gen_lsp_server/Cargo.toml +++ b/crates/gen_lsp_server/Cargo.toml | |||
@@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0" | |||
8 | description = "Generic LSP server scaffold." | 8 | description = "Generic LSP server scaffold." |
9 | 9 | ||
10 | [dependencies] | 10 | [dependencies] |
11 | languageserver-types = "0.53.1" | 11 | lsp-types = "0.54.0" |
12 | log = "0.4.3" | 12 | log = "0.4.3" |
13 | failure = "0.1.4" | 13 | failure = "0.1.4" |
14 | serde_json = "1.0.34" | 14 | serde_json = "1.0.34" |
diff --git a/crates/gen_lsp_server/src/lib.rs b/crates/gen_lsp_server/src/lib.rs index 16ac799ac..edbdda6c8 100644 --- a/crates/gen_lsp_server/src/lib.rs +++ b/crates/gen_lsp_server/src/lib.rs | |||
@@ -6,12 +6,12 @@ | |||
6 | //! | 6 | //! |
7 | //! ```no_run | 7 | //! ```no_run |
8 | //! extern crate gen_lsp_server; | 8 | //! extern crate gen_lsp_server; |
9 | //! extern crate languageserver_types; | 9 | //! extern crate lsp_types; |
10 | //! extern crate failure; | 10 | //! extern crate failure; |
11 | //! extern crate crossbeam_channel; | 11 | //! extern crate crossbeam_channel; |
12 | //! | 12 | //! |
13 | //! use crossbeam_channel::{Sender, Receiver}; | 13 | //! use crossbeam_channel::{Sender, Receiver}; |
14 | //! use languageserver_types::{ServerCapabilities, InitializeParams, request::{GotoDefinition, GotoDefinitionResponse}}; | 14 | //! use lsp_types::{ServerCapabilities, InitializeParams, request::{GotoDefinition, GotoDefinitionResponse}}; |
15 | //! use gen_lsp_server::{run_server, stdio_transport, handle_shutdown, RawMessage, RawResponse}; | 15 | //! use gen_lsp_server::{run_server, stdio_transport, handle_shutdown, RawMessage, RawResponse}; |
16 | //! | 16 | //! |
17 | //! fn main() -> Result<(), failure::Error> { | 17 | //! fn main() -> Result<(), failure::Error> { |
@@ -65,7 +65,7 @@ mod msg; | |||
65 | mod stdio; | 65 | mod stdio; |
66 | 66 | ||
67 | use crossbeam_channel::{Receiver, Sender}; | 67 | use crossbeam_channel::{Receiver, Sender}; |
68 | use languageserver_types::{ | 68 | use lsp_types::{ |
69 | notification::{Exit, Initialized}, | 69 | notification::{Exit, Initialized}, |
70 | request::{Initialize, Shutdown}, | 70 | request::{Initialize, Shutdown}, |
71 | InitializeParams, InitializeResult, ServerCapabilities, | 71 | InitializeParams, InitializeResult, ServerCapabilities, |
diff --git a/crates/gen_lsp_server/src/msg.rs b/crates/gen_lsp_server/src/msg.rs index 94bef374c..818111fe7 100644 --- a/crates/gen_lsp_server/src/msg.rs +++ b/crates/gen_lsp_server/src/msg.rs | |||
@@ -1,6 +1,6 @@ | |||
1 | use std::io::{BufRead, Write}; | 1 | use std::io::{BufRead, Write}; |
2 | 2 | ||
3 | use languageserver_types::{notification::Notification, request::Request}; | 3 | use lsp_types::{notification::Notification, request::Request}; |
4 | use serde::{Deserialize, Serialize}; | 4 | use serde::{Deserialize, Serialize}; |
5 | use serde_json::{from_str, from_value, to_string, to_value, Value}; | 5 | use serde_json::{from_str, from_value, to_string, to_value, Value}; |
6 | use failure::{bail, format_err}; | 6 | use failure::{bail, format_err}; |
diff --git a/crates/ra_db/Cargo.toml b/crates/ra_db/Cargo.toml index 2c1f94ad0..21d987688 100644 --- a/crates/ra_db/Cargo.toml +++ b/crates/ra_db/Cargo.toml | |||
@@ -6,7 +6,7 @@ authors = ["Aleksey Kladov <[email protected]>"] | |||
6 | 6 | ||
7 | [dependencies] | 7 | [dependencies] |
8 | relative-path = "0.4.0" | 8 | relative-path = "0.4.0" |
9 | salsa = "0.9.1" | 9 | salsa = "0.9.2" |
10 | rustc-hash = "1.0" | 10 | rustc-hash = "1.0" |
11 | parking_lot = "0.7.0" | 11 | parking_lot = "0.7.0" |
12 | ra_arena = { path = "../ra_arena" } | 12 | ra_arena = { path = "../ra_arena" } |
diff --git a/crates/ra_db/src/cancellation.rs b/crates/ra_db/src/cancellation.rs index 32a268553..439080075 100644 --- a/crates/ra_db/src/cancellation.rs +++ b/crates/ra_db/src/cancellation.rs | |||
@@ -21,8 +21,6 @@ pub struct Canceled { | |||
21 | _private: (), | 21 | _private: (), |
22 | } | 22 | } |
23 | 23 | ||
24 | pub type Cancelable<T> = Result<T, Canceled>; | ||
25 | |||
26 | impl Canceled { | 24 | impl Canceled { |
27 | pub(crate) fn new() -> Canceled { | 25 | pub(crate) fn new() -> Canceled { |
28 | Canceled { _private: () } | 26 | Canceled { _private: () } |
diff --git a/crates/ra_db/src/lib.rs b/crates/ra_db/src/lib.rs index 0c4dfc8c6..89113e7a6 100644 --- a/crates/ra_db/src/lib.rs +++ b/crates/ra_db/src/lib.rs | |||
@@ -10,7 +10,7 @@ use std::panic; | |||
10 | use ra_syntax::{TextUnit, TextRange, SourceFile, TreeArc}; | 10 | use ra_syntax::{TextUnit, TextRange, SourceFile, TreeArc}; |
11 | 11 | ||
12 | pub use crate::{ | 12 | pub use crate::{ |
13 | cancellation::{Canceled, Cancelable}, | 13 | cancellation::Canceled, |
14 | syntax_ptr::LocalSyntaxPtr, | 14 | syntax_ptr::LocalSyntaxPtr, |
15 | input::{ | 15 | input::{ |
16 | FilesDatabase, FileId, CrateId, SourceRoot, SourceRootId, CrateGraph, Dependency, | 16 | FilesDatabase, FileId, CrateId, SourceRoot, SourceRootId, CrateGraph, Dependency, |
@@ -21,10 +21,23 @@ pub use crate::{ | |||
21 | }; | 21 | }; |
22 | 22 | ||
23 | pub trait BaseDatabase: salsa::Database + panic::RefUnwindSafe { | 23 | pub trait BaseDatabase: salsa::Database + panic::RefUnwindSafe { |
24 | fn check_canceled(&self) -> Cancelable<()> { | 24 | /// Aborts current query if there are pending changes. |
25 | self.salsa_runtime() | 25 | /// |
26 | .if_current_revision_is_canceled(Canceled::throw); | 26 | /// rust-analyzer needs to be able to answer semantic questions about the |
27 | Ok(()) | 27 | /// code while the code is being modified. A common problem is that a |
28 | /// long-running query is being calculated when a new change arrives. | ||
29 | /// | ||
30 | /// We can't just apply the change immediately: this will cause the pending | ||
31 | /// query to see inconsistent state (it will observe an absence of | ||
32 | /// repeatable read). So what we do is we **cancel** all pending queries | ||
33 | /// before applying the change. | ||
34 | /// | ||
35 | /// We implement cancellation by panicking with a special value and catching | ||
36 | /// it on the API boundary. Salsa explicitly supports this use-case. | ||
37 | fn check_canceled(&self) { | ||
38 | if self.salsa_runtime().is_current_revision_canceled() { | ||
39 | Canceled::throw() | ||
40 | } | ||
28 | } | 41 | } |
29 | 42 | ||
30 | fn catch_canceled<F: FnOnce(&Self) -> T + panic::UnwindSafe, T>( | 43 | fn catch_canceled<F: FnOnce(&Self) -> T + panic::UnwindSafe, T>( |
diff --git a/crates/ra_hir/Cargo.toml b/crates/ra_hir/Cargo.toml index 0135e0e16..415848f09 100644 --- a/crates/ra_hir/Cargo.toml +++ b/crates/ra_hir/Cargo.toml | |||
@@ -8,7 +8,7 @@ authors = ["Aleksey Kladov <[email protected]>"] | |||
8 | arrayvec = "0.4.10" | 8 | arrayvec = "0.4.10" |
9 | log = "0.4.5" | 9 | log = "0.4.5" |
10 | relative-path = "0.4.0" | 10 | relative-path = "0.4.0" |
11 | salsa = "0.9.1" | 11 | salsa = "0.9.2" |
12 | rustc-hash = "1.0" | 12 | rustc-hash = "1.0" |
13 | parking_lot = "0.7.0" | 13 | parking_lot = "0.7.0" |
14 | ena = "0.11" | 14 | ena = "0.11" |
diff --git a/crates/ra_hir/src/adt.rs b/crates/ra_hir/src/adt.rs index bcb705c24..d87fe7049 100644 --- a/crates/ra_hir/src/adt.rs +++ b/crates/ra_hir/src/adt.rs | |||
@@ -1,6 +1,5 @@ | |||
1 | use std::sync::Arc; | 1 | use std::sync::Arc; |
2 | 2 | ||
3 | use ra_db::Cancelable; | ||
4 | use ra_syntax::{ | 3 | use ra_syntax::{ |
5 | SyntaxNode, | 4 | SyntaxNode, |
6 | ast::{self, NameOwner, StructFlavor, AstNode} | 5 | ast::{self, NameOwner, StructFlavor, AstNode} |
@@ -18,8 +17,8 @@ impl Struct { | |||
18 | Struct { def_id } | 17 | Struct { def_id } |
19 | } | 18 | } |
20 | 19 | ||
21 | pub(crate) fn variant_data(&self, db: &impl HirDatabase) -> Cancelable<Arc<VariantData>> { | 20 | pub(crate) fn variant_data(&self, db: &impl HirDatabase) -> Arc<VariantData> { |
22 | Ok(db.struct_data(self.def_id)?.variant_data.clone()) | 21 | db.struct_data(self.def_id).variant_data.clone() |
23 | } | 22 | } |
24 | } | 23 | } |
25 | 24 | ||
@@ -37,16 +36,13 @@ impl StructData { | |||
37 | StructData { name, variant_data } | 36 | StructData { name, variant_data } |
38 | } | 37 | } |
39 | 38 | ||
40 | pub(crate) fn struct_data_query( | 39 | pub(crate) fn struct_data_query(db: &impl HirDatabase, def_id: DefId) -> Arc<StructData> { |
41 | db: &impl HirDatabase, | ||
42 | def_id: DefId, | ||
43 | ) -> Cancelable<Arc<StructData>> { | ||
44 | let def_loc = def_id.loc(db); | 40 | let def_loc = def_id.loc(db); |
45 | assert!(def_loc.kind == DefKind::Struct); | 41 | assert!(def_loc.kind == DefKind::Struct); |
46 | let syntax = db.file_item(def_loc.source_item_id); | 42 | let syntax = db.file_item(def_loc.source_item_id); |
47 | let struct_def = | 43 | let struct_def = |
48 | ast::StructDef::cast(&syntax).expect("struct def should point to StructDef node"); | 44 | ast::StructDef::cast(&syntax).expect("struct def should point to StructDef node"); |
49 | Ok(Arc::new(StructData::new(struct_def))) | 45 | Arc::new(StructData::new(struct_def)) |
50 | } | 46 | } |
51 | } | 47 | } |
52 | 48 | ||
@@ -84,10 +80,7 @@ impl EnumData { | |||
84 | EnumData { name, variants } | 80 | EnumData { name, variants } |
85 | } | 81 | } |
86 | 82 | ||
87 | pub(crate) fn enum_data_query( | 83 | pub(crate) fn enum_data_query(db: &impl HirDatabase, def_id: DefId) -> Arc<EnumData> { |
88 | db: &impl HirDatabase, | ||
89 | def_id: DefId, | ||
90 | ) -> Cancelable<Arc<EnumData>> { | ||
91 | let def_loc = def_id.loc(db); | 84 | let def_loc = def_id.loc(db); |
92 | assert!(def_loc.kind == DefKind::Enum); | 85 | assert!(def_loc.kind == DefKind::Enum); |
93 | let syntax = db.file_item(def_loc.source_item_id); | 86 | let syntax = db.file_item(def_loc.source_item_id); |
@@ -107,7 +100,7 @@ impl EnumData { | |||
107 | } else { | 100 | } else { |
108 | Vec::new() | 101 | Vec::new() |
109 | }; | 102 | }; |
110 | Ok(Arc::new(EnumData::new(enum_def, variants))) | 103 | Arc::new(EnumData::new(enum_def, variants)) |
111 | } | 104 | } |
112 | } | 105 | } |
113 | 106 | ||
@@ -133,7 +126,7 @@ impl EnumVariantData { | |||
133 | pub(crate) fn enum_variant_data_query( | 126 | pub(crate) fn enum_variant_data_query( |
134 | db: &impl HirDatabase, | 127 | db: &impl HirDatabase, |
135 | def_id: DefId, | 128 | def_id: DefId, |
136 | ) -> Cancelable<Arc<EnumVariantData>> { | 129 | ) -> Arc<EnumVariantData> { |
137 | let def_loc = def_id.loc(db); | 130 | let def_loc = def_id.loc(db); |
138 | assert!(def_loc.kind == DefKind::EnumVariant); | 131 | assert!(def_loc.kind == DefKind::EnumVariant); |
139 | let syntax = db.file_item(def_loc.source_item_id); | 132 | let syntax = db.file_item(def_loc.source_item_id); |
@@ -146,10 +139,7 @@ impl EnumVariantData { | |||
146 | .expect("enum variant list should have enum ancestor"); | 139 | .expect("enum variant list should have enum ancestor"); |
147 | let enum_def_id = get_def_id(db, &def_loc, enum_node, DefKind::Enum); | 140 | let enum_def_id = get_def_id(db, &def_loc, enum_node, DefKind::Enum); |
148 | 141 | ||
149 | Ok(Arc::new(EnumVariantData::new( | 142 | Arc::new(EnumVariantData::new(variant_def, Enum::new(enum_def_id))) |
150 | variant_def, | ||
151 | Enum::new(enum_def_id), | ||
152 | ))) | ||
153 | } | 143 | } |
154 | } | 144 | } |
155 | 145 | ||
diff --git a/crates/ra_hir/src/code_model_api.rs b/crates/ra_hir/src/code_model_api.rs index 91b235594..0cf7deac9 100644 --- a/crates/ra_hir/src/code_model_api.rs +++ b/crates/ra_hir/src/code_model_api.rs | |||
@@ -1,7 +1,7 @@ | |||
1 | use std::sync::Arc; | 1 | use std::sync::Arc; |
2 | 2 | ||
3 | use relative_path::RelativePathBuf; | 3 | use relative_path::RelativePathBuf; |
4 | use ra_db::{CrateId, Cancelable, FileId}; | 4 | use ra_db::{CrateId, FileId}; |
5 | use ra_syntax::{ast, TreeArc, SyntaxNode}; | 5 | use ra_syntax::{ast, TreeArc, SyntaxNode}; |
6 | 6 | ||
7 | use crate::{ | 7 | use crate::{ |
@@ -33,10 +33,10 @@ impl Crate { | |||
33 | pub fn crate_id(&self) -> CrateId { | 33 | pub fn crate_id(&self) -> CrateId { |
34 | self.crate_id | 34 | self.crate_id |
35 | } | 35 | } |
36 | pub fn dependencies(&self, db: &impl HirDatabase) -> Cancelable<Vec<CrateDependency>> { | 36 | pub fn dependencies(&self, db: &impl HirDatabase) -> Vec<CrateDependency> { |
37 | Ok(self.dependencies_impl(db)) | 37 | self.dependencies_impl(db) |
38 | } | 38 | } |
39 | pub fn root_module(&self, db: &impl HirDatabase) -> Cancelable<Option<Module>> { | 39 | pub fn root_module(&self, db: &impl HirDatabase) -> Option<Module> { |
40 | self.root_module_impl(db) | 40 | self.root_module_impl(db) |
41 | } | 41 | } |
42 | } | 42 | } |
@@ -78,12 +78,12 @@ pub enum Problem { | |||
78 | 78 | ||
79 | impl Module { | 79 | impl Module { |
80 | /// Name of this module. | 80 | /// Name of this module. |
81 | pub fn name(&self, db: &impl HirDatabase) -> Cancelable<Option<Name>> { | 81 | pub fn name(&self, db: &impl HirDatabase) -> Option<Name> { |
82 | self.name_impl(db) | 82 | self.name_impl(db) |
83 | } | 83 | } |
84 | 84 | ||
85 | /// Returns a node which defines this module. That is, a file or a `mod foo {}` with items. | 85 | /// Returns a node which defines this module. That is, a file or a `mod foo {}` with items. |
86 | pub fn definition_source(&self, db: &impl HirDatabase) -> Cancelable<(FileId, ModuleSource)> { | 86 | pub fn definition_source(&self, db: &impl HirDatabase) -> (FileId, ModuleSource) { |
87 | self.definition_source_impl(db) | 87 | self.definition_source_impl(db) |
88 | } | 88 | } |
89 | 89 | ||
@@ -92,60 +92,57 @@ impl Module { | |||
92 | pub fn declaration_source( | 92 | pub fn declaration_source( |
93 | &self, | 93 | &self, |
94 | db: &impl HirDatabase, | 94 | db: &impl HirDatabase, |
95 | ) -> Cancelable<Option<(FileId, TreeArc<ast::Module>)>> { | 95 | ) -> Option<(FileId, TreeArc<ast::Module>)> { |
96 | self.declaration_source_impl(db) | 96 | self.declaration_source_impl(db) |
97 | } | 97 | } |
98 | 98 | ||
99 | /// Returns the crate this module is part of. | 99 | /// Returns the crate this module is part of. |
100 | pub fn krate(&self, db: &impl HirDatabase) -> Cancelable<Option<Crate>> { | 100 | pub fn krate(&self, db: &impl HirDatabase) -> Option<Crate> { |
101 | self.krate_impl(db) | 101 | self.krate_impl(db) |
102 | } | 102 | } |
103 | 103 | ||
104 | /// Topmost parent of this module. Every module has a `crate_root`, but some | 104 | /// Topmost parent of this module. Every module has a `crate_root`, but some |
105 | /// might be missing `krate`. This can happen if a module's file is not included | 105 | /// might be missing `krate`. This can happen if a module's file is not included |
106 | /// in the module tree of any target in Cargo.toml. | 106 | /// in the module tree of any target in Cargo.toml. |
107 | pub fn crate_root(&self, db: &impl HirDatabase) -> Cancelable<Module> { | 107 | pub fn crate_root(&self, db: &impl HirDatabase) -> Module { |
108 | self.crate_root_impl(db) | 108 | self.crate_root_impl(db) |
109 | } | 109 | } |
110 | 110 | ||
111 | /// Finds a child module with the specified name. | 111 | /// Finds a child module with the specified name. |
112 | pub fn child(&self, db: &impl HirDatabase, name: &Name) -> Cancelable<Option<Module>> { | 112 | pub fn child(&self, db: &impl HirDatabase, name: &Name) -> Option<Module> { |
113 | self.child_impl(db, name) | 113 | self.child_impl(db, name) |
114 | } | 114 | } |
115 | 115 | ||
116 | /// Iterates over all child modules. | 116 | /// Iterates over all child modules. |
117 | pub fn children(&self, db: &impl HirDatabase) -> Cancelable<impl Iterator<Item = Module>> { | 117 | pub fn children(&self, db: &impl HirDatabase) -> impl Iterator<Item = Module> { |
118 | self.children_impl(db) | 118 | self.children_impl(db) |
119 | } | 119 | } |
120 | 120 | ||
121 | /// Finds a parent module. | 121 | /// Finds a parent module. |
122 | pub fn parent(&self, db: &impl HirDatabase) -> Cancelable<Option<Module>> { | 122 | pub fn parent(&self, db: &impl HirDatabase) -> Option<Module> { |
123 | self.parent_impl(db) | 123 | self.parent_impl(db) |
124 | } | 124 | } |
125 | 125 | ||
126 | pub fn path_to_root(&self, db: &impl HirDatabase) -> Cancelable<Vec<Module>> { | 126 | pub fn path_to_root(&self, db: &impl HirDatabase) -> Vec<Module> { |
127 | let mut res = vec![self.clone()]; | 127 | let mut res = vec![self.clone()]; |
128 | let mut curr = self.clone(); | 128 | let mut curr = self.clone(); |
129 | while let Some(next) = curr.parent(db)? { | 129 | while let Some(next) = curr.parent(db) { |
130 | res.push(next.clone()); | 130 | res.push(next.clone()); |
131 | curr = next | 131 | curr = next |
132 | } | 132 | } |
133 | Ok(res) | 133 | res |
134 | } | 134 | } |
135 | 135 | ||
136 | /// Returns a `ModuleScope`: a set of items, visible in this module. | 136 | /// Returns a `ModuleScope`: a set of items, visible in this module. |
137 | pub fn scope(&self, db: &impl HirDatabase) -> Cancelable<ModuleScope> { | 137 | pub fn scope(&self, db: &impl HirDatabase) -> ModuleScope { |
138 | self.scope_impl(db) | 138 | self.scope_impl(db) |
139 | } | 139 | } |
140 | 140 | ||
141 | pub fn resolve_path(&self, db: &impl HirDatabase, path: &Path) -> Cancelable<PerNs<DefId>> { | 141 | pub fn resolve_path(&self, db: &impl HirDatabase, path: &Path) -> PerNs<DefId> { |
142 | self.resolve_path_impl(db, path) | 142 | self.resolve_path_impl(db, path) |
143 | } | 143 | } |
144 | 144 | ||
145 | pub fn problems( | 145 | pub fn problems(&self, db: &impl HirDatabase) -> Vec<(TreeArc<SyntaxNode>, Problem)> { |
146 | &self, | ||
147 | db: &impl HirDatabase, | ||
148 | ) -> Cancelable<Vec<(TreeArc<SyntaxNode>, Problem)>> { | ||
149 | self.problems_impl(db) | 146 | self.problems_impl(db) |
150 | } | 147 | } |
151 | } | 148 | } |
@@ -160,7 +157,7 @@ impl StructField { | |||
160 | pub fn name(&self) -> &Name { | 157 | pub fn name(&self) -> &Name { |
161 | &self.name | 158 | &self.name |
162 | } | 159 | } |
163 | pub fn ty(&self, db: &impl HirDatabase) -> Cancelable<Option<Ty>> { | 160 | pub fn ty(&self, db: &impl HirDatabase) -> Option<Ty> { |
164 | db.type_for_field(self.struct_.def_id, self.name.clone()) | 161 | db.type_for_field(self.struct_.def_id, self.name.clone()) |
165 | } | 162 | } |
166 | } | 163 | } |
@@ -175,13 +172,12 @@ impl Struct { | |||
175 | self.def_id | 172 | self.def_id |
176 | } | 173 | } |
177 | 174 | ||
178 | pub fn name(&self, db: &impl HirDatabase) -> Cancelable<Option<Name>> { | 175 | pub fn name(&self, db: &impl HirDatabase) -> Option<Name> { |
179 | Ok(db.struct_data(self.def_id)?.name.clone()) | 176 | db.struct_data(self.def_id).name.clone() |
180 | } | 177 | } |
181 | 178 | ||
182 | pub fn fields(&self, db: &impl HirDatabase) -> Cancelable<Vec<StructField>> { | 179 | pub fn fields(&self, db: &impl HirDatabase) -> Vec<StructField> { |
183 | let res = db | 180 | db.struct_data(self.def_id) |
184 | .struct_data(self.def_id)? | ||
185 | .variant_data | 181 | .variant_data |
186 | .fields() | 182 | .fields() |
187 | .iter() | 183 | .iter() |
@@ -189,15 +185,11 @@ impl Struct { | |||
189 | struct_: self.clone(), | 185 | struct_: self.clone(), |
190 | name: it.name.clone(), | 186 | name: it.name.clone(), |
191 | }) | 187 | }) |
192 | .collect(); | 188 | .collect() |
193 | Ok(res) | ||
194 | } | 189 | } |
195 | 190 | ||
196 | pub fn source( | 191 | pub fn source(&self, db: &impl HirDatabase) -> (HirFileId, TreeArc<ast::StructDef>) { |
197 | &self, | 192 | def_id_to_ast(db, self.def_id) |
198 | db: &impl HirDatabase, | ||
199 | ) -> Cancelable<(HirFileId, TreeArc<ast::StructDef>)> { | ||
200 | Ok(def_id_to_ast(db, self.def_id)) | ||
201 | } | 193 | } |
202 | } | 194 | } |
203 | 195 | ||
@@ -215,16 +207,16 @@ impl Enum { | |||
215 | self.def_id | 207 | self.def_id |
216 | } | 208 | } |
217 | 209 | ||
218 | pub fn name(&self, db: &impl HirDatabase) -> Cancelable<Option<Name>> { | 210 | pub fn name(&self, db: &impl HirDatabase) -> Option<Name> { |
219 | Ok(db.enum_data(self.def_id)?.name.clone()) | 211 | db.enum_data(self.def_id).name.clone() |
220 | } | 212 | } |
221 | 213 | ||
222 | pub fn variants(&self, db: &impl HirDatabase) -> Cancelable<Vec<(Name, EnumVariant)>> { | 214 | pub fn variants(&self, db: &impl HirDatabase) -> Vec<(Name, EnumVariant)> { |
223 | Ok(db.enum_data(self.def_id)?.variants.clone()) | 215 | db.enum_data(self.def_id).variants.clone() |
224 | } | 216 | } |
225 | 217 | ||
226 | pub fn source(&self, db: &impl HirDatabase) -> Cancelable<(HirFileId, TreeArc<ast::EnumDef>)> { | 218 | pub fn source(&self, db: &impl HirDatabase) -> (HirFileId, TreeArc<ast::EnumDef>) { |
227 | Ok(def_id_to_ast(db, self.def_id)) | 219 | def_id_to_ast(db, self.def_id) |
228 | } | 220 | } |
229 | } | 221 | } |
230 | 222 | ||
@@ -242,23 +234,20 @@ impl EnumVariant { | |||
242 | self.def_id | 234 | self.def_id |
243 | } | 235 | } |
244 | 236 | ||
245 | pub fn parent_enum(&self, db: &impl HirDatabase) -> Cancelable<Enum> { | 237 | pub fn parent_enum(&self, db: &impl HirDatabase) -> Enum { |
246 | Ok(db.enum_variant_data(self.def_id)?.parent_enum.clone()) | 238 | db.enum_variant_data(self.def_id).parent_enum.clone() |
247 | } | 239 | } |
248 | 240 | ||
249 | pub fn name(&self, db: &impl HirDatabase) -> Cancelable<Option<Name>> { | 241 | pub fn name(&self, db: &impl HirDatabase) -> Option<Name> { |
250 | Ok(db.enum_variant_data(self.def_id)?.name.clone()) | 242 | db.enum_variant_data(self.def_id).name.clone() |
251 | } | 243 | } |
252 | 244 | ||
253 | pub fn variant_data(&self, db: &impl HirDatabase) -> Cancelable<Arc<VariantData>> { | 245 | pub fn variant_data(&self, db: &impl HirDatabase) -> Arc<VariantData> { |
254 | Ok(db.enum_variant_data(self.def_id)?.variant_data.clone()) | 246 | db.enum_variant_data(self.def_id).variant_data.clone() |
255 | } | 247 | } |
256 | 248 | ||
257 | pub fn source( | 249 | pub fn source(&self, db: &impl HirDatabase) -> (HirFileId, TreeArc<ast::EnumVariant>) { |
258 | &self, | 250 | def_id_to_ast(db, self.def_id) |
259 | db: &impl HirDatabase, | ||
260 | ) -> Cancelable<(HirFileId, TreeArc<ast::EnumVariant>)> { | ||
261 | Ok(def_id_to_ast(db, self.def_id)) | ||
262 | } | 251 | } |
263 | } | 252 | } |
264 | 253 | ||
@@ -305,28 +294,28 @@ impl Function { | |||
305 | self.def_id | 294 | self.def_id |
306 | } | 295 | } |
307 | 296 | ||
308 | pub fn source(&self, db: &impl HirDatabase) -> Cancelable<(HirFileId, TreeArc<ast::FnDef>)> { | 297 | pub fn source(&self, db: &impl HirDatabase) -> (HirFileId, TreeArc<ast::FnDef>) { |
309 | Ok(def_id_to_ast(db, self.def_id)) | 298 | def_id_to_ast(db, self.def_id) |
310 | } | 299 | } |
311 | 300 | ||
312 | pub fn body_syntax_mapping(&self, db: &impl HirDatabase) -> Cancelable<Arc<BodySyntaxMapping>> { | 301 | pub fn body_syntax_mapping(&self, db: &impl HirDatabase) -> Arc<BodySyntaxMapping> { |
313 | db.body_syntax_mapping(self.def_id) | 302 | db.body_syntax_mapping(self.def_id) |
314 | } | 303 | } |
315 | 304 | ||
316 | pub fn scopes(&self, db: &impl HirDatabase) -> Cancelable<ScopesWithSyntaxMapping> { | 305 | pub fn scopes(&self, db: &impl HirDatabase) -> ScopesWithSyntaxMapping { |
317 | let scopes = db.fn_scopes(self.def_id)?; | 306 | let scopes = db.fn_scopes(self.def_id); |
318 | let syntax_mapping = db.body_syntax_mapping(self.def_id)?; | 307 | let syntax_mapping = db.body_syntax_mapping(self.def_id); |
319 | Ok(ScopesWithSyntaxMapping { | 308 | ScopesWithSyntaxMapping { |
320 | scopes, | 309 | scopes, |
321 | syntax_mapping, | 310 | syntax_mapping, |
322 | }) | 311 | } |
323 | } | 312 | } |
324 | 313 | ||
325 | pub fn signature(&self, db: &impl HirDatabase) -> Arc<FnSignature> { | 314 | pub fn signature(&self, db: &impl HirDatabase) -> Arc<FnSignature> { |
326 | db.fn_signature(self.def_id) | 315 | db.fn_signature(self.def_id) |
327 | } | 316 | } |
328 | 317 | ||
329 | pub fn infer(&self, db: &impl HirDatabase) -> Cancelable<Arc<InferenceResult>> { | 318 | pub fn infer(&self, db: &impl HirDatabase) -> Arc<InferenceResult> { |
330 | db.infer(self.def_id) | 319 | db.infer(self.def_id) |
331 | } | 320 | } |
332 | } | 321 | } |
@@ -341,8 +330,8 @@ impl Const { | |||
341 | Const { def_id } | 330 | Const { def_id } |
342 | } | 331 | } |
343 | 332 | ||
344 | pub fn source(&self, db: &impl HirDatabase) -> Cancelable<(HirFileId, TreeArc<ast::ConstDef>)> { | 333 | pub fn source(&self, db: &impl HirDatabase) -> (HirFileId, TreeArc<ast::ConstDef>) { |
345 | Ok(def_id_to_ast(db, self.def_id)) | 334 | def_id_to_ast(db, self.def_id) |
346 | } | 335 | } |
347 | } | 336 | } |
348 | 337 | ||
@@ -356,11 +345,8 @@ impl Static { | |||
356 | Static { def_id } | 345 | Static { def_id } |
357 | } | 346 | } |
358 | 347 | ||
359 | pub fn source( | 348 | pub fn source(&self, db: &impl HirDatabase) -> (HirFileId, TreeArc<ast::StaticDef>) { |
360 | &self, | 349 | def_id_to_ast(db, self.def_id) |
361 | db: &impl HirDatabase, | ||
362 | ) -> Cancelable<(HirFileId, TreeArc<ast::StaticDef>)> { | ||
363 | Ok(def_id_to_ast(db, self.def_id)) | ||
364 | } | 350 | } |
365 | } | 351 | } |
366 | 352 | ||
@@ -374,8 +360,8 @@ impl Trait { | |||
374 | Trait { def_id } | 360 | Trait { def_id } |
375 | } | 361 | } |
376 | 362 | ||
377 | pub fn source(&self, db: &impl HirDatabase) -> Cancelable<(HirFileId, TreeArc<ast::TraitDef>)> { | 363 | pub fn source(&self, db: &impl HirDatabase) -> (HirFileId, TreeArc<ast::TraitDef>) { |
378 | Ok(def_id_to_ast(db, self.def_id)) | 364 | def_id_to_ast(db, self.def_id) |
379 | } | 365 | } |
380 | } | 366 | } |
381 | 367 | ||
@@ -389,7 +375,7 @@ impl Type { | |||
389 | Type { def_id } | 375 | Type { def_id } |
390 | } | 376 | } |
391 | 377 | ||
392 | pub fn source(&self, db: &impl HirDatabase) -> Cancelable<(HirFileId, TreeArc<ast::TypeDef>)> { | 378 | pub fn source(&self, db: &impl HirDatabase) -> (HirFileId, TreeArc<ast::TypeDef>) { |
393 | Ok(def_id_to_ast(db, self.def_id)) | 379 | def_id_to_ast(db, self.def_id) |
394 | } | 380 | } |
395 | } | 381 | } |
diff --git a/crates/ra_hir/src/code_model_impl/function.rs b/crates/ra_hir/src/code_model_impl/function.rs index 8d6b7fc19..66d7e1713 100644 --- a/crates/ra_hir/src/code_model_impl/function.rs +++ b/crates/ra_hir/src/code_model_impl/function.rs | |||
@@ -2,7 +2,6 @@ mod scope; | |||
2 | 2 | ||
3 | use std::sync::Arc; | 3 | use std::sync::Arc; |
4 | 4 | ||
5 | use ra_db::Cancelable; | ||
6 | use ra_syntax::{TreeArc, ast::{self, NameOwner}}; | 5 | use ra_syntax::{TreeArc, ast::{self, NameOwner}}; |
7 | 6 | ||
8 | use crate::{ | 7 | use crate::{ |
@@ -20,16 +19,16 @@ impl Function { | |||
20 | Function { def_id } | 19 | Function { def_id } |
21 | } | 20 | } |
22 | 21 | ||
23 | pub(crate) fn body(&self, db: &impl HirDatabase) -> Cancelable<Arc<Body>> { | 22 | pub(crate) fn body(&self, db: &impl HirDatabase) -> Arc<Body> { |
24 | db.body_hir(self.def_id) | 23 | db.body_hir(self.def_id) |
25 | } | 24 | } |
26 | 25 | ||
27 | pub(crate) fn module(&self, db: &impl HirDatabase) -> Cancelable<Module> { | 26 | pub(crate) fn module(&self, db: &impl HirDatabase) -> Module { |
28 | self.def_id.module(db) | 27 | self.def_id.module(db) |
29 | } | 28 | } |
30 | 29 | ||
31 | /// The containing impl block, if this is a method. | 30 | /// The containing impl block, if this is a method. |
32 | pub(crate) fn impl_block(&self, db: &impl HirDatabase) -> Cancelable<Option<ImplBlock>> { | 31 | pub(crate) fn impl_block(&self, db: &impl HirDatabase) -> Option<ImplBlock> { |
33 | self.def_id.impl_block(db) | 32 | self.def_id.impl_block(db) |
34 | } | 33 | } |
35 | } | 34 | } |
diff --git a/crates/ra_hir/src/code_model_impl/krate.rs b/crates/ra_hir/src/code_model_impl/krate.rs index 3275eafed..8c6e34873 100644 --- a/crates/ra_hir/src/code_model_impl/krate.rs +++ b/crates/ra_hir/src/code_model_impl/krate.rs | |||
@@ -1,4 +1,4 @@ | |||
1 | use ra_db::{CrateId, Cancelable}; | 1 | use ra_db::CrateId; |
2 | 2 | ||
3 | use crate::{ | 3 | use crate::{ |
4 | HirFileId, Crate, CrateDependency, AsName, DefLoc, DefKind, Module, SourceItemId, | 4 | HirFileId, Crate, CrateDependency, AsName, DefLoc, DefKind, Module, SourceItemId, |
@@ -20,18 +20,18 @@ impl Crate { | |||
20 | }) | 20 | }) |
21 | .collect() | 21 | .collect() |
22 | } | 22 | } |
23 | pub(crate) fn root_module_impl(&self, db: &impl HirDatabase) -> Cancelable<Option<Module>> { | 23 | pub(crate) fn root_module_impl(&self, db: &impl HirDatabase) -> Option<Module> { |
24 | let crate_graph = db.crate_graph(); | 24 | let crate_graph = db.crate_graph(); |
25 | let file_id = crate_graph.crate_root(self.crate_id); | 25 | let file_id = crate_graph.crate_root(self.crate_id); |
26 | let source_root_id = db.file_source_root(file_id); | 26 | let source_root_id = db.file_source_root(file_id); |
27 | let file_id = HirFileId::from(file_id); | 27 | let file_id = HirFileId::from(file_id); |
28 | let module_tree = db.module_tree(source_root_id)?; | 28 | let module_tree = db.module_tree(source_root_id); |
29 | // FIXME: teach module tree about crate roots instead of guessing | 29 | // FIXME: teach module tree about crate roots instead of guessing |
30 | let source = SourceItemId { | 30 | let source = SourceItemId { |
31 | file_id, | 31 | file_id, |
32 | item_id: None, | 32 | item_id: None, |
33 | }; | 33 | }; |
34 | let module_id = ctry!(module_tree.find_module_by_source(source)); | 34 | let module_id = module_tree.find_module_by_source(source)?; |
35 | 35 | ||
36 | let def_loc = DefLoc { | 36 | let def_loc = DefLoc { |
37 | kind: DefKind::Module, | 37 | kind: DefKind::Module, |
@@ -42,6 +42,6 @@ impl Crate { | |||
42 | let def_id = def_loc.id(db); | 42 | let def_id = def_loc.id(db); |
43 | 43 | ||
44 | let module = Module::new(def_id); | 44 | let module = Module::new(def_id); |
45 | Ok(Some(module)) | 45 | Some(module) |
46 | } | 46 | } |
47 | } | 47 | } |
diff --git a/crates/ra_hir/src/code_model_impl/module.rs b/crates/ra_hir/src/code_model_impl/module.rs index 775dd6709..a5c032d69 100644 --- a/crates/ra_hir/src/code_model_impl/module.rs +++ b/crates/ra_hir/src/code_model_impl/module.rs | |||
@@ -1,4 +1,4 @@ | |||
1 | use ra_db::{Cancelable, SourceRootId, FileId}; | 1 | use ra_db::{SourceRootId, FileId}; |
2 | use ra_syntax::{ast, SyntaxNode, AstNode, TreeArc}; | 2 | use ra_syntax::{ast, SyntaxNode, AstNode, TreeArc}; |
3 | 3 | ||
4 | use crate::{ | 4 | use crate::{ |
@@ -18,8 +18,8 @@ impl Module { | |||
18 | db: &impl HirDatabase, | 18 | db: &impl HirDatabase, |
19 | source_root_id: SourceRootId, | 19 | source_root_id: SourceRootId, |
20 | module_id: ModuleId, | 20 | module_id: ModuleId, |
21 | ) -> Cancelable<Self> { | 21 | ) -> Self { |
22 | let module_tree = db.module_tree(source_root_id)?; | 22 | let module_tree = db.module_tree(source_root_id); |
23 | let def_loc = DefLoc { | 23 | let def_loc = DefLoc { |
24 | kind: DefKind::Module, | 24 | kind: DefKind::Module, |
25 | source_root_id, | 25 | source_root_id, |
@@ -27,21 +27,17 @@ impl Module { | |||
27 | source_item_id: module_id.source(&module_tree), | 27 | source_item_id: module_id.source(&module_tree), |
28 | }; | 28 | }; |
29 | let def_id = def_loc.id(db); | 29 | let def_id = def_loc.id(db); |
30 | let module = Module::new(def_id); | 30 | Module::new(def_id) |
31 | Ok(module) | ||
32 | } | 31 | } |
33 | 32 | ||
34 | pub(crate) fn name_impl(&self, db: &impl HirDatabase) -> Cancelable<Option<Name>> { | 33 | pub(crate) fn name_impl(&self, db: &impl HirDatabase) -> Option<Name> { |
35 | let loc = self.def_id.loc(db); | 34 | let loc = self.def_id.loc(db); |
36 | let module_tree = db.module_tree(loc.source_root_id)?; | 35 | let module_tree = db.module_tree(loc.source_root_id); |
37 | let link = ctry!(loc.module_id.parent_link(&module_tree)); | 36 | let link = loc.module_id.parent_link(&module_tree)?; |
38 | Ok(Some(link.name(&module_tree).clone())) | 37 | Some(link.name(&module_tree).clone()) |
39 | } | 38 | } |
40 | 39 | ||
41 | pub fn definition_source_impl( | 40 | pub fn definition_source_impl(&self, db: &impl HirDatabase) -> (FileId, ModuleSource) { |
42 | &self, | ||
43 | db: &impl HirDatabase, | ||
44 | ) -> Cancelable<(FileId, ModuleSource)> { | ||
45 | let loc = self.def_id.loc(db); | 41 | let loc = self.def_id.loc(db); |
46 | let file_id = loc.source_item_id.file_id.as_original_file(); | 42 | let file_id = loc.source_item_id.file_id.as_original_file(); |
47 | let syntax_node = db.file_item(loc.source_item_id); | 43 | let syntax_node = db.file_item(loc.source_item_id); |
@@ -51,94 +47,89 @@ impl Module { | |||
51 | let module = ast::Module::cast(&syntax_node).unwrap(); | 47 | let module = ast::Module::cast(&syntax_node).unwrap(); |
52 | ModuleSource::Module(module.to_owned()) | 48 | ModuleSource::Module(module.to_owned()) |
53 | }; | 49 | }; |
54 | Ok((file_id, module_source)) | 50 | (file_id, module_source) |
55 | } | 51 | } |
56 | 52 | ||
57 | pub fn declaration_source_impl( | 53 | pub fn declaration_source_impl( |
58 | &self, | 54 | &self, |
59 | db: &impl HirDatabase, | 55 | db: &impl HirDatabase, |
60 | ) -> Cancelable<Option<(FileId, TreeArc<ast::Module>)>> { | 56 | ) -> Option<(FileId, TreeArc<ast::Module>)> { |
61 | let loc = self.def_id.loc(db); | 57 | let loc = self.def_id.loc(db); |
62 | let module_tree = db.module_tree(loc.source_root_id)?; | 58 | let module_tree = db.module_tree(loc.source_root_id); |
63 | let link = ctry!(loc.module_id.parent_link(&module_tree)); | 59 | let link = loc.module_id.parent_link(&module_tree)?; |
64 | let file_id = link | 60 | let file_id = link |
65 | .owner(&module_tree) | 61 | .owner(&module_tree) |
66 | .source(&module_tree) | 62 | .source(&module_tree) |
67 | .file_id | 63 | .file_id |
68 | .as_original_file(); | 64 | .as_original_file(); |
69 | let src = link.source(&module_tree, db); | 65 | let src = link.source(&module_tree, db); |
70 | Ok(Some((file_id, src))) | 66 | Some((file_id, src)) |
71 | } | 67 | } |
72 | 68 | ||
73 | pub(crate) fn krate_impl(&self, db: &impl HirDatabase) -> Cancelable<Option<Crate>> { | 69 | pub(crate) fn krate_impl(&self, db: &impl HirDatabase) -> Option<Crate> { |
74 | let root = self.crate_root(db)?; | 70 | let root = self.crate_root(db); |
75 | let loc = root.def_id.loc(db); | 71 | let loc = root.def_id.loc(db); |
76 | let file_id = loc.source_item_id.file_id.as_original_file(); | 72 | let file_id = loc.source_item_id.file_id.as_original_file(); |
77 | 73 | ||
78 | let crate_graph = db.crate_graph(); | 74 | let crate_graph = db.crate_graph(); |
79 | let crate_id = ctry!(crate_graph.crate_id_for_crate_root(file_id)); | 75 | let crate_id = crate_graph.crate_id_for_crate_root(file_id)?; |
80 | Ok(Some(Crate::new(crate_id))) | 76 | Some(Crate::new(crate_id)) |
81 | } | 77 | } |
82 | 78 | ||
83 | pub(crate) fn crate_root_impl(&self, db: &impl HirDatabase) -> Cancelable<Module> { | 79 | pub(crate) fn crate_root_impl(&self, db: &impl HirDatabase) -> Module { |
84 | let loc = self.def_id.loc(db); | 80 | let loc = self.def_id.loc(db); |
85 | let module_tree = db.module_tree(loc.source_root_id)?; | 81 | let module_tree = db.module_tree(loc.source_root_id); |
86 | let module_id = loc.module_id.crate_root(&module_tree); | 82 | let module_id = loc.module_id.crate_root(&module_tree); |
87 | Module::from_module_id(db, loc.source_root_id, module_id) | 83 | Module::from_module_id(db, loc.source_root_id, module_id) |
88 | } | 84 | } |
89 | 85 | ||
90 | /// Finds a child module with the specified name. | 86 | /// Finds a child module with the specified name. |
91 | pub fn child_impl(&self, db: &impl HirDatabase, name: &Name) -> Cancelable<Option<Module>> { | 87 | pub fn child_impl(&self, db: &impl HirDatabase, name: &Name) -> Option<Module> { |
92 | let loc = self.def_id.loc(db); | 88 | let loc = self.def_id.loc(db); |
93 | let module_tree = db.module_tree(loc.source_root_id)?; | 89 | let module_tree = db.module_tree(loc.source_root_id); |
94 | let child_id = ctry!(loc.module_id.child(&module_tree, name)); | 90 | let child_id = loc.module_id.child(&module_tree, name)?; |
95 | Module::from_module_id(db, loc.source_root_id, child_id).map(Some) | 91 | Some(Module::from_module_id(db, loc.source_root_id, child_id)) |
96 | } | 92 | } |
97 | 93 | ||
98 | /// Iterates over all child modules. | 94 | /// Iterates over all child modules. |
99 | pub fn children_impl(&self, db: &impl HirDatabase) -> Cancelable<impl Iterator<Item = Module>> { | 95 | pub fn children_impl(&self, db: &impl HirDatabase) -> impl Iterator<Item = Module> { |
100 | // FIXME this should be implementable without collecting into a vec, but | 96 | // FIXME this should be implementable without collecting into a vec, but |
101 | // it's kind of hard since the iterator needs to keep a reference to the | 97 | // it's kind of hard since the iterator needs to keep a reference to the |
102 | // module tree. | 98 | // module tree. |
103 | let loc = self.def_id.loc(db); | 99 | let loc = self.def_id.loc(db); |
104 | let module_tree = db.module_tree(loc.source_root_id)?; | 100 | let module_tree = db.module_tree(loc.source_root_id); |
105 | let children = loc | 101 | let children = loc |
106 | .module_id | 102 | .module_id |
107 | .children(&module_tree) | 103 | .children(&module_tree) |
108 | .map(|(_, module_id)| Module::from_module_id(db, loc.source_root_id, module_id)) | 104 | .map(|(_, module_id)| Module::from_module_id(db, loc.source_root_id, module_id)) |
109 | .collect::<Cancelable<Vec<_>>>()?; | 105 | .collect::<Vec<_>>(); |
110 | Ok(children.into_iter()) | 106 | children.into_iter() |
111 | } | 107 | } |
112 | 108 | ||
113 | pub fn parent_impl(&self, db: &impl HirDatabase) -> Cancelable<Option<Module>> { | 109 | pub fn parent_impl(&self, db: &impl HirDatabase) -> Option<Module> { |
114 | let loc = self.def_id.loc(db); | 110 | let loc = self.def_id.loc(db); |
115 | let module_tree = db.module_tree(loc.source_root_id)?; | 111 | let module_tree = db.module_tree(loc.source_root_id); |
116 | let parent_id = ctry!(loc.module_id.parent(&module_tree)); | 112 | let parent_id = loc.module_id.parent(&module_tree)?; |
117 | Module::from_module_id(db, loc.source_root_id, parent_id).map(Some) | 113 | Some(Module::from_module_id(db, loc.source_root_id, parent_id)) |
118 | } | 114 | } |
119 | 115 | ||
120 | /// Returns a `ModuleScope`: a set of items, visible in this module. | 116 | /// Returns a `ModuleScope`: a set of items, visible in this module. |
121 | pub fn scope_impl(&self, db: &impl HirDatabase) -> Cancelable<ModuleScope> { | 117 | pub fn scope_impl(&self, db: &impl HirDatabase) -> ModuleScope { |
122 | let loc = self.def_id.loc(db); | 118 | let loc = self.def_id.loc(db); |
123 | let item_map = db.item_map(loc.source_root_id)?; | 119 | let item_map = db.item_map(loc.source_root_id); |
124 | let res = item_map.per_module[&loc.module_id].clone(); | 120 | item_map.per_module[&loc.module_id].clone() |
125 | Ok(res) | ||
126 | } | 121 | } |
127 | 122 | ||
128 | pub fn resolve_path_impl( | 123 | pub fn resolve_path_impl(&self, db: &impl HirDatabase, path: &Path) -> PerNs<DefId> { |
129 | &self, | ||
130 | db: &impl HirDatabase, | ||
131 | path: &Path, | ||
132 | ) -> Cancelable<PerNs<DefId>> { | ||
133 | let mut curr_per_ns = PerNs::types( | 124 | let mut curr_per_ns = PerNs::types( |
134 | match path.kind { | 125 | match path.kind { |
135 | PathKind::Crate => self.crate_root(db)?, | 126 | PathKind::Crate => self.crate_root(db), |
136 | PathKind::Self_ | PathKind::Plain => self.clone(), | 127 | PathKind::Self_ | PathKind::Plain => self.clone(), |
137 | PathKind::Super => { | 128 | PathKind::Super => { |
138 | if let Some(p) = self.parent(db)? { | 129 | if let Some(p) = self.parent(db) { |
139 | p | 130 | p |
140 | } else { | 131 | } else { |
141 | return Ok(PerNs::none()); | 132 | return PerNs::none(); |
142 | } | 133 | } |
143 | } | 134 | } |
144 | } | 135 | } |
@@ -150,47 +141,44 @@ impl Module { | |||
150 | let curr = if let Some(r) = curr_per_ns.as_ref().take_types() { | 141 | let curr = if let Some(r) = curr_per_ns.as_ref().take_types() { |
151 | r | 142 | r |
152 | } else { | 143 | } else { |
153 | return Ok(PerNs::none()); | 144 | return PerNs::none(); |
154 | }; | 145 | }; |
155 | let module = match curr.resolve(db)? { | 146 | let module = match curr.resolve(db) { |
156 | Def::Module(it) => it, | 147 | Def::Module(it) => it, |
157 | Def::Enum(e) => { | 148 | Def::Enum(e) => { |
158 | if segments.len() == idx + 1 { | 149 | if segments.len() == idx + 1 { |
159 | // enum variant | 150 | // enum variant |
160 | let matching_variant = | 151 | let matching_variant = |
161 | e.variants(db)?.into_iter().find(|(n, _variant)| n == name); | 152 | e.variants(db).into_iter().find(|(n, _variant)| n == name); |
162 | 153 | ||
163 | if let Some((_n, variant)) = matching_variant { | 154 | if let Some((_n, variant)) = matching_variant { |
164 | return Ok(PerNs::both(variant.def_id(), e.def_id())); | 155 | return PerNs::both(variant.def_id(), e.def_id()); |
165 | } else { | 156 | } else { |
166 | return Ok(PerNs::none()); | 157 | return PerNs::none(); |
167 | } | 158 | } |
168 | } else if segments.len() == idx { | 159 | } else if segments.len() == idx { |
169 | // enum | 160 | // enum |
170 | return Ok(PerNs::types(e.def_id())); | 161 | return PerNs::types(e.def_id()); |
171 | } else { | 162 | } else { |
172 | // malformed enum? | 163 | // malformed enum? |
173 | return Ok(PerNs::none()); | 164 | return PerNs::none(); |
174 | } | 165 | } |
175 | } | 166 | } |
176 | _ => return Ok(PerNs::none()), | 167 | _ => return PerNs::none(), |
177 | }; | 168 | }; |
178 | let scope = module.scope(db)?; | 169 | let scope = module.scope(db); |
179 | curr_per_ns = if let Some(r) = scope.get(&name) { | 170 | curr_per_ns = if let Some(r) = scope.get(&name) { |
180 | r.def_id | 171 | r.def_id |
181 | } else { | 172 | } else { |
182 | return Ok(PerNs::none()); | 173 | return PerNs::none(); |
183 | }; | 174 | }; |
184 | } | 175 | } |
185 | Ok(curr_per_ns) | 176 | curr_per_ns |
186 | } | 177 | } |
187 | 178 | ||
188 | pub fn problems_impl( | 179 | pub fn problems_impl(&self, db: &impl HirDatabase) -> Vec<(TreeArc<SyntaxNode>, Problem)> { |
189 | &self, | ||
190 | db: &impl HirDatabase, | ||
191 | ) -> Cancelable<Vec<(TreeArc<SyntaxNode>, Problem)>> { | ||
192 | let loc = self.def_id.loc(db); | 180 | let loc = self.def_id.loc(db); |
193 | let module_tree = db.module_tree(loc.source_root_id)?; | 181 | let module_tree = db.module_tree(loc.source_root_id); |
194 | Ok(loc.module_id.problems(&module_tree, db)) | 182 | loc.module_id.problems(&module_tree, db) |
195 | } | 183 | } |
196 | } | 184 | } |
diff --git a/crates/ra_hir/src/db.rs b/crates/ra_hir/src/db.rs index fd6336dd8..0a0994f5f 100644 --- a/crates/ra_hir/src/db.rs +++ b/crates/ra_hir/src/db.rs | |||
@@ -1,7 +1,7 @@ | |||
1 | use std::sync::Arc; | 1 | use std::sync::Arc; |
2 | 2 | ||
3 | use ra_syntax::{SyntaxNode, TreeArc, SourceFile}; | 3 | use ra_syntax::{SyntaxNode, TreeArc, SourceFile}; |
4 | use ra_db::{SourceRootId, LocationIntener, SyntaxDatabase, Cancelable}; | 4 | use ra_db::{SourceRootId, LocationIntener, SyntaxDatabase}; |
5 | 5 | ||
6 | use crate::{ | 6 | use crate::{ |
7 | DefLoc, DefId, MacroCallLoc, MacroCallId, Name, HirFileId, | 7 | DefLoc, DefId, MacroCallLoc, MacroCallId, Name, HirFileId, |
@@ -32,37 +32,37 @@ pub trait HirDatabase: SyntaxDatabase | |||
32 | use fn crate::macros::expand_macro_invocation; | 32 | use fn crate::macros::expand_macro_invocation; |
33 | } | 33 | } |
34 | 34 | ||
35 | fn fn_scopes(def_id: DefId) -> Cancelable<Arc<FnScopes>> { | 35 | fn fn_scopes(def_id: DefId) -> Arc<FnScopes> { |
36 | type FnScopesQuery; | 36 | type FnScopesQuery; |
37 | use fn query_definitions::fn_scopes; | 37 | use fn query_definitions::fn_scopes; |
38 | } | 38 | } |
39 | 39 | ||
40 | fn struct_data(def_id: DefId) -> Cancelable<Arc<StructData>> { | 40 | fn struct_data(def_id: DefId) -> Arc<StructData> { |
41 | type StructDataQuery; | 41 | type StructDataQuery; |
42 | use fn crate::adt::StructData::struct_data_query; | 42 | use fn crate::adt::StructData::struct_data_query; |
43 | } | 43 | } |
44 | 44 | ||
45 | fn enum_data(def_id: DefId) -> Cancelable<Arc<EnumData>> { | 45 | fn enum_data(def_id: DefId) -> Arc<EnumData> { |
46 | type EnumDataQuery; | 46 | type EnumDataQuery; |
47 | use fn crate::adt::EnumData::enum_data_query; | 47 | use fn crate::adt::EnumData::enum_data_query; |
48 | } | 48 | } |
49 | 49 | ||
50 | fn enum_variant_data(def_id: DefId) -> Cancelable<Arc<EnumVariantData>> { | 50 | fn enum_variant_data(def_id: DefId) -> Arc<EnumVariantData> { |
51 | type EnumVariantDataQuery; | 51 | type EnumVariantDataQuery; |
52 | use fn crate::adt::EnumVariantData::enum_variant_data_query; | 52 | use fn crate::adt::EnumVariantData::enum_variant_data_query; |
53 | } | 53 | } |
54 | 54 | ||
55 | fn infer(def_id: DefId) -> Cancelable<Arc<InferenceResult>> { | 55 | fn infer(def_id: DefId) -> Arc<InferenceResult> { |
56 | type InferQuery; | 56 | type InferQuery; |
57 | use fn crate::ty::infer; | 57 | use fn crate::ty::infer; |
58 | } | 58 | } |
59 | 59 | ||
60 | fn type_for_def(def_id: DefId) -> Cancelable<Ty> { | 60 | fn type_for_def(def_id: DefId) -> Ty { |
61 | type TypeForDefQuery; | 61 | type TypeForDefQuery; |
62 | use fn crate::ty::type_for_def; | 62 | use fn crate::ty::type_for_def; |
63 | } | 63 | } |
64 | 64 | ||
65 | fn type_for_field(def_id: DefId, field: Name) -> Cancelable<Option<Ty>> { | 65 | fn type_for_field(def_id: DefId, field: Name) -> Option<Ty> { |
66 | type TypeForFieldQuery; | 66 | type TypeForFieldQuery; |
67 | use fn crate::ty::type_for_field; | 67 | use fn crate::ty::type_for_field; |
68 | } | 68 | } |
@@ -77,42 +77,42 @@ pub trait HirDatabase: SyntaxDatabase | |||
77 | use fn query_definitions::file_item; | 77 | use fn query_definitions::file_item; |
78 | } | 78 | } |
79 | 79 | ||
80 | fn submodules(source: SourceItemId) -> Cancelable<Arc<Vec<crate::module_tree::Submodule>>> { | 80 | fn submodules(source: SourceItemId) -> Arc<Vec<crate::module_tree::Submodule>> { |
81 | type SubmodulesQuery; | 81 | type SubmodulesQuery; |
82 | use fn crate::module_tree::Submodule::submodules_query; | 82 | use fn crate::module_tree::Submodule::submodules_query; |
83 | } | 83 | } |
84 | 84 | ||
85 | fn input_module_items(source_root_id: SourceRootId, module_id: ModuleId) -> Cancelable<Arc<InputModuleItems>> { | 85 | fn input_module_items(source_root_id: SourceRootId, module_id: ModuleId) -> Arc<InputModuleItems> { |
86 | type InputModuleItemsQuery; | 86 | type InputModuleItemsQuery; |
87 | use fn query_definitions::input_module_items; | 87 | use fn query_definitions::input_module_items; |
88 | } | 88 | } |
89 | 89 | ||
90 | fn item_map(source_root_id: SourceRootId) -> Cancelable<Arc<ItemMap>> { | 90 | fn item_map(source_root_id: SourceRootId) -> Arc<ItemMap> { |
91 | type ItemMapQuery; | 91 | type ItemMapQuery; |
92 | use fn query_definitions::item_map; | 92 | use fn query_definitions::item_map; |
93 | } | 93 | } |
94 | 94 | ||
95 | fn module_tree(source_root_id: SourceRootId) -> Cancelable<Arc<ModuleTree>> { | 95 | fn module_tree(source_root_id: SourceRootId) -> Arc<ModuleTree> { |
96 | type ModuleTreeQuery; | 96 | type ModuleTreeQuery; |
97 | use fn crate::module_tree::ModuleTree::module_tree_query; | 97 | use fn crate::module_tree::ModuleTree::module_tree_query; |
98 | } | 98 | } |
99 | 99 | ||
100 | fn impls_in_module(source_root_id: SourceRootId, module_id: ModuleId) -> Cancelable<Arc<ModuleImplBlocks>> { | 100 | fn impls_in_module(source_root_id: SourceRootId, module_id: ModuleId) -> Arc<ModuleImplBlocks> { |
101 | type ImplsInModuleQuery; | 101 | type ImplsInModuleQuery; |
102 | use fn crate::impl_block::impls_in_module; | 102 | use fn crate::impl_block::impls_in_module; |
103 | } | 103 | } |
104 | 104 | ||
105 | fn impls_in_crate(krate: Crate) -> Cancelable<Arc<CrateImplBlocks>> { | 105 | fn impls_in_crate(krate: Crate) -> Arc<CrateImplBlocks> { |
106 | type ImplsInCrateQuery; | 106 | type ImplsInCrateQuery; |
107 | use fn crate::ty::method_resolution::CrateImplBlocks::impls_in_crate_query; | 107 | use fn crate::ty::method_resolution::CrateImplBlocks::impls_in_crate_query; |
108 | } | 108 | } |
109 | 109 | ||
110 | fn body_hir(def_id: DefId) -> Cancelable<Arc<crate::expr::Body>> { | 110 | fn body_hir(def_id: DefId) -> Arc<crate::expr::Body> { |
111 | type BodyHirQuery; | 111 | type BodyHirQuery; |
112 | use fn crate::expr::body_hir; | 112 | use fn crate::expr::body_hir; |
113 | } | 113 | } |
114 | 114 | ||
115 | fn body_syntax_mapping(def_id: DefId) -> Cancelable<Arc<crate::expr::BodySyntaxMapping>> { | 115 | fn body_syntax_mapping(def_id: DefId) -> Arc<crate::expr::BodySyntaxMapping> { |
116 | type BodySyntaxMappingQuery; | 116 | type BodySyntaxMappingQuery; |
117 | use fn crate::expr::body_syntax_mapping; | 117 | use fn crate::expr::body_syntax_mapping; |
118 | } | 118 | } |
diff --git a/crates/ra_hir/src/expr.rs b/crates/ra_hir/src/expr.rs index f0936e9f3..663338844 100644 --- a/crates/ra_hir/src/expr.rs +++ b/crates/ra_hir/src/expr.rs | |||
@@ -4,10 +4,11 @@ use std::sync::Arc; | |||
4 | use rustc_hash::FxHashMap; | 4 | use rustc_hash::FxHashMap; |
5 | 5 | ||
6 | use ra_arena::{Arena, RawId, impl_arena_id, map::ArenaMap}; | 6 | use ra_arena::{Arena, RawId, impl_arena_id, map::ArenaMap}; |
7 | use ra_db::{LocalSyntaxPtr, Cancelable}; | 7 | use ra_db::LocalSyntaxPtr; |
8 | use ra_syntax::ast::{self, AstNode, LoopBodyOwner, ArgListOwner, NameOwner}; | 8 | use ra_syntax::ast::{self, AstNode, LoopBodyOwner, ArgListOwner, NameOwner, LiteralFlavor}; |
9 | 9 | ||
10 | use crate::{Path, type_ref::{Mutability, TypeRef}, Name, HirDatabase, DefId, Def, name::AsName}; | 10 | use crate::{Path, type_ref::{Mutability, TypeRef}, Name, HirDatabase, DefId, Def, name::AsName}; |
11 | use crate::ty::primitive::{UintTy, UncertainIntTy, UncertainFloatTy}; | ||
11 | 12 | ||
12 | #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] | 13 | #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] |
13 | pub struct ExprId(RawId); | 14 | pub struct ExprId(RawId); |
@@ -104,6 +105,16 @@ impl BodySyntaxMapping { | |||
104 | } | 105 | } |
105 | 106 | ||
106 | #[derive(Debug, Clone, Eq, PartialEq)] | 107 | #[derive(Debug, Clone, Eq, PartialEq)] |
108 | pub enum Literal { | ||
109 | String(String), | ||
110 | ByteString(Vec<u8>), | ||
111 | Char(char), | ||
112 | Bool(bool), | ||
113 | Int(u64, UncertainIntTy), | ||
114 | Float(u64, UncertainFloatTy), // FIXME: f64 is not Eq | ||
115 | } | ||
116 | |||
117 | #[derive(Debug, Clone, Eq, PartialEq)] | ||
107 | pub enum Expr { | 118 | pub enum Expr { |
108 | /// This is produced if syntax tree does not have a required expression piece. | 119 | /// This is produced if syntax tree does not have a required expression piece. |
109 | Missing, | 120 | Missing, |
@@ -171,7 +182,7 @@ pub enum Expr { | |||
171 | }, | 182 | }, |
172 | UnaryOp { | 183 | UnaryOp { |
173 | expr: ExprId, | 184 | expr: ExprId, |
174 | op: Option<UnaryOp>, | 185 | op: UnaryOp, |
175 | }, | 186 | }, |
176 | BinaryOp { | 187 | BinaryOp { |
177 | lhs: ExprId, | 188 | lhs: ExprId, |
@@ -186,6 +197,7 @@ pub enum Expr { | |||
186 | Tuple { | 197 | Tuple { |
187 | exprs: Vec<ExprId>, | 198 | exprs: Vec<ExprId>, |
188 | }, | 199 | }, |
200 | Literal(Literal), | ||
189 | } | 201 | } |
190 | 202 | ||
191 | pub use ra_syntax::ast::PrefixOp as UnaryOp; | 203 | pub use ra_syntax::ast::PrefixOp as UnaryOp; |
@@ -305,6 +317,7 @@ impl Expr { | |||
305 | f(*expr); | 317 | f(*expr); |
306 | } | 318 | } |
307 | } | 319 | } |
320 | Expr::Literal(_) => {} | ||
308 | } | 321 | } |
309 | } | 322 | } |
310 | } | 323 | } |
@@ -343,8 +356,8 @@ impl Pat { | |||
343 | 356 | ||
344 | // Queries | 357 | // Queries |
345 | 358 | ||
346 | pub(crate) fn body_hir(db: &impl HirDatabase, def_id: DefId) -> Cancelable<Arc<Body>> { | 359 | pub(crate) fn body_hir(db: &impl HirDatabase, def_id: DefId) -> Arc<Body> { |
347 | Ok(Arc::clone(&body_syntax_mapping(db, def_id)?.body)) | 360 | Arc::clone(&body_syntax_mapping(db, def_id).body) |
348 | } | 361 | } |
349 | 362 | ||
350 | struct ExprCollector { | 363 | struct ExprCollector { |
@@ -599,8 +612,11 @@ impl ExprCollector { | |||
599 | } | 612 | } |
600 | ast::ExprKind::PrefixExpr(e) => { | 613 | ast::ExprKind::PrefixExpr(e) => { |
601 | let expr = self.collect_expr_opt(e.expr()); | 614 | let expr = self.collect_expr_opt(e.expr()); |
602 | let op = e.op(); | 615 | if let Some(op) = e.op() { |
603 | self.alloc_expr(Expr::UnaryOp { expr, op }, syntax_ptr) | 616 | self.alloc_expr(Expr::UnaryOp { expr, op }, syntax_ptr) |
617 | } else { | ||
618 | self.alloc_expr(Expr::Missing, syntax_ptr) | ||
619 | } | ||
604 | } | 620 | } |
605 | ast::ExprKind::LambdaExpr(e) => { | 621 | ast::ExprKind::LambdaExpr(e) => { |
606 | let mut args = Vec::new(); | 622 | let mut args = Vec::new(); |
@@ -633,13 +649,50 @@ impl ExprCollector { | |||
633 | let exprs = e.exprs().map(|expr| self.collect_expr(expr)).collect(); | 649 | let exprs = e.exprs().map(|expr| self.collect_expr(expr)).collect(); |
634 | self.alloc_expr(Expr::Tuple { exprs }, syntax_ptr) | 650 | self.alloc_expr(Expr::Tuple { exprs }, syntax_ptr) |
635 | } | 651 | } |
652 | ast::ExprKind::Literal(e) => { | ||
653 | let child = if let Some(child) = e.literal_expr() { | ||
654 | child | ||
655 | } else { | ||
656 | return self.alloc_expr(Expr::Missing, syntax_ptr); | ||
657 | }; | ||
658 | |||
659 | let lit = match child.flavor() { | ||
660 | LiteralFlavor::IntNumber { suffix } => { | ||
661 | let known_name = suffix | ||
662 | .map(|s| Name::new(s)) | ||
663 | .and_then(|name| UncertainIntTy::from_name(&name)); | ||
664 | |||
665 | Literal::Int( | ||
666 | Default::default(), | ||
667 | known_name.unwrap_or(UncertainIntTy::Unknown), | ||
668 | ) | ||
669 | } | ||
670 | LiteralFlavor::FloatNumber { suffix } => { | ||
671 | let known_name = suffix | ||
672 | .map(|s| Name::new(s)) | ||
673 | .and_then(|name| UncertainFloatTy::from_name(&name)); | ||
674 | |||
675 | Literal::Float( | ||
676 | Default::default(), | ||
677 | known_name.unwrap_or(UncertainFloatTy::Unknown), | ||
678 | ) | ||
679 | } | ||
680 | LiteralFlavor::ByteString => Literal::ByteString(Default::default()), | ||
681 | LiteralFlavor::String => Literal::String(Default::default()), | ||
682 | LiteralFlavor::Byte => { | ||
683 | Literal::Int(Default::default(), UncertainIntTy::Unsigned(UintTy::U8)) | ||
684 | } | ||
685 | LiteralFlavor::Bool => Literal::Bool(Default::default()), | ||
686 | LiteralFlavor::Char => Literal::Char(Default::default()), | ||
687 | }; | ||
688 | self.alloc_expr(Expr::Literal(lit), syntax_ptr) | ||
689 | } | ||
636 | 690 | ||
637 | // TODO implement HIR for these: | 691 | // TODO implement HIR for these: |
638 | ast::ExprKind::Label(_e) => self.alloc_expr(Expr::Missing, syntax_ptr), | 692 | ast::ExprKind::Label(_e) => self.alloc_expr(Expr::Missing, syntax_ptr), |
639 | ast::ExprKind::IndexExpr(_e) => self.alloc_expr(Expr::Missing, syntax_ptr), | 693 | ast::ExprKind::IndexExpr(_e) => self.alloc_expr(Expr::Missing, syntax_ptr), |
640 | ast::ExprKind::ArrayExpr(_e) => self.alloc_expr(Expr::Missing, syntax_ptr), | 694 | ast::ExprKind::ArrayExpr(_e) => self.alloc_expr(Expr::Missing, syntax_ptr), |
641 | ast::ExprKind::RangeExpr(_e) => self.alloc_expr(Expr::Missing, syntax_ptr), | 695 | ast::ExprKind::RangeExpr(_e) => self.alloc_expr(Expr::Missing, syntax_ptr), |
642 | ast::ExprKind::Literal(_e) => self.alloc_expr(Expr::Missing, syntax_ptr), | ||
643 | } | 696 | } |
644 | } | 697 | } |
645 | 698 | ||
@@ -776,17 +829,14 @@ pub(crate) fn collect_fn_body_syntax(node: &ast::FnDef) -> BodySyntaxMapping { | |||
776 | collector.into_body_syntax_mapping(params, body) | 829 | collector.into_body_syntax_mapping(params, body) |
777 | } | 830 | } |
778 | 831 | ||
779 | pub(crate) fn body_syntax_mapping( | 832 | pub(crate) fn body_syntax_mapping(db: &impl HirDatabase, def_id: DefId) -> Arc<BodySyntaxMapping> { |
780 | db: &impl HirDatabase, | 833 | let def = def_id.resolve(db); |
781 | def_id: DefId, | ||
782 | ) -> Cancelable<Arc<BodySyntaxMapping>> { | ||
783 | let def = def_id.resolve(db)?; | ||
784 | 834 | ||
785 | let body_syntax_mapping = match def { | 835 | let body_syntax_mapping = match def { |
786 | Def::Function(f) => collect_fn_body_syntax(&f.source(db)?.1), | 836 | Def::Function(f) => collect_fn_body_syntax(&f.source(db).1), |
787 | // TODO: consts, etc. | 837 | // TODO: consts, etc. |
788 | _ => panic!("Trying to get body for item type without body"), | 838 | _ => panic!("Trying to get body for item type without body"), |
789 | }; | 839 | }; |
790 | 840 | ||
791 | Ok(Arc::new(body_syntax_mapping)) | 841 | Arc::new(body_syntax_mapping) |
792 | } | 842 | } |
diff --git a/crates/ra_hir/src/ids.rs b/crates/ra_hir/src/ids.rs index 316896dce..0d8e67547 100644 --- a/crates/ra_hir/src/ids.rs +++ b/crates/ra_hir/src/ids.rs | |||
@@ -1,4 +1,4 @@ | |||
1 | use ra_db::{SourceRootId, LocationIntener, Cancelable, FileId}; | 1 | use ra_db::{SourceRootId, LocationIntener, FileId}; |
2 | use ra_syntax::{TreeArc, SyntaxKind, SyntaxNode, SourceFile, AstNode, ast}; | 2 | use ra_syntax::{TreeArc, SyntaxKind, SyntaxNode, SourceFile, AstNode, ast}; |
3 | use ra_arena::{Arena, RawId, impl_arena_id}; | 3 | use ra_arena::{Arena, RawId, impl_arena_id}; |
4 | 4 | ||
@@ -159,11 +159,11 @@ impl DefId { | |||
159 | db.as_ref().id2loc(self) | 159 | db.as_ref().id2loc(self) |
160 | } | 160 | } |
161 | 161 | ||
162 | pub fn resolve(self, db: &impl HirDatabase) -> Cancelable<Def> { | 162 | pub fn resolve(self, db: &impl HirDatabase) -> Def { |
163 | let loc = self.loc(db); | 163 | let loc = self.loc(db); |
164 | let res = match loc.kind { | 164 | match loc.kind { |
165 | DefKind::Module => { | 165 | DefKind::Module => { |
166 | let module = Module::from_module_id(db, loc.source_root_id, loc.module_id)?; | 166 | let module = Module::from_module_id(db, loc.source_root_id, loc.module_id); |
167 | Def::Module(module) | 167 | Def::Module(module) |
168 | } | 168 | } |
169 | DefKind::Function => { | 169 | DefKind::Function => { |
@@ -195,8 +195,7 @@ impl DefId { | |||
195 | 195 | ||
196 | DefKind::StructCtor => Def::Item, | 196 | DefKind::StructCtor => Def::Item, |
197 | DefKind::Item => Def::Item, | 197 | DefKind::Item => Def::Item, |
198 | }; | 198 | } |
199 | Ok(res) | ||
200 | } | 199 | } |
201 | 200 | ||
202 | pub(crate) fn source(self, db: &impl HirDatabase) -> (HirFileId, TreeArc<SyntaxNode>) { | 201 | pub(crate) fn source(self, db: &impl HirDatabase) -> (HirFileId, TreeArc<SyntaxNode>) { |
@@ -206,21 +205,21 @@ impl DefId { | |||
206 | } | 205 | } |
207 | 206 | ||
208 | /// For a module, returns that module; for any other def, returns the containing module. | 207 | /// For a module, returns that module; for any other def, returns the containing module. |
209 | pub fn module(self, db: &impl HirDatabase) -> Cancelable<Module> { | 208 | pub fn module(self, db: &impl HirDatabase) -> Module { |
210 | let loc = self.loc(db); | 209 | let loc = self.loc(db); |
211 | Module::from_module_id(db, loc.source_root_id, loc.module_id) | 210 | Module::from_module_id(db, loc.source_root_id, loc.module_id) |
212 | } | 211 | } |
213 | 212 | ||
214 | /// Returns the containing crate. | 213 | /// Returns the containing crate. |
215 | pub fn krate(&self, db: &impl HirDatabase) -> Cancelable<Option<Crate>> { | 214 | pub fn krate(&self, db: &impl HirDatabase) -> Option<Crate> { |
216 | Ok(self.module(db)?.krate(db)?) | 215 | self.module(db).krate(db) |
217 | } | 216 | } |
218 | 217 | ||
219 | /// Returns the containing impl block, if this is an impl item. | 218 | /// Returns the containing impl block, if this is an impl item. |
220 | pub fn impl_block(self, db: &impl HirDatabase) -> Cancelable<Option<ImplBlock>> { | 219 | pub fn impl_block(self, db: &impl HirDatabase) -> Option<ImplBlock> { |
221 | let loc = self.loc(db); | 220 | let loc = self.loc(db); |
222 | let module_impls = db.impls_in_module(loc.source_root_id, loc.module_id)?; | 221 | let module_impls = db.impls_in_module(loc.source_root_id, loc.module_id); |
223 | Ok(ImplBlock::containing(module_impls, self)) | 222 | ImplBlock::containing(module_impls, self) |
224 | } | 223 | } |
225 | } | 224 | } |
226 | 225 | ||
diff --git a/crates/ra_hir/src/impl_block.rs b/crates/ra_hir/src/impl_block.rs index d0b086308..ab996a12c 100644 --- a/crates/ra_hir/src/impl_block.rs +++ b/crates/ra_hir/src/impl_block.rs | |||
@@ -3,7 +3,7 @@ use rustc_hash::FxHashMap; | |||
3 | 3 | ||
4 | use ra_arena::{Arena, RawId, impl_arena_id}; | 4 | use ra_arena::{Arena, RawId, impl_arena_id}; |
5 | use ra_syntax::ast::{self, AstNode}; | 5 | use ra_syntax::ast::{self, AstNode}; |
6 | use ra_db::{LocationIntener, Cancelable, SourceRootId}; | 6 | use ra_db::{LocationIntener, SourceRootId}; |
7 | 7 | ||
8 | use crate::{ | 8 | use crate::{ |
9 | DefId, DefLoc, DefKind, SourceItemId, SourceFileItems, | 9 | DefId, DefLoc, DefKind, SourceItemId, SourceFileItems, |
@@ -166,8 +166,8 @@ impl ModuleImplBlocks { | |||
166 | } | 166 | } |
167 | } | 167 | } |
168 | 168 | ||
169 | fn collect(&mut self, db: &impl HirDatabase, module: Module) -> Cancelable<()> { | 169 | fn collect(&mut self, db: &impl HirDatabase, module: Module) { |
170 | let (file_id, module_source) = module.definition_source(db)?; | 170 | let (file_id, module_source) = module.definition_source(db); |
171 | let node = match &module_source { | 171 | let node = match &module_source { |
172 | ModuleSource::SourceFile(node) => node.syntax(), | 172 | ModuleSource::SourceFile(node) => node.syntax(), |
173 | ModuleSource::Module(node) => node | 173 | ModuleSource::Module(node) => node |
@@ -185,8 +185,6 @@ impl ModuleImplBlocks { | |||
185 | self.impls_by_def.insert(impl_item.def_id(), id); | 185 | self.impls_by_def.insert(impl_item.def_id(), id); |
186 | } | 186 | } |
187 | } | 187 | } |
188 | |||
189 | Ok(()) | ||
190 | } | 188 | } |
191 | } | 189 | } |
192 | 190 | ||
@@ -194,9 +192,9 @@ pub(crate) fn impls_in_module( | |||
194 | db: &impl HirDatabase, | 192 | db: &impl HirDatabase, |
195 | source_root_id: SourceRootId, | 193 | source_root_id: SourceRootId, |
196 | module_id: ModuleId, | 194 | module_id: ModuleId, |
197 | ) -> Cancelable<Arc<ModuleImplBlocks>> { | 195 | ) -> Arc<ModuleImplBlocks> { |
198 | let mut result = ModuleImplBlocks::new(); | 196 | let mut result = ModuleImplBlocks::new(); |
199 | let module = Module::from_module_id(db, source_root_id, module_id)?; | 197 | let module = Module::from_module_id(db, source_root_id, module_id); |
200 | result.collect(db, module)?; | 198 | result.collect(db, module); |
201 | Ok(Arc::new(result)) | 199 | Arc::new(result) |
202 | } | 200 | } |
diff --git a/crates/ra_hir/src/lib.rs b/crates/ra_hir/src/lib.rs index 45dda4f7f..ef7d049ee 100644 --- a/crates/ra_hir/src/lib.rs +++ b/crates/ra_hir/src/lib.rs | |||
@@ -5,15 +5,6 @@ | |||
5 | //! to a particular crate instance. That is, it has cfg flags and features | 5 | //! to a particular crate instance. That is, it has cfg flags and features |
6 | //! applied. So, the relation between syntax and HIR is many-to-one. | 6 | //! applied. So, the relation between syntax and HIR is many-to-one. |
7 | 7 | ||
8 | macro_rules! ctry { | ||
9 | ($expr:expr) => { | ||
10 | match $expr { | ||
11 | None => return Ok(None), | ||
12 | Some(it) => it, | ||
13 | } | ||
14 | }; | ||
15 | } | ||
16 | |||
17 | pub mod db; | 8 | pub mod db; |
18 | #[cfg(test)] | 9 | #[cfg(test)] |
19 | mod mock; | 10 | mod mock; |
diff --git a/crates/ra_hir/src/module_tree.rs b/crates/ra_hir/src/module_tree.rs index 67823e970..0256d7996 100644 --- a/crates/ra_hir/src/module_tree.rs +++ b/crates/ra_hir/src/module_tree.rs | |||
@@ -3,7 +3,7 @@ use std::sync::Arc; | |||
3 | use rustc_hash::{FxHashMap, FxHashSet}; | 3 | use rustc_hash::{FxHashMap, FxHashSet}; |
4 | use arrayvec::ArrayVec; | 4 | use arrayvec::ArrayVec; |
5 | use relative_path::RelativePathBuf; | 5 | use relative_path::RelativePathBuf; |
6 | use ra_db::{FileId, SourceRootId, Cancelable, SourceRoot}; | 6 | use ra_db::{FileId, SourceRootId, SourceRoot}; |
7 | use ra_syntax::{ | 7 | use ra_syntax::{ |
8 | SyntaxNode, TreeArc, | 8 | SyntaxNode, TreeArc, |
9 | algo::generate, | 9 | algo::generate, |
@@ -41,8 +41,8 @@ impl Submodule { | |||
41 | pub(crate) fn submodules_query( | 41 | pub(crate) fn submodules_query( |
42 | db: &impl HirDatabase, | 42 | db: &impl HirDatabase, |
43 | source: SourceItemId, | 43 | source: SourceItemId, |
44 | ) -> Cancelable<Arc<Vec<Submodule>>> { | 44 | ) -> Arc<Vec<Submodule>> { |
45 | db.check_canceled()?; | 45 | db.check_canceled(); |
46 | let file_id = source.file_id; | 46 | let file_id = source.file_id; |
47 | let file_items = db.file_items(file_id); | 47 | let file_items = db.file_items(file_id); |
48 | let module_source = ModuleSource::from_source_item_id(db, source); | 48 | let module_source = ModuleSource::from_source_item_id(db, source); |
@@ -54,7 +54,7 @@ impl Submodule { | |||
54 | collect_submodules(file_id, &file_items, module.item_list().unwrap()) | 54 | collect_submodules(file_id, &file_items, module.item_list().unwrap()) |
55 | } | 55 | } |
56 | }; | 56 | }; |
57 | return Ok(Arc::new(submodules)); | 57 | return Arc::new(submodules); |
58 | 58 | ||
59 | fn collect_submodules( | 59 | fn collect_submodules( |
60 | file_id: HirFileId, | 60 | file_id: HirFileId, |
@@ -116,10 +116,10 @@ impl ModuleTree { | |||
116 | pub(crate) fn module_tree_query( | 116 | pub(crate) fn module_tree_query( |
117 | db: &impl HirDatabase, | 117 | db: &impl HirDatabase, |
118 | source_root: SourceRootId, | 118 | source_root: SourceRootId, |
119 | ) -> Cancelable<Arc<ModuleTree>> { | 119 | ) -> Arc<ModuleTree> { |
120 | db.check_canceled()?; | 120 | db.check_canceled(); |
121 | let res = create_module_tree(db, source_root); | 121 | let res = create_module_tree(db, source_root); |
122 | Ok(Arc::new(res?)) | 122 | Arc::new(res) |
123 | } | 123 | } |
124 | 124 | ||
125 | pub(crate) fn modules<'a>(&'a self) -> impl Iterator<Item = ModuleId> + 'a { | 125 | pub(crate) fn modules<'a>(&'a self) -> impl Iterator<Item = ModuleId> + 'a { |
@@ -225,10 +225,7 @@ fn modules(root: &impl ast::ModuleItemOwner) -> impl Iterator<Item = (Name, &ast | |||
225 | }) | 225 | }) |
226 | } | 226 | } |
227 | 227 | ||
228 | fn create_module_tree<'a>( | 228 | fn create_module_tree<'a>(db: &impl HirDatabase, source_root: SourceRootId) -> ModuleTree { |
229 | db: &impl HirDatabase, | ||
230 | source_root: SourceRootId, | ||
231 | ) -> Cancelable<ModuleTree> { | ||
232 | let mut tree = ModuleTree::default(); | 229 | let mut tree = ModuleTree::default(); |
233 | 230 | ||
234 | let mut roots = FxHashMap::default(); | 231 | let mut roots = FxHashMap::default(); |
@@ -252,10 +249,10 @@ fn create_module_tree<'a>( | |||
252 | &mut roots, | 249 | &mut roots, |
253 | None, | 250 | None, |
254 | source, | 251 | source, |
255 | )?; | 252 | ); |
256 | roots.insert(file_id, module_id); | 253 | roots.insert(file_id, module_id); |
257 | } | 254 | } |
258 | Ok(tree) | 255 | tree |
259 | } | 256 | } |
260 | 257 | ||
261 | fn build_subtree( | 258 | fn build_subtree( |
@@ -266,14 +263,14 @@ fn build_subtree( | |||
266 | roots: &mut FxHashMap<FileId, ModuleId>, | 263 | roots: &mut FxHashMap<FileId, ModuleId>, |
267 | parent: Option<LinkId>, | 264 | parent: Option<LinkId>, |
268 | source: SourceItemId, | 265 | source: SourceItemId, |
269 | ) -> Cancelable<ModuleId> { | 266 | ) -> ModuleId { |
270 | visited.insert(source); | 267 | visited.insert(source); |
271 | let id = tree.push_mod(ModuleData { | 268 | let id = tree.push_mod(ModuleData { |
272 | source, | 269 | source, |
273 | parent, | 270 | parent, |
274 | children: Vec::new(), | 271 | children: Vec::new(), |
275 | }); | 272 | }); |
276 | for sub in db.submodules(source)?.iter() { | 273 | for sub in db.submodules(source).iter() { |
277 | let link = tree.push_link(LinkData { | 274 | let link = tree.push_link(LinkData { |
278 | source: sub.source, | 275 | source: sub.source, |
279 | name: sub.name.clone(), | 276 | name: sub.name.clone(), |
@@ -289,7 +286,7 @@ fn build_subtree( | |||
289 | .map(|file_id| match roots.remove(&file_id) { | 286 | .map(|file_id| match roots.remove(&file_id) { |
290 | Some(module_id) => { | 287 | Some(module_id) => { |
291 | tree.mods[module_id].parent = Some(link); | 288 | tree.mods[module_id].parent = Some(link); |
292 | Ok(module_id) | 289 | module_id |
293 | } | 290 | } |
294 | None => build_subtree( | 291 | None => build_subtree( |
295 | db, | 292 | db, |
@@ -304,7 +301,7 @@ fn build_subtree( | |||
304 | }, | 301 | }, |
305 | ), | 302 | ), |
306 | }) | 303 | }) |
307 | .collect::<Cancelable<Vec<_>>>()?; | 304 | .collect::<Vec<_>>(); |
308 | (points_to, problem) | 305 | (points_to, problem) |
309 | } else { | 306 | } else { |
310 | let points_to = build_subtree( | 307 | let points_to = build_subtree( |
@@ -315,14 +312,14 @@ fn build_subtree( | |||
315 | roots, | 312 | roots, |
316 | Some(link), | 313 | Some(link), |
317 | sub.source, | 314 | sub.source, |
318 | )?; | 315 | ); |
319 | (vec![points_to], None) | 316 | (vec![points_to], None) |
320 | }; | 317 | }; |
321 | 318 | ||
322 | tree.links[link].points_to = points_to; | 319 | tree.links[link].points_to = points_to; |
323 | tree.links[link].problem = problem; | 320 | tree.links[link].problem = problem; |
324 | } | 321 | } |
325 | Ok(id) | 322 | id |
326 | } | 323 | } |
327 | 324 | ||
328 | fn resolve_submodule( | 325 | fn resolve_submodule( |
diff --git a/crates/ra_hir/src/name.rs b/crates/ra_hir/src/name.rs index d9683549c..8d786d2ac 100644 --- a/crates/ra_hir/src/name.rs +++ b/crates/ra_hir/src/name.rs | |||
@@ -23,7 +23,7 @@ impl fmt::Debug for Name { | |||
23 | } | 23 | } |
24 | 24 | ||
25 | impl Name { | 25 | impl Name { |
26 | fn new(text: SmolStr) -> Name { | 26 | pub(crate) fn new(text: SmolStr) -> Name { |
27 | Name { text } | 27 | Name { text } |
28 | } | 28 | } |
29 | 29 | ||
diff --git a/crates/ra_hir/src/nameres.rs b/crates/ra_hir/src/nameres.rs index 6bf949654..484f668d0 100644 --- a/crates/ra_hir/src/nameres.rs +++ b/crates/ra_hir/src/nameres.rs | |||
@@ -22,7 +22,7 @@ use ra_syntax::{ | |||
22 | SyntaxKind::{self, *}, | 22 | SyntaxKind::{self, *}, |
23 | ast::{self, AstNode} | 23 | ast::{self, AstNode} |
24 | }; | 24 | }; |
25 | use ra_db::{SourceRootId, Cancelable, FileId}; | 25 | use ra_db::{SourceRootId, FileId}; |
26 | 26 | ||
27 | use crate::{ | 27 | use crate::{ |
28 | HirFileId, | 28 | HirFileId, |
@@ -319,30 +319,26 @@ where | |||
319 | } | 319 | } |
320 | } | 320 | } |
321 | 321 | ||
322 | pub(crate) fn resolve(mut self) -> Cancelable<ItemMap> { | 322 | pub(crate) fn resolve(mut self) -> ItemMap { |
323 | for (&module_id, items) in self.input.iter() { | 323 | for (&module_id, items) in self.input.iter() { |
324 | self.populate_module(module_id, Arc::clone(items))?; | 324 | self.populate_module(module_id, Arc::clone(items)); |
325 | } | 325 | } |
326 | 326 | ||
327 | loop { | 327 | loop { |
328 | let processed_imports_count = self.processed_imports.len(); | 328 | let processed_imports_count = self.processed_imports.len(); |
329 | for &module_id in self.input.keys() { | 329 | for &module_id in self.input.keys() { |
330 | self.db.check_canceled()?; | 330 | self.db.check_canceled(); |
331 | self.resolve_imports(module_id)?; | 331 | self.resolve_imports(module_id); |
332 | } | 332 | } |
333 | if processed_imports_count == self.processed_imports.len() { | 333 | if processed_imports_count == self.processed_imports.len() { |
334 | // no new imports resolved | 334 | // no new imports resolved |
335 | break; | 335 | break; |
336 | } | 336 | } |
337 | } | 337 | } |
338 | Ok(self.result) | 338 | self.result |
339 | } | 339 | } |
340 | 340 | ||
341 | fn populate_module( | 341 | fn populate_module(&mut self, module_id: ModuleId, input: Arc<InputModuleItems>) { |
342 | &mut self, | ||
343 | module_id: ModuleId, | ||
344 | input: Arc<InputModuleItems>, | ||
345 | ) -> Cancelable<()> { | ||
346 | let mut module_items = ModuleScope::default(); | 342 | let mut module_items = ModuleScope::default(); |
347 | 343 | ||
348 | // Populate extern crates prelude | 344 | // Populate extern crates prelude |
@@ -353,8 +349,8 @@ where | |||
353 | if let Some(crate_id) = crate_graph.crate_id_for_crate_root(file_id.as_original_file()) | 349 | if let Some(crate_id) = crate_graph.crate_id_for_crate_root(file_id.as_original_file()) |
354 | { | 350 | { |
355 | let krate = Crate::new(crate_id); | 351 | let krate = Crate::new(crate_id); |
356 | for dep in krate.dependencies(self.db)? { | 352 | for dep in krate.dependencies(self.db) { |
357 | if let Some(module) = dep.krate.root_module(self.db)? { | 353 | if let Some(module) = dep.krate.root_module(self.db) { |
358 | let def_id = module.def_id; | 354 | let def_id = module.def_id; |
359 | self.add_module_item( | 355 | self.add_module_item( |
360 | &mut module_items, | 356 | &mut module_items, |
@@ -415,7 +411,6 @@ where | |||
415 | } | 411 | } |
416 | 412 | ||
417 | self.result.per_module.insert(module_id, module_items); | 413 | self.result.per_module.insert(module_id, module_items); |
418 | Ok(()) | ||
419 | } | 414 | } |
420 | 415 | ||
421 | fn add_module_item(&self, module_items: &mut ModuleScope, name: Name, def_id: PerNs<DefId>) { | 416 | fn add_module_item(&self, module_items: &mut ModuleScope, name: Name, def_id: PerNs<DefId>) { |
@@ -426,24 +421,23 @@ where | |||
426 | module_items.items.insert(name, resolution); | 421 | module_items.items.insert(name, resolution); |
427 | } | 422 | } |
428 | 423 | ||
429 | fn resolve_imports(&mut self, module_id: ModuleId) -> Cancelable<()> { | 424 | fn resolve_imports(&mut self, module_id: ModuleId) { |
430 | for (i, import) in self.input[&module_id].imports.iter().enumerate() { | 425 | for (i, import) in self.input[&module_id].imports.iter().enumerate() { |
431 | if self.processed_imports.contains(&(module_id, i)) { | 426 | if self.processed_imports.contains(&(module_id, i)) { |
432 | // already done | 427 | // already done |
433 | continue; | 428 | continue; |
434 | } | 429 | } |
435 | if self.resolve_import(module_id, import)? { | 430 | if self.resolve_import(module_id, import) { |
436 | log::debug!("import {:?} resolved (or definite error)", import); | 431 | log::debug!("import {:?} resolved (or definite error)", import); |
437 | self.processed_imports.insert((module_id, i)); | 432 | self.processed_imports.insert((module_id, i)); |
438 | } | 433 | } |
439 | } | 434 | } |
440 | Ok(()) | ||
441 | } | 435 | } |
442 | 436 | ||
443 | fn resolve_import(&mut self, module_id: ModuleId, import: &Import) -> Cancelable<bool> { | 437 | fn resolve_import(&mut self, module_id: ModuleId, import: &Import) -> bool { |
444 | log::debug!("resolving import: {:?}", import); | 438 | log::debug!("resolving import: {:?}", import); |
445 | let ptr = match import.kind { | 439 | let ptr = match import.kind { |
446 | ImportKind::Glob => return Ok(false), | 440 | ImportKind::Glob => return false, |
447 | ImportKind::Named(ptr) => ptr, | 441 | ImportKind::Named(ptr) => ptr, |
448 | }; | 442 | }; |
449 | 443 | ||
@@ -455,7 +449,7 @@ where | |||
455 | None => { | 449 | None => { |
456 | // TODO: error | 450 | // TODO: error |
457 | log::debug!("super path in root module"); | 451 | log::debug!("super path in root module"); |
458 | return Ok(true); // this can't suddenly resolve if we just resolve some other imports | 452 | return true; // this can't suddenly resolve if we just resolve some other imports |
459 | } | 453 | } |
460 | } | 454 | } |
461 | } | 455 | } |
@@ -469,7 +463,7 @@ where | |||
469 | Some(res) if !res.def_id.is_none() => res.def_id, | 463 | Some(res) if !res.def_id.is_none() => res.def_id, |
470 | _ => { | 464 | _ => { |
471 | log::debug!("path segment {:?} not found", name); | 465 | log::debug!("path segment {:?} not found", name); |
472 | return Ok(false); | 466 | return false; |
473 | } | 467 | } |
474 | }; | 468 | }; |
475 | 469 | ||
@@ -481,7 +475,7 @@ where | |||
481 | "path segment {:?} resolved to value only, but is not last", | 475 | "path segment {:?} resolved to value only, but is not last", |
482 | name | 476 | name |
483 | ); | 477 | ); |
484 | return Ok(false); | 478 | return false; |
485 | }; | 479 | }; |
486 | curr = match type_def_id.loc(self.db) { | 480 | curr = match type_def_id.loc(self.db) { |
487 | DefLoc { | 481 | DefLoc { |
@@ -499,7 +493,7 @@ where | |||
499 | kind: PathKind::Crate, | 493 | kind: PathKind::Crate, |
500 | }; | 494 | }; |
501 | log::debug!("resolving {:?} in other source root", path); | 495 | log::debug!("resolving {:?} in other source root", path); |
502 | let def_id = module.resolve_path(self.db, &path)?; | 496 | let def_id = module.resolve_path(self.db, &path); |
503 | if !def_id.is_none() { | 497 | if !def_id.is_none() { |
504 | let name = path.segments.last().unwrap(); | 498 | let name = path.segments.last().unwrap(); |
505 | self.update(module_id, |items| { | 499 | self.update(module_id, |items| { |
@@ -515,10 +509,10 @@ where | |||
515 | import, | 509 | import, |
516 | def_id.map(|did| did.loc(self.db)) | 510 | def_id.map(|did| did.loc(self.db)) |
517 | ); | 511 | ); |
518 | return Ok(true); | 512 | return true; |
519 | } else { | 513 | } else { |
520 | log::debug!("rest of path did not resolve in other source root"); | 514 | log::debug!("rest of path did not resolve in other source root"); |
521 | return Ok(true); | 515 | return true; |
522 | } | 516 | } |
523 | } | 517 | } |
524 | } | 518 | } |
@@ -528,7 +522,7 @@ where | |||
528 | name, | 522 | name, |
529 | type_def_id.loc(self.db) | 523 | type_def_id.loc(self.db) |
530 | ); | 524 | ); |
531 | return Ok(true); // this resolved to a non-module, so the path won't ever resolve | 525 | return true; // this resolved to a non-module, so the path won't ever resolve |
532 | } | 526 | } |
533 | } | 527 | } |
534 | } else { | 528 | } else { |
@@ -547,7 +541,7 @@ where | |||
547 | }) | 541 | }) |
548 | } | 542 | } |
549 | } | 543 | } |
550 | Ok(true) | 544 | true |
551 | } | 545 | } |
552 | 546 | ||
553 | fn update(&mut self, module_id: ModuleId, f: impl FnOnce(&mut ModuleScope)) { | 547 | fn update(&mut self, module_id: ModuleId, f: impl FnOnce(&mut ModuleScope)) { |
diff --git a/crates/ra_hir/src/nameres/tests.rs b/crates/ra_hir/src/nameres/tests.rs index 647fd92aa..9a0474045 100644 --- a/crates/ra_hir/src/nameres/tests.rs +++ b/crates/ra_hir/src/nameres/tests.rs | |||
@@ -15,11 +15,9 @@ use crate::{ | |||
15 | fn item_map(fixture: &str) -> (Arc<ItemMap>, ModuleId) { | 15 | fn item_map(fixture: &str) -> (Arc<ItemMap>, ModuleId) { |
16 | let (db, pos) = MockDatabase::with_position(fixture); | 16 | let (db, pos) = MockDatabase::with_position(fixture); |
17 | let source_root = db.file_source_root(pos.file_id); | 17 | let source_root = db.file_source_root(pos.file_id); |
18 | let module = crate::source_binder::module_from_position(&db, pos) | 18 | let module = crate::source_binder::module_from_position(&db, pos).unwrap(); |
19 | .unwrap() | ||
20 | .unwrap(); | ||
21 | let module_id = module.def_id.loc(&db).module_id; | 19 | let module_id = module.def_id.loc(&db).module_id; |
22 | (db.item_map(source_root).unwrap(), module_id) | 20 | (db.item_map(source_root), module_id) |
23 | } | 21 | } |
24 | 22 | ||
25 | fn check_module_item_map(map: &ItemMap, module_id: ModuleId, expected: &str) { | 23 | fn check_module_item_map(map: &ItemMap, module_id: ModuleId, expected: &str) { |
@@ -242,11 +240,9 @@ fn item_map_across_crates() { | |||
242 | db.set_crate_graph(crate_graph); | 240 | db.set_crate_graph(crate_graph); |
243 | 241 | ||
244 | let source_root = db.file_source_root(main_id); | 242 | let source_root = db.file_source_root(main_id); |
245 | let module = crate::source_binder::module_from_file_id(&db, main_id) | 243 | let module = crate::source_binder::module_from_file_id(&db, main_id).unwrap(); |
246 | .unwrap() | ||
247 | .unwrap(); | ||
248 | let module_id = module.def_id.loc(&db).module_id; | 244 | let module_id = module.def_id.loc(&db).module_id; |
249 | let item_map = db.item_map(source_root).unwrap(); | 245 | let item_map = db.item_map(source_root); |
250 | 246 | ||
251 | check_module_item_map( | 247 | check_module_item_map( |
252 | &item_map, | 248 | &item_map, |
@@ -296,11 +292,9 @@ fn import_across_source_roots() { | |||
296 | 292 | ||
297 | db.set_crate_graph(crate_graph); | 293 | db.set_crate_graph(crate_graph); |
298 | 294 | ||
299 | let module = crate::source_binder::module_from_file_id(&db, main_id) | 295 | let module = crate::source_binder::module_from_file_id(&db, main_id).unwrap(); |
300 | .unwrap() | ||
301 | .unwrap(); | ||
302 | let module_id = module.def_id.loc(&db).module_id; | 296 | let module_id = module.def_id.loc(&db).module_id; |
303 | let item_map = db.item_map(source_root).unwrap(); | 297 | let item_map = db.item_map(source_root); |
304 | 298 | ||
305 | check_module_item_map( | 299 | check_module_item_map( |
306 | &item_map, | 300 | &item_map, |
@@ -341,11 +335,9 @@ fn reexport_across_crates() { | |||
341 | db.set_crate_graph(crate_graph); | 335 | db.set_crate_graph(crate_graph); |
342 | 336 | ||
343 | let source_root = db.file_source_root(main_id); | 337 | let source_root = db.file_source_root(main_id); |
344 | let module = crate::source_binder::module_from_file_id(&db, main_id) | 338 | let module = crate::source_binder::module_from_file_id(&db, main_id).unwrap(); |
345 | .unwrap() | ||
346 | .unwrap(); | ||
347 | let module_id = module.def_id.loc(&db).module_id; | 339 | let module_id = module.def_id.loc(&db).module_id; |
348 | let item_map = db.item_map(source_root).unwrap(); | 340 | let item_map = db.item_map(source_root); |
349 | 341 | ||
350 | check_module_item_map( | 342 | check_module_item_map( |
351 | &item_map, | 343 | &item_map, |
@@ -362,7 +354,7 @@ fn check_item_map_is_not_recomputed(initial: &str, file_change: &str) { | |||
362 | let source_root = db.file_source_root(pos.file_id); | 354 | let source_root = db.file_source_root(pos.file_id); |
363 | { | 355 | { |
364 | let events = db.log_executed(|| { | 356 | let events = db.log_executed(|| { |
365 | db.item_map(source_root).unwrap(); | 357 | db.item_map(source_root); |
366 | }); | 358 | }); |
367 | assert!(format!("{:?}", events).contains("item_map")) | 359 | assert!(format!("{:?}", events).contains("item_map")) |
368 | } | 360 | } |
@@ -371,7 +363,7 @@ fn check_item_map_is_not_recomputed(initial: &str, file_change: &str) { | |||
371 | 363 | ||
372 | { | 364 | { |
373 | let events = db.log_executed(|| { | 365 | let events = db.log_executed(|| { |
374 | db.item_map(source_root).unwrap(); | 366 | db.item_map(source_root); |
375 | }); | 367 | }); |
376 | assert!( | 368 | assert!( |
377 | !format!("{:?}", events).contains("item_map"), | 369 | !format!("{:?}", events).contains("item_map"), |
diff --git a/crates/ra_hir/src/query_definitions.rs b/crates/ra_hir/src/query_definitions.rs index 214a9d68b..24cb5c752 100644 --- a/crates/ra_hir/src/query_definitions.rs +++ b/crates/ra_hir/src/query_definitions.rs | |||
@@ -8,7 +8,7 @@ use ra_syntax::{ | |||
8 | AstNode, SyntaxNode, TreeArc, | 8 | AstNode, SyntaxNode, TreeArc, |
9 | ast::{self, ModuleItemOwner} | 9 | ast::{self, ModuleItemOwner} |
10 | }; | 10 | }; |
11 | use ra_db::{SourceRootId, Cancelable,}; | 11 | use ra_db::SourceRootId; |
12 | 12 | ||
13 | use crate::{ | 13 | use crate::{ |
14 | SourceFileItems, SourceItemId, DefId, HirFileId, ModuleSource, | 14 | SourceFileItems, SourceItemId, DefId, HirFileId, ModuleSource, |
@@ -18,10 +18,10 @@ use crate::{ | |||
18 | nameres::{InputModuleItems, ItemMap, Resolver}, | 18 | nameres::{InputModuleItems, ItemMap, Resolver}, |
19 | }; | 19 | }; |
20 | 20 | ||
21 | pub(super) fn fn_scopes(db: &impl HirDatabase, def_id: DefId) -> Cancelable<Arc<FnScopes>> { | 21 | pub(super) fn fn_scopes(db: &impl HirDatabase, def_id: DefId) -> Arc<FnScopes> { |
22 | let body = db.body_hir(def_id)?; | 22 | let body = db.body_hir(def_id); |
23 | let res = FnScopes::new(body); | 23 | let res = FnScopes::new(body); |
24 | Ok(Arc::new(res)) | 24 | Arc::new(res) |
25 | } | 25 | } |
26 | 26 | ||
27 | pub(super) fn file_items(db: &impl HirDatabase, file_id: HirFileId) -> Arc<SourceFileItems> { | 27 | pub(super) fn file_items(db: &impl HirDatabase, file_id: HirFileId) -> Arc<SourceFileItems> { |
@@ -47,8 +47,8 @@ pub(super) fn input_module_items( | |||
47 | db: &impl HirDatabase, | 47 | db: &impl HirDatabase, |
48 | source_root_id: SourceRootId, | 48 | source_root_id: SourceRootId, |
49 | module_id: ModuleId, | 49 | module_id: ModuleId, |
50 | ) -> Cancelable<Arc<InputModuleItems>> { | 50 | ) -> Arc<InputModuleItems> { |
51 | let module_tree = db.module_tree(source_root_id)?; | 51 | let module_tree = db.module_tree(source_root_id); |
52 | let source = module_id.source(&module_tree); | 52 | let source = module_id.source(&module_tree); |
53 | let file_id = source.file_id; | 53 | let file_id = source.file_id; |
54 | let source = ModuleSource::from_source_item_id(db, source); | 54 | let source = ModuleSource::from_source_item_id(db, source); |
@@ -90,26 +90,20 @@ pub(super) fn input_module_items( | |||
90 | } | 90 | } |
91 | } | 91 | } |
92 | }; | 92 | }; |
93 | Ok(Arc::new(res)) | 93 | Arc::new(res) |
94 | } | 94 | } |
95 | 95 | ||
96 | pub(super) fn item_map( | 96 | pub(super) fn item_map(db: &impl HirDatabase, source_root: SourceRootId) -> Arc<ItemMap> { |
97 | db: &impl HirDatabase, | ||
98 | source_root: SourceRootId, | ||
99 | ) -> Cancelable<Arc<ItemMap>> { | ||
100 | let start = Instant::now(); | 97 | let start = Instant::now(); |
101 | let module_tree = db.module_tree(source_root)?; | 98 | let module_tree = db.module_tree(source_root); |
102 | let input = module_tree | 99 | let input = module_tree |
103 | .modules() | 100 | .modules() |
104 | .map(|id| { | 101 | .map(|id| (id, db.input_module_items(source_root, id))) |
105 | let items = db.input_module_items(source_root, id)?; | 102 | .collect::<FxHashMap<_, _>>(); |
106 | Ok((id, items)) | ||
107 | }) | ||
108 | .collect::<Cancelable<FxHashMap<_, _>>>()?; | ||
109 | 103 | ||
110 | let resolver = Resolver::new(db, &input, source_root, module_tree); | 104 | let resolver = Resolver::new(db, &input, source_root, module_tree); |
111 | let res = resolver.resolve()?; | 105 | let res = resolver.resolve(); |
112 | let elapsed = start.elapsed(); | 106 | let elapsed = start.elapsed(); |
113 | log::info!("item_map: {:?}", elapsed); | 107 | log::info!("item_map: {:?}", elapsed); |
114 | Ok(Arc::new(res)) | 108 | Arc::new(res) |
115 | } | 109 | } |
diff --git a/crates/ra_hir/src/source_binder.rs b/crates/ra_hir/src/source_binder.rs index 1f149a366..7ab8eeae2 100644 --- a/crates/ra_hir/src/source_binder.rs +++ b/crates/ra_hir/src/source_binder.rs | |||
@@ -5,7 +5,7 @@ | |||
5 | /// | 5 | /// |
6 | /// So, this modules should not be used during hir construction, it exists | 6 | /// So, this modules should not be used during hir construction, it exists |
7 | /// purely for "IDE needs". | 7 | /// purely for "IDE needs". |
8 | use ra_db::{FileId, FilePosition, Cancelable}; | 8 | use ra_db::{FileId, FilePosition}; |
9 | use ra_syntax::{ | 9 | use ra_syntax::{ |
10 | SmolStr, TextRange, SyntaxNode, | 10 | SmolStr, TextRange, SyntaxNode, |
11 | ast::{self, AstNode, NameOwner}, | 11 | ast::{self, AstNode, NameOwner}, |
@@ -18,7 +18,7 @@ use crate::{ | |||
18 | }; | 18 | }; |
19 | 19 | ||
20 | /// Locates the module by `FileId`. Picks topmost module in the file. | 20 | /// Locates the module by `FileId`. Picks topmost module in the file. |
21 | pub fn module_from_file_id(db: &impl HirDatabase, file_id: FileId) -> Cancelable<Option<Module>> { | 21 | pub fn module_from_file_id(db: &impl HirDatabase, file_id: FileId) -> Option<Module> { |
22 | let module_source = SourceItemId { | 22 | let module_source = SourceItemId { |
23 | file_id: file_id.into(), | 23 | file_id: file_id.into(), |
24 | item_id: None, | 24 | item_id: None, |
@@ -31,25 +31,22 @@ pub fn module_from_declaration( | |||
31 | db: &impl HirDatabase, | 31 | db: &impl HirDatabase, |
32 | file_id: FileId, | 32 | file_id: FileId, |
33 | decl: &ast::Module, | 33 | decl: &ast::Module, |
34 | ) -> Cancelable<Option<Module>> { | 34 | ) -> Option<Module> { |
35 | let parent_module = module_from_file_id(db, file_id)?; | 35 | let parent_module = module_from_file_id(db, file_id); |
36 | let child_name = decl.name(); | 36 | let child_name = decl.name(); |
37 | match (parent_module, child_name) { | 37 | match (parent_module, child_name) { |
38 | (Some(parent_module), Some(child_name)) => { | 38 | (Some(parent_module), Some(child_name)) => { |
39 | if let Some(child) = parent_module.child(db, &child_name.as_name())? { | 39 | if let Some(child) = parent_module.child(db, &child_name.as_name()) { |
40 | return Ok(Some(child)); | 40 | return Some(child); |
41 | } | 41 | } |
42 | } | 42 | } |
43 | _ => (), | 43 | _ => (), |
44 | } | 44 | } |
45 | Ok(None) | 45 | None |
46 | } | 46 | } |
47 | 47 | ||
48 | /// Locates the module by position in the source code. | 48 | /// Locates the module by position in the source code. |
49 | pub fn module_from_position( | 49 | pub fn module_from_position(db: &impl HirDatabase, position: FilePosition) -> Option<Module> { |
50 | db: &impl HirDatabase, | ||
51 | position: FilePosition, | ||
52 | ) -> Cancelable<Option<Module>> { | ||
53 | let file = db.source_file(position.file_id); | 50 | let file = db.source_file(position.file_id); |
54 | match find_node_at_offset::<ast::Module>(file.syntax(), position.offset) { | 51 | match find_node_at_offset::<ast::Module>(file.syntax(), position.offset) { |
55 | Some(m) if !m.has_semi() => module_from_inline(db, position.file_id.into(), m), | 52 | Some(m) if !m.has_semi() => module_from_inline(db, position.file_id.into(), m), |
@@ -61,7 +58,7 @@ fn module_from_inline( | |||
61 | db: &impl HirDatabase, | 58 | db: &impl HirDatabase, |
62 | file_id: FileId, | 59 | file_id: FileId, |
63 | module: &ast::Module, | 60 | module: &ast::Module, |
64 | ) -> Cancelable<Option<Module>> { | 61 | ) -> Option<Module> { |
65 | assert!(!module.has_semi()); | 62 | assert!(!module.has_semi()); |
66 | let file_id = file_id.into(); | 63 | let file_id = file_id.into(); |
67 | let file_items = db.file_items(file_id); | 64 | let file_items = db.file_items(file_id); |
@@ -78,7 +75,7 @@ pub fn module_from_child_node( | |||
78 | db: &impl HirDatabase, | 75 | db: &impl HirDatabase, |
79 | file_id: FileId, | 76 | file_id: FileId, |
80 | child: &SyntaxNode, | 77 | child: &SyntaxNode, |
81 | ) -> Cancelable<Option<Module>> { | 78 | ) -> Option<Module> { |
82 | if let Some(m) = child | 79 | if let Some(m) = child |
83 | .ancestors() | 80 | .ancestors() |
84 | .filter_map(ast::Module::cast) | 81 | .filter_map(ast::Module::cast) |
@@ -90,22 +87,16 @@ pub fn module_from_child_node( | |||
90 | } | 87 | } |
91 | } | 88 | } |
92 | 89 | ||
93 | fn module_from_source(db: &impl HirDatabase, source: SourceItemId) -> Cancelable<Option<Module>> { | 90 | fn module_from_source(db: &impl HirDatabase, source: SourceItemId) -> Option<Module> { |
94 | let source_root_id = db.file_source_root(source.file_id.as_original_file()); | 91 | let source_root_id = db.file_source_root(source.file_id.as_original_file()); |
95 | let module_tree = db.module_tree(source_root_id)?; | 92 | let module_tree = db.module_tree(source_root_id); |
96 | let module_id = ctry!(module_tree.find_module_by_source(source)); | 93 | let module_id = module_tree.find_module_by_source(source)?; |
97 | Ok(Some(Module::from_module_id(db, source_root_id, module_id)?)) | 94 | Some(Module::from_module_id(db, source_root_id, module_id)) |
98 | } | 95 | } |
99 | 96 | ||
100 | pub fn function_from_position( | 97 | pub fn function_from_position(db: &impl HirDatabase, position: FilePosition) -> Option<Function> { |
101 | db: &impl HirDatabase, | ||
102 | position: FilePosition, | ||
103 | ) -> Cancelable<Option<Function>> { | ||
104 | let file = db.source_file(position.file_id); | 98 | let file = db.source_file(position.file_id); |
105 | let fn_def = ctry!(find_node_at_offset::<ast::FnDef>( | 99 | let fn_def = find_node_at_offset::<ast::FnDef>(file.syntax(), position.offset)?; |
106 | file.syntax(), | ||
107 | position.offset | ||
108 | )); | ||
109 | function_from_source(db, position.file_id, fn_def) | 100 | function_from_source(db, position.file_id, fn_def) |
110 | } | 101 | } |
111 | 102 | ||
@@ -113,10 +104,10 @@ pub fn function_from_source( | |||
113 | db: &impl HirDatabase, | 104 | db: &impl HirDatabase, |
114 | file_id: FileId, | 105 | file_id: FileId, |
115 | fn_def: &ast::FnDef, | 106 | fn_def: &ast::FnDef, |
116 | ) -> Cancelable<Option<Function>> { | 107 | ) -> Option<Function> { |
117 | let module = ctry!(module_from_child_node(db, file_id, fn_def.syntax())?); | 108 | let module = module_from_child_node(db, file_id, fn_def.syntax())?; |
118 | let res = function_from_module(db, &module, fn_def); | 109 | let res = function_from_module(db, &module, fn_def); |
119 | Ok(Some(res)) | 110 | Some(res) |
120 | } | 111 | } |
121 | 112 | ||
122 | pub fn function_from_module( | 113 | pub fn function_from_module( |
@@ -145,21 +136,18 @@ pub fn function_from_child_node( | |||
145 | db: &impl HirDatabase, | 136 | db: &impl HirDatabase, |
146 | file_id: FileId, | 137 | file_id: FileId, |
147 | node: &SyntaxNode, | 138 | node: &SyntaxNode, |
148 | ) -> Cancelable<Option<Function>> { | 139 | ) -> Option<Function> { |
149 | let fn_def = ctry!(node.ancestors().find_map(ast::FnDef::cast)); | 140 | let fn_def = node.ancestors().find_map(ast::FnDef::cast)?; |
150 | function_from_source(db, file_id, fn_def) | 141 | function_from_source(db, file_id, fn_def) |
151 | } | 142 | } |
152 | 143 | ||
153 | pub fn macro_symbols( | 144 | pub fn macro_symbols(db: &impl HirDatabase, file_id: FileId) -> Vec<(SmolStr, TextRange)> { |
154 | db: &impl HirDatabase, | 145 | let module = match module_from_file_id(db, file_id) { |
155 | file_id: FileId, | ||
156 | ) -> Cancelable<Vec<(SmolStr, TextRange)>> { | ||
157 | let module = match module_from_file_id(db, file_id)? { | ||
158 | Some(it) => it, | 146 | Some(it) => it, |
159 | None => return Ok(Vec::new()), | 147 | None => return Vec::new(), |
160 | }; | 148 | }; |
161 | let loc = module.def_id.loc(db); | 149 | let loc = module.def_id.loc(db); |
162 | let items = db.input_module_items(loc.source_root_id, loc.module_id)?; | 150 | let items = db.input_module_items(loc.source_root_id, loc.module_id); |
163 | let mut res = Vec::new(); | 151 | let mut res = Vec::new(); |
164 | 152 | ||
165 | for macro_call_id in items | 153 | for macro_call_id in items |
@@ -184,5 +172,5 @@ pub fn macro_symbols( | |||
184 | } | 172 | } |
185 | } | 173 | } |
186 | 174 | ||
187 | Ok(res) | 175 | res |
188 | } | 176 | } |
diff --git a/crates/ra_hir/src/ty.rs b/crates/ra_hir/src/ty.rs index fa46ddfe9..85d4dc05c 100644 --- a/crates/ra_hir/src/ty.rs +++ b/crates/ra_hir/src/ty.rs | |||
@@ -14,7 +14,7 @@ | |||
14 | //! rustc. | 14 | //! rustc. |
15 | 15 | ||
16 | mod autoderef; | 16 | mod autoderef; |
17 | mod primitive; | 17 | pub(crate) mod primitive; |
18 | #[cfg(test)] | 18 | #[cfg(test)] |
19 | mod tests; | 19 | mod tests; |
20 | pub(crate) mod method_resolution; | 20 | pub(crate) mod method_resolution; |
@@ -30,25 +30,15 @@ use ra_arena::map::ArenaMap; | |||
30 | use join_to_string::join; | 30 | use join_to_string::join; |
31 | use rustc_hash::FxHashMap; | 31 | use rustc_hash::FxHashMap; |
32 | 32 | ||
33 | use ra_db::Cancelable; | ||
34 | |||
35 | use crate::{ | 33 | use crate::{ |
36 | Def, DefId, Module, Function, Struct, Enum, EnumVariant, Path, Name, ImplBlock, | 34 | Def, DefId, Module, Function, Struct, Enum, EnumVariant, Path, Name, ImplBlock, |
37 | FnSignature, FnScopes, | 35 | FnSignature, FnScopes, |
38 | db::HirDatabase, | 36 | db::HirDatabase, |
39 | type_ref::{TypeRef, Mutability}, | 37 | type_ref::{TypeRef, Mutability}, |
40 | name::KnownName, | 38 | name::KnownName, |
41 | expr::{Body, Expr, ExprId, PatId, UnaryOp, BinaryOp, Statement}, | 39 | expr::{Body, Expr, Literal, ExprId, PatId, UnaryOp, BinaryOp, Statement}, |
42 | }; | 40 | }; |
43 | 41 | ||
44 | fn transpose<T>(x: Cancelable<Option<T>>) -> Option<Cancelable<T>> { | ||
45 | match x { | ||
46 | Ok(Some(t)) => Some(Ok(t)), | ||
47 | Ok(None) => None, | ||
48 | Err(e) => Some(Err(e)), | ||
49 | } | ||
50 | } | ||
51 | |||
52 | /// The ID of a type variable. | 42 | /// The ID of a type variable. |
53 | #[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)] | 43 | #[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)] |
54 | pub struct TypeVarId(u32); | 44 | pub struct TypeVarId(u32); |
@@ -107,13 +97,35 @@ impl UnifyValue for TypeVarValue { | |||
107 | } | 97 | } |
108 | } | 98 | } |
109 | 99 | ||
110 | /// The kinds of placeholders we need during type inference. Currently, we only | 100 | /// The kinds of placeholders we need during type inference. There's separate |
111 | /// have type variables; in the future, we will probably also need int and float | 101 | /// values for general types, and for integer and float variables. The latter |
112 | /// variables, for inference of literal values (e.g. `100` could be one of | 102 | /// two are used for inference of literal values (e.g. `100` could be one of |
113 | /// several integer types). | 103 | /// several integer types). |
114 | #[derive(Clone, PartialEq, Eq, Hash, Debug)] | 104 | #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] |
115 | pub enum InferTy { | 105 | pub enum InferTy { |
116 | TypeVar(TypeVarId), | 106 | TypeVar(TypeVarId), |
107 | IntVar(TypeVarId), | ||
108 | FloatVar(TypeVarId), | ||
109 | } | ||
110 | |||
111 | impl InferTy { | ||
112 | fn to_inner(self) -> TypeVarId { | ||
113 | match self { | ||
114 | InferTy::TypeVar(ty) | InferTy::IntVar(ty) | InferTy::FloatVar(ty) => ty, | ||
115 | } | ||
116 | } | ||
117 | |||
118 | fn fallback_value(self) -> Ty { | ||
119 | match self { | ||
120 | InferTy::TypeVar(..) => Ty::Unknown, | ||
121 | InferTy::IntVar(..) => { | ||
122 | Ty::Int(primitive::UncertainIntTy::Signed(primitive::IntTy::I32)) | ||
123 | } | ||
124 | InferTy::FloatVar(..) => { | ||
125 | Ty::Float(primitive::UncertainFloatTy::Known(primitive::FloatTy::F64)) | ||
126 | } | ||
127 | } | ||
128 | } | ||
117 | } | 129 | } |
118 | 130 | ||
119 | /// When inferring an expression, we propagate downward whatever type hint we | 131 | /// When inferring an expression, we propagate downward whatever type hint we |
@@ -151,14 +163,11 @@ pub enum Ty { | |||
151 | /// (a non-surrogate code point). Written as `char`. | 163 | /// (a non-surrogate code point). Written as `char`. |
152 | Char, | 164 | Char, |
153 | 165 | ||
154 | /// A primitive signed integer type. For example, `i32`. | 166 | /// A primitive integer type. For example, `i32`. |
155 | Int(primitive::IntTy), | 167 | Int(primitive::UncertainIntTy), |
156 | |||
157 | /// A primitive unsigned integer type. For example, `u32`. | ||
158 | Uint(primitive::UintTy), | ||
159 | 168 | ||
160 | /// A primitive floating-point type. For example, `f64`. | 169 | /// A primitive floating-point type. For example, `f64`. |
161 | Float(primitive::FloatTy), | 170 | Float(primitive::UncertainFloatTy), |
162 | 171 | ||
163 | /// Structures, enumerations and unions. | 172 | /// Structures, enumerations and unions. |
164 | Adt { | 173 | Adt { |
@@ -198,8 +207,9 @@ pub enum Ty { | |||
198 | // above function pointer type. Once we implement generics, we will probably | 207 | // above function pointer type. Once we implement generics, we will probably |
199 | // need this as well. | 208 | // need this as well. |
200 | 209 | ||
201 | // A trait, defined with `dyn trait`. | 210 | // A trait, defined with `dyn Trait`. |
202 | // Dynamic(), | 211 | // Dynamic(), |
212 | |||
203 | // The anonymous type of a closure. Used to represent the type of | 213 | // The anonymous type of a closure. Used to represent the type of |
204 | // `|a| a`. | 214 | // `|a| a`. |
205 | // Closure(DefId, ClosureSubsts<'tcx>), | 215 | // Closure(DefId, ClosureSubsts<'tcx>), |
@@ -251,28 +261,28 @@ impl Ty { | |||
251 | module: &Module, | 261 | module: &Module, |
252 | impl_block: Option<&ImplBlock>, | 262 | impl_block: Option<&ImplBlock>, |
253 | type_ref: &TypeRef, | 263 | type_ref: &TypeRef, |
254 | ) -> Cancelable<Self> { | 264 | ) -> Self { |
255 | Ok(match type_ref { | 265 | match type_ref { |
256 | TypeRef::Never => Ty::Never, | 266 | TypeRef::Never => Ty::Never, |
257 | TypeRef::Tuple(inner) => { | 267 | TypeRef::Tuple(inner) => { |
258 | let inner_tys = inner | 268 | let inner_tys = inner |
259 | .iter() | 269 | .iter() |
260 | .map(|tr| Ty::from_hir(db, module, impl_block, tr)) | 270 | .map(|tr| Ty::from_hir(db, module, impl_block, tr)) |
261 | .collect::<Cancelable<Vec<_>>>()?; | 271 | .collect::<Vec<_>>(); |
262 | Ty::Tuple(inner_tys.into()) | 272 | Ty::Tuple(inner_tys.into()) |
263 | } | 273 | } |
264 | TypeRef::Path(path) => Ty::from_hir_path(db, module, impl_block, path)?, | 274 | TypeRef::Path(path) => Ty::from_hir_path(db, module, impl_block, path), |
265 | TypeRef::RawPtr(inner, mutability) => { | 275 | TypeRef::RawPtr(inner, mutability) => { |
266 | let inner_ty = Ty::from_hir(db, module, impl_block, inner)?; | 276 | let inner_ty = Ty::from_hir(db, module, impl_block, inner); |
267 | Ty::RawPtr(Arc::new(inner_ty), *mutability) | 277 | Ty::RawPtr(Arc::new(inner_ty), *mutability) |
268 | } | 278 | } |
269 | TypeRef::Array(_inner) => Ty::Unknown, // TODO | 279 | TypeRef::Array(_inner) => Ty::Unknown, // TODO |
270 | TypeRef::Slice(inner) => { | 280 | TypeRef::Slice(inner) => { |
271 | let inner_ty = Ty::from_hir(db, module, impl_block, inner)?; | 281 | let inner_ty = Ty::from_hir(db, module, impl_block, inner); |
272 | Ty::Slice(Arc::new(inner_ty)) | 282 | Ty::Slice(Arc::new(inner_ty)) |
273 | } | 283 | } |
274 | TypeRef::Reference(inner, mutability) => { | 284 | TypeRef::Reference(inner, mutability) => { |
275 | let inner_ty = Ty::from_hir(db, module, impl_block, inner)?; | 285 | let inner_ty = Ty::from_hir(db, module, impl_block, inner); |
276 | Ty::Ref(Arc::new(inner_ty), *mutability) | 286 | Ty::Ref(Arc::new(inner_ty), *mutability) |
277 | } | 287 | } |
278 | TypeRef::Placeholder => Ty::Unknown, | 288 | TypeRef::Placeholder => Ty::Unknown, |
@@ -280,7 +290,7 @@ impl Ty { | |||
280 | let mut inner_tys = params | 290 | let mut inner_tys = params |
281 | .iter() | 291 | .iter() |
282 | .map(|tr| Ty::from_hir(db, module, impl_block, tr)) | 292 | .map(|tr| Ty::from_hir(db, module, impl_block, tr)) |
283 | .collect::<Cancelable<Vec<_>>>()?; | 293 | .collect::<Vec<_>>(); |
284 | let return_ty = inner_tys | 294 | let return_ty = inner_tys |
285 | .pop() | 295 | .pop() |
286 | .expect("TypeRef::Fn should always have at least return type"); | 296 | .expect("TypeRef::Fn should always have at least return type"); |
@@ -291,7 +301,7 @@ impl Ty { | |||
291 | Ty::FnPtr(Arc::new(sig)) | 301 | Ty::FnPtr(Arc::new(sig)) |
292 | } | 302 | } |
293 | TypeRef::Error => Ty::Unknown, | 303 | TypeRef::Error => Ty::Unknown, |
294 | }) | 304 | } |
295 | } | 305 | } |
296 | 306 | ||
297 | pub(crate) fn from_hir_opt( | 307 | pub(crate) fn from_hir_opt( |
@@ -299,10 +309,8 @@ impl Ty { | |||
299 | module: &Module, | 309 | module: &Module, |
300 | impl_block: Option<&ImplBlock>, | 310 | impl_block: Option<&ImplBlock>, |
301 | type_ref: Option<&TypeRef>, | 311 | type_ref: Option<&TypeRef>, |
302 | ) -> Cancelable<Self> { | 312 | ) -> Self { |
303 | type_ref | 313 | type_ref.map_or(Ty::Unknown, |t| Ty::from_hir(db, module, impl_block, t)) |
304 | .map(|t| Ty::from_hir(db, module, impl_block, t)) | ||
305 | .unwrap_or(Ok(Ty::Unknown)) | ||
306 | } | 314 | } |
307 | 315 | ||
308 | pub(crate) fn from_hir_path( | 316 | pub(crate) fn from_hir_path( |
@@ -310,33 +318,31 @@ impl Ty { | |||
310 | module: &Module, | 318 | module: &Module, |
311 | impl_block: Option<&ImplBlock>, | 319 | impl_block: Option<&ImplBlock>, |
312 | path: &Path, | 320 | path: &Path, |
313 | ) -> Cancelable<Self> { | 321 | ) -> Self { |
314 | if let Some(name) = path.as_ident() { | 322 | if let Some(name) = path.as_ident() { |
315 | if let Some(KnownName::Bool) = name.as_known_name() { | 323 | if let Some(int_ty) = primitive::UncertainIntTy::from_name(name) { |
316 | return Ok(Ty::Bool); | 324 | return Ty::Int(int_ty); |
317 | } else if let Some(KnownName::Char) = name.as_known_name() { | 325 | } else if let Some(float_ty) = primitive::UncertainFloatTy::from_name(name) { |
318 | return Ok(Ty::Char); | 326 | return Ty::Float(float_ty); |
319 | } else if let Some(KnownName::Str) = name.as_known_name() { | ||
320 | return Ok(Ty::Str); | ||
321 | } else if let Some(int_ty) = primitive::IntTy::from_name(name) { | ||
322 | return Ok(Ty::Int(int_ty)); | ||
323 | } else if let Some(uint_ty) = primitive::UintTy::from_name(name) { | ||
324 | return Ok(Ty::Uint(uint_ty)); | ||
325 | } else if let Some(float_ty) = primitive::FloatTy::from_name(name) { | ||
326 | return Ok(Ty::Float(float_ty)); | ||
327 | } else if name.as_known_name() == Some(KnownName::SelfType) { | 327 | } else if name.as_known_name() == Some(KnownName::SelfType) { |
328 | return Ty::from_hir_opt(db, module, None, impl_block.map(|i| i.target_type())); | 328 | return Ty::from_hir_opt(db, module, None, impl_block.map(|i| i.target_type())); |
329 | } else if let Some(known) = name.as_known_name() { | ||
330 | match known { | ||
331 | KnownName::Bool => return Ty::Bool, | ||
332 | KnownName::Char => return Ty::Char, | ||
333 | KnownName::Str => return Ty::Str, | ||
334 | _ => {} | ||
335 | } | ||
329 | } | 336 | } |
330 | } | 337 | } |
331 | 338 | ||
332 | // Resolve in module (in type namespace) | 339 | // Resolve in module (in type namespace) |
333 | let resolved = if let Some(r) = module.resolve_path(db, path)?.take_types() { | 340 | let resolved = if let Some(r) = module.resolve_path(db, path).take_types() { |
334 | r | 341 | r |
335 | } else { | 342 | } else { |
336 | return Ok(Ty::Unknown); | 343 | return Ty::Unknown; |
337 | }; | 344 | }; |
338 | let ty = db.type_for_def(resolved)?; | 345 | db.type_for_def(resolved) |
339 | Ok(ty) | ||
340 | } | 346 | } |
341 | 347 | ||
342 | pub fn unit() -> Self { | 348 | pub fn unit() -> Self { |
@@ -392,7 +398,6 @@ impl fmt::Display for Ty { | |||
392 | Ty::Bool => write!(f, "bool"), | 398 | Ty::Bool => write!(f, "bool"), |
393 | Ty::Char => write!(f, "char"), | 399 | Ty::Char => write!(f, "char"), |
394 | Ty::Int(t) => write!(f, "{}", t.ty_to_string()), | 400 | Ty::Int(t) => write!(f, "{}", t.ty_to_string()), |
395 | Ty::Uint(t) => write!(f, "{}", t.ty_to_string()), | ||
396 | Ty::Float(t) => write!(f, "{}", t.ty_to_string()), | 401 | Ty::Float(t) => write!(f, "{}", t.ty_to_string()), |
397 | Ty::Str => write!(f, "str"), | 402 | Ty::Str => write!(f, "str"), |
398 | Ty::Slice(t) => write!(f, "[{}]", t), | 403 | Ty::Slice(t) => write!(f, "[{}]", t), |
@@ -427,47 +432,47 @@ impl fmt::Display for Ty { | |||
427 | 432 | ||
428 | /// Compute the declared type of a function. This should not need to look at the | 433 | /// Compute the declared type of a function. This should not need to look at the |
429 | /// function body. | 434 | /// function body. |
430 | fn type_for_fn(db: &impl HirDatabase, f: Function) -> Cancelable<Ty> { | 435 | fn type_for_fn(db: &impl HirDatabase, f: Function) -> Ty { |
431 | let signature = f.signature(db); | 436 | let signature = f.signature(db); |
432 | let module = f.module(db)?; | 437 | let module = f.module(db); |
433 | let impl_block = f.impl_block(db)?; | 438 | let impl_block = f.impl_block(db); |
434 | // TODO we ignore type parameters for now | 439 | // TODO we ignore type parameters for now |
435 | let input = signature | 440 | let input = signature |
436 | .params() | 441 | .params() |
437 | .iter() | 442 | .iter() |
438 | .map(|tr| Ty::from_hir(db, &module, impl_block.as_ref(), tr)) | 443 | .map(|tr| Ty::from_hir(db, &module, impl_block.as_ref(), tr)) |
439 | .collect::<Cancelable<Vec<_>>>()?; | 444 | .collect::<Vec<_>>(); |
440 | let output = Ty::from_hir(db, &module, impl_block.as_ref(), signature.ret_type())?; | 445 | let output = Ty::from_hir(db, &module, impl_block.as_ref(), signature.ret_type()); |
441 | let sig = FnSig { input, output }; | 446 | let sig = FnSig { input, output }; |
442 | Ok(Ty::FnPtr(Arc::new(sig))) | 447 | Ty::FnPtr(Arc::new(sig)) |
443 | } | 448 | } |
444 | 449 | ||
445 | fn type_for_struct(db: &impl HirDatabase, s: Struct) -> Cancelable<Ty> { | 450 | fn type_for_struct(db: &impl HirDatabase, s: Struct) -> Ty { |
446 | Ok(Ty::Adt { | 451 | Ty::Adt { |
447 | def_id: s.def_id(), | 452 | def_id: s.def_id(), |
448 | name: s.name(db)?.unwrap_or_else(Name::missing), | 453 | name: s.name(db).unwrap_or_else(Name::missing), |
449 | }) | 454 | } |
450 | } | 455 | } |
451 | 456 | ||
452 | pub(crate) fn type_for_enum(db: &impl HirDatabase, s: Enum) -> Cancelable<Ty> { | 457 | pub(crate) fn type_for_enum(db: &impl HirDatabase, s: Enum) -> Ty { |
453 | Ok(Ty::Adt { | 458 | Ty::Adt { |
454 | def_id: s.def_id(), | 459 | def_id: s.def_id(), |
455 | name: s.name(db)?.unwrap_or_else(Name::missing), | 460 | name: s.name(db).unwrap_or_else(Name::missing), |
456 | }) | 461 | } |
457 | } | 462 | } |
458 | 463 | ||
459 | pub(crate) fn type_for_enum_variant(db: &impl HirDatabase, ev: EnumVariant) -> Cancelable<Ty> { | 464 | pub(crate) fn type_for_enum_variant(db: &impl HirDatabase, ev: EnumVariant) -> Ty { |
460 | let enum_parent = ev.parent_enum(db)?; | 465 | let enum_parent = ev.parent_enum(db); |
461 | 466 | ||
462 | type_for_enum(db, enum_parent) | 467 | type_for_enum(db, enum_parent) |
463 | } | 468 | } |
464 | 469 | ||
465 | pub(super) fn type_for_def(db: &impl HirDatabase, def_id: DefId) -> Cancelable<Ty> { | 470 | pub(super) fn type_for_def(db: &impl HirDatabase, def_id: DefId) -> Ty { |
466 | let def = def_id.resolve(db)?; | 471 | let def = def_id.resolve(db); |
467 | match def { | 472 | match def { |
468 | Def::Module(..) => { | 473 | Def::Module(..) => { |
469 | log::debug!("trying to get type for module {:?}", def_id); | 474 | log::debug!("trying to get type for module {:?}", def_id); |
470 | Ok(Ty::Unknown) | 475 | Ty::Unknown |
471 | } | 476 | } |
472 | Def::Function(f) => type_for_fn(db, f), | 477 | Def::Function(f) => type_for_fn(db, f), |
473 | Def::Struct(s) => type_for_struct(db, s), | 478 | Def::Struct(s) => type_for_struct(db, s), |
@@ -479,35 +484,26 @@ pub(super) fn type_for_def(db: &impl HirDatabase, def_id: DefId) -> Cancelable<T | |||
479 | def_id, | 484 | def_id, |
480 | def | 485 | def |
481 | ); | 486 | ); |
482 | Ok(Ty::Unknown) | 487 | Ty::Unknown |
483 | } | 488 | } |
484 | } | 489 | } |
485 | } | 490 | } |
486 | 491 | ||
487 | pub(super) fn type_for_field( | 492 | pub(super) fn type_for_field(db: &impl HirDatabase, def_id: DefId, field: Name) -> Option<Ty> { |
488 | db: &impl HirDatabase, | 493 | let def = def_id.resolve(db); |
489 | def_id: DefId, | ||
490 | field: Name, | ||
491 | ) -> Cancelable<Option<Ty>> { | ||
492 | let def = def_id.resolve(db)?; | ||
493 | let variant_data = match def { | 494 | let variant_data = match def { |
494 | Def::Struct(s) => s.variant_data(db)?, | 495 | Def::Struct(s) => s.variant_data(db), |
495 | Def::EnumVariant(ev) => ev.variant_data(db)?, | 496 | Def::EnumVariant(ev) => ev.variant_data(db), |
496 | // TODO: unions | 497 | // TODO: unions |
497 | _ => panic!( | 498 | _ => panic!( |
498 | "trying to get type for field in non-struct/variant {:?}", | 499 | "trying to get type for field in non-struct/variant {:?}", |
499 | def_id | 500 | def_id |
500 | ), | 501 | ), |
501 | }; | 502 | }; |
502 | let module = def_id.module(db)?; | 503 | let module = def_id.module(db); |
503 | let impl_block = def_id.impl_block(db)?; | 504 | let impl_block = def_id.impl_block(db); |
504 | let type_ref = ctry!(variant_data.get_field_type_ref(&field)); | 505 | let type_ref = variant_data.get_field_type_ref(&field)?; |
505 | Ok(Some(Ty::from_hir( | 506 | Some(Ty::from_hir(db, &module, impl_block.as_ref(), &type_ref)) |
506 | db, | ||
507 | &module, | ||
508 | impl_block.as_ref(), | ||
509 | &type_ref, | ||
510 | )?)) | ||
511 | } | 507 | } |
512 | 508 | ||