aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.lock197
-rw-r--r--crates/ra_cli/src/main.rs8
-rw-r--r--crates/ra_hir/src/adt.rs7
-rw-r--r--crates/ra_hir/src/code_model.rs (renamed from crates/ra_hir/src/code_model_api.rs)391
-rw-r--r--crates/ra_hir/src/code_model_impl.rs4
-rw-r--r--crates/ra_hir/src/code_model_impl/function.rs50
-rw-r--r--crates/ra_hir/src/code_model_impl/konst.rs34
-rw-r--r--crates/ra_hir/src/code_model_impl/krate.rs22
-rw-r--r--crates/ra_hir/src/code_model_impl/module.rs99
-rw-r--r--crates/ra_hir/src/generics.rs13
-rw-r--r--crates/ra_hir/src/impl_block.rs2
-rw-r--r--crates/ra_hir/src/lib.rs7
-rw-r--r--crates/ra_hir/src/nameres/collector.rs6
-rw-r--r--crates/ra_hir/src/nameres/raw.rs19
-rw-r--r--crates/ra_hir/src/resolve.rs2
-rw-r--r--crates/ra_hir/src/ty.rs1
-rw-r--r--crates/ra_hir/src/ty/infer.rs21
-rw-r--r--crates/ra_hir/src/ty/lower.rs10
-rw-r--r--crates/ra_ide_api/src/completion/complete_dot.rs252
-rw-r--r--crates/ra_ide_api/src/completion/complete_fn_param.rs60
-rw-r--r--crates/ra_ide_api/src/completion/complete_pattern.rs62
-rw-r--r--crates/ra_ide_api/src/completion/complete_struct_literal.rs23
-rw-r--r--crates/ra_ide_api/src/completion/presentation.rs1
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__bindings_from_for.snap10
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__bindings_from_if_let.snap12
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__bindings_from_let.snap12
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__completes_break_and_continue_in_loops1.snap20
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__completes_break_and_continue_in_loops2.snap16
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__completes_prelude.snap12
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__completes_use_paths_across_crates.snap8
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__deeply_nested_use_tree.snap8
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__dont_add_semi_after_return_if_not_a_statement.snap16
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__dont_render_function_parens_if_already_call.snap10
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__dont_render_function_parens_if_already_call_assoc_fn.snap8
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__dont_render_function_parens_in_use_item.snap8
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__dont_show_both_completions_for_shadowing.snap10
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__enum_variant.snap14
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__enum_variant_with_details.snap18
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__extern_prelude.snap8
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__generic_params.snap10
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__generic_params_in_struct.snap10
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__inserts_parens_for_function_calls1.snap10
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__inserts_parens_for_function_calls2.snap10
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__inserts_parens_for_function_calls3.snap8
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_function1.snap16
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_function2.snap20
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_function3.snap16
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_function4.snap16
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_use_stmt1.snap12
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_use_stmt2.snap10
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_use_stmt3.snap10
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__last_return_in_block_has_semi1.snap16
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__last_return_in_block_has_semi2.snap16
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__mod_with_docs.snap10
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__module_items.snap12
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__module_items_in_nested_modules.snap10
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__nested_use_tree.snap10
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__no_semi_after_break_continue_in_expr.snap20
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__postfix_completion_works_for_trivial_path_expression.snap20
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__return_type.snap10
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__self_in_methods.snap10
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__snippets_in_expressions.snap10
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__snippets_in_items.snap10
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__struct_associated_const.snap10
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__struct_associated_method.snap10
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__struct_associated_type.snap10
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__use_item_starting_with_crate.snap10
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__use_item_starting_with_self.snap8
-rw-r--r--crates/ra_ide_api/src/diagnostics.rs46
-rw-r--r--crates/ra_ide_api/src/display/navigation_target.rs8
-rw-r--r--crates/ra_ide_api/src/display/snapshots/tests__file_structure.snap68
-rw-r--r--crates/ra_ide_api/src/lib.rs5
-rw-r--r--crates/ra_ide_api/src/snapshots/highlighting.html45
-rw-r--r--crates/ra_ide_api/src/snapshots/tests__highlighting.snap146
-rw-r--r--crates/ra_ide_api/src/snapshots/tests__rename_mod.snap30
-rw-r--r--crates/ra_ide_api/src/snapshots/tests__rename_mod_in_dir.snap30
-rw-r--r--crates/ra_ide_api/src/snapshots/tests__runnables.snap18
-rw-r--r--crates/ra_ide_api/src/snapshots/tests__runnables_module.snap16
-rw-r--r--crates/ra_ide_api/src/snapshots/tests__runnables_multiple_depth_module.snap16
-rw-r--r--crates/ra_ide_api/src/snapshots/tests__runnables_one_depth_layer_module.snap16
-rw-r--r--crates/ra_ide_api/src/syntax_highlighting.rs91
-rw-r--r--crates/ra_parser/src/grammar/items.rs4
-rw-r--r--crates/ra_parser/src/grammar/items/traits.rs4
-rw-r--r--crates/ra_parser/src/grammar/type_params.rs4
-rw-r--r--crates/ra_parser/src/grammar/types.rs4
-rw-r--r--docs/user/README.md19
86 files changed, 1213 insertions, 1188 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 9502fed45..a61aec4e1 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -29,27 +29,26 @@ name = "atty"
29version = "0.2.11" 29version = "0.2.11"
30source = "registry+https://github.com/rust-lang/crates.io-index" 30source = "registry+https://github.com/rust-lang/crates.io-index"
31dependencies = [ 31dependencies = [
32 "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", 32 "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)",
33 "termion 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)", 33 "termion 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
34 "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", 34 "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
35] 35]
36 36
37[[package]] 37[[package]]
38name = "autocfg" 38name = "autocfg"
39version = "0.1.2" 39version = "0.1.4"
40source = "registry+https://github.com/rust-lang/crates.io-index" 40source = "registry+https://github.com/rust-lang/crates.io-index"
41 41
42[[package]] 42[[package]]
43name = "backtrace" 43name = "backtrace"
44version = "0.3.15" 44version = "0.3.20"
45source = "registry+https://github.com/rust-lang/crates.io-index" 45source = "registry+https://github.com/rust-lang/crates.io-index"
46dependencies = [ 46dependencies = [
47 "autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", 47 "autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
48 "backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", 48 "backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)",
49 "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", 49 "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
50 "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", 50 "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)",
51 "rustc-demangle 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", 51 "rustc-demangle 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
52 "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
53] 52]
54 53
55[[package]] 54[[package]]
@@ -57,8 +56,8 @@ name = "backtrace-sys"
57version = "0.1.28" 56version = "0.1.28"
58source = "registry+https://github.com/rust-lang/crates.io-index" 57source = "registry+https://github.com/rust-lang/crates.io-index"
59dependencies = [ 58dependencies = [
60 "cc 1.0.36 (registry+https://github.com/rust-lang/crates.io-index)", 59 "cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)",
61 "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", 60 "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)",
62] 61]
63 62
64[[package]] 63[[package]]
@@ -121,7 +120,7 @@ name = "cargo_metadata"
121version = "0.7.4" 120version = "0.7.4"
122source = "registry+https://github.com/rust-lang/crates.io-index" 121source = "registry+https://github.com/rust-lang/crates.io-index"
123dependencies = [ 122dependencies = [
124 "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", 123 "error-chain 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)",
125 "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", 124 "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
126 "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", 125 "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)",
127 "serde_derive 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", 126 "serde_derive 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -130,12 +129,12 @@ dependencies = [
130 129
131[[package]] 130[[package]]
132name = "cc" 131name = "cc"
133version = "1.0.36" 132version = "1.0.37"
134source = "registry+https://github.com/rust-lang/crates.io-index" 133source = "registry+https://github.com/rust-lang/crates.io-index"
135 134
136[[package]] 135[[package]]
137name = "cfg-if" 136name = "cfg-if"
138version = "0.1.7" 137version = "0.1.9"
139source = "registry+https://github.com/rust-lang/crates.io-index" 138source = "registry+https://github.com/rust-lang/crates.io-index"
140 139
141[[package]] 140[[package]]
@@ -198,8 +197,8 @@ name = "chrono"
198version = "0.4.6" 197version = "0.4.6"
199source = "registry+https://github.com/rust-lang/crates.io-index" 198source = "registry+https://github.com/rust-lang/crates.io-index"
200dependencies = [ 199dependencies = [
201 "num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", 200 "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)",
202 "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", 201 "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
203 "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", 202 "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)",
204 "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", 203 "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)",
205] 204]
@@ -230,7 +229,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
230dependencies = [ 229dependencies = [
231 "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", 230 "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
232 "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", 231 "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
233 "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", 232 "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)",
234 "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", 233 "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
235] 234]
236 235
@@ -256,8 +255,8 @@ dependencies = [
256 "clicolors-control 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", 255 "clicolors-control 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
257 "encode_unicode 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", 256 "encode_unicode 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
258 "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", 257 "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
259 "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", 258 "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)",
260 "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", 259 "parking_lot 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
261 "regex 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)", 260 "regex 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
262 "termios 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 261 "termios 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
263 "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", 262 "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -288,7 +287,7 @@ version = "0.3.1"
288source = "registry+https://github.com/rust-lang/crates.io-index" 287source = "registry+https://github.com/rust-lang/crates.io-index"
289dependencies = [ 288dependencies = [
290 "arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", 289 "arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)",
291 "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", 290 "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
292 "crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", 291 "crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
293 "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", 292 "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
294 "memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", 293 "memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -301,7 +300,7 @@ name = "crossbeam-utils"
301version = "0.2.2" 300version = "0.2.2"
302source = "registry+https://github.com/rust-lang/crates.io-index" 301source = "registry+https://github.com/rust-lang/crates.io-index"
303dependencies = [ 302dependencies = [
304 "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", 303 "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
305] 304]
306 305
307[[package]] 306[[package]]
@@ -309,7 +308,7 @@ name = "crossbeam-utils"
309version = "0.6.5" 308version = "0.6.5"
310source = "registry+https://github.com/rust-lang/crates.io-index" 309source = "registry+https://github.com/rust-lang/crates.io-index"
311dependencies = [ 310dependencies = [
312 "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", 311 "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
313 "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", 312 "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
314] 313]
315 314
@@ -379,10 +378,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
379 378
380[[package]] 379[[package]]
381name = "error-chain" 380name = "error-chain"
382version = "0.12.0" 381version = "0.12.1"
383source = "registry+https://github.com/rust-lang/crates.io-index" 382source = "registry+https://github.com/rust-lang/crates.io-index"
384dependencies = [ 383dependencies = [
385 "backtrace 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", 384 "backtrace 0.3.20 (registry+https://github.com/rust-lang/crates.io-index)",
385 "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
386] 386]
387 387
388[[package]] 388[[package]]
@@ -390,7 +390,7 @@ name = "failure"
390version = "0.1.5" 390version = "0.1.5"
391source = "registry+https://github.com/rust-lang/crates.io-index" 391source = "registry+https://github.com/rust-lang/crates.io-index"
392dependencies = [ 392dependencies = [
393 "backtrace 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", 393 "backtrace 0.3.20 (registry+https://github.com/rust-lang/crates.io-index)",
394 "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", 394 "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
395] 395]
396 396
@@ -402,7 +402,7 @@ dependencies = [
402 "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", 402 "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)",
403 "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", 403 "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)",
404 "syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)", 404 "syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)",
405 "synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", 405 "synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)",
406] 406]
407 407
408[[package]] 408[[package]]
@@ -415,8 +415,8 @@ name = "filetime"
415version = "0.2.5" 415version = "0.2.5"
416source = "registry+https://github.com/rust-lang/crates.io-index" 416source = "registry+https://github.com/rust-lang/crates.io-index"
417dependencies = [ 417dependencies = [
418 "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", 418 "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
419 "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", 419 "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)",
420 "redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)", 420 "redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)",
421] 421]
422 422
@@ -427,7 +427,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
427 427
428[[package]] 428[[package]]
429name = "flexi_logger" 429name = "flexi_logger"
430version = "0.11.4" 430version = "0.11.5"
431source = "registry+https://github.com/rust-lang/crates.io-index" 431source = "registry+https://github.com/rust-lang/crates.io-index"
432dependencies = [ 432dependencies = [
433 "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", 433 "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -455,7 +455,7 @@ name = "fsevent-sys"
455version = "2.0.1" 455version = "2.0.1"
456source = "registry+https://github.com/rust-lang/crates.io-index" 456source = "registry+https://github.com/rust-lang/crates.io-index"
457dependencies = [ 457dependencies = [
458 "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", 458 "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)",
459] 459]
460 460
461[[package]] 461[[package]]
@@ -491,7 +491,7 @@ version = "0.2.0"
491dependencies = [ 491dependencies = [
492 "crossbeam-channel 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", 492 "crossbeam-channel 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
493 "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", 493 "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
494 "flexi_logger 0.11.4 (registry+https://github.com/rust-lang/crates.io-index)", 494 "flexi_logger 0.11.5 (registry+https://github.com/rust-lang/crates.io-index)",
495 "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", 495 "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
496 "lsp-types 0.57.1 (registry+https://github.com/rust-lang/crates.io-index)", 496 "lsp-types 0.57.1 (registry+https://github.com/rust-lang/crates.io-index)",
497 "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", 497 "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -521,7 +521,7 @@ name = "heck"
521version = "0.3.1" 521version = "0.3.1"
522source = "registry+https://github.com/rust-lang/crates.io-index" 522source = "registry+https://github.com/rust-lang/crates.io-index"
523dependencies = [ 523dependencies = [
524 "unicode-segmentation 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", 524 "unicode-segmentation 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
525] 525]
526 526
527[[package]] 527[[package]]
@@ -552,7 +552,7 @@ dependencies = [
552 "console 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)", 552 "console 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
553 "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", 553 "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
554 "number_prefix 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", 554 "number_prefix 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
555 "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", 555 "parking_lot 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
556 "regex 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)", 556 "regex 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
557] 557]
558 558
@@ -563,7 +563,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
563dependencies = [ 563dependencies = [
564 "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", 564 "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
565 "inotify-sys 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", 565 "inotify-sys 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
566 "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", 566 "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)",
567] 567]
568 568
569[[package]] 569[[package]]
@@ -571,7 +571,7 @@ name = "inotify-sys"
571version = "0.1.3" 571version = "0.1.3"
572source = "registry+https://github.com/rust-lang/crates.io-index" 572source = "registry+https://github.com/rust-lang/crates.io-index"
573dependencies = [ 573dependencies = [
574 "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", 574 "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)",
575] 575]
576 576
577[[package]] 577[[package]]
@@ -599,7 +599,7 @@ name = "iovec"
599version = "0.1.2" 599version = "0.1.2"
600source = "registry+https://github.com/rust-lang/crates.io-index" 600source = "registry+https://github.com/rust-lang/crates.io-index"
601dependencies = [ 601dependencies = [
602 "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", 602 "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)",
603 "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", 603 "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
604] 604]
605 605
@@ -630,7 +630,7 @@ version = "0.2.0"
630source = "registry+https://github.com/rust-lang/crates.io-index" 630source = "registry+https://github.com/rust-lang/crates.io-index"
631dependencies = [ 631dependencies = [
632 "jemalloc-sys 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", 632 "jemalloc-sys 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
633 "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", 633 "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)",
634] 634]
635 635
636[[package]] 636[[package]]
@@ -638,9 +638,9 @@ name = "jemalloc-sys"
638version = "0.1.8" 638version = "0.1.8"
639source = "registry+https://github.com/rust-lang/crates.io-index" 639source = "registry+https://github.com/rust-lang/crates.io-index"
640dependencies = [ 640dependencies = [
641 "cc 1.0.36 (registry+https://github.com/rust-lang/crates.io-index)", 641 "cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)",
642 "fs_extra 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 642 "fs_extra 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
643 "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", 643 "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)",
644] 644]
645 645
646[[package]] 646[[package]]
@@ -649,7 +649,7 @@ version = "0.1.9"
649source = "registry+https://github.com/rust-lang/crates.io-index" 649source = "registry+https://github.com/rust-lang/crates.io-index"
650dependencies = [ 650dependencies = [
651 "jemalloc-sys 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", 651 "jemalloc-sys 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
652 "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", 652 "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)",
653] 653]
654 654
655[[package]] 655[[package]]
@@ -683,7 +683,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
683 683
684[[package]] 684[[package]]
685name = "libc" 685name = "libc"
686version = "0.2.54" 686version = "0.2.55"
687source = "registry+https://github.com/rust-lang/crates.io-index" 687source = "registry+https://github.com/rust-lang/crates.io-index"
688 688
689[[package]] 689[[package]]
@@ -713,7 +713,7 @@ name = "log"
713version = "0.4.6" 713version = "0.4.6"
714source = "registry+https://github.com/rust-lang/crates.io-index" 714source = "registry+https://github.com/rust-lang/crates.io-index"
715dependencies = [ 715dependencies = [
716 "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", 716 "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
717] 717]
718 718
719[[package]] 719[[package]]
@@ -723,7 +723,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
723dependencies = [ 723dependencies = [
724 "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", 724 "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
725 "num-derive 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", 725 "num-derive 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
726 "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", 726 "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
727 "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", 727 "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)",
728 "serde_derive 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", 728 "serde_derive 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)",
729 "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", 729 "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -753,15 +753,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
753 753
754[[package]] 754[[package]]
755name = "mio" 755name = "mio"
756version = "0.6.16" 756version = "0.6.17"
757source = "registry+https://github.com/rust-lang/crates.io-index" 757source = "registry+https://github.com/rust-lang/crates.io-index"
758dependencies = [ 758dependencies = [
759 "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", 759 "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
760 "fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", 760 "fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
761 "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", 761 "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
762 "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", 762 "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
763 "lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", 763 "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)",
764 "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)",
765 "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", 764 "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
766 "miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", 765 "miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
767 "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", 766 "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -776,7 +775,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
776dependencies = [ 775dependencies = [
777 "lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", 776 "lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
778 "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", 777 "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
779 "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", 778 "mio 0.6.17 (registry+https://github.com/rust-lang/crates.io-index)",
780 "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", 779 "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
781] 780]
782 781
@@ -796,8 +795,8 @@ name = "net2"
796version = "0.2.33" 795version = "0.2.33"
797source = "registry+https://github.com/rust-lang/crates.io-index" 796source = "registry+https://github.com/rust-lang/crates.io-index"
798dependencies = [ 797dependencies = [
799 "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", 798 "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
800 "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", 799 "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)",
801 "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", 800 "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
802] 801]
803 802
@@ -808,7 +807,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
808 807
809[[package]] 808[[package]]
810name = "notify" 809name = "notify"
811version = "4.0.11" 810version = "4.0.12"
812source = "registry+https://github.com/rust-lang/crates.io-index" 811source = "registry+https://github.com/rust-lang/crates.io-index"
813dependencies = [ 812dependencies = [
814 "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", 813 "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -817,8 +816,8 @@ dependencies = [
817 "fsevent-sys 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", 816 "fsevent-sys 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
818 "inotify 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", 817 "inotify 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
819 "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", 818 "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
820 "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", 819 "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)",
821 "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", 820 "mio 0.6.17 (registry+https://github.com/rust-lang/crates.io-index)",
822 "mio-extras 2.0.5 (registry+https://github.com/rust-lang/crates.io-index)", 821 "mio-extras 2.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
823 "walkdir 2.2.7 (registry+https://github.com/rust-lang/crates.io-index)", 822 "walkdir 2.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
824 "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", 823 "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -836,23 +835,27 @@ dependencies = [
836 835
837[[package]] 836[[package]]
838name = "num-integer" 837name = "num-integer"
839version = "0.1.39" 838version = "0.1.41"
840source = "registry+https://github.com/rust-lang/crates.io-index" 839source = "registry+https://github.com/rust-lang/crates.io-index"
841dependencies = [ 840dependencies = [
842 "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", 841 "autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
842 "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
843] 843]
844 844
845[[package]] 845[[package]]
846name = "num-traits" 846name = "num-traits"
847version = "0.2.6" 847version = "0.2.8"
848source = "registry+https://github.com/rust-lang/crates.io-index" 848source = "registry+https://github.com/rust-lang/crates.io-index"
849dependencies = [
850 "autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
851]
849 852
850[[package]] 853[[package]]
851name = "num_cpus" 854name = "num_cpus"
852version = "1.10.0" 855version = "1.10.0"
853source = "registry+https://github.com/rust-lang/crates.io-index" 856source = "registry+https://github.com/rust-lang/crates.io-index"
854dependencies = [ 857dependencies = [
855 "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", 858 "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)",
856] 859]
857 860
858[[package]] 861[[package]]
@@ -860,7 +863,7 @@ name = "number_prefix"
860version = "0.2.8" 863version = "0.2.8"
861source = "registry+https://github.com/rust-lang/crates.io-index" 864source = "registry+https://github.com/rust-lang/crates.io-index"
862dependencies = [ 865dependencies = [
863 "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", 866 "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
864] 867]
865 868
866[[package]] 869[[package]]
@@ -918,7 +921,7 @@ name = "parking_lot_core"
918version = "0.4.0" 921version = "0.4.0"
919source = "registry+https://github.com/rust-lang/crates.io-index" 922source = "registry+https://github.com/rust-lang/crates.io-index"
920dependencies = [ 923dependencies = [
921 "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", 924 "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)",
922 "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", 925 "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
923 "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", 926 "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
924 "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", 927 "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -930,9 +933,9 @@ name = "parking_lot_core"
930version = "0.5.0" 933version = "0.5.0"
931source = "registry+https://github.com/rust-lang/crates.io-index" 934source = "registry+https://github.com/rust-lang/crates.io-index"
932dependencies = [ 935dependencies = [
933 "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", 936 "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
934 "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", 937 "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
935 "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", 938 "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)",
936 "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", 939 "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
937 "redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)", 940 "redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)",
938 "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", 941 "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1010,7 +1013,7 @@ dependencies = [
1010 "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", 1013 "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
1011 "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 1014 "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
1012 "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", 1015 "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
1013 "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", 1016 "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
1014 "quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)", 1017 "quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
1015 "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", 1018 "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
1016 "rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 1019 "rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1072,7 +1075,7 @@ version = "0.1.0"
1072dependencies = [ 1075dependencies = [
1073 "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", 1076 "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)",
1074 "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", 1077 "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
1075 "flexi_logger 0.11.4 (registry+https://github.com/rust-lang/crates.io-index)", 1078 "flexi_logger 0.11.5 (registry+https://github.com/rust-lang/crates.io-index)",
1076 "indicatif 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", 1079 "indicatif 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
1077 "join_to_string 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", 1080 "join_to_string 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
1078 "ra_batch 0.1.0", 1081 "ra_batch 0.1.0",
@@ -1115,7 +1118,7 @@ dependencies = [
1115 "chalk-rust-ir 0.1.0 (git+https://github.com/flodiebold/chalk.git?branch=fuel)", 1118 "chalk-rust-ir 0.1.0 (git+https://github.com/flodiebold/chalk.git?branch=fuel)",
1116 "chalk-solve 0.1.0 (git+https://github.com/flodiebold/chalk.git?branch=fuel)", 1119 "chalk-solve 0.1.0 (git+https://github.com/flodiebold/chalk.git?branch=fuel)",
1117 "ena 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", 1120 "ena 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
1118 "flexi_logger 0.11.4 (registry+https://github.com/rust-lang/crates.io-index)", 1121 "flexi_logger 0.11.5 (registry+https://github.com/rust-lang/crates.io-index)",
1119 "insta 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", 1122 "insta 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
1120 "join_to_string 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", 1123 "join_to_string 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
1121 "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", 1124 "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1166,7 +1169,7 @@ dependencies = [
1166 "crossbeam-channel 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", 1169 "crossbeam-channel 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
1167 "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", 1170 "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
1168 "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", 1171 "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
1169 "flexi_logger 0.11.4 (registry+https://github.com/rust-lang/crates.io-index)", 1172 "flexi_logger 0.11.5 (registry+https://github.com/rust-lang/crates.io-index)",
1170 "gen_lsp_server 0.2.0", 1173 "gen_lsp_server 0.2.0",
1171 "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", 1174 "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
1172 "lsp-types 0.57.1 (registry+https://github.com/rust-lang/crates.io-index)", 1175 "lsp-types 0.57.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1182,7 +1185,7 @@ dependencies = [
1182 "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", 1185 "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
1183 "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", 1186 "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)",
1184 "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", 1187 "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)",
1185 "tempfile 3.0.7 (registry+https://github.com/rust-lang/crates.io-index)", 1188 "tempfile 3.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
1186 "test_utils 0.1.0", 1189 "test_utils 0.1.0",
1187 "thread_worker 0.1.0", 1190 "thread_worker 0.1.0",
1188 "threadpool 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", 1191 "threadpool 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1275,7 +1278,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
1275dependencies = [ 1278dependencies = [
1276 "crossbeam-channel 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", 1279 "crossbeam-channel 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
1277 "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", 1280 "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
1278 "notify 4.0.11 (registry+https://github.com/rust-lang/crates.io-index)", 1281 "notify 4.0.12 (registry+https://github.com/rust-lang/crates.io-index)",
1279 "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", 1282 "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
1280 "relative-path 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 1283 "relative-path 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
1281 "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", 1284 "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1287,8 +1290,8 @@ name = "rand"
1287version = "0.6.5" 1290version = "0.6.5"
1288source = "registry+https://github.com/rust-lang/crates.io-index" 1291source = "registry+https://github.com/rust-lang/crates.io-index"
1289dependencies = [ 1292dependencies = [
1290 "autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", 1293 "autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
1291 "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", 1294 "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)",
1292 "rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 1295 "rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
1293 "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 1296 "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
1294 "rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 1297 "rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1305,7 +1308,7 @@ name = "rand_chacha"
1305version = "0.1.1" 1308version = "0.1.1"
1306source = "registry+https://github.com/rust-lang/crates.io-index" 1309source = "registry+https://github.com/rust-lang/crates.io-index"
1307dependencies = [ 1310dependencies = [
1308 "autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", 1311 "autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
1309 "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 1312 "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
1310] 1313]
1311 1314
@@ -1343,7 +1346,7 @@ name = "rand_jitter"
1343version = "0.1.4" 1346version = "0.1.4"
1344source = "registry+https://github.com/rust-lang/crates.io-index" 1347source = "registry+https://github.com/rust-lang/crates.io-index"
1345dependencies = [ 1348dependencies = [
1346 "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", 1349 "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)",
1347 "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 1350 "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
1348 "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", 1351 "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
1349] 1352]
@@ -1355,7 +1358,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
1355dependencies = [ 1358dependencies = [
1356 "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", 1359 "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
1357 "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 1360 "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
1358 "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", 1361 "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)",
1359 "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 1362 "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
1360 "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 1363 "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
1361 "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", 1364 "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1366,7 +1369,7 @@ name = "rand_pcg"
1366version = "0.1.2" 1369version = "0.1.2"
1367source = "registry+https://github.com/rust-lang/crates.io-index" 1370source = "registry+https://github.com/rust-lang/crates.io-index"
1368dependencies = [ 1371dependencies = [
1369 "autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", 1372 "autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
1370 "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 1373 "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
1371] 1374]
1372 1375
@@ -1395,7 +1398,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
1395dependencies = [ 1398dependencies = [
1396 "crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", 1399 "crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
1397 "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", 1400 "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
1398 "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", 1401 "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)",
1399 "num_cpus 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", 1402 "num_cpus 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
1400] 1403]
1401 1404
@@ -1644,9 +1647,9 @@ name = "stacker"
1644version = "0.1.5" 1647version = "0.1.5"
1645source = "registry+https://github.com/rust-lang/crates.io-index" 1648source = "registry+https://github.com/rust-lang/crates.io-index"
1646dependencies = [ 1649dependencies = [
1647 "cc 1.0.36 (registry+https://github.com/rust-lang/crates.io-index)", 1650 "cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)",
1648 "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", 1651 "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
1649 "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", 1652 "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)",
1650 "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", 1653 "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
1651] 1654]
1652 1655
@@ -1672,7 +1675,7 @@ dependencies = [
1672 1675
1673[[package]] 1676[[package]]
1674name = "synstructure" 1677name = "synstructure"
1675version = "0.10.1" 1678version = "0.10.2"
1676source = "registry+https://github.com/rust-lang/crates.io-index" 1679source = "registry+https://github.com/rust-lang/crates.io-index"
1677dependencies = [ 1680dependencies = [
1678 "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", 1681 "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1683,11 +1686,11 @@ dependencies = [
1683 1686
1684[[package]] 1687[[package]]
1685name = "tempfile" 1688name = "tempfile"
1686version = "3.0.7" 1689version = "3.0.8"
1687source = "registry+https://github.com/rust-lang/crates.io-index" 1690source = "registry+https://github.com/rust-lang/crates.io-index"
1688dependencies = [ 1691dependencies = [
1689 "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", 1692 "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
1690 "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", 1693 "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)",
1691 "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", 1694 "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
1692 "redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)", 1695 "redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)",
1693 "remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", 1696 "remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1700,7 +1703,7 @@ version = "0.11.20"
1700source = "registry+https://github.com/rust-lang/crates.io-index" 1703source = "registry+https://github.com/rust-lang/crates.io-index"
1701dependencies = [ 1704dependencies = [
1702 "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", 1705 "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
1703 "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", 1706 "error-chain 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)",
1704 "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", 1707 "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
1705 "humansize 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 1708 "humansize 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
1706 "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", 1709 "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1730,7 +1733,7 @@ name = "termion"
1730version = "1.5.2" 1733version = "1.5.2"
1731source = "registry+https://github.com/rust-lang/crates.io-index" 1734source = "registry+https://github.com/rust-lang/crates.io-index"
1732dependencies = [ 1735dependencies = [
1733 "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", 1736 "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)",
1734 "numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 1737 "numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
1735 "redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)", 1738 "redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)",
1736 "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 1739 "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1741,7 +1744,7 @@ name = "termios"
1741version = "0.3.1" 1744version = "0.3.1"
1742source = "registry+https://github.com/rust-lang/crates.io-index" 1745source = "registry+https://github.com/rust-lang/crates.io-index"
1743dependencies = [ 1746dependencies = [
1744 "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", 1747 "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)",
1745] 1748]
1746 1749
1747[[package]] 1750[[package]]
@@ -1799,7 +1802,7 @@ name = "time"
1799version = "0.1.42" 1802version = "0.1.42"
1800source = "registry+https://github.com/rust-lang/crates.io-index" 1803source = "registry+https://github.com/rust-lang/crates.io-index"
1801dependencies = [ 1804dependencies = [
1802 "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", 1805 "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)",
1803 "redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)", 1806 "redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)",
1804 "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", 1807 "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
1805] 1808]
@@ -1900,7 +1903,7 @@ dependencies = [
1900 1903
1901[[package]] 1904[[package]]
1902name = "unicode-segmentation" 1905name = "unicode-segmentation"
1903version = "1.2.1" 1906version = "1.3.0"
1904source = "registry+https://github.com/rust-lang/crates.io-index" 1907source = "registry+https://github.com/rust-lang/crates.io-index"
1905 1908
1906[[package]] 1909[[package]]
@@ -2025,8 +2028,8 @@ dependencies = [
2025"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" 2028"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
2026"checksum arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "92c7fb76bc8826a8b33b4ee5bb07a247a81e76764ab4d55e8f73e3a4d8808c71" 2029"checksum arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "92c7fb76bc8826a8b33b4ee5bb07a247a81e76764ab4d55e8f73e3a4d8808c71"
2027"checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652" 2030"checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652"
2028"checksum autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a6d640bee2da49f60a4068a7fae53acde8982514ab7bae8b8cea9e88cbcfd799" 2031"checksum autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "0e49efa51329a5fd37e7c79db4621af617cd4e3e5bc224939808d076077077bf"
2029"checksum backtrace 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "f106c02a3604afcdc0df5d36cc47b44b55917dbaf3d808f71c163a0ddba64637" 2032"checksum backtrace 0.3.20 (registry+https://github.com/rust-lang/crates.io-index)" = "45934a579eff9fd0ff637ac376a4bd134f47f8fc603f0b211d696b54d61e35f1"
2030"checksum backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)" = "797c830ac25ccc92a7f8a7b9862bde440715531514594a6154e3d4a54dd769b6" 2033"checksum backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)" = "797c830ac25ccc92a7f8a7b9862bde440715531514594a6154e3d4a54dd769b6"
2031"checksum base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e" 2034"checksum base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e"
2032"checksum bit-set 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e84c238982c4b1e1ee668d136c510c67a13465279c0cb367ea6baf6310620a80" 2035"checksum bit-set 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e84c238982c4b1e1ee668d136c510c67a13465279c0cb367ea6baf6310620a80"
@@ -2037,8 +2040,8 @@ dependencies = [
2037"checksum byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" 2040"checksum byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7"
2038"checksum byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a019b10a2a7cdeb292db131fc8113e57ea2a908f6e7894b0c3c671893b65dbeb" 2041"checksum byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a019b10a2a7cdeb292db131fc8113e57ea2a908f6e7894b0c3c671893b65dbeb"
2039"checksum cargo_metadata 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)" = "178d62b240c34223f265a4c1e275e37d62da163d421fc8d7f7e3ee340f803c57" 2042"checksum cargo_metadata 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)" = "178d62b240c34223f265a4c1e275e37d62da163d421fc8d7f7e3ee340f803c57"
2040"checksum cc 1.0.36 (registry+https://github.com/rust-lang/crates.io-index)" = "a0c56216487bb80eec9c4516337b2588a4f2a2290d72a1416d930e4dcdb0c90d" 2043"checksum cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)" = "39f75544d7bbaf57560d2168f28fd649ff9c76153874db88bdbdfd839b1a7e7d"
2041"checksum cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "11d43355396e872eefb45ce6342e4374ed7bc2b3a502d1b28e36d6e23c05d1f4" 2044"checksum cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "b486ce3ccf7ffd79fdeb678eac06a9e6c09fc88d33836340becb8fffe87c5e33"
2042"checksum chalk-engine 0.9.0 (git+https://github.com/flodiebold/chalk.git?branch=fuel)" = "<none>" 2045"checksum chalk-engine 0.9.0 (git+https://github.com/flodiebold/chalk.git?branch=fuel)" = "<none>"
2043"checksum chalk-ir 0.1.0 (git+https://github.com/flodiebold/chalk.git?branch=fuel)" = "<none>" 2046"checksum chalk-ir 0.1.0 (git+https://github.com/flodiebold/chalk.git?branch=fuel)" = "<none>"
2044"checksum chalk-macros 0.1.1 (git+https://github.com/flodiebold/chalk.git?branch=fuel)" = "<none>" 2047"checksum chalk-macros 0.1.1 (git+https://github.com/flodiebold/chalk.git?branch=fuel)" = "<none>"
@@ -2066,13 +2069,13 @@ dependencies = [
2066"checksum ena 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "25b4e5febb25f08c49f1b07dc33a182729a6b21edfb562b5aef95f78e0dbe5bb" 2069"checksum ena 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "25b4e5febb25f08c49f1b07dc33a182729a6b21edfb562b5aef95f78e0dbe5bb"
2067"checksum ena 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f56c93cc076508c549d9bb747f79aa9b4eb098be7b8cad8830c3137ef52d1e00" 2070"checksum ena 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f56c93cc076508c549d9bb747f79aa9b4eb098be7b8cad8830c3137ef52d1e00"
2068"checksum encode_unicode 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "90b2c9496c001e8cb61827acdefad780795c42264c137744cae6f7d9e3450abd" 2071"checksum encode_unicode 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "90b2c9496c001e8cb61827acdefad780795c42264c137744cae6f7d9e3450abd"
2069"checksum error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "07e791d3be96241c77c43846b665ef1384606da2cd2a48730abe606a12906e02" 2072"checksum error-chain 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3ab49e9dcb602294bc42f9a7dfc9bc6e936fca4418ea300dbfb84fe16de0b7d9"
2070"checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2" 2073"checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2"
2071"checksum failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea1063915fd7ef4309e222a5a07cf9c319fb9c7836b1f89b85458672dbb127e1" 2074"checksum failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea1063915fd7ef4309e222a5a07cf9c319fb9c7836b1f89b85458672dbb127e1"
2072"checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" 2075"checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed"
2073"checksum filetime 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "2f8c63033fcba1f51ef744505b3cad42510432b904c062afa67ad7ece008429d" 2076"checksum filetime 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "2f8c63033fcba1f51ef744505b3cad42510432b904c062afa67ad7ece008429d"
2074"checksum fixedbitset 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "86d4de0081402f5e88cdac65c8dcdcc73118c1a7a465e2a05f0da05843a8ea33" 2077"checksum fixedbitset 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "86d4de0081402f5e88cdac65c8dcdcc73118c1a7a465e2a05f0da05843a8ea33"
2075"checksum flexi_logger 0.11.4 (registry+https://github.com/rust-lang/crates.io-index)" = "73de04baa435682b03677bb28f7b3e9d72b0489a551da5ba413c9b29f7979a19" 2078"checksum flexi_logger 0.11.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ce5e9a2e15c8eb8dcf35565b92b9548e4787b9990528f1ef49d09e20bbeee5a7"
2076"checksum fs_extra 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5f2a4a2034423744d2cc7ca2068453168dcdb82c438419e639a26bd87839c674" 2079"checksum fs_extra 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5f2a4a2034423744d2cc7ca2068453168dcdb82c438419e639a26bd87839c674"
2077"checksum fsevent 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5ab7d1bd1bd33cc98b0889831b72da23c0aa4df9cec7e0702f46ecea04b35db6" 2080"checksum fsevent 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5ab7d1bd1bd33cc98b0889831b72da23c0aa4df9cec7e0702f46ecea04b35db6"
2078"checksum fsevent-sys 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f41b048a94555da0f42f1d632e2e19510084fb8e303b0daa2816e733fb3644a0" 2081"checksum fsevent-sys 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f41b048a94555da0f42f1d632e2e19510084fb8e303b0daa2816e733fb3644a0"
@@ -2103,7 +2106,7 @@ dependencies = [
2103"checksum lalrpop-intern 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cc4fd87be4a815fd373e02773983940f0d75fb26fde8c098e9e45f7af03154c0" 2106"checksum lalrpop-intern 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cc4fd87be4a815fd373e02773983940f0d75fb26fde8c098e9e45f7af03154c0"
2104"checksum lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc5729f27f159ddd61f4df6228e827e86643d4d3e7c32183cb30a1c08f604a14" 2107"checksum lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc5729f27f159ddd61f4df6228e827e86643d4d3e7c32183cb30a1c08f604a14"
2105"checksum lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f" 2108"checksum lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f"
2106"checksum libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)" = "c6785aa7dd976f5fbf3b71cfd9cd49d7f783c1ff565a858d71031c6c313aa5c6" 2109"checksum libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)" = "42914d39aad277d9e176efbdad68acb1d5443ab65afe0e0e4f0d49352a950880"
2107"checksum linked-hash-map 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ae91b68aebc4ddb91978b11a1b02ddd8602a05ec19002801c5666000e05e0f83" 2110"checksum linked-hash-map 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ae91b68aebc4ddb91978b11a1b02ddd8602a05ec19002801c5666000e05e0f83"
2108"checksum lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "62ebf1391f6acad60e5c8b43706dde4582df75c06698ab44511d15016bc2442c" 2111"checksum lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "62ebf1391f6acad60e5c8b43706dde4582df75c06698ab44511d15016bc2442c"
2109"checksum lock_api 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ed946d4529956a20f2d63ebe1b69996d5a2137c91913fe3ebbeff957f5bca7ff" 2112"checksum lock_api 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ed946d4529956a20f2d63ebe1b69996d5a2137c91913fe3ebbeff957f5bca7ff"
@@ -2113,15 +2116,15 @@ dependencies = [
2113"checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" 2116"checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08"
2114"checksum memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2efc7bc57c883d4a4d6e3246905283d8dae951bb3bd32f49d6ef297f546e1c39" 2117"checksum memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2efc7bc57c883d4a4d6e3246905283d8dae951bb3bd32f49d6ef297f546e1c39"
2115"checksum memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0f9dc261e2b62d7a622bf416ea3c5245cdd5d9a7fcc428c0d06804dfce1775b3" 2118"checksum memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0f9dc261e2b62d7a622bf416ea3c5245cdd5d9a7fcc428c0d06804dfce1775b3"
2116"checksum mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)" = "71646331f2619b1026cc302f87a2b8b648d5c6dd6937846a16cc8ce0f347f432" 2119"checksum mio 0.6.17 (registry+https://github.com/rust-lang/crates.io-index)" = "049ba5ca2b63e837adeee724aa9e36b408ed593529dcc802aa96ca14bd329bdf"
2117"checksum mio-extras 2.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "46e73a04c2fa6250b8d802134d56d554a9ec2922bf977777c805ea5def61ce40" 2120"checksum mio-extras 2.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "46e73a04c2fa6250b8d802134d56d554a9ec2922bf977777c805ea5def61ce40"
2118"checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" 2121"checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919"
2119"checksum net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88" 2122"checksum net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88"
2120"checksum nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9667ddcc6cc8a43afc9b7917599d7216aa09c463919ea32c59ed6cac8bc945" 2123"checksum nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9667ddcc6cc8a43afc9b7917599d7216aa09c463919ea32c59ed6cac8bc945"
2121"checksum notify 4.0.11 (registry+https://github.com/rust-lang/crates.io-index)" = "ceb1a496a81dd6125f68ce772b41b83efe89a54d21768ed6d0c33c95832604e6" 2124"checksum notify 4.0.12 (registry+https://github.com/rust-lang/crates.io-index)" = "3572d71f13ea8ed41867accd971fd564aa75934cf7a1fae03ddb8c74a8a49943"
2122"checksum num-derive 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "eafd0b45c5537c3ba526f79d3e75120036502bebacbb3f3220914067ce39dbf2" 2125"checksum num-derive 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "eafd0b45c5537c3ba526f79d3e75120036502bebacbb3f3220914067ce39dbf2"
2123"checksum num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "e83d528d2677f0518c570baf2b7abdcf0cd2d248860b68507bdcb3e91d4c0cea" 2126"checksum num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "b85e541ef8255f6cf42bbfe4ef361305c6c135d10919ecc26126c4e5ae94bc09"
2124"checksum num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0b3a5d7cc97d6d30d8b9bc8fa19bf45349ffe46241e8816f50f62f6d6aaabee1" 2127"checksum num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "6ba9a427cfca2be13aa6f6403b0b7e7368fe982bfa16fccc450ce74c46cd9b32"
2125"checksum num_cpus 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1a23f0ed30a54abaa0c7e83b1d2d87ada7c3c23078d1d87815af3e3b6385fbba" 2128"checksum num_cpus 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1a23f0ed30a54abaa0c7e83b1d2d87ada7c3c23078d1d87815af3e3b6385fbba"
2126"checksum number_prefix 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "dbf9993e59c894e3c08aa1c2712914e9e6bf1fcbfc6bef283e2183df345a4fee" 2129"checksum number_prefix 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "dbf9993e59c894e3c08aa1c2712914e9e6bf1fcbfc6bef283e2183df345a4fee"
2127"checksum numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef" 2130"checksum numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef"
@@ -2190,8 +2193,8 @@ dependencies = [
2190"checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" 2193"checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
2191"checksum superslice 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ab16ced94dbd8a46c82fd81e3ed9a8727dac2977ea869d217bcc4ea1f122e81f" 2194"checksum superslice 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ab16ced94dbd8a46c82fd81e3ed9a8727dac2977ea869d217bcc4ea1f122e81f"
2192"checksum syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)" = "a1393e4a97a19c01e900df2aec855a29f71cf02c402e2f443b8d2747c25c5dbe" 2195"checksum syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)" = "a1393e4a97a19c01e900df2aec855a29f71cf02c402e2f443b8d2747c25c5dbe"
2193"checksum synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "73687139bf99285483c96ac0add482c3776528beac1d97d444f6e91f203a2015" 2196"checksum synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "02353edf96d6e4dc81aea2d8490a7e9db177bf8acb0e951c24940bf866cb313f"
2194"checksum tempfile 3.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "b86c784c88d98c801132806dadd3819ed29d8600836c4088e855cdf3e178ed8a" 2197"checksum tempfile 3.0.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7dc4738f2e68ed2855de5ac9cdbe05c9216773ecde4739b2f095002ab03a13ef"
2195"checksum tera 0.11.20 (registry+https://github.com/rust-lang/crates.io-index)" = "4b505279e19d8f7d24b1a9dc58327c9c36174b1a2c7ebdeac70792d017cb64f3" 2198"checksum tera 0.11.20 (registry+https://github.com/rust-lang/crates.io-index)" = "4b505279e19d8f7d24b1a9dc58327c9c36174b1a2c7ebdeac70792d017cb64f3"
2196"checksum teraron 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0d89ad4617d1dec55331067fadaa041e813479e1779616f3d3ce9308bf46184e" 2199"checksum teraron 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0d89ad4617d1dec55331067fadaa041e813479e1779616f3d3ce9308bf46184e"
2197"checksum termion 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dde0593aeb8d47accea5392b39350015b5eccb12c0d98044d856983d89548dea" 2200"checksum termion 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dde0593aeb8d47accea5392b39350015b5eccb12c0d98044d856983d89548dea"
@@ -2213,7 +2216,7 @@ dependencies = [
2213"checksum unicase 2.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a84e5511b2a947f3ae965dcb29b13b7b1691b6e7332cf5dbc1744138d5acb7f6" 2216"checksum unicase 2.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a84e5511b2a947f3ae965dcb29b13b7b1691b6e7332cf5dbc1744138d5acb7f6"
2214"checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" 2217"checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5"
2215"checksum unicode-normalization 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "141339a08b982d942be2ca06ff8b076563cbe223d1befd5450716790d44e2426" 2218"checksum unicode-normalization 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "141339a08b982d942be2ca06ff8b076563cbe223d1befd5450716790d44e2426"
2216"checksum unicode-segmentation 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "aa6024fc12ddfd1c6dbc14a80fa2324d4568849869b779f6bd37e5e4c03344d1" 2219"checksum unicode-segmentation 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1967f4cdfc355b37fd76d2a954fb2ed3871034eb4f26d60537d88795cfc332a9"
2217"checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526" 2220"checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526"
2218"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" 2221"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
2219"checksum url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a" 2222"checksum url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a"
diff --git a/crates/ra_cli/src/main.rs b/crates/ra_cli/src/main.rs
index f11d0e6bd..93aba4c70 100644
--- a/crates/ra_cli/src/main.rs
+++ b/crates/ra_cli/src/main.rs
@@ -3,7 +3,7 @@ mod analysis_stats;
3use std::io::Read; 3use std::io::Read;
4 4
5use clap::{App, Arg, SubCommand}; 5use clap::{App, Arg, SubCommand};
6use ra_ide_api::file_structure; 6use ra_ide_api::{file_structure, Analysis};
7use ra_syntax::{SourceFile, TreeArc, AstNode}; 7use ra_syntax::{SourceFile, TreeArc, AstNode};
8use flexi_logger::Logger; 8use flexi_logger::Logger;
9use ra_prof::profile; 9use ra_prof::profile;
@@ -16,6 +16,7 @@ fn main() -> Result<()> {
16 .setting(clap::AppSettings::SubcommandRequiredElseHelp) 16 .setting(clap::AppSettings::SubcommandRequiredElseHelp)
17 .subcommand(SubCommand::with_name("parse").arg(Arg::with_name("no-dump").long("--no-dump"))) 17 .subcommand(SubCommand::with_name("parse").arg(Arg::with_name("no-dump").long("--no-dump")))
18 .subcommand(SubCommand::with_name("symbols")) 18 .subcommand(SubCommand::with_name("symbols"))
19 .subcommand(SubCommand::with_name("highlight"))
19 .subcommand( 20 .subcommand(
20 SubCommand::with_name("analysis-stats") 21 SubCommand::with_name("analysis-stats")
21 .arg(Arg::with_name("verbose").short("v").long("verbose")) 22 .arg(Arg::with_name("verbose").short("v").long("verbose"))
@@ -38,6 +39,11 @@ fn main() -> Result<()> {
38 println!("{:?}", s); 39 println!("{:?}", s);
39 } 40 }
40 } 41 }
42 ("highlight", _) => {
43 let (analysis, file_id) = Analysis::from_single_file(read_stdin()?);
44 let html = analysis.highlight_as_html(file_id).unwrap();
45 println!("{}", html);
46 }
41 ("analysis-stats", Some(matches)) => { 47 ("analysis-stats", Some(matches)) => {
42 let verbose = matches.is_present("verbose"); 48 let verbose = matches.is_present("verbose");
43 let path = matches.value_of("path").unwrap_or(""); 49 let path = matches.value_of("path").unwrap_or("");
diff --git a/crates/ra_hir/src/adt.rs b/crates/ra_hir/src/adt.rs
index e027eedd9..5e5905f15 100644
--- a/crates/ra_hir/src/adt.rs
+++ b/crates/ra_hir/src/adt.rs
@@ -10,7 +10,7 @@ use ra_syntax::{
10}; 10};
11 11
12use crate::{ 12use crate::{
13 Name, AsName, Struct, Enum, EnumVariant, Crate, 13 Name, AsName, Struct, Union, Enum, EnumVariant, Crate,
14 HirDatabase, HirFileId, StructField, FieldSource, 14 HirDatabase, HirFileId, StructField, FieldSource,
15 type_ref::TypeRef, DefDatabase, 15 type_ref::TypeRef, DefDatabase,
16}; 16};
@@ -18,14 +18,16 @@ use crate::{
18#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] 18#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
19pub enum AdtDef { 19pub enum AdtDef {
20 Struct(Struct), 20 Struct(Struct),
21 Union(Union),
21 Enum(Enum), 22 Enum(Enum),
22} 23}
23impl_froms!(AdtDef: Struct, Enum); 24impl_froms!(AdtDef: Struct, Union, Enum);
24 25
25impl AdtDef { 26impl AdtDef {
26 pub(crate) fn krate(self, db: &impl HirDatabase) -> Option<Crate> { 27 pub(crate) fn krate(self, db: &impl HirDatabase) -> Option<Crate> {
27 match self { 28 match self {
28 AdtDef::Struct(s) => s.module(db), 29 AdtDef::Struct(s) => s.module(db),
30 AdtDef::Union(s) => s.module(db),
29 AdtDef::Enum(e) => e.module(db), 31 AdtDef::Enum(e) => e.module(db),
30 } 32 }
31 .krate(db) 33 .krate(db)
@@ -38,6 +40,7 @@ impl Struct {
38 } 40 }
39} 41}
40 42
43/// Note that we use `StructData` for unions as well!
41#[derive(Debug, Clone, PartialEq, Eq)] 44#[derive(Debug, Clone, PartialEq, Eq)]
42pub struct StructData { 45pub struct StructData {
43 pub(crate) name: Option<Name>, 46 pub(crate) name: Option<Name>,
diff --git a/crates/ra_hir/src/code_model_api.rs b/crates/ra_hir/src/code_model.rs
index 0c4a80bfa..49030ce67 100644
--- a/crates/ra_hir/src/code_model_api.rs
+++ b/crates/ra_hir/src/code_model.rs
@@ -1,15 +1,15 @@
1use std::sync::Arc; 1use std::sync::Arc;
2 2
3use ra_db::{CrateId, SourceRootId, Edition}; 3use ra_db::{CrateId, SourceRootId, Edition, FileId};
4use ra_syntax::{ast::self, TreeArc}; 4use ra_syntax::{ast::{self, NameOwner, TypeAscriptionOwner}, TreeArc};
5 5
6use crate::{ 6use crate::{
7 Name, Ty, HirFileId, Either, 7 Name, AsName, AstId, Ty, HirFileId, Either,
8 HirDatabase, DefDatabase, 8 HirDatabase, DefDatabase,
9 type_ref::TypeRef, 9 type_ref::TypeRef,
10 nameres::{ModuleScope, Namespace, ImportId, CrateModuleId}, 10 nameres::{ModuleScope, Namespace, ImportId, CrateModuleId},
11 expr::{Body, BodySourceMap, validation::ExprValidator}, 11 expr::{Body, BodySourceMap, validation::ExprValidator},
12 ty::{ TraitRef, InferenceResult}, 12 ty::{TraitRef, InferenceResult},
13 adt::{EnumVariantId, StructFieldId, VariantDef}, 13 adt::{EnumVariantId, StructFieldId, VariantDef},
14 generics::HasGenericParams, 14 generics::HasGenericParams,
15 docs::{Documentation, Docs, docs_from_ast}, 15 docs::{Documentation, Docs, docs_from_ast},
@@ -18,6 +18,7 @@ use crate::{
18 resolve::Resolver, 18 resolve::Resolver,
19 diagnostics::{DiagnosticSink}, 19 diagnostics::{DiagnosticSink},
20 traits::{TraitItem, TraitData}, 20 traits::{TraitItem, TraitData},
21 type_ref::Mutability,
21}; 22};
22 23
23/// hir::Crate describes a single crate. It's the main interface with which 24/// hir::Crate describes a single crate. It's the main interface with which
@@ -35,19 +36,28 @@ pub struct CrateDependency {
35} 36}
36 37
37impl Crate { 38impl Crate {
38 pub fn crate_id(&self) -> CrateId { 39 pub fn crate_id(self) -> CrateId {
39 self.crate_id 40 self.crate_id
40 } 41 }
41 42
42 pub fn dependencies(&self, db: &impl DefDatabase) -> Vec<CrateDependency> { 43 pub fn dependencies(self, db: &impl DefDatabase) -> Vec<CrateDependency> {
43 self.dependencies_impl(db) 44 db.crate_graph()
45 .dependencies(self.crate_id)
46 .map(|dep| {
47 let krate = Crate { crate_id: dep.crate_id() };
48 let name = dep.as_name();
49 CrateDependency { krate, name }
50 })
51 .collect()
44 } 52 }
45 53
46 pub fn root_module(&self, db: &impl DefDatabase) -> Option<Module> { 54 pub fn root_module(self, db: &impl DefDatabase) -> Option<Module> {
47 self.root_module_impl(db) 55 let module_id = db.crate_def_map(self).root();
56 let module = Module { krate: self, module_id };
57 Some(module)
48 } 58 }
49 59
50 pub fn edition(&self, db: &impl DefDatabase) -> Edition { 60 pub fn edition(self, db: &impl DefDatabase) -> Edition {
51 let crate_graph = db.crate_graph(); 61 let crate_graph = db.crate_graph();
52 crate_graph.edition(self.crate_id) 62 crate_graph.edition(self.crate_id)
53 } 63 }
@@ -71,6 +81,7 @@ pub enum ModuleDef {
71 Module(Module), 81 Module(Module),
72 Function(Function), 82 Function(Function),
73 Struct(Struct), 83 Struct(Struct),
84 Union(Union),
74 Enum(Enum), 85 Enum(Enum),
75 // Can't be directly declared, but can be imported. 86 // Can't be directly declared, but can be imported.
76 EnumVariant(EnumVariant), 87 EnumVariant(EnumVariant),
@@ -83,6 +94,7 @@ impl_froms!(
83 ModuleDef: Module, 94 ModuleDef: Module,
84 Function, 95 Function,
85 Struct, 96 Struct,
97 Union,
86 Enum, 98 Enum,
87 EnumVariant, 99 EnumVariant,
88 Const, 100 Const,
@@ -96,29 +108,66 @@ pub enum ModuleSource {
96 Module(TreeArc<ast::Module>), 108 Module(TreeArc<ast::Module>),
97} 109}
98 110
111impl ModuleSource {
112 pub(crate) fn new(
113 db: &impl DefDatabase,
114 file_id: Option<FileId>,
115 decl_id: Option<AstId<ast::Module>>,
116 ) -> ModuleSource {
117 match (file_id, decl_id) {
118 (Some(file_id), _) => {
119 let source_file = db.parse(file_id);
120 ModuleSource::SourceFile(source_file)
121 }
122 (None, Some(item_id)) => {
123 let module = item_id.to_node(db);
124 assert!(module.item_list().is_some(), "expected inline module");
125 ModuleSource::Module(module.to_owned())
126 }
127 (None, None) => panic!(),
128 }
129 }
130}
131
99impl Module { 132impl Module {
100 /// Name of this module. 133 /// Name of this module.
101 pub fn name(&self, db: &impl HirDatabase) -> Option<Name> { 134 pub fn name(self, db: &impl HirDatabase) -> Option<Name> {
102 self.name_impl(db) 135 let def_map = db.crate_def_map(self.krate);
136 let parent = def_map[self.module_id].parent?;
137 def_map[parent].children.iter().find_map(|(name, module_id)| {
138 if *module_id == self.module_id {
139 Some(name.clone())
140 } else {
141 None
142 }
143 })
103 } 144 }
104 145
105 /// Returns a node which defines this module. That is, a file or a `mod foo {}` with items. 146 /// Returns a node which defines this module. That is, a file or a `mod foo {}` with items.
106 pub fn definition_source(&self, db: &impl DefDatabase) -> (HirFileId, ModuleSource) { 147 pub fn definition_source(self, db: &impl DefDatabase) -> (HirFileId, ModuleSource) {
107 self.definition_source_impl(db) 148 let def_map = db.crate_def_map(self.krate);
149 let decl_id = def_map[self.module_id].declaration;
150 let file_id = def_map[self.module_id].definition;
151 let module_source = ModuleSource::new(db, file_id, decl_id);
152 let file_id = file_id.map(HirFileId::from).unwrap_or_else(|| decl_id.unwrap().file_id());
153 (file_id, module_source)
108 } 154 }
109 155
110 /// Returns a node which declares this module, either a `mod foo;` or a `mod foo {}`. 156 /// Returns a node which declares this module, either a `mod foo;` or a `mod foo {}`.
111 /// `None` for the crate root. 157 /// `None` for the crate root.
112 pub fn declaration_source( 158 pub fn declaration_source(
113 &self, 159 self,
114 db: &impl HirDatabase, 160 db: &impl HirDatabase,
115 ) -> Option<(HirFileId, TreeArc<ast::Module>)> { 161 ) -> Option<(HirFileId, TreeArc<ast::Module>)> {
116 self.declaration_source_impl(db) 162 let def_map = db.crate_def_map(self.krate);
163 let decl = def_map[self.module_id].declaration?;
164 let ast = decl.to_node(db);
165 Some((decl.file_id(), ast))
117 } 166 }
118 167
119 /// Returns the syntax of the last path segment corresponding to this import 168 /// Returns the syntax of the last path segment corresponding to this import
120 pub fn import_source( 169 pub fn import_source(
121 &self, 170 self,
122 db: &impl HirDatabase, 171 db: &impl HirDatabase,
123 import: ImportId, 172 import: ImportId,
124 ) -> Either<TreeArc<ast::UseTree>, TreeArc<ast::ExternCrateItem>> { 173 ) -> Either<TreeArc<ast::UseTree>, TreeArc<ast::ExternCrateItem>> {
@@ -128,33 +177,44 @@ impl Module {
128 } 177 }
129 178
130 /// Returns the crate this module is part of. 179 /// Returns the crate this module is part of.
131 pub fn krate(&self, _db: &impl DefDatabase) -> Option<Crate> { 180 pub fn krate(self, _db: &impl DefDatabase) -> Option<Crate> {
132 Some(self.krate) 181 Some(self.krate)
133 } 182 }
134 183
135 /// Topmost parent of this module. Every module has a `crate_root`, but some 184 /// Topmost parent of this module. Every module has a `crate_root`, but some
136 /// might be missing `krate`. This can happen if a module's file is not included 185 /// might be missing `krate`. This can happen if a module's file is not included
137 /// in the module tree of any target in `Cargo.toml`. 186 /// in the module tree of any target in `Cargo.toml`.
138 pub fn crate_root(&self, db: &impl DefDatabase) -> Module { 187 pub fn crate_root(self, db: &impl DefDatabase) -> Module {
139 self.crate_root_impl(db) 188 let def_map = db.crate_def_map(self.krate);
189 self.with_module_id(def_map.root())
140 } 190 }
141 191
142 /// Finds a child module with the specified name. 192 /// Finds a child module with the specified name.
143 pub fn child(&self, db: &impl HirDatabase, name: &Name) -> Option<Module> { 193 pub fn child(self, db: &impl HirDatabase, name: &Name) -> Option<Module> {
144 self.child_impl(db, name) 194 let def_map = db.crate_def_map(self.krate);
195 let child_id = def_map[self.module_id].children.get(name)?;
196 Some(self.with_module_id(*child_id))
145 } 197 }
146 198
147 /// Iterates over all child modules. 199 /// Iterates over all child modules.
148 pub fn children(&self, db: &impl DefDatabase) -> impl Iterator<Item = Module> { 200 pub fn children(self, db: &impl DefDatabase) -> impl Iterator<Item = Module> {
149 self.children_impl(db) 201 let def_map = db.crate_def_map(self.krate);
202 let children = def_map[self.module_id]
203 .children
204 .iter()
205 .map(|(_, module_id)| self.with_module_id(*module_id))
206 .collect::<Vec<_>>();
207 children.into_iter()
150 } 208 }
151 209
152 /// Finds a parent module. 210 /// Finds a parent module.
153 pub fn parent(&self, db: &impl DefDatabase) -> Option<Module> { 211 pub fn parent(self, db: &impl DefDatabase) -> Option<Module> {
154 self.parent_impl(db) 212 let def_map = db.crate_def_map(self.krate);
213 let parent_id = def_map[self.module_id].parent?;
214 Some(self.with_module_id(parent_id))
155 } 215 }
156 216
157 pub fn path_to_root(&self, db: &impl HirDatabase) -> Vec<Module> { 217 pub fn path_to_root(self, db: &impl HirDatabase) -> Vec<Module> {
158 let mut res = vec![self.clone()]; 218 let mut res = vec![self.clone()];
159 let mut curr = self.clone(); 219 let mut curr = self.clone();
160 while let Some(next) = curr.parent(db) { 220 while let Some(next) = curr.parent(db) {
@@ -165,11 +225,11 @@ impl Module {
165 } 225 }
166 226
167 /// Returns a `ModuleScope`: a set of items, visible in this module. 227 /// Returns a `ModuleScope`: a set of items, visible in this module.
168 pub fn scope(&self, db: &impl HirDatabase) -> ModuleScope { 228 pub fn scope(self, db: &impl HirDatabase) -> ModuleScope {
169 db.crate_def_map(self.krate)[self.module_id].scope.clone() 229 db.crate_def_map(self.krate)[self.module_id].scope.clone()
170 } 230 }
171 231
172 pub fn diagnostics(&self, db: &impl HirDatabase, sink: &mut DiagnosticSink) { 232 pub fn diagnostics(self, db: &impl HirDatabase, sink: &mut DiagnosticSink) {
173 db.crate_def_map(self.krate).add_diagnostics(db, self.module_id, sink); 233 db.crate_def_map(self.krate).add_diagnostics(db, self.module_id, sink);
174 for decl in self.declarations(db) { 234 for decl in self.declarations(db) {
175 match decl { 235 match decl {
@@ -189,7 +249,7 @@ impl Module {
189 } 249 }
190 } 250 }
191 251
192 pub(crate) fn resolver(&self, db: &impl DefDatabase) -> Resolver { 252 pub(crate) fn resolver(self, db: &impl DefDatabase) -> Resolver {
193 let def_map = db.crate_def_map(self.krate); 253 let def_map = db.crate_def_map(self.krate);
194 Resolver::default().push_module_scope(def_map, self.module_id) 254 Resolver::default().push_module_scope(def_map, self.module_id)
195 } 255 }
@@ -214,6 +274,10 @@ impl Module {
214 .map(|(impl_id, _)| ImplBlock::from_id(self, impl_id)) 274 .map(|(impl_id, _)| ImplBlock::from_id(self, impl_id))
215 .collect() 275 .collect()
216 } 276 }
277
278 fn with_module_id(&self, module_id: CrateModuleId) -> Module {
279 Module { module_id, krate: self.krate }
280 }
217} 281}
218 282
219impl Docs for Module { 283impl Docs for Module {
@@ -267,49 +331,49 @@ pub struct Struct {
267} 331}
268 332
269impl Struct { 333impl Struct {
270 pub fn source(&self, db: &impl DefDatabase) -> (HirFileId, TreeArc<ast::StructDef>) { 334 pub fn source(self, db: &impl DefDatabase) -> (HirFileId, TreeArc<ast::StructDef>) {
271 self.id.source(db) 335 self.id.source(db)
272 } 336 }
273 337
274 pub fn module(&self, db: &impl HirDatabase) -> Module { 338 pub fn module(self, db: &impl HirDatabase) -> Module {
275 self.id.module(db) 339 self.id.module(db)
276 } 340 }
277 341
278 pub fn name(&self, db: &impl HirDatabase) -> Option<Name> { 342 pub fn name(self, db: &impl HirDatabase) -> Option<Name> {
279 db.struct_data(*self).name.clone() 343 db.struct_data(self).name.clone()
280 } 344 }
281 345
282 pub fn fields(&self, db: &impl HirDatabase) -> Vec<StructField> { 346 pub fn fields(self, db: &impl HirDatabase) -> Vec<StructField> {
283 db.struct_data(*self) 347 db.struct_data(self)
284 .variant_data 348 .variant_data
285 .fields() 349 .fields()
286 .into_iter() 350 .into_iter()
287 .flat_map(|it| it.iter()) 351 .flat_map(|it| it.iter())
288 .map(|(id, _)| StructField { parent: (*self).into(), id }) 352 .map(|(id, _)| StructField { parent: self.into(), id })
289 .collect() 353 .collect()
290 } 354 }
291 355
292 pub fn field(&self, db: &impl HirDatabase, name: &Name) -> Option<StructField> { 356 pub fn field(self, db: &impl HirDatabase, name: &Name) -> Option<StructField> {
293 db.struct_data(*self) 357 db.struct_data(self)
294 .variant_data 358 .variant_data
295 .fields() 359 .fields()
296 .into_iter() 360 .into_iter()
297 .flat_map(|it| it.iter()) 361 .flat_map(|it| it.iter())
298 .find(|(_id, data)| data.name == *name) 362 .find(|(_id, data)| data.name == *name)
299 .map(|(id, _)| StructField { parent: (*self).into(), id }) 363 .map(|(id, _)| StructField { parent: self.into(), id })
300 } 364 }
301 365
302 pub fn ty(&self, db: &impl HirDatabase) -> Ty { 366 pub fn ty(self, db: &impl HirDatabase) -> Ty {
303 db.type_for_def((*self).into(), Namespace::Types) 367 db.type_for_def(self.into(), Namespace::Types)
304 } 368 }
305 369
306 pub fn constructor_ty(&self, db: &impl HirDatabase) -> Ty { 370 pub fn constructor_ty(self, db: &impl HirDatabase) -> Ty {
307 db.type_for_def((*self).into(), Namespace::Values) 371 db.type_for_def(self.into(), Namespace::Values)
308 } 372 }
309 373
310 // FIXME move to a more general type 374 // FIXME move to a more general type
311 /// Builds a resolver for type references inside this struct. 375 /// Builds a resolver for type references inside this struct.
312 pub(crate) fn resolver(&self, db: &impl HirDatabase) -> Resolver { 376 pub(crate) fn resolver(self, db: &impl HirDatabase) -> Resolver {
313 // take the outer scope... 377 // take the outer scope...
314 let r = self.module(db).resolver(db); 378 let r = self.module(db).resolver(db);
315 // ...and add generic params, if present 379 // ...and add generic params, if present
@@ -326,46 +390,78 @@ impl Docs for Struct {
326} 390}
327 391
328#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 392#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
393pub struct Union {
394 pub(crate) id: StructId,
395}
396
397impl Union {
398 pub fn source(self, db: &impl DefDatabase) -> (HirFileId, TreeArc<ast::StructDef>) {
399 self.id.source(db)
400 }
401
402 pub fn name(self, db: &impl HirDatabase) -> Option<Name> {
403 db.struct_data(Struct { id: self.id }).name.clone()
404 }
405
406 pub fn module(self, db: &impl HirDatabase) -> Module {
407 self.id.module(db)
408 }
409
410 // FIXME move to a more general type
411 /// Builds a resolver for type references inside this union.
412 pub(crate) fn resolver(self, db: &impl HirDatabase) -> Resolver {
413 // take the outer scope...
414 let r = self.module(db).resolver(db);
415 // ...and add generic params, if present
416 let p = self.generic_params(db);
417 let r = if !p.params.is_empty() { r.push_generic_params_scope(p) } else { r };
418 r
419 }
420}
421
422impl Docs for Union {
423 fn docs(&self, db: &impl HirDatabase) -> Option<Documentation> {
424 docs_from_ast(&*self.source(db).1)
425 }
426}
427
428#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
329pub struct Enum { 429pub struct Enum {
330 pub(crate) id: EnumId, 430 pub(crate) id: EnumId,
331} 431}
332 432
333impl Enum { 433impl Enum {
334 pub fn source(&self, db: &impl DefDatabase) -> (HirFileId, TreeArc<ast::EnumDef>) { 434 pub fn source(self, db: &impl DefDatabase) -> (HirFileId, TreeArc<ast::EnumDef>) {
335 self.id.source(db) 435 self.id.source(db)
336 } 436 }
337 437
338 pub fn module(&self, db: &impl HirDatabase) -> Module { 438 pub fn module(self, db: &impl HirDatabase) -> Module {
339 self.id.module(db) 439 self.id.module(db)
340 } 440 }
341 441
342 pub fn name(&self, db: &impl HirDatabase) -> Option<Name> { 442 pub fn name(self, db: &impl HirDatabase) -> Option<Name> {
343 db.enum_data(*self).name.clone() 443 db.enum_data(self).name.clone()
344 } 444 }
345 445
346 pub fn variants(&self, db: &impl DefDatabase) -> Vec<EnumVariant> { 446 pub fn variants(self, db: &impl DefDatabase) -> Vec<EnumVariant> {
347 db.enum_data(*self) 447 db.enum_data(self).variants.iter().map(|(id, _)| EnumVariant { parent: self, id }).collect()
348 .variants
349 .iter()
350 .map(|(id, _)| EnumVariant { parent: *self, id })
351 .collect()
352 } 448 }
353 449
354 pub fn variant(&self, db: &impl DefDatabase, name: &Name) -> Option<EnumVariant> { 450 pub fn variant(self, db: &impl DefDatabase, name: &Name) -> Option<EnumVariant> {
355 db.enum_data(*self) 451 db.enum_data(self)
356 .variants 452 .variants
357 .iter() 453 .iter()
358 .find(|(_id, data)| data.name.as_ref() == Some(name)) 454 .find(|(_id, data)| data.name.as_ref() == Some(name))
359 .map(|(id, _)| EnumVariant { parent: *self, id }) 455 .map(|(id, _)| EnumVariant { parent: self, id })
360 } 456 }
361 457
362 pub fn ty(&self, db: &impl HirDatabase) -> Ty { 458 pub fn ty(self, db: &impl HirDatabase) -> Ty {
363 db.type_for_def((*self).into(), Namespace::Types) 459 db.type_for_def(self.into(), Namespace::Types)
364 } 460 }
365 461
366 // FIXME: move to a more general type 462 // FIXME: move to a more general type
367 /// Builds a resolver for type references inside this struct. 463 /// Builds a resolver for type references inside this struct.
368 pub(crate) fn resolver(&self, db: &impl HirDatabase) -> Resolver { 464 pub(crate) fn resolver(self, db: &impl HirDatabase) -> Resolver {
369 // take the outer scope... 465 // take the outer scope...
370 let r = self.module(db).resolver(db); 466 let r = self.module(db).resolver(db);
371 // ...and add generic params, if present 467 // ...and add generic params, if present
@@ -438,16 +534,16 @@ pub enum DefWithBody {
438impl_froms!(DefWithBody: Function, Const, Static); 534impl_froms!(DefWithBody: Function, Const, Static);
439 535
440impl DefWithBody { 536impl DefWithBody {
441 pub fn infer(&self, db: &impl HirDatabase) -> Arc<InferenceResult> { 537 pub fn infer(self, db: &impl HirDatabase) -> Arc<InferenceResult> {
442 db.infer(*self) 538 db.infer(self)
443 } 539 }
444 540
445 pub fn body(&self, db: &impl HirDatabase) -> Arc<Body> { 541 pub fn body(self, db: &impl HirDatabase) -> Arc<Body> {
446 db.body_hir(*self) 542 db.body_hir(self)
447 } 543 }
448 544
449 pub fn body_source_map(&self, db: &impl HirDatabase) -> Arc<BodySourceMap> { 545 pub fn body_source_map(self, db: &impl HirDatabase) -> Arc<BodySourceMap> {
450 db.body_with_source_map(*self).1 546 db.body_with_source_map(self).1
451 } 547 }
452 548
453 /// Builds a resolver for code inside this item. 549 /// Builds a resolver for code inside this item.
@@ -477,6 +573,44 @@ pub struct FnSignature {
477} 573}
478 574
479impl FnSignature { 575impl FnSignature {
576 pub(crate) fn fn_signature_query(db: &impl DefDatabase, func: Function) -> Arc<FnSignature> {
577 let (_, node) = func.source(db);
578 let name = node.name().map(|n| n.as_name()).unwrap_or_else(Name::missing);
579 let mut params = Vec::new();
580 let mut has_self_param = false;
581 if let Some(param_list) = node.param_list() {
582 if let Some(self_param) = param_list.self_param() {
583 let self_type = if let Some(type_ref) = self_param.ascribed_type() {
584 TypeRef::from_ast(type_ref)
585 } else {
586 let self_type = TypeRef::Path(Name::self_type().into());
587 match self_param.kind() {
588 ast::SelfParamKind::Owned => self_type,
589 ast::SelfParamKind::Ref => {
590 TypeRef::Reference(Box::new(self_type), Mutability::Shared)
591 }
592 ast::SelfParamKind::MutRef => {
593 TypeRef::Reference(Box::new(self_type), Mutability::Mut)
594 }
595 }
596 };
597 params.push(self_type);
598 has_self_param = true;
599 }
600 for param in param_list.params() {
601 let type_ref = TypeRef::from_ast_opt(param.ascribed_type());
602 params.push(type_ref);
603 }
604 }
605 let ret_type = if let Some(type_ref) = node.ret_type().and_then(|rt| rt.type_ref()) {
606 TypeRef::from_ast(type_ref)
607 } else {
608 TypeRef::unit()
609 };
610
611 let sig = FnSignature { name, params, ret_type, has_self_param };
612 Arc::new(sig)
613 }
480 pub fn name(&self) -> &Name { 614 pub fn name(&self) -> &Name {
481 &self.name 615 &self.name
482 } 616 }
@@ -497,50 +631,50 @@ impl FnSignature {
497} 631}
498 632
499impl Function { 633impl Function {
500 pub fn source(&self, db: &impl DefDatabase) -> (HirFileId, TreeArc<ast::FnDef>) { 634 pub fn source(self, db: &impl DefDatabase) -> (HirFileId, TreeArc<ast::FnDef>) {
501 self.id.source(db) 635 self.id.source(db)
502 } 636 }
503 637
504 pub fn module(&self, db: &impl DefDatabase) -> Module { 638 pub fn module(self, db: &impl DefDatabase) -> Module {
505 self.id.module(db) 639 self.id.module(db)
506 } 640 }
507 641
508 pub fn name(&self, db: &impl HirDatabase) -> Name { 642 pub fn name(self, db: &impl HirDatabase) -> Name {
509 self.signature(db).name.clone() 643 self.signature(db).name.clone()
510 } 644 }
511 645
512 pub(crate) fn body_source_map(&self, db: &impl HirDatabase) -> Arc<BodySourceMap> { 646 pub(crate) fn body_source_map(self, db: &impl HirDatabase) -> Arc<BodySourceMap> {
513 db.body_with_source_map((*self).into()).1 647 db.body_with_source_map(self.into()).1
514 } 648 }
515 649
516 pub fn body(&self, db: &impl HirDatabase) -> Arc<Body> { 650 pub fn body(self, db: &impl HirDatabase) -> Arc<Body> {
517 db.body_hir((*self).into()) 651 db.body_hir(self.into())
518 } 652 }
519 653
520 pub fn ty(&self, db: &impl HirDatabase) -> Ty { 654 pub fn ty(self, db: &impl HirDatabase) -> Ty {
521 db.type_for_def((*self).into(), Namespace::Values) 655 db.type_for_def(self.into(), Namespace::Values)
522 } 656 }
523 657
524 pub fn signature(&self, db: &impl HirDatabase) -> Arc<FnSignature> { 658 pub fn signature(self, db: &impl HirDatabase) -> Arc<FnSignature> {
525 db.fn_signature(*self) 659 db.fn_signature(self)
526 } 660 }
527 661
528 pub fn infer(&self, db: &impl HirDatabase) -> Arc<InferenceResult> { 662 pub fn infer(self, db: &impl HirDatabase) -> Arc<InferenceResult> {
529 db.infer((*self).into()) 663 db.infer(self.into())
530 } 664 }
531 665
532 /// The containing impl block, if this is a method. 666 /// The containing impl block, if this is a method.
533 pub fn impl_block(&self, db: &impl DefDatabase) -> Option<ImplBlock> { 667 pub fn impl_block(self, db: &impl DefDatabase) -> Option<ImplBlock> {
534 let module_impls = db.impls_in_module(self.module(db)); 668 let module_impls = db.impls_in_module(self.module(db));
535 ImplBlock::containing(module_impls, (*self).into()) 669 ImplBlock::containing(module_impls, self.into())
536 } 670 }
537 671
538 /// The containing trait, if this is a trait method definition. 672 /// The containing trait, if this is a trait method definition.
539 pub fn parent_trait(&self, db: &impl DefDatabase) -> Option<Trait> { 673 pub fn parent_trait(self, db: &impl DefDatabase) -> Option<Trait> {
540 db.trait_items_index(self.module(db)).get_parent_trait((*self).into()) 674 db.trait_items_index(self.module(db)).get_parent_trait(self.into())
541 } 675 }
542 676
543 pub fn container(&self, db: &impl DefDatabase) -> Option<Container> { 677 pub fn container(self, db: &impl DefDatabase) -> Option<Container> {
544 if let Some(impl_block) = self.impl_block(db) { 678 if let Some(impl_block) = self.impl_block(db) {
545 Some(impl_block.into()) 679 Some(impl_block.into())
546 } else if let Some(trait_) = self.parent_trait(db) { 680 } else if let Some(trait_) = self.parent_trait(db) {
@@ -552,7 +686,7 @@ impl Function {
552 686
553 // FIXME: move to a more general type for 'body-having' items 687 // FIXME: move to a more general type for 'body-having' items
554 /// Builds a resolver for code inside this item. 688 /// Builds a resolver for code inside this item.
555 pub(crate) fn resolver(&self, db: &impl HirDatabase) -> Resolver { 689 pub(crate) fn resolver(self, db: &impl HirDatabase) -> Resolver {
556 // take the outer scope... 690 // take the outer scope...
557 let r = self.container(db).map_or_else(|| self.module(db).resolver(db), |c| c.resolver(db)); 691 let r = self.container(db).map_or_else(|| self.module(db).resolver(db), |c| c.resolver(db));
558 // ...and add generic params, if present 692 // ...and add generic params, if present
@@ -561,10 +695,10 @@ impl Function {
561 r 695 r
562 } 696 }
563 697
564 pub fn diagnostics(&self, db: &impl HirDatabase, sink: &mut DiagnosticSink) { 698 pub fn diagnostics(self, db: &impl HirDatabase, sink: &mut DiagnosticSink) {
565 let infer = self.infer(db); 699 let infer = self.infer(db);
566 infer.add_diagnostics(db, *self, sink); 700 infer.add_diagnostics(db, self, sink);
567 let mut validator = ExprValidator::new(*self, infer, sink); 701 let mut validator = ExprValidator::new(self, infer, sink);
568 validator.validate_body(db); 702 validator.validate_body(db);
569 } 703 }
570} 704}
@@ -581,31 +715,31 @@ pub struct Const {
581} 715}
582 716
583impl Const { 717impl Const {
584 pub fn source(&self, db: &impl DefDatabase) -> (HirFileId, TreeArc<ast::ConstDef>) { 718 pub fn source(self, db: &impl DefDatabase) -> (HirFileId, TreeArc<ast::ConstDef>) {
585 self.id.source(db) 719 self.id.source(db)
586 } 720 }
587 721
588 pub fn module(&self, db: &impl DefDatabase) -> Module { 722 pub fn module(self, db: &impl DefDatabase) -> Module {
589 self.id.module(db) 723 self.id.module(db)
590 } 724 }
591 725
592 pub fn signature(&self, db: &impl HirDatabase) -> Arc<ConstSignature> { 726 pub fn signature(self, db: &impl HirDatabase) -> Arc<ConstSignature> {
593 db.const_signature(*self) 727 db.const_signature(self)
594 } 728 }
595 729
596 pub fn infer(&self, db: &impl HirDatabase) -> Arc<InferenceResult> { 730 pub fn infer(self, db: &impl HirDatabase) -> Arc<InferenceResult> {
597 db.infer((*self).into()) 731 db.infer(self.into())
598 } 732 }
599 733
600 /// The containing impl block, if this is a method. 734 /// The containing impl block, if this is a method.
601 pub fn impl_block(&self, db: &impl DefDatabase) -> Option<ImplBlock> { 735 pub fn impl_block(self, db: &impl DefDatabase) -> Option<ImplBlock> {
602 let module_impls = db.impls_in_module(self.module(db)); 736 let module_impls = db.impls_in_module(self.module(db));
603 ImplBlock::containing(module_impls, (*self).into()) 737 ImplBlock::containing(module_impls, self.into())
604 } 738 }
605 739
606 // FIXME: move to a more general type for 'body-having' items 740 // FIXME: move to a more general type for 'body-having' items
607 /// Builds a resolver for code inside this item. 741 /// Builds a resolver for code inside this item.
608 pub(crate) fn resolver(&self, db: &impl HirDatabase) -> Resolver { 742 pub(crate) fn resolver(self, db: &impl HirDatabase) -> Resolver {
609 // take the outer scope... 743 // take the outer scope...
610 let r = self 744 let r = self
611 .impl_block(db) 745 .impl_block(db)
@@ -636,6 +770,29 @@ impl ConstSignature {
636 pub fn type_ref(&self) -> &TypeRef { 770 pub fn type_ref(&self) -> &TypeRef {
637 &self.type_ref 771 &self.type_ref
638 } 772 }
773
774 pub(crate) fn const_signature_query(
775 db: &impl DefDatabase,
776 konst: Const,
777 ) -> Arc<ConstSignature> {
778 let (_, node) = konst.source(db);
779 const_signature_for(&*node)
780 }
781
782 pub(crate) fn static_signature_query(
783 db: &impl DefDatabase,
784 konst: Static,
785 ) -> Arc<ConstSignature> {
786 let (_, node) = konst.source(db);
787 const_signature_for(&*node)
788 }
789}
790
791fn const_signature_for<N: NameOwner + TypeAscriptionOwner>(node: &N) -> Arc<ConstSignature> {
792 let name = node.name().map(|n| n.as_name()).unwrap_or_else(Name::missing);
793 let type_ref = TypeRef::from_ast_opt(node.ascribed_type());
794 let sig = ConstSignature { name, type_ref };
795 Arc::new(sig)
639} 796}
640 797
641#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 798#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
@@ -644,26 +801,26 @@ pub struct Static {
644} 801}
645 802
646impl Static { 803impl Static {
647 pub fn source(&self, db: &impl DefDatabase) -> (HirFileId, TreeArc<ast::StaticDef>) { 804 pub fn source(self, db: &impl DefDatabase) -> (HirFileId, TreeArc<ast::StaticDef>) {
648 self.id.source(db) 805 self.id.source(db)
649 } 806 }
650 807
651 pub fn module(&self, db: &impl DefDatabase) -> Module { 808 pub fn module(self, db: &impl DefDatabase) -> Module {
652 self.id.module(db) 809 self.id.module(db)
653 } 810 }
654 811
655 pub fn signature(&self, db: &impl HirDatabase) -> Arc<ConstSignature> { 812 pub fn signature(self, db: &impl HirDatabase) -> Arc<ConstSignature> {
656 db.static_signature(*self) 813 db.static_signature(self)
657 } 814 }
658 815
659 /// Builds a resolver for code inside this item. 816 /// Builds a resolver for code inside this item.
660 pub(crate) fn resolver(&self, db: &impl HirDatabase) -> Resolver { 817 pub(crate) fn resolver(self, db: &impl HirDatabase) -> Resolver {
661 // take the outer scope... 818 // take the outer scope...
662 self.module(db).resolver(db) 819 self.module(db).resolver(db)
663 } 820 }
664 821
665 pub fn infer(&self, db: &impl HirDatabase) -> Arc<InferenceResult> { 822 pub fn infer(self, db: &impl HirDatabase) -> Arc<InferenceResult> {
666 db.infer((*self).into()) 823 db.infer(self.into())
667 } 824 }
668} 825}
669 826
@@ -679,11 +836,11 @@ pub struct Trait {
679} 836}
680 837
681impl Trait { 838impl Trait {
682 pub fn source(&self, db: &impl DefDatabase) -> (HirFileId, TreeArc<ast::TraitDef>) { 839 pub fn source(self, db: &impl DefDatabase) -> (HirFileId, TreeArc<ast::TraitDef>) {
683 self.id.source(db) 840 self.id.source(db)
684 } 841 }
685 842
686 pub fn module(&self, db: &impl DefDatabase) -> Module { 843 pub fn module(self, db: &impl DefDatabase) -> Module {
687 self.id.module(db) 844 self.id.module(db)
688 } 845 }
689 846
@@ -707,7 +864,7 @@ impl Trait {
707 self.trait_data(db).is_auto() 864 self.trait_data(db).is_auto()
708 } 865 }
709 866
710 pub(crate) fn resolver(&self, db: &impl DefDatabase) -> Resolver { 867 pub(crate) fn resolver(self, db: &impl DefDatabase) -> Resolver {
711 let r = self.module(db).resolver(db); 868 let r = self.module(db).resolver(db);
712 // add generic params, if present 869 // add generic params, if present
713 let p = self.generic_params(db); 870 let p = self.generic_params(db);
@@ -728,26 +885,26 @@ pub struct TypeAlias {
728} 885}
729 886
730impl TypeAlias { 887impl TypeAlias {
731 pub fn source(&self, db: &impl DefDatabase) -> (HirFileId, TreeArc<ast::TypeAliasDef>) { 888 pub fn source(self, db: &impl DefDatabase) -> (HirFileId, TreeArc<ast::TypeAliasDef>) {
732 self.id.source(db) 889 self.id.source(db)
733 } 890 }
734 891
735 pub fn module(&self, db: &impl DefDatabase) -> Module { 892 pub fn module(self, db: &impl DefDatabase) -> Module {
736 self.id.module(db) 893 self.id.module(db)
737 } 894 }
738 895
739 /// The containing impl block, if this is a method. 896 /// The containing impl block, if this is a method.
740 pub fn impl_block(&self, db: &impl DefDatabase) -> Option<ImplBlock> { 897 pub fn impl_block(self, db: &impl DefDatabase) -> Option<ImplBlock> {
741 let module_impls = db.impls_in_module(self.module(db)); 898 let module_impls = db.impls_in_module(self.module(db));
742 ImplBlock::containing(module_impls, (*self).into()) 899 ImplBlock::containing(module_impls, self.into())
743 } 900 }
744 901
745 /// The containing trait, if this is a trait method definition. 902 /// The containing trait, if this is a trait method definition.
746 pub fn parent_trait(&self, db: &impl DefDatabase) -> Option<Trait> { 903 pub fn parent_trait(self, db: &impl DefDatabase) -> Option<Trait> {
747 db.trait_items_index(self.module(db)).get_parent_trait((*self).into()) 904 db.trait_items_index(self.module(db)).get_parent_trait(self.into())
748 } 905 }
749 906
750 pub fn container(&self, db: &impl DefDatabase) -> Option<Container> { 907 pub fn container(self, db: &impl DefDatabase) -> Option<Container> {
751 if let Some(impl_block) = self.impl_block(db) { 908 if let Some(impl_block) = self.impl_block(db) {
752 Some(impl_block.into()) 909 Some(impl_block.into())
753 } else if let Some(trait_) = self.parent_trait(db) { 910 } else if let Some(trait_) = self.parent_trait(db) {
@@ -762,7 +919,7 @@ impl TypeAlias {
762 } 919 }
763 920
764 /// Builds a resolver for the type references in this type alias. 921 /// Builds a resolver for the type references in this type alias.
765 pub(crate) fn resolver(&self, db: &impl HirDatabase) -> Resolver { 922 pub(crate) fn resolver(self, db: &impl HirDatabase) -> Resolver {
766 // take the outer scope... 923 // take the outer scope...
767 let r = self 924 let r = self
768 .impl_block(db) 925 .impl_block(db)
@@ -788,7 +945,7 @@ pub enum Container {
788impl_froms!(Container: Trait, ImplBlock); 945impl_froms!(Container: Trait, ImplBlock);
789 946
790impl Container { 947impl Container {
791 pub(crate) fn resolver(&self, db: &impl DefDatabase) -> Resolver { 948 pub(crate) fn resolver(self, db: &impl DefDatabase) -> Resolver {
792 match self { 949 match self {
793 Container::Trait(trait_) => trait_.resolver(db), 950 Container::Trait(trait_) => trait_.resolver(db),
794 Container::ImplBlock(impl_block) => impl_block.resolver(db), 951 Container::ImplBlock(impl_block) => impl_block.resolver(db),
diff --git a/crates/ra_hir/src/code_model_impl.rs b/crates/ra_hir/src/code_model_impl.rs
deleted file mode 100644
index 24df9a113..000000000
--- a/crates/ra_hir/src/code_model_impl.rs
+++ /dev/null
@@ -1,4 +0,0 @@
1mod krate; // `crate` is invalid ident :(
2mod konst; // `const` is invalid ident :(
3mod module;
4pub(crate) mod function;
diff --git a/crates/ra_hir/src/code_model_impl/function.rs b/crates/ra_hir/src/code_model_impl/function.rs
deleted file mode 100644
index f8bd0f784..000000000
--- a/crates/ra_hir/src/code_model_impl/function.rs
+++ /dev/null
@@ -1,50 +0,0 @@
1use std::sync::Arc;
2
3use ra_syntax::ast::{self, NameOwner, TypeAscriptionOwner};
4
5use crate::{
6 Name, AsName, Function, FnSignature,
7 type_ref::{TypeRef, Mutability},
8 DefDatabase,
9};
10
11impl FnSignature {
12 pub(crate) fn fn_signature_query(db: &impl DefDatabase, func: Function) -> Arc<FnSignature> {
13 let (_, node) = func.source(db);
14 let name = node.name().map(|n| n.as_name()).unwrap_or_else(Name::missing);
15 let mut params = Vec::new();
16 let mut has_self_param = false;
17 if let Some(param_list) = node.param_list() {
18 if let Some(self_param) = param_list.self_param() {
19 let self_type = if let Some(type_ref) = self_param.ascribed_type() {
20 TypeRef::from_ast(type_ref)
21 } else {
22 let self_type = TypeRef::Path(Name::self_type().into());
23 match self_param.kind() {
24 ast::SelfParamKind::Owned => self_type,
25 ast::SelfParamKind::Ref => {
26 TypeRef::Reference(Box::new(self_type), Mutability::Shared)
27 }
28 ast::SelfParamKind::MutRef => {
29 TypeRef::Reference(Box::new(self_type), Mutability::Mut)
30 }
31 }
32 };
33 params.push(self_type);
34 has_self_param = true;
35 }
36 for param in param_list.params() {
37 let type_ref = TypeRef::from_ast_opt(param.ascribed_type());
38 params.push(type_ref);
39 }
40 }
41 let ret_type = if let Some(type_ref) = node.ret_type().and_then(|rt| rt.type_ref()) {
42 TypeRef::from_ast(type_ref)
43 } else {
44 TypeRef::unit()
45 };
46
47 let sig = FnSignature { name, params, ret_type, has_self_param };
48 Arc::new(sig)
49 }
50}
diff --git a/crates/ra_hir/src/code_model_impl/konst.rs b/crates/ra_hir/src/code_model_impl/konst.rs
deleted file mode 100644
index db4e5ce5c..000000000
--- a/crates/ra_hir/src/code_model_impl/konst.rs
+++ /dev/null
@@ -1,34 +0,0 @@
1use std::sync::Arc;
2
3use ra_syntax::ast::{NameOwner, TypeAscriptionOwner};
4
5use crate::{
6 Name, AsName, Const, ConstSignature, Static,
7 type_ref::{TypeRef},
8 DefDatabase,
9};
10
11fn const_signature_for<N: NameOwner + TypeAscriptionOwner>(node: &N) -> Arc<ConstSignature> {
12 let name = node.name().map(|n| n.as_name()).unwrap_or_else(Name::missing);
13 let type_ref = TypeRef::from_ast_opt(node.ascribed_type());
14 let sig = ConstSignature { name, type_ref };
15 Arc::new(sig)
16}
17
18impl ConstSignature {
19 pub(crate) fn const_signature_query(
20 db: &impl DefDatabase,
21 konst: Const,
22 ) -> Arc<ConstSignature> {
23 let (_, node) = konst.source(db);
24 const_signature_for(&*node)
25 }
26
27 pub(crate) fn static_signature_query(
28 db: &impl DefDatabase,
29 konst: Static,
30 ) -> Arc<ConstSignature> {
31 let (_, node) = konst.source(db);
32 const_signature_for(&*node)
33 }
34}
diff --git a/crates/ra_hir/src/code_model_impl/krate.rs b/crates/ra_hir/src/code_model_impl/krate.rs
deleted file mode 100644
index 914414fc3..000000000
--- a/crates/ra_hir/src/code_model_impl/krate.rs
+++ /dev/null
@@ -1,22 +0,0 @@
1use crate::{
2 Crate, CrateDependency, AsName, Module, DefDatabase,
3};
4
5impl Crate {
6 pub(crate) fn dependencies_impl(&self, db: &impl DefDatabase) -> Vec<CrateDependency> {
7 let crate_graph = db.crate_graph();
8 crate_graph
9 .dependencies(self.crate_id)
10 .map(|dep| {
11 let krate = Crate { crate_id: dep.crate_id() };
12 let name = dep.as_name();
13 CrateDependency { krate, name }
14 })
15 .collect()
16 }
17 pub(crate) fn root_module_impl(&self, db: &impl DefDatabase) -> Option<Module> {
18 let module_id = db.crate_def_map(*self).root();
19 let module = Module { krate: *self, module_id };
20 Some(module)
21 }
22}
diff --git a/crates/ra_hir/src/code_model_impl/module.rs b/crates/ra_hir/src/code_model_impl/module.rs
deleted file mode 100644
index 5c2ea73ce..000000000
--- a/crates/ra_hir/src/code_model_impl/module.rs
+++ /dev/null
@@ -1,99 +0,0 @@
1use ra_db::FileId;
2use ra_syntax::{ast, TreeArc};
3
4use crate::{
5 Module, ModuleSource, Name, AstId,
6 nameres::CrateModuleId,
7 HirDatabase, DefDatabase,
8 HirFileId,
9};
10
11impl ModuleSource {
12 pub(crate) fn new(
13 db: &impl DefDatabase,
14 file_id: Option<FileId>,
15 decl_id: Option<AstId<ast::Module>>,
16 ) -> ModuleSource {
17 match (file_id, decl_id) {
18 (Some(file_id), _) => {
19 let source_file = db.parse(file_id);
20 ModuleSource::SourceFile(source_file)
21 }
22 (None, Some(item_id)) => {
23 let module = item_id.to_node(db);
24 assert!(module.item_list().is_some(), "expected inline module");
25 ModuleSource::Module(module.to_owned())
26 }
27 (None, None) => panic!(),
28 }
29 }
30}
31
32impl Module {
33 fn with_module_id(&self, module_id: CrateModuleId) -> Module {
34 Module { module_id, krate: self.krate }
35 }
36
37 pub(crate) fn name_impl(&self, db: &impl HirDatabase) -> Option<Name> {
38 let def_map = db.crate_def_map(self.krate);
39 let parent = def_map[self.module_id].parent?;
40 def_map[parent].children.iter().find_map(|(name, module_id)| {
41 if *module_id == self.module_id {
42 Some(name.clone())
43 } else {
44 None
45 }
46 })
47 }
48
49 pub(crate) fn definition_source_impl(
50 &self,
51 db: &impl DefDatabase,
52 ) -> (HirFileId, ModuleSource) {
53 let def_map = db.crate_def_map(self.krate);
54 let decl_id = def_map[self.module_id].declaration;
55 let file_id = def_map[self.module_id].definition;
56 let module_source = ModuleSource::new(db, file_id, decl_id);
57 let file_id = file_id.map(HirFileId::from).unwrap_or_else(|| decl_id.unwrap().file_id());
58 (file_id, module_source)
59 }
60
61 pub(crate) fn declaration_source_impl(
62 &self,
63 db: &impl HirDatabase,
64 ) -> Option<(HirFileId, TreeArc<ast::Module>)> {
65 let def_map = db.crate_def_map(self.krate);
66 let decl = def_map[self.module_id].declaration?;
67 let ast = decl.to_node(db);
68 Some((decl.file_id(), ast))
69 }
70
71 pub(crate) fn crate_root_impl(&self, db: &impl DefDatabase) -> Module {
72 let def_map = db.crate_def_map(self.krate);
73 self.with_module_id(def_map.root())
74 }
75
76 /// Finds a child module with the specified name.
77 pub(crate) fn child_impl(&self, db: &impl HirDatabase, name: &Name) -> Option<Module> {
78 let def_map = db.crate_def_map(self.krate);
79 let child_id = def_map[self.module_id].children.get(name)?;
80 Some(self.with_module_id(*child_id))
81 }
82
83 /// Iterates over all child modules.
84 pub(crate) fn children_impl(&self, db: &impl DefDatabase) -> impl Iterator<Item = Module> {
85 let def_map = db.crate_def_map(self.krate);
86 let children = def_map[self.module_id]
87 .children
88 .iter()
89 .map(|(_, module_id)| self.with_module_id(*module_id))
90 .collect::<Vec<_>>();
91 children.into_iter()
92 }
93
94 pub(crate) fn parent_impl(&self, db: &impl DefDatabase) -> Option<Module> {
95 let def_map = db.crate_def_map(self.krate);
96 let parent_id = def_map[self.module_id].parent?;
97 Some(self.with_module_id(parent_id))
98 }
99}
diff --git a/crates/ra_hir/src/generics.rs b/crates/ra_hir/src/generics.rs
index 79a7fa23a..8effbbe35 100644
--- a/crates/ra_hir/src/generics.rs
+++ b/crates/ra_hir/src/generics.rs
@@ -9,7 +9,7 @@ use ra_syntax::ast::{self, NameOwner, TypeParamsOwner, TypeBoundsOwner, DefaultT
9 9
10use crate::{ 10use crate::{
11 db::{ HirDatabase, DefDatabase}, 11 db::{ HirDatabase, DefDatabase},
12 Name, AsName, Function, Struct, Enum, Trait, TypeAlias, ImplBlock, Container, path::Path, type_ref::TypeRef, AdtDef 12 Name, AsName, Function, Struct, Union, Enum, Trait, TypeAlias, ImplBlock, Container, path::Path, type_ref::TypeRef, AdtDef
13}; 13};
14 14
15/// Data about a generic parameter (to a function, struct, impl, ...). 15/// Data about a generic parameter (to a function, struct, impl, ...).
@@ -42,12 +42,13 @@ pub struct WherePredicate {
42pub enum GenericDef { 42pub enum GenericDef {
43 Function(Function), 43 Function(Function),
44 Struct(Struct), 44 Struct(Struct),
45 Union(Union),
45 Enum(Enum), 46 Enum(Enum),
46 Trait(Trait), 47 Trait(Trait),
47 TypeAlias(TypeAlias), 48 TypeAlias(TypeAlias),
48 ImplBlock(ImplBlock), 49 ImplBlock(ImplBlock),
49} 50}
50impl_froms!(GenericDef: Function, Struct, Enum, Trait, TypeAlias, ImplBlock); 51impl_froms!(GenericDef: Function, Struct, Union, Enum, Trait, TypeAlias, ImplBlock);
51 52
52impl GenericParams { 53impl GenericParams {
53 pub(crate) fn generic_params_query( 54 pub(crate) fn generic_params_query(
@@ -58,7 +59,10 @@ impl GenericParams {
58 let parent = match def { 59 let parent = match def {
59 GenericDef::Function(it) => it.container(db).map(GenericDef::from), 60 GenericDef::Function(it) => it.container(db).map(GenericDef::from),
60 GenericDef::TypeAlias(it) => it.container(db).map(GenericDef::from), 61 GenericDef::TypeAlias(it) => it.container(db).map(GenericDef::from),
61 GenericDef::Struct(_) | GenericDef::Enum(_) | GenericDef::Trait(_) => None, 62 GenericDef::Struct(_)
63 | GenericDef::Union(_)
64 | GenericDef::Enum(_)
65 | GenericDef::Trait(_) => None,
62 GenericDef::ImplBlock(_) => None, 66 GenericDef::ImplBlock(_) => None,
63 }; 67 };
64 generics.parent_params = parent.map(|p| db.generic_params(p)); 68 generics.parent_params = parent.map(|p| db.generic_params(p));
@@ -66,6 +70,7 @@ impl GenericParams {
66 match def { 70 match def {
67 GenericDef::Function(it) => generics.fill(&*it.source(db).1, start), 71 GenericDef::Function(it) => generics.fill(&*it.source(db).1, start),
68 GenericDef::Struct(it) => generics.fill(&*it.source(db).1, start), 72 GenericDef::Struct(it) => generics.fill(&*it.source(db).1, start),
73 GenericDef::Union(it) => generics.fill(&*it.source(db).1, start),
69 GenericDef::Enum(it) => generics.fill(&*it.source(db).1, start), 74 GenericDef::Enum(it) => generics.fill(&*it.source(db).1, start),
70 GenericDef::Trait(it) => { 75 GenericDef::Trait(it) => {
71 // traits get the Self type as an implicit first type parameter 76 // traits get the Self type as an implicit first type parameter
@@ -171,6 +176,7 @@ impl GenericDef {
171 match self { 176 match self {
172 GenericDef::Function(inner) => inner.resolver(db), 177 GenericDef::Function(inner) => inner.resolver(db),
173 GenericDef::Struct(inner) => inner.resolver(db), 178 GenericDef::Struct(inner) => inner.resolver(db),
179 GenericDef::Union(inner) => inner.resolver(db),
174 GenericDef::Enum(inner) => inner.resolver(db), 180 GenericDef::Enum(inner) => inner.resolver(db),
175 GenericDef::Trait(inner) => inner.resolver(db), 181 GenericDef::Trait(inner) => inner.resolver(db),
176 GenericDef::TypeAlias(inner) => inner.resolver(db), 182 GenericDef::TypeAlias(inner) => inner.resolver(db),
@@ -192,6 +198,7 @@ impl From<crate::adt::AdtDef> for GenericDef {
192 fn from(adt: crate::adt::AdtDef) -> Self { 198 fn from(adt: crate::adt::AdtDef) -> Self {
193 match adt { 199 match adt {
194 AdtDef::Struct(s) => s.into(), 200 AdtDef::Struct(s) => s.into(),
201 AdtDef::Union(u) => u.into(),
195 AdtDef::Enum(e) => e.into(), 202 AdtDef::Enum(e) => e.into(),
196 } 203 }
197 } 204 }
diff --git a/crates/ra_hir/src/impl_block.rs b/crates/ra_hir/src/impl_block.rs
index 51fa491c3..637f6ab83 100644
--- a/crates/ra_hir/src/impl_block.rs
+++ b/crates/ra_hir/src/impl_block.rs
@@ -15,7 +15,7 @@ use crate::{
15 resolve::Resolver, 15 resolve::Resolver,
16 ty::Ty, 16 ty::Ty,
17 generics::HasGenericParams, 17 generics::HasGenericParams,
18 code_model_api::{Module, ModuleSource} 18 code_model::{Module, ModuleSource}
19}; 19};
20 20
21#[derive(Debug, Default, PartialEq, Eq)] 21#[derive(Debug, Default, PartialEq, Eq)]
diff --git a/crates/ra_hir/src/lib.rs b/crates/ra_hir/src/lib.rs
index 0c6d7c2b7..fe2d4adee 100644
--- a/crates/ra_hir/src/lib.rs
+++ b/crates/ra_hir/src/lib.rs
@@ -42,8 +42,7 @@ mod docs;
42mod resolve; 42mod resolve;
43pub mod diagnostics; 43pub mod diagnostics;
44 44
45mod code_model_api; 45mod code_model;
46mod code_model_impl;
47 46
48#[cfg(test)] 47#[cfg(test)]
49mod marks; 48mod marks;
@@ -73,11 +72,11 @@ pub use self::{
73 source_binder::{SourceAnalyzer, PathResolution, ScopeEntryWithSyntax,MacroByExampleDef}, 72 source_binder::{SourceAnalyzer, PathResolution, ScopeEntryWithSyntax,MacroByExampleDef},
74}; 73};
75 74
76pub use self::code_model_api::{ 75pub use self::code_model::{
77 Crate, CrateDependency, 76 Crate, CrateDependency,
78 DefWithBody, 77 DefWithBody,
79 Module, ModuleDef, ModuleSource, 78 Module, ModuleDef, ModuleSource,
80 Struct, Enum, EnumVariant, 79 Struct, Union, Enum, EnumVariant,
81 Function, FnSignature, 80 Function, FnSignature,
82 StructField, FieldSource, 81 StructField, FieldSource,
83 Static, Const, ConstSignature, 82 Static, Const, ConstSignature,
diff --git a/crates/ra_hir/src/nameres/collector.rs b/crates/ra_hir/src/nameres/collector.rs
index c615d80c3..621236551 100644
--- a/crates/ra_hir/src/nameres/collector.rs
+++ b/crates/ra_hir/src/nameres/collector.rs
@@ -6,7 +6,7 @@ use ra_db::FileId;
6use ra_syntax::ast; 6use ra_syntax::ast;
7 7
8use crate::{ 8use crate::{
9 Function, Module, Struct, Enum, Const, Static, Trait, TypeAlias, 9 Function, Module, Struct, Union, Enum, Const, Static, Trait, TypeAlias,
10 DefDatabase, HirFileId, Name, Path, 10 DefDatabase, HirFileId, Name, Path,
11 KnownName, 11 KnownName,
12 nameres::{ 12 nameres::{
@@ -495,6 +495,10 @@ where
495 let s = def!(Struct, ast_id); 495 let s = def!(Struct, ast_id);
496 PerNs::both(s, s) 496 PerNs::both(s, s)
497 } 497 }
498 raw::DefKind::Union(ast_id) => {
499 let s = def!(Union, ast_id);
500 PerNs::both(s, s)
501 }
498 raw::DefKind::Enum(ast_id) => PerNs::types(def!(Enum, ast_id)), 502 raw::DefKind::Enum(ast_id) => PerNs::types(def!(Enum, ast_id)),
499 raw::DefKind::Const(ast_id) => PerNs::values(def!(Const, ast_id)), 503 raw::DefKind::Const(ast_id) => PerNs::values(def!(Const, ast_id)),
500 raw::DefKind::Static(ast_id) => PerNs::values(def!(Static, ast_id)), 504 raw::DefKind::Static(ast_id) => PerNs::values(def!(Static, ast_id)),
diff --git a/crates/ra_hir/src/nameres/raw.rs b/crates/ra_hir/src/nameres/raw.rs
index bd32b264b..1b4dcbb7a 100644
--- a/crates/ra_hir/src/nameres/raw.rs
+++ b/crates/ra_hir/src/nameres/raw.rs
@@ -1,7 +1,4 @@
1use std::{ 1use std::{sync::Arc, ops::Index};
2 sync::Arc,
3 ops::Index,
4};
5 2
6use test_utils::tested_by; 3use test_utils::tested_by;
7use ra_arena::{Arena, impl_arena_id, RawId, map::ArenaMap}; 4use ra_arena::{Arena, impl_arena_id, RawId, map::ArenaMap};
@@ -10,10 +7,7 @@ use ra_syntax::{
10 ast::{self, NameOwner, AttrsOwner}, 7 ast::{self, NameOwner, AttrsOwner},
11}; 8};
12 9
13use crate::{ 10use crate::{DefDatabase, Name, AsName, Path, HirFileId, ModuleSource, AstIdMap, FileAstId, Either};
14 DefDatabase, Name, AsName, Path, HirFileId, ModuleSource,
15 AstIdMap, FileAstId, Either,
16};
17 11
18/// `RawItems` is a set of top-level items in a file (except for impls). 12/// `RawItems` is a set of top-level items in a file (except for impls).
19/// 13///
@@ -161,6 +155,7 @@ pub(super) struct DefData {
161pub(super) enum DefKind { 155pub(super) enum DefKind {
162 Function(FileAstId<ast::FnDef>), 156 Function(FileAstId<ast::FnDef>),
163 Struct(FileAstId<ast::StructDef>), 157 Struct(FileAstId<ast::StructDef>),
158 Union(FileAstId<ast::StructDef>),
164 Enum(FileAstId<ast::EnumDef>), 159 Enum(FileAstId<ast::EnumDef>),
165 Const(FileAstId<ast::ConstDef>), 160 Const(FileAstId<ast::ConstDef>),
166 Static(FileAstId<ast::StaticDef>), 161 Static(FileAstId<ast::StaticDef>),
@@ -215,7 +210,13 @@ impl RawItemsCollector {
215 return; 210 return;
216 } 211 }
217 ast::ModuleItemKind::StructDef(it) => { 212 ast::ModuleItemKind::StructDef(it) => {
218 (DefKind::Struct(self.source_ast_id_map.ast_id(it)), it.name()) 213 let id = self.source_ast_id_map.ast_id(it);
214 let name = it.name();
215 if it.is_union() {
216 (DefKind::Union(id), name)
217 } else {
218 (DefKind::Struct(id), name)
219 }
219 } 220 }
220 ast::ModuleItemKind::EnumDef(it) => { 221 ast::ModuleItemKind::EnumDef(it) => {
221 (DefKind::Enum(self.source_ast_id_map.ast_id(it)), it.name()) 222 (DefKind::Enum(self.source_ast_id_map.ast_id(it)), it.name())
diff --git a/crates/ra_hir/src/resolve.rs b/crates/ra_hir/src/resolve.rs
index 3874e28bf..fedfe2fee 100644
--- a/crates/ra_hir/src/resolve.rs
+++ b/crates/ra_hir/src/resolve.rs
@@ -5,7 +5,7 @@ use rustc_hash::{FxHashMap, FxHashSet};
5 5
6use crate::{ 6use crate::{
7 ModuleDef, Trait, 7 ModuleDef, Trait,
8 code_model_api::Crate, 8 code_model::Crate,
9 MacroDefId, 9 MacroDefId,
10 db::HirDatabase, 10 db::HirDatabase,
11 name::{Name, KnownName}, 11 name::{Name, KnownName},
diff --git a/crates/ra_hir/src/ty.rs b/crates/ra_hir/src/ty.rs
index 3679a2242..76d34c12b 100644
--- a/crates/ra_hir/src/ty.rs
+++ b/crates/ra_hir/src/ty.rs
@@ -536,6 +536,7 @@ impl HirDisplay for ApplicationTy {
536 TypeCtor::Adt(def_id) => { 536 TypeCtor::Adt(def_id) => {
537 let name = match def_id { 537 let name = match def_id {
538 AdtDef::Struct(s) => s.name(f.db), 538 AdtDef::Struct(s) => s.name(f.db),
539 AdtDef::Union(u) => u.name(f.db),
539 AdtDef::Enum(e) => e.name(f.db), 540 AdtDef::Enum(e) => e.name(f.db),
540 } 541 }
541 .unwrap_or_else(Name::missing); 542 .unwrap_or_else(Name::missing);
diff --git a/crates/ra_hir/src/ty/infer.rs b/crates/ra_hir/src/ty/infer.rs
index a48272981..7d8250292 100644
--- a/crates/ra_hir/src/ty/infer.rs
+++ b/crates/ra_hir/src/ty/infer.rs
@@ -27,13 +27,13 @@ use ra_prof::profile;
27use test_utils::tested_by; 27use test_utils::tested_by;
28 28
29use crate::{ 29use crate::{
30 Function, StructField, Path, Name, 30 Function, StructField, Path, Name, FnSignature, AdtDef, ConstSignature, HirDatabase,
31 FnSignature, AdtDef,ConstSignature, 31 DefWithBody, ImplItem,
32 HirDatabase,
33 DefWithBody,
34 ImplItem,
35 type_ref::{TypeRef, Mutability}, 32 type_ref::{TypeRef, Mutability},
36 expr::{Body, Expr, BindingAnnotation, Literal, ExprId, Pat, PatId, UnaryOp, BinaryOp, Statement, FieldPat,Array, self}, 33 expr::{
34 Body, Expr, BindingAnnotation, Literal, ExprId, Pat, PatId, UnaryOp, BinaryOp, Statement,
35 FieldPat, Array, self,
36 },
37 generics::{GenericParams, HasGenericParams}, 37 generics::{GenericParams, HasGenericParams},
38 path::{GenericArgs, GenericArg}, 38 path::{GenericArgs, GenericArg},
39 ModuleDef, 39 ModuleDef,
@@ -644,7 +644,8 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
644 let ty = self.insert_type_vars(ty.apply_substs(substs)); 644 let ty = self.insert_type_vars(ty.apply_substs(substs));
645 (ty, Some(var.into())) 645 (ty, Some(var.into()))
646 } 646 }
647 TypableDef::TypeAlias(_) 647 TypableDef::Union(_)
648 | TypableDef::TypeAlias(_)
648 | TypableDef::Function(_) 649 | TypableDef::Function(_)
649 | TypableDef::Enum(_) 650 | TypableDef::Enum(_)
650 | TypableDef::Const(_) 651 | TypableDef::Const(_)
@@ -1407,7 +1408,11 @@ impl Expectation {
1407} 1408}
1408 1409
1409mod diagnostics { 1410mod diagnostics {
1410 use crate::{expr::ExprId, diagnostics::{DiagnosticSink, NoSuchField}, HirDatabase, Function}; 1411 use crate::{
1412 expr::ExprId,
1413 diagnostics::{DiagnosticSink, NoSuchField},
1414 HirDatabase, Function,
1415};
1411 1416
1412 #[derive(Debug, PartialEq, Eq, Clone)] 1417 #[derive(Debug, PartialEq, Eq, Clone)]
1413 pub(super) enum InferenceDiagnostic { 1418 pub(super) enum InferenceDiagnostic {
diff --git a/crates/ra_hir/src/ty/lower.rs b/crates/ra_hir/src/ty/lower.rs
index a1a2d0f6b..7defa7a9b 100644
--- a/crates/ra_hir/src/ty/lower.rs
+++ b/crates/ra_hir/src/ty/lower.rs
@@ -9,7 +9,7 @@ use std::sync::Arc;
9use std::iter; 9use std::iter;
10 10
11use crate::{ 11use crate::{
12 Function, Struct, StructField, Enum, EnumVariant, Path, ModuleDef, TypeAlias, Const, Static, 12 Function, Struct, Union, StructField, Enum, EnumVariant, Path, ModuleDef, TypeAlias, Const, Static,
13 HirDatabase, 13 HirDatabase,
14 type_ref::TypeRef, 14 type_ref::TypeRef,
15 name::KnownName, 15 name::KnownName,
@@ -124,6 +124,7 @@ impl Ty {
124 let def_generic: Option<GenericDef> = match resolved { 124 let def_generic: Option<GenericDef> = match resolved {
125 TypableDef::Function(func) => Some(func.into()), 125 TypableDef::Function(func) => Some(func.into()),
126 TypableDef::Struct(s) => Some(s.into()), 126 TypableDef::Struct(s) => Some(s.into()),
127 TypableDef::Union(u) => Some(u.into()),
127 TypableDef::Enum(e) => Some(e.into()), 128 TypableDef::Enum(e) => Some(e.into()),
128 TypableDef::EnumVariant(var) => Some(var.parent_enum(db).into()), 129 TypableDef::EnumVariant(var) => Some(var.parent_enum(db).into()),
129 TypableDef::TypeAlias(t) => Some(t.into()), 130 TypableDef::TypeAlias(t) => Some(t.into()),
@@ -144,6 +145,7 @@ impl Ty {
144 let segment = match resolved { 145 let segment = match resolved {
145 TypableDef::Function(_) 146 TypableDef::Function(_)
146 | TypableDef::Struct(_) 147 | TypableDef::Struct(_)
148 | TypableDef::Union(_)
147 | TypableDef::Enum(_) 149 | TypableDef::Enum(_)
148 | TypableDef::Const(_) 150 | TypableDef::Const(_)
149 | TypableDef::Static(_) 151 | TypableDef::Static(_)
@@ -293,12 +295,14 @@ pub(crate) fn type_for_def(db: &impl HirDatabase, def: TypableDef, ns: Namespace
293 (TypableDef::Struct(s), Namespace::Values) => type_for_struct_constructor(db, s), 295 (TypableDef::Struct(s), Namespace::Values) => type_for_struct_constructor(db, s),
294 (TypableDef::Enum(e), Namespace::Types) => type_for_adt(db, e), 296 (TypableDef::Enum(e), Namespace::Types) => type_for_adt(db, e),
295 (TypableDef::EnumVariant(v), Namespace::Values) => type_for_enum_variant_constructor(db, v), 297 (TypableDef::EnumVariant(v), Namespace::Values) => type_for_enum_variant_constructor(db, v),
298 (TypableDef::Union(u), Namespace::Types) => type_for_adt(db, u),
296 (TypableDef::TypeAlias(t), Namespace::Types) => type_for_type_alias(db, t), 299 (TypableDef::TypeAlias(t), Namespace::Types) => type_for_type_alias(db, t),
297 (TypableDef::Const(c), Namespace::Values) => type_for_const(db, c), 300 (TypableDef::Const(c), Namespace::Values) => type_for_const(db, c),
298 (TypableDef::Static(c), Namespace::Values) => type_for_static(db, c), 301 (TypableDef::Static(c), Namespace::Values) => type_for_static(db, c),
299 302
300 // 'error' cases: 303 // 'error' cases:
301 (TypableDef::Function(_), Namespace::Types) => Ty::Unknown, 304 (TypableDef::Function(_), Namespace::Types) => Ty::Unknown,
305 (TypableDef::Union(_), Namespace::Values) => Ty::Unknown,
302 (TypableDef::Enum(_), Namespace::Values) => Ty::Unknown, 306 (TypableDef::Enum(_), Namespace::Values) => Ty::Unknown,
303 (TypableDef::EnumVariant(_), Namespace::Types) => Ty::Unknown, 307 (TypableDef::EnumVariant(_), Namespace::Types) => Ty::Unknown,
304 (TypableDef::TypeAlias(_), Namespace::Values) => Ty::Unknown, 308 (TypableDef::TypeAlias(_), Namespace::Values) => Ty::Unknown,
@@ -467,19 +471,21 @@ fn type_for_type_alias(db: &impl HirDatabase, t: TypeAlias) -> Ty {
467pub enum TypableDef { 471pub enum TypableDef {
468 Function(Function), 472 Function(Function),
469 Struct(Struct), 473 Struct(Struct),
474 Union(Union),
470 Enum(Enum), 475 Enum(Enum),
471 EnumVariant(EnumVariant), 476 EnumVariant(EnumVariant),
472 TypeAlias(TypeAlias), 477 TypeAlias(TypeAlias),
473 Const(Const), 478 Const(Const),
474 Static(Static), 479 Static(Static),
475} 480}
476impl_froms!(TypableDef: Function, Struct, Enum, EnumVariant, TypeAlias, Const, Static); 481impl_froms!(TypableDef: Function, Struct, Union, Enum, EnumVariant, TypeAlias, Const, Static);
477 482
478impl From<ModuleDef> for Option<TypableDef> { 483impl From<ModuleDef> for Option<TypableDef> {
479 fn from(def: ModuleDef) -> Option<TypableDef> { 484 fn from(def: ModuleDef) -> Option<TypableDef> {
480 let res = match def { 485 let res = match def {
481 ModuleDef::Function(f) => f.into(), 486 ModuleDef::Function(f) => f.into(),
482 ModuleDef::Struct(s) => s.into(), 487 ModuleDef::Struct(s) => s.into(),
488 ModuleDef::Union(u) => u.into(),
483 ModuleDef::Enum(e) => e.into(), 489 ModuleDef::Enum(e) => e.into(),
484 ModuleDef::EnumVariant(v) => v.into(), 490 ModuleDef::EnumVariant(v) => v.into(),
485 ModuleDef::TypeAlias(t) => t.into(), 491 ModuleDef::TypeAlias(t) => t.into(),
diff --git a/crates/ra_ide_api/src/completion/complete_dot.rs b/crates/ra_ide_api/src/completion/complete_dot.rs
index 2e8084699..5bf289c63 100644
--- a/crates/ra_ide_api/src/completion/complete_dot.rs
+++ b/crates/ra_ide_api/src/completion/complete_dot.rs
@@ -66,16 +66,18 @@ mod tests {
66 } 66 }
67 ", 67 ",
68 ), 68 ),
69 @r###"[ 69 @r###"
70 CompletionItem { 70 â‹®[
71 label: "the_field", 71 â‹® CompletionItem {
72 source_range: [94; 94), 72 â‹® label: "the_field",
73 delete: [94; 94), 73 â‹® source_range: [94; 94),
74 insert: "the_field", 74 â‹® delete: [94; 94),
75 kind: Field, 75 â‹® insert: "the_field",
76 detail: "u32" 76 â‹® kind: Field,
77 } 77 â‹® detail: "u32",
78]"### 78 â‹® },
79 â‹®]
80 "###
79 ); 81 );
80 } 82 }
81 83
@@ -95,27 +97,29 @@ mod tests {
95 } 97 }
96 ", 98 ",
97 ), 99 ),
98 @r###"[ 100 @r###"
99 CompletionItem { 101 â‹®[
100 label: "foo", 102 â‹® CompletionItem {
101 source_range: [187; 187), 103 â‹® label: "foo",
102 delete: [187; 187), 104 â‹® source_range: [187; 187),
103 insert: "foo()$0", 105 â‹® delete: [187; 187),
104 kind: Method, 106 â‹® insert: "foo()$0",
105 detail: "fn foo(self)" 107 â‹® kind: Method,
106 }, 108 â‹® detail: "fn foo(self)",
107 CompletionItem { 109 â‹® },
108 label: "the_field", 110 â‹® CompletionItem {
109 source_range: [187; 187), 111 â‹® label: "the_field",
110 delete: [187; 187), 112 â‹® source_range: [187; 187),
111 insert: "the_field", 113 â‹® delete: [187; 187),
112 kind: Field, 114 â‹® insert: "the_field",
113 detail: "(u32,)", 115 â‹® kind: Field,
114 documentation: Documentation( 116 â‹® detail: "(u32,)",
115 "This is the_field" 117 â‹® documentation: Documentation(
116 ) 118 â‹® "This is the_field",
117 } 119 â‹® ),
118]"### 120 â‹® },
121 â‹®]
122 "###
119 ); 123 );
120 } 124 }
121 125
@@ -132,24 +136,26 @@ mod tests {
132 } 136 }
133 ", 137 ",
134 ), 138 ),
135 @r###"[ 139 @r###"
136 CompletionItem { 140 â‹®[
137 label: "foo", 141 â‹® CompletionItem {
138 source_range: [126; 126), 142 â‹® label: "foo",
139 delete: [126; 126), 143 â‹® source_range: [126; 126),
140 insert: "foo()$0", 144 â‹® delete: [126; 126),
141 kind: Method, 145 â‹® insert: "foo()$0",
142 detail: "fn foo(&self)" 146 â‹® kind: Method,
143 }, 147 â‹® detail: "fn foo(&self)",
144 CompletionItem { 148 â‹® },
145 label: "the_field", 149 â‹® CompletionItem {
146 source_range: [126; 126), 150 â‹® label: "the_field",
147 delete: [126; 126), 151 â‹® source_range: [126; 126),
148 insert: "the_field", 152 â‹® delete: [126; 126),
149 kind: Field, 153 â‹® insert: "the_field",
150 detail: "(u32, i32)" 154 â‹® kind: Field,
151 } 155 â‹® detail: "(u32, i32)",
152]"### 156 â‹® },
157 â‹®]
158 "###
153 ); 159 );
154 } 160 }
155 161
@@ -182,16 +188,18 @@ mod tests {
182 } 188 }
183 ", 189 ",
184 ), 190 ),
185 @r###"[ 191 @r###"
186 CompletionItem { 192 â‹®[
187 label: "the_method", 193 â‹® CompletionItem {
188 source_range: [144; 144), 194 â‹® label: "the_method",
189 delete: [144; 144), 195 â‹® source_range: [144; 144),
190 insert: "the_method()$0", 196 â‹® delete: [144; 144),
191 kind: Method, 197 â‹® insert: "the_method()$0",
192 detail: "fn the_method(&self)" 198 â‹® kind: Method,
193 } 199 â‹® detail: "fn the_method(&self)",
194]"### 200 â‹® },
201 â‹®]
202 "###
195 ); 203 );
196 } 204 }
197 205
@@ -208,16 +216,18 @@ mod tests {
208 } 216 }
209 ", 217 ",
210 ), 218 ),
211 @r###"[ 219 @r###"
212 CompletionItem { 220 â‹®[
213 label: "the_method", 221 â‹® CompletionItem {
214 source_range: [151; 151), 222 â‹® label: "the_method",
215 delete: [151; 151), 223 â‹® source_range: [151; 151),
216 insert: "the_method()$0", 224 â‹® delete: [151; 151),
217 kind: Method, 225 â‹® insert: "the_method()$0",
218 detail: "fn the_method(&self)" 226 â‹® kind: Method,
219 } 227 â‹® detail: "fn the_method(&self)",
220]"### 228 â‹® },
229 â‹®]
230 "###
221 ); 231 );
222 } 232 }
223 233
@@ -257,16 +267,18 @@ mod tests {
257 } 267 }
258 ", 268 ",
259 ), 269 ),
260 @r###"[ 270 @r###"
261 CompletionItem { 271 â‹®[
262 label: "the_method", 272 â‹® CompletionItem {
263 source_range: [249; 249), 273 â‹® label: "the_method",
264 delete: [249; 249), 274 â‹® source_range: [249; 249),
265 insert: "the_method()$0", 275 â‹® delete: [249; 249),
266 kind: Method, 276 â‹® insert: "the_method()$0",
267 detail: "fn the_method(&self)" 277 â‹® kind: Method,
268 } 278 â‹® detail: "fn the_method(&self)",
269]"### 279 â‹® },
280 â‹®]
281 "###
270 ); 282 );
271 } 283 }
272 284
@@ -281,24 +293,26 @@ mod tests {
281 } 293 }
282 ", 294 ",
283 ), 295 ),
284 @r###"[ 296 @r###"
285 CompletionItem { 297 â‹®[
286 label: "0", 298 â‹® CompletionItem {
287 source_range: [75; 75), 299 â‹® label: "0",
288 delete: [75; 75), 300 â‹® source_range: [75; 75),
289 insert: "0", 301 â‹® delete: [75; 75),
290 kind: Field, 302 â‹® insert: "0",
291 detail: "i32" 303 â‹® kind: Field,
292 }, 304 â‹® detail: "i32",
293 CompletionItem { 305 â‹® },
294 label: "1", 306 â‹® CompletionItem {
295 source_range: [75; 75), 307 â‹® label: "1",
296 delete: [75; 75), 308 â‹® source_range: [75; 75),
297 insert: "1", 309 â‹® delete: [75; 75),
298 kind: Field, 310 â‹® insert: "1",
299 detail: "f64" 311 â‹® kind: Field,
300 } 312 â‹® detail: "f64",
301]"### 313 â‹® },
314 â‹®]
315 "###
302 ); 316 );
303 } 317 }
304 318
@@ -322,16 +336,18 @@ mod tests {
322 } 336 }
323 ", 337 ",
324 ), 338 ),
325 @r###"[ 339 @r###"
326 CompletionItem { 340 â‹®[
327 label: "blah", 341 â‹® CompletionItem {
328 source_range: [299; 300), 342 â‹® label: "blah",
329 delete: [299; 300), 343 â‹® source_range: [299; 300),
330 insert: "blah()$0", 344 â‹® delete: [299; 300),
331 kind: Method, 345 â‹® insert: "blah()$0",
332 detail: "pub fn blah(&self)" 346 â‹® kind: Method,
333 } 347 â‹® detail: "pub fn blah(&self)",
334]"### 348 â‹® },
349 â‹®]
350 "###
335 ); 351 );
336 } 352 }
337 353
@@ -346,16 +362,18 @@ mod tests {
346 }; 362 };
347 ", 363 ",
348 ), 364 ),
349 @r###"[ 365 @r###"
350 CompletionItem { 366 â‹®[
351 label: "the_field", 367 â‹® CompletionItem {
352 source_range: [106; 106), 368 â‹® label: "the_field",
353 delete: [106; 106), 369 â‹® source_range: [106; 106),
354 insert: "the_field", 370 â‹® delete: [106; 106),
355 kind: Field, 371 â‹® insert: "the_field",
356 detail: "u32" 372 â‹® kind: Field,
357 } 373 â‹® detail: "u32",
358]"### 374 â‹® },
375 â‹®]
376 "###
359 ); 377 );
360 } 378 }
361} 379}
diff --git a/crates/ra_ide_api/src/completion/complete_fn_param.rs b/crates/ra_ide_api/src/completion/complete_fn_param.rs
index 85ef62f52..d738ffc13 100644
--- a/crates/ra_ide_api/src/completion/complete_fn_param.rs
+++ b/crates/ra_ide_api/src/completion/complete_fn_param.rs
@@ -71,15 +71,17 @@ mod tests {
71 fn baz(file<|>) {} 71 fn baz(file<|>) {}
72 ", 72 ",
73 ), 73 ),
74 @r###"[ 74 @r###"
75 CompletionItem { 75 â‹®[
76 label: "file_id: FileId", 76 â‹® CompletionItem {
77 source_range: [110; 114), 77 â‹® label: "file_id: FileId",
78 delete: [110; 114), 78 â‹® source_range: [110; 114),
79 insert: "file_id: FileId", 79 â‹® delete: [110; 114),
80 lookup: "file_id" 80 â‹® insert: "file_id: FileId",
81 } 81 â‹® lookup: "file_id",
82]"### 82 â‹® },
83 â‹®]
84 "###
83 ); 85 );
84 } 86 }
85 87
@@ -93,15 +95,17 @@ mod tests {
93 fn baz(file<|>, x: i32) {} 95 fn baz(file<|>, x: i32) {}
94 ", 96 ",
95 ), 97 ),
96 @r###"[ 98 @r###"
97 CompletionItem { 99 â‹®[
98 label: "file_id: FileId", 100 â‹® CompletionItem {
99 source_range: [110; 114), 101 â‹® label: "file_id: FileId",
100 delete: [110; 114), 102 â‹® source_range: [110; 114),
101 insert: "file_id: FileId", 103 â‹® delete: [110; 114),
102 lookup: "file_id" 104 â‹® insert: "file_id: FileId",
103 } 105 â‹® lookup: "file_id",
104]"### 106 â‹® },
107 â‹®]
108 "###
105 ); 109 );
106 } 110 }
107 111
@@ -118,15 +122,17 @@ mod tests {
118 } 122 }
119 ", 123 ",
120 ), 124 ),
121 @r###"[ 125 @r###"
122 CompletionItem { 126 â‹®[
123 label: "file_id: FileId", 127 â‹® CompletionItem {
124 source_range: [289; 293), 128 â‹® label: "file_id: FileId",
125 delete: [289; 293), 129 â‹® source_range: [289; 293),
126 insert: "file_id: FileId", 130 â‹® delete: [289; 293),
127 lookup: "file_id" 131 â‹® insert: "file_id: FileId",
128 } 132 â‹® lookup: "file_id",
129]"### 133 â‹® },
134 â‹®]
135 "###
130 ); 136 );
131 } 137 }
132} 138}
diff --git a/crates/ra_ide_api/src/completion/complete_pattern.rs b/crates/ra_ide_api/src/completion/complete_pattern.rs
index 0ef248687..74833a756 100644
--- a/crates/ra_ide_api/src/completion/complete_pattern.rs
+++ b/crates/ra_ide_api/src/completion/complete_pattern.rs
@@ -53,35 +53,37 @@ mod tests {
53 } 53 }
54 ", 54 ",
55 ); 55 );
56 assert_debug_snapshot_matches!(completions, @r###"[ 56 assert_debug_snapshot_matches!(completions, @r###"
57 CompletionItem { 57 â‹®[
58 label: "E", 58 â‹® CompletionItem {
59 source_range: [246; 246), 59 â‹® label: "E",
60 delete: [246; 246), 60 â‹® source_range: [246; 246),
61 insert: "E", 61 â‹® delete: [246; 246),
62 kind: Enum 62 â‹® insert: "E",
63 }, 63 â‹® kind: Enum,
64 CompletionItem { 64 â‹® },
65 label: "X", 65 â‹® CompletionItem {
66 source_range: [246; 246), 66 â‹® label: "X",
67 delete: [246; 246), 67 â‹® source_range: [246; 246),
68 insert: "X", 68 â‹® delete: [246; 246),
69 kind: EnumVariant 69 â‹® insert: "X",
70 }, 70 â‹® kind: EnumVariant,
71 CompletionItem { 71 â‹® },
72 label: "Z", 72 â‹® CompletionItem {
73 source_range: [246; 246), 73 â‹® label: "Z",
74 delete: [246; 246), 74 â‹® source_range: [246; 246),
75 insert: "Z", 75 â‹® delete: [246; 246),
76 kind: Const 76 â‹® insert: "Z",
77 }, 77 â‹® kind: Const,
78 CompletionItem { 78 â‹® },
79 label: "m", 79 â‹® CompletionItem {
80 source_range: [246; 246), 80 â‹® label: "m",
81 delete: [246; 246), 81 â‹® source_range: [246; 246),
82 insert: "m", 82 â‹® delete: [246; 246),
83 kind: Module 83 â‹® insert: "m",
84 } 84 â‹® kind: Module,
85]"###); 85 â‹® },
86 â‹®]
87 "###);
86 } 88 }
87} 89}
diff --git a/crates/ra_ide_api/src/completion/complete_struct_literal.rs b/crates/ra_ide_api/src/completion/complete_struct_literal.rs
index 48fbf67f7..1eeea58f6 100644
--- a/crates/ra_ide_api/src/completion/complete_struct_literal.rs
+++ b/crates/ra_ide_api/src/completion/complete_struct_literal.rs
@@ -20,6 +20,7 @@ pub(super) fn complete_struct_literal(acc: &mut Completions, ctx: &CompletionCon
20 } 20 }
21 21
22 // FIXME unions 22 // FIXME unions
23 AdtDef::Union(_) => (),
23 AdtDef::Enum(_) => (), 24 AdtDef::Enum(_) => (),
24 }; 25 };
25} 26}
@@ -43,15 +44,17 @@ mod tests {
43 } 44 }
44 ", 45 ",
45 ); 46 );
46 assert_debug_snapshot_matches!(completions, @r###"[ 47 assert_debug_snapshot_matches!(completions, @r###"
47 CompletionItem { 48 â‹®[
48 label: "the_field", 49 â‹® CompletionItem {
49 source_range: [83; 86), 50 â‹® label: "the_field",
50 delete: [83; 86), 51 â‹® source_range: [83; 86),
51 insert: "the_field", 52 â‹® delete: [83; 86),
52 kind: Field, 53 â‹® insert: "the_field",
53 detail: "u32" 54 â‹® kind: Field,
54 } 55 â‹® detail: "u32",
55]"###); 56 â‹® },
57 â‹®]
58 "###);
56 } 59 }
57} 60}
diff --git a/crates/ra_ide_api/src/completion/presentation.rs b/crates/ra_ide_api/src/completion/presentation.rs
index 9aa346688..064d379a4 100644
--- a/crates/ra_ide_api/src/completion/presentation.rs
+++ b/crates/ra_ide_api/src/completion/presentation.rs
@@ -63,6 +63,7 @@ impl Completions {
63 return self.add_function_with_name(ctx, Some(local_name), *func); 63 return self.add_function_with_name(ctx, Some(local_name), *func);
64 } 64 }
65 Resolution::Def(Struct(it)) => (CompletionItemKind::Struct, it.docs(ctx.db)), 65 Resolution::Def(Struct(it)) => (CompletionItemKind::Struct, it.docs(ctx.db)),
66 Resolution::Def(Union(it)) => (CompletionItemKind::Struct, it.docs(ctx.db)),
66 Resolution::Def(Enum(it)) => (CompletionItemKind::Enum, it.docs(ctx.db)), 67 Resolution::Def(Enum(it)) => (CompletionItemKind::Enum, it.docs(ctx.db)),
67 Resolution::Def(EnumVariant(it)) => (CompletionItemKind::EnumVariant, it.docs(ctx.db)), 68 Resolution::Def(EnumVariant(it)) => (CompletionItemKind::EnumVariant, it.docs(ctx.db)),
68 Resolution::Def(Const(it)) => (CompletionItemKind::Const, it.docs(ctx.db)), 69 Resolution::Def(Const(it)) => (CompletionItemKind::Const, it.docs(ctx.db)),
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__bindings_from_for.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__bindings_from_for.snap
index bd7f99f71..e9b717a45 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__bindings_from_for.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__bindings_from_for.snap
@@ -1,6 +1,6 @@
1--- 1---
2created: "2019-02-18T09:22:24.132341107Z" 2created: "2019-05-23T22:23:35.119822026Z"
3creator: insta@0.6.2 3creator: insta@0.8.1
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
6--- 6---
@@ -11,13 +11,13 @@ expression: kind_completions
11 delete: [83; 83), 11 delete: [83; 83),
12 insert: "quux()$0", 12 insert: "quux()$0",
13 kind: Function, 13 kind: Function,
14 detail: "fn quux()" 14 detail: "fn quux()",
15 }, 15 },
16 CompletionItem { 16 CompletionItem {
17 label: "x", 17 label: "x",
18 source_range: [83; 83), 18 source_range: [83; 83),
19 delete: [83; 83), 19 delete: [83; 83),
20 insert: "x", 20 insert: "x",
21 kind: Binding 21 kind: Binding,
22 } 22 },
23] 23]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__bindings_from_if_let.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__bindings_from_if_let.snap
index 3b374c4de..2a22201ad 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__bindings_from_if_let.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__bindings_from_if_let.snap
@@ -1,6 +1,6 @@
1--- 1---
2created: "2019-02-18T09:22:24.126809445Z" 2created: "2019-05-23T22:23:35.122168608Z"
3creator: insta@0.6.2 3creator: insta@0.8.1
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
6--- 6---
@@ -10,14 +10,14 @@ expression: kind_completions
10 source_range: [214; 214), 10 source_range: [214; 214),
11 delete: [214; 214), 11 delete: [214; 214),
12 insert: "a", 12 insert: "a",
13 kind: Binding 13 kind: Binding,
14 }, 14 },
15 CompletionItem { 15 CompletionItem {
16 label: "b", 16 label: "b",
17 source_range: [214; 214), 17 source_range: [214; 214),
18 delete: [214; 214), 18 delete: [214; 214),
19 insert: "b", 19 insert: "b",
20 kind: Binding 20 kind: Binding,
21 }, 21 },
22 CompletionItem { 22 CompletionItem {
23 label: "quux", 23 label: "quux",
@@ -25,6 +25,6 @@ expression: kind_completions
25 delete: [214; 214), 25 delete: [214; 214),
26 insert: "quux()$0", 26 insert: "quux()$0",
27 kind: Function, 27 kind: Function,
28 detail: "fn quux()" 28 detail: "fn quux()",
29 } 29 },
30] 30]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__bindings_from_let.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__bindings_from_let.snap
index 173f5319a..b9a5dc9c8 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__bindings_from_let.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__bindings_from_let.snap
@@ -1,6 +1,6 @@
1--- 1---
2created: "2019-02-18T09:22:24.126696322Z" 2created: "2019-05-23T22:23:35.122797188Z"
3creator: insta@0.6.2 3creator: insta@0.8.1
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
6--- 6---
@@ -11,20 +11,20 @@ expression: kind_completions
11 delete: [79; 79), 11 delete: [79; 79),
12 insert: "quux($0)", 12 insert: "quux($0)",
13 kind: Function, 13 kind: Function,
14 detail: "fn quux(x: i32)" 14 detail: "fn quux(x: i32)",
15 }, 15 },
16 CompletionItem { 16 CompletionItem {
17 label: "x", 17 label: "x",
18 source_range: [79; 79), 18 source_range: [79; 79),
19 delete: [79; 79), 19 delete: [79; 79),
20 insert: "x", 20 insert: "x",
21 kind: Binding 21 kind: Binding,
22 }, 22 },
23 CompletionItem { 23 CompletionItem {
24 label: "y", 24 label: "y",
25 source_range: [79; 79), 25 source_range: [79; 79),
26 delete: [79; 79), 26 delete: [79; 79),
27 insert: "y", 27 insert: "y",
28 kind: Binding 28 kind: Binding,
29 } 29 },
30] 30]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__completes_break_and_continue_in_loops1.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__completes_break_and_continue_in_loops1.snap
index 42ff02469..b6f95c1ff 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__completes_break_and_continue_in_loops1.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__completes_break_and_continue_in_loops1.snap
@@ -1,6 +1,6 @@
1--- 1---
2created: "2019-02-18T09:22:23.976673150Z" 2created: "2019-05-23T22:23:35.067956470Z"
3creator: insta@0.6.2 3creator: insta@0.8.1
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
6--- 6---
@@ -10,48 +10,48 @@ expression: kind_completions
10 source_range: [55; 55), 10 source_range: [55; 55),
11 delete: [55; 55), 11 delete: [55; 55),
12 insert: "break;", 12 insert: "break;",
13 kind: Keyword 13 kind: Keyword,
14 }, 14 },
15 CompletionItem { 15 CompletionItem {
16 label: "continue", 16 label: "continue",
17 source_range: [55; 55), 17 source_range: [55; 55),
18 delete: [55; 55), 18 delete: [55; 55),
19 insert: "continue;", 19 insert: "continue;",
20 kind: Keyword 20 kind: Keyword,
21 }, 21 },
22 CompletionItem { 22 CompletionItem {
23 label: "if", 23 label: "if",
24 source_range: [55; 55), 24 source_range: [55; 55),
25 delete: [55; 55), 25 delete: [55; 55),
26 insert: "if $0 {}", 26 insert: "if $0 {}",
27 kind: Keyword 27 kind: Keyword,
28 }, 28 },
29 CompletionItem { 29 CompletionItem {
30 label: "loop", 30 label: "loop",
31 source_range: [55; 55), 31 source_range: [55; 55),
32 delete: [55; 55), 32 delete: [55; 55),
33 insert: "loop {$0}", 33 insert: "loop {$0}",
34 kind: Keyword 34 kind: Keyword,
35 }, 35 },
36 CompletionItem { 36 CompletionItem {
37 label: "match", 37 label: "match",
38 source_range: [55; 55), 38 source_range: [55; 55),
39 delete: [55; 55), 39 delete: [55; 55),
40 insert: "match $0 {}", 40 insert: "match $0 {}",
41 kind: Keyword 41 kind: Keyword,
42 }, 42 },
43 CompletionItem { 43 CompletionItem {
44 label: "return", 44 label: "return",
45 source_range: [55; 55), 45 source_range: [55; 55),
46 delete: [55; 55), 46 delete: [55; 55),
47 insert: "return $0;", 47 insert: "return $0;",
48 kind: Keyword 48 kind: Keyword,
49 }, 49 },
50 CompletionItem { 50 CompletionItem {
51 label: "while", 51 label: "while",
52 source_range: [55; 55), 52 source_range: [55; 55),
53 delete: [55; 55), 53 delete: [55; 55),
54 insert: "while $0 {}", 54 insert: "while $0 {}",
55 kind: Keyword 55 kind: Keyword,
56 } 56 },
57] 57]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__completes_break_and_continue_in_loops2.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__completes_break_and_continue_in_loops2.snap
index 057ff8a7a..9b37478ef 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__completes_break_and_continue_in_loops2.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__completes_break_and_continue_in_loops2.snap
@@ -1,6 +1,6 @@
1--- 1---
2created: "2019-02-18T09:22:24.068967569Z" 2created: "2019-05-23T22:44:10.859967190Z"
3creator: insta@0.6.2 3creator: insta@0.8.1
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
6--- 6---
@@ -10,34 +10,34 @@ expression: kind_completions
10 source_range: [60; 60), 10 source_range: [60; 60),
11 delete: [60; 60), 11 delete: [60; 60),
12 insert: "if $0 {}", 12 insert: "if $0 {}",
13 kind: Keyword 13 kind: Keyword,
14 }, 14 },
15 CompletionItem { 15 CompletionItem {
16 label: "loop", 16 label: "loop",
17 source_range: [60; 60), 17 source_range: [60; 60),
18 delete: [60; 60), 18 delete: [60; 60),
19 insert: "loop {$0}", 19 insert: "loop {$0}",
20 kind: Keyword 20 kind: Keyword,
21 }, 21 },
22 CompletionItem { 22 CompletionItem {
23 label: "match", 23 label: "match",
24 source_range: [60; 60), 24 source_range: [60; 60),
25 delete: [60; 60), 25 delete: [60; 60),
26 insert: "match $0 {}", 26 insert: "match $0 {}",
27 kind: Keyword 27 kind: Keyword,
28 }, 28 },
29 CompletionItem { 29 CompletionItem {
30 label: "return", 30 label: "return",
31 source_range: [60; 60), 31 source_range: [60; 60),
32 delete: [60; 60), 32 delete: [60; 60),
33 insert: "return $0;", 33 insert: "return $0;",
34 kind: Keyword 34 kind: Keyword,
35 }, 35 },
36 CompletionItem { 36 CompletionItem {
37 label: "while", 37 label: "while",
38 source_range: [60; 60), 38 source_range: [60; 60),
39 delete: [60; 60), 39 delete: [60; 60),
40 insert: "while $0 {}", 40 insert: "while $0 {}",
41 kind: Keyword 41 kind: Keyword,
42 } 42 },
43] 43]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__completes_prelude.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__completes_prelude.snap
index 16126ee77..b339c6c5f 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__completes_prelude.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__completes_prelude.snap
@@ -1,6 +1,6 @@
1--- 1---
2created: "2019-02-18T09:22:24.180517434Z" 2created: "2019-05-23T22:23:35.139262926Z"
3creator: insta@0.6.2 3creator: insta@0.8.1
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
6--- 6---
@@ -10,7 +10,7 @@ expression: kind_completions
10 source_range: [18; 18), 10 source_range: [18; 18),
11 delete: [18; 18), 11 delete: [18; 18),
12 insert: "Option", 12 insert: "Option",
13 kind: Struct 13 kind: Struct,
14 }, 14 },
15 CompletionItem { 15 CompletionItem {
16 label: "foo", 16 label: "foo",
@@ -18,13 +18,13 @@ expression: kind_completions
18 delete: [18; 18), 18 delete: [18; 18),
19 insert: "foo()$0", 19 insert: "foo()$0",
20 kind: Function, 20 kind: Function,
21 detail: "fn foo()" 21 detail: "fn foo()",
22 }, 22 },
23 CompletionItem { 23 CompletionItem {
24 label: "std", 24 label: "std",
25 source_range: [18; 18), 25 source_range: [18; 18),
26 delete: [18; 18), 26 delete: [18; 18),
27 insert: "std", 27 insert: "std",
28 kind: Module 28 kind: Module,
29 } 29 },
30] 30]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__completes_use_paths_across_crates.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__completes_use_paths_across_crates.snap
index 2420e7744..113deafb1 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__completes_use_paths_across_crates.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__completes_use_paths_across_crates.snap
@@ -1,6 +1,6 @@
1--- 1---
2created: "2019-02-18T09:22:24.118807216Z" 2created: "2019-05-23T22:23:35.108690807Z"
3creator: insta@0.6.2 3creator: insta@0.8.1
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
6--- 6---
@@ -10,6 +10,6 @@ expression: kind_completions
10 source_range: [9; 9), 10 source_range: [9; 9),
11 delete: [9; 9), 11 delete: [9; 9),
12 insert: "bar", 12 insert: "bar",
13 kind: Module 13 kind: Module,
14 } 14 },
15] 15]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__deeply_nested_use_tree.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__deeply_nested_use_tree.snap
index c472f7965..aacdeb763 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__deeply_nested_use_tree.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__deeply_nested_use_tree.snap
@@ -1,6 +1,6 @@
1--- 1---
2created: "2019-02-18T09:22:24.044567777Z" 2created: "2019-05-23T22:23:35.085633034Z"
3creator: insta@0.6.2 3creator: insta@0.8.1
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
6--- 6---
@@ -10,6 +10,6 @@ expression: kind_completions
10 source_range: [23; 25), 10 source_range: [23; 25),
11 delete: [23; 25), 11 delete: [23; 25),
12 insert: "Spam", 12 insert: "Spam",
13 kind: Struct 13 kind: Struct,
14 } 14 },
15] 15]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__dont_add_semi_after_return_if_not_a_statement.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__dont_add_semi_after_return_if_not_a_statement.snap
index 97bd76c49..9d320c715 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__dont_add_semi_after_return_if_not_a_statement.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__dont_add_semi_after_return_if_not_a_statement.snap
@@ -1,6 +1,6 @@
1--- 1---
2created: "2019-02-18T09:22:23.987788705Z" 2created: "2019-05-23T22:23:35.081993214Z"
3creator: insta@0.6.2 3creator: insta@0.8.1
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
6--- 6---
@@ -10,34 +10,34 @@ expression: kind_completions
10 source_range: [85; 85), 10 source_range: [85; 85),
11 delete: [85; 85), 11 delete: [85; 85),
12 insert: "if $0 {}", 12 insert: "if $0 {}",
13 kind: Keyword 13 kind: Keyword,
14 }, 14 },
15 CompletionItem { 15 CompletionItem {
16 label: "loop", 16 label: "loop",
17 source_range: [85; 85), 17 source_range: [85; 85),
18 delete: [85; 85), 18 delete: [85; 85),
19 insert: "loop {$0}", 19 insert: "loop {$0}",
20 kind: Keyword 20 kind: Keyword,
21 }, 21 },
22 CompletionItem { 22 CompletionItem {
23 label: "match", 23 label: "match",
24 source_range: [85; 85), 24 source_range: [85; 85),
25 delete: [85; 85), 25 delete: [85; 85),
26 insert: "match $0 {}", 26 insert: "match $0 {}",
27 kind: Keyword 27 kind: Keyword,
28 }, 28 },
29 CompletionItem { 29 CompletionItem {
30 label: "return", 30 label: "return",
31 source_range: [85; 85), 31 source_range: [85; 85),
32 delete: [85; 85), 32 delete: [85; 85),
33 insert: "return $0", 33 insert: "return $0",
34 kind: Keyword 34 kind: Keyword,
35 }, 35 },
36 CompletionItem { 36 CompletionItem {
37 label: "while", 37 label: "while",
38 source_range: [85; 85), 38 source_range: [85; 85),
39 delete: [85; 85), 39 delete: [85; 85),
40 insert: "while $0 {}", 40 insert: "while $0 {}",
41 kind: Keyword 41 kind: Keyword,
42 } 42 },
43] 43]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__dont_render_function_parens_if_already_call.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__dont_render_function_parens_if_already_call.snap
index 1de0efb5b..46bea2ccd 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__dont_render_function_parens_if_already_call.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__dont_render_function_parens_if_already_call.snap
@@ -1,6 +1,6 @@
1--- 1---
2created: "2019-02-18T09:22:24.211680376Z" 2created: "2019-05-23T22:23:35.158296242Z"
3creator: insta@0.6.2 3creator: insta@0.8.1
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
6--- 6---
@@ -11,7 +11,7 @@ expression: kind_completions
11 delete: [35; 39), 11 delete: [35; 39),
12 insert: "frobnicate", 12 insert: "frobnicate",
13 kind: Function, 13 kind: Function,
14 detail: "fn frobnicate()" 14 detail: "fn frobnicate()",
15 }, 15 },
16 CompletionItem { 16 CompletionItem {
17 label: "main", 17 label: "main",
@@ -19,6 +19,6 @@ expression: kind_completions
19 delete: [35; 39), 19 delete: [35; 39),
20 insert: "main", 20 insert: "main",
21 kind: Function, 21 kind: Function,
22 detail: "fn main()" 22 detail: "fn main()",
23 } 23 },
24] 24]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__dont_render_function_parens_if_already_call_assoc_fn.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__dont_render_function_parens_if_already_call_assoc_fn.snap
index 19375ea95..b09a6745e 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__dont_render_function_parens_if_already_call_assoc_fn.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__dont_render_function_parens_if_already_call_assoc_fn.snap
@@ -1,6 +1,6 @@
1--- 1---
2created: "2019-02-24T16:33:48.008220694Z" 2created: "2019-05-23T22:44:10.920136527Z"
3creator: insta@0.6.3 3creator: insta@0.8.1
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
6--- 6---
@@ -11,6 +11,6 @@ expression: kind_completions
11 delete: [67; 69), 11 delete: [67; 69),
12 insert: "new", 12 insert: "new",
13 kind: Function, 13 kind: Function,
14 detail: "fn new() -> Foo" 14 detail: "fn new() -> Foo",
15 } 15 },
16] 16]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__dont_render_function_parens_in_use_item.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__dont_render_function_parens_in_use_item.snap
index ef77816ec..84ccc8160 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__dont_render_function_parens_in_use_item.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__dont_render_function_parens_in_use_item.snap
@@ -1,6 +1,6 @@
1--- 1---
2created: "2019-02-18T09:22:24.213677341Z" 2created: "2019-05-23T22:23:35.154795561Z"
3creator: insta@0.6.2 3creator: insta@0.8.1
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
6--- 6---
@@ -11,6 +11,6 @@ expression: kind_completions
11 delete: [40; 41), 11 delete: [40; 41),
12 insert: "foo", 12 insert: "foo",
13 kind: Function, 13 kind: Function,
14 detail: "pub fn foo()" 14 detail: "pub fn foo()",
15 } 15 },
16] 16]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__dont_show_both_completions_for_shadowing.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__dont_show_both_completions_for_shadowing.snap
index 34adcda6c..57434210d 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__dont_show_both_completions_for_shadowing.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__dont_show_both_completions_for_shadowing.snap
@@ -1,6 +1,6 @@
1--- 1---
2created: "2019-04-04T14:52:24.531844100Z" 2created: "2019-05-23T22:23:35.142044205Z"
3creator: insta@0.7.4 3creator: insta@0.8.1
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
6--- 6---
@@ -10,7 +10,7 @@ expression: kind_completions
10 source_range: [126; 126), 10 source_range: [126; 126),
11 delete: [126; 126), 11 delete: [126; 126),
12 insert: "bar", 12 insert: "bar",
13 kind: Binding 13 kind: Binding,
14 }, 14 },
15 CompletionItem { 15 CompletionItem {
16 label: "foo", 16 label: "foo",
@@ -18,6 +18,6 @@ expression: kind_completions
18 delete: [126; 126), 18 delete: [126; 126),
19 insert: "foo()$0", 19 insert: "foo()$0",
20 kind: Function, 20 kind: Function,
21 detail: "fn foo()" 21 detail: "fn foo()",
22 } 22 },
23] 23]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__enum_variant.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__enum_variant.snap
index 1df121523..e40217ca8 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__enum_variant.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__enum_variant.snap
@@ -1,6 +1,6 @@
1--- 1---
2created: "2019-02-18T09:22:24.045355450Z" 2created: "2019-05-23T22:23:35.090178265Z"
3creator: insta@0.6.2 3creator: insta@0.8.1
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
6--- 6---
@@ -13,8 +13,8 @@ expression: kind_completions
13 kind: EnumVariant, 13 kind: EnumVariant,
14 detail: "(i32)", 14 detail: "(i32)",
15 documentation: Documentation( 15 documentation: Documentation(
16 "Bar Variant with i32" 16 "Bar Variant with i32",
17 ) 17 ),
18 }, 18 },
19 CompletionItem { 19 CompletionItem {
20 label: "Foo", 20 label: "Foo",
@@ -24,7 +24,7 @@ expression: kind_completions
24 kind: EnumVariant, 24 kind: EnumVariant,
25 detail: "()", 25 detail: "()",
26 documentation: Documentation( 26 documentation: Documentation(
27 "Foo Variant" 27 "Foo Variant",
28 ) 28 ),
29 } 29 },
30] 30]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__enum_variant_with_details.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__enum_variant_with_details.snap
index daccd9fba..e09d7988a 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__enum_variant_with_details.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__enum_variant_with_details.snap
@@ -1,6 +1,6 @@
1--- 1---
2created: "2019-04-02T07:43:12.954637543Z" 2created: "2019-05-23T22:23:35.091325331Z"
3creator: insta@0.7.4 3creator: insta@0.8.1
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
6--- 6---
@@ -13,8 +13,8 @@ expression: kind_completions
13 kind: EnumVariant, 13 kind: EnumVariant,
14 detail: "(i32, u32)", 14 detail: "(i32, u32)",
15 documentation: Documentation( 15 documentation: Documentation(
16 "Bar Variant with i32 and u32" 16 "Bar Variant with i32 and u32",
17 ) 17 ),
18 }, 18 },
19 CompletionItem { 19 CompletionItem {
20 label: "Foo", 20 label: "Foo",
@@ -24,8 +24,8 @@ expression: kind_completions
24 kind: EnumVariant, 24 kind: EnumVariant,
25 detail: "()", 25 detail: "()",
26 documentation: Documentation( 26 documentation: Documentation(
27 "Foo Variant (empty)" 27 "Foo Variant (empty)",
28 ) 28 ),
29 }, 29 },
30 CompletionItem { 30 CompletionItem {
31 label: "S", 31 label: "S",
@@ -35,7 +35,7 @@ expression: kind_completions
35 kind: EnumVariant, 35 kind: EnumVariant,
36 detail: "(S)", 36 detail: "(S)",
37 documentation: Documentation( 37 documentation: Documentation(
38 "" 38 "",
39 ) 39 ),
40 } 40 },
41] 41]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__extern_prelude.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__extern_prelude.snap
index 0d36fd603..b9449a76c 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__extern_prelude.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__extern_prelude.snap
@@ -1,6 +1,6 @@
1--- 1---
2created: "2019-02-18T09:22:24.137183638Z" 2created: "2019-05-23T22:23:35.123197049Z"
3creator: insta@0.6.2 3creator: insta@0.8.1
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
6--- 6---
@@ -10,6 +10,6 @@ expression: kind_completions
10 source_range: [4; 4), 10 source_range: [4; 4),
11 delete: [4; 4), 11 delete: [4; 4),
12 insert: "other_crate", 12 insert: "other_crate",
13 kind: Module 13 kind: Module,
14 } 14 },
15] 15]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__generic_params.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__generic_params.snap
index 210e5a02d..eb1a4151a 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__generic_params.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__generic_params.snap
@@ -1,6 +1,6 @@
1--- 1---
2created: "2019-02-18T09:22:24.143253235Z" 2created: "2019-05-23T22:23:35.123825399Z"
3creator: insta@0.6.2 3creator: insta@0.8.1
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
6--- 6---
@@ -10,7 +10,7 @@ expression: kind_completions
10 source_range: [44; 44), 10 source_range: [44; 44),
11 delete: [44; 44), 11 delete: [44; 44),
12 insert: "T", 12 insert: "T",
13 kind: TypeParam 13 kind: TypeParam,
14 }, 14 },
15 CompletionItem { 15 CompletionItem {
16 label: "quux", 16 label: "quux",
@@ -18,6 +18,6 @@ expression: kind_completions
18 delete: [44; 44), 18 delete: [44; 44),
19 insert: "quux()$0", 19 insert: "quux()$0",
20 kind: Function, 20 kind: Function,
21 detail: "fn quux<T>()" 21 detail: "fn quux<T>()",
22 } 22 },
23] 23]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__generic_params_in_struct.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__generic_params_in_struct.snap
index ab8c30446..52f08267f 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__generic_params_in_struct.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__generic_params_in_struct.snap
@@ -1,6 +1,6 @@
1--- 1---
2created: "2019-02-18T09:22:24.149424158Z" 2created: "2019-05-23T22:23:35.130778739Z"
3creator: insta@0.6.2 3creator: insta@0.8.1
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
6--- 6---
@@ -10,13 +10,13 @@ expression: kind_completions
10 source_range: [46; 46), 10 source_range: [46; 46),
11 delete: [46; 46), 11 delete: [46; 46),
12 insert: "T", 12 insert: "T",
13 kind: TypeParam 13 kind: TypeParam,
14 }, 14 },
15 CompletionItem { 15 CompletionItem {
16 label: "X", 16 label: "X",
17 source_range: [46; 46), 17 source_range: [46; 46),
18 delete: [46; 46), 18 delete: [46; 46),
19 insert: "X", 19 insert: "X",
20 kind: Struct 20 kind: Struct,
21 } 21 },
22] 22]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__inserts_parens_for_function_calls1.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__inserts_parens_for_function_calls1.snap
index a4fc447b2..c795b9aae 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__inserts_parens_for_function_calls1.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__inserts_parens_for_function_calls1.snap
@@ -1,6 +1,6 @@
1--- 1---
2created: "2019-02-18T09:22:24.224510370Z" 2created: "2019-05-23T22:23:35.156115632Z"
3creator: insta@0.6.2 3creator: insta@0.8.1
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
6--- 6---
@@ -11,7 +11,7 @@ expression: kind_completions
11 delete: [53; 56), 11 delete: [53; 56),
12 insert: "main()$0", 12 insert: "main()$0",
13 kind: Function, 13 kind: Function,
14 detail: "fn main()" 14 detail: "fn main()",
15 }, 15 },
16 CompletionItem { 16 CompletionItem {
17 label: "no_args", 17 label: "no_args",
@@ -19,6 +19,6 @@ expression: kind_completions
19 delete: [53; 56), 19 delete: [53; 56),
20 insert: "no_args()$0", 20 insert: "no_args()$0",
21 kind: Function, 21 kind: Function,
22 detail: "fn no_args()" 22 detail: "fn no_args()",
23 } 23 },
24] 24]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__inserts_parens_for_function_calls2.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__inserts_parens_for_function_calls2.snap
index b124355d5..b49a838e0 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__inserts_parens_for_function_calls2.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__inserts_parens_for_function_calls2.snap
@@ -1,6 +1,6 @@
1--- 1---
2created: "2019-02-18T09:22:24.267013140Z" 2created: "2019-05-23T22:44:10.916806744Z"
3creator: insta@0.6.2 3creator: insta@0.8.1
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
6--- 6---
@@ -11,7 +11,7 @@ expression: kind_completions
11 delete: [72; 77), 11 delete: [72; 77),
12 insert: "main()$0", 12 insert: "main()$0",
13 kind: Function, 13 kind: Function,
14 detail: "fn main()" 14 detail: "fn main()",
15 }, 15 },
16 CompletionItem { 16 CompletionItem {
17 label: "with_args", 17 label: "with_args",
@@ -19,6 +19,6 @@ expression: kind_completions
19 delete: [72; 77), 19 delete: [72; 77),
20 insert: "with_args($0)", 20 insert: "with_args($0)",
21 kind: Function, 21 kind: Function,
22 detail: "fn with_args(x: i32, y: String)" 22 detail: "fn with_args(x: i32, y: String)",
23 } 23 },
24] 24]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__inserts_parens_for_function_calls3.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__inserts_parens_for_function_calls3.snap
index fec729d48..b62cb7aa1 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__inserts_parens_for_function_calls3.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__inserts_parens_for_function_calls3.snap
@@ -1,6 +1,6 @@
1--- 1---
2created: "2019-02-18T09:22:24.303360770Z" 2created: "2019-05-23T22:44:40.543731193Z"
3creator: insta@0.6.2 3creator: insta@0.8.1
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
6--- 6---
@@ -11,6 +11,6 @@ expression: kind_completions
11 delete: [139; 140), 11 delete: [139; 140),
12 insert: "foo()$0", 12 insert: "foo()$0",
13 kind: Method, 13 kind: Method,
14 detail: "fn foo(&self)" 14 detail: "fn foo(&self)",
15 } 15 },
16] 16]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_function1.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_function1.snap
index 045e2a4e6..34a44bb70 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_function1.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_function1.snap
@@ -1,6 +1,6 @@
1--- 1---
2created: "2019-02-18T09:22:23.987788720Z" 2created: "2019-05-23T22:23:35.075690846Z"
3creator: insta@0.6.2 3creator: insta@0.8.1
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
6--- 6---
@@ -10,34 +10,34 @@ expression: kind_completions
10 source_range: [41; 41), 10 source_range: [41; 41),
11 delete: [41; 41), 11 delete: [41; 41),
12 insert: "if $0 {}", 12 insert: "if $0 {}",
13 kind: Keyword 13 kind: Keyword,
14 }, 14 },
15 CompletionItem { 15 CompletionItem {
16 label: "loop", 16 label: "loop",
17 source_range: [41; 41), 17 source_range: [41; 41),
18 delete: [41; 41), 18 delete: [41; 41),
19 insert: "loop {$0}", 19 insert: "loop {$0}",
20 kind: Keyword 20 kind: Keyword,
21 }, 21 },
22 CompletionItem { 22 CompletionItem {
23 label: "match", 23 label: "match",
24 source_range: [41; 41), 24 source_range: [41; 41),
25 delete: [41; 41), 25 delete: [41; 41),
26 insert: "match $0 {}", 26 insert: "match $0 {}",
27 kind: Keyword 27 kind: Keyword,
28 }, 28 },
29 CompletionItem { 29 CompletionItem {
30 label: "return", 30 label: "return",
31 source_range: [41; 41), 31 source_range: [41; 41),
32 delete: [41; 41), 32 delete: [41; 41),
33 insert: "return;", 33 insert: "return;",
34 kind: Keyword 34 kind: Keyword,
35 }, 35 },
36 CompletionItem { 36 CompletionItem {
37 label: "while", 37 label: "while",
38 source_range: [41; 41), 38 source_range: [41; 41),
39 delete: [41; 41), 39 delete: [41; 41),
40 insert: "while $0 {}", 40 insert: "while $0 {}",
41 kind: Keyword 41 kind: Keyword,
42 } 42 },
43] 43]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_function2.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_function2.snap
index b08efa522..ac744f362 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_function2.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_function2.snap
@@ -1,6 +1,6 @@
1--- 1---
2created: "2019-02-18T09:22:23.984740354Z" 2created: "2019-05-23T22:23:35.068799431Z"
3creator: insta@0.6.2 3creator: insta@0.8.1
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
6--- 6---
@@ -10,48 +10,48 @@ expression: kind_completions
10 source_range: [92; 92), 10 source_range: [92; 92),
11 delete: [92; 92), 11 delete: [92; 92),
12 insert: "else {$0}", 12 insert: "else {$0}",
13 kind: Keyword 13 kind: Keyword,
14 }, 14 },
15 CompletionItem { 15 CompletionItem {
16 label: "else if", 16 label: "else if",
17 source_range: [92; 92), 17 source_range: [92; 92),
18 delete: [92; 92), 18 delete: [92; 92),
19 insert: "else if $0 {}", 19 insert: "else if $0 {}",
20 kind: Keyword 20 kind: Keyword,
21 }, 21 },
22 CompletionItem { 22 CompletionItem {
23 label: "if", 23 label: "if",
24 source_range: [92; 92), 24 source_range: [92; 92),
25 delete: [92; 92), 25 delete: [92; 92),
26 insert: "if $0 {}", 26 insert: "if $0 {}",
27 kind: Keyword 27 kind: Keyword,
28 }, 28 },
29 CompletionItem { 29 CompletionItem {
30 label: "loop", 30 label: "loop",
31 source_range: [92; 92), 31 source_range: [92; 92),
32 delete: [92; 92), 32 delete: [92; 92),
33 insert: "loop {$0}", 33 insert: "loop {$0}",
34 kind: Keyword 34 kind: Keyword,
35 }, 35 },
36 CompletionItem { 36 CompletionItem {
37 label: "match", 37 label: "match",
38 source_range: [92; 92), 38 source_range: [92; 92),
39 delete: [92; 92), 39 delete: [92; 92),
40 insert: "match $0 {}", 40 insert: "match $0 {}",
41 kind: Keyword 41 kind: Keyword,
42 }, 42 },
43 CompletionItem { 43 CompletionItem {
44 label: "return", 44 label: "return",
45 source_range: [92; 92), 45 source_range: [92; 92),
46 delete: [92; 92), 46 delete: [92; 92),
47 insert: "return;", 47 insert: "return;",
48 kind: Keyword 48 kind: Keyword,
49 }, 49 },
50 CompletionItem { 50 CompletionItem {
51 label: "while", 51 label: "while",
52 source_range: [92; 92), 52 source_range: [92; 92),
53 delete: [92; 92), 53 delete: [92; 92),
54 insert: "while $0 {}", 54 insert: "while $0 {}",
55 kind: Keyword 55 kind: Keyword,
56 } 56 },
57] 57]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_function3.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_function3.snap
index e2b9214fb..1098ecf54 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_function3.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_function3.snap
@@ -1,6 +1,6 @@
1--- 1---
2created: "2019-02-18T09:22:24.049699338Z" 2created: "2019-05-23T22:23:35.085655258Z"
3creator: insta@0.6.2 3creator: insta@0.8.1
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
6--- 6---
@@ -10,34 +10,34 @@ expression: kind_completions
10 source_range: [48; 48), 10 source_range: [48; 48),
11 delete: [48; 48), 11 delete: [48; 48),
12 insert: "if $0 {}", 12 insert: "if $0 {}",
13 kind: Keyword 13 kind: Keyword,
14 }, 14 },
15 CompletionItem { 15 CompletionItem {
16 label: "loop", 16 label: "loop",
17 source_range: [48; 48), 17 source_range: [48; 48),
18 delete: [48; 48), 18 delete: [48; 48),
19 insert: "loop {$0}", 19 insert: "loop {$0}",
20 kind: Keyword 20 kind: Keyword,
21 }, 21 },
22 CompletionItem { 22 CompletionItem {
23 label: "match", 23 label: "match",
24 source_range: [48; 48), 24 source_range: [48; 48),
25 delete: [48; 48), 25 delete: [48; 48),
26 insert: "match $0 {}", 26 insert: "match $0 {}",
27 kind: Keyword 27 kind: Keyword,
28 }, 28 },
29 CompletionItem { 29 CompletionItem {
30 label: "return", 30 label: "return",
31 source_range: [48; 48), 31 source_range: [48; 48),
32 delete: [48; 48), 32 delete: [48; 48),
33 insert: "return $0;", 33 insert: "return $0;",
34 kind: Keyword 34 kind: Keyword,
35 }, 35 },
36 CompletionItem { 36 CompletionItem {
37 label: "while", 37 label: "while",
38 source_range: [48; 48), 38 source_range: [48; 48),
39 delete: [48; 48), 39 delete: [48; 48),
40 insert: "while $0 {}", 40 insert: "while $0 {}",
41 kind: Keyword 41 kind: Keyword,
42 } 42 },
43] 43]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_function4.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_function4.snap
index 1ea7eb5ce..3c5eca1ba 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_function4.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_function4.snap
@@ -1,6 +1,6 @@
1--- 1---
2created: "2019-02-18T09:22:24.090949782Z" 2created: "2019-05-23T22:44:10.869539856Z"
3creator: insta@0.6.2 3creator: insta@0.8.1
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
6--- 6---
@@ -10,34 +10,34 @@ expression: kind_completions
10 source_range: [41; 41), 10 source_range: [41; 41),
11 delete: [41; 41), 11 delete: [41; 41),
12 insert: "if $0 {}", 12 insert: "if $0 {}",
13 kind: Keyword 13 kind: Keyword,
14 }, 14 },
15 CompletionItem { 15 CompletionItem {
16 label: "loop", 16 label: "loop",
17 source_range: [41; 41), 17 source_range: [41; 41),
18 delete: [41; 41), 18 delete: [41; 41),
19 insert: "loop {$0}", 19 insert: "loop {$0}",
20 kind: Keyword 20 kind: Keyword,
21 }, 21 },
22 CompletionItem { 22 CompletionItem {
23 label: "match", 23 label: "match",
24 source_range: [41; 41), 24 source_range: [41; 41),
25 delete: [41; 41), 25 delete: [41; 41),
26 insert: "match $0 {}", 26 insert: "match $0 {}",
27 kind: Keyword 27 kind: Keyword,
28 }, 28 },
29 CompletionItem { 29 CompletionItem {
30 label: "return", 30 label: "return",
31 source_range: [41; 41), 31 source_range: [41; 41),
32 delete: [41; 41), 32 delete: [41; 41),
33 insert: "return;", 33 insert: "return;",
34 kind: Keyword 34 kind: Keyword,
35 }, 35 },
36 CompletionItem { 36 CompletionItem {
37 label: "while", 37 label: "while",
38 source_range: [41; 41), 38 source_range: [41; 41),
39 delete: [41; 41), 39 delete: [41; 41),
40 insert: "while $0 {}", 40 insert: "while $0 {}",
41 kind: Keyword 41 kind: Keyword,
42 } 42 },
43] 43]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_use_stmt1.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_use_stmt1.snap
index 76d5daf55..71d7e9de8 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_use_stmt1.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_use_stmt1.snap
@@ -1,6 +1,6 @@
1--- 1---
2created: "2019-02-18T09:22:23.988755424Z" 2created: "2019-05-23T22:23:35.066687241Z"
3creator: insta@0.6.2 3creator: insta@0.8.1
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
6--- 6---
@@ -10,20 +10,20 @@ expression: kind_completions
10 source_range: [17; 17), 10 source_range: [17; 17),
11 delete: [17; 17), 11 delete: [17; 17),
12 insert: "crate::", 12 insert: "crate::",
13 kind: Keyword 13 kind: Keyword,
14 }, 14 },
15 CompletionItem { 15 CompletionItem {
16 label: "self", 16 label: "self",
17 source_range: [17; 17), 17 source_range: [17; 17),
18 delete: [17; 17), 18 delete: [17; 17),
19 insert: "self", 19 insert: "self",
20 kind: Keyword 20 kind: Keyword,
21 }, 21 },
22 CompletionItem { 22 CompletionItem {
23 label: "super", 23 label: "super",
24 source_range: [17; 17), 24 source_range: [17; 17),
25 delete: [17; 17), 25 delete: [17; 17),
26 insert: "super::", 26 insert: "super::",
27 kind: Keyword 27 kind: Keyword,
28 } 28 },
29] 29]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_use_stmt2.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_use_stmt2.snap
index ee8bf4ca1..ad156fb44 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_use_stmt2.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_use_stmt2.snap
@@ -1,6 +1,6 @@
1--- 1---
2created: "2019-02-18T09:22:24.030382527Z" 2created: "2019-05-23T22:44:10.859494330Z"
3creator: insta@0.6.2 3creator: insta@0.8.1
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
6--- 6---
@@ -10,13 +10,13 @@ expression: kind_completions
10 source_range: [20; 20), 10 source_range: [20; 20),
11 delete: [20; 20), 11 delete: [20; 20),
12 insert: "self", 12 insert: "self",
13 kind: Keyword 13 kind: Keyword,
14 }, 14 },
15 CompletionItem { 15 CompletionItem {
16 label: "super", 16 label: "super",
17 source_range: [20; 20), 17 source_range: [20; 20),
18 delete: [20; 20), 18 delete: [20; 20),
19 insert: "super::", 19 insert: "super::",
20 kind: Keyword 20 kind: Keyword,
21 } 21 },
22] 22]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_use_stmt3.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_use_stmt3.snap
index b44db276e..e7b11d532 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_use_stmt3.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_use_stmt3.snap
@@ -1,6 +1,6 @@
1--- 1---
2created: "2019-02-18T09:22:24.073607133Z" 2created: "2019-05-23T22:44:40.506690279Z"
3creator: insta@0.6.2 3creator: insta@0.8.1
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
6--- 6---
@@ -10,13 +10,13 @@ expression: kind_completions
10 source_range: [24; 24), 10 source_range: [24; 24),
11 delete: [24; 24), 11 delete: [24; 24),
12 insert: "self", 12 insert: "self",
13 kind: Keyword 13 kind: Keyword,
14 }, 14 },
15 CompletionItem { 15 CompletionItem {
16 label: "super", 16 label: "super",
17 source_range: [24; 24), 17 source_range: [24; 24),
18 delete: [24; 24), 18 delete: [24; 24),
19 insert: "super::", 19 insert: "super::",
20 kind: Keyword 20 kind: Keyword,
21 } 21 },
22] 22]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__last_return_in_block_has_semi1.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__last_return_in_block_has_semi1.snap
index f220d35c2..e7069dc0c 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__last_return_in_block_has_semi1.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__last_return_in_block_has_semi1.snap
@@ -1,6 +1,6 @@
1--- 1---
2created: "2019-02-18T09:22:23.989188654Z" 2created: "2019-05-23T22:23:35.082403612Z"
3creator: insta@0.6.2 3creator: insta@0.8.1
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
6--- 6---
@@ -10,34 +10,34 @@ expression: kind_completions
10 source_range: [83; 83), 10 source_range: [83; 83),
11 delete: [83; 83), 11 delete: [83; 83),
12 insert: "if $0 {}", 12 insert: "if $0 {}",
13 kind: Keyword 13 kind: Keyword,
14 }, 14 },
15 CompletionItem { 15 CompletionItem {
16 label: "loop", 16 label: "loop",
17 source_range: [83; 83), 17 source_range: [83; 83),
18 delete: [83; 83), 18 delete: [83; 83),
19 insert: "loop {$0}", 19 insert: "loop {$0}",
20 kind: Keyword 20 kind: Keyword,
21 }, 21 },
22 CompletionItem { 22 CompletionItem {
23 label: "match", 23 label: "match",
24 source_range: [83; 83), 24 source_range: [83; 83),
25 delete: [83; 83), 25 delete: [83; 83),
26 insert: "match $0 {}", 26 insert: "match $0 {}",
27 kind: Keyword 27 kind: Keyword,
28 }, 28 },
29 CompletionItem { 29 CompletionItem {
30 label: "return", 30 label: "return",
31 source_range: [83; 83), 31 source_range: [83; 83),
32 delete: [83; 83), 32 delete: [83; 83),
33 insert: "return $0;", 33 insert: "return $0;",
34 kind: Keyword 34 kind: Keyword,
35 }, 35 },
36 CompletionItem { 36 CompletionItem {
37 label: "while", 37 label: "while",
38 source_range: [83; 83), 38 source_range: [83; 83),
39 delete: [83; 83), 39 delete: [83; 83),
40 insert: "while $0 {}", 40 insert: "while $0 {}",
41 kind: Keyword 41 kind: Keyword,
42 } 42 },
43] 43]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__last_return_in_block_has_semi2.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__last_return_in_block_has_semi2.snap
index d2093acdf..47beb904b 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__last_return_in_block_has_semi2.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__last_return_in_block_has_semi2.snap
@@ -1,6 +1,6 @@
1--- 1---
2created: "2019-02-18T09:22:24.036383875Z" 2created: "2019-05-23T22:44:10.871868390Z"
3creator: insta@0.6.2 3creator: insta@0.8.1
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
6--- 6---
@@ -10,34 +10,34 @@ expression: kind_completions
10 source_range: [83; 83), 10 source_range: [83; 83),
11 delete: [83; 83), 11 delete: [83; 83),
12 insert: "if $0 {}", 12 insert: "if $0 {}",
13 kind: Keyword 13 kind: Keyword,
14 }, 14 },
15 CompletionItem { 15 CompletionItem {
16 label: "loop", 16 label: "loop",
17 source_range: [83; 83), 17 source_range: [83; 83),
18 delete: [83; 83), 18 delete: [83; 83),
19 insert: "loop {$0}", 19 insert: "loop {$0}",
20 kind: Keyword 20 kind: Keyword,
21 }, 21 },
22 CompletionItem { 22 CompletionItem {
23 label: "match", 23 label: "match",
24 source_range: [83; 83), 24 source_range: [83; 83),
25 delete: [83; 83), 25 delete: [83; 83),
26 insert: "match $0 {}", 26 insert: "match $0 {}",
27 kind: Keyword 27 kind: Keyword,
28 }, 28 },
29 CompletionItem { 29 CompletionItem {
30 label: "return", 30 label: "return",
31 source_range: [83; 83), 31 source_range: [83; 83),
32 delete: [83; 83), 32 delete: [83; 83),
33 insert: "return $0;", 33 insert: "return $0;",
34 kind: Keyword 34 kind: Keyword,
35 }, 35 },
36 CompletionItem { 36 CompletionItem {
37 label: "while", 37 label: "while",
38 source_range: [83; 83), 38 source_range: [83; 83),
39 delete: [83; 83), 39 delete: [83; 83),
40 insert: "while $0 {}", 40 insert: "while $0 {}",
41 kind: Keyword 41 kind: Keyword,
42 } 42 },
43] 43]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__mod_with_docs.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__mod_with_docs.snap
index 1da3c3ba2..f2b26e393 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__mod_with_docs.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__mod_with_docs.snap
@@ -1,6 +1,6 @@
1--- 1---
2created: "2019-02-18T09:22:24.066918191Z" 2created: "2019-05-23T22:23:35.093689514Z"
3creator: insta@0.6.2 3creator: insta@0.8.1
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
6--- 6---
@@ -12,7 +12,7 @@ expression: kind_completions
12 insert: "my", 12 insert: "my",
13 kind: Module, 13 kind: Module,
14 documentation: Documentation( 14 documentation: Documentation(
15 "Some simple\ndocs describing `mod my`." 15 "Some simple\ndocs describing `mod my`.",
16 ) 16 ),
17 } 17 },
18] 18]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__module_items.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__module_items.snap
index 86bc8679d..cee4898c3 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__module_items.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__module_items.snap
@@ -1,6 +1,6 @@
1--- 1---
2created: "2019-02-18T09:22:24.161888678Z" 2created: "2019-05-23T22:23:35.133106898Z"
3creator: insta@0.6.2 3creator: insta@0.8.1
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
6--- 6---
@@ -10,14 +10,14 @@ expression: kind_completions
10 source_range: [89; 89), 10 source_range: [89; 89),
11 delete: [89; 89), 11 delete: [89; 89),
12 insert: "Baz", 12 insert: "Baz",
13 kind: Enum 13 kind: Enum,
14 }, 14 },
15 CompletionItem { 15 CompletionItem {
16 label: "Foo", 16 label: "Foo",
17 source_range: [89; 89), 17 source_range: [89; 89),
18 delete: [89; 89), 18 delete: [89; 89),
19 insert: "Foo", 19 insert: "Foo",
20 kind: Struct 20 kind: Struct,
21 }, 21 },
22 CompletionItem { 22 CompletionItem {
23 label: "quux", 23 label: "quux",
@@ -25,6 +25,6 @@ expression: kind_completions
25 delete: [89; 89), 25 delete: [89; 89),
26 insert: "quux()$0", 26 insert: "quux()$0",
27 kind: Function, 27 kind: Function,
28 detail: "fn quux()" 28 detail: "fn quux()",
29 } 29 },
30] 30]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__module_items_in_nested_modules.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__module_items_in_nested_modules.snap
index 9f796b7ca..ce18e5bb7 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__module_items_in_nested_modules.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__module_items_in_nested_modules.snap
@@ -1,6 +1,6 @@
1--- 1---
2created: "2019-02-18T09:22:24.180517419Z" 2created: "2019-05-23T22:23:35.134417551Z"
3creator: insta@0.6.2 3creator: insta@0.8.1
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
6--- 6---
@@ -10,7 +10,7 @@ expression: kind_completions
10 source_range: [101; 101), 10 source_range: [101; 101),
11 delete: [101; 101), 11 delete: [101; 101),
12 insert: "Bar", 12 insert: "Bar",
13 kind: Struct 13 kind: Struct,
14 }, 14 },
15 CompletionItem { 15 CompletionItem {
16 label: "quux", 16 label: "quux",
@@ -18,6 +18,6 @@ expression: kind_completions
18 delete: [101; 101), 18 delete: [101; 101),
19 insert: "quux()$0", 19 insert: "quux()$0",
20 kind: Function, 20 kind: Function,
21 detail: "fn quux()" 21 detail: "fn quux()",
22 } 22 },
23] 23]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__nested_use_tree.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__nested_use_tree.snap
index 4920e500e..4c143d28e 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__nested_use_tree.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__nested_use_tree.snap
@@ -1,6 +1,6 @@
1--- 1---
2created: "2019-02-18T09:22:24.085605313Z" 2created: "2019-05-23T22:23:35.099358768Z"
3creator: insta@0.6.2 3creator: insta@0.8.1
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
6--- 6---
@@ -10,13 +10,13 @@ expression: kind_completions
10 source_range: [12; 14), 10 source_range: [12; 14),
11 delete: [12; 14), 11 delete: [12; 14),
12 insert: "Spam", 12 insert: "Spam",
13 kind: Struct 13 kind: Struct,
14 }, 14 },
15 CompletionItem { 15 CompletionItem {
16 label: "foo", 16 label: "foo",
17 source_range: [12; 14), 17 source_range: [12; 14),
18 delete: [12; 14), 18 delete: [12; 14),
19 insert: "foo", 19 insert: "foo",
20 kind: Module 20 kind: Module,
21 } 21 },
22] 22]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__no_semi_after_break_continue_in_expr.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__no_semi_after_break_continue_in_expr.snap
index 038e7f402..22e25fe3d 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__no_semi_after_break_continue_in_expr.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__no_semi_after_break_continue_in_expr.snap
@@ -1,6 +1,6 @@
1--- 1---
2created: "2019-02-18T09:22:23.999953358Z" 2created: "2019-05-23T22:23:35.085365816Z"
3creator: insta@0.6.2 3creator: insta@0.8.1
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
6--- 6---
@@ -10,48 +10,48 @@ expression: kind_completions
10 source_range: [106; 108), 10 source_range: [106; 108),
11 delete: [106; 108), 11 delete: [106; 108),
12 insert: "break", 12 insert: "break",
13 kind: Keyword 13 kind: Keyword,
14 }, 14 },
15 CompletionItem { 15 CompletionItem {
16 label: "continue", 16 label: "continue",
17 source_range: [106; 108), 17 source_range: [106; 108),
18 delete: [106; 108), 18 delete: [106; 108),
19 insert: "continue", 19 insert: "continue",
20 kind: Keyword 20 kind: Keyword,
21 }, 21 },
22 CompletionItem { 22 CompletionItem {
23 label: "if", 23 label: "if",
24 source_range: [106; 108), 24 source_range: [106; 108),
25 delete: [106; 108), 25 delete: [106; 108),
26 insert: "if $0 {}", 26 insert: "if $0 {}",
27 kind: Keyword 27 kind: Keyword,
28 }, 28 },
29 CompletionItem { 29 CompletionItem {
30 label: "loop", 30 label: "loop",
31 source_range: [106; 108), 31 source_range: [106; 108),
32 delete: [106; 108), 32 delete: [106; 108),
33 insert: "loop {$0}", 33 insert: "loop {$0}",
34 kind: Keyword 34 kind: Keyword,
35 }, 35 },
36 CompletionItem { 36 CompletionItem {
37 label: "match", 37 label: "match",
38 source_range: [106; 108), 38 source_range: [106; 108),
39 delete: [106; 108), 39 delete: [106; 108),
40 insert: "match $0 {}", 40 insert: "match $0 {}",
41 kind: Keyword 41 kind: Keyword,
42 }, 42 },
43 CompletionItem { 43 CompletionItem {
44 label: "return", 44 label: "return",
45 source_range: [106; 108), 45 source_range: [106; 108),
46 delete: [106; 108), 46 delete: [106; 108),
47 insert: "return", 47 insert: "return",
48 kind: Keyword 48 kind: Keyword,
49 }, 49 },
50 CompletionItem { 50 CompletionItem {
51 label: "while", 51 label: "while",
52 source_range: [106; 108), 52 source_range: [106; 108),
53 delete: [106; 108), 53 delete: [106; 108),
54 insert: "while $0 {}", 54 insert: "while $0 {}",
55 kind: Keyword 55 kind: Keyword,
56 } 56 },
57] 57]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__postfix_completion_works_for_trivial_path_expression.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__postfix_completion_works_for_trivial_path_expression.snap
index 3bbc9e3c4..fcb292596 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__postfix_completion_works_for_trivial_path_expression.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__postfix_completion_works_for_trivial_path_expression.snap
@@ -1,6 +1,6 @@
1--- 1---
2created: "2019-04-22T07:37:13.981826301Z" 2created: "2019-05-23T22:23:35.118738523Z"
3creator: insta@0.7.4 3creator: insta@0.8.1
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
6--- 6---
@@ -10,48 +10,48 @@ expression: kind_completions
10 source_range: [76; 76), 10 source_range: [76; 76),
11 delete: [72; 76), 11 delete: [72; 76),
12 insert: "dbg!(bar)", 12 insert: "dbg!(bar)",
13 detail: "dbg!(expr)" 13 detail: "dbg!(expr)",
14 }, 14 },
15 CompletionItem { 15 CompletionItem {
16 label: "if", 16 label: "if",
17 source_range: [76; 76), 17 source_range: [76; 76),
18 delete: [72; 76), 18 delete: [72; 76),
19 insert: "if bar {$0}", 19 insert: "if bar {$0}",
20 detail: "if expr {}" 20 detail: "if expr {}",
21 }, 21 },
22 CompletionItem { 22 CompletionItem {
23 label: "match", 23 label: "match",
24 source_range: [76; 76), 24 source_range: [76; 76),
25 delete: [72; 76), 25 delete: [72; 76),
26 insert: "match bar {\n ${1:_} => {$0\\},\n}", 26 insert: "match bar {\n ${1:_} => {$0\\},\n}",
27 detail: "match expr {}" 27 detail: "match expr {}",
28 }, 28 },
29 CompletionItem { 29 CompletionItem {
30 label: "not", 30 label: "not",
31 source_range: [76; 76), 31 source_range: [76; 76),
32 delete: [72; 76), 32 delete: [72; 76),
33 insert: "!bar", 33 insert: "!bar",
34 detail: "!expr" 34 detail: "!expr",
35 }, 35 },
36 CompletionItem { 36 CompletionItem {
37 label: "ref", 37 label: "ref",
38 source_range: [76; 76), 38 source_range: [76; 76),
39 delete: [72; 76), 39 delete: [72; 76),
40 insert: "&bar", 40 insert: "&bar",
41 detail: "&expr" 41 detail: "&expr",
42 }, 42 },
43 CompletionItem { 43 CompletionItem {
44 label: "refm", 44 label: "refm",
45 source_range: [76; 76), 45 source_range: [76; 76),
46 delete: [72; 76), 46 delete: [72; 76),
47 insert: "&mut bar", 47 insert: "&mut bar",
48 detail: "&mut expr" 48 detail: "&mut expr",
49 }, 49 },
50 CompletionItem { 50 CompletionItem {
51 label: "while", 51 label: "while",
52 source_range: [76; 76), 52 source_range: [76; 76),
53 delete: [72; 76), 53 delete: [72; 76),
54 insert: "while bar {\n$0\n}", 54 insert: "while bar {\n$0\n}",
55 detail: "while expr {}" 55 detail: "while expr {}",
56 } 56 },
57] 57]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__return_type.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__return_type.snap
index ff36df707..16dd18431 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__return_type.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__return_type.snap
@@ -1,6 +1,6 @@
1--- 1---
2created: "2019-04-04T14:52:24.525395600Z" 2created: "2019-05-23T22:23:35.140648630Z"
3creator: insta@0.7.4 3creator: insta@0.8.1
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
6--- 6---
@@ -10,7 +10,7 @@ expression: kind_completions
10 source_range: [47; 47), 10 source_range: [47; 47),
11 delete: [47; 47), 11 delete: [47; 47),
12 insert: "Foo", 12 insert: "Foo",
13 kind: Struct 13 kind: Struct,
14 }, 14 },
15 CompletionItem { 15 CompletionItem {
16 label: "x", 16 label: "x",
@@ -18,6 +18,6 @@ expression: kind_completions
18 delete: [47; 47), 18 delete: [47; 47),
19 insert: "x()$0", 19 insert: "x()$0",
20 kind: Function, 20 kind: Function,
21 detail: "fn x()" 21 detail: "fn x()",
22 } 22 },
23] 23]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__self_in_methods.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__self_in_methods.snap
index baf12cae1..e1af94870 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__self_in_methods.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__self_in_methods.snap
@@ -1,6 +1,6 @@
1--- 1---
2created: "2019-02-18T09:22:24.174038680Z" 2created: "2019-05-23T22:23:35.141900902Z"
3creator: insta@0.6.2 3creator: insta@0.8.1
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
6--- 6---
@@ -10,13 +10,13 @@ expression: kind_completions
10 source_range: [25; 25), 10 source_range: [25; 25),
11 delete: [25; 25), 11 delete: [25; 25),
12 insert: "Self", 12 insert: "Self",
13 kind: TypeParam 13 kind: TypeParam,
14 }, 14 },
15 CompletionItem { 15 CompletionItem {
16 label: "self", 16 label: "self",
17 source_range: [25; 25), 17 source_range: [25; 25),
18 delete: [25; 25), 18 delete: [25; 25),
19 insert: "self", 19 insert: "self",
20 kind: Binding 20 kind: Binding,
21 } 21 },
22] 22]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__snippets_in_expressions.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__snippets_in_expressions.snap
index fce2d6479..6f41bf76f 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__snippets_in_expressions.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__snippets_in_expressions.snap
@@ -1,6 +1,6 @@
1--- 1---
2created: "2019-02-18T09:22:24.191576723Z" 2created: "2019-05-23T22:23:35.141901047Z"
3creator: insta@0.6.2 3creator: insta@0.8.1
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
6--- 6---
@@ -10,13 +10,13 @@ expression: kind_completions
10 source_range: [17; 17), 10 source_range: [17; 17),
11 delete: [17; 17), 11 delete: [17; 17),
12 insert: "eprintln!(\"$0 = {:?}\", $0);", 12 insert: "eprintln!(\"$0 = {:?}\", $0);",
13 kind: Snippet 13 kind: Snippet,
14 }, 14 },
15 CompletionItem { 15 CompletionItem {
16 label: "ppd", 16 label: "ppd",
17 source_range: [17; 17), 17 source_range: [17; 17),
18 delete: [17; 17), 18 delete: [17; 17),
19 insert: "eprintln!(\"$0 = {:#?}\", $0);", 19 insert: "eprintln!(\"$0 = {:#?}\", $0);",
20 kind: Snippet 20 kind: Snippet,
21 } 21 },
22] 22]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__snippets_in_items.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__snippets_in_items.snap
index d2b1a5f0e..1eb0adebe 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__snippets_in_items.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__snippets_in_items.snap
@@ -1,6 +1,6 @@
1--- 1---
2created: "2019-02-18T09:22:24.187670733Z" 2created: "2019-05-23T22:23:35.149234118Z"
3creator: insta@0.6.2 3creator: insta@0.8.1
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
6--- 6---
@@ -11,13 +11,13 @@ expression: kind_completions
11 delete: [66; 66), 11 delete: [66; 66),
12 insert: "#[test]\nfn ${1:feature}() {\n $0\n}", 12 insert: "#[test]\nfn ${1:feature}() {\n $0\n}",
13 kind: Snippet, 13 kind: Snippet,
14 lookup: "tfn" 14 lookup: "tfn",
15 }, 15 },
16 CompletionItem { 16 CompletionItem {
17 label: "pub(crate)", 17 label: "pub(crate)",
18 source_range: [66; 66), 18 source_range: [66; 66),
19 delete: [66; 66), 19 delete: [66; 66),
20 insert: "pub(crate) $0", 20 insert: "pub(crate) $0",
21 kind: Snippet 21 kind: Snippet,
22 } 22 },
23] 23]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__struct_associated_const.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__struct_associated_const.snap
index 6ad4c5acc..f7bc6177c 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__struct_associated_const.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__struct_associated_const.snap
@@ -1,6 +1,6 @@
1--- 1---
2created: "2019-02-18T09:22:24.093406123Z" 2created: "2019-05-23T22:23:35.101474826Z"
3creator: insta@0.6.2 3creator: insta@0.8.1
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
6--- 6---
@@ -13,7 +13,7 @@ expression: kind_completions
13 kind: Const, 13 kind: Const,
14 detail: "const C: i32 = 42;", 14 detail: "const C: i32 = 42;",
15 documentation: Documentation( 15 documentation: Documentation(
16 "An associated const" 16 "An associated const",
17 ) 17 ),
18 } 18 },
19] 19]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__struct_associated_method.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__struct_associated_method.snap
index 7c69eebeb..45080a802 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__struct_associated_method.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__struct_associated_method.snap
@@ -1,6 +1,6 @@
1--- 1---
2created: "2019-02-24T16:33:47.990111169Z" 2created: "2019-05-23T22:23:35.102351365Z"
3creator: insta@0.6.3 3creator: insta@0.8.1
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
6--- 6---
@@ -13,7 +13,7 @@ expression: kind_completions
13 kind: Function, 13 kind: Function,
14 detail: "fn m()", 14 detail: "fn m()",
15 documentation: Documentation( 15 documentation: Documentation(
16 "An associated method" 16 "An associated method",
17 ) 17 ),
18 } 18 },
19] 19]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__struct_associated_type.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__struct_associated_type.snap
index 583bda225..f40065286 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__struct_associated_type.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__struct_associated_type.snap
@@ -1,6 +1,6 @@
1--- 1---
2created: "2019-02-18T09:22:24.090876030Z" 2created: "2019-05-23T22:23:35.105188762Z"
3creator: insta@0.6.2 3creator: insta@0.8.1
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
6--- 6---
@@ -13,7 +13,7 @@ expression: kind_completions
13 kind: TypeAlias, 13 kind: TypeAlias,
14 detail: "type T = i32;", 14 detail: "type T = i32;",
15 documentation: Documentation( 15 documentation: Documentation(
16 "An associated type" 16 "An associated type",
17 ) 17 ),
18 } 18 },
19] 19]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__use_item_starting_with_crate.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__use_item_starting_with_crate.snap
index 34e70c35d..17e831c84 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__use_item_starting_with_crate.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__use_item_starting_with_crate.snap
@@ -1,6 +1,6 @@
1--- 1---
2created: "2019-02-18T09:22:24.098574884Z" 2created: "2019-05-23T22:23:35.105336210Z"
3creator: insta@0.6.2 3creator: insta@0.8.1
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
6--- 6---
@@ -10,13 +10,13 @@ expression: kind_completions
10 source_range: [11; 13), 10 source_range: [11; 13),
11 delete: [11; 13), 11 delete: [11; 13),
12 insert: "Spam", 12 insert: "Spam",
13 kind: Struct 13 kind: Struct,
14 }, 14 },
15 CompletionItem { 15 CompletionItem {
16 label: "foo", 16 label: "foo",
17 source_range: [11; 13), 17 source_range: [11; 13),
18 delete: [11; 13), 18 delete: [11; 13),
19 insert: "foo", 19 insert: "foo",
20 kind: Module 20 kind: Module,
21 } 21 },
22] 22]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__use_item_starting_with_self.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__use_item_starting_with_self.snap
index d15f1905b..d1abc6b5b 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__use_item_starting_with_self.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__use_item_starting_with_self.snap
@@ -1,6 +1,6 @@
1--- 1---
2created: "2019-02-18T09:22:24.102063333Z" 2created: "2019-05-23T22:23:35.106923266Z"
3creator: insta@0.6.2 3creator: insta@0.8.1
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
6--- 6---
@@ -10,6 +10,6 @@ expression: kind_completions
10 source_range: [26; 26), 10 source_range: [26; 26),
11 delete: [26; 26), 11 delete: [26; 26),
12 insert: "Bar", 12 insert: "Bar",
13 kind: Struct 13 kind: Struct,
14 } 14 },
15] 15]
diff --git a/crates/ra_ide_api/src/diagnostics.rs b/crates/ra_ide_api/src/diagnostics.rs
index 9a0eb2c14..923008708 100644
--- a/crates/ra_ide_api/src/diagnostics.rs
+++ b/crates/ra_ide_api/src/diagnostics.rs
@@ -310,28 +310,30 @@ mod tests {
310 fn test_unresolved_module_diagnostic() { 310 fn test_unresolved_module_diagnostic() {
311 let (analysis, file_id) = single_file("mod foo;"); 311 let (analysis, file_id) = single_file("mod foo;");
312 let diagnostics = analysis.diagnostics(file_id).unwrap(); 312 let diagnostics = analysis.diagnostics(file_id).unwrap();
313 assert_debug_snapshot_matches!(diagnostics, @r####"[ 313 assert_debug_snapshot_matches!(diagnostics, @r###"
314 Diagnostic { 314 â‹®[
315 message: "unresolved module", 315 â‹® Diagnostic {
316 range: [0; 8), 316 â‹® message: "unresolved module",
317 fix: Some( 317 â‹® range: [0; 8),
318 SourceChange { 318 â‹® fix: Some(
319 label: "create module", 319 â‹® SourceChange {
320 source_file_edits: [], 320 â‹® label: "create module",
321 file_system_edits: [ 321 â‹® source_file_edits: [],
322 CreateFile { 322 â‹® file_system_edits: [
323 source_root: SourceRootId( 323 â‹® CreateFile {
324 0 324 â‹® source_root: SourceRootId(
325 ), 325 â‹® 0,
326 path: "foo.rs" 326 â‹® ),
327 } 327 â‹® path: "foo.rs",
328 ], 328 â‹® },
329 cursor_position: None 329 â‹® ],
330 } 330 â‹® cursor_position: None,
331 ), 331 â‹® },
332 severity: Error 332 â‹® ),
333 } 333 â‹® severity: Error,
334]"####); 334 â‹® },
335 â‹®]
336 "###);
335 } 337 }
336 338
337 #[test] 339 #[test]
diff --git a/crates/ra_ide_api/src/display/navigation_target.rs b/crates/ra_ide_api/src/display/navigation_target.rs
index 1c694cbc9..7f81483f7 100644
--- a/crates/ra_ide_api/src/display/navigation_target.rs
+++ b/crates/ra_ide_api/src/display/navigation_target.rs
@@ -154,6 +154,10 @@ impl NavigationTarget {
154 let (file_id, node) = s.source(db); 154 let (file_id, node) = s.source(db);
155 NavigationTarget::from_named(file_id.original_file(db), &*node) 155 NavigationTarget::from_named(file_id.original_file(db), &*node)
156 } 156 }
157 hir::AdtDef::Union(s) => {
158 let (file_id, node) = s.source(db);
159 NavigationTarget::from_named(file_id.original_file(db), &*node)
160 }
157 hir::AdtDef::Enum(s) => { 161 hir::AdtDef::Enum(s) => {
158 let (file_id, node) = s.source(db); 162 let (file_id, node) = s.source(db);
159 NavigationTarget::from_named(file_id.original_file(db), &*node) 163 NavigationTarget::from_named(file_id.original_file(db), &*node)
@@ -169,6 +173,10 @@ impl NavigationTarget {
169 let (file_id, node) = s.source(db); 173 let (file_id, node) = s.source(db);
170 NavigationTarget::from_named(file_id.original_file(db), &*node) 174 NavigationTarget::from_named(file_id.original_file(db), &*node)
171 } 175 }
176 hir::ModuleDef::Union(s) => {
177 let (file_id, node) = s.source(db);
178 NavigationTarget::from_named(file_id.original_file(db), &*node)
179 }
172 hir::ModuleDef::Const(s) => { 180 hir::ModuleDef::Const(s) => {
173 let (file_id, node) = s.source(db); 181 let (file_id, node) = s.source(db);
174 NavigationTarget::from_named(file_id.original_file(db), &*node) 182 NavigationTarget::from_named(file_id.original_file(db), &*node)
diff --git a/crates/ra_ide_api/src/display/snapshots/tests__file_structure.snap b/crates/ra_ide_api/src/display/snapshots/tests__file_structure.snap
index 32dd99484..3097977de 100644
--- a/crates/ra_ide_api/src/display/snapshots/tests__file_structure.snap
+++ b/crates/ra_ide_api/src/display/snapshots/tests__file_structure.snap
@@ -1,6 +1,6 @@
1--- 1---
2created: "2019-04-08T09:44:50.196004400Z" 2created: "2019-05-23T22:23:35.168422050Z"
3creator: insta@0.7.4 3creator: insta@0.8.1
4source: crates/ra_ide_api/src/display/structure.rs 4source: crates/ra_ide_api/src/display/structure.rs
5expression: structure 5expression: structure
6--- 6---
@@ -12,20 +12,20 @@ expression: structure
12 node_range: [1; 26), 12 node_range: [1; 26),
13 kind: STRUCT_DEF, 13 kind: STRUCT_DEF,
14 detail: None, 14 detail: None,
15 deprecated: false 15 deprecated: false,
16 }, 16 },
17 StructureNode { 17 StructureNode {
18 parent: Some( 18 parent: Some(
19 0 19 0,
20 ), 20 ),
21 label: "x", 21 label: "x",
22 navigation_range: [18; 19), 22 navigation_range: [18; 19),
23 node_range: [18; 24), 23 node_range: [18; 24),
24 kind: NAMED_FIELD_DEF, 24 kind: NAMED_FIELD_DEF,
25 detail: Some( 25 detail: Some(
26 "i32" 26 "i32",
27 ), 27 ),
28 deprecated: false 28 deprecated: false,
29 }, 29 },
30 StructureNode { 30 StructureNode {
31 parent: None, 31 parent: None,
@@ -34,46 +34,46 @@ expression: structure
34 node_range: [28; 158), 34 node_range: [28; 158),
35 kind: MODULE, 35 kind: MODULE,
36 detail: None, 36 detail: None,
37 deprecated: false 37 deprecated: false,
38 }, 38 },
39 StructureNode { 39 StructureNode {
40 parent: Some( 40 parent: Some(
41 2 41 2,
42 ), 42 ),
43 label: "bar1", 43 label: "bar1",
44 navigation_range: [43; 47), 44 navigation_range: [43; 47),
45 node_range: [40; 52), 45 node_range: [40; 52),
46 kind: FN_DEF, 46 kind: FN_DEF,
47 detail: Some( 47 detail: Some(
48 "fn()" 48 "fn()",
49 ), 49 ),
50 deprecated: false 50 deprecated: false,
51 }, 51 },
52 StructureNode { 52 StructureNode {
53 parent: Some( 53 parent: Some(
54 2 54 2,
55 ), 55 ),
56 label: "bar2", 56 label: "bar2",
57 navigation_range: [60; 64), 57 navigation_range: [60; 64),
58 node_range: [57; 81), 58 node_range: [57; 81),
59 kind: FN_DEF, 59 kind: FN_DEF,
60 detail: Some( 60 detail: Some(
61 "fn<T>(t: T) -> T" 61 "fn<T>(t: T) -> T",
62 ), 62 ),
63 deprecated: false 63 deprecated: false,
64 }, 64 },
65 StructureNode { 65 StructureNode {
66 parent: Some( 66 parent: Some(
67 2 67 2,
68 ), 68 ),
69 label: "bar3", 69 label: "bar3",
70 navigation_range: [89; 93), 70 navigation_range: [89; 93),
71 node_range: [86; 156), 71 node_range: [86; 156),
72 kind: FN_DEF, 72 kind: FN_DEF,
73 detail: Some( 73 detail: Some(
74 "fn<A, B>(a: A, b: B) -> Vec< u32 >" 74 "fn<A, B>(a: A, b: B) -> Vec< u32 >",
75 ), 75 ),
76 deprecated: false 76 deprecated: false,
77 }, 77 },
78 StructureNode { 78 StructureNode {
79 parent: None, 79 parent: None,
@@ -82,29 +82,29 @@ expression: structure
82 node_range: [160; 180), 82 node_range: [160; 180),
83 kind: ENUM_DEF, 83 kind: ENUM_DEF,
84 detail: None, 84 detail: None,
85 deprecated: false 85 deprecated: false,
86 }, 86 },
87 StructureNode { 87 StructureNode {
88 parent: Some( 88 parent: Some(
89 6 89 6,
90 ), 90 ),
91 label: "X", 91 label: "X",
92 navigation_range: [169; 170), 92 navigation_range: [169; 170),
93 node_range: [169; 170), 93 node_range: [169; 170),
94 kind: ENUM_VARIANT, 94 kind: ENUM_VARIANT,
95 detail: None, 95 detail: None,
96 deprecated: false 96 deprecated: false,
97 }, 97 },
98 StructureNode { 98 StructureNode {
99 parent: Some( 99 parent: Some(
100 6 100 6,
101 ), 101 ),
102 label: "Y", 102 label: "Y",
103 navigation_range: [172; 173), 103 navigation_range: [172; 173),
104 node_range: [172; 178), 104 node_range: [172; 178),
105 kind: ENUM_VARIANT, 105 kind: ENUM_VARIANT,
106 detail: None, 106 detail: None,
107 deprecated: false 107 deprecated: false,
108 }, 108 },
109 StructureNode { 109 StructureNode {
110 parent: None, 110 parent: None,
@@ -113,9 +113,9 @@ expression: structure
113 node_range: [181; 193), 113 node_range: [181; 193),
114 kind: TYPE_ALIAS_DEF, 114 kind: TYPE_ALIAS_DEF,
115 detail: Some( 115 detail: Some(
116 "()" 116 "()",
117 ), 117 ),
118 deprecated: false 118 deprecated: false,
119 }, 119 },
120 StructureNode { 120 StructureNode {
121 parent: None, 121 parent: None,
@@ -124,9 +124,9 @@ expression: structure
124 node_range: [194; 213), 124 node_range: [194; 213),
125 kind: STATIC_DEF, 125 kind: STATIC_DEF,
126 detail: Some( 126 detail: Some(
127 "i32" 127 "i32",
128 ), 128 ),
129 deprecated: false 129 deprecated: false,
130 }, 130 },
131 StructureNode { 131 StructureNode {
132 parent: None, 132 parent: None,
@@ -135,9 +135,9 @@ expression: structure
135 node_range: [214; 232), 135 node_range: [214; 232),
136 kind: CONST_DEF, 136 kind: CONST_DEF,
137 detail: Some( 137 detail: Some(
138 "i32" 138 "i32",
139 ), 139 ),
140 deprecated: false 140 deprecated: false,
141 }, 141 },
142 StructureNode { 142 StructureNode {
143 parent: None, 143 parent: None,
@@ -146,7 +146,7 @@ expression: structure
146 node_range: [234; 243), 146 node_range: [234; 243),
147 kind: IMPL_BLOCK, 147 kind: IMPL_BLOCK,
148 detail: None, 148 detail: None,
149 deprecated: false 149 deprecated: false,
150 }, 150 },
151 StructureNode { 151 StructureNode {
152 parent: None, 152 parent: None,
@@ -155,7 +155,7 @@ expression: structure
155 node_range: [245; 269), 155 node_range: [245; 269),
156 kind: IMPL_BLOCK, 156 kind: IMPL_BLOCK,
157 detail: None, 157 detail: None,
158 deprecated: false 158 deprecated: false,
159 }, 159 },
160 StructureNode { 160 StructureNode {
161 parent: None, 161 parent: None,
@@ -164,9 +164,9 @@ expression: structure
164 node_range: [271; 301), 164 node_range: [271; 301),
165 kind: FN_DEF, 165 kind: FN_DEF,
166 detail: Some( 166 detail: Some(
167 "fn()" 167 "fn()",
168 ), 168 ),
169 deprecated: true 169 deprecated: true,
170 }, 170 },
171 StructureNode { 171 StructureNode {
172 parent: None, 172 parent: None,
@@ -175,8 +175,8 @@ expression: structure
175 node_range: [303; 359), 175 node_range: [303; 359),
176 kind: FN_DEF, 176 kind: FN_DEF,
177 detail: Some( 177 detail: Some(
178 "fn()" 178 "fn()",
179 ), 179 ),
180 deprecated: true 180 deprecated: true,
181 } 181 },
182] 182]
diff --git a/crates/ra_ide_api/src/lib.rs b/crates/ra_ide_api/src/lib.rs
index f78348f74..d3456d5b2 100644
--- a/crates/ra_ide_api/src/lib.rs
+++ b/crates/ra_ide_api/src/lib.rs
@@ -462,6 +462,11 @@ impl Analysis {
462 self.with_db(|db| syntax_highlighting::highlight(db, file_id)) 462 self.with_db(|db| syntax_highlighting::highlight(db, file_id))
463 } 463 }
464 464
465 /// Computes syntax highlighting for the given file.
466 pub fn highlight_as_html(&self, file_id: FileId) -> Cancelable<String> {
467 self.with_db(|db| syntax_highlighting::highlight_as_html(db, file_id))
468 }
469
465 /// Computes completions at the given position. 470 /// Computes completions at the given position.
466 pub fn completions(&self, position: FilePosition) -> Cancelable<Option<Vec<CompletionItem>>> { 471 pub fn completions(&self, position: FilePosition) -> Cancelable<Option<Vec<CompletionItem>>> {
467 self.with_db(|db| completion::completions(db, position).map(Into::into)) 472 self.with_db(|db| completion::completions(db, position).map(Into::into))
diff --git a/crates/ra_ide_api/src/snapshots/highlighting.html b/crates/ra_ide_api/src/snapshots/highlighting.html
new file mode 100644
index 000000000..bfc0a67b1
--- /dev/null
+++ b/crates/ra_ide_api/src/snapshots/highlighting.html
@@ -0,0 +1,45 @@
1
2<style>
3pre {
4 color: #DCDCCC;
5 background-color: #3F3F3F;
6 font-size: 22px;
7}
8
9.comment { color: #7F9F7F; }
10.string { color: #CC9393; }
11.function { color: #93E0E3; }
12.parameter { color: #94BFF3; }
13.builtin { color: #DD6718; }
14.text { color: #DCDCCC; }
15.attribute { color: #BFEBBF; }
16.literal { color: #DFAF8F; }
17.macro { color: #DFAF8F; }
18
19.keyword { color: #F0DFAF; }
20.keyword\.unsafe { color: #F0DFAF; font-weight: bold; }
21.keyword\.control { color: #DC8CC3; }
22
23</style>
24<pre><code>
25<span class="attribute">#</span><span class="attribute">[</span><span class="attribute">derive</span><span class="attribute">(</span><span class="attribute">Clone</span><span class="attribute">,</span><span class="attribute"> </span><span class="attribute">Debug</span><span class="attribute">)</span><span class="attribute">]</span>
26<span class="keyword">struct</span> <span class="function">Foo</span> {
27 <span class="keyword">pub</span> <span class="function">x</span>: <span class="text">i32</span>,
28 <span class="keyword">pub</span> <span class="function">y</span>: <span class="text">i32</span>,
29}
30
31<span class="keyword">fn</span> <span class="function">foo</span>&lt;<span class="type function">T</span>&gt;() -&gt; <span class="type">T</span> {
32 <span class="macro">unimplemented</span><span class="macro">!</span>();
33}
34
35<span class="comment">// comment</span>
36<span class="keyword">fn</span> <span class="function">main</span>() {
37 <span class="macro">println</span><span class="macro">!</span>(<span class="string">"Hello, {}!"</span>, <span class="literal">92</span>);
38
39 <span class="keyword">let</span> <span class="keyword">mut</span> <span class="function">vec</span> = <span class="text">Vec</span>::<span class="text">new</span>();
40 <span class="keyword.control">if</span> <span class="keyword">true</span> {
41 <span class="text">vec</span>.<span class="text">push</span>(<span class="type">Foo</span> { <span class="field">x</span>: <span class="literal">0</span>, <span class="field">y</span>: <span class="literal">1</span> });
42 }
43 <span class="keyword.unsafe">unsafe</span> { <span class="text">vec</span>.<span class="text">set_len</span>(<span class="literal">0</span>); }
44}
45</code></pre> \ No newline at end of file
diff --git a/crates/ra_ide_api/src/snapshots/tests__highlighting.snap b/crates/ra_ide_api/src/snapshots/tests__highlighting.snap
deleted file mode 100644
index 9d4c04db3..000000000
--- a/crates/ra_ide_api/src/snapshots/tests__highlighting.snap
+++ /dev/null
@@ -1,146 +0,0 @@
1---
2created: "2019-05-23T12:10:32.628883358Z"
3creator: [email protected]
4source: crates/ra_ide_api/src/syntax_highlighting.rs
5expression: result
6---
7Ok(
8 [
9 HighlightedRange {
10 range: [1; 24),
11 tag: "attribute"
12 },
13 HighlightedRange {
14 range: [25; 31),
15 tag: "keyword"
16 },
17 HighlightedRange {
18 range: [32; 35),
19 tag: "function"
20 },
21 HighlightedRange {
22 range: [42; 45),
23 tag: "keyword"
24 },
25 HighlightedRange {
26 range: [46; 47),
27 tag: "function"
28 },
29 HighlightedRange {
30 range: [49; 52),
31 tag: "text"
32 },
33 HighlightedRange {
34 range: [58; 61),
35 tag: "keyword"
36 },
37 HighlightedRange {
38 range: [62; 63),
39 tag: "function"
40 },
41 HighlightedRange {
42 range: [65; 68),
43 tag: "text"
44 },
45 HighlightedRange {
46 range: [73; 75),
47 tag: "keyword"
48 },
49 HighlightedRange {
50 range: [76; 79),
51 tag: "function"
52 },
53 HighlightedRange {
54 range: [80; 81),
55 tag: "type"
56 },
57 HighlightedRange {
58 range: [80; 81),
59 tag: "function"
60 },
61 HighlightedRange {
62 range: [88; 89),
63 tag: "type"
64 },
65 HighlightedRange {
66 range: [96; 110),
67 tag: "macro"
68 },
69 HighlightedRange {
70 range: [117; 127),
71 tag: "comment"
72 },
73 HighlightedRange {
74 range: [128; 130),
75 tag: "keyword"
76 },
77 HighlightedRange {
78 range: [131; 135),
79 tag: "function"
80 },
81 HighlightedRange {
82 range: [145; 153),
83 tag: "macro"
84 },
85 HighlightedRange {
86 range: [154; 166),
87 tag: "string"
88 },
89 HighlightedRange {
90 range: [168; 170),
91 tag: "literal"
92 },
93 HighlightedRange {
94 range: [178; 181),
95 tag: "keyword"
96 },
97 HighlightedRange {
98 range: [182; 185),
99 tag: "keyword"
100 },
101 HighlightedRange {
102 range: [186; 189),
103 tag: "macro"
104 },
105 HighlightedRange {
106 range: [197; 200),
107 tag: "macro"
108 },
109 HighlightedRange {
110 range: [192; 195),
111 tag: "text"
112 },
113 HighlightedRange {
114 range: [208; 211),
115 tag: "macro"
116 },
117 HighlightedRange {
118 range: [212; 216),
119 tag: "macro"
120 },
121 HighlightedRange {
122 range: [226; 227),
123 tag: "literal"
124 },
125 HighlightedRange {
126 range: [232; 233),
127 tag: "literal"
128 },
129 HighlightedRange {
130 range: [242; 248),
131 tag: "keyword.unsafe"
132 },
133 HighlightedRange {
134 range: [251; 254),
135 tag: "text"
136 },
137 HighlightedRange {
138 range: [255; 262),
139 tag: "text"
140 },
141 HighlightedRange {
142 range: [263; 264),
143 tag: "literal"
144 }
145 ]
146)
diff --git a/crates/ra_ide_api/src/snapshots/tests__rename_mod.snap b/crates/ra_ide_api/src/snapshots/tests__rename_mod.snap
index 890426db7..431de5c55 100644
--- a/crates/ra_ide_api/src/snapshots/tests__rename_mod.snap
+++ b/crates/ra_ide_api/src/snapshots/tests__rename_mod.snap
@@ -1,8 +1,8 @@
1--- 1---
2created: "2019-01-24T08:39:53.759318522+00:00" 2created: "2019-05-23T22:23:35.215905447Z"
3creator: [email protected] 3creator: [email protected]
4source: crates/ra_ide_api/src/references.rs
4expression: "&source_change" 5expression: "&source_change"
5source: crates/ra_ide_api/src/rename.rs
6--- 6---
7Some( 7Some(
8 SourceChange { 8 SourceChange {
@@ -10,29 +10,29 @@ Some(
10 source_file_edits: [ 10 source_file_edits: [
11 SourceFileEdit { 11 SourceFileEdit {
12 file_id: FileId( 12 file_id: FileId(
13 2 13 2,
14 ), 14 ),
15 edit: TextEdit { 15 edit: TextEdit {
16 atoms: [ 16 atoms: [
17 AtomTextEdit { 17 AtomTextEdit {
18 delete: [4; 7), 18 delete: [4; 7),
19 insert: "foo2" 19 insert: "foo2",
20 } 20 },
21 ] 21 ],
22 } 22 },
23 } 23 },
24 ], 24 ],
25 file_system_edits: [ 25 file_system_edits: [
26 MoveFile { 26 MoveFile {
27 src: FileId( 27 src: FileId(
28 3 28 3,
29 ), 29 ),
30 dst_source_root: SourceRootId( 30 dst_source_root: SourceRootId(
31 0 31 0,
32 ), 32 ),
33 dst_path: "bar/foo2.rs" 33 dst_path: "bar/foo2.rs",
34 } 34 },
35 ], 35 ],
36 cursor_position: None 36 cursor_position: None,
37 } 37 },
38) 38)
diff --git a/crates/ra_ide_api/src/snapshots/tests__rename_mod_in_dir.snap b/crates/ra_ide_api/src/snapshots/tests__rename_mod_in_dir.snap
index e96bf5c02..aaff9b4b5 100644
--- a/crates/ra_ide_api/src/snapshots/tests__rename_mod_in_dir.snap
+++ b/crates/ra_ide_api/src/snapshots/tests__rename_mod_in_dir.snap
@@ -1,8 +1,8 @@
1--- 1---
2created: "2019-01-22T14:45:00.975229300+00:00" 2created: "2019-05-23T22:23:35.213830371Z"
3creator: [email protected] 3creator: [email protected]
4source: crates/ra_ide_api/src/references.rs
4expression: "&source_change" 5expression: "&source_change"
5source: "crates\\ra_ide_api\\src\\rename.rs"
6--- 6---
7Some( 7Some(
8 SourceChange { 8 SourceChange {
@@ -10,29 +10,29 @@ Some(
10 source_file_edits: [ 10 source_file_edits: [
11 SourceFileEdit { 11 SourceFileEdit {
12 file_id: FileId( 12 file_id: FileId(
13 1 13 1,
14 ), 14 ),
15 edit: TextEdit { 15 edit: TextEdit {
16 atoms: [ 16 atoms: [
17 AtomTextEdit { 17 AtomTextEdit {
18 delete: [4; 7), 18 delete: [4; 7),
19 insert: "foo2" 19 insert: "foo2",
20 } 20 },
21 ] 21 ],
22 } 22 },
23 } 23 },
24 ], 24 ],
25 file_system_edits: [ 25 file_system_edits: [
26 MoveFile { 26 MoveFile {
27 src: FileId( 27 src: FileId(
28 2 28 2,
29 ), 29 ),
30 dst_source_root: SourceRootId( 30 dst_source_root: SourceRootId(
31 0 31 0,
32 ), 32 ),
33 dst_path: "foo2/mod.rs" 33 dst_path: "foo2/mod.rs",
34 } 34 },
35 ], 35 ],
36 cursor_position: None 36 cursor_position: None,
37 } 37 },
38) 38)
diff --git a/crates/ra_ide_api/src/snapshots/tests__runnables.snap b/crates/ra_ide_api/src/snapshots/tests__runnables.snap
index 71bd7a4bd..de2fadd7f 100644
--- a/crates/ra_ide_api/src/snapshots/tests__runnables.snap
+++ b/crates/ra_ide_api/src/snapshots/tests__runnables.snap
@@ -1,24 +1,24 @@
1--- 1---
2created: "2019-01-22T14:45:00.975229300+00:00" 2created: "2019-05-23T22:23:35.217100106Z"
3creator: [email protected] 3creator: [email protected]
4source: crates/ra_ide_api/src/runnables.rs
4expression: "&runnables" 5expression: "&runnables"
5source: "crates\\ra_ide_api\\src\\runnables.rs"
6--- 6---
7[ 7[
8 Runnable { 8 Runnable {
9 range: [1; 21), 9 range: [1; 21),
10 kind: Bin 10 kind: Bin,
11 }, 11 },
12 Runnable { 12 Runnable {
13 range: [22; 46), 13 range: [22; 46),
14 kind: Test { 14 kind: Test {
15 name: "test_foo" 15 name: "test_foo",
16 } 16 },
17 }, 17 },
18 Runnable { 18 Runnable {
19 range: [47; 81), 19 range: [47; 81),
20 kind: Test { 20 kind: Test {
21 name: "test_foo" 21 name: "test_foo",
22 } 22 },
23 } 23 },
24] 24]
diff --git a/crates/ra_ide_api/src/snapshots/tests__runnables_module.snap b/crates/ra_ide_api/src/snapshots/tests__runnables_module.snap
index a28dd8952..23993a97f 100644
--- a/crates/ra_ide_api/src/snapshots/tests__runnables_module.snap
+++ b/crates/ra_ide_api/src/snapshots/tests__runnables_module.snap
@@ -1,20 +1,20 @@
1--- 1---
2created: "2019-01-22T14:45:00.976230700+00:00" 2created: "2019-05-23T22:23:35.219258850Z"
3creator: [email protected] 3creator: [email protected]
4source: crates/ra_ide_api/src/runnables.rs
4expression: "&runnables" 5expression: "&runnables"
5source: "crates\\ra_ide_api\\src\\runnables.rs"
6--- 6---
7[ 7[
8 Runnable { 8 Runnable {
9 range: [1; 59), 9 range: [1; 59),
10 kind: TestMod { 10 kind: TestMod {
11 path: "test_mod" 11 path: "test_mod",
12 } 12 },
13 }, 13 },
14 Runnable { 14 Runnable {
15 range: [28; 57), 15 range: [28; 57),
16 kind: Test { 16 kind: Test {
17 name: "test_foo1" 17 name: "test_foo1",
18 } 18 },
19 } 19 },
20] 20]
diff --git a/crates/ra_ide_api/src/snapshots/tests__runnables_multiple_depth_module.snap b/crates/ra_ide_api/src/snapshots/tests__runnables_multiple_depth_module.snap
index 79f07bef9..c516a61df 100644
--- a/crates/ra_ide_api/src/snapshots/tests__runnables_multiple_depth_module.snap
+++ b/crates/ra_ide_api/src/snapshots/tests__runnables_multiple_depth_module.snap
@@ -1,20 +1,20 @@
1--- 1---
2created: "2019-01-22T14:45:00.979218100+00:00" 2created: "2019-05-23T22:23:35.219671663Z"
3creator: [email protected] 3creator: [email protected]
4source: crates/ra_ide_api/src/runnables.rs
4expression: "&runnables" 5expression: "&runnables"
5source: "crates\\ra_ide_api\\src\\runnables.rs"
6--- 6---
7[ 7[
8 Runnable { 8 Runnable {
9 range: [41; 115), 9 range: [41; 115),
10 kind: TestMod { 10 kind: TestMod {
11 path: "foo::bar::test_mod" 11 path: "foo::bar::test_mod",
12 } 12 },
13 }, 13 },
14 Runnable { 14 Runnable {
15 range: [68; 105), 15 range: [68; 105),
16 kind: Test { 16 kind: Test {
17 name: "test_foo1" 17 name: "test_foo1",
18 } 18 },
19 } 19 },
20] 20]
diff --git a/crates/ra_ide_api/src/snapshots/tests__runnables_one_depth_layer_module.snap b/crates/ra_ide_api/src/snapshots/tests__runnables_one_depth_layer_module.snap
index d199e9073..b02e6707e 100644
--- a/crates/ra_ide_api/src/snapshots/tests__runnables_one_depth_layer_module.snap
+++ b/crates/ra_ide_api/src/snapshots/tests__runnables_one_depth_layer_module.snap
@@ -1,20 +1,20 @@
1--- 1---
2created: "2019-01-22T14:45:01.016119500+00:00" 2created: "2019-05-23T22:23:35.224315047Z"
3creator: [email protected] 3creator: [email protected]
4source: crates/ra_ide_api/src/runnables.rs
4expression: "&runnables" 5expression: "&runnables"
5source: "crates\\ra_ide_api\\src\\runnables.rs"
6--- 6---
7[ 7[
8 Runnable { 8 Runnable {
9 range: [23; 85), 9 range: [23; 85),
10 kind: TestMod { 10 kind: TestMod {
11 path: "foo::test_mod" 11 path: "foo::test_mod",
12 } 12 },
13 }, 13 },
14 Runnable { 14 Runnable {
15 range: [46; 79), 15 range: [46; 79),
16 kind: Test { 16 kind: Test {
17 name: "test_foo1" 17 name: "test_foo1",
18 } 18 },
19 } 19 },
20] 20]
diff --git a/crates/ra_ide_api/src/syntax_highlighting.rs b/crates/ra_ide_api/src/syntax_highlighting.rs
index 89f20260f..87e053364 100644
--- a/crates/ra_ide_api/src/syntax_highlighting.rs
+++ b/crates/ra_ide_api/src/syntax_highlighting.rs
@@ -2,6 +2,7 @@ use rustc_hash::FxHashSet;
2 2
3use ra_syntax::{ast, AstNode, TextRange, Direction, SyntaxKind, SyntaxKind::*, SyntaxElement, T}; 3use ra_syntax::{ast, AstNode, TextRange, Direction, SyntaxKind, SyntaxKind::*, SyntaxElement, T};
4use ra_db::SourceDatabase; 4use ra_db::SourceDatabase;
5use ra_prof::profile;
5 6
6use crate::{FileId, db::RootDatabase}; 7use crate::{FileId, db::RootDatabase};
7 8
@@ -27,6 +28,8 @@ fn is_control_keyword(kind: SyntaxKind) -> bool {
27} 28}
28 29
29pub(crate) fn highlight(db: &RootDatabase, file_id: FileId) -> Vec<HighlightedRange> { 30pub(crate) fn highlight(db: &RootDatabase, file_id: FileId) -> Vec<HighlightedRange> {
31 let _p = profile("highlight");
32
30 let source_file = db.parse(file_id); 33 let source_file = db.parse(file_id);
31 34
32 // Visited nodes to handle highlighting priorities 35 // Visited nodes to handle highlighting priorities
@@ -57,6 +60,7 @@ pub(crate) fn highlight(db: &RootDatabase, file_id: FileId) -> Vec<HighlightedRa
57 Some(Def(ModuleDef::Module(_))) => "module", 60 Some(Def(ModuleDef::Module(_))) => "module",
58 Some(Def(ModuleDef::Function(_))) => "function", 61 Some(Def(ModuleDef::Function(_))) => "function",
59 Some(Def(ModuleDef::Struct(_))) => "type", 62 Some(Def(ModuleDef::Struct(_))) => "type",
63 Some(Def(ModuleDef::Union(_))) => "type",
60 Some(Def(ModuleDef::Enum(_))) => "type", 64 Some(Def(ModuleDef::Enum(_))) => "type",
61 Some(Def(ModuleDef::EnumVariant(_))) => "constant", 65 Some(Def(ModuleDef::EnumVariant(_))) => "constant",
62 Some(Def(ModuleDef::Const(_))) => "constant", 66 Some(Def(ModuleDef::Const(_))) => "constant",
@@ -110,10 +114,79 @@ pub(crate) fn highlight(db: &RootDatabase, file_id: FileId) -> Vec<HighlightedRa
110 res 114 res
111} 115}
112 116
117pub(crate) fn highlight_as_html(db: &RootDatabase, file_id: FileId) -> String {
118 let source_file = db.parse(file_id);
119
120 let mut ranges = highlight(db, file_id);
121 ranges.sort_by_key(|it| it.range.start());
122 // quick non-optimal heuristic to intersect token ranges and highlighted ranges
123 let mut frontier = 0;
124 let mut could_intersect: Vec<&HighlightedRange> = Vec::new();
125
126 let mut buf = String::new();
127 buf.push_str(&STYLE);
128 buf.push_str("<pre><code>");
129 let tokens = source_file.syntax().descendants_with_tokens().filter_map(|it| it.as_token());
130 for token in tokens {
131 could_intersect.retain(|it| token.range().start() <= it.range.end());
132 while let Some(r) = ranges.get(frontier) {
133 if r.range.start() <= token.range().end() {
134 could_intersect.push(r);
135 frontier += 1;
136 } else {
137 break;
138 }
139 }
140 let text = html_escape(&token.text());
141 let classes = could_intersect
142 .iter()
143 .filter(|it| token.range().is_subrange(&it.range))
144 .map(|it| it.tag)
145 .collect::<Vec<_>>();
146 if classes.is_empty() {
147 buf.push_str(&text);
148 } else {
149 let classes = classes.join(" ");
150 buf.push_str(&format!("<span class=\"{}\">{}</span>", classes, text));
151 }
152 }
153 buf.push_str("</code></pre>");
154 buf
155}
156
157//FIXME: like, real html escaping
158fn html_escape(text: &str) -> String {
159 text.replace("<", "&lt;").replace(">", "&gt;")
160}
161
162const STYLE: &str = "
163<style>
164pre {
165 color: #DCDCCC;
166 background-color: #3F3F3F;
167 font-size: 22px;
168}
169
170.comment { color: #7F9F7F; }
171.string { color: #CC9393; }
172.function { color: #93E0E3; }
173.parameter { color: #94BFF3; }
174.builtin { color: #DD6718; }
175.text { color: #DCDCCC; }
176.attribute { color: #BFEBBF; }
177.literal { color: #DFAF8F; }
178.macro { color: #DFAF8F; }
179
180.keyword { color: #F0DFAF; }
181.keyword\\.unsafe { color: #F0DFAF; font-weight: bold; }
182.keyword\\.control { color: #DC8CC3; }
183
184</style>
185";
186
113#[cfg(test)] 187#[cfg(test)]
114mod tests { 188mod tests {
115 use insta::assert_debug_snapshot_matches; 189 use test_utils::{project_dir, read_text, assert_eq_text};
116
117 use crate::mock_analysis::single_file; 190 use crate::mock_analysis::single_file;
118 191
119 #[test] 192 #[test]
@@ -131,15 +204,21 @@ fn foo<T>() -> T {
131} 204}
132 205
133// comment 206// comment
134fn main() {} 207fn main() {
135 println!("Hello, {}!", 92); 208 println!("Hello, {}!", 92);
136 209
137 let mut vec = Vec::new(); 210 let mut vec = Vec::new();
138 vec.push(Foo { x: 0, y: 1 }); 211 if true {
212 vec.push(Foo { x: 0, y: 1 });
213 }
139 unsafe { vec.set_len(0); } 214 unsafe { vec.set_len(0); }
215}
140"#, 216"#,
141 ); 217 );
142 let result = analysis.highlight(file_id); 218 let dst_file = project_dir().join("crates/ra_ide_api/src/snapshots/highlighting.html");
143 assert_debug_snapshot_matches!("highlighting", result); 219 let actual_html = &analysis.highlight_as_html(file_id).unwrap();
220 let expected_html = &read_text(&dst_file);
221 // std::fs::write(dst_file, &actual_html).unwrap();
222 assert_eq_text!(expected_html, actual_html);
144 } 223 }
145} 224}
diff --git a/crates/ra_parser/src/grammar/items.rs b/crates/ra_parser/src/grammar/items.rs
index 6728e395f..7718fbe6a 100644
--- a/crates/ra_parser/src/grammar/items.rs
+++ b/crates/ra_parser/src/grammar/items.rs
@@ -103,7 +103,7 @@ pub(super) fn maybe_item(p: &mut Parser, m: Marker, flavor: ItemFlavor) -> Resul
103 p.bump_remap(T![auto]); 103 p.bump_remap(T![auto]);
104 has_mods = true; 104 has_mods = true;
105 } 105 }
106 if p.at(IDENT) && p.at_contextual_kw("default") && p.nth(1) == T![impl ] { 106 if p.at(IDENT) && p.at_contextual_kw("default") && p.nth(1) == T![impl] {
107 p.bump_remap(T![default]); 107 p.bump_remap(T![default]);
108 has_mods = true; 108 has_mods = true;
109 } 109 }
@@ -161,7 +161,7 @@ pub(super) fn maybe_item(p: &mut Parser, m: Marker, flavor: ItemFlavor) -> Resul
161 161
162 // test unsafe_default_impl 162 // test unsafe_default_impl
163 // unsafe default impl Foo {} 163 // unsafe default impl Foo {}
164 T![impl ] => { 164 T![impl] => {
165 traits::impl_block(p); 165 traits::impl_block(p);
166 m.complete(p, IMPL_BLOCK); 166 m.complete(p, IMPL_BLOCK);
167 } 167 }
diff --git a/crates/ra_parser/src/grammar/items/traits.rs b/crates/ra_parser/src/grammar/items/traits.rs
index 09ab3bfd4..5fcacfbff 100644
--- a/crates/ra_parser/src/grammar/items/traits.rs
+++ b/crates/ra_parser/src/grammar/items/traits.rs
@@ -44,7 +44,7 @@ pub(crate) fn trait_item_list(p: &mut Parser) {
44// test impl_block 44// test impl_block
45// impl Foo {} 45// impl Foo {}
46pub(super) fn impl_block(p: &mut Parser) { 46pub(super) fn impl_block(p: &mut Parser) {
47 assert!(p.at(T![impl ])); 47 assert!(p.at(T![impl]));
48 p.bump(); 48 p.bump();
49 if choose_type_params_over_qpath(p) { 49 if choose_type_params_over_qpath(p) {
50 type_params::opt_type_param_list(p); 50 type_params::opt_type_param_list(p);
@@ -130,7 +130,7 @@ fn choose_type_params_over_qpath(p: &Parser) -> bool {
130// impl impl NotType {} 130// impl impl NotType {}
131// impl Trait2 for impl NotType {} 131// impl Trait2 for impl NotType {}
132pub(crate) fn impl_type(p: &mut Parser) { 132pub(crate) fn impl_type(p: &mut Parser) {
133 if p.at(T![impl ]) { 133 if p.at(T![impl]) {
134 p.error("expected trait or type"); 134 p.error("expected trait or type");
135 return; 135 return;
136 } 136 }
diff --git a/crates/ra_parser/src/grammar/type_params.rs b/crates/ra_parser/src/grammar/type_params.rs
index 4bbfed780..ef59b59d3 100644
--- a/crates/ra_parser/src/grammar/type_params.rs
+++ b/crates/ra_parser/src/grammar/type_params.rs
@@ -150,7 +150,7 @@ pub(super) fn opt_where_clause(p: &mut Parser) {
150fn is_where_predicate(p: &mut Parser) -> bool { 150fn is_where_predicate(p: &mut Parser) -> bool {
151 match p.current() { 151 match p.current() {
152 LIFETIME => true, 152 LIFETIME => true,
153 T![impl ] => false, 153 T![impl] => false,
154 token => types::TYPE_FIRST.contains(token), 154 token => types::TYPE_FIRST.contains(token),
155 } 155 }
156} 156}
@@ -170,7 +170,7 @@ fn where_predicate(p: &mut Parser) {
170 p.error("expected colon"); 170 p.error("expected colon");
171 } 171 }
172 } 172 }
173 T![impl ] => { 173 T![impl] => {
174 p.error("expected lifetime or type"); 174 p.error("expected lifetime or type");
175 } 175 }
176 _ => { 176 _ => {
diff --git a/crates/ra_parser/src/grammar/types.rs b/crates/ra_parser/src/grammar/types.rs
index 438e3ab0e..c0b722569 100644
--- a/crates/ra_parser/src/grammar/types.rs
+++ b/crates/ra_parser/src/grammar/types.rs
@@ -25,7 +25,7 @@ fn type_with_bounds_cond(p: &mut Parser, allow_bounds: bool) {
25 T![_] => placeholder_type(p), 25 T![_] => placeholder_type(p),
26 T![fn] | T![unsafe] | T![extern] => fn_pointer_type(p), 26 T![fn] | T![unsafe] | T![extern] => fn_pointer_type(p),
27 T![for] => for_type(p), 27 T![for] => for_type(p),
28 T![impl ] => impl_trait_type(p), 28 T![impl] => impl_trait_type(p),
29 T![dyn ] => dyn_trait_type(p), 29 T![dyn ] => dyn_trait_type(p),
30 // Some path types are not allowed to have bounds (no plus) 30 // Some path types are not allowed to have bounds (no plus)
31 T![<] => path_type_(p, allow_bounds), 31 T![<] => path_type_(p, allow_bounds),
@@ -221,7 +221,7 @@ pub(super) fn for_type(p: &mut Parser) {
221// test impl_trait_type 221// test impl_trait_type
222// type A = impl Iterator<Item=Foo<'a>> + 'a; 222// type A = impl Iterator<Item=Foo<'a>> + 'a;
223fn impl_trait_type(p: &mut Parser) { 223fn impl_trait_type(p: &mut Parser) {
224 assert!(p.at(T![impl ])); 224 assert!(p.at(T![impl]));
225 let m = p.start(); 225 let m = p.start();
226 p.bump(); 226 p.bump();
227 type_params::bounds_without_colon(p); 227 type_params::bounds_without_colon(p);
diff --git a/docs/user/README.md b/docs/user/README.md
index affb96939..47fc840f7 100644
--- a/docs/user/README.md
+++ b/docs/user/README.md
@@ -89,6 +89,25 @@ to load path and require it in `init.el`
89* (Optionally) bind commands like `rust-analyzer-join-lines` or `rust-analyzer-extend-selection` to keys 89* (Optionally) bind commands like `rust-analyzer-join-lines` or `rust-analyzer-extend-selection` to keys
90 90
91 91
92## Vim and NeoVim
93
94* Install coc.nvim by following the instructions at [coc.nvim]
95* Add rust analyzer using: [coc.nvim wiki][coc-wiki]
96
97```jsonc
98 "languageserver": {
99 "rust": {
100 "command": "ra_lsp_server",
101 "filetypes": ["rust"],
102 "rootPatterns": ["Cargo.toml"]
103 }
104}
105```
106
107[coc.nvim]: https://github.com/neoclide/coc.nvim
108[coc-wiki]: https://github.com/neoclide/coc.nvim/wiki/Language-servers#rust
109
110
92## Sublime Text 3 111## Sublime Text 3
93 112
94Prequisites: 113Prequisites: