Commit Graph

18334 Commits

Author SHA1 Message Date
Aleksey Kladov
cd6df6935f minor: make sure that project_root works correctly 2021-07-13 15:02:29 +03:00
bors[bot]
f6896f8356
Merge #9585
9585: Rename the old server before update r=matklad a=lnicola

Kinda' fixes #6602

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-07-13 10:43:01 +00:00
bors[bot]
62622c6940
Merge #9550
9550: Proc macro multi abi proof of concept r=matklad a=alexjg

#8925 was irritating me so I thought I would have a bash at fixing it. What I've done here is copy the `crates/proc_macro_srv/src/proc_macro` code (which is copied from `<RUST>/library/proc_macro`) to `crates/proc_macro_srv/src/proc_macro_nightly` and the modified the nightly version to include the changes from https://github.com/rust-analyzer/rust-analyzer/pull/9047 and aeb7b183a2

This gives us the code to support both stable and nightly ABIs. Then we use the `proc_macro_api::version::read_dylib_info` to determine which version of the ABI to load when creating a `ProcMacroLibraryLibLoading` (which is now an enum). 

This seems to work for me.  The code could be cleaned up but I wanted to see if the approach makes sense before I spend more time on it.

I've split the change into two commits, the first is just copying and modifying the `proc_macro` crate, the second contains most of the interesting work around figuring out which ABI to use.

Co-authored-by: Alex Good <alex@memoryandthought.me>
Co-authored-by: alexjg <alex@memoryandthought.me>
2021-07-13 10:35:20 +00:00
Laurențiu Nicola
cfaf186d02 Rename the old server before update 2021-07-13 09:10:25 +03:00
bors[bot]
7988c80dd5
Merge #9583
9583: internal: get rid of a call to slow O(N) visibility_of function r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-07-12 18:15:45 +00:00
Aleksey Kladov
6f269708e8 internal: get rid of a call to slow O(N) visibility_of function
Instead of inferring module's declared visibility by looking at the
scope of its parent, let's just remeber the declared visibility in the
DefMap.
2021-07-12 21:13:43 +03:00
bors[bot]
c8d19fedb8
Merge #9582
9582: internal: remove erroneous default impl r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-07-12 17:18:43 +00:00
Aleksey Kladov
a9d0d1414a internal: remove erroneous default impl 2021-07-12 20:18:07 +03:00
Aleksey Kladov
67a7dfda43 internal: remove deprecated fn 2021-07-12 20:05:09 +03:00
Aleksey Kladov
d40cf52e6d internal: perpare to remove ModuleData::default 2021-07-12 20:02:56 +03:00
Aleksey Kladov
107e07458c internal: remove erroneous Default impl for ModuleOrigin
In rust-analyzer, we avoid defualt impls for types which don't have
sensible, "empty" defaults. In particular, we avoid using invalid
indices for defaults and similar hacks.
2021-07-12 20:00:17 +03:00
Alex Good
e240eb67a8 Introduce proc_macro_srv::abis, impl 1.47 and 1.55
Rather than a "Stable" and "Nightly" ABI we instead name ABIs based on
the version of the rust compiler in which they were introduced. We place
these ABIs in a new module - `proc_macro_srv::abis` - where we also add
some mchinery to abstract over ABIs. This should make it easy to add new
ABIs at a later date as the rust compiler evolves.
2021-07-12 16:05:45 +01:00
alexjg
14a51d28b5 check rustc major version == 1 not < 1
Co-authored-by: bjorn3 <bjorn3@users.noreply.github.com>
2021-07-12 16:05:45 +01:00
Alex Good
39b8d10b93 Use rustc version of dylib to choose which proc macro ABI to use 2021-07-12 16:05:45 +01:00
Alex Good
a8b0a91011 copy proc_maco to proc_macro_nightly and modify for nightly ABI compatibility 2021-07-12 16:05:45 +01:00
bors[bot]
745be39383
Merge #9179
9179: Update npm deps r=matklad a=lnicola



Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-07-12 14:45:48 +00:00
bors[bot]
cfe6661c19
Merge #9579
9579: fix: Set more `CARGO_` env vars r=jonas-schievink a=jonas-schievink

Set `CARGO_CRATE_NAME` to the package name, with `-` replaced by `_`. This is wrong, but better than not setting the variable at all.

Also set `CARGO_PKG_HOMEPAGE` since it's easy.

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-07-12 13:37:12 +00:00
Jonas Schievink
7c2b9fb660 Set more CARGO_ env vars 2021-07-12 15:34:49 +02:00
bors[bot]
091dbfe637
Merge #9535
9535: internal: remove proc macro management thread r=jonas-schievink a=jonas-schievink

Communication with the proc macro server process has always happened one request at a time, so the additional thread isn't really needed (it just forwarded each request, and sent back the response). This removes some indirection that was a bit hard to understand (a channel was allocated and sent over another channel to return the response).

Hope I'm not missing anything here

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-07-12 13:23:26 +00:00
Jonas Schievink
29db33ce76 Address review comments 2021-07-12 15:19:53 +02:00
bors[bot]
fe00358888
Merge #9569
9569: internal: Explicitly check for reference locals or fields in Name classification r=Veykril a=Veykril

