Commit graph

7860 commits

Author SHA1 Message Date
Adam Bratschi-Kaye
28367f7e4f
rewording and typo fix
Co-Authored-By: Laurențiu Nicola <lnicola@users.noreply.github.com>
2020-02-22 18:07:43 +01:00
adamrk
8ebd50fb99 add ssr doc 2020-02-22 17:19:24 +01:00
bors[bot]
2cbe8a4c4b
Merge #3263
3263: Implement unsizing coercions using Chalk r=matklad a=flodiebold

These are coercions like `&[T; n] -> &[T]`, which are handled by the `Unsize` and `CoerceUnsized` traits. The impls for `Unsize` are all built in to the compiler and require special handling, so we need to provide them to Chalk.

This adds the following `Unsize` impls:
 - `Unsize<[T]> for [T; _]`
 - `Unsize<dyn Trait> for T where T: Trait`
 - `Unsize<dyn SuperTrait> for dyn SubTrait`

Hence we are still missing the 'unsizing the last field of a generic struct' case.

Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2020-02-22 12:31:30 +00:00
bors[bot]
7836720f2e
Merge #3271
3271: Fix dat comment r=matklad a=Veetaha



Co-authored-by: Veetaha <veetaha2@gmail.com>
2020-02-22 12:24:58 +00:00
Veetaha
59dc797eb3
Fix dat comment 2020-02-22 14:16:13 +02:00
Florian Diebold
5a6e770f99 Shorten some code 2020-02-22 13:15:54 +01:00
Florian Diebold
3e106c77ff Rework find_super_trait_path to protect against cycles 2020-02-22 13:14:39 +01:00
bors[bot]
70ad904012
Merge #3205
3205: vscode: migrate to tripple equals r=matklad a=Veetaha



Co-authored-by: Veetaha <gerzoh1@gmail.com>
2020-02-22 12:01:27 +00:00
bors[bot]
9999660c90
Merge #3269
3269: Add inlay hints documentation r=flodiebold a=SomeoneToIgnore

Closes https://github.com/rust-analyzer/rust-analyzer/issues/3267

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2020-02-22 11:50:36 +00:00
Veetaha
d905abfb11 vscode: migrate to tripple equals 2020-02-22 13:46:11 +02:00
Kirill Bulatov
818a4ea272
Fix a typo 2020-02-22 14:35:48 +03:00
bors[bot]
f9acb4333f
Merge #3260
3260: Refactor how builtins are resolved r=matklad a=flodiebold

This fixes autocompletion suggesting e.g. `self::usize`. (I thought we had a bug for that, but I didn't find it.)

Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
2020-02-22 11:25:09 +00:00
bors[bot]
62ddf617e2
Merge #3230
3230: ra_mbe: convert_literal now works with malformed tokens r=edwin0cheng a=Veetaha

Fixes: #3226

Co-authored-by: Veetaha <gerzoh1@gmail.com>
Co-authored-by: Veetaha <veetaha2@gmail.com>
2020-02-22 11:17:23 +00:00
Veetaha
5f15e3aeb0
ra_mbe: Remove explicit type annotation 2020-02-22 13:14:46 +02:00
Veetaha
28bdb65407 ra_mbe: added test for malformed token in macro invokation
There was a panic where lexer returned None on malformed tokens.
But now we just ignore tokenization errors in mbe.
2020-02-22 13:10:54 +02:00
Veetaha
93a19bda17 ra_mbe: convert_literal now works with malformed tokens 2020-02-22 13:10:54 +02:00
Kirill Bulatov
6f8d70363d
One more tiny doc fix 2020-02-22 13:52:49 +03:00
Kirill Bulatov
68c34d1f63
Code review fixes
Co-Authored-By: Florian Diebold <flodiebold@googlemail.com>
Co-Authored-By: Laurențiu Nicola <lnicola@users.noreply.github.com>
2020-02-22 12:51:08 +02:00
Florian Diebold
c200025794 Fix shift_bound_vars
It should only shift free vars (maybe the name isn't the best...)
2020-02-22 11:09:21 +01:00
Florian Diebold
463df6720c Fix wrong handling of bare dyn Trait exposed by canonicalizer fix
The self type in the `dyn Trait` trait ref should always be ^0, but we didn't
put that in there in the bare case.
2020-02-22 11:09:21 +01:00
Florian Diebold
2d5ab63247 Add &dyn Trait -> &dyn SuperTrait coercion, and fix &T -> &dyn Trait 2020-02-22 11:09:21 +01:00
Florian Diebold
f126808b2e Fix handling of binders in canonicalization
I'm looking forward to getting rid of this in favor of Chalk's implementation.
2020-02-22 11:09:21 +01:00
Florian Diebold
0dfbbaf03b Implement dyn Trait unsizing as well 2020-02-22 11:09:21 +01:00
Florian Diebold
de39d221a1 Implement unsize coercion using proper trait solving 2020-02-22 11:09:21 +01:00
Kirill Bulatov
64051ac5c7 Add inlay hints documentation 2020-02-22 10:23:03 +03:00
bors[bot]
baf832d6d9
Merge #3262
3262: Fix handling of const patterns r=matklad a=flodiebold

E.g. in `match x { None => ... }`, `None` is a path pattern (resolving to the
option variant), not a binding. To determine this, we need to try to resolve the
name during lowering. This isn't too hard since we already need to resolve names
for macro expansion anyway (though maybe a bit hacky).

Fixes #1618.

Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
2020-02-22 00:27:09 +00:00
bors[bot]
d8b0943535
Merge #3244
3244: Rename module references r=matklad a=adamrk

Rename references to a module when the module is renamed. This fixes some missing renames in the existing implementation. For example, renaming the module `foo` to `foo2` in this case:
```rust
mod foo {
    pub fn bar() {}
}

fn main() {
    foo::bar()
}
```
previously would not change the call `foo::bar()` to `foo2::bar()`, but now it will. 

Co-authored-by: adamrk <ark.email@gmail.com>
Co-authored-by: Adam Bratschi-Kaye <ark.email@gmail.com>
2020-02-22 00:19:28 +00:00
adamrk
fe8ce4c41d remove unneeded collect 2020-02-21 23:51:30 +01:00
Adam Bratschi-Kaye
7be1044104 use Vec::extend instead of Vec::push in loop
Co-Authored-By: Laurențiu Nicola <lnicola@users.noreply.github.com>
2020-02-21 23:51:30 +01:00
adamrk
8b3f449b5f rename module references 2020-02-21 23:51:30 +01:00
bors[bot]
f3ab290bd4
Merge #3264
3264: Tidy up documentation. r=flodiebold a=ablakey

Thought I'd tidy up the docs while reading through them. Hope you don't mind!

For the most part, I just made the formatting consistent through-out and added a few words here and there. Also updated the language server install graphic.

Co-authored-by: Andrew Blakey <ablakey@locusrobotics.com>
2020-02-21 20:26:25 +00:00
Andrew Blakey
cda6d2b25c update image 2020-02-21 14:55:15 -05:00
Andrew Blakey
1be166f0fb update docs 2020-02-21 14:53:30 -05:00
Florian Diebold
f1f45f9191 Fix handling of const patterns
E.g. in `match x { None => ... }`, `None` is a path pattern (resolving to the
option variant), not a binding. To determine this, we need to try to resolve the
name during lowering. This isn't too hard since we already need to resolve names
for macro expansion anyway (though maybe a bit hacky).

Fixes #1618.
2020-02-21 17:01:19 +01:00
Florian Diebold
31af774254 Refactor how builtins are resolved
This fixes autocompletion suggesting e.g. self::usize.
2020-02-21 15:39:51 +01:00
bors[bot]
e3037c2631
Merge #3259
3259: Normalize associated types in types coming from Chalk r=matklad a=flodiebold

Fixes #3232.

Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
2020-02-21 13:22:06 +00:00
Florian Diebold
e50201345e Normalize associated types in types coming from Chalk
Fixes #3232.
2020-02-21 14:06:19 +01:00
bors[bot]
db1bbb11fb
Merge #3247
3247: Improve RA version display r=matklad a=edwin0cheng

There are 2 problems of current implementation for displaying current version of RA binary:

1. If that binary is coming from built by source, the `REV` may not be updated somehow. (See discussion in [Zuilp](https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/vscode.20version.20in.20console))

2. We must go through the VSCode debugger console to see the output of `console.log`.

This PR implemented a new VSCode command "Show RA Version" to display the version, which  fixed the first problem.  And added some `rerun-if` flags in `build.rs` to fix the second one.

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-02-21 10:34:58 +00:00
Edwin Cheng
319a09847b Use stdout directly 2020-02-21 18:33:45 +08:00
Edwin Cheng
489be40d3a Use ensureServerBinary instead 2020-02-21 18:33:45 +08:00
Edwin Cheng
e7a0d8f8d0 Add trailing newline 2020-02-21 18:33:45 +08:00
Edwin Cheng
d70ddec746 Remove unused placeholder 2020-02-21 18:33:45 +08:00
Edwin Cheng
b21ead6ede Add document for Show RA Version 2020-02-21 18:33:45 +08:00
Edwin Cheng
4e48a73f9c Improve server version info 2020-02-21 18:33:45 +08:00
bors[bot]
88014fcec0
Merge #3258
3258: enforce camel case r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-02-21 10:23:10 +00:00
Aleksey Kladov
28bf731751 enforce camel case 2020-02-21 11:22:45 +01:00
bors[bot]
04dacb9943
Merge #3252
3252: Improve integration with token color configuration r=matklad a=eaglgenes101

First, the extension now checks theme token color customizations as well as global token color customizations when determining what colors to highlight syntax with. Theme token color customizations take precedence over both global token color customizations and the theme token colors. 

Second, a few additional token color customization keys used by other themes are added. The original paths still take precedence, but now turning on rust analyzer syntax highlighting should now not unexpectedly homogenize token colors when custom themes are used. 

Co-authored-by: eaglgenes101 <eaglgenes101@gmail.com>
2020-02-20 17:50:39 +00:00
eaglgenes101
bf99a6eb08 Merge branch 'master' of https://github.com/rust-analyzer/rust-analyzer 2020-02-20 12:46:50 -05:00
bors[bot]
f761ed2abb
Merge #3251
3251: Better errorse r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-02-20 17:41:41 +00:00
Aleksey Kladov
7f4b205b72 Better errorse 2020-02-20 18:41:12 +01:00