Commit graph

9825 commits

Author SHA1 Message Date
Edwin Cheng
ce4eeec1bf Support Macro v2 in mbe 2021-01-26 05:15:47 +08:00
Jonas Schievink
08253d5473 Traverse parent DefMap for super paths 2021-01-25 19:15:39 +01:00
Jonas Schievink
98a88ebb9e Intern block locations and handle them in ModuleId 2021-01-25 19:02:05 +01:00
vsrs
185cd736a6 Add RA_WAIT_DBG and docs 2021-01-25 17:46:03 +03:00
vsrs
8c843d1dac Add the ability to wait for a debugger. 2021-01-25 17:46:03 +03:00
vsrs
98d7512e93 Add stderr flush 2021-01-25 17:46:03 +03:00
vsrs
43fabfbe36 Add --no-buffering flag for the file logging. 2021-01-25 17:46:03 +03:00
bors[bot]
2c735ed734
Merge #7426
7426: Create all `ModuleId`s through a `DefMap` method r=jonas-schievink a=jonas-schievink

`ModuleId` needs to be able to represent blocks, and only the
associated `DefMap` will know how to construct that `ModuleId`

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-01-25 14:22:24 +00:00
Jonas Schievink
5c241b0766 Create all ModuleIds through a DefMap method
`ModuleId` needs to be able to represent blocks, and only the
associated `DefMap` will know how to construct that `ModuleId`
2021-01-25 15:21:33 +01:00
Laurențiu Nicola
5ed5a542fb Derive Default on ItemTree 2021-01-25 14:12:53 +02:00
bors[bot]
a6a5b02f4c
Merge #7422
7422: Disallow non-boolean literals in concat! r=lnicola a=lnicola



Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-01-25 11:35:37 +00:00
Laurențiu Nicola
4e92681aba Disallow non-boolean literals in concat! 2021-01-25 13:31:03 +02:00
bors[bot]
83231dd987
Merge #7409 #7421
7409: Add References CodeLens. r=matklad a=vsrs

Closes #5836

7421: Fix RA_LOG example in dev docs r=lnicola a=lnicola

bors r+

Co-authored-by: vsrs <vit@conrlab.com>
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-01-25 11:18:58 +00:00
Laurențiu Nicola
ee8c678870 Unquote strings and handle boolean literals in concat! 2021-01-25 13:02:57 +02:00
Aleksey Kladov
1df711b95c ⬆️ rowan 2021-01-25 12:32:35 +03:00
bors[bot]
3ab8d7a9ae
Merge #7414
7414: Add validation for mutable const items r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-01-24 01:18:58 +00:00
Lukas Wirth
70d43c3faf Add validation for mutable const items 2021-01-24 02:17:41 +01:00
Lukas Wirth
a872ebf81f Support unions in symbol search 2021-01-24 01:32:52 +01:00
vsrs
3618c4e0d3 Add References code lens.
For Struct, Enum, Union and Trait symbols.
2021-01-23 16:56:20 +03:00
Phil Ellison
db6dda94a3 Remove use of SourceFileEdit 2021-01-23 07:54:45 +00:00
Phil Ellison
65a5ea581d Update tests to register the required standard library types 2021-01-23 07:40:25 +00:00
Phil Ellison
7c691f51f9 Fix test names 2021-01-23 07:40:25 +00:00
Phil Ellison
8c7ccdc29d Identify methods using functions ids rather than string names 2021-01-23 07:40:25 +00:00
Phil Ellison
920e57bd15 cargo fmt 2021-01-23 07:40:25 +00:00
Phil Ellison
e62e4ed148 Address review comments 2021-01-23 07:40:25 +00:00
Phil Ellison
449ced4d21 cargo fmt 2021-01-23 07:40:25 +00:00
Phil Ellison
1ff860b93c Implement fix, add tests 2021-01-23 07:40:25 +00:00
Phil Ellison
1316422a7c Add diagnostic for filter_map followed by next 2021-01-23 07:40:24 +00:00
bors[bot]
eab5db20ed
Merge #7391
7391: Fix error when using "extern crate self as" r=kazatsuyu a=kazatsuyu

Fix #6957

Co-authored-by: kazatsuyu <shirayama.kazatsuyu@gmail.com>
2021-01-23 04:04:09 +00:00
Dániel Buga
5728d7186e Deduplicate variant matching 2021-01-22 23:39:43 +01:00
Dániel Buga
24f0cd8293 replace_if_let_with_match: don't assume sad pattern 2021-01-22 23:29:51 +01:00
bors[bot]
f301da3c3d
Merge #7399
7399: Make `ModuleId`'s `krate` field private and audit uses r=jonas-schievink a=jonas-schievink

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-01-22 17:11:48 +00:00
Jonas Schievink
3de8f57c51 Make ModuleId's krate field private 2021-01-22 18:09:55 +01:00
Aleksey Kladov
738d9cdfde stave off zombies 2021-01-22 19:50:56 +03:00
Aleksey Kladov
96197e0873 Normalize tests 2021-01-22 19:15:34 +03:00
Aleksey Kladov
a40f78f92a More useful fn detail in completion
Detail should be rendered as shtort one line, just dumping fn header
there is not useful, despite the fact that TS does this.

The fact that this is a function should be indicated by the icon, the
same goes for pub/const/async etc qualitfiers

name is already present in the lable (and arg list should be a part of
that, as in idea)

But the return type is the small genuinerlly useful bit of info we can show here
2021-01-22 19:15:34 +03:00
Aleksey Kladov
02a17cdffc Make assertion failures more annoying for maintainers 2021-01-22 19:13:21 +03:00
bors[bot]
b16add934d
Merge #7310 #7395
7310: Add assist: add lifetime to type r=matklad a=bnjjj

close #7200 

7395: Obtain `ModuleId`'s `DefMap` through a method r=jonas-schievink a=jonas-schievink

Once `ModuleId` can represent modules inside block expressions, this will be required in order to obtain the correct `DefMap`. Otherwise existing code might use a `LocalModuleId` from the wrong `DefMap` and cause a panic.

bors r+

Co-authored-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-01-22 15:45:50 +00:00
Jonas Schievink
ce29730bc7 Obtain ModuleId's DefMap through a method 2021-01-22 16:33:58 +01:00
bors[bot]
0c37b3a0fc
Merge #7353
7353: Add LifetimeParam and ConstParam to CompletionItemKind r=matklad a=Veykril

Adds `LifetimeParam` and `ConstParam` to `CompletionItemKind` and maps them both to `TypeParam` in the protocol conversion as there are no equivalents, so nothing really changes there.
`ConstParam` could be mapped to `Const` I guess but I'm split on whether that would be better?

Additions were solely inspired by (the single) test output for const params.

Also sorts the variants of `CompletionItemKind` and its to_proto match.



Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-01-22 15:31:47 +00:00
kazatsuyu
90d6740e32 Add mark::check! and mark::hit! 2021-01-23 00:11:37 +09:00
Arnaud
1fc56ea224 Document paths items 2021-01-22 15:38:33 +01:00
kazatsuyu
0fb4544403 cargo fmt 2021-01-22 22:52:04 +09:00
kazatsuyu
e52589e3a7 Fix error when using "extern crate self as" 2021-01-22 22:28:45 +09:00
bors[bot]
c050e972a3
Merge #7386
7386: Handle box with allocator r=flodiebold a=tweksteen

In 1.49.0, the definition of Box was modified to support an optional
Allocator[1]. Adapt the parsing of the `box` keyword to supply the
expected number of parameters to the constructor.

[1] f288cd2e17

Fixes: #6956 


Co-authored-by: Thiébaud Weksteen <tweek@google.com>
2021-01-22 13:14:40 +00:00
Thiébaud Weksteen
be0691b02b Handle box with allocator
In 1.49.0, the definition of Box was modified to support an optional
Allocator[1]. Adapt the parsing of the `box` keyword to supply the
expected number of parameters to the constructor.

[1] f288cd2e17
2021-01-22 13:50:23 +01:00
bors[bot]
1b96c79ab5
Merge #7348
7348: Fix broken link in intra-doc r=edwin0cheng a=sasurau4

Fix #5546 
The intra-doc link doesn't work fine for trait associated method.

Co-authored-by: Daiki Ihara <sasurau4@gmail.com>
2021-01-22 12:29:42 +00:00
bors[bot]
3cd994d8a5
Merge #7389
7389: Remove approximate goto def r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-01-22 12:14:23 +00:00
Aleksey Kladov
f67a2eedf5 Cleanup tests 2021-01-22 15:13:18 +03:00
Aleksey Kladov
2c786f1b98 Remove index based fallback for goto def
We are so precise that the fallback creates more confusion, when you can
goto def on an unresolved reference.
2021-01-22 15:11:29 +03:00
Edwin Cheng
eb2cb6b01f Use AbsPath 2021-01-22 19:51:14 +08:00
bors[bot]
6403b530bb
Merge #7387
7387: Refactor build script specific data r=edwin0cheng a=edwin0cheng

It refactors for separating logic for build script specific data. 

bors r+

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2021-01-22 11:15:22 +00:00
Edwin Cheng
6bdb6786ba Refactor build script data 2021-01-22 19:11:01 +08:00
Daiki Ihara
f5b97e52c9 Fix broken link in intra-doc 2021-01-22 20:06:45 +09:00
Jonas Schievink
8916b0c6cb Remove unused field 2021-01-21 21:12:26 +01:00
Jonas Schievink
4d19607057 Add test for path resolution bug 2021-01-21 20:35:36 +01:00
Jonas Schievink
3f4f253028
Revert "Make use of block_def_map in body lowering" 2021-01-21 19:04:31 +01:00
bors[bot]
e76d8c1d9a
Merge #7378
7378: Include `countme` crate to count important data structures. r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-01-21 17:46:44 +00:00
Jonas Schievink
cdb0e25aaa Make use of block_def_map in body lowering
Removes the `local_scope` hack from `Expander` in favor of tracking the
`DefMap` in use during body lowering
2021-01-21 18:05:52 +01:00
Aleksey Kladov
e5c5c0a040 Include countme crate to count important data structures. 2021-01-21 19:30:52 +03:00
Jonas Schievink
d157a03e93 Remove unnecessary annotations from tests 2021-01-21 17:19:46 +01:00
Jonas Schievink
4e603b7947 Add test for nameres in nested blocks 2021-01-21 16:42:56 +01:00
bors[bot]
47a70aadce
Merge #7375
7375: Add support for running name resolution in block expressions r=jonas-schievink a=jonas-schievink

This adds a `block_def_map` query that runs the name resolution algorithm on a block expression, and returns a `DefMap` that stores links to the parent `DefMap` (either the containing block or the crate-level `DefMap`). Blocks with no inner items return the parent's `DefMap` as-is, to avoid creating unnecessarily long `DefMap` chains.

Path resolution is updated to recurse into the parent `DefMap` after looking up a path in the original `DefMap`.

I've added a few new tests for this, but outside of those this isn't used yet.

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-01-21 15:28:40 +00:00
Jonas Schievink
ec4a1dc297 Add test that merges inner and outer names 2021-01-21 16:23:50 +01:00
Jonas Schievink
d62c9c6c63 Fix lowering with multiple block expressions 2021-01-21 16:23:22 +01:00
bors[bot]
323138f32e
Merge #7372
7372: Up lexer r=kjeremy a=kjeremy

No real changes here.