Closes #7524
Inlines all the calls to reference related name classification as well as emits both goto definition targets for field shorthands.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-07-11 14:28:08 +00:00
bors[bot]
3fc5f01f59
Merge #9572
9572: fix: Work around older synstructure derives r=lnicola a=flodiebold

Fixes #9562, until the proper fix rust-lang/chalk#717 works which requires mystor/synstructure#47 to be released.

Also add an unrelated test, for #9560.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2021-07-11 14:19:25 +00:00
Lukas Wirth
ab2647769c Return both field and local references for shorthands in goto_def 2021-07-11 16:16:16 +02:00
Florian Diebold
44d3c32922 Add test for #9560 2021-07-11 16:14:39 +02:00
Florian Diebold
b7bd45574a Add workaround for #9562
This treats the consts generated by older synstructure versions like
unnamed consts. We should remove this at some point (at least after
Chalk has switched).
2021-07-11 16:14:39 +02:00
Lukas Wirth
c41f1279a3 Inline name classification reference calls 2021-07-11 15:39:09 +02:00
Lukas Wirth
c65bb7f8b9 Explicitly check for reference locals or fields in Name classification 2021-07-11 15:04:40 +02:00
bors[bot]
87621de2b9
Merge #9567 #9568
9567: remove unneded special case r=matklad a=matklad

bors r+
🤖

9568: feat: add 'for' postfix completion r=lnicola a=mahdi-frms


![Peek 2021-07-11 16-45](https://user-images.githubusercontent.com/62165556/125194692-a0aaf780-e267-11eb-952a-81de7955d9a1.gif)


adds #9561

used ```ele``` as identifier for each element in the iteration

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
Co-authored-by: mahdi-frms <mahdif1380@outlook.com>
2021-07-11 12:51:33 +00:00
Aleksey Kladov
bbb053532e internal: remove one more needless extern crate 2021-07-11 15:48:49 +03:00
bors[bot]
a70d9313af
Merge #9570
9570: minor: Simplify Semantics::type_of_expr_with_coercion r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-07-11 12:44:31 +00:00
Lukas Wirth
c6b6f18520 Simplify Semantics::type_of_expr_with_coercion 2021-07-11 14:44:10 +02:00
mahdi-frms
7bae9c9187 add 'for' postfix completion 2021-07-11 17:10:57 +04:30
Aleksey Kladov
dbf11b16da typo 2021-07-11 15:13:42 +03:00
Aleksey Kladov
1171dc74e0 internal: remove unused param 2021-07-11 15:08:00 +03:00
Aleksey Kladov
5021f10660 internal: add a test for broken refactor 2021-07-11 15:05:16 +03:00
Aleksey Kladov
f42648e305 internal: remove needless distinction between a carte and its root mod 2021-07-11 14:55:24 +03:00
bors[bot]
0fbeacc1d3
Merge #9565
9565: internal: document NameClass and NameRefClass r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-07-11 11:41:51 +00:00
Aleksey Kladov
dedf0ff7c5 internal: document NameClass and NameRefClass 2021-07-11 14:41:21 +03:00
bors[bot]
06cee26a2c
Merge #9563
9563: internal: move some presentation-specific concerns out of IDE crate r=Veykril a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-07-11 11:07:56 +00:00
Aleksey Kladov
92059ea438 update tests 2021-07-11 13:55:00 +03:00
Aleksey Kladov
5c26523e94 drop unused fields 2021-07-11 13:51:52 +03:00
Aleksey Kladov
a04775060c simplify 2021-07-11 13:49:38 +03:00
Aleksey Kladov
ddce16a126 drop unused field 2021-07-11 13:48:26 +03:00
Aleksey Kladov
beb81a40eb simplify 2021-07-11 13:45:58 +03:00
Aleksey Kladov
96d85a9efb be explicit about what we *can't* debug 2021-07-11 13:44:28 +03:00
Aleksey Kladov
fa6f78c95b better name 2021-07-11 13:43:43 +03:00
Aleksey Kladov
0dc186f612 Let the client care about presentation 2021-07-11 13:42:19 +03:00
Aleksey Kladov
148e11aa9e prepare to move run/debug splitting to handlers 2021-07-11 13:34:22 +03:00
bors[bot]
325140a165
Merge #9449
9449: feat: Emit test names in `Run test` runnables if they come from a macro expansion r=matklad a=Veykril

Fixes #8964
Before:
![Code_D1Tu5Iuh5I](https://user-images.githubusercontent.com/3757771/124174685-f552b380-daac-11eb-9086-c97db014b77c.png)
After:
![image](https://user-images.githubusercontent.com/3757771/124174493-bb81ad00-daac-11eb-96c7-3de6545a62e1.png)

Basically when a macro emits more than one test we name the test functions/modules name in the runnable instead to not emit a bunch of equally named `Run Test` annotations which don't really tell much.

Note that the `Run fibonacci_test Tests` line is below the attributes due to the fact that the function name span is being reused for the generated module in rstest's expansion.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-07-11 09:37:33 +00:00
bors[bot]
2e52d6ea93
Merge #9557
9557: fix: Respect coercions in `inline_call` r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-07-10 17:25:16 +00:00