Commit Graph

19228 Commits

Author SHA1 Message Date
bors[bot]
075fe761f3
Merge #10313
10313: Mark large benchmark data files as binary to filter greps r=lnicola a=joshtriplett

When doing a git grep (of rust-analyzer or of rust-lang/rust with
--recurse-submodules), if the grep happens to match within the large
benchmark data files, the resulting long single lines can cause a text
pager or editor to slow down and distract from more useful matches.

These test data files aren't formatted for human consumption, so mark
them as binary, which causes git grep to instead just state that they
match without printing the matching "line".

Co-authored-by: Josh Triplett <josh@joshtriplett.org>
2021-09-22 20:04:30 +00:00
Josh Triplett
dfd28c1764 Mark large benchmark data files as binary to filter greps
When doing a git grep (of rust-analyzer or of rust-lang/rust with
--recurse-submodules), if the grep happens to match within the large
benchmark data files, the resulting long single lines can cause a text
pager or editor to slow down and distract from more useful matches.

These test data files aren't formatted for human consumption, so mark
them as binary, which causes git grep to instead just state that they
match without printing the matching "line".
2021-09-22 12:51:58 -07:00
bors[bot]
8a82e6c492
Merge #10284
10284: internal: definition based hover functions r=Veykril a=HKalbasi

This is part of #10181 but since it is blocked and `hover.rs` is moving quickly so will cause conflicts, I submitted this PR.

This PR extract some parts of `hover` to `find_definition` (maybe this need to be moved to some other file?) and `hover_for_definition`, with those functions I will be able to calculate definition of every token, and calculate hover (and probably other queries) for each definition only once.

Co-authored-by: hamidreza kalbasi <hamidrezakalbasi@protonmail.com>
2021-09-22 15:23:23 +00:00
hamidreza kalbasi
589c1dfa04 move function to defs.rs 2021-09-22 18:35:54 +03:30
hamidreza kalbasi
18e6b508dd remove dead code 2021-09-22 11:44:23 +03:30
hamidreza kalbasi
569ac5bee1 use find_definition in go to 2021-09-22 11:37:26 +03:30
bors[bot]
6b77e320f0
Merge #10306
10306: Generate function assist creates bad param names for const/static item args r=XFFXFF a=XFFXFF

Try to fix #10278 

Co-authored-by: zhoufan <1247714429@qq.com>
2021-09-21 22:54:56 +00:00
zhoufan
8690cfb868 Change the style of the code 2021-09-22 06:32:23 +08:00
zhoufan
7912d3a4b3 Generate function assist creates bad param names for const/static item args 2021-09-22 00:15:57 +08:00
hamidreza kalbasi
887b7ddc37 fix derive hover in macro 2021-09-21 19:55:57 +04:30
bors[bot]
254022c13c
Merge #10304
10304: internal: Generate ast nodes for each ast trait r=Veykril a=Veykril

Generate a `DynTrait` node per ast trait that implements the trait itself as well as conversions via the `AstNode` trait. This is a trick already employed in `hir_def::attr` with `AttrsOwner` where it was manually implemented for.

This basically gives us stack trait objects for these(only useful for `hir_def::attr` currently) as well as simple conversions of `SyntaxNode` to a trait, in cases where only a result of a function call of such a trait is of interest.

It doesn't have many uses yet but as its autogenerated it doesn't add any maintenance costs. 

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-21 14:15:53 +00:00
Lukas Wirth
83e97adfff Simplify 2021-09-21 16:15:30 +02:00
Lukas Wirth
b36f12dba5 Simplify 2021-09-21 16:05:21 +02:00
Lukas Wirth
6d6e0b8f21 Generate ast nodes for each ast trait 2021-09-21 15:52:11 +02:00
bors[bot]
168b00fbba
Merge #10303
10303: internal: Add a mirror function-like proc-macro expander for tests r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-21 12:56:37 +00:00
Lukas Wirth
ba84b91e78 Add a mirror function-like proc-macro expander for tests 2021-09-21 14:55:54 +02:00
bors[bot]
063df5a482
Merge #10301
10301: minor: Merge iter_for_each_to_for and for_to_iter_for_each assists modules r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-21 08:34:51 +00:00
Lukas Wirth
8b1e8197fe Merge iter_for_each_to_for and for_to_iter_for_each assists modules 2021-09-21 10:34:11 +02:00
bors[bot]
6a98383fa5
Merge #10299
10299: minor: Rename some assists r=Veykril a=Veykril