Co-authored-by: kjeremy <kjeremy@gmail.com>
2021-01-21 14:32:57 +00:00
kjeremy
f006517857 Up lexer 2021-01-21 09:31:06 -05:00
Jonas Schievink
f8f44cfb9b Fall back to parent DefMaps when resolving paths 2021-01-21 15:24:15 +01:00
Jonas Schievink
896dfacfc4 Add name resolution query for block expressions 2021-01-21 15:22:17 +01:00
bors[bot]
cde22aba1c
Merge #7371
7371: Change directory before running rustfmt to respect rustfmt.toml r=matklad a=lnicola

Fixes #6973

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-01-21 14:15:14 +00:00
Laurențiu Nicola
c067ca505a chdir to file before rustfmt 2021-01-21 15:58:17 +02:00
bors[bot]
64a92e2328
Merge #7368
7368: Clarify enabled features and defined features in PackageData r=matklad a=edwin0cheng



Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2021-01-21 11:30:38 +00:00
Edwin Cheng
ac3ec18f4b Added defined_features in PackageData 2021-01-21 19:12:19 +08:00
Benjamin Coenen
06f1c8f5a1 Add assist: add lifetime to type #7200
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2021-01-21 09:53:24 +01:00
Laurențiu Nicola
e42dfd7a40 Bump chalk 2021-01-21 10:29:19 +02:00
Jonas Schievink
82146737ac Treat BlockExpr as a potential module origin 2021-01-20 20:05:48 +01:00
Lukas Wirth
08b822b259 Update completions test output 2021-01-20 18:46:22 +01:00
Lukas Wirth
f2cb7dbcb7 Partially unify SymbolKind and CompletionItemKind 2021-01-20 18:39:46 +01:00
bors[bot]
7d5ed18c42
Merge #7365
7365: chalk 0.49.0 r=kjeremy a=kjeremy



Co-authored-by: kjeremy <kjeremy@gmail.com>
2021-01-20 17:35:15 +00:00
kjeremy
1e0b163860 chalk 0.49.0 2021-01-20 12:31:03 -05:00
Jonas Schievink
5f319ca7ee DefMap: hide remaining crate-visible fields 2021-01-20 18:17:48 +01:00
bors[bot]
e62533c3ec
Merge #7359
7359: ItemTree: store a mapping from blocks to inner items r=jonas-schievink a=jonas-schievink

To do name resolution within block expressions, we need to know which inner items are located inside each block expression. This adds such a mapping to `ItemTree`, replacing the previous one, which was seemingly unused other than to access all the inner items.

This also assigns `AstId`s to block expressions, which is needed to store the mapping in salsa.

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-01-20 16:09:22 +00:00
Jonas Schievink
0587b99fde Make public DefMap fields private 2021-01-20 15:41:18 +01:00
Lukas Wirth
563a175fdb Move SymbolKind to ide_db 2021-01-20 15:25:34 +01:00
Jonas Schievink
c5ed2284b5 Create a mapping from blocks to inner items 2021-01-20 15:00:28 +01:00
bors[bot]
de5aabd48b
Merge #7350
7350: Update pico-args r=matklad a=kjeremy

Should maintain existing behavior

Co-authored-by: kjeremy <kjeremy@gmail.com>
2021-01-20 12:28:10 +00:00
Aleksey Kladov
74f8201586 Avoid intermediate collections 2021-01-20 14:49:29 +03:00
Aleksey Kladov
724059569b Don't show runnable suggestions for other files
It't be actually great to have these once we have run anything dialog,
but for run the thing at point it makes sense to show a limited set.
2021-01-20 14:30:50 +03:00
Aleksey Kladov
3429b32ad1 ⬆️ rowan
It now stores text inline with tokens
2021-01-20 14:04:53 +03:00
Aleksey Kladov
46b4f89c92 . 2021-01-20 01:56:11 +03:00
Lukas Wirth
83e49200d8 Add LifetimeParam and ConstParam to CompletionItemKind 2021-01-19 20:25:29 +01:00
bors[bot]
63f509f492
Merge #7352
7352: ⬆️ rowan r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-01-19 19:19:24 +00:00
Aleksey Kladov
cd21b0e9c1 ⬆️ rowan 2021-01-19 22:11:42 +03:00
bors[bot]
f647e134a7
Merge #7351
7351: Show const params in completions r=Veykril a=Veykril

