Commit Graph

8026 Commits

Author SHA1 Message Date
bors[bot]
7a03f05eac
Merge #5692
5692: Add support for extern crate r=jonas-schievink a=Nashenas88

This adds syntax highlighting, hover and goto def functionality for extern crate.

Fixes #5690 

Co-authored-by: Paul Daniel Faria <Nashenas88@users.noreply.github.com>
2020-08-09 23:16:58 +00:00
Paul Daniel Faria
bf9b4578bb Remove Option<...> from result of Crate::root_module
There doesn't seem to be any need for it, and removing it simplies
several paths of code that depend on it.
2020-08-09 18:52:19 -04:00
bors[bot]
b1cb4ac13d
Merge #5693
5693: Fix no inlay hints / unresolved tokens until manual edit to refresh r=jonas-schievink a=Veetaha

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

Now we return ContentModified during the workspace loading. This signifies the language
client to retry the operation (i.e. the client will
continue polling the server while it returns ContentModified).
I believe that there might be cases of overly big projects where the backoff
logic we have setup in `sendRequestWithRetry` (which we use for inlay hints)
might bail too early (currently the largest retry standby time is 10 seconds).
However, I've tried on one of my project with 500+ dependencies and it is still enough.

Here are the examples before/after the change (the gifs are quite lengthy because they show testing rather large cargo workspace).

<details>
<summary>Before</summary>

Here you can see that the client receives empty array of inlay hints and does nothing more.
Same applies to semantic tokens. The client receives unresolved tokens and does nothing more.
The user needs to do a manual edit to refresh the editor.

