aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.lock163
-rw-r--r--Cargo.toml1
-rw-r--r--crates/ra_analysis/Cargo.toml2
-rw-r--r--crates/ra_analysis/src/completion/complete_dot.rs15
-rw-r--r--crates/ra_analysis/src/db.rs1
-rw-r--r--crates/ra_analysis/src/mock_analysis.rs7
-rw-r--r--crates/ra_analysis/tests/test/main.rs8
-rw-r--r--crates/ra_db/Cargo.toml2
-rw-r--r--crates/ra_editor/src/structure.rs6
-rw-r--r--crates/ra_hir/Cargo.toml2
-rw-r--r--crates/ra_hir/src/db.rs6
-rw-r--r--crates/ra_hir/src/function.rs17
-rw-r--r--crates/ra_hir/src/ids.rs14
-rw-r--r--crates/ra_hir/src/impl_block.rs180
-rw-r--r--crates/ra_hir/src/krate.rs2
-rw-r--r--crates/ra_hir/src/lib.rs2
-rw-r--r--crates/ra_hir/src/mock.rs5
-rw-r--r--crates/ra_hir/src/module.rs15
-rw-r--r--crates/ra_hir/src/module/nameres.rs2
-rw-r--r--crates/ra_hir/src/name.rs5
-rw-r--r--crates/ra_hir/src/path.rs5
-rw-r--r--crates/ra_hir/src/ty.rs168
-rw-r--r--crates/ra_hir/src/ty/tests.rs19
-rw-r--r--crates/ra_hir/src/ty/tests/data/0007_self.txt6
-rw-r--r--crates/ra_lsp_server/src/conv.rs2
-rw-r--r--crates/ra_syntax/src/ast.rs33
-rw-r--r--crates/ra_syntax/src/ast/generated.rs119
-rw-r--r--crates/ra_syntax/src/grammar.ron13
-rw-r--r--crates/ra_syntax/src/grammar/items.rs4
-rw-r--r--crates/ra_syntax/src/grammar/items/traits.rs6
-rw-r--r--crates/ra_syntax/src/reparsing.rs2
-rw-r--r--crates/ra_syntax/src/syntax_kinds/generated.rs4
-rw-r--r--crates/ra_syntax/tests/data/parser/err/0018_incomplete_fn.txt2
-rw-r--r--crates/ra_syntax/tests/data/parser/err/0022_bad_exprs.txt2
-rw-r--r--crates/ra_syntax/tests/data/parser/err/0026_imp_recovery.txt4
-rw-r--r--crates/ra_syntax/tests/data/parser/inline/err/0002_misplaced_label_err.txt2
-rw-r--r--crates/ra_syntax/tests/data/parser/inline/err/0004_impl_type.txt12
-rw-r--r--crates/ra_syntax/tests/data/parser/inline/ok/0001_trait_item_list.txt2
-rw-r--r--crates/ra_syntax/tests/data/parser/inline/ok/0006_self_param.txt2
-rw-r--r--crates/ra_syntax/tests/data/parser/inline/ok/0018_arb_self_types.txt2
-rw-r--r--crates/ra_syntax/tests/data/parser/inline/ok/0021_impl_item_list.txt2
-rw-r--r--crates/ra_syntax/tests/data/parser/inline/ok/0047_unsafe_default_impl.txt2
-rw-r--r--crates/ra_syntax/tests/data/parser/inline/ok/0063_impl_block_neg.rs (renamed from crates/ra_syntax/tests/data/parser/inline/ok/0063_impl_item_neg.rs)0
-rw-r--r--crates/ra_syntax/tests/data/parser/inline/ok/0063_impl_block_neg.txt (renamed from crates/ra_syntax/tests/data/parser/inline/ok/0063_impl_item_neg.txt)2
-rw-r--r--crates/ra_syntax/tests/data/parser/inline/ok/0079_impl_block.rs (renamed from crates/ra_syntax/tests/data/parser/inline/ok/0079_impl_item.rs)0
-rw-r--r--crates/ra_syntax/tests/data/parser/inline/ok/0079_impl_block.txt (renamed from crates/ra_syntax/tests/data/parser/inline/ok/0079_impl_item.txt)2
-rw-r--r--crates/ra_syntax/tests/data/parser/inline/ok/0087_unsafe_impl.txt2
-rw-r--r--crates/ra_syntax/tests/data/parser/inline/ok/0097_default_impl.txt2
-rw-r--r--crates/ra_syntax/tests/data/parser/ok/0037_mod.txt1
49 files changed, 675 insertions, 202 deletions
diff --git a/Cargo.lock b/Cargo.lock
index b06058688..dbadfc64e 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -32,7 +32,7 @@ name = "atty"
32version = "0.2.11" 32version = "0.2.11"
33source = "registry+https://github.com/rust-lang/crates.io-index" 33source = "registry+https://github.com/rust-lang/crates.io-index"
34dependencies = [ 34dependencies = [
35 "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", 35 "libc 0.2.46 (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,8 +50,8 @@ 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.45 (registry+https://github.com/rust-lang/crates.io-index)", 53 "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
54 "rustc-demangle 0.1.11 (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]
57 57
@@ -61,7 +61,7 @@ version = "0.1.28"
61source = "registry+https://github.com/rust-lang/crates.io-index" 61source = "registry+https://github.com/rust-lang/crates.io-index"
62dependencies = [ 62dependencies = [
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.45 (registry+https://github.com/rust-lang/crates.io-index)", 64 "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
65] 65]
66 66
67[[package]] 67[[package]]
@@ -170,8 +170,8 @@ version = "0.3.6"
170source = "registry+https://github.com/rust-lang/crates.io-index" 170source = "registry+https://github.com/rust-lang/crates.io-index"
171dependencies = [ 171dependencies = [
172 "crossbeam-utils 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", 172 "crossbeam-utils 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
173 "parking_lot 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", 173 "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
174 "rand 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", 174 "rand 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
175 "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", 175 "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)",
176] 176]
177 177
@@ -270,16 +270,16 @@ dependencies = [
270 270
271[[package]] 271[[package]]
272name = "failure" 272name = "failure"
273version = "0.1.4" 273version = "0.1.5"
274source = "registry+https://github.com/rust-lang/crates.io-index" 274source = "registry+https://github.com/rust-lang/crates.io-index"
275dependencies = [ 275dependencies = [
276 "backtrace 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", 276 "backtrace 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)",
277 "failure_derive 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", 277 "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
278] 278]
279 279
280[[package]] 280[[package]]
281name = "failure_derive" 281name = "failure_derive"
282version = "0.1.4" 282version = "0.1.5"
283source = "registry+https://github.com/rust-lang/crates.io-index" 283source = "registry+https://github.com/rust-lang/crates.io-index"
284dependencies = [ 284dependencies = [
285 "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", 285 "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -337,7 +337,7 @@ name = "gen_lsp_server"
337version = "0.1.0" 337version = "0.1.0"
338dependencies = [ 338dependencies = [
339 "crossbeam-channel 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", 339 "crossbeam-channel 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
340 "failure 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", 340 "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
341 "languageserver-types 0.53.1 (registry+https://github.com/rust-lang/crates.io-index)", 341 "languageserver-types 0.53.1 (registry+https://github.com/rust-lang/crates.io-index)",
342 "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", 342 "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
343 "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", 343 "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -434,7 +434,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
434 434
435[[package]] 435[[package]]
436name = "libc" 436name = "libc"
437version = "0.2.45" 437version = "0.2.46"
438source = "registry+https://github.com/rust-lang/crates.io-index" 438source = "registry+https://github.com/rust-lang/crates.io-index"
439 439
440[[package]] 440[[package]]
@@ -470,7 +470,7 @@ version = "2.1.2"
470source = "registry+https://github.com/rust-lang/crates.io-index" 470source = "registry+https://github.com/rust-lang/crates.io-index"
471dependencies = [ 471dependencies = [
472 "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", 472 "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
473 "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", 473 "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
474 "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", 474 "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
475] 475]
476 476
@@ -479,7 +479,7 @@ name = "memmap"
479version = "0.6.2" 479version = "0.6.2"
480source = "registry+https://github.com/rust-lang/crates.io-index" 480source = "registry+https://github.com/rust-lang/crates.io-index"
481dependencies = [ 481dependencies = [
482 "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", 482 "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
483 "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", 483 "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
484] 484]
485 485
@@ -522,7 +522,7 @@ name = "num_cpus"
522version = "1.9.0" 522version = "1.9.0"
523source = "registry+https://github.com/rust-lang/crates.io-index" 523source = "registry+https://github.com/rust-lang/crates.io-index"
524dependencies = [ 524dependencies = [
525 "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", 525 "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
526] 526]
527 527
528[[package]] 528[[package]]
@@ -535,16 +535,7 @@ dependencies = [
535 535
536[[package]] 536[[package]]
537name = "parking_lot" 537name = "parking_lot"
538version = "0.6.4" 538version = "0.7.1"
539source = "registry+https://github.com/rust-lang/crates.io-index"
540dependencies = [
541 "lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
542 "parking_lot_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
543]
544
545[[package]]
546name = "parking_lot"
547version = "0.7.0"
548source = "registry+https://github.com/rust-lang/crates.io-index" 539source = "registry+https://github.com/rust-lang/crates.io-index"
549dependencies = [ 540dependencies = [
550 "lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", 541 "lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -553,23 +544,11 @@ dependencies = [
553 544
554[[package]] 545[[package]]
555name = "parking_lot_core" 546name = "parking_lot_core"
556version = "0.3.1"
557source = "registry+https://github.com/rust-lang/crates.io-index"
558dependencies = [
559 "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)",
560 "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)",
561 "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
562 "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)",
563 "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
564]
565
566[[package]]
567name = "parking_lot_core"
568version = "0.4.0" 547version = "0.4.0"
569source = "registry+https://github.com/rust-lang/crates.io-index" 548source = "registry+https://github.com/rust-lang/crates.io-index"
570dependencies = [ 549dependencies = [
571 "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", 550 "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
572 "rand 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", 551 "rand 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
573 "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", 552 "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
574 "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", 553 "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)",
575 "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", 554 "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -664,7 +643,7 @@ dependencies = [
664 "fst 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", 643 "fst 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
665 "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", 644 "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
666 "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", 645 "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
667 "parking_lot 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", 646 "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
668 "ra_db 0.1.0", 647 "ra_db 0.1.0",
669 "ra_editor 0.1.0", 648 "ra_editor 0.1.0",
670 "ra_hir 0.1.0", 649 "ra_hir 0.1.0",
@@ -673,7 +652,7 @@ dependencies = [
673 "rayon 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", 652 "rayon 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
674 "relative-path 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 653 "relative-path 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
675 "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", 654 "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
676 "salsa 0.9.0 (git+https://github.com/matklad/salsa.git?branch=transitive-untracked)", 655 "salsa 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
677 "test_utils 0.1.0", 656 "test_utils 0.1.0",
678 "unicase 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", 657 "unicase 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
679] 658]
@@ -687,7 +666,7 @@ name = "ra_cli"
687version = "0.1.0" 666version = "0.1.0"
688dependencies = [ 667dependencies = [
689 "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)", 668 "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)",
690 "failure 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", 669 "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
691 "join_to_string 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 670 "join_to_string 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
692 "ra_editor 0.1.0", 671 "ra_editor 0.1.0",
693 "ra_syntax 0.1.0", 672 "ra_syntax 0.1.0",
@@ -698,12 +677,12 @@ dependencies = [
698name = "ra_db" 677name = "ra_db"
699version = "0.1.0" 678version = "0.1.0"
700dependencies = [ 679dependencies = [
701 "parking_lot 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", 680 "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
702 "ra_editor 0.1.0", 681 "ra_editor 0.1.0",
703 "ra_syntax 0.1.0", 682 "ra_syntax 0.1.0",
704 "relative-path 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 683 "relative-path 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
705 "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", 684 "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
706 "salsa 0.9.0 (git+https://github.com/matklad/salsa.git?branch=transitive-untracked)", 685 "salsa 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
707 "test_utils 0.1.0", 686 "test_utils 0.1.0",
708] 687]
709 688
@@ -729,14 +708,14 @@ dependencies = [
729 "ena 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", 708 "ena 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
730 "flexi_logger 0.10.3 (registry+https://github.com/rust-lang/crates.io-index)", 709 "flexi_logger 0.10.3 (registry+https://github.com/rust-lang/crates.io-index)",
731 "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", 710 "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
732 "parking_lot 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", 711 "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
733 "ra_arena 0.1.0", 712 "ra_arena 0.1.0",
734 "ra_db 0.1.0", 713 "ra_db 0.1.0",
735 "ra_editor 0.1.0", 714 "ra_editor 0.1.0",
736 "ra_syntax 0.1.0", 715 "ra_syntax 0.1.0",
737 "relative-path 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 716 "relative-path 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
738 "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", 717 "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
739 "salsa 0.9.0 (git+https://github.com/matklad/salsa.git?branch=transitive-untracked)", 718 "salsa 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
740 "test_utils 0.1.0", 719 "test_utils 0.1.0",
741] 720]
742 721
@@ -747,14 +726,14 @@ dependencies = [
747 "cargo_metadata 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", 726 "cargo_metadata 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
748 "crossbeam-channel 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", 727 "crossbeam-channel 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
749 "drop_bomb 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", 728 "drop_bomb 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
750 "failure 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", 729 "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
751 "failure_derive 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", 730 "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
752 "flexi_logger 0.10.3 (registry+https://github.com/rust-lang/crates.io-index)", 731 "flexi_logger 0.10.3 (registry+https://github.com/rust-lang/crates.io-index)",
753 "gen_lsp_server 0.1.0", 732 "gen_lsp_server 0.1.0",
754 "im 12.2.0 (registry+https://github.com/rust-lang/crates.io-index)", 733 "im 12.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
755 "languageserver-types 0.53.1 (registry+https://github.com/rust-lang/crates.io-index)", 734 "languageserver-types 0.53.1 (registry+https://github.com/rust-lang/crates.io-index)",
756 "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", 735 "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
757 "parking_lot 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", 736 "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
758 "ra_analysis 0.1.0", 737 "ra_analysis 0.1.0",
759 "ra_editor 0.1.0", 738 "ra_editor 0.1.0",
760 "ra_syntax 0.1.0", 739 "ra_syntax 0.1.0",
@@ -783,9 +762,9 @@ dependencies = [
783 "arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", 762 "arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)",
784 "drop_bomb 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", 763 "drop_bomb 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
785 "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", 764 "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
786 "parking_lot 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", 765 "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
787 "ra_text_edit 0.1.0", 766 "ra_text_edit 0.1.0",
788 "rowan 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", 767 "rowan 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
789 "test_utils 0.1.0", 768 "test_utils 0.1.0",
790 "text_unit 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", 769 "text_unit 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
791 "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 770 "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -822,36 +801,35 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
822dependencies = [ 801dependencies = [
823 "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", 802 "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
824 "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", 803 "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
825 "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", 804 "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
826 "rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", 805 "rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
827 "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", 806 "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
828] 807]
829 808
830[[package]] 809[[package]]
831name = "rand" 810name = "rand"
832version = "0.6.1" 811version = "0.6.3"
833source = "registry+https://github.com/rust-lang/crates.io-index" 812source = "registry+https://github.com/rust-lang/crates.io-index"
834dependencies = [ 813dependencies = [
835 "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", 814 "autocfg 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
836 "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", 815 "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
837 "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", 816 "rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
838 "rand_chacha 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
839 "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", 817 "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
840 "rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 818 "rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
841 "rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 819 "rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
820 "rand_os 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
842 "rand_pcg 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 821 "rand_pcg 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
843 "rand_xorshift 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 822 "rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
844 "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
845 "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", 823 "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
846] 824]
847 825
848[[package]] 826[[package]]
849name = "rand_chacha" 827name = "rand_chacha"
850version = "0.1.0" 828version = "0.1.1"
851source = "registry+https://github.com/rust-lang/crates.io-index" 829source = "registry+https://github.com/rust-lang/crates.io-index"
852dependencies = [ 830dependencies = [
831 "autocfg 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
853 "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", 832 "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
854 "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
855] 833]
856 834
857[[package]] 835[[package]]
@@ -884,6 +862,18 @@ dependencies = [
884] 862]
885 863
886[[package]] 864[[package]]
865name = "rand_os"
866version = "0.1.0"
867source = "registry+https://github.com/rust-lang/crates.io-index"
868dependencies = [
869 "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
870 "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
871 "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
872 "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
873 "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
874]
875
876[[package]]
887name = "rand_pcg" 877name = "rand_pcg"
888version = "0.1.1" 878version = "0.1.1"
889source = "registry+https://github.com/rust-lang/crates.io-index" 879source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -894,7 +884,7 @@ dependencies = [
894 884
895[[package]] 885[[package]]
896name = "rand_xorshift" 886name = "rand_xorshift"
897version = "0.1.0" 887version = "0.1.1"
898source = "registry+https://github.com/rust-lang/crates.io-index" 888source = "registry+https://github.com/rust-lang/crates.io-index"
899dependencies = [ 889dependencies = [
900 "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", 890 "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -917,7 +907,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
917dependencies = [ 907dependencies = [
918 "crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", 908 "crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
919 "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", 909 "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
920 "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", 910 "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
921 "num_cpus 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)", 911 "num_cpus 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
922] 912]
923 913
@@ -979,17 +969,17 @@ dependencies = [
979 969
980[[package]] 970[[package]]
981name = "rowan" 971name = "rowan"
982version = "0.1.3" 972version = "0.1.4"
983source = "registry+https://github.com/rust-lang/crates.io-index" 973source = "registry+https://github.com/rust-lang/crates.io-index"
984dependencies = [ 974dependencies = [
985 "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", 975 "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
986 "smol_str 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", 976 "smol_str 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
987 "text_unit 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", 977 "text_unit 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
988] 978]
989 979
990[[package]] 980[[package]]
991name = "rustc-demangle" 981name = "rustc-demangle"
992version = "0.1.11" 982version = "0.1.13"
993source = "registry+https://github.com/rust-lang/crates.io-index" 983source = "registry+https://github.com/rust-lang/crates.io-index"
994 984
995[[package]] 985[[package]]
@@ -1031,14 +1021,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
1031 1021
1032[[package]] 1022[[package]]
1033name = "salsa" 1023name = "salsa"
1034version = "0.9.0" 1024version = "0.9.1"
1035source = "git+https://github.com/matklad/salsa.git?branch=transitive-untracked#a2198f1f8a1d09894b842035a1af6b0b4c133c93" 1025source = "registry+https://github.com/rust-lang/crates.io-index"
1036dependencies = [ 1026dependencies = [
1037 "derive-new 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", 1027 "derive-new 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
1038 "indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", 1028 "indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
1039 "lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", 1029 "lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
1040 "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", 1030 "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
1041 "parking_lot 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", 1031 "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
1042 "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", 1032 "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
1043 "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", 1033 "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)",
1044] 1034]
@@ -1175,8 +1165,8 @@ version = "3.0.5"
1175source = "registry+https://github.com/rust-lang/crates.io-index" 1165source = "registry+https://github.com/rust-lang/crates.io-index"
1176dependencies = [ 1166dependencies = [
1177 "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", 1167 "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
1178 "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", 1168 "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
1179 "rand 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", 1169 "rand 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
1180 "redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)", 1170 "redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)",
1181 "remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", 1171 "remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
1182 "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", 1172 "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1207,7 +1197,7 @@ name = "teraron"
1207version = "0.0.1" 1197version = "0.0.1"
1208source = "registry+https://github.com/rust-lang/crates.io-index" 1198source = "registry+https://github.com/rust-lang/crates.io-index"
1209dependencies = [ 1199dependencies = [
1210 "failure 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", 1200 "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
1211 "heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 1201 "heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
1212 "ron 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 1202 "ron 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
1213 "tera 0.11.20 (registry+https://github.com/rust-lang/crates.io-index)", 1203 "tera 0.11.20 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1218,7 +1208,7 @@ name = "termion"
1218version = "1.5.1" 1208version = "1.5.1"
1219source = "registry+https://github.com/rust-lang/crates.io-index" 1209source = "registry+https://github.com/rust-lang/crates.io-index"
1220dependencies = [ 1210dependencies = [
1221 "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", 1211 "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
1222 "redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)", 1212 "redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)",
1223 "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 1213 "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
1224] 1214]
@@ -1279,7 +1269,7 @@ name = "time"
1279version = "0.1.41" 1269version = "0.1.41"
1280source = "registry+https://github.com/rust-lang/crates.io-index" 1270source = "registry+https://github.com/rust-lang/crates.io-index"
1281dependencies = [ 1271dependencies = [
1282 "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", 1272 "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
1283 "redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)", 1273 "redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)",
1284 "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", 1274 "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
1285] 1275]
@@ -1289,7 +1279,7 @@ name = "tools"
1289version = "0.1.0" 1279version = "0.1.0"
1290dependencies = [ 1280dependencies = [
1291 "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)", 1281 "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)",
1292 "failure 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", 1282 "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
1293 "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", 1283 "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
1294 "teraron 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)", 1284 "teraron 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
1295 "walkdir 2.2.7 (registry+https://github.com/rust-lang/crates.io-index)", 1285 "walkdir 2.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1442,7 +1432,7 @@ name = "wait-timeout"
1442version = "0.1.5" 1432version = "0.1.5"
1443source = "registry+https://github.com/rust-lang/crates.io-index" 1433source = "registry+https://github.com/rust-lang/crates.io-index"
1444dependencies = [ 1434dependencies = [
1445 "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", 1435 "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
1446] 1436]
1447 1437
1448[[package]] 1438[[package]]
@@ -1517,8 +1507,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
1517"checksum either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3be565ca5c557d7f59e7cfcf1844f9e3033650c929c6566f511e8005f205c1d0" 1507"checksum either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3be565ca5c557d7f59e7cfcf1844f9e3033650c929c6566f511e8005f205c1d0"
1518"checksum ena 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f56c93cc076508c549d9bb747f79aa9b4eb098be7b8cad8830c3137ef52d1e00" 1508"checksum ena 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f56c93cc076508c549d9bb747f79aa9b4eb098be7b8cad8830c3137ef52d1e00"
1519"checksum error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "07e791d3be96241c77c43846b665ef1384606da2cd2a48730abe606a12906e02" 1509"checksum error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "07e791d3be96241c77c43846b665ef1384606da2cd2a48730abe606a12906e02"
1520"checksum failure 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "e945b93ec214c6e97b520ec6c5d80267fc97af327658ee5b9f35984626e51fbf" 1510"checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2"
1521"checksum failure_derive 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "7c395a14ab27b42704e85bf2435c5c51f334ad7a96e16fe23c6e63a1cad6cc12" 1511"checksum failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea1063915fd7ef4309e222a5a07cf9c319fb9c7836b1f89b85458672dbb127e1"
1522"checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" 1512"checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed"
1523"checksum flexi_logger 0.10.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4dda06444ccc8b0a6da19d939989b4a4e83f328710ada449eedaed48c8b903cd" 1513"checksum flexi_logger 0.10.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4dda06444ccc8b0a6da19d939989b4a4e83f328710ada449eedaed48c8b903cd"
1524"checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" 1514"checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3"
@@ -1537,7 +1527,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
1537"checksum join_to_string 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7bddc885f3fd69dd4b5d747c2efe6dd2c36d795ea9938281ed50910e32c95e31" 1527"checksum join_to_string 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7bddc885f3fd69dd4b5d747c2efe6dd2c36d795ea9938281ed50910e32c95e31"
1538"checksum languageserver-types 0.53.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7c01845f71b8b3b3557a8179af4434a4b2570829da12371f05272d28183a06ce" 1528"checksum languageserver-types 0.53.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7c01845f71b8b3b3557a8179af4434a4b2570829da12371f05272d28183a06ce"
1539"checksum lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a374c89b9db55895453a74c1e38861d9deec0b01b405a82516e9d5de4820dea1" 1529"checksum lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a374c89b9db55895453a74c1e38861d9deec0b01b405a82516e9d5de4820dea1"
1540"checksum libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)" = "2d2857ec59fadc0773853c664d2d18e7198e83883e7060b63c924cb077bd5c74" 1530"checksum libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)" = "023a4cd09b2ff695f9734c1934145a315594b7986398496841c7031a5a1bbdbd"
1541"checksum lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "62ebf1391f6acad60e5c8b43706dde4582df75c06698ab44511d15016bc2442c" 1531"checksum lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "62ebf1391f6acad60e5c8b43706dde4582df75c06698ab44511d15016bc2442c"
1542"checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6" 1532"checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6"
1543"checksum maplit 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "08cbb6b4fef96b6d77bfc40ec491b1690c779e77b05cd9f07f787ed376fd4c43" 1533"checksum maplit 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "08cbb6b4fef96b6d77bfc40ec491b1690c779e77b05cd9f07f787ed376fd4c43"
@@ -1551,9 +1541,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
1551"checksum num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0b3a5d7cc97d6d30d8b9bc8fa19bf45349ffe46241e8816f50f62f6d6aaabee1" 1541"checksum num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0b3a5d7cc97d6d30d8b9bc8fa19bf45349ffe46241e8816f50f62f6d6aaabee1"
1552"checksum num_cpus 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5a69d464bdc213aaaff628444e99578ede64e9c854025aa43b9796530afa9238" 1542"checksum num_cpus 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5a69d464bdc213aaaff628444e99578ede64e9c854025aa43b9796530afa9238"
1553"checksum owning_ref 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "49a4b8ea2179e6a2e27411d3bca09ca6dd630821cf6894c6c7c8467a8ee7ef13" 1543"checksum owning_ref 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "49a4b8ea2179e6a2e27411d3bca09ca6dd630821cf6894c6c7c8467a8ee7ef13"
1554"checksum parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f0802bff09003b291ba756dc7e79313e51cc31667e94afbe847def490424cde5" 1544"checksum parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ab41b4aed082705d1056416ae4468b6ea99d52599ecf3169b00088d43113e337"
1555"checksum parking_lot 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9723236a9525c757d9725b993511e3fc941e33f27751942232f0058298297edf"
1556"checksum parking_lot_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ad7f7e6ebdc79edff6fdcb87a55b620174f7a989e3eb31b65231f4af57f00b8c"
1557"checksum parking_lot_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94c8c7923936b28d546dfd14d4472eaf34c99b14e1c973a32b3e6d4eb04298c9" 1545"checksum parking_lot_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94c8c7923936b28d546dfd14d4472eaf34c99b14e1c973a32b3e6d4eb04298c9"
1558"checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" 1546"checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831"
1559"checksum pest 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "54f0c72a98d8ab3c99560bfd16df8059cc10e1f9a8e83e6e3b97718dd766e9c3" 1547"checksum pest 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "54f0c72a98d8ab3c99560bfd16df8059cc10e1f9a8e83e6e3b97718dd766e9c3"
@@ -1565,14 +1553,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
1565"checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" 1553"checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0"
1566"checksum quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "53fa22a1994bd0f9372d7a816207d8a2677ad0325b073f5c5332760f0fb62b5c" 1554"checksum quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "53fa22a1994bd0f9372d7a816207d8a2677ad0325b073f5c5332760f0fb62b5c"
1567"checksum rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e464cd887e869cddcae8792a4ee31d23c7edd516700695608f5b98c67ee0131c" 1555"checksum rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e464cd887e869cddcae8792a4ee31d23c7edd516700695608f5b98c67ee0131c"
1568"checksum rand 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ae9d223d52ae411a33cf7e54ec6034ec165df296ccd23533d671a28252b6f66a" 1556"checksum rand 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b65e163105a6284f841bd23100a015895f54340e88a5ffc9ca7b8b33827cfce0"
1569"checksum rand_chacha 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "771b009e3a508cb67e8823dda454aaa5368c7bc1c16829fb77d3e980440dd34a" 1557"checksum rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef"
1570"checksum rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1961a422c4d189dfb50ffa9320bf1f2a9bd54ecb92792fb9477f99a1045f3372" 1558"checksum rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1961a422c4d189dfb50ffa9320bf1f2a9bd54ecb92792fb9477f99a1045f3372"
1571"checksum rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0905b6b7079ec73b314d4c748701f6931eb79fd97c668caa3f1899b22b32c6db" 1559"checksum rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0905b6b7079ec73b314d4c748701f6931eb79fd97c668caa3f1899b22b32c6db"
1572"checksum rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4" 1560"checksum rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4"
1573"checksum rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08" 1561"checksum rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08"
1562"checksum rand_os 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "de5ac4de1c2973e1391dc305cb0fbf8788cb58068e98255439b7485a77022273"
1574"checksum rand_pcg 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "086bd09a33c7044e56bb44d5bdde5a60e7f119a9e95b0775f545de759a32fe05" 1563"checksum rand_pcg 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "086bd09a33c7044e56bb44d5bdde5a60e7f119a9e95b0775f545de759a32fe05"
1575"checksum rand_xorshift 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "effa3fcaa47e18db002bdde6060944b6d2f9cfd8db471c30e873448ad9187be3" 1564"checksum rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c"
1576"checksum rayon 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "373814f27745b2686b350dd261bfd24576a6fb0e2c5919b3a2b6005f820b0473" 1565"checksum rayon 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "373814f27745b2686b350dd261bfd24576a6fb0e2c5919b3a2b6005f820b0473"
1577"checksum rayon-core 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b055d1e92aba6877574d8fe604a63c8b5df60f60e5982bf7ccbb1338ea527356" 1566"checksum rayon-core 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b055d1e92aba6877574d8fe604a63c8b5df60f60e5982bf7ccbb1338ea527356"
1578"checksum redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)" = "52ee9a534dc1301776eff45b4fa92d2c39b1d8c3d3357e6eb593e0d795506fc2" 1567"checksum redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)" = "52ee9a534dc1301776eff45b4fa92d2c39b1d8c3d3357e6eb593e0d795506fc2"
@@ -1582,14 +1571,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
1582"checksum relative-path 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0e7790c7f1cc73d831d28dc5a7deb316a006e7848e6a7f467cdb10a0a9e0fb1c" 1571"checksum relative-path 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0e7790c7f1cc73d831d28dc5a7deb316a006e7848e6a7f467cdb10a0a9e0fb1c"
1583"checksum remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3488ba1b9a2084d38645c4c08276a1752dcbf2c7130d74f1569681ad5d2799c5" 1572"checksum remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3488ba1b9a2084d38645c4c08276a1752dcbf2c7130d74f1569681ad5d2799c5"
1584"checksum ron 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c48677d8a9247a4e0d1f3f9cb4b0a8e29167fdc3c04f383a5e669cd7a960ae0f" 1573"checksum ron 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c48677d8a9247a4e0d1f3f9cb4b0a8e29167fdc3c04f383a5e669cd7a960ae0f"
1585"checksum rowan 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a9ccca91953e9c549cac18e8f41daa5d49dad1c9a4c9bb977ac42718bb34e1bf" 1574"checksum rowan 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "c218b4430ab922850b71b14fa9bca224425097f935f6155c0b6a4b1f398a54f0"
1586"checksum rustc-demangle 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "01b90379b8664dd83460d59bdc5dd1fd3172b8913788db483ed1325171eab2f7" 1575"checksum rustc-demangle 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "adacaae16d02b6ec37fdc7acfcddf365978de76d1983d3ee22afc260e1ca9619"
1587"checksum rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7540fc8b0c49f096ee9c961cda096467dce8084bec6bdca2fc83895fd9b28cb8" 1576"checksum rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7540fc8b0c49f096ee9c961cda096467dce8084bec6bdca2fc83895fd9b28cb8"
1588"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" 1577"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
1589"checksum rusty-fork 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9591f190d2852720b679c21f66ad929f9f1d7bb09d1193c26167586029d8489c" 1578"checksum rusty-fork 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9591f190d2852720b679c21f66ad929f9f1d7bb09d1193c26167586029d8489c"
1590"checksum ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "eb9e9b8cde282a9fe6a42dd4681319bfb63f121b8a8ee9439c6f4107e58a46f7" 1579"checksum ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "eb9e9b8cde282a9fe6a42dd4681319bfb63f121b8a8ee9439c6f4107e58a46f7"
1591"checksum safemem 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8dca453248a96cb0749e36ccdfe2b0b4e54a61bfef89fb97ec621eb8e0a93dd9" 1580"checksum safemem 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8dca453248a96cb0749e36ccdfe2b0b4e54a61bfef89fb97ec621eb8e0a93dd9"
1592"checksum salsa 0.9.0 (git+https://github.com/matklad/salsa.git?branch=transitive-untracked)" = "<none>" 1581"checksum salsa 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "442ef4acdb48c0e24ddaf4f3b62555af2d1da7047f2f26acd54ae73010aa0c02"
1593"checksum same-file 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8f20c4be53a8a1ff4c1f1b2bd14570d2f634628709752f0702ecdd2b3f9a5267" 1582"checksum same-file 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8f20c4be53a8a1ff4c1f1b2bd14570d2f634628709752f0702ecdd2b3f9a5267"
1594"checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" 1583"checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27"
1595"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" 1584"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
diff --git a/Cargo.toml b/Cargo.toml
index dd8499c06..c5155e899 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -6,4 +6,3 @@ incremental = true
6debug = true 6debug = true
7 7
8[patch.'crates-io'] 8[patch.'crates-io']
9salsa = { git = "https://github.com/matklad/salsa.git", branch = "transitive-untracked" }
diff --git a/crates/ra_analysis/Cargo.toml b/crates/ra_analysis/Cargo.toml
index 7a4fdaed9..11c78ced8 100644
--- a/crates/ra_analysis/Cargo.toml
+++ b/crates/ra_analysis/Cargo.toml
@@ -10,7 +10,7 @@ log = "0.4.5"
10relative-path = "0.4.0" 10relative-path = "0.4.0"
11rayon = "1.0.2" 11rayon = "1.0.2"
12fst = "0.3.1" 12fst = "0.3.1"
13salsa = "0.9.0" 13salsa = "0.9.1"
14rustc-hash = "1.0" 14rustc-hash = "1.0"
15parking_lot = "0.7.0" 15parking_lot = "0.7.0"
16unicase = "2.2.0" 16unicase = "2.2.0"
diff --git a/crates/ra_analysis/src/completion/complete_dot.rs b/crates/ra_analysis/src/completion/complete_dot.rs
index f24835d17..031d8b98f 100644
--- a/crates/ra_analysis/src/completion/complete_dot.rs
+++ b/crates/ra_analysis/src/completion/complete_dot.rs
@@ -73,6 +73,21 @@ mod tests {
73 } 73 }
74 74
75 #[test] 75 #[test]
76 fn test_struct_field_completion_self() {
77 check_ref_completion(
78 r"
79 struct A { the_field: u32 }
80 impl A {
81 fn foo(self) {
82 self.<|>
83 }
84 }
85 ",
86 r#"the_field"#,
87 );
88 }
89
90 #[test]
76 fn test_no_struct_field_completion_for_method_call() { 91 fn test_no_struct_field_completion_for_method_call() {
77 check_ref_completion( 92 check_ref_completion(
78 r" 93 r"
diff --git a/crates/ra_analysis/src/db.rs b/crates/ra_analysis/src/db.rs
index d7740f0c4..5422a400b 100644
--- a/crates/ra_analysis/src/db.rs
+++ b/crates/ra_analysis/src/db.rs
@@ -105,6 +105,7 @@ salsa::database_storage! {
105 fn type_for_field() for hir::db::TypeForFieldQuery; 105 fn type_for_field() for hir::db::TypeForFieldQuery;
106 fn struct_data() for hir::db::StructDataQuery; 106 fn struct_data() for hir::db::StructDataQuery;
107 fn enum_data() for hir::db::EnumDataQuery; 107 fn enum_data() for hir::db::EnumDataQuery;
108 fn impls_in_module() for hir::db::ImplsInModuleQuery;
108 } 109 }
109 } 110 }
110} 111}
diff --git a/crates/ra_analysis/src/mock_analysis.rs b/crates/ra_analysis/src/mock_analysis.rs
index 960529404..846c76cfe 100644
--- a/crates/ra_analysis/src/mock_analysis.rs
+++ b/crates/ra_analysis/src/mock_analysis.rs
@@ -4,7 +4,7 @@ use relative_path::RelativePathBuf;
4use test_utils::{extract_offset, extract_range, parse_fixture, CURSOR_MARKER}; 4use test_utils::{extract_offset, extract_range, parse_fixture, CURSOR_MARKER};
5use ra_db::mock::FileMap; 5use ra_db::mock::FileMap;
6 6
7use crate::{Analysis, AnalysisChange, AnalysisHost, FileId, FilePosition, FileRange, SourceRootId}; 7use crate::{Analysis, AnalysisChange, AnalysisHost, CrateGraph, FileId, FilePosition, FileRange, SourceRootId};
8 8
9/// Mock analysis is used in test to bootstrap an AnalysisHost/Analysis 9/// Mock analysis is used in test to bootstrap an AnalysisHost/Analysis
10/// from a set of in-memory files. 10/// from a set of in-memory files.
@@ -87,12 +87,17 @@ impl MockAnalysis {
87 let source_root = SourceRootId(0); 87 let source_root = SourceRootId(0);
88 let mut change = AnalysisChange::new(); 88 let mut change = AnalysisChange::new();
89 change.add_root(source_root, true); 89 change.add_root(source_root, true);
90 let mut crate_graph = CrateGraph::default();
90 for (path, contents) in self.files.into_iter() { 91 for (path, contents) in self.files.into_iter() {
91 assert!(path.starts_with('/')); 92 assert!(path.starts_with('/'));
92 let path = RelativePathBuf::from_path(&path[1..]).unwrap(); 93 let path = RelativePathBuf::from_path(&path[1..]).unwrap();
93 let file_id = file_map.add(path.clone()); 94 let file_id = file_map.add(path.clone());
95 if path == "/lib.rs" || path == "/main.rs" {
96 crate_graph.add_crate_root(file_id);
97 }
94 change.add_file(source_root, file_id, path, Arc::new(contents)); 98 change.add_file(source_root, file_id, path, Arc::new(contents));
95 } 99 }
100 change.set_crate_graph(crate_graph);
96 // change.set_file_resolver(Arc::new(file_map)); 101 // change.set_file_resolver(Arc::new(file_map));
97 host.apply_change(change); 102 host.apply_change(change);
98 host 103 host
diff --git a/crates/ra_analysis/tests/test/main.rs b/crates/ra_analysis/tests/test/main.rs
index 859778024..beeae1e19 100644
--- a/crates/ra_analysis/tests/test/main.rs
+++ b/crates/ra_analysis/tests/test/main.rs
@@ -138,14 +138,14 @@ fn test_resolve_parent_module_for_inline() {
138fn test_resolve_crate_root() { 138fn test_resolve_crate_root() {
139 let mock = MockAnalysis::with_files( 139 let mock = MockAnalysis::with_files(
140 " 140 "
141 //- /lib.rs 141 //- /bar.rs
142 mod foo; 142 mod foo;
143 //- /foo.rs 143 //- /bar/foo.rs
144 // emtpy <|> 144 // emtpy <|>
145 ", 145 ",
146 ); 146 );
147 let root_file = mock.id_of("/lib.rs"); 147 let root_file = mock.id_of("/bar.rs");
148 let mod_file = mock.id_of("/foo.rs"); 148 let mod_file = mock.id_of("/bar/foo.rs");
149 let mut host = mock.analysis_host(); 149 let mut host = mock.analysis_host();
150 assert!(host.analysis().crate_for(mod_file).unwrap().is_empty()); 150 assert!(host.analysis().crate_for(mod_file).unwrap().is_empty());
151 151
diff --git a/crates/ra_db/Cargo.toml b/crates/ra_db/Cargo.toml
index ecc56d953..c0e83a140 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]
8relative-path = "0.4.0" 8relative-path = "0.4.0"
9salsa = "0.9.0" 9salsa = "0.9.1"
10rustc-hash = "1.0" 10rustc-hash = "1.0"
11parking_lot = "0.7.0" 11parking_lot = "0.7.0"
12ra_syntax = { path = "../ra_syntax" } 12ra_syntax = { path = "../ra_syntax" }
diff --git a/crates/ra_editor/src/structure.rs b/crates/ra_editor/src/structure.rs
index 2292b1ddf..32d59e335 100644
--- a/crates/ra_editor/src/structure.rs
+++ b/crates/ra_editor/src/structure.rs
@@ -60,7 +60,7 @@ fn structure_node(node: SyntaxNodeRef) -> Option<StructureNode> {
60 .visit(decl::<ast::TypeDef>) 60 .visit(decl::<ast::TypeDef>)
61 .visit(decl::<ast::ConstDef>) 61 .visit(decl::<ast::ConstDef>)
62 .visit(decl::<ast::StaticDef>) 62 .visit(decl::<ast::StaticDef>)
63 .visit(|im: ast::ImplItem| { 63 .visit(|im: ast::ImplBlock| {
64 let target_type = im.target_type()?; 64 let target_type = im.target_type()?;
65 let target_trait = im.target_trait(); 65 let target_trait = im.target_trait();
66 let label = match target_trait { 66 let label = match target_trait {
@@ -121,8 +121,8 @@ impl fmt::Debug for E {}
121 StructureNode { parent: None, label: "T", navigation_range: [81; 82), node_range: [76; 88), kind: TYPE_DEF }, 121 StructureNode { parent: None, label: "T", navigation_range: [81; 82), node_range: [76; 88), kind: TYPE_DEF },
122 StructureNode { parent: None, label: "S", navigation_range: [96; 97), node_range: [89; 108), kind: STATIC_DEF }, 122 StructureNode { parent: None, label: "S", navigation_range: [96; 97), node_range: [89; 108), kind: STATIC_DEF },
123 StructureNode { parent: None, label: "C", navigation_range: [115; 116), node_range: [109; 127), kind: CONST_DEF }, 123 StructureNode { parent: None, label: "C", navigation_range: [115; 116), node_range: [109; 127), kind: CONST_DEF },
124 StructureNode { parent: None, label: "impl E", navigation_range: [134; 135), node_range: [129; 138), kind: IMPL_ITEM }, 124 StructureNode { parent: None, label: "impl E", navigation_range: [134; 135), node_range: [129; 138), kind: IMPL_BLOCK },
125 StructureNode { parent: None, label: "impl fmt::Debug for E", navigation_range: [160; 161), node_range: [140; 164), kind: IMPL_ITEM }]"#, 125 StructureNode { parent: None, label: "impl fmt::Debug for E", navigation_range: [160; 161), node_range: [140; 164), kind: IMPL_BLOCK }]"#,
126 &structure, 126 &structure,
127 ) 127 )
128 } 128 }
diff --git a/crates/ra_hir/Cargo.toml b/crates/ra_hir/Cargo.toml
index 8c0cf4b86..245a21ce3 100644
--- a/crates/ra_hir/Cargo.toml
+++ b/crates/ra_hir/Cargo.toml
@@ -8,7 +8,7 @@ authors = ["Aleksey Kladov <[email protected]>"]
8arrayvec = "0.4.10" 8arrayvec = "0.4.10"
9log = "0.4.5" 9log = "0.4.5"
10relative-path = "0.4.0" 10relative-path = "0.4.0"
11salsa = "0.9.0" 11salsa = "0.9.1"
12rustc-hash = "1.0" 12rustc-hash = "1.0"
13parking_lot = "0.7.0" 13parking_lot = "0.7.0"
14ena = "0.11" 14ena = "0.11"
diff --git a/crates/ra_hir/src/db.rs b/crates/ra_hir/src/db.rs
index 73a4cdc5c..58296fc6f 100644
--- a/crates/ra_hir/src/db.rs
+++ b/crates/ra_hir/src/db.rs
@@ -13,6 +13,7 @@ use crate::{
13 nameres::{ItemMap, InputModuleItems}}, 13 nameres::{ItemMap, InputModuleItems}},
14 ty::{InferenceResult, Ty}, 14 ty::{InferenceResult, Ty},
15 adt::{StructData, EnumData}, 15 adt::{StructData, EnumData},
16 impl_block::ModuleImplBlocks,
16}; 17};
17 18
18salsa::query_group! { 19salsa::query_group! {
@@ -87,6 +88,11 @@ pub trait HirDatabase: SyntaxDatabase
87 type ModuleTreeQuery; 88 type ModuleTreeQuery;
88 use fn crate::module::imp::module_tree; 89 use fn crate::module::imp::module_tree;
89 } 90 }
91
92 fn impls_in_module(source_root_id: SourceRootId, module_id: ModuleId) -> Cancelable<Arc<ModuleImplBlocks>> {
93 type ImplsInModuleQuery;
94 use fn crate::impl_block::impls_in_module;
95 }
90} 96}
91 97
92} 98}
diff --git a/crates/ra_hir/src/function.rs b/crates/ra_hir/src/function.rs
index 5a44132fc..75ef308ae 100644
--- a/crates/ra_hir/src/function.rs
+++ b/crates/ra_hir/src/function.rs
@@ -11,11 +11,11 @@ use ra_syntax::{
11 ast::{self, AstNode, DocCommentsOwner, NameOwner}, 11 ast::{self, AstNode, DocCommentsOwner, NameOwner},
12}; 12};
13 13
14use crate::{DefId, DefKind, HirDatabase, ty::InferenceResult, Module}; 14use crate::{DefId, DefKind, HirDatabase, ty::InferenceResult, Module, Crate, impl_block::ImplBlock};
15 15
16pub use self::scope::FnScopes; 16pub use self::scope::FnScopes;
17 17
18#[derive(Debug)] 18#[derive(Debug, Clone, PartialEq, Eq)]
19pub struct Function { 19pub struct Function {
20 def_id: DefId, 20 def_id: DefId,
21} 21}
@@ -25,6 +25,10 @@ impl Function {
25 Function { def_id } 25 Function { def_id }
26 } 26 }
27 27
28 pub fn def_id(&self) -> DefId {
29 self.def_id
30 }
31
28 pub fn syntax(&self, db: &impl HirDatabase) -> ast::FnDefNode { 32 pub fn syntax(&self, db: &impl HirDatabase) -> ast::FnDefNode {
29 let def_loc = self.def_id.loc(db); 33 let def_loc = self.def_id.loc(db);
30 assert!(def_loc.kind == DefKind::Function); 34 assert!(def_loc.kind == DefKind::Function);
@@ -48,6 +52,15 @@ impl Function {
48 pub fn module(&self, db: &impl HirDatabase) -> Cancelable<Module> { 52 pub fn module(&self, db: &impl HirDatabase) -> Cancelable<Module> {
49 self.def_id.module(db) 53 self.def_id.module(db)
50 } 54 }
55
56 pub fn krate(&self, db: &impl HirDatabase) -> Cancelable<Option<Crate>> {
57 self.def_id.krate(db)
58 }
59
60 /// The containing impl block, if this is a method.
61 pub fn impl_block(&self, db: &impl HirDatabase) -> Cancelable<Option<ImplBlock>> {
62 self.def_id.impl_block(db)
63 }
51} 64}
52 65
53#[derive(Debug, Clone)] 66#[derive(Debug, Clone)]
diff --git a/crates/ra_hir/src/ids.rs b/crates/ra_hir/src/ids.rs
index 66adacc7d..4d6378e02 100644
--- a/crates/ra_hir/src/ids.rs
+++ b/crates/ra_hir/src/ids.rs
@@ -2,7 +2,7 @@ use ra_db::{SourceRootId, LocationIntener, Cancelable, FileId};
2use ra_syntax::{SourceFileNode, SyntaxKind, SyntaxNode, SyntaxNodeRef, SourceFile, AstNode, ast}; 2use ra_syntax::{SourceFileNode, SyntaxKind, SyntaxNode, SyntaxNodeRef, SourceFile, AstNode, ast};
3use ra_arena::{Arena, RawId, impl_arena_id}; 3use ra_arena::{Arena, RawId, impl_arena_id};
4 4
5use crate::{HirDatabase, PerNs, ModuleId, Module, Def, Function, Struct, Enum}; 5use crate::{HirDatabase, PerNs, ModuleId, Module, Def, Function, Struct, Enum, ImplBlock, Crate};
6 6
7/// hir makes a heavy use of ids: integer (u32) handlers to various things. You 7/// hir makes a heavy use of ids: integer (u32) handlers to various things. You
8/// can think of id as a pointer (but without a lifetime) or a file descriptor 8/// can think of id as a pointer (but without a lifetime) or a file descriptor
@@ -177,6 +177,18 @@ impl DefId {
177 let loc = self.loc(db); 177 let loc = self.loc(db);
178 Module::new(db, loc.source_root_id, loc.module_id) 178 Module::new(db, loc.source_root_id, loc.module_id)
179 } 179 }
180
181 /// Returns the containing crate.
182 pub fn krate(&self, db: &impl HirDatabase) -> Cancelable<Option<Crate>> {
183 Ok(self.module(db)?.krate(db))
184 }
185
186 /// Returns the containing impl block, if this is an impl item.
187 pub fn impl_block(self, db: &impl HirDatabase) -> Cancelable<Option<ImplBlock>> {
188 let loc = self.loc(db);
189 let module_impls = db.impls_in_module(loc.source_root_id, loc.module_id)?;
190 Ok(ImplBlock::containing(module_impls, self))
191 }
180} 192}
181 193
182impl DefLoc { 194impl DefLoc {
diff --git a/crates/ra_hir/src/impl_block.rs b/crates/ra_hir/src/impl_block.rs
new file mode 100644
index 000000000..01afa84c4
--- /dev/null
+++ b/crates/ra_hir/src/impl_block.rs
@@ -0,0 +1,180 @@
1use std::sync::Arc;
2use rustc_hash::FxHashMap;
3
4use ra_arena::{Arena, RawId, impl_arena_id};
5use ra_syntax::ast::{self, AstNode};
6use ra_db::{LocationIntener, Cancelable, SourceRootId};
7
8use crate::{
9 DefId, DefLoc, DefKind, SourceItemId, SourceFileItems,
10 Module, Function,
11 db::HirDatabase,
12 type_ref::TypeRef,
13 module::{ModuleSourceNode, ModuleId},
14};
15
16#[derive(Debug, Clone, PartialEq, Eq)]
17pub struct ImplBlock {
18 module_impl_blocks: Arc<ModuleImplBlocks>,
19 impl_id: ImplId,
20}
21
22impl ImplBlock {
23 pub(crate) fn containing(
24 module_impl_blocks: Arc<ModuleImplBlocks>,
25 def_id: DefId,
26 ) -> Option<ImplBlock> {
27 let impl_id = *module_impl_blocks.impls_by_def.get(&def_id)?;
28 Some(ImplBlock {
29 module_impl_blocks,
30 impl_id,
31 })
32 }
33
34 fn impl_data(&self) -> &ImplData {
35 &self.module_impl_blocks.impls[self.impl_id]
36 }
37
38 pub fn target_trait(&self) -> Option<&TypeRef> {
39 self.impl_data().target_trait.as_ref()
40 }
41
42 pub fn target_type(&self) -> &TypeRef {
43 &self.impl_data().target_type
44 }
45
46 pub fn items(&self) -> &[ImplItem] {
47 &self.impl_data().items
48 }
49}
50
51#[derive(Debug, Clone, PartialEq, Eq)]
52pub struct ImplData {
53 target_trait: Option<TypeRef>,
54 target_type: TypeRef,
55 items: Vec<ImplItem>,
56}
57
58impl ImplData {
59 pub(crate) fn from_ast(
60 db: &impl AsRef<LocationIntener<DefLoc, DefId>>,
61 file_items: &SourceFileItems,
62 module: &Module,
63 node: ast::ImplBlock,
64 ) -> Self {
65 let target_trait = node.target_type().map(TypeRef::from_ast);
66 let target_type = TypeRef::from_ast_opt(node.target_type());
67 let file_id = module.source().file_id();
68 let items = if let Some(item_list) = node.item_list() {
69 item_list
70 .impl_items()
71 .map(|item_node| {
72 let kind = match item_node {
73 ast::ImplItem::FnDef(..) => DefKind::Function,
74 ast::ImplItem::ConstDef(..) => DefKind::Item,
75 ast::ImplItem::TypeDef(..) => DefKind::Item,
76 };
77 let item_id = file_items.id_of_unchecked(item_node.syntax());
78 let def_loc = DefLoc {
79 kind,
80 source_root_id: module.source_root_id,
81 module_id: module.module_id,
82 source_item_id: SourceItemId {
83 file_id,
84 item_id: Some(item_id),
85 },
86 };
87 let def_id = def_loc.id(db);
88 match item_node {
89 ast::ImplItem::FnDef(..) => ImplItem::Method(Function::new(def_id)),
90 ast::ImplItem::ConstDef(..) => ImplItem::Const(def_id),
91 ast::ImplItem::TypeDef(..) => ImplItem::Type(def_id),
92 }
93 })
94 .collect()
95 } else {
96 Vec::new()
97 };
98 ImplData {
99 target_trait,
100 target_type,
101 items,
102 }
103 }
104}
105
106#[derive(Debug, Clone, PartialEq, Eq)]
107pub enum ImplItem {
108 Method(Function),
109 // these don't have their own types yet
110 Const(DefId),
111 Type(DefId),
112 // Existential
113}
114
115impl ImplItem {
116 pub fn def_id(&self) -> DefId {
117 match self {
118 ImplItem::Method(f) => f.def_id(),
119 ImplItem::Const(def_id) => *def_id,
120 ImplItem::Type(def_id) => *def_id,
121 }
122 }
123}
124
125#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
126pub struct ImplId(pub RawId);
127impl_arena_id!(ImplId);
128
129/// Collection of impl blocks is a two-step process: First we collect the blocks
130/// per-module; then we build an index of all impl blocks in the crate. This
131/// way, we avoid having to do this process for the whole crate whenever someone
132/// types in any file; as long as the impl blocks in the file don't change, we
133/// don't need to do the second step again.
134///
135/// (The second step does not yet exist currently.)
136#[derive(Debug, PartialEq, Eq)]
137pub struct ModuleImplBlocks {
138 impls: Arena<ImplId, ImplData>,
139 impls_by_def: FxHashMap<DefId, ImplId>,
140}
141
142impl ModuleImplBlocks {
143 fn new() -> Self {
144 ModuleImplBlocks {
145 impls: Arena::default(),
146 impls_by_def: FxHashMap::default(),
147 }
148 }
149
150 fn collect(&mut self, db: &impl HirDatabase, module: Module) -> Cancelable<()> {
151 let module_source_node = module.source().resolve(db);
152 let node = match &module_source_node {
153 ModuleSourceNode::SourceFile(node) => node.borrowed().syntax(),
154 ModuleSourceNode::Module(node) => node.borrowed().syntax(),
155 };
156
157 let source_file_items = db.file_items(module.source().file_id());
158
159 for impl_block_ast in node.children().filter_map(ast::ImplBlock::cast) {
160 let impl_block = ImplData::from_ast(db, &source_file_items, &module, impl_block_ast);
161 let id = self.impls.alloc(impl_block);
162 for impl_item in &self.impls[id].items {
163 self.impls_by_def.insert(impl_item.def_id(), id);
164 }
165 }
166
167 Ok(())
168 }
169}
170
171pub(crate) fn impls_in_module(
172 db: &impl HirDatabase,
173 source_root_id: SourceRootId,
174 module_id: ModuleId,
175) -> Cancelable<Arc<ModuleImplBlocks>> {
176 let mut result = ModuleImplBlocks::new();
177 let module = Module::new(db, source_root_id, module_id)?;
178 result.collect(db, module)?;
179 Ok(Arc::new(result))
180}
diff --git a/crates/ra_hir/src/krate.rs b/crates/ra_hir/src/krate.rs
index a0821d15d..5194e280b 100644
--- a/crates/ra_hir/src/krate.rs
+++ b/crates/ra_hir/src/krate.rs
@@ -5,7 +5,7 @@ use crate::{HirDatabase, Module, Name, AsName, HirFileId};
5/// hir::Crate describes a single crate. It's the main inteface with which 5/// hir::Crate describes a single crate. It's the main inteface with which
6/// crate's dependencies interact. Mostly, it should be just a proxy for the 6/// crate's dependencies interact. Mostly, it should be just a proxy for the
7/// root module. 7/// root module.
8#[derive(Debug)] 8#[derive(Debug, Clone, PartialEq, Eq, Hash)]
9pub struct Crate { 9pub struct Crate {
10 crate_id: CrateId, 10 crate_id: CrateId,
11} 11}
diff --git a/crates/ra_hir/src/lib.rs b/crates/ra_hir/src/lib.rs
index 344b543b6..2abcec441 100644
--- a/crates/ra_hir/src/lib.rs
+++ b/crates/ra_hir/src/lib.rs
@@ -31,6 +31,7 @@ mod function;
31mod adt; 31mod adt;
32mod type_ref; 32mod type_ref;
33mod ty; 33mod ty;
34mod impl_block;
34 35
35use crate::{ 36use crate::{
36 db::HirDatabase, 37 db::HirDatabase,
@@ -48,6 +49,7 @@ pub use self::{
48 function::{Function, FnScopes}, 49 function::{Function, FnScopes},
49 adt::{Struct, Enum}, 50 adt::{Struct, Enum},
50 ty::Ty, 51 ty::Ty,
52 impl_block::{ImplBlock, ImplItem},
51}; 53};
52 54
53pub use self::function::FnSignatureInfo; 55pub use self::function::FnSignatureInfo;
diff --git a/crates/ra_hir/src/mock.rs b/crates/ra_hir/src/mock.rs
index 89b18194a..a9db932ff 100644
--- a/crates/ra_hir/src/mock.rs
+++ b/crates/ra_hir/src/mock.rs
@@ -30,6 +30,10 @@ impl MockDatabase {
30 let file_id = db.add_file(&mut source_root, "/main.rs", text); 30 let file_id = db.add_file(&mut source_root, "/main.rs", text);
31 db.query_mut(ra_db::SourceRootQuery) 31 db.query_mut(ra_db::SourceRootQuery)
32 .set(WORKSPACE, Arc::new(source_root.clone())); 32 .set(WORKSPACE, Arc::new(source_root.clone()));
33
34 let mut crate_graph = CrateGraph::default();
35 crate_graph.add_crate_root(file_id);
36 db.set_crate_graph(crate_graph);
33 (db, source_root, file_id) 37 (db, source_root, file_id)
34 } 38 }
35 39
@@ -203,6 +207,7 @@ salsa::database_storage! {
203 fn type_for_field() for db::TypeForFieldQuery; 207 fn type_for_field() for db::TypeForFieldQuery;
204 fn struct_data() for db::StructDataQuery; 208 fn struct_data() for db::StructDataQuery;
205 fn enum_data() for db::EnumDataQuery; 209 fn enum_data() for db::EnumDataQuery;
210 fn impls_in_module() for db::ImplsInModuleQuery;
206 } 211 }
207 } 212 }
208} 213}
diff --git a/crates/ra_hir/src/module.rs b/crates/ra_hir/src/module.rs
index c70dc54dd..b9821115c 100644
--- a/crates/ra_hir/src/module.rs
+++ b/crates/ra_hir/src/module.rs
@@ -71,6 +71,21 @@ impl Module {
71 }) 71 })
72 } 72 }
73 73
74 /// Returns an iterator of all children of this module.
75 pub fn children<'a>(&'a self) -> impl Iterator<Item = (Name, Module)> + 'a {
76 self.module_id
77 .children(&self.tree)
78 .map(move |(name, module_id)| {
79 (
80 name,
81 Module {
82 module_id,
83 ..self.clone()
84 },
85 )
86 })
87 }
88
74 /// Returns the crate this module is part of. 89 /// Returns the crate this module is part of.
75 pub fn krate(&self, db: &impl HirDatabase) -> Option<Crate> { 90 pub fn krate(&self, db: &impl HirDatabase) -> Option<Crate> {
76 let root_id = self.module_id.crate_root(&self.tree); 91 let root_id = self.module_id.crate_root(&self.tree);
diff --git a/crates/ra_hir/src/module/nameres.rs b/crates/ra_hir/src/module/nameres.rs
index 8d1209626..3c6851a0a 100644
--- a/crates/ra_hir/src/module/nameres.rs
+++ b/crates/ra_hir/src/module/nameres.rs
@@ -233,7 +233,7 @@ impl InputModuleItems {
233 ast::ModuleItem::TypeDef(it) => { 233 ast::ModuleItem::TypeDef(it) => {
234 self.items.push(ModuleItem::new(file_id, file_items, it)?) 234 self.items.push(ModuleItem::new(file_id, file_items, it)?)
235 } 235 }
236 ast::ModuleItem::ImplItem(_) => { 236 ast::ModuleItem::ImplBlock(_) => {
237 // impls don't define items 237 // impls don't define items
238 } 238 }
239 ast::ModuleItem::UseItem(it) => self.add_use_item(file_items, it), 239 ast::ModuleItem::UseItem(it) => self.add_use_item(file_items, it),
diff --git a/crates/ra_hir/src/name.rs b/crates/ra_hir/src/name.rs
index 51e8b3da8..017caf442 100644
--- a/crates/ra_hir/src/name.rs
+++ b/crates/ra_hir/src/name.rs
@@ -51,6 +51,7 @@ impl Name {
51 "u128" => KnownName::U128, 51 "u128" => KnownName::U128,
52 "f32" => KnownName::F32, 52 "f32" => KnownName::F32,
53 "f64" => KnownName::F64, 53 "f64" => KnownName::F64,
54 "Self" => KnownName::Self_,
54 _ => return None, 55 _ => return None,
55 }; 56 };
56 Some(name) 57 Some(name)
@@ -84,7 +85,7 @@ impl AsName for ra_db::Dependency {
84// const ISIZE: Name = Name::new("isize") 85// const ISIZE: Name = Name::new("isize")
85// ``` 86// ```
86// but const-fn is not that powerful yet. 87// but const-fn is not that powerful yet.
87#[derive(Debug)] 88#[derive(Debug, PartialEq, Eq)]
88pub(crate) enum KnownName { 89pub(crate) enum KnownName {
89 Isize, 90 Isize,
90 I8, 91 I8,
@@ -102,4 +103,6 @@ pub(crate) enum KnownName {
102 103
103 F32, 104 F32,
104 F64, 105 F64,
106
107 Self_,
105} 108}
diff --git a/crates/ra_hir/src/path.rs b/crates/ra_hir/src/path.rs
index 93f7203fe..9fdfa0d13 100644
--- a/crates/ra_hir/src/path.rs
+++ b/crates/ra_hir/src/path.rs
@@ -70,6 +70,11 @@ impl Path {
70 self.kind == PathKind::Plain && self.segments.len() == 1 70 self.kind == PathKind::Plain && self.segments.len() == 1
71 } 71 }
72 72
73 /// `true` if this path is just a standalone `self`
74 pub fn is_self(&self) -> bool {
75 self.kind == PathKind::Self_ && self.segments.len() == 0
76 }
77
73 /// If this path is a single identifier, like `foo`, return its name. 78 /// If this path is a single identifier, like `foo`, return its name.
74 pub fn as_ident(&self) -> Option<&Name> { 79 pub fn as_ident(&self) -> Option<&Name> {
75 if self.kind != PathKind::Plain || self.segments.len() > 1 { 80 if self.kind != PathKind::Plain || self.segments.len() > 1 {
diff --git a/crates/ra_hir/src/ty.rs b/crates/ra_hir/src/ty.rs
index 719b3f7cd..e33762e0d 100644
--- a/crates/ra_hir/src/ty.rs
+++ b/crates/ra_hir/src/ty.rs
@@ -31,9 +31,10 @@ use ra_syntax::{
31}; 31};
32 32
33use crate::{ 33use crate::{
34 Def, DefId, FnScopes, Module, Function, Struct, Enum, Path, Name, AsName, 34 Def, DefId, FnScopes, Module, Function, Struct, Enum, Path, Name, AsName, ImplBlock,
35 db::HirDatabase, 35 db::HirDatabase,
36 type_ref::{TypeRef, Mutability}, 36 type_ref::{TypeRef, Mutability},
37 name::KnownName,
37}; 38};
38 39
39/// The ID of a type variable. 40/// The ID of a type variable.
@@ -235,6 +236,7 @@ impl Ty {
235 pub(crate) fn from_hir( 236 pub(crate) fn from_hir(
236 db: &impl HirDatabase, 237 db: &impl HirDatabase,
237 module: &Module, 238 module: &Module,
239 impl_block: Option<&ImplBlock>,
238 type_ref: &TypeRef, 240 type_ref: &TypeRef,
239 ) -> Cancelable<Self> { 241 ) -> Cancelable<Self> {
240 Ok(match type_ref { 242 Ok(match type_ref {
@@ -242,29 +244,29 @@ impl Ty {
242 TypeRef::Tuple(inner) => { 244 TypeRef::Tuple(inner) => {
243 let inner_tys = inner 245 let inner_tys = inner
244 .iter() 246 .iter()
245 .map(|tr| Ty::from_hir(db, module, tr)) 247 .map(|tr| Ty::from_hir(db, module, impl_block, tr))
246 .collect::<Cancelable<Vec<_>>>()?; 248 .collect::<Cancelable<Vec<_>>>()?;
247 Ty::Tuple(inner_tys.into()) 249 Ty::Tuple(inner_tys.into())
248 } 250 }
249 TypeRef::Path(path) => Ty::from_hir_path(db, module, path)?, 251 TypeRef::Path(path) => Ty::from_hir_path(db, module, impl_block, path)?,
250 TypeRef::RawPtr(inner, mutability) => { 252 TypeRef::RawPtr(inner, mutability) => {
251 let inner_ty = Ty::from_hir(db, module, inner)?; 253 let inner_ty = Ty::from_hir(db, module, impl_block, inner)?;
252 Ty::RawPtr(Arc::new(inner_ty), *mutability) 254 Ty::RawPtr(Arc::new(inner_ty), *mutability)
253 } 255 }
254 TypeRef::Array(_inner) => Ty::Unknown, // TODO 256 TypeRef::Array(_inner) => Ty::Unknown, // TODO
255 TypeRef::Slice(inner) => { 257 TypeRef::Slice(inner) => {
256 let inner_ty = Ty::from_hir(db, module, inner)?; 258 let inner_ty = Ty::from_hir(db, module, impl_block, inner)?;
257 Ty::Slice(Arc::new(inner_ty)) 259 Ty::Slice(Arc::new(inner_ty))
258 } 260 }
259 TypeRef::Reference(inner, mutability) => { 261 TypeRef::Reference(inner, mutability) => {
260 let inner_ty = Ty::from_hir(db, module, inner)?; 262 let inner_ty = Ty::from_hir(db, module, impl_block, inner)?;
261 Ty::Ref(Arc::new(inner_ty), *mutability) 263 Ty::Ref(Arc::new(inner_ty), *mutability)
262 } 264 }
263 TypeRef::Placeholder => Ty::Unknown, 265 TypeRef::Placeholder => Ty::Unknown,
264 TypeRef::Fn(params) => { 266 TypeRef::Fn(params) => {
265 let mut inner_tys = params 267 let mut inner_tys = params
266 .iter() 268 .iter()
267 .map(|tr| Ty::from_hir(db, module, tr)) 269 .map(|tr| Ty::from_hir(db, module, impl_block, tr))
268 .collect::<Cancelable<Vec<_>>>()?; 270 .collect::<Cancelable<Vec<_>>>()?;
269 let return_ty = inner_tys 271 let return_ty = inner_tys
270 .pop() 272 .pop()
@@ -279,9 +281,21 @@ impl Ty {
279 }) 281 })
280 } 282 }
281 283
284 pub(crate) fn from_hir_opt(
285 db: &impl HirDatabase,
286 module: &Module,
287 impl_block: Option<&ImplBlock>,
288 type_ref: Option<&TypeRef>,
289 ) -> Cancelable<Self> {
290 type_ref
291 .map(|t| Ty::from_hir(db, module, impl_block, t))
292 .unwrap_or(Ok(Ty::Unknown))
293 }
294
282 pub(crate) fn from_hir_path( 295 pub(crate) fn from_hir_path(
283 db: &impl HirDatabase, 296 db: &impl HirDatabase,
284 module: &Module, 297 module: &Module,
298 impl_block: Option<&ImplBlock>,
285 path: &Path, 299 path: &Path,
286 ) -> Cancelable<Self> { 300 ) -> Cancelable<Self> {
287 if let Some(name) = path.as_ident() { 301 if let Some(name) = path.as_ident() {
@@ -291,6 +305,8 @@ impl Ty {
291 return Ok(Ty::Uint(uint_ty)); 305 return Ok(Ty::Uint(uint_ty));
292 } else if let Some(float_ty) = primitive::FloatTy::from_name(name) { 306 } else if let Some(float_ty) = primitive::FloatTy::from_name(name) {
293 return Ok(Ty::Float(float_ty)); 307 return Ok(Ty::Float(float_ty));
308 } else if name.as_known_name() == Some(KnownName::Self_) {
309 return Ty::from_hir_opt(db, module, None, impl_block.map(|i| i.target_type()));
294 } 310 }
295 } 311 }
296 312
@@ -308,18 +324,20 @@ impl Ty {
308 pub(crate) fn from_ast_opt( 324 pub(crate) fn from_ast_opt(
309 db: &impl HirDatabase, 325 db: &impl HirDatabase,
310 module: &Module, 326 module: &Module,
327 impl_block: Option<&ImplBlock>,
311 node: Option<ast::TypeRef>, 328 node: Option<ast::TypeRef>,
312 ) -> Cancelable<Self> { 329 ) -> Cancelable<Self> {
313 node.map(|n| Ty::from_ast(db, module, n)) 330 node.map(|n| Ty::from_ast(db, module, impl_block, n))
314 .unwrap_or(Ok(Ty::Unknown)) 331 .unwrap_or(Ok(Ty::Unknown))
315 } 332 }
316 333
317 pub(crate) fn from_ast( 334 pub(crate) fn from_ast(
318 db: &impl HirDatabase, 335 db: &impl HirDatabase,
319 module: &Module, 336 module: &Module,
337 impl_block: Option<&ImplBlock>,
320 node: ast::TypeRef, 338 node: ast::TypeRef,
321 ) -> Cancelable<Self> { 339 ) -> Cancelable<Self> {
322 Ty::from_hir(db, module, &TypeRef::from_ast(node)) 340 Ty::from_hir(db, module, impl_block, &TypeRef::from_ast(node))
323 } 341 }
324 342
325 pub fn unit() -> Self { 343 pub fn unit() -> Self {
@@ -402,18 +420,19 @@ impl fmt::Display for Ty {
402fn type_for_fn(db: &impl HirDatabase, f: Function) -> Cancelable<Ty> { 420fn type_for_fn(db: &impl HirDatabase, f: Function) -> Cancelable<Ty> {
403 let syntax = f.syntax(db); 421 let syntax = f.syntax(db);
404 let module = f.module(db)?; 422 let module = f.module(db)?;
423 let impl_block = f.impl_block(db)?;
405 let node = syntax.borrowed(); 424 let node = syntax.borrowed();
406 // TODO we ignore type parameters for now 425 // TODO we ignore type parameters for now
407 let input = node 426 let input = node
408 .param_list() 427 .param_list()
409 .map(|pl| { 428 .map(|pl| {
410 pl.params() 429 pl.params()
411 .map(|p| Ty::from_ast_opt(db, &module, p.type_ref())) 430 .map(|p| Ty::from_ast_opt(db, &module, impl_block.as_ref(), p.type_ref()))
412 .collect() 431 .collect()
413 }) 432 })
414 .unwrap_or_else(|| Ok(Vec::new()))?; 433 .unwrap_or_else(|| Ok(Vec::new()))?;
415 let output = if let Some(type_ref) = node.ret_type().and_then(|rt| rt.type_ref()) { 434 let output = if let Some(type_ref) = node.ret_type().and_then(|rt| rt.type_ref()) {
416 Ty::from_ast(db, &module, type_ref)? 435 Ty::from_ast(db, &module, impl_block.as_ref(), type_ref)?
417 } else { 436 } else {
418 Ty::unit() 437 Ty::unit()
419 }; 438 };
@@ -467,12 +486,13 @@ pub(super) fn type_for_field(db: &impl HirDatabase, def_id: DefId, field: Name)
467 ), 486 ),
468 }; 487 };
469 let module = def_id.module(db)?; 488 let module = def_id.module(db)?;
489 let impl_block = def_id.impl_block(db)?;
470 let type_ref = if let Some(tr) = variant_data.get_field_type_ref(&field) { 490 let type_ref = if let Some(tr) = variant_data.get_field_type_ref(&field) {
471 tr 491 tr
472 } else { 492 } else {
473 return Ok(Ty::Unknown); 493 return Ok(Ty::Unknown);
474 }; 494 };
475 Ty::from_hir(db, &module, &type_ref) 495 Ty::from_hir(db, &module, impl_block.as_ref(), &type_ref)
476} 496}
477 497
478/// The result of type inference: A mapping from expressions and patterns to types. 498/// The result of type inference: A mapping from expressions and patterns to types.
@@ -496,19 +516,32 @@ impl InferenceResult {
496struct InferenceContext<'a, D: HirDatabase> { 516struct InferenceContext<'a, D: HirDatabase> {
497 db: &'a D, 517 db: &'a D,
498 scopes: Arc<FnScopes>, 518 scopes: Arc<FnScopes>,
519 /// The self param for the current method, if it exists.
520 self_param: Option<LocalSyntaxPtr>,
499 module: Module, 521 module: Module,
522 impl_block: Option<ImplBlock>,
500 var_unification_table: InPlaceUnificationTable<TypeVarId>, 523 var_unification_table: InPlaceUnificationTable<TypeVarId>,
501 type_of: FxHashMap<LocalSyntaxPtr, Ty>, 524 type_of: FxHashMap<LocalSyntaxPtr, Ty>,
525 /// The return type of the function being inferred.
526 return_ty: Ty,
502} 527}
503 528
504impl<'a, D: HirDatabase> InferenceContext<'a, D> { 529impl<'a, D: HirDatabase> InferenceContext<'a, D> {
505 fn new(db: &'a D, scopes: Arc<FnScopes>, module: Module) -> Self { 530 fn new(
531 db: &'a D,
532 scopes: Arc<FnScopes>,
533 module: Module,
534 impl_block: Option<ImplBlock>,
535 ) -> Self {
506 InferenceContext { 536 InferenceContext {
507 type_of: FxHashMap::default(), 537 type_of: FxHashMap::default(),
508 var_unification_table: InPlaceUnificationTable::new(), 538 var_unification_table: InPlaceUnificationTable::new(),
539 self_param: None, // set during parameter typing
540 return_ty: Ty::Unknown, // set in collect_fn_signature
509 db, 541 db,
510 scopes, 542 scopes,
511 module, 543 module,
544 impl_block,
512 } 545 }
513 } 546 }
514 547
@@ -525,6 +558,14 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
525 self.type_of.insert(LocalSyntaxPtr::new(node), ty); 558 self.type_of.insert(LocalSyntaxPtr::new(node), ty);
526 } 559 }
527 560
561 fn make_ty(&self, type_ref: &TypeRef) -> Cancelable<Ty> {
562 Ty::from_hir(self.db, &self.module, self.impl_block.as_ref(), type_ref)
563 }
564
565 fn make_ty_opt(&self, type_ref: Option<&TypeRef>) -> Cancelable<Ty> {
566 Ty::from_hir_opt(self.db, &self.module, self.impl_block.as_ref(), type_ref)
567 }
568
528 fn unify(&mut self, ty1: &Ty, ty2: &Ty) -> bool { 569 fn unify(&mut self, ty1: &Ty, ty2: &Ty) -> bool {
529 match (ty1, ty2) { 570 match (ty1, ty2) {
530 (Ty::Unknown, ..) => true, 571 (Ty::Unknown, ..) => true,
@@ -628,6 +669,12 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
628 let ty = self.resolve_ty_as_possible(ty.clone()); 669 let ty = self.resolve_ty_as_possible(ty.clone());
629 return Ok(Some(ty)); 670 return Ok(Some(ty));
630 }; 671 };
672 } else if path.is_self() {
673 // resolve `self` param
674 let self_param = ctry!(self.self_param);
675 let ty = ctry!(self.type_of.get(&self_param));
676 let ty = self.resolve_ty_as_possible(ty.clone());
677 return Ok(Some(ty));
631 }; 678 };
632 679
633 // resolve in module 680 // resolve in module
@@ -826,7 +873,12 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
826 } 873 }
827 ast::Expr::CastExpr(e) => { 874 ast::Expr::CastExpr(e) => {
828 let _inner_ty = self.infer_expr_opt(e.expr(), &Expectation::none())?; 875 let _inner_ty = self.infer_expr_opt(e.expr(), &Expectation::none())?;
829 let cast_ty = Ty::from_ast_opt(self.db, &self.module, e.type_ref())?; 876 let cast_ty = Ty::from_ast_opt(
877 self.db,
878 &self.module,
879 self.impl_block.as_ref(),
880 e.type_ref(),
881 )?;
830 let cast_ty = self.insert_type_vars(cast_ty); 882 let cast_ty = self.insert_type_vars(cast_ty);
831 // TODO do the coercion... 883 // TODO do the coercion...
832 cast_ty 884 cast_ty
@@ -880,7 +932,12 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
880 for stmt in node.statements() { 932 for stmt in node.statements() {
881 match stmt { 933 match stmt {
882 ast::Stmt::LetStmt(stmt) => { 934 ast::Stmt::LetStmt(stmt) => {
883 let decl_ty = Ty::from_ast_opt(self.db, &self.module, stmt.type_ref())?; 935 let decl_ty = Ty::from_ast_opt(
936 self.db,
937 &self.module,
938 self.impl_block.as_ref(),
939 stmt.type_ref(),
940 )?;
884 let decl_ty = self.insert_type_vars(decl_ty); 941 let decl_ty = self.insert_type_vars(decl_ty);
885 let ty = if let Some(expr) = stmt.initializer() { 942 let ty = if let Some(expr) = stmt.initializer() {
886 let expr_ty = self.infer_expr(expr, &Expectation::has_type(decl_ty))?; 943 let expr_ty = self.infer_expr(expr, &Expectation::has_type(decl_ty))?;
@@ -906,46 +963,71 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
906 self.write_ty(node.syntax(), ty.clone()); 963 self.write_ty(node.syntax(), ty.clone());
907 Ok(ty) 964 Ok(ty)
908 } 965 }
966
967 fn collect_fn_signature(&mut self, node: ast::FnDef) -> Cancelable<()> {
968 if let Some(param_list) = node.param_list() {
969 if let Some(self_param) = param_list.self_param() {
970 let self_type = if let Some(type_ref) = self_param.type_ref() {
971 let ty = self.make_ty(&TypeRef::from_ast(type_ref))?;
972 self.insert_type_vars(ty)
973 } else {
974 // TODO this should be handled by desugaring during HIR conversion
975 let ty = self.make_ty_opt(self.impl_block.as_ref().map(|i| i.target_type()))?;
976 let ty = match self_param.flavor() {
977 ast::SelfParamFlavor::Owned => ty,
978 ast::SelfParamFlavor::Ref => Ty::Ref(Arc::new(ty), Mutability::Shared),
979 ast::SelfParamFlavor::MutRef => Ty::Ref(Arc::new(ty), Mutability::Mut),
980 };
981 self.insert_type_vars(ty)
982 };
983 if let Some(self_kw) = self_param.self_kw() {
984 let self_param = LocalSyntaxPtr::new(self_kw.syntax());
985 self.self_param = Some(self_param);
986 self.type_of.insert(self_param, self_type);
987 }
988 }
989 for param in param_list.params() {
990 let pat = if let Some(pat) = param.pat() {
991 pat
992 } else {
993 continue;
994 };
995 let ty = if let Some(type_ref) = param.type_ref() {
996 let ty = self.make_ty(&TypeRef::from_ast(type_ref))?;
997 self.insert_type_vars(ty)
998 } else {
999 // missing type annotation
1000 self.new_type_var()
1001 };
1002 self.type_of.insert(LocalSyntaxPtr::new(pat.syntax()), ty);
1003 }
1004 }
1005
1006 self.return_ty = if let Some(type_ref) = node.ret_type().and_then(|n| n.type_ref()) {
1007 let ty = self.make_ty(&TypeRef::from_ast(type_ref))?;
1008 self.insert_type_vars(ty)
1009 } else {
1010 Ty::unit()
1011 };
1012
1013 Ok(())
1014 }
909} 1015}
910 1016
911pub fn infer(db: &impl HirDatabase, def_id: DefId) -> Cancelable<Arc<InferenceResult>> { 1017pub fn infer(db: &impl HirDatabase, def_id: DefId) -> Cancelable<Arc<InferenceResult>> {
912 let function = Function::new(def_id); // TODO: consts also need inference 1018 let function = Function::new(def_id); // TODO: consts also need inference
913 let scopes = function.scopes(db); 1019 let scopes = function.scopes(db);
914 let module = function.module(db)?; 1020 let module = function.module(db)?;
915 let mut ctx = InferenceContext::new(db, scopes, module); 1021 let impl_block = function.impl_block(db)?;
1022 let mut ctx = InferenceContext::new(db, scopes, module, impl_block);
916 1023
917 let syntax = function.syntax(db); 1024 let syntax = function.syntax(db);
918 let node = syntax.borrowed(); 1025 let node = syntax.borrowed();
919 1026
920 if let Some(param_list) = node.param_list() { 1027 ctx.collect_fn_signature(node)?;
921 for param in param_list.params() {
922 let pat = if let Some(pat) = param.pat() {
923 pat
924 } else {
925 continue;
926 };
927 if let Some(type_ref) = param.type_ref() {
928 let ty = Ty::from_ast(db, &ctx.module, type_ref)?;
929 let ty = ctx.insert_type_vars(ty);
930 ctx.type_of.insert(LocalSyntaxPtr::new(pat.syntax()), ty);
931 } else {
932 // TODO self param
933 let type_var = ctx.new_type_var();
934 ctx.type_of
935 .insert(LocalSyntaxPtr::new(pat.syntax()), type_var);
936 };
937 }
938 }
939
940 let ret_ty = if let Some(type_ref) = node.ret_type().and_then(|n| n.type_ref()) {
941 let ty = Ty::from_ast(db, &ctx.module, type_ref)?;
942 ctx.insert_type_vars(ty)
943 } else {
944 Ty::unit()
945 };
946 1028
947 if let Some(block) = node.body() { 1029 if let Some(block) = node.body() {
948 ctx.infer_block(block, &Expectation::has_type(ret_ty))?; 1030 ctx.infer_block(block, &Expectation::has_type(ctx.return_ty.clone()))?;
949 } 1031 }
950 1032
951 Ok(Arc::new(ctx.resolve_all())) 1033 Ok(Arc::new(ctx.resolve_all()))
diff --git a/crates/ra_hir/src/ty/tests.rs b/crates/ra_hir/src/ty/tests.rs
index 93bf431c4..fb53fcf0b 100644
--- a/crates/ra_hir/src/ty/tests.rs
+++ b/crates/ra_hir/src/ty/tests.rs
@@ -134,6 +134,25 @@ fn test() -> &mut &f64 {
134 ); 134 );
135} 135}
136 136
137#[test]
138fn infer_self() {
139 check_inference(
140 r#"
141struct S;
142
143impl S {
144 fn test(&self) {
145 self;
146 }
147 fn test2(self: &Self) {
148 self;
149 }
150}
151"#,
152 "0007_self.txt",
153 );
154}
155
137fn infer(content: &str) -> String { 156fn infer(content: &str) -> String {
138 let (db, _, file_id) = MockDatabase::with_single_file(content); 157 let (db, _, file_id) = MockDatabase::with_single_file(content);
139 let source_file = db.source_file(file_id); 158 let source_file = db.source_file(file_id);
diff --git a/crates/ra_hir/src/ty/tests/data/0007_self.txt b/crates/ra_hir/src/ty/tests/data/0007_self.txt
new file mode 100644
index 000000000..db4ba17d0
--- /dev/null
+++ b/crates/ra_hir/src/ty/tests/data/0007_self.txt
@@ -0,0 +1,6 @@
1[50; 54) 'self': &S
2[34; 38) 'self': &S
3[40; 61) '{ ... }': ()
4[88; 109) '{ ... }': ()
5[98; 102) 'self': &S
6[75; 79) 'self': &S
diff --git a/crates/ra_lsp_server/src/conv.rs b/crates/ra_lsp_server/src/conv.rs
index 7230fb101..e8eb3940f 100644
--- a/crates/ra_lsp_server/src/conv.rs
+++ b/crates/ra_lsp_server/src/conv.rs
@@ -44,7 +44,7 @@ impl Conv for SyntaxKind {
44 SyntaxKind::TYPE_DEF => SymbolKind::TypeParameter, 44 SyntaxKind::TYPE_DEF => SymbolKind::TypeParameter,
45 SyntaxKind::STATIC_DEF => SymbolKind::Constant, 45 SyntaxKind::STATIC_DEF => SymbolKind::Constant,
46 SyntaxKind::CONST_DEF => SymbolKind::Constant, 46 SyntaxKind::CONST_DEF => SymbolKind::Constant,
47 SyntaxKind::IMPL_ITEM => SymbolKind::Object, 47 SyntaxKind::IMPL_BLOCK => SymbolKind::Object,
48 _ => SymbolKind::Variable, 48 _ => SymbolKind::Variable,
49 } 49 }
50 } 50 }
diff --git a/crates/ra_syntax/src/ast.rs b/crates/ra_syntax/src/ast.rs
index 3aaa5edda..2a3bd27e2 100644
--- a/crates/ra_syntax/src/ast.rs
+++ b/crates/ra_syntax/src/ast.rs
@@ -279,7 +279,7 @@ impl<'a> NameRef<'a> {
279 } 279 }
280} 280}
281 281
282impl<'a> ImplItem<'a> { 282impl<'a> ImplBlock<'a> {
283 pub fn target_type(self) -> Option<TypeRef<'a>> { 283 pub fn target_type(self) -> Option<TypeRef<'a>> {
284 match self.target() { 284 match self.target() {
285 (Some(t), None) | (_, Some(t)) => Some(t), 285 (Some(t), None) | (_, Some(t)) => Some(t),
@@ -482,6 +482,37 @@ impl<'a> PrefixExpr<'a> {
482 } 482 }
483} 483}
484 484
485#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
486pub enum SelfParamFlavor {
487 /// self
488 Owned,
489 /// &self
490 Ref,
491 /// &mut self
492 MutRef,
493}
494
495impl<'a> SelfParam<'a> {
496 pub fn flavor(&self) -> SelfParamFlavor {
497 let borrowed = self.syntax().children().any(|n| n.kind() == AMP);
498 if borrowed {
499 // check for a `mut` coming after the & -- `mut &self` != `&mut self`
500 if self
501 .syntax()
502 .children()
503 .skip_while(|n| n.kind() != AMP)
504 .any(|n| n.kind() == MUT_KW)
505 {
506 SelfParamFlavor::MutRef
507 } else {
508 SelfParamFlavor::Ref
509 }
510 } else {
511 SelfParamFlavor::Owned
512 }
513 }
514}
515
485#[test] 516#[test]
486fn test_doc_comment_of_items() { 517fn test_doc_comment_of_items() {
487 let file = SourceFileNode::parse( 518 let file = SourceFileNode::parse(
diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs
index c619fc130..7df6a9c46 100644
--- a/crates/ra_syntax/src/ast/generated.rs
+++ b/crates/ra_syntax/src/ast/generated.rs
@@ -1407,41 +1407,73 @@ impl<'a> IfExpr<'a> {
1407 } 1407 }
1408} 1408}
1409 1409
1410// ImplItem 1410// ImplBlock
1411#[derive(Debug, Clone, Copy,)] 1411#[derive(Debug, Clone, Copy,)]
1412pub struct ImplItemNode<R: TreeRoot<RaTypes> = OwnedRoot> { 1412pub struct ImplBlockNode<R: TreeRoot<RaTypes> = OwnedRoot> {
1413 pub(crate) syntax: SyntaxNode<R>, 1413 pub(crate) syntax: SyntaxNode<R>,
1414} 1414}
1415pub type ImplItem<'a> = ImplItemNode<RefRoot<'a>>; 1415pub type ImplBlock<'a> = ImplBlockNode<RefRoot<'a>>;
1416 1416
1417impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<ImplItemNode<R1>> for ImplItemNode<R2> { 1417impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<ImplBlockNode<R1>> for ImplBlockNode<R2> {
1418 fn eq(&self, other: &ImplItemNode<R1>) -> bool { self.syntax == other.syntax } 1418 fn eq(&self, other: &ImplBlockNode<R1>) -> bool { self.syntax == other.syntax }
1419} 1419}
1420impl<R: TreeRoot<RaTypes>> Eq for ImplItemNode<R> {} 1420impl<R: TreeRoot<RaTypes>> Eq for ImplBlockNode<R> {}
1421impl<R: TreeRoot<RaTypes>> Hash for ImplItemNode<R> { 1421impl<R: TreeRoot<RaTypes>> Hash for ImplBlockNode<R> {
1422 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } 1422 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
1423} 1423}
1424 1424
1425impl<'a> AstNode<'a> for ImplItem<'a> { 1425impl<'a> AstNode<'a> for ImplBlock<'a> {
1426 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 1426 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
1427 match syntax.kind() { 1427 match syntax.kind() {
1428 IMPL_ITEM => Some(ImplItem { syntax }), 1428 IMPL_BLOCK => Some(ImplBlock { syntax }),
1429 _ => None, 1429 _ => None,
1430 } 1430 }
1431 } 1431 }
1432 fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } 1432 fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax }
1433} 1433}
1434 1434
1435impl<R: TreeRoot<RaTypes>> ImplItemNode<R> { 1435impl<R: TreeRoot<RaTypes>> ImplBlockNode<R> {
1436 pub fn borrowed(&self) -> ImplItem { 1436 pub fn borrowed(&self) -> ImplBlock {
1437 ImplItemNode { syntax: self.syntax.borrowed() } 1437 ImplBlockNode { syntax: self.syntax.borrowed() }
1438 } 1438 }
1439 pub fn owned(&self) -> ImplItemNode { 1439 pub fn owned(&self) -> ImplBlockNode {
1440 ImplItemNode { syntax: self.syntax.owned() } 1440 ImplBlockNode { syntax: self.syntax.owned() }
1441 } 1441 }
1442} 1442}
1443 1443
1444 1444
1445impl<'a> ImplBlock<'a> {
1446 pub fn item_list(self) -> Option<ItemList<'a>> {
1447 super::child_opt(self)
1448 }
1449}
1450
1451// ImplItem
1452#[derive(Debug, Clone, Copy, PartialEq, Eq)]
1453pub enum ImplItem<'a> {
1454 FnDef(FnDef<'a>),
1455 TypeDef(TypeDef<'a>),
1456 ConstDef(ConstDef<'a>),
1457}
1458
1459impl<'a> AstNode<'a> for ImplItem<'a> {
1460 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
1461 match syntax.kind() {
1462 FN_DEF => Some(ImplItem::FnDef(FnDef { syntax })),
1463 TYPE_DEF => Some(ImplItem::TypeDef(TypeDef { syntax })),
1464 CONST_DEF => Some(ImplItem::ConstDef(ConstDef { syntax })),
1465 _ => None,
1466 }
1467 }
1468 fn syntax(self) -> SyntaxNodeRef<'a> {
1469 match self {
1470 ImplItem::FnDef(inner) => inner.syntax(),
1471 ImplItem::TypeDef(inner) => inner.syntax(),
1472 ImplItem::ConstDef(inner) => inner.syntax(),
1473 }
1474 }
1475}
1476
1445impl<'a> ImplItem<'a> {} 1477impl<'a> ImplItem<'a> {}
1446 1478
1447// ImplTraitType 1479// ImplTraitType
@@ -1555,7 +1587,11 @@ impl<R: TreeRoot<RaTypes>> ItemListNode<R> {
1555 1587
1556impl<'a> ast::FnDefOwner<'a> for ItemList<'a> {} 1588impl<'a> ast::FnDefOwner<'a> for ItemList<'a> {}
1557impl<'a> ast::ModuleItemOwner<'a> for ItemList<'a> {} 1589impl<'a> ast::ModuleItemOwner<'a> for ItemList<'a> {}
1558impl<'a> ItemList<'a> {} 1590impl<'a> ItemList<'a> {
1591 pub fn impl_items(self) -> impl Iterator<Item = ImplItem<'a>> + 'a {
1592 super::children(self)
1593 }
1594}
1559 1595
1560// Label 1596// Label
1561#[derive(Debug, Clone, Copy,)] 1597#[derive(Debug, Clone, Copy,)]
@@ -2157,7 +2193,7 @@ pub enum ModuleItem<'a> {
2157 FnDef(FnDef<'a>), 2193 FnDef(FnDef<'a>),
2158 TraitDef(TraitDef<'a>), 2194 TraitDef(TraitDef<'a>),
2159 TypeDef(TypeDef<'a>), 2195 TypeDef(TypeDef<'a>),
2160 ImplItem(ImplItem<'a>), 2196 ImplBlock(ImplBlock<'a>),
2161 UseItem(UseItem<'a>), 2197 UseItem(UseItem<'a>),
2162 ExternCrateItem(ExternCrateItem<'a>), 2198 ExternCrateItem(ExternCrateItem<'a>),
2163 ConstDef(ConstDef<'a>), 2199 ConstDef(ConstDef<'a>),
@@ -2173,7 +2209,7 @@ impl<'a> AstNode<'a> for ModuleItem<'a> {
2173 FN_DEF => Some(ModuleItem::FnDef(FnDef { syntax })), 2209 FN_DEF => Some(ModuleItem::FnDef(FnDef { syntax })),
2174 TRAIT_DEF => Some(ModuleItem::TraitDef(TraitDef { syntax })), 2210 TRAIT_DEF => Some(ModuleItem::TraitDef(TraitDef { syntax })),
2175 TYPE_DEF => Some(ModuleItem::TypeDef(TypeDef { syntax })), 2211 TYPE_DEF => Some(ModuleItem::TypeDef(TypeDef { syntax })),
2176 IMPL_ITEM => Some(ModuleItem::ImplItem(ImplItem { syntax })), 2212 IMPL_BLOCK => Some(ModuleItem::ImplBlock(ImplBlock { syntax })),
2177 USE_ITEM => Some(ModuleItem::UseItem(UseItem { syntax })), 2213 USE_ITEM => Some(ModuleItem::UseItem(UseItem { syntax })),
2178 EXTERN_CRATE_ITEM => Some(ModuleItem::ExternCrateItem(ExternCrateItem { syntax })), 2214 EXTERN_CRATE_ITEM => Some(ModuleItem::ExternCrateItem(ExternCrateItem { syntax })),
2179 CONST_DEF => Some(ModuleItem::ConstDef(ConstDef { syntax })), 2215 CONST_DEF => Some(ModuleItem::ConstDef(ConstDef { syntax })),
@@ -2189,7 +2225,7 @@ impl<'a> AstNode<'a> for ModuleItem<'a> {
2189 ModuleItem::FnDef(inner) => inner.syntax(), 2225 ModuleItem::FnDef(inner) => inner.syntax(),
2190 ModuleItem::TraitDef(inner) => inner.syntax(), 2226 ModuleItem::TraitDef(inner) => inner.syntax(),
2191 ModuleItem::TypeDef(inner) => inner.syntax(), 2227 ModuleItem::TypeDef(inner) => inner.syntax(),
2192 ModuleItem::ImplItem(inner) => inner.syntax(), 2228 ModuleItem::ImplBlock(inner) => inner.syntax(),
2193 ModuleItem::UseItem(inner) => inner.syntax(), 2229 ModuleItem::UseItem(inner) => inner.syntax(),
2194 ModuleItem::ExternCrateItem(inner) => inner.syntax(), 2230 ModuleItem::ExternCrateItem(inner) => inner.syntax(),
2195 ModuleItem::ConstDef(inner) => inner.syntax(), 2231 ModuleItem::ConstDef(inner) => inner.syntax(),
@@ -3452,6 +3488,43 @@ impl<'a> ReturnExpr<'a> {
3452 } 3488 }
3453} 3489}
3454 3490
3491// SelfKw
3492#[derive(Debug, Clone, Copy,)]
3493pub struct SelfKwNode<R: TreeRoot<RaTypes> = OwnedRoot> {
3494 pub(crate) syntax: SyntaxNode<R>,
3495}
3496pub type SelfKw<'a> = SelfKwNode<RefRoot<'a>>;
3497
3498impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<SelfKwNode<R1>> for SelfKwNode<R2> {
3499 fn eq(&self, other: &SelfKwNode<R1>) -> bool { self.syntax == other.syntax }
3500}
3501impl<R: TreeRoot<RaTypes>> Eq for SelfKwNode<R> {}
3502impl<R: TreeRoot<RaTypes>> Hash for SelfKwNode<R> {
3503 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
3504}
3505
3506impl<'a> AstNode<'a> for SelfKw<'a> {
3507 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
3508 match syntax.kind() {
3509 SELF_KW => Some(SelfKw { syntax }),
3510 _ => None,
3511 }
3512 }
3513 fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax }
3514}
3515
3516impl<R: TreeRoot<RaTypes>> SelfKwNode<R> {
3517 pub fn borrowed(&self) -> SelfKw {
3518 SelfKwNode { syntax: self.syntax.borrowed() }
3519 }
3520 pub fn owned(&self) -> SelfKwNode {
3521 SelfKwNode { syntax: self.syntax.owned() }
3522 }
3523}
3524
3525
3526impl<'a> SelfKw<'a> {}
3527
3455// SelfParam 3528// SelfParam
3456#[derive(Debug, Clone, Copy,)] 3529#[derive(Debug, Clone, Copy,)]
3457pub struct SelfParamNode<R: TreeRoot<RaTypes> = OwnedRoot> { 3530pub struct SelfParamNode<R: TreeRoot<RaTypes> = OwnedRoot> {
@@ -3487,7 +3560,15 @@ impl<R: TreeRoot<RaTypes>> SelfParamNode<R> {
3487} 3560}
3488 3561
3489 3562
3490impl<'a> SelfParam<'a> {} 3563impl<'a> SelfParam<'a> {
3564 pub fn type_ref(self) -> Option<TypeRef<'a>> {
3565 super::child_opt(self)
3566 }
3567
3568 pub fn self_kw(self) -> Option<SelfKw<'a>> {
3569 super::child_opt(self)
3570 }
3571}
3491 3572
3492// SlicePat 3573// SlicePat
3493#[derive(Debug, Clone, Copy,)] 3574#[derive(Debug, Clone, Copy,)]
diff --git a/crates/ra_syntax/src/grammar.ron b/crates/ra_syntax/src/grammar.ron
index 2abb9da61..c55e9e07a 100644
--- a/crates/ra_syntax/src/grammar.ron
+++ b/crates/ra_syntax/src/grammar.ron
@@ -128,7 +128,7 @@ Grammar(
128 "STATIC_DEF", 128 "STATIC_DEF",
129 "CONST_DEF", 129 "CONST_DEF",
130 "TRAIT_DEF", 130 "TRAIT_DEF",
131 "IMPL_ITEM", 131 "IMPL_BLOCK",
132 "TYPE_DEF", 132 "TYPE_DEF",
133 "MACRO_CALL", 133 "MACRO_CALL",
134 "TOKEN_TREE", 134 "TOKEN_TREE",
@@ -284,6 +284,7 @@ Grammar(
284 options: [ "ItemList" ] 284 options: [ "ItemList" ]
285 ), 285 ),
286 "ItemList": ( 286 "ItemList": (
287 collections: [["impl_items", "ImplItem"]],
287 traits: [ "FnDefOwner", "ModuleItemOwner" ], 288 traits: [ "FnDefOwner", "ModuleItemOwner" ],
288 ), 289 ),
289 "ConstDef": ( traits: [ 290 "ConstDef": ( traits: [
@@ -307,7 +308,7 @@ Grammar(
307 "AttrsOwner", 308 "AttrsOwner",
308 "DocCommentsOwner" 309 "DocCommentsOwner"
309 ] ), 310 ] ),
310 "ImplItem": (), 311 "ImplBlock": (options: ["ItemList"]),
311 312
312 "ParenType": (options: ["TypeRef"]), 313 "ParenType": (options: ["TypeRef"]),
313 "TupleType": ( collections: [["fields", "TypeRef"]] ), 314 "TupleType": ( collections: [["fields", "TypeRef"]] ),
@@ -348,9 +349,12 @@ Grammar(
348 ], 349 ],
349 ), 350 ),
350 "ModuleItem": ( 351 "ModuleItem": (
351 enum: ["StructDef", "EnumDef", "FnDef", "TraitDef", "TypeDef", "ImplItem", 352 enum: ["StructDef", "EnumDef", "FnDef", "TraitDef", "TypeDef", "ImplBlock",
352 "UseItem", "ExternCrateItem", "ConstDef", "StaticDef", "Module" ] 353 "UseItem", "ExternCrateItem", "ConstDef", "StaticDef", "Module" ]
353 ), 354 ),
355 "ImplItem": (
356 enum: ["FnDef", "TypeDef", "ConstDef"]
357 ),
354 358
355 "TupleExpr": (), 359 "TupleExpr": (),
356 "ArrayExpr": (), 360 "ArrayExpr": (),
@@ -530,7 +534,8 @@ Grammar(
530 ["params", "Param"] 534 ["params", "Param"]
531 ] 535 ]
532 ), 536 ),
533 "SelfParam": (), 537 "SelfParam": (options: ["TypeRef", "SelfKw"]),
538 "SelfKw": (),
534 "Param": ( 539 "Param": (
535 options: [ "Pat", "TypeRef" ], 540 options: [ "Pat", "TypeRef" ],
536 ), 541 ),
diff --git a/crates/ra_syntax/src/grammar/items.rs b/crates/ra_syntax/src/grammar/items.rs
index aa5fe0777..265e84570 100644
--- a/crates/ra_syntax/src/grammar/items.rs
+++ b/crates/ra_syntax/src/grammar/items.rs
@@ -151,8 +151,8 @@ pub(super) fn maybe_item(p: &mut Parser, flavor: ItemFlavor) -> MaybeItem {
151 // test unsafe_default_impl 151 // test unsafe_default_impl
152 // unsafe default impl Foo {} 152 // unsafe default impl Foo {}
153 IMPL_KW => { 153 IMPL_KW => {
154 traits::impl_item(p); 154 traits::impl_block(p);
155 IMPL_ITEM 155 IMPL_BLOCK
156 } 156 }
157 _ => { 157 _ => {
158 return if has_mods { 158 return if has_mods {
diff --git a/crates/ra_syntax/src/grammar/items/traits.rs b/crates/ra_syntax/src/grammar/items/traits.rs
index d4da8b2f7..0a0621753 100644
--- a/crates/ra_syntax/src/grammar/items/traits.rs
+++ b/crates/ra_syntax/src/grammar/items/traits.rs
@@ -40,9 +40,9 @@ pub(crate) fn trait_item_list(p: &mut Parser) {
40 m.complete(p, ITEM_LIST); 40 m.complete(p, ITEM_LIST);
41} 41}
42 42
43// test impl_item 43// test impl_block
44// impl Foo {} 44// impl Foo {}
45pub(super) fn impl_item(p: &mut Parser) { 45pub(super) fn impl_block(p: &mut Parser) {
46 assert!(p.at(IMPL_KW)); 46 assert!(p.at(IMPL_KW));
47 p.bump(); 47 p.bump();
48 if choose_type_params_over_qpath(p) { 48 if choose_type_params_over_qpath(p) {
@@ -52,7 +52,7 @@ pub(super) fn impl_item(p: &mut Parser) {
52 // TODO: never type 52 // TODO: never type
53 // impl ! {} 53 // impl ! {}
54 54
55 // test impl_item_neg 55 // test impl_block_neg
56 // impl !Send for X {} 56 // impl !Send for X {}
57 p.eat(EXCL); 57 p.eat(EXCL);
58 impl_type(p); 58 impl_type(p);
diff --git a/crates/ra_syntax/src/reparsing.rs b/crates/ra_syntax/src/reparsing.rs
index 208cae5c8..7ee71a1b6 100644
--- a/crates/ra_syntax/src/reparsing.rs
+++ b/crates/ra_syntax/src/reparsing.rs
@@ -100,7 +100,7 @@ fn find_reparsable_node(
100 ITEM_LIST => { 100 ITEM_LIST => {
101 let parent = node.parent().unwrap(); 101 let parent = node.parent().unwrap();
102 match parent.kind() { 102 match parent.kind() {
103 IMPL_ITEM => grammar::impl_item_list, 103 IMPL_BLOCK => grammar::impl_item_list,
104 TRAIT_DEF => grammar::trait_item_list, 104 TRAIT_DEF => grammar::trait_item_list,
105 MODULE => grammar::mod_item_list, 105 MODULE => grammar::mod_item_list,
106 _ => return None, 106 _ => return None,
diff --git a/crates/ra_syntax/src/syntax_kinds/generated.rs b/crates/ra_syntax/src/syntax_kinds/generated.rs
index 3a869ad34..ef4588d93 100644
--- a/crates/ra_syntax/src/syntax_kinds/generated.rs
+++ b/crates/ra_syntax/src/syntax_kinds/generated.rs
@@ -128,7 +128,7 @@ pub enum SyntaxKind {
128 STATIC_DEF, 128 STATIC_DEF,
129 CONST_DEF, 129 CONST_DEF,
130 TRAIT_DEF, 130 TRAIT_DEF,
131 IMPL_ITEM, 131 IMPL_BLOCK,
132 TYPE_DEF, 132 TYPE_DEF,
133 MACRO_CALL, 133 MACRO_CALL,
134 TOKEN_TREE, 134 TOKEN_TREE,
@@ -389,7 +389,7 @@ impl SyntaxKind {
389 STATIC_DEF => &SyntaxInfo { name: "STATIC_DEF" }, 389 STATIC_DEF => &SyntaxInfo { name: "STATIC_DEF" },
390 CONST_DEF => &SyntaxInfo { name: "CONST_DEF" }, 390 CONST_DEF => &SyntaxInfo { name: "CONST_DEF" },
391 TRAIT_DEF => &SyntaxInfo { name: "TRAIT_DEF" }, 391 TRAIT_DEF => &SyntaxInfo { name: "TRAIT_DEF" },
392 IMPL_ITEM => &SyntaxInfo { name: "IMPL_ITEM" }, 392 IMPL_BLOCK => &SyntaxInfo { name: "IMPL_BLOCK" },
393 TYPE_DEF => &SyntaxInfo { name: "TYPE_DEF" }, 393 TYPE_DEF => &SyntaxInfo { name: "TYPE_DEF" },
394 MACRO_CALL => &SyntaxInfo { name: "MACRO_CALL" }, 394 MACRO_CALL => &SyntaxInfo { name: "MACRO_CALL" },
395 TOKEN_TREE => &SyntaxInfo { name: "TOKEN_TREE" }, 395 TOKEN_TREE => &SyntaxInfo { name: "TOKEN_TREE" },
diff --git a/crates/ra_syntax/tests/data/parser/err/0018_incomplete_fn.txt b/crates/ra_syntax/tests/data/parser/err/0018_incomplete_fn.txt
index 3937be255..262cbba1e 100644
--- a/crates/ra_syntax/tests/data/parser/err/0018_incomplete_fn.txt
+++ b/crates/ra_syntax/tests/data/parser/err/0018_incomplete_fn.txt
@@ -1,5 +1,5 @@
1SOURCE_FILE@[0; 183) 1SOURCE_FILE@[0; 183)
2 IMPL_ITEM@[0; 182) 2 IMPL_BLOCK@[0; 182)
3 IMPL_KW@[0; 4) 3 IMPL_KW@[0; 4)
4 WHITESPACE@[4; 5) 4 WHITESPACE@[4; 5)
5 PATH_TYPE@[5; 13) 5 PATH_TYPE@[5; 13)
diff --git a/crates/ra_syntax/tests/data/parser/err/0022_bad_exprs.txt b/crates/ra_syntax/tests/data/parser/err/0022_bad_exprs.txt
index 55999c160..da3894133 100644
--- a/crates/ra_syntax/tests/data/parser/err/0022_bad_exprs.txt
+++ b/crates/ra_syntax/tests/data/parser/err/0022_bad_exprs.txt
@@ -94,7 +94,7 @@ SOURCE_FILE@[0; 112)
94 COMMA@[54; 55) 94 COMMA@[54; 55)
95 err: `expected SEMI` 95 err: `expected SEMI`
96 WHITESPACE@[55; 56) 96 WHITESPACE@[55; 56)
97 IMPL_ITEM@[56; 60) 97 IMPL_BLOCK@[56; 60)
98 IMPL_KW@[56; 60) 98 IMPL_KW@[56; 60)
99 err: `expected type` 99 err: `expected type`
100 err: `expected `{`` 100 err: `expected `{``
diff --git a/crates/ra_syntax/tests/data/parser/err/0026_imp_recovery.txt b/crates/ra_syntax/tests/data/parser/err/0026_imp_recovery.txt
index 82683f6ee..9b5fadcf7 100644
--- a/crates/ra_syntax/tests/data/parser/err/0026_imp_recovery.txt
+++ b/crates/ra_syntax/tests/data/parser/err/0026_imp_recovery.txt
@@ -1,5 +1,5 @@
1SOURCE_FILE@[0; 38) 1SOURCE_FILE@[0; 38)
2 IMPL_ITEM@[0; 14) 2 IMPL_BLOCK@[0; 14)
3 IMPL_KW@[0; 4) 3 IMPL_KW@[0; 4)
4 TYPE_PARAM_LIST@[4; 14) 4 TYPE_PARAM_LIST@[4; 14)
5 L_ANGLE@[4; 5) 5 L_ANGLE@[4; 5)
@@ -17,7 +17,7 @@ SOURCE_FILE@[0; 38)
17 err: `expected trait or type` 17 err: `expected trait or type`
18 err: `expected `{`` 18 err: `expected `{``
19 WHITESPACE@[14; 15) 19 WHITESPACE@[14; 15)
20 IMPL_ITEM@[15; 37) 20 IMPL_BLOCK@[15; 37)
21 IMPL_KW@[15; 19) 21 IMPL_KW@[15; 19)
22 TYPE_PARAM_LIST@[19; 22) 22 TYPE_PARAM_LIST@[19; 22)
23 L_ANGLE@[19; 20) 23 L_ANGLE@[19; 20)
diff --git a/crates/ra_syntax/tests/data/parser/inline/err/0002_misplaced_label_err.txt b/crates/ra_syntax/tests/data/parser/inline/err/0002_misplaced_label_err.txt
index 75533ecc1..8021aee00 100644
--- a/crates/ra_syntax/tests/data/parser/inline/err/0002_misplaced_label_err.txt
+++ b/crates/ra_syntax/tests/data/parser/inline/err/0002_misplaced_label_err.txt
@@ -19,7 +19,7 @@ SOURCE_FILE@[0; 30)
19 err: `expected a loop` 19 err: `expected a loop`
20 err: `expected SEMI` 20 err: `expected SEMI`
21 WHITESPACE@[22; 23) 21 WHITESPACE@[22; 23)
22 IMPL_ITEM@[23; 27) 22 IMPL_BLOCK@[23; 27)
23 IMPL_KW@[23; 27) 23 IMPL_KW@[23; 27)
24 err: `expected type` 24 err: `expected type`
25 err: `expected `{`` 25 err: `expected `{``
diff --git a/crates/ra_syntax/tests/data/parser/inline/err/0004_impl_type.txt b/crates/ra_syntax/tests/data/parser/inline/err/0004_impl_type.txt
index 7279d5cae..6875ed016 100644
--- a/crates/ra_syntax/tests/data/parser/inline/err/0004_impl_type.txt
+++ b/crates/ra_syntax/tests/data/parser/inline/err/0004_impl_type.txt
@@ -1,5 +1,5 @@
1SOURCE_FILE@[0; 87) 1SOURCE_FILE@[0; 87)
2 IMPL_ITEM@[0; 12) 2 IMPL_BLOCK@[0; 12)
3 IMPL_KW@[0; 4) 3 IMPL_KW@[0; 4)
4 WHITESPACE@[4; 5) 4 WHITESPACE@[4; 5)
5 PATH_TYPE@[5; 9) 5 PATH_TYPE@[5; 9)
@@ -12,7 +12,7 @@ SOURCE_FILE@[0; 87)
12 L_CURLY@[10; 11) 12 L_CURLY@[10; 11)
13 R_CURLY@[11; 12) 13 R_CURLY@[11; 12)
14 WHITESPACE@[12; 13) 14 WHITESPACE@[12; 13)
15 IMPL_ITEM@[13; 33) 15 IMPL_BLOCK@[13; 33)
16 IMPL_KW@[13; 17) 16 IMPL_KW@[13; 17)
17 WHITESPACE@[17; 18) 17 WHITESPACE@[17; 18)
18 PATH_TYPE@[18; 24) 18 PATH_TYPE@[18; 24)
@@ -33,12 +33,12 @@ SOURCE_FILE@[0; 87)
33 L_CURLY@[31; 32) 33 L_CURLY@[31; 32)
34 R_CURLY@[32; 33) 34 R_CURLY@[32; 33)
35 WHITESPACE@[33; 34) 35 WHITESPACE@[33; 34)
36 IMPL_ITEM@[34; 38) 36 IMPL_BLOCK@[34; 38)
37 IMPL_KW@[34; 38) 37 IMPL_KW@[34; 38)
38 err: `expected trait or type` 38 err: `expected trait or type`
39 err: `expected `{`` 39 err: `expected `{``
40 WHITESPACE@[38; 39) 40 WHITESPACE@[38; 39)
41 IMPL_ITEM@[39; 54) 41 IMPL_BLOCK@[39; 54)
42 IMPL_KW@[39; 43) 42 IMPL_KW@[39; 43)
43 WHITESPACE@[43; 44) 43 WHITESPACE@[43; 44)
44 PATH_TYPE@[44; 51) 44 PATH_TYPE@[44; 51)
@@ -51,7 +51,7 @@ SOURCE_FILE@[0; 87)
51 L_CURLY@[52; 53) 51 L_CURLY@[52; 53)
52 R_CURLY@[53; 54) 52 R_CURLY@[53; 54)
53 WHITESPACE@[54; 55) 53 WHITESPACE@[54; 55)
54 IMPL_ITEM@[55; 70) 54 IMPL_BLOCK@[55; 70)
55 IMPL_KW@[55; 59) 55 IMPL_KW@[55; 59)
56 WHITESPACE@[59; 60) 56 WHITESPACE@[59; 60)
57 PATH_TYPE@[60; 66) 57 PATH_TYPE@[60; 66)
@@ -64,7 +64,7 @@ SOURCE_FILE@[0; 87)
64 err: `expected trait or type` 64 err: `expected trait or type`
65 err: `expected `{`` 65 err: `expected `{``
66 WHITESPACE@[70; 71) 66 WHITESPACE@[70; 71)
67 IMPL_ITEM@[71; 86) 67 IMPL_BLOCK@[71; 86)
68 IMPL_KW@[71; 75) 68 IMPL_KW@[71; 75)
69 WHITESPACE@[75; 76) 69 WHITESPACE@[75; 76)
70 PATH_TYPE@[76; 83) 70 PATH_TYPE@[76; 83)
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0001_trait_item_list.txt b/crates/ra_syntax/tests/data/parser/inline/ok/0001_trait_item_list.txt
index 998ac3da9..de7df7312 100644
--- a/crates/ra_syntax/tests/data/parser/inline/ok/0001_trait_item_list.txt
+++ b/crates/ra_syntax/tests/data/parser/inline/ok/0001_trait_item_list.txt
@@ -1,5 +1,5 @@
1SOURCE_FILE@[0; 83) 1SOURCE_FILE@[0; 83)
2 IMPL_ITEM@[0; 82) 2 IMPL_BLOCK@[0; 82)
3 IMPL_KW@[0; 4) 3 IMPL_KW@[0; 4)
4 WHITESPACE@[4; 5) 4 WHITESPACE@[4; 5)
5 PATH_TYPE@[5; 6) 5 PATH_TYPE@[5; 6)
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0006_self_param.txt b/crates/ra_syntax/tests/data/parser/inline/ok/0006_self_param.txt
index 53027c852..4df01c6e5 100644
--- a/crates/ra_syntax/tests/data/parser/inline/ok/0006_self_param.txt
+++ b/crates/ra_syntax/tests/data/parser/inline/ok/0006_self_param.txt
@@ -1,5 +1,5 @@
1SOURCE_FILE@[0; 128) 1SOURCE_FILE@[0; 128)
2 IMPL_ITEM@[0; 127) 2 IMPL_BLOCK@[0; 127)
3 IMPL_KW@[0; 4) 3 IMPL_KW@[0; 4)
4 WHITESPACE@[4; 5) 4 WHITESPACE@[4; 5)
5 PATH_TYPE@[5; 6) 5 PATH_TYPE@[5; 6)
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0018_arb_self_types.txt b/crates/ra_syntax/tests/data/parser/inline/ok/0018_arb_self_types.txt
index b2f04ea7b..03139f7a4 100644
--- a/crates/ra_syntax/tests/data/parser/inline/ok/0018_arb_self_types.txt
+++ b/crates/ra_syntax/tests/data/parser/inline/ok/0018_arb_self_types.txt
@@ -1,5 +1,5 @@
1SOURCE_FILE@[0; 69) 1SOURCE_FILE@[0; 69)
2 IMPL_ITEM@[0; 68) 2 IMPL_BLOCK@[0; 68)
3 IMPL_KW@[0; 4) 3 IMPL_KW@[0; 4)
4 WHITESPACE@[4; 5) 4 WHITESPACE@[4; 5)
5 PATH_TYPE@[5; 6) 5 PATH_TYPE@[5; 6)
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0021_impl_item_list.txt b/crates/ra_syntax/tests/data/parser/inline/ok/0021_impl_item_list.txt
index b15f93cd2..50426bdfe 100644
--- a/crates/ra_syntax/tests/data/parser/inline/ok/0021_impl_item_list.txt
+++ b/crates/ra_syntax/tests/data/parser/inline/ok/0021_impl_item_list.txt
@@ -1,5 +1,5 @@
1SOURCE_FILE@[0; 89) 1SOURCE_FILE@[0; 89)
2 IMPL_ITEM@[0; 88) 2 IMPL_BLOCK@[0; 88)
3 IMPL_KW@[0; 4) 3 IMPL_KW@[0; 4)
4 WHITESPACE@[4; 5) 4 WHITESPACE@[4; 5)
5 PATH_TYPE@[5; 6) 5 PATH_TYPE@[5; 6)
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0047_unsafe_default_impl.txt b/crates/ra_syntax/tests/data/parser/inline/ok/0047_unsafe_default_impl.txt
index 6003ba645..5d68e88d6 100644
--- a/crates/ra_syntax/tests/data/parser/inline/ok/0047_unsafe_default_impl.txt
+++ b/crates/ra_syntax/tests/data/parser/inline/ok/0047_unsafe_default_impl.txt
@@ -1,5 +1,5 @@
1SOURCE_FILE@[0; 27) 1SOURCE_FILE@[0; 27)
2 IMPL_ITEM@[0; 26) 2 IMPL_BLOCK@[0; 26)
3 UNSAFE_KW@[0; 6) 3 UNSAFE_KW@[0; 6)
4 WHITESPACE@[6; 7) 4 WHITESPACE@[6; 7)
5 DEFAULT_KW@[7; 14) 5 DEFAULT_KW@[7; 14)
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0063_impl_item_neg.rs b/crates/ra_syntax/tests/data/parser/inline/ok/0063_impl_block_neg.rs
index b7527c870..b7527c870 100644
--- a/crates/ra_syntax/tests/data/parser/inline/ok/0063_impl_item_neg.rs
+++ b/crates/ra_syntax/tests/data/parser/inline/ok/0063_impl_block_neg.rs
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0063_impl_item_neg.txt b/crates/ra_syntax/tests/data/parser/inline/ok/0063_impl_block_neg.txt
index b83db380e..563e43508 100644
--- a/crates/ra_syntax/tests/data/parser/inline/ok/0063_impl_item_neg.txt
+++ b/crates/ra_syntax/tests/data/parser/inline/ok/0063_impl_block_neg.txt
@@ -1,5 +1,5 @@
1SOURCE_FILE@[0; 20) 1SOURCE_FILE@[0; 20)
2 IMPL_ITEM@[0; 19) 2 IMPL_BLOCK@[0; 19)
3 IMPL_KW@[0; 4) 3 IMPL_KW@[0; 4)
4 WHITESPACE@[4; 5) 4 WHITESPACE@[4; 5)
5 EXCL@[5; 6) 5 EXCL@[5; 6)
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0079_impl_item.rs b/crates/ra_syntax/tests/data/parser/inline/ok/0079_impl_block.rs
index d6337f6b3..d6337f6b3 100644
--- a/crates/ra_syntax/tests/data/parser/inline/ok/0079_impl_item.rs
+++ b/crates/ra_syntax/tests/data/parser/inline/ok/0079_impl_block.rs
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0079_impl_item.txt b/crates/ra_syntax/tests/data/parser/inline/ok/0079_impl_block.txt
index 1b9a8aa0e..a2c218aa9 100644
--- a/crates/ra_syntax/tests/data/parser/inline/ok/0079_impl_item.txt
+++ b/crates/ra_syntax/tests/data/parser/inline/ok/0079_impl_block.txt
@@ -1,5 +1,5 @@
1SOURCE_FILE@[0; 12) 1SOURCE_FILE@[0; 12)
2 IMPL_ITEM@[0; 11) 2 IMPL_BLOCK@[0; 11)
3 IMPL_KW@[0; 4) 3 IMPL_KW@[0; 4)
4 WHITESPACE@[4; 5) 4 WHITESPACE@[4; 5)
5 PATH_TYPE@[5; 8) 5 PATH_TYPE@[5; 8)
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0087_unsafe_impl.txt b/crates/ra_syntax/tests/data/parser/inline/ok/0087_unsafe_impl.txt
index f9c96c242..d93c0df4d 100644
--- a/crates/ra_syntax/tests/data/parser/inline/ok/0087_unsafe_impl.txt
+++ b/crates/ra_syntax/tests/data/parser/inline/ok/0087_unsafe_impl.txt
@@ -1,5 +1,5 @@
1SOURCE_FILE@[0; 19) 1SOURCE_FILE@[0; 19)
2 IMPL_ITEM@[0; 18) 2 IMPL_BLOCK@[0; 18)
3 UNSAFE_KW@[0; 6) 3 UNSAFE_KW@[0; 6)
4 WHITESPACE@[6; 7) 4 WHITESPACE@[6; 7)
5 IMPL_KW@[7; 11) 5 IMPL_KW@[7; 11)
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0097_default_impl.txt b/crates/ra_syntax/tests/data/parser/inline/ok/0097_default_impl.txt
index f45b6251f..0b9af800b 100644
--- a/crates/ra_syntax/tests/data/parser/inline/ok/0097_default_impl.txt
+++ b/crates/ra_syntax/tests/data/parser/inline/ok/0097_default_impl.txt
@@ -1,5 +1,5 @@
1SOURCE_FILE@[0; 20) 1SOURCE_FILE@[0; 20)
2 IMPL_ITEM@[0; 19) 2 IMPL_BLOCK@[0; 19)
3 DEFAULT_KW@[0; 7) 3 DEFAULT_KW@[0; 7)
4 WHITESPACE@[7; 8) 4 WHITESPACE@[7; 8)
5 IMPL_KW@[8; 12) 5 IMPL_KW@[8; 12)
diff --git a/crates/ra_syntax/tests/data/parser/ok/0037_mod.txt b/crates/ra_syntax/tests/data/parser/ok/0037_mod.txt
index e11c4a06d..f8a20ac53 100644
--- a/crates/ra_syntax/tests/data/parser/ok/0037_mod.txt
+++ b/crates/ra_syntax/tests/data/parser/ok/0037_mod.txt
@@ -14,4 +14,3 @@ SOURCE_FILE@[0; 93)
14 ITEM_LIST@[91; 93) 14 ITEM_LIST@[91; 93)
15 L_CURLY@[91; 92) 15 L_CURLY@[91; 92)
16 R_CURLY@[92; 93) 16 R_CURLY@[92; 93)
17