Commit Graph

7356 Commits

Author SHA1 Message Date
kjeremy
0610444407 Dropping a reference does nothing.
Allows clippy to continue compilation
2020-01-13 10:51:39 -05:00
Aleksey Kladov
a30129be5a build with clang? 2020-01-13 15:20:09 +01:00
Aleksey Kladov
ab6e992c87 musl 2020-01-13 14:53:09 +01:00
Aleksey Kladov
79c7394da2
Merge pull request #2820 from rust-analyzer/releases
GitHub releases
2020-01-13 14:48:13 +01:00
Aleksey Kladov
5514ca3997 🎁 GitHub releases 🎁 2020-01-13 14:47:03 +01:00
Aleksey Kladov
875352b2b6 Rename Emacs "extension" 2020-01-13 12:56:33 +01:00
bors[bot]
96e759413d
Merge #2815
2815: Report macro calls as functions r=matklad a=kjeremy



Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2020-01-13 10:34:43 +00:00
bors[bot]
de717a8635
Merge #2816
2816: Add macro_rules item snippet r=matklad a=memoryruins

An user trying out rust-analyzer mentioned to me that they missed `rls-vscode`'s [macro_rules snippet](c2293a63d4/snippets/rust.json (L60))

![2020-01-12_17-47-34](https://user-images.githubusercontent.com/6868531/72227227-fcf46480-3567-11ea-9e3b-2f7319d127f7.gif)


Co-authored-by: memoryruins <memoryruinsmusic@gmail.com>
2020-01-13 10:24:17 +00:00
bors[bot]
5fd1b044b6
Merge #2768
2768: Rename VS Code extension to rust-analyzer r=matklad a=matklad

I want to merge this before release on Monday, such that we can give heads up on twitter

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-01-13 10:13:47 +00:00
Aleksey Kladov
bd7aa5db14 Rename VS Code extension to rust-analyzer 2020-01-13 11:13:18 +01:00
memoryruins
5575588387 Add macro_rules item snippet 2020-01-12 18:47:15 -05:00
Jeremy Kolb
9e71ff9636 Report macro calls as functions 2020-01-12 17:22:09 -05:00
bors[bot]
a05970da46
Merge #2788
2788: Fix file_structure()  to recognize macro_rules! r=flodiebold a=ruabmbua

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/2774.

Not sure what to do about classifying macro definitions. Maybe make all macro invocations a function invocation?

Co-authored-by: Roland Ruckerbauer <roland.rucky@gmail.com>
2020-01-12 17:34:47 +00:00
Roland Ruckerbauer
20b8d283ae Remove hir usage from macro_rules! detection in structure_node() 2020-01-12 17:34:57 +01:00
Roland Ruckerbauer
15c5426b54 Use hir .path() and .name() to differentiate
macro call and macro definition
2020-01-12 17:34:57 +01:00
Roland Ruckerbauer
c6655c67d2 Added test for file_structure unidentified macro definition 2020-01-12 17:34:57 +01:00
Roland Ruckerbauer
db151763d4 Fix file_structure() to recognize macro_rules!
where first token != "macro_rules"
2020-01-12 17:34:57 +01:00
bors[bot]
d0b52e5d84
Merge #2814
2814: Update crates r=matklad a=kjeremy

Adds a new dependency on autocfg 1.0. There are pending PRs against indexmap, crossbeam and rand to bring them up.

Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2020-01-12 15:57:38 +00:00
Joshua Nelson
c3ac2c93fb
Allow attributes before function arguments
This adds support for function calls of the form:

```rust
  (
    #[attr(...)] 1.2,
    #[attr_one(...)]
    #[attr_two(...)]
    1.5,
    ... etc ...
  )
```

Closes https://github.com/rust-analyzer/rust-analyzer/issues/2801
2020-01-12 10:25:41 -05:00
bors[bot]
f7a7092d69
Merge #2712
2712: Supporting extend selection inside macro calls r=edwin0cheng a=edwin0cheng



Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-01-12 12:26:40 +00:00
Edwin Cheng
0593da9a36 Fix format 2020-01-12 20:25:58 +08:00
Edwin Cheng
384e1ced88 Use prev_token and next_token 2020-01-12 20:25:58 +08:00
Edwin Cheng
b7ab079211 Use indices first and last instead of min-max 2020-01-12 20:25:58 +08:00
Edwin Cheng
caed836e41 Use first and last token only 2020-01-12 20:25:58 +08:00
Edwin Cheng
b30e6a7b56 Handle extend selection in recursive macro 2020-01-12 20:25:58 +08:00
Edwin Cheng
07f4171b18 Minor fix 2020-01-12 20:25:58 +08:00
Edwin Cheng
4c4416543a Fix formatting 2020-01-12 20:25:58 +08:00
Edwin Cheng
83b2d78bbb Supporting extend selection inside macro calls 2020-01-12 20:25:58 +08:00
bors[bot]
8bb2a50ce6
Merge #2807
2807: Use attr location for builtin derive in goto-implementation r=matklad a=edwin0cheng

This PR is use attribute location for builtin derive in `ImplBlock`'s NavigationTarget such that the goto-implementation will goto to a correct position. 

Related to #2531

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-01-12 11:33:31 +00:00
Edwin Cheng
db5f73d261 Add test 2020-01-12 19:24:34 +08:00
bors[bot]
21be386db8
Merge #2809
2809: Qualify paths in 'fill match arms' assist r=matklad a=flodiebold



Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2020-01-12 11:23:11 +00:00
Florian Diebold
2c11a9b42d Qualify paths in 'fill match arms' assist 2020-01-12 11:34:52 +01:00
Edwin Cheng
d7be1a4372 Use attr location for builtin macro goto-imp 2020-01-12 18:08:53 +08:00
Jeremy Kolb
38c3b02f96 Update crates 2020-01-11 20:16:35 -05:00
bors[bot]
86d2af9f7b
Merge #2803
2803: Fix various names, e.g. Iterator not resolving in core prelude r=matklad a=flodiebold

Basically, `Iterator` is re-exported via several steps, which happened to not be
resolved yet when we got to the prelude import, but since the name resolved to
the reexport from `core::iter` (just to no actual items), we gave up trying to
resolve it further.

Maybe part of the problem is that we can have
`PartialResolvedImport::Unresolved` or `PartialResolvedImport::Indeterminate`
with `None` in all namespaces, and handle them differently.

Fixes #2683.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2020-01-11 23:00:37 +00:00
bors[bot]
bcfd297f49
Merge #2727
2727: Qualify paths in 'add impl members' r=flodiebold a=flodiebold

This makes the 'add impl members' assist qualify paths, so that they should resolve to the same thing as in the definition. To do that, it adds an algorithm that finds a path to refer to any item from any module (if possible), which is actually probably the more important part of this PR 😄 It handles visibility, reexports, renamed crates, prelude etc.; I think the only thing that's missing is support for local items. I'm not sure about the performance, since it takes into account every location where the target item has been `pub use`d, and then recursively goes up the module tree; there's probably potential for optimization by memoizing more, but I think the general shape of the algorithm is necessary to handle every case in Rust's module system.

~The 'find path' part is actually pretty complete, I think; I'm still working on the assist (hence the failing tests).~

Fixes #1943.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
2020-01-11 22:42:39 +00:00
Florian Diebold
9dc1826cfa Fix various names, e.g. Iterator not resolving in core prelude
Basically, `Iterator` is re-exported via several steps, which happened to not be
resolved yet when we got to the prelude import, but since the name resolved to
the reexport from `core::iter` (just to no actual items), we gave up trying to
resolve it further.

Maybe part of the problem is that we can have
`PartialResolvedImport::Unresolved` or `PartialResolvedImport::Indeterminate`
with `None` in all namespaces, and handle them differently.

Fixes #2683.
2020-01-11 23:37:58 +01:00
Florian Diebold
ccb75f7c97 Use FxHashMap 2020-01-11 23:33:04 +01:00
Florian Diebold
4496e2a06a Apply review suggestions 2020-01-11 23:33:04 +01:00
Florian Diebold
15fc643e05 Fix ordering problem between qualifying paths and substituting params 2020-01-11 23:33:04 +01:00
Florian Diebold
12905e5b58 Some more refactoring 2020-01-11 23:33:04 +01:00
Florian Diebold
def124e932 Fix file ID when qualifying paths; add another failing test 2020-01-11 23:33:04 +01:00
Florian Diebold
4545f289a9 Handle type args 2020-01-11 23:33:04 +01:00
Florian Diebold
5cb1f71322 More failing tests 2020-01-11 23:33:04 +01:00
Florian Diebold
4d75430e91 Qualify some paths in 'add missing impl members' 2020-01-11 23:33:04 +01:00
Florian Diebold
460fa71c55 Use self 2020-01-11 23:33:04 +01:00
Florian Diebold
2906d188c2 Cleanup 2020-01-11 23:33:04 +01:00
Florian Diebold
38cd9f0c94 Handle cycles 2020-01-11 23:33:04 +01:00
Florian Diebold
b1325488ec Use query for importable locations 2020-01-11 23:33:04 +01:00
Florian Diebold
947eec7b87 Use super, don't use private imports 2020-01-11 23:33:04 +01:00