![prev-demo](https://user-images.githubusercontent.com/36276403/89717721-e4471280-d9c1-11ea-89ce-7dc3e83d9768.gif)

</details>

<details>
<summary>After</summary>

Here the server returns ContentModified, so the client periodically retries the requests and eventually receives the wellformed response.

![new-demo](https://user-images.githubusercontent.com/36276403/89717725-eb6e2080-d9c1-11ea-84c9-796bb2b22cec.gif)

</details>

Co-authored-by: Veetaha <veetaha2@gmail.com>
2020-08-09 22:39:10 +00:00
Veetaha
dbe7ede2ee Let shutdown request to pass through when status == Loading 2020-08-10 00:49:53 +03:00
bors[bot]
9995e79cce
Merge #5414
5414: Fix test code lens r=jonas-schievink a=avrong

Closes #5217

The implementation is quite similar to #4821. Maybe we should somehow deal with duplicated code.

Also, both of these requests introduce some unclear behavior. I'm not sure how to process this, therefore asking for advice. Examples are below.
<img width="286" alt="image" src="https://user-images.githubusercontent.com/6342851/87713209-83595f80-c7b2-11ea-8c0f-a12e7571e7df.png">

Co-authored-by: Aleksei Trifonov <avrong@avrong.me>
2020-08-09 21:23:20 +00:00
JmPotato
3f2bc813d3 format in to_proto::markup_content
Signed-off-by: JmPotato <ghzpotato@gmail.com>
2020-08-09 21:33:14 +08:00
Veetaha
e43811c164 Fix no inlay hints / unresolved tokens until manual edit
No we return ContentModified during the workspace loading. This signifies the language
client to retry the operation (i.e. the client will
continue polling the server while it returns ContentModified).
I believe that there might be cases of overly big projects where the backoff
logic we have setup in `sendRequestWithRetry` (which we use for inlay hints)
might bail too early (currently the largest retry standby time is 10 seconds).
However, I've tried on one of my project with 500+ dependencies and it is still enough.
2020-08-08 21:53:38 +03:00
Paul Daniel Faria
6cde0b1aa0 Add support for extern crate
This adds syntax highlighting, hover and goto def
functionality for extern crate
2020-08-08 14:14:18 -04:00
bors[bot]
8a57afe5a4
Merge #5684
5684: Semantic highlighting for unsafe union field access r=jonas-schievink a=Nashenas88

This change adds support for unions in inference and lowering, then extends on that to add the unsafe semantic modifier on field access only. The `is_possibly_unsafe` function in `syntax_highlighting.rs` could be extended to support fns and static muts so that their definitions are not highlighted as unsafe, but only their usage.

Also, each commit of this PR updates the tests. By reviewing the files by commit, it's easy to see how the changes in the code affected the tests.

Co-authored-by: Paul Daniel Faria <Nashenas88@users.noreply.github.com>
2020-08-08 16:45:37 +00:00
Paul Daniel Faria
be935b2b56 Apply unsafe semantic highlighting to union field access 2020-08-08 11:29:56 -04:00
Paul Daniel Faria
3bf033e548 Add support for unions in inference and lowering 2020-08-08 11:29:56 -04:00
Paul Daniel Faria
a39d503ef3 Add additional checks for union inference tests 2020-08-08 11:29:50 -04:00
Veetaha
b1ec08e3ff Remove clone 2020-08-08 17:42:50 +03:00
Yusuke Tanaka
cd49e41642
Add test for handle_document_symbol (#5655) 2020-08-08 20:49:09 +09:00
Yusuke Tanaka
b970d675f5
Reverse document symbols for each scope (#5655) 2020-08-08 20:48:45 +09:00
bors[bot]
7a02cc8845
Merge #5679
5679: Account for static mut in missing unsafe diagnostic r=jonas-schievink a=Nashenas88

Accessing or modifying a static mut is an unsafe operation. The "missing unsafe" diagnostic now tracks this.

Co-authored-by: Paul Daniel Faria <Nashenas88@users.noreply.github.com>
2020-08-07 12:26:23 +00:00
bors[bot]
911ef38b24
Merge #5678
5678: Static mut unsafe semantic highlighting r=jonas-schievink a=Nashenas88

This marks static mutable names as unsafe, since accessing or modifying a static mut is an unsafe operation.

Co-authored-by: Paul Daniel Faria <Nashenas88@users.noreply.github.com>
2020-08-07 12:20:13 +00:00
Igor Aleksanov
c51fb7aca5 Fix failing test 2020-08-07 14:35:43 +03:00
Igor Aleksanov
78c1a87797 Add a test for disabled diagnostics 2020-08-07 14:26:36 +03:00
Igor Aleksanov
90857ff8b0 Add an AnalysisConfig structure and use it to configure diagnostics run 2020-08-07 14:25:55 +03:00
bors[bot]
ae1197accd
Merge #5674
5674: Update chalk r=matklad a=kjeremy



Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2020-08-07 10:32:06 +00:00
Igor Aleksanov
c463d217a1 Add names for diagnostics and add a possibility to disable them 2020-08-07 13:18:47 +03:00
Paul Daniel Faria
a6532905a9 Add test for unsafe union field access highlighting 2020-08-06 21:15:31 -04:00
Paul Daniel Faria
f089690a21 Account for static mut in missing unsafe diagnostic 2020-08-06 20:55:29 -04:00
Paul Daniel Faria
8e657f663d Mark static mutable names as unsafe 2020-08-06 20:07:42 -04:00
Paul Daniel Faria
6be528da0d Add test for accessing static mut 2020-08-06 19:58:37 -04:00
Jeremy Kolb
4591bd458d Update chalk 2020-08-05 22:24:23 -04:00
bors[bot]
f1d507270c
Merge #5526
5526: Handle semantic token deltas r=kjeremy a=kjeremy

This basically takes the naive approach where we always compute the tokens but save space sending over the wire which apparently solves some GC problems with vscode.

This is waiting for https://github.com/gluon-lang/lsp-types/pull/174 to be merged. I am also unsure of the best way to stash the tokens into `DocumentData` in a safe manner.

Co-authored-by: kjeremy <kjeremy@gmail.com>
Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2020-08-06 01:44:38 +00:00
Jeremy Kolb
195111d769 Address PR comments 2020-08-05 21:35:35 -04:00
bors[bot]
2cb079ba9a
Merge #5672
5672: align names in make

 r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-08-05 22:29:27 +00:00
bors[bot]
ed4687f698
Merge #5639
5639: SSR: Allow `self` in patterns. r=jonas-schievink a=davidlattimore

It's now consistent with other variables in that if the pattern references self, only the `self` in scope where the rule is invoked will be accepted. Since `self` doesn't work the same as other paths, this is implemented by restricting the search to just the current function. Prior to this change (since path resolution was implemented), having self in a pattern would just result in no matches.

Co-authored-by: David Lattimore <dml@google.com>
2020-08-05 22:07:35 +00:00
David Lattimore
3eea41a68c Use SyntaxNode.ancestors instead of a loop 2020-08-06 07:36:03 +10:00
Aleksey Kladov
09d3b7d7a2 align names in make 2020-08-05 19:37:26 +02:00
bors[bot]
5ebf92cd0e
Merge #5648
5648: Add expand glob import assist r=jonas-schievink a=unexge

closes https://github.com/rust-analyzer/rust-analyzer/issues/5557

Co-authored-by: unexge <unexge@gmail.com>
2020-08-05 17:05:07 +00:00
bors[bot]
32246b91c2
Merge #5664
5664: Fix renamed self module. r=jonas-schievink a=Nashenas88

Fixes #5663 

Now `inner_mod` below is properly marked as a `module`.
```rust
use crate::inner::{self as inner_mod};
mod inner {}
```

Co-authored-by: Paul Daniel Faria <Nashenas88@users.noreply.github.com>
2020-08-05 16:56:39 +00:00
Aleksey Kladov
edd4a83ee3 Use salsa's purge to account for all memory 2020-08-05 15:28:20 +02:00
Aleksey Kladov
ffe4a5e114 Fix relative path handling for custom rustfmt
`current_dir` and relative paths to executables works differently on
unix and windows (unix behavior does not make sense), see:

17e30e83a1/src/lib.rs (L295-L324)

The original motivation to set cwd was to make rustfmt read the
correct rustfmt.toml, but that was future proofing, rather than a bug
fix.

So, let's just remove this and see if breaks or fixes more use-cases.

If support for per-file config is needed, we could use `--config-path`
flag.
2020-08-05 13:20:36 +02:00
unexge
6cb090345e Pattern match on slice elements instead of using .first().unwrap() 2020-08-05 13:25:26 +03:00
unexge
5214b4cdba Look for trait methods in expand glob import assist 2020-08-05 11:29:00 +03:00
Paul Daniel Faria
4e2e3543c7 When resolving a rename, fallback to the name higher in the use tree if the path segment is self 2020-08-04 09:28:40 -04:00
Paul Daniel Faria
cc3eb85311 Add test showing unresolved module rename 2020-08-04 09:26:38 -04:00
bors[bot]
af6e9a7eb3
Merge #5658
5658: do not add to `pub use` in assists that insert a use statement r=jonas-schievink a=jbr

closes #5657 , see issue for rationale

Initially I wrote a version of this that changed the signature of `insert_use_statement` to take an `Option<VisibilityKind>` and only add to use statements with the same visibility, but that didn't make sense for any of the current uses of `insert_use_statement` (they all expected private visibility).

Co-authored-by: Jacob Rothstein <hi@jbr.me>
2020-08-04 12:47:11 +00:00
Michael Lazear
2e72e74dbd Revert "Restore line index micro-optimization"
This reverts commit 83a87fcd11.
2020-08-03 13:35:32 -07:00
Jacob Rothstein
03a61134f2
do not add to pub use statements 2020-08-03 12:17:05 -07:00
bors[bot]
33e53d4721
Merge #5653
5653: Fold trait declarations r=SomeoneToIgnore a=lnicola

Fixes #5652

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-08-03 17:25:26 +00:00
Laurențiu Nicola
f1bbc776c0 Fold trait declarations 2020-08-03 15:45:39 +03:00
bors[bot]
f17d2d1289
Merge #5628
5628: Rename test modules r=matklad a=lnicola



Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-08-03 11:47:56 +00:00
unexge
bdb97756ca Simplify find_mod_path with use of node.ancestors 2020-08-03 13:04:20 +03:00
unexge
544322e66a Generate doctest 2020-08-02 23:07:56 +03:00
unexge
a05a2ab1bb Rename ast::UseItem to ast::Use 2020-08-02 23:07:36 +03:00
unexge
edd79a6b1c Add expand glob import assist 2020-08-02 22:56:54 +03:00
Aleksei Trifonov
85d5ed3675 Fix test code lens 2020-08-02 13:53:34 +03:00
bors[bot]
e4d0f19b01
Merge #5638
5638: Simplify argument parsing r=matklad a=lnicola

and use `Display` when printing errors.

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-08-01 16:47:51 +00:00
Laurențiu Nicola
562491b16b Simplify argument parsing 2020-08-01 19:31:14 +03:00
Aleksey Kladov
bff8dd0949 Update grammar 2020-08-01 13:47:19 +02:00
David Lattimore
6bbeffc8c5 SSR: Allow self in patterns.
It's now consistent with other variables in that if the pattern
references self, only the `self` in scope where the rule is invoked will
be accepted. Since `self` doesn't work the same as other paths, this is
implemented by restricting the search to just the current function.
Prior to this change (since path resolution was implemented), having
self in a pattern would just result in no matches.
2020-08-01 17:41:42 +10:00
David Lattimore
21d2cebcf1 SSR: Matching trait associated constants, types and functions
This fixes matching of things like `HashMap::default()` by resolving
`HashMap` instead of `default` (which resolves to `Default::default`).

Same for associated constants and types that are part of a trait
implementation.

However, we still don't support matching calls to trait methods.
2020-08-01 12:55:26 +10:00
kjeremy
fcfd7cb1e3 Handle semantic token deltas 2020-07-31 20:57:53 -04:00
Aleksey Kladov
8cf19847dd Finish rename 2020-07-31 22:04:12 +02:00
Aleksey Kladov
b9c6aa9ec9 Unify naming of tuple fields 2020-07-31 22:04:12 +02:00
Aleksey Kladov
22d295ceaa Rename DotDotPat -> RestPat 2020-07-31 21:45:29 +02:00
Aleksey Kladov
af53d5f4b0 Rename 2020-07-31 20:23:52 +02:00
Aleksey Kladov
81359af733 Simplify trait gramamr 2020-07-31 20:22:20 +02:00
Aleksey Kladov
9818108798 Rename BindPat -> IdentPat 2020-07-31 20:12:10 +02:00
Aleksey Kladov
6791eb9685 Rename PalceholderPat -> WildcardPat 2020-07-31 20:07:21 +02:00
Aleksey Kladov
d7f75db90d Reorder 2020-07-31 20:04:40 +02:00
Aleksey Kladov
14cb96ec0e Allign RecordPat with RecordExpr 2020-07-31 20:00:48 +02:00
Aleksey Kladov
572f1c08b6 Minor gramamr reorder 2020-07-31 19:49:26 +02:00
bors[bot]
5cade89d73
Merge #5630
5630: Remove dead code r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-07-31 16:56:57 +00:00
Aleksey Kladov
45e6052406 Remove dead code 2020-07-31 18:53:10 +02:00
Aleksey Kladov
c1c97b2896 Fix leading colon 2020-07-31 18:49:42 +02:00
Aleksey Kladov
ddf08daddf Fix const arguments grammar 2020-07-31 18:46:07 +02:00
Aleksey Kladov
040b4c800d Fix GenericArgs grammar 2020-07-31 18:41:37 +02:00
Laurențiu Nicola
e5d7b003af Rename test modules 2020-07-31 19:30:37 +03:00
Aleksey Kladov
91781c7ce8 Rename TypeArgList -> GenericArgList 2020-07-31 18:29:29 +02:00
Aleksey Kladov
54fd09a9ca Finalize Path grammar 2020-07-31 18:27:23 +02:00
Aleksey Kladov
7980a7e19a Minor 2020-07-31 18:10:46 +02:00
Aleksey Kladov
633aace411 Rename LambdaExpr -> ClosureExpr 2020-07-31 17:08:58 +02:00
Aleksey Kladov
bfcee63e75 Work on expressions grammar 2020-07-31 16:52:08 +02:00
Aleksey Kladov
d4d986c7f8 Item is a Stmt 2020-07-31 15:51:01 +02:00
Aleksey Kladov
a7ca6583fb Handwrite Stmt 2020-07-31 15:40:48 +02:00
Aleksey Kladov
4d38b0dce1 Move Stmt Grammar 2020-07-31 15:27:40 +02:00
Aleksey Kladov
b250ae6c55 Finalize TypeBound grammar 2020-07-31 15:01:18 +02:00
Aleksey Kladov
a6527ed92c "Finalize" Types grammar
Note that `for` type is rust-analyzer's own invention.
Both the reference and syn allow `for` only for fnptr types, and we
allow them everywhere. This needs to be checked with respect to type
bounds grammar...
2020-07-31 14:40:28 +02:00
Aleksey Kladov
a6e45c6c69 Reame PlaceholderType -> InferType 2020-07-31 14:12:51 +02:00
Aleksey Kladov
08ea2271e8 Rename TypeRef -> Type
The TypeRef name comes from IntelliJ days, where you often have both
type *syntax* as well as *semantical* representation of types in
scope. And naming both Type is confusing.

In rust-analyzer however, we use ast types as `ast::Type`, and have
many more semantic counterparts to ast types, so avoiding name clash
here is just confusing.
2020-07-31 12:14:37 +02:00
bors[bot]
6b7cb8b5ab
Merge #5596
5596: Add checkOnSave.noDefaultFeatures and correct, how we handle some cargo flags. r=clemenswasser a=clemenswasser

This PR adds the `rust-analyzer.checkOnSave.noDefaultFeatures` option
and fixes the handling of `cargo.allFeatures`, `cargo.noDefaultFeatures` and `cargo.features`.
Fixes: #5550 

Co-authored-by: Clemens Wasser <clemens.wasser@gmail.com>
2020-07-30 21:23:41 +00:00
bors[bot]
7d18109af4
Merge #5615
5615: simplify r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-07-30 20:58:20 +00:00
Aleksey Kladov
848f446a5a simplify 2020-07-30 22:56:43 +02:00
bors[bot]
43d8142214
Merge #5614
5614: Use split_once polyfill r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-07-30 20:38:58 +00:00
Aleksey Kladov
cd9f863b01 Use CmdArgs pattern for bench & analysis stats 2020-07-30 22:38:24 +02:00
Aleksey Kladov
be49547b44 Use split_once polyfill 2020-07-30 22:23:12 +02:00
bors[bot]
08d18e0edd
Merge #5610
5610: Bump deps r=flodiebold a=lnicola



Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-07-30 20:10:07 +00:00
Laurențiu Nicola
797cdb00d9 Bump chalk 2020-07-30 23:09:07 +03:00
Aleksey Kladov
f95f425ae4 Use ty to access most TypeRefs 2020-07-30 21:02:55 +02:00
Aleksey Kladov
2e2642efcc Remove TypeAscriptionOwner 2020-07-30 20:51:43 +02:00
Aleksey Kladov
fbe60a2e28 simplify 2020-07-30 20:38:15 +02:00
Aleksey Kladov
fcce07d2d1 Finalize attribute grammar 2020-07-30 20:21:32 +02:00
Laurențiu Nicola
fa64817eab Bump perf-event and rustc_lexer 2020-07-30 20:36:03 +03:00
Laurențiu Nicola
a94c564ad0 Fix typo 2020-07-30 20:19:37 +03:00
bors[bot]
e28ea81b2b
Merge #5609
5609: Attrs & Vis r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-07-30 17:11:26 +00:00
Aleksey Kladov
01d6c3836b Dead code 2020-07-30 19:10:46 +02:00
bors[bot]
bc8610e2b5
Merge #5608
5608: Introduce GenericParam r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-07-30 16:52:59 +00:00
Aleksey Kladov
3dce34aaf8 Introduce GenericParam 2020-07-30 18:52:02 +02:00
bors[bot]
af8132e610
Merge #5607
5607: Finaize item grammar r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-07-30 16:39:40 +00:00
Aleksey Kladov
917c89c103 Finaize item grammar 2020-07-30 18:37:46 +02:00
bors[bot]
0f5805541b
Merge #5606
5606: Finalize impl Grammar r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-07-30 16:29:24 +00:00
Aleksey Kladov
c5798c4d75 Finalize impl Grammar 2020-07-30 18:28:28 +02:00
Aleksey Kladov
c83467796b Finalize Trait grammar 2020-07-30 18:17:28 +02:00
bors[bot]
c8e2d67dd4
Merge #5594 #5604 #5605
5594: Update sysroot crates r=jonas-schievink a=lnicola



5604: Rename EnumVariant -> Variant r=matklad a=matklad



bors r+
🤖

5605: fmt r=matklad a=matklad



bors r+
🤖

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-07-30 16:13:58 +00:00
Aleksey Kladov
ba71f05438 fmt 2020-07-30 18:10:07 +02:00
Aleksey Kladov
3cd4112bdc Finalize const&static grammar 2020-07-30 18:02:20 +02:00
Aleksey Kladov
1766aae145 Rename EnumVariant -> Variant 2020-07-30 17:56:53 +02:00
Aleksey Kladov
609680ef97 Rename EnumDef -> Enum 2020-07-30 17:52:53 +02:00
Aleksey Kladov
216a5344c8 Rename StructDef -> Struct 2020-07-30 17:50:40 +02:00
Aleksey Kladov
1ae4721c9c Finalize union grammar 2020-07-30 17:38:52 +02:00
Aleksey Kladov
8ddbf06e39 Finalize structs grammar 2020-07-30 17:24:07 +02:00
bors[bot]
a257fd06b3
Merge #5597
5597: Rename FieldDef -> Field r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-07-30 14:49:39 +00:00
Aleksey Kladov
0a9e3ccc26 Rename FieldDef -> Field 2020-07-30 16:49:13 +02:00
Clemens Wasser
2e562c158f ra_project_model: Fix configuration of features
This commit fixes the handling of user-defined configuration
of some cargo options. Previously you could either specify
`--all-features`, `--no-default-features` or `--features`.
Now you can specify either `--all-features` or `--no-default-features`
and `--features`. This commit also corrects the `--features`
command-line argument creation inside of `load_extern_resources`.
2020-07-30 16:28:29 +02:00
bors[bot]
282702c287
Merge #5595
5595: Rename RecordLit -> RecordExpr r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-07-30 14:24:20 +00:00
Aleksey Kladov
6f8aa75329 Rename RecordLit -> RecordExpr 2020-07-30 16:21:30 +02:00
Laurențiu Nicola
afd02461bc Update sysroot crates 2020-07-30 17:17:59 +03:00
Clemens Wasser
8d9f8ac273 flycheck: Added checkOnSave.noDefaultFeatures
This commit adds the option
`rust-analyzer.checkOnSave.noDefaultFeatures`
and fixes #5550.
2020-07-30 16:04:01 +02:00
bors[bot]
323fd64abd
Merge #5593
5593: Code shuffle resiliently r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-07-30 13:49:02 +00:00
Aleksey Kladov
d061ab6c8e Code shuffle resiliently 2020-07-30 15:48:35 +02:00
bors[bot]
97fb5daf72
Merge #5592
5592: Rename TypeParamList -> GenericParamList r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-07-30 13:39:55 +00:00
Aleksey Kladov
28ef4c375a Rename TypeParamList -> GenericParamList 2020-07-30 15:36:21 +02:00
bors[bot]
ee00679331
Merge #5591
5591: Rename TypeAliasDef -> TypeAlias r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-07-30 13:26:15 +00:00
Aleksey Kladov
eb2f806344 Rename TypeAliasDef -> TypeAlias 2020-07-30 15:25:46 +02:00
Aleksey Kladov
1142112c70 Rename FnDef -> Fn 2020-07-30 15:16:05 +02:00
bors[bot]
96c3ff1c57
Merge #5588
5588: Print errors when failing to create a perf counter r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-07-30 12:34:38 +00:00
Aleksey Kladov
3e1e6227ca Print errors when failing to create a perf counter 2020-07-30 14:34:11 +02:00
bors[bot]
5844dd0bb4
Merge #5586
5586: Add workaround for changing sysroot paths r=jonas-schievink a=lnicola

Fixes #5577

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-07-30 12:26:04 +00:00
Aleksey Kladov
b6b77d1396 Update tests 2020-07-30 14:20:33 +02:00
Aleksey Kladov
b1332670c7 Rename UseItem -> Use 2020-07-30 14:20:33 +02:00
Aleksey Kladov
e381c02ef3 Add comma list to use tree 2020-07-30 14:20:33 +02:00
bors[bot]
51b18ee2f1
Merge #5587
5587: Finish use grammar r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-07-30 12:18:41 +00:00
Aleksey Kladov
02cac962e1 Update tests 2020-07-30 14:18:12 +02:00
Aleksey Kladov
9697d23cbe Rename UseItem -> Use 2020-07-30 14:12:04 +02:00
Aleksey Kladov
35e7966ebe Add comma list to use tree 2020-07-30 14:06:39 +02:00
Laurențiu Nicola
a538e0fbe8 Add workaround for changing sysroot paths 2020-07-30 15:04:41 +03:00
bors[bot]
9042009b7f
Merge #5567
5567: SSR: Wrap placeholder expansions in parenthesis when necessary r=matklad a=davidlattimore

e.g. `foo($a) ==> $a.to_string()` should produce `(1 + 2).to_string()` not `1 + 2.to_string()`

We don't yet try to determine if the whole replacement needs to be wrapped in parenthesis. That's harder and I think perhaps less often an issue.

Co-authored-by: David Lattimore <dml@google.com>
2020-07-30 11:36:50 +00:00
Aleksey Kladov
96313283cd Update tests 2020-07-30 12:33:05 +02:00
David Lattimore
fa1e411322 SSR: Wrap placeholder expansions in parenthesis when necessary
e.g. `foo($a) ==> $a.to_string()` should produce `(1 + 2).to_string()`
not `1 + 2.to_string()`

We don't yet try to determine if the whole replacement needs to be
wrapped in parenthesis. That's harder and I think perhaps less often an
issue.
2020-07-30 20:32:01 +10:00
Aleksey Kladov
d032f872b6 Finish extern crates grammar 2020-07-30 12:31:07 +02:00
bors[bot]
570fdf26c9
Merge #5584
5584: Rename metric r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-07-30 10:12:58 +00:00
Aleksey Kladov
5cb3d527b0 Rename metric 2020-07-30 12:04:01 +02:00
Aleksey Kladov
026e4e6af1 Update tests 2020-07-30 12:01:14 +02:00
Aleksey Kladov
6cd2131caf Rename Rename 2020-07-30 11:58:41 +02:00
Aleksey Kladov
7d09e5ed61 Finish Module grammar 2020-07-30 11:50:56 +02:00
Aleksey Kladov
081f35fe1b Update tests 2020-07-30 11:50:56 +02:00
Aleksey Kladov
2984da672e Split ItemList & AssocItemList 2020-07-30 11:50:56 +02:00
Aleksey Kladov
f22af66c37 Fixes 2020-07-30 10:43:47 +02:00
Aleksey Kladov
5e498546e8 Fix non-linux compilation 2020-07-30 10:40:55 +02:00
Aleksey Kladov
e9983f98a9 Do not show progress with parallel analysis 2020-07-30 10:30:01 +02:00
Aleksey Kladov
7204374719 Report instructions in addition to time
They hopefully will be more stable on CI
2020-07-30 10:23:32 +02:00
Aleksey Kladov
4bab553029 fix cast 2020-07-30 10:14:35 +02:00
Aleksey Kladov
afab67e69c Allow negative bytes
Gotta be optimistic about those memory usage optimizations
2020-07-30 09:57:36 +02:00
Aleksey Kladov
dae99b6661 Drop resident from memory usage 2020-07-30 09:45:20 +02:00
bors[bot]
9da454bcc2
Merge #5578
5578: Rename ModuleItem -> Item r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-07-29 22:48:04 +00:00
Aleksey Kladov
ede5d17b04 Finish SourceFile grammar 2020-07-30 00:46:39 +02:00
Aleksey Kladov
6636f56e79 Rename ModuleItem -> Item 2020-07-30 00:23:03 +02:00
bors[bot]
4567ae575e
Merge #5554
5554: Fix remove_dbg r=matklad a=petr-tik

Closes #5129 

Addresses two issues:
- keep the parens from dbg!() in case the call is chained or there is
semantic difference if parens are excluded
- Exclude the semicolon after the dbg!(); by checking if it was
accidentally included in the macro_call

investigated, but decided against:
fix ast::MacroCall extraction to never include semicolons at the end -
this logic lives in rowan.

Defensively shorten the macro_range if there is a semicolon token.
Deleted unneccessary temp variable macro_args

Renamed macro_content to "paste_instead_of_dbg", because it isn't a
simple extraction of text inside dbg!() anymore

Co-authored-by: petr-tik <petr-tik@users.noreply.github.com>
2020-07-29 21:59:03 +00:00
bors[bot]
bd5d236724
Merge #5563
5563: Check all targets for package-level tasks r=matklad a=SomeoneToIgnore

When invoking "Select Runnable" with the caret on a runnable with a specific target (test, bench, binary), append the corresponding argument for the `cargo check -p` module runnable.

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2020-07-29 21:51:49 +00:00
petr-tik
6ea393a8d1 Addressed code review
replaced match with let-if variable assignment
removed the unnecessary semicolon_on_end variable
converted all code and expected test variables to raw strings
and inlined them in asserts
2020-07-29 22:12:53 +01:00
kjeremy
e51d1ddf5b cargo_metadata 0.11.1 and cargo update 2020-07-29 17:06:56 -04:00
Aleksey Kladov
63de7bbb5b
Update crates/rust-analyzer/src/cli/analysis_stats.rs
Co-authored-by: Laurențiu Nicola <lnicola@users.noreply.github.com>
2020-07-29 19:56:54 +02:00
Aleksey Kladov
ba585309ec Replace rand with oorandom 2020-07-29 19:49:10 +02:00
Aleksey Kladov
76202a2c73 Rename NomialDef -> AdtDef 2020-07-29 19:22:15 +02:00
Aleksey Kladov
3d28292157 Switch to ungrammar from ast_src
The primary advantage of ungrammar is that it (eventually) allows one
to describe concrete syntax tree structure -- with alternatives and
specific sequence of tokens & nodes.

That should be re-usable for:

* generate `make` calls
* Rust reference
* Hypothetical parser's evented API

We loose doc comments for the time being unfortunately. I don't think
we should add support for doc comments to ungrammar -- they'll make
grammar file hard to read. We might supply docs as out-of band info,
or maybe just via a reference, but we'll think about that once things
are no longer in flux
2020-07-29 19:18:25 +02:00
Aleksey Kladov
0d1357be05 Dead code 2020-07-29 17:35:12 +02:00
Aleksey Kladov
9fb1624c5e Remove dead code 2020-07-29 15:46:47 +02:00
Aleksey Kladov
dc18ff51c3 Remove dead code 2020-07-29 15:12:19 +02:00
Kirill Bulatov
85d71f4dff Run package-specific cargo check and test for all targets 2020-07-29 15:35:27 +03:00
bors[bot]
9a9ddcc297
Merge #5564
5564: SSR: Restrict to current selection if any r=davidlattimore a=davidlattimore

The selection is also used to avoid unnecessary work, but only to the file level. Further restricting unnecessary work is left for later.

Co-authored-by: David Lattimore <dml@google.com>
2020-07-29 09:23:33 +00:00
David Lattimore
fcb6b166fb SSR: Rename position and lookup_context to resolve_context 2020-07-29 19:20:40 +10:00
bors[bot]
04d2b7b256
Merge #5565
5565: SSR: Don't mix non-path-based rules with path-based r=matklad a=davidlattimore

If any rules contain paths, then we reject any rules that don't contain paths. Allowing a mix leads to strange semantics, since the path-based rules only match things where the path refers to semantically the same thing, whereas the non-path-based rules could match anything. Specifically, if we have a rule like `foo ==>> bar` we only want to match the `foo` that is in the current scope, not any `foo`. However "foo" can be parsed as a pattern (BIND_PAT -> NAME -> IDENT). Allowing such a rule through would result in renaming everything called `foo` to `bar`. It'd also be slow, since without a path, we'd have to use the slow-scan search mechanism.

Co-authored-by: David Lattimore <dml@google.com>
2020-07-29 08:55:34 +00:00
David Lattimore
3600c43f49 SSR: Don't mix non-path-based rules with path-based
If any rules contain paths, then we reject any rules that don't contain paths. Allowing a mix leads to strange semantics, since the path-based rules only match things where the path refers to semantically the same thing, whereas the non-path-based rules could match anything. Specifically, if we have a rule like `foo ==>> bar` we only want to match the `foo` that is in the current scope, not any `foo`. However "foo" can be parsed as a pattern (BIND_PAT -> NAME -> IDENT). Allowing such a rule through would result in renaming everything called `foo` to `bar`. It'd also be slow, since without a path, we'd have to use the slow-scan search mechanism.
2020-07-29 16:01:00 +10:00
David Lattimore
cf55806257 SSR: Restrict to current selection if any
The selection is also used to avoid unnecessary work, but only to the
file level. Further restricting unnecessary work is left for later.
2020-07-29 15:06:58 +10:00
Kirill Bulatov
bb1ae85ed0 Allow running more tests at once 2020-07-29 01:03:19 +03:00
Aleksey Kladov
b10e437039 Fix nameref parsing 2020-07-28 20:59:48 +02:00
Aleksey Kladov
97d309ea4b Bump test timeout for macs 2020-07-28 10:31:08 +02:00
petr-tik
6ea28c3779 Fixed #5129
Addresses two issues:
- keep the parens from dbg!() in case the call is chained or there is
semantic difference if parens are excluded
- Exclude the semicolon after the dbg!(); by checking if it was
accidentally included in the macro_call

investigated, but decided against:
fix ast::MacroCall extraction to never include semicolons at the end -
this logic lives in rowan.

Defensively shorten the macro_range if there is a semicolon token.
Deleted unneccessary temp variable macro_args

Renamed macro_content to "paste_instead_of_dbg", because it isn't a
simple extraction of text inside dbg!() anymore
2020-07-27 22:17:15 +01:00
petr-tik
01bdeaad71 Make all test fn names consistent in remove_dbg 2020-07-27 21:28:41 +01:00
petr-tik
63751d1c6b Added failing tests 2020-07-27 21:28:07 +01:00
bors[bot]
020a40335b
Merge #5547
5547: Fold multiline fn parameters r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-07-27 11:48:10 +00:00
Aleksey Kladov
aa09aa36e2 Fold multiline fn parameters 2020-07-27 13:42:36 +02:00
bors[bot]
bc9fab1565
Merge #5532
5532: Restore line index optimization for edits r=matklad a=lnicola



Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-07-27 09:49:45 +00:00
bors[bot]
91b2f0baaf
Merge #5539
5539: SSR: Fix path resolution of locals in current scope r=matklad a=davidlattimore



Co-authored-by: David Lattimore <dml@google.com>
2020-07-27 08:06:18 +00:00
Emil Gardström
2b8dcc15ac add completion for rustc lints 2020-07-27 02:23:21 +02:00
David Lattimore
b3ca36b2d9 SSR: Fix for path resolution of locals
It seems that Semantics::scope, if given a statement node, won't resolve
locals that were defined in the current scope, only in parent scopes.
Not sure if this is intended / expected behavior, but we work around it
for now by finding another nearby node to use as the scope (e.g. the
expression inside the EXPR_STMT).
2020-07-26 21:58:35 +10:00
David Lattimore
bb587fae1d SSR: Move more resolution-related code into the resolving module 2020-07-26 21:58:35 +10:00
Aleksey Kladov
524c2e9a7c Report type errors in metrics 2020-07-26 12:43:53 +02:00
Aleksey Kladov
da65cff18b Add one more test 2020-07-26 11:05:28 +02:00
Laurențiu Nicola
83a87fcd11 Restore line index micro-optimization 2020-07-25 12:56:39 +03:00
Aleksey Kladov
451edcc098 Add rustc-perf to metrics 2020-07-25 10:35:45 +02:00
bors[bot]
a09a00a560
Merge #5520
5520: Add DocumentData to represent in-memory document with LSP info r=matklad a=kjeremy

At the moment this only holds document version information but in the near-future it will hold other things like semantic token delta info.

Co-authored-by: kjeremy <kjeremy@gmail.com>
2020-07-24 20:31:44 +00:00
bors[bot]
d7f1a53c6c
Merge #5524
5524: Allow opting out of experimental diagnostics like MismatchedArgCount r=matklad a=jonas-schievink

Closes https://github.com/rust-analyzer/rust-analyzer/issues/5448
Closes https://github.com/rust-analyzer/rust-analyzer/issues/5419

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2020-07-24 20:18:01 +00:00
Jonas Schievink
92a4ec80a0 Only display experimental diagnostics when enabled 2020-07-24 17:39:44 +02:00