bors r+
![image](https://user-images.githubusercontent.com/3757771/105080872-bba76680-5a91-11eb-91cd-0910da4c8312.png)


Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-01-19 19:07:33 +00:00
Lukas Wirth
bed12833cc Show const params in completions 2021-01-19 20:06:39 +01:00
Jonas Schievink
52fe50a97b Record FileAstIds for block expressiosn
Every block expression may contain inner items, so we need to be able
to refer to any block expression and use it as a salsa key.
2021-01-19 19:49:19 +01:00
kjeremy
db0aaeca33 Update pico-args
Should maintains existing behavior
2021-01-19 11:56:45 -05:00
Edwin Cheng
7b3e960d94 Reduce TokenMap size 2021-01-19 19:26:53 +08:00
bors[bot]
8935106b39
Merge #7321
7321: Support runnables in macros r=matklad a=edwin0cheng

fixes  #4771

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2021-01-19 09:27:45 +00:00
Edwin Cheng
8b03b58ad7 Support runnables in macros 2021-01-19 16:58:11 +08:00
bors[bot]
00680a5d7c
Merge #7342
7342: Show deprecated completions for deprecated traits r=kjeremy a=SomeoneToIgnore

TIL that there are two kinds of deprecation tags and a few details about String methods.

<img width="472" alt="Screenshot 2021-01-19 at 01 11 38" src="https://user-images.githubusercontent.com/2690773/104970200-569d3380-59f3-11eb-9ee3-627b3c8a5c9d.png">


Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2021-01-19 01:33:49 +00:00
bors[bot]
5231f4b270
Merge #7341
7341: Fix warnings when running `cargo doc --document-private-items` r=Veykril a=jyn514

These were the warnings previously:

<details>

```
warning: could not parse code block as Rust code
   --> crates/stdx/src/lib.rs:137:9
    |
137 |   ///     ∀ x in slice[..idx]:  pred(x)
    |  _________^
138 | | ///  && ∀ x in slice[idx..]: !pred(x)
    | |____^
    |
    = note: error from rustc: unknown start of token: \u{2200}

warning: 1 warning emitted

warning: unresolved link to `package`
   --> crates/base_db/src/input.rs:181:15
    |
181 |     /// it's [package].name, can be different for other project types or even
    |               ^^^^^^^ no item named `package` in scope
    |
    = note: `#[warn(broken_intra_doc_links)]` on by default
    = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`

warning: unresolved link to `package`
   --> crates/base_db/src/input.rs:181:15
    |
181 |     /// it's [package].name, can be different for other project types or even
    |               ^^^^^^^ no item named `package` in scope
    |
    = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`

warning: 2 warnings emitted

warning: unresolved link to `package`
   --> crates/base_db/src/input.rs:181:15
    |
181 |     /// it's [package].name, can be different for other project types or even
    |               ^^^^^^^ no item named `package` in scope
    |
    = note: `#[warn(broken_intra_doc_links)]` on by default
    = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`

warning: unresolved link to `package`
   --> crates/base_db/src/input.rs:181:15
    |
181 |     /// it's [package].name, can be different for other project types or even
    |               ^^^^^^^ no item named `package` in scope
    |
    = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`

warning: 2 warnings emitted
```

</details>

This does *not* fix the following warning, because it is actually rust
code and rustdoc is being over eager:

```
warning: Rust code block is empty
  --> crates/parser/src/grammar.rs:16:5
   |
16 |   //! ```
   |  _____^
17 | | //! // test function_with_zero_parameters
18 | | //! // fn foo() {}
19 | | //! ```
   | |_______^
   |
help: mark blocks that do not contain Rust code as text
   |
16 | //! ```text
   |     ^^^^^^^
```

https://github.com/rust-lang/rust/pull/79816 should make this
configurable so the warning can be `allow`ed.

Co-authored-by: Joshua Nelson <jyn514@gmail.com>
2021-01-18 23:19:53 +00:00
Kirill Bulatov
ca65488276 Show deprecated completions for deprecated traits 2021-01-19 01:08:59 +02:00
Kirill Bulatov
cc663a7b0c Consider rustc_deprecated attr when checking for deprecation 2021-01-19 00:04:24 +02:00
Joshua Nelson
e7d1f30cb3 Fix warnings when running cargo doc --document-private-items
These were the warnings previously:

```
warning: could not parse code block as Rust code
   --> crates/stdx/src/lib.rs:137:9
    |
137 |   ///     ∀ x in slice[..idx]:  pred(x)
    |  _________^
138 | | ///  && ∀ x in slice[idx..]: !pred(x)
    | |____^
    |
    = note: error from rustc: unknown start of token: \u{2200}

warning: 1 warning emitted

warning: unresolved link to `package`
   --> crates/base_db/src/input.rs:181:15
    |
181 |     /// it's [package].name, can be different for other project types or even
    |               ^^^^^^^ no item named `package` in scope
    |
    = note: `#[warn(broken_intra_doc_links)]` on by default
    = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`

warning: unresolved link to `package`
   --> crates/base_db/src/input.rs:181:15
    |
181 |     /// it's [package].name, can be different for other project types or even
    |               ^^^^^^^ no item named `package` in scope
    |
    = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`

warning: 2 warnings emitted

warning: unresolved link to `package`
   --> crates/base_db/src/input.rs:181:15
    |
181 |     /// it's [package].name, can be different for other project types or even
    |               ^^^^^^^ no item named `package` in scope
    |
    = note: `#[warn(broken_intra_doc_links)]` on by default
    = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`

warning: unresolved link to `package`
   --> crates/base_db/src/input.rs:181:15
    |
181 |     /// it's [package].name, can be different for other project types or even
    |               ^^^^^^^ no item named `package` in scope
    |
    = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`

warning: 2 warnings emitted
```

This does *not* fix the following warning, because it is actually rust
code and rustdoc is being over eager:

```
warning: Rust code block is empty
  --> crates/parser/src/grammar.rs:16:5
   |
16 |   //! ```
   |  _____^
17 | | //! // test function_with_zero_parameters
18 | | //! // fn foo() {}
19 | | //! ```
   | |_______^
   |
help: mark blocks that do not contain Rust code as text
   |
16 | //! ```text
   |     ^^^^^^^
```

https://github.com/rust-lang/rust/pull/79816 should make this
configurable so the warning can be `allow`ed.
2021-01-18 16:44:40 -05:00
bors[bot]
bf889bcf3b
Merge #7340
7340: Remove obsolete RangeInfo usage in references r=Veykril a=Veykril

Didn't even realize these were only here for renaming as well!

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-01-18 20:25:26 +00:00
bors[bot]
0791c8e44c
Merge #7336
7336: Rename `CrateDefMap` to `DefMap` r=matklad a=jonas-schievink

I propose handling local items by computing a `DefMap` for every block expression, using the regular (early) name resolution algorithm. The result of that will be a `DefMap` that has a reference to the parent `DefMap`, which is either the one computed for the containing block expression, or the crate's root `DefMap`. Name resolution will fall back to a name in the parent `DefMap` if it cannot be resolved in the inner block.

The `DefMap`s computed for block expressions will go through a separate query that can be garbage-collected much more aggressively, since these `DefMap`s should be cheap to compute and are never part of a crate's public API.

The first step towards that is to make `CrateDefMap` not specific to crates anymore, hence this rename (if this plans sounds reasonable).

cc https://github.com/rust-analyzer/rust-analyzer/issues/7325 and https://github.com/rust-analyzer/rust-analyzer/issues/1165

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-01-18 20:12:11 +00:00
Lukas Wirth
e31420fbe2 Remove obsolete RangeInfo usage in references 2021-01-18 21:10:01 +01:00
bors[bot]
8164e2ea31
Merge #7339
7339: Delete optional arg for inline attr and add doc alias attr completion r=lnicola a=bnjjj

close #7167

Co-authored-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2021-01-18 19:54:40 +00:00
Benjamin Coenen
52bce6bf5d Delete optional arg for inline attr and add doc alias attr completion #7167
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2021-01-18 20:50:45 +01:00
bors[bot]
342bf41022
Merge #7297 #7338
7297: Propose trait associated items and autoimport traits on completion r=matklad a=SomeoneToIgnore

![trait_imports](https://user-images.githubusercontent.com/2690773/104819998-6faeb480-583a-11eb-8b45-b7351b51b90e.gif)

Closes #7248

7338: Parse `impl const Trait` r=Veykril a=Veykril

Closes #7313

bors r+

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-01-18 19:40:11 +00:00
Benjamin Coenen
35d9944c17 Add assist: add lifetime to type #7200
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2021-01-18 20:38:52 +01:00
Kirill Bulatov
f01cfe9114 Small token fix
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-01-18 21:30:04 +02:00
Lukas Wirth
21a6384ce6 Remove obsolete RangeInfo usage in rename 2021-01-18 20:28:20 +01:00
Jonas Schievink
57a82fb05b Rename CrateDefMap to DefMap 2021-01-18 20:18:05 +01:00
Lukas Wirth
b26002410b Parse impl const Trait 2021-01-18 20:18:02 +01:00
bors[bot]
39282ec419
Merge #7332
7332: Rename reference search uses ide_db::search directly r=matklad a=Veykril

https://github.com/rust-analyzer/rust-analyzer/pull/7251#discussion_r556644241

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-01-18 19:00:04 +00:00
Jonas Schievink
9b5fa1c61a Add back jemalloc support 2021-01-18 19:39:46 +01:00
kjeremy
a8b984185b cargo update
Update test_serialize_proc_macro for new serde version
2021-01-18 13:13:24 -05:00
Lukas Wirth
6015a66cae Make rename reference search use ide_db::search directly 2021-01-18 18:57:59 +01:00
bors[bot]
a1c72451bb
Merge #7331
7331: shrink_to_fit `TokenMap`'s backing storage r=jonas-schievink a=jonas-schievink

Reduces `HygieneFrameQuery`'s memory usage by like 10 MB or so

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-01-18 17:49:52 +00:00
bors[bot]
fcc109e890
Merge #7326
7326: Use `is_ident` when converting Path to an Identifier r=edwin0cheng a=kevaundray



Co-authored-by: Kevaundray Wedderburn <kevtheappdev@gmail.com>
2021-01-18 17:40:11 +00:00
Jonas Schievink
2d799cf5e0 shrink_to_fit TokenMap's backing storage 2021-01-18 18:40:06 +01:00
bors[bot]
9210f480ac
Merge #7329
7329: Add test for reference search on self declaration param r=Veykril a=Veykril

Closes #7316

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-01-18 17:24:48 +00:00
Lukas Wirth
22b9b9abe7 Add test for reference search on self declaration param 2021-01-18 18:21:40 +01:00
bors[bot]
6105dbfc2e
Merge #7327
7327: Remove `item_tree::Expr` r=jonas-schievink a=jonas-schievink

It's empty and unused

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-01-18 17:11:38 +00:00
Jonas Schievink
6f4f285f37 Remove item_tree::Expr
It's empty and unused
2021-01-18 18:05:40 +01:00
Kevaundray Wedderburn
da104bb0f5 cargo fmt 2021-01-18 16:58:29 +00:00
Jonas Schievink
872bf09381 Add MacroType syntax 2021-01-18 17:56:35 +01:00
Kevaundray Wedderburn
725c20e8c5 use is_ident method 2021-01-18 16:54:07 +00:00
bors[bot]
9daba961f2
Merge #7291
7291: Wrap remaining self/super/crate in Name{Ref} r=matklad a=Veykril

That should be the remaining special casing for `self` 🎉 

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-01-18 16:13:06 +00:00
bors[bot]
cc58459ee3
Merge #7323
7323: Minor r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-01-18 13:11:37 +00:00
Aleksey Kladov
738cf7d495 Minor 2021-01-18 16:09:44 +03:00
Aleksey Kladov
a60168e674 Use assert_never properly 2021-01-18 15:58:10 +03:00
bors[bot]
1f53026997
Merge #7320
7320: Enable serde_json unbounded_depth feature r=lnicola a=lnicola

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-01-18 12:05:39 +00:00
Laurențiu Nicola
d6b3dc1a6f Enable serde_json unbounded_depth feature 2021-01-18 14:04:20 +02:00
Aleksey Kladov
add87f5424 Avoid blocking the main loop when editing Cargo.toml
I've noticed a bunch of "main loop too long" warnings in console when
typing in Cargo.toml. Profiling showed that the culprit is `rustc
--print cfg` call.

I moved it to the background project loading phase, where it belongs.
This highlighted a problem: we generally use single `cfg`, while it
really should be per crate.
2021-01-18 14:52:12 +03:00
Aleksey Kladov
cc963d2b11 Add profile call 2021-01-18 14:01:52 +03:00
bors[bot]
5e6e890947
Merge #7317
7317: Add profile call r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-01-18 10:30:43 +00:00
Aleksey Kladov
e13065b8ac Add profile call 2021-01-18 13:30:12 +03:00
bors[bot]
9eb37fbdeb
Merge #7292
7292: Swap assert_eq_text\!(expected, actual) r=matklad a=u5surf

Fixes #7283 

Swap assert_eq_text parameters in the order (expected, actual)

Co-authored-by: yugo-horie <u5.horie@gmail.com>
2021-01-18 10:12:54 +00:00
Benjamin Coenen
557cf513fa Add assist: add lifetime to type #7200
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2021-01-17 15:15:23 +01:00
Aleksey Kladov
b97447b125 Add missing inlines 2021-01-17 16:50:03 +03:00
Aleksey Kladov
0a570eddd2 Less annoying mod completion
We shouldn't complete optional elements, as deleting stuff is much more
annoying than adding it.
2021-01-17 13:18:45 +03:00
Aleksey Kladov
1c8feac01f ⬆️ arena 2021-01-17 11:43:04 +03:00
Aramis Razzaghipour
1d103cf087
Use ‘index’ terminology for arena consistently 2021-01-17 18:38:08 +11:00
bors[bot]
3224ecea87
Merge #7276
7276: Remove map module from la-arena public API r=lnicola a=arzg

It’s unlikely that more items will be added to the module, so it’s simpler for users if `ArenaMap` is re-exported and the module made private.

This doesn’t compile for the same reason that #7275 doesn’t:

> This pull request doesn’t compile because dependencies on la-arena go through crates.io, so existing dependencies on the crate are referencing an old version. As such, this PR will only compile once a new la-arena version has been published.

Co-authored-by: Aramis Razzaghipour <aramisnoah@gmail.com>
2021-01-17 07:20:36 +00:00
bors[bot]
f5f011ba71
Merge #7304
7304: Depend on local copy of la-arena instead of crates.io’s r=lnicola a=arzg

This addresses [this comment](https://github.com/rust-analyzer/rust-analyzer/pull/7276#issuecomment-760909936). #7275 and #7276 should start compiling if this is merged.

Co-authored-by: Aramis Razzaghipour <aramisnoah@gmail.com>
2021-01-17 07:05:44 +00:00
Aramis Razzaghipour
709034d123
Depend on local copy of la-arena instead of crates.io’s 2021-01-17 17:52:57 +11:00
Kirill Bulatov
d1ac3293f4 Properly resolve completion edits for empty input 2021-01-17 02:57:38 +02:00