Trying to make our assist names a bit more uniform
`fill_match_arms` -> `add_missing_match_arms`
`infer_function_return_type` -> `add_return_type`
`replace_impl_trait_with_generic` -> `introduce_named_generic`
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-20 22:54:39 +00:00
Lukas Wirth
8b2be8572f Rename some assists 2021-09-21 00:54:09 +02:00
bors[bot]
f1d7f98ed0
Merge #10293
10293: fix: Don't bail on parse errors in macro input for builtin expansion r=Veykril a=Veykril

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

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-19 22:33:42 +00:00
Lukas Wirth
e7e87fc69d Don't bail on parse errors in macro input for builtin expansion 2021-09-20 00:33:13 +02:00
bors[bot]
b7bedf16a1
Merge #10289
10289: fix: Only strip derive attributes when preparing macro input r=Veykril a=Veykril

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/10246
cc https://github.com/rust-analyzer/rowan/pull/114, follow up to https://github.com/rust-analyzer/rust-analyzer/pull/10025

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-19 21:46:51 +00:00
bors[bot]
05d291881a
Merge #10292
10292: minor: Simplify r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-19 21:39:36 +00:00
Lukas Wirth
a6dde501df Only strip derive attributes when preparing macro input 2021-09-19 23:38:38 +02:00
Lukas Wirth
9c39363ada Simplify 2021-09-19 23:34:07 +02:00
bors[bot]
06ea89d3de
Merge #10290
10290: minor: Simplify r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-19 17:01:23 +00:00
Lukas Wirth
3987bf5d6f Simplify 2021-09-19 19:00:06 +02:00
bors[bot]
b02027d4fe
Merge #10287
10287: internal: more focused tests for const arguments r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-09-19 13:35:46 +00:00
Aleksey Kladov
a6181bfdb7 internal: more focused tests for const arguments 2021-09-19 16:35:10 +03:00
bors[bot]
bd2cd6a15f
Merge #10283
10283: minor: simplify generics parsing r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-09-19 11:51:38 +00:00
Aleksey Kladov
09531b703d minor: simplify 2021-09-19 14:50:53 +03:00
hamidreza kalbasi
0777698f29 internal: definition based hover functions 2021-09-19 16:15:44 +04:30
Aleksey Kladov
0005678649 minor: simplify 2021-09-19 14:26:35 +03:00
bors[bot]
e458f66214
Merge #10282
10282: fix: don't allow two turbo-fishes in generic arguments r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-09-19 09:10:32 +00:00
Aleksey Kladov
f99bdf4cc0 fix: don't allow two turbo-fishes in generic arguments 2021-09-19 12:09:50 +03:00
bors[bot]
1c81c36219
Merge #10280
10280: internal: type argument parsing refactoring r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-09-19 08:54:02 +00:00
Aleksey Kladov
8ae1f9c335 internal: add erroneous test for double turbo fish
We parse `f` successfully, but that is a bug.
2021-09-19 11:42:10 +03:00
Aleksey Kladov
8009ccc27d minor: improve readability 2021-09-19 11:34:25 +03:00
Aleksey Kladov
25adc5e9f0 minor: reduce duplication 2021-09-19 11:19:31 +03:00
bors[bot]
7729473dd2
Merge #10276
10276: internal: parser cleanup r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-09-18 13:09:51 +00:00
Aleksey Kladov
fbb6a6a95b fix: correctly handle jointness 2021-09-18 16:09:12 +03:00
Aleksey Kladov
c0556bd8c1 minor: improve readability 2021-09-18 15:56:26 +03:00
Aleksey Kladov
ed84717869 internal: better naming 2021-09-18 15:55:07 +03:00
Aleksey Kladov
3dc2aeea0f internal: parser cleanup 2021-09-18 15:46:28 +03:00
Aleksey Kladov
af9fd37cd9 internal: minimize use_tree parser tests
The code here is intentionally dense and does exactly what is written.
Explaining semantic difference between Rust 2015 and 2018 doesn't help
with understanding syntax. Better to just add more targeted tests.
2021-09-18 15:22:49 +03:00
bors[bot]
dd12521ac9
Merge #10275
10275: internal: parser cleanups r=Veykril a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-09-18 12:20:55 +00:00
Aleksey Kladov
1d2e9818d6 internal: parser cleanups 2021-09-18 14:53:46 +03:00
bors[bot]
ba16c16005
Merge #10274
10274: feat: Make inlay hints work in attributed items r=Veykril a=Veykril

Attempt at #10043(previous attempt #10231)
![image](https://user-images.githubusercontent.com/3757771/133887500-091675db-f473-44f8-9bf5-8313ecfbc9e7.png)
Slight difference to the first approach, chaining hints now work but attribute inputs do not as they are basically the same as normal macros in that they take a token tree.

Fixes #10043

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-18 11:43:10 +00:00
Aleksey Kladov
aaadaa40bd internal: more focused trait item parsing tests 2021-09-18 14:34:29 +03:00