Commit Graph

5986 Commits

Author SHA1 Message Date
bors[bot]
0ad6b6d407
Merge #4061
4061: ra_proc_macro: cleanups here and there r=edwin0cheng a=Veetaha

r? @edwin0cheng 

Co-authored-by: veetaha <veetaha2@gmail.com>
Co-authored-by: Veetaha <veetaha2@gmail.com>
2020-04-20 20:25:33 +00:00
veetaha
fc460b1e42 Migrate to Result<T, io::Error> -> io::Result<T> 2020-04-20 22:42:36 +03:00
veetaha
d8ca817456 Fix doc comment 2020-04-20 22:24:10 +03:00
Veetaha
834960d841
Fix typo
Co-Authored-By: Laurențiu Nicola <lnicola@users.noreply.github.com>
2020-04-20 22:07:47 +03:00
Veetaha
0f5b1fef5e Display path not debug it
Co-Authored-By: Laurențiu Nicola <lnicola@users.noreply.github.com>
2020-04-20 22:06:41 +03:00
Veetaha
982af2286a
Display path not debug it
Co-Authored-By: Laurențiu Nicola <lnicola@users.noreply.github.com>
2020-04-20 21:50:06 +03:00
veetaha
d3019164dc ra_proc_macro: cleanups here and there 2020-04-20 21:37:02 +03:00
Florian Diebold
0be68a4825 Update Chalk, and cache Chalk env elaboration through a query
This should fix some of the worst performance problems.
2020-04-20 19:16:01 +02:00
Aleksey Kladov
8a04372fec Fix panic in split_imports assist
The fix is admittedly quit literally just papering over.

Long-term, I see two more principled approaches:

* we switch to a fully tree-based impl, without parse . to_string
  step; with this approach, there shouldn't be any panics. The results
  might be nonsensical, but so was the original input.

* we preserve the invariant that re-parsing constructed node is an
  identity, and make all the `make_xxx` method return an `Option`.

closes #4044
2020-04-20 16:34:01 +02:00
Jeremy Kolb
d7f3d858ad Some clippy fixes 2020-04-19 15:15:49 -04:00
bors[bot]
36840bd6c7
Merge #4036
4036: Fix a bunch of unresovled references r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-04-18 20:18:57 +00:00
Aleksey Kladov
b79fd82559 Correctly infer types in guard expressions
The root cause was that we forgot to add bindings from the arm to the
guard expression

closes #3980
2020-04-18 22:16:04 +02:00
Aleksey Kladov
fa2ea8f494 Fix goto definition for record patterns 2020-04-18 22:11:49 +02:00
bors[bot]
7a59cd49ff
Merge #4035
4035: Convert bool to ident instead of literal in mbe r=matklad a=edwin0cheng

Fixed #1249

Currently we treat boolean literal as `tt::Literal` , which makes parsing $lit:lit matcher easily.
However, proc-macro2 treat boolean literal as `ident` :

4173a21dc4/src/lib.rs (L939)

OT: I am quite happy we finally need to fix this bug :)

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-04-18 19:36:37 +00:00
bors[bot]
b95b77f92f
Merge #4034
4034: Add semantic tag for unresolved references r=matklad a=matklad

This is a quick way to implement unresolved reference diagnostics.
For example, adding to VS Code config

    "editor.tokenColorCustomizationsExperimental": {
        "unresolvedReference": "#FF0000"
    },

will highlight all unresolved refs in red.

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-04-18 19:29:17 +00:00
Aleksey Kladov
ca61356b01 Add semantic tag for unresolved references
This is a quick way to implement unresolved reference diagnostics.
For example, adding to VS Code config

    "editor.tokenColorCustomizationsExperimental": {
        "unresolvedReference": "#FF0000"
    },

will highlight all unresolved refs in red.
2020-04-18 21:28:51 +02:00
Edwin Cheng
a1b5cf81eb Convert bool to ident instead of literal in mbe 2020-04-19 03:24:17 +08:00
bors[bot]
b949500126
Merge #4032
4032: Add mbe lifetime split test r=matklad a=edwin0cheng



Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-04-18 18:57:14 +00:00
Edwin Cheng
ce674be217 Add mbe lifetime split test 2020-04-19 02:45:17 +08:00
bors[bot]
6f60e646fc
Merge #3894
3894: Match check enum record r=flodiebold a=JoshMcguigan

This PR implements match statement exhaustiveness checking for record type enums.

It also make a minor addition to the test infrastructure to allow testing against a single diagnostic, so you can be sure your test is triggering (or not) whichever diagnostic you expect.

Co-authored-by: Josh Mcguigan <joshmcg88@gmail.com>
2020-04-18 18:42:07 +00:00
bors[bot]
98819d8919
Merge #4029
4029: Fix various proc-macro bugs r=matklad a=edwin0cheng

This PRs does the following things:

1. Fixed #4001 by splitting `LIFETIME` lexer token to two mbe tokens. It is because rustc token stream expects `LIFETIME` as a combination of punct and ident, but RA `tt:TokenTree` treats it as a single `Ident` previously.
2. Fixed #4003, by skipping `proc-macro` for completion. It is because currently we don't have `AstNode` for `proc-macro`. We would need to redesign how to implement `HasSource` for `proc-macro`.
3.  Fixed a bug how empty `TokenStream` merging in `proc-macro-srv` such that no L_DOLLAR and R_DOLLAR will be emitted accidentally. 


Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-04-18 17:56:54 +00:00
Josh Mcguigan
7adb681b1f missing match arm diagnostic support enum record type 2020-04-18 05:54:56 -07:00
Edwin Cheng
72bba98828 Merge empty delim subtree in proc-macro 2020-04-18 19:29:04 +08:00
Edwin Cheng
da18f11307 Split LIFETIME to two tokens in mbe 2020-04-18 19:28:07 +08:00
Edwin Cheng
f78de3bb95 Ignore proc-macro in completion 2020-04-18 19:26:54 +08:00
Florian Diebold
b49ecafd40 find_path: Builtins are always in scope
Fixes #3977.
2020-04-18 12:06:22 +02:00
bors[bot]
0948932145
Merge #4026
4026: Omit more parameter hints in the presence of underscores r=matklad a=lnicola

Fixes #4017.

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-04-18 09:01:41 +00:00
bors[bot]
162481d5ce
Merge #4023
4023: Fix another crash from wrong binders r=matklad a=flodiebold

Basically, if we had something like `dyn Trait<T>` (where `T` is a type parameter) in an impl we lowered that to `dyn Trait<^0.0>`, when it should be `dyn Trait<^1.0>` because the `dyn` introduces a new binder. With one type parameter, that's just wrong, with two, it'll lead to crashes.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2020-04-18 08:48:08 +00:00
Laurențiu Nicola
8a51a74556 Omit more parameter hints in the presence of underscores 2020-04-18 10:53:48 +03:00
Florian Diebold
d3cb9ea0bf Fix another crash from wrong binders
Basically, if we had something like `dyn Trait<T>` (where `T` is a type
parameter) in an impl we lowered that to `dyn Trait<^0.0>`, when it should be
`dyn Trait<^1.0>` because the `dyn` introduces a new binder. With one type
parameter, that's just wrong, with two, it'll lead to crashes.
2020-04-18 00:01:09 +02:00
Leander Tentrup
2e2c03ee2d Fix incorrect order of syntax highlight ranges 2020-04-17 22:50:30 +02:00
Florian Diebold
6a7fc76b89 Fix type equality for dyn Trait
Fixes a lot of false type mismatches.

(And as always when touching the unification code, I have to say I'm looking
forward to replacing it by Chalk's...)
2020-04-17 19:42:36 +02:00
Florian Diebold
fbd95785a6 Add two more tests for associated types 2020-04-17 18:27:38 +02:00
Aleksey Kladov
f178df1a5e Don't use SyntaxNodePtr::range when determining scope for offset 2020-04-17 18:04:49 +02:00
bors[bot]
179d983535
Merge #4012
4012: fix panic on ellipsis in pattern r=flodiebold a=JoshMcguigan

fixes #3999

Co-authored-by: Josh Mcguigan <joshmcg88@gmail.com>
2020-04-17 12:39:20 +00:00
Josh Mcguigan
408f914bf4 fix panic on ellipsis in pattern 2020-04-17 05:36:44 -07:00
Aleksey Kladov
028f1e2e3a Don\t suggest import itself as a completion for import 2020-04-17 14:28:20 +02:00
bors[bot]
0262c9b9c0
Merge #4010
4010: Fix handling of ranges in diagnostics r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-04-17 11:57:29 +00:00
Aleksey Kladov
146f6f5a45 Simplify Diagnostic structure
It's not entirely clear what subnode ranges should mean in the
presence of macros, so let's leave them out for now. We are not using
them heavily anyway.
2020-04-17 13:56:42 +02:00
Aleksey Kladov
a8196ffe84 Correctly highlight ranges of diagnostics from macros
closes #2799
2020-04-17 13:56:38 +02:00
Aleksey Kladov
302bf97bbf Don't expose impl details of SyntaxPtr 2020-04-17 12:25:41 +02:00
bors[bot]
bd6b532224
Merge #4009
4009: Better snippet when completing trait method r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-04-17 10:06:01 +00:00
Aleksey Kladov
3b75bc154f Better snippet when completing trait method 2020-04-17 12:05:35 +02:00
bors[bot]
46105cdaba
Merge #4004
4004: Use mmap for proc macro libs r=matklad a=lnicola

Fixes #4002.

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-04-17 09:40:53 +00:00
Laurențiu Nicola
93fcf1c133 Use mmap for proc macro libs 2020-04-17 12:38:38 +03:00
bors[bot]
f8016b8194
Merge #3996
3996: Fix path for proc-macro in nightly / stable release r=matklad a=edwin0cheng

I messed up that I forget we use different executable names for nightly / stable release, I changed to use the current executable name instead.

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-04-17 09:31:57 +00:00
Laurențiu Nicola
02b96d522c Reduce allocations when looking up proc macro decl 2020-04-17 11:12:05 +03:00
Edwin Cheng
ef6ee16006 Fix path for proc-macro in nightly / stable build 2020-04-17 04:45:03 +08:00
bors[bot]
8d296be109
Merge #3995
3995: Separate project discovery from project loading r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-04-16 20:36:19 +00:00
Aleksey Kladov
422ae477ce Unmix error handling when discovering workspaces
Hitting an io::Error is a legit problem. Finding more than one
Cargo.toml is not.
2020-04-16 22:35:50 +02:00