]>
git.lizzy.rs Git - rust.git/log
BooksBaum [Tue, 10 Aug 2021 12:15:12 +0000 (14:15 +0200)]
Fix errors from `rebase master`
Note:
2nd Assist description is moved down: generated doc tests extracts now
all tests (previously only the first one). But it uses the first
`Assist` name -- which is the wrong one for the 2nd test. And 2nd assist
is currently disabled -> would fail anyway.
BooksBaum [Tue, 10 Aug 2021 11:28:32 +0000 (13:28 +0200)]
Cleanup according to style-requirements in tests
BooksBaum [Mon, 9 Aug 2021 18:58:33 +0000 (20:58 +0200)]
Fix: different assist ids in doc and code
BooksBaum [Mon, 9 Aug 2021 17:56:11 +0000 (19:56 +0200)]
Handle tuple in macro call
Only tuple name is handled (uncommented), not tuple index
BooksBaum [Fri, 6 Aug 2021 08:55:44 +0000 (10:55 +0200)]
Add destructure in sub-pattern (after `@`)
BooksBaum [Wed, 4 Aug 2021 19:16:53 +0000 (21:16 +0200)]
Handle `mut` & `ref`
BooksBaum [Tue, 17 Aug 2021 17:22:57 +0000 (19:22 +0200)]
Add Destructure Tuple
bors[bot] [Tue, 17 Aug 2021 16:26:05 +0000 (16:26 +0000)]
Merge #9936
9936: proc_macro_api: make commit & date suffix of binary version optional r=lnicola a=lnicola
Closes #9916
bors r+
Co-authored-by: Florian sp1rit <sp1ritCS@protonmail.com>
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
Laurențiu Nicola [Tue, 17 Aug 2021 16:25:37 +0000 (19:25 +0300)]
Fix formatting
bors[bot] [Tue, 17 Aug 2021 15:49:02 +0000 (15:49 +0000)]
Merge #9934
9934: Revert "Downgrade notify and use RecommendedWatcher" r=lnicola a=xanderio
This reverts commit
5b0c86af7d1683983a35f232baa7c98cfa3c382d .
The pre-5.0.12 release of notify fixed this issue.
`@lnicola` Could you verify that this now works on NetBSD?
Co-authored-by: Alexander Sieg <alex@xanderio.de>
Co-authored-by: Alexander Sieg <6298052+xanderio@users.noreply.github.com>
Alexander Sieg [Tue, 17 Aug 2021 15:27:37 +0000 (17:27 +0200)]
rebuild Cargo.lock
Alexander Sieg [Tue, 17 Aug 2021 15:25:11 +0000 (17:25 +0200)]
Bump notify version to 5.0.0-pre.12
Co-authored-by: Laurențiu Nicola <lnicola@users.noreply.github.com>
Alexander Sieg [Tue, 17 Aug 2021 15:17:02 +0000 (17:17 +0200)]
Revert "Downgrade notify and use RecommendedWatcher"
This reverts commit
5b0c86af7d1683983a35f232baa7c98cfa3c382d .
The pre-5.0.12 release of notify fixed this issue.
bors[bot] [Tue, 17 Aug 2021 13:25:08 +0000 (13:25 +0000)]
Merge #9929
9929: fix: Handle all rename special cases for record pattern fields r=Veykril a=Veykril
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
Lukas Wirth [Tue, 17 Aug 2021 13:24:01 +0000 (15:24 +0200)]
Emit more concise text edits in ide_db::rename
Florian sp1rit [Mon, 16 Aug 2021 11:23:53 +0000 (13:23 +0200)]
proc_macro_api: make commit & date suffix of binary version optional
Signed-off-by: Florian "sp1rit" <sp1ritCS@protonmail.com>
Lukas Wirth [Mon, 16 Aug 2021 21:06:51 +0000 (23:06 +0200)]
some code docs for the ide_db/rename module
Lukas Wirth [Mon, 16 Aug 2021 20:48:38 +0000 (22:48 +0200)]
Handle all rename special cases for all record pattern fields
bors[bot] [Mon, 16 Aug 2021 19:26:18 +0000 (19:26 +0000)]
Merge #9928
9928: internal: Highlight function exit points on `fn` keyword r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
Lukas Wirth [Mon, 16 Aug 2021 19:25:22 +0000 (21:25 +0200)]
Highlight function exit points on `fn` keyword
bors[bot] [Mon, 16 Aug 2021 19:04:57 +0000 (19:04 +0000)]
Merge #9927
9927: minor: Fix some clippy lints r=lnicola a=lnicola
bors r+
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
Laurențiu Nicola [Mon, 16 Aug 2021 19:04:26 +0000 (22:04 +0300)]
Fix some clippy lints
bors[bot] [Mon, 16 Aug 2021 16:38:44 +0000 (16:38 +0000)]
Merge #9921
9921: Only add entries to SourceToDef dynmaps when they come from the same file r=matklad a=Veykril
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/9919
Running the test as described in the issue I do not get any eprintln output at all anymore.
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
Lukas Wirth [Mon, 16 Aug 2021 16:29:16 +0000 (18:29 +0200)]
style
bors[bot] [Mon, 16 Aug 2021 16:25:57 +0000 (16:25 +0000)]
Merge #9924
9924: Fix gen debug for enums r=yoshuawuyts a=yoshuawuyts
Closes https://github.com/rust-analyzer/rust-analyzer/issues/9914. Thanks!
r? `@Veykril`
Co-authored-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
Yoshua Wuyts [Mon, 16 Aug 2021 16:23:51 +0000 (18:23 +0200)]
implement feedback from review
Lukas Wirth [Mon, 16 Aug 2021 15:55:18 +0000 (17:55 +0200)]
Flatten SourceToDefCache structure
Yoshua Wuyts [Mon, 16 Aug 2021 15:39:08 +0000 (17:39 +0200)]
fix debug tuple structs
Lukas Wirth [Mon, 16 Aug 2021 15:07:25 +0000 (17:07 +0200)]
Only add entries to SourceToDef dynmaps when they come from the same file
bors[bot] [Mon, 16 Aug 2021 14:13:04 +0000 (14:13 +0000)]
Merge #9920
9920: minor: Simplify r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
Lukas Wirth [Mon, 16 Aug 2021 14:12:20 +0000 (16:12 +0200)]
Simplify
bors[bot] [Mon, 16 Aug 2021 11:46:21 +0000 (11:46 +0000)]
Merge #9918
9918: minor: simplify r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
Aleksey Kladov [Mon, 16 Aug 2021 11:45:54 +0000 (14:45 +0300)]
minor: simplify
bors[bot] [Mon, 16 Aug 2021 11:32:43 +0000 (11:32 +0000)]
Merge #9917
9917: minor: remove dead code r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
Aleksey Kladov [Mon, 16 Aug 2021 11:27:36 +0000 (14:27 +0300)]
minor: remove dead code
Yoshua Wuyts [Mon, 16 Aug 2021 10:58:06 +0000 (12:58 +0200)]
fix debug record structs
bors[bot] [Sun, 15 Aug 2021 10:26:59 +0000 (10:26 +0000)]
Merge #9905
9905: internal: optimize compile time r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
Aleksey Kladov [Sun, 15 Aug 2021 10:24:37 +0000 (13:24 +0300)]
internal: optimize compile time
cargo llvm-lines shows that path_to_error bloats the code. I don't think
I've needed this functionality recently, seems that we've fixed most of
the serialization problems. So let's just remove it. Should be easy to
add back if we ever need it, and it does make sense to keep the
`from_json` function around.
bors[bot] [Sat, 14 Aug 2021 17:43:52 +0000 (17:43 +0000)]
Merge #9902
9902: minor: move functionality to a better place r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
Aleksey Kladov [Sat, 14 Aug 2021 17:38:31 +0000 (20:38 +0300)]
minor: move functionality to a better place
bors[bot] [Sat, 14 Aug 2021 17:30:13 +0000 (17:30 +0000)]
Merge #9901
9901: internal: remove dead code r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
Aleksey Kladov [Sat, 14 Aug 2021 17:29:46 +0000 (20:29 +0300)]
internal: remove dead code
bors[bot] [Sat, 14 Aug 2021 17:17:51 +0000 (17:17 +0000)]
Merge #9900
9900: internal: remove one more usage of old editing API. r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
Aleksey Kladov [Sat, 14 Aug 2021 17:17:16 +0000 (20:17 +0300)]
internal: remove one more usage of old editing API.
bors[bot] [Sat, 14 Aug 2021 17:10:04 +0000 (17:10 +0000)]
Merge #9899
9899: minor: Simplify r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
Lukas Wirth [Sat, 14 Aug 2021 17:06:35 +0000 (19:06 +0200)]
Simplify
bors[bot] [Sat, 14 Aug 2021 16:46:19 +0000 (16:46 +0000)]
Merge #9897
9897: internal: remove old editing API r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
Aleksey Kladov [Sat, 14 Aug 2021 16:45:47 +0000 (19:45 +0300)]
internal: remove old editing API
bors[bot] [Sat, 14 Aug 2021 16:19:14 +0000 (16:19 +0000)]
Merge #9896
9896: internal: Only complete type annotations for patterns in function params r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
Lukas Wirth [Sat, 14 Aug 2021 16:18:18 +0000 (18:18 +0200)]
Only complete type annotations for patterns in function params
bors[bot] [Sat, 14 Aug 2021 16:07:09 +0000 (16:07 +0000)]
Merge #9895
9895: minor: Simplify r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
Lukas Wirth [Sat, 14 Aug 2021 16:02:51 +0000 (18:02 +0200)]
Simplify
bors[bot] [Sat, 14 Aug 2021 15:59:47 +0000 (15:59 +0000)]
Merge #9894
9894: internal: use standard test style r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
Aleksey Kladov [Sat, 14 Aug 2021 15:53:21 +0000 (18:53 +0300)]
internal: use standard test style
bors[bot] [Sat, 14 Aug 2021 15:52:48 +0000 (15:52 +0000)]
Merge #9893
9893: fix: Don't use uncached syntax nodes in `generate_function` for sema lookups r=Veykril a=Veykril
Fixes the crash in the comment here https://github.com/rust-analyzer/rust-analyzer/issues/9382#issuecomment-
896101298
Couldn't make out a repro test for this unfortunately
still not idea about the original issue
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
Lukas Wirth [Sat, 14 Aug 2021 15:42:06 +0000 (17:42 +0200)]
Don't use non cache syntaxnodes in generate_function for lookups
bors[bot] [Sat, 14 Aug 2021 15:40:20 +0000 (15:40 +0000)]
Merge #9892
9892: internal: remove a remnant of old editing infra r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
Aleksey Kladov [Sat, 14 Aug 2021 15:28:38 +0000 (18:28 +0300)]
internal: make assist naming consistent
Aleksey Kladov [Sat, 14 Aug 2021 15:24:42 +0000 (18:24 +0300)]
internal: remove a remnant of old editing infra
bors[bot] [Sat, 14 Aug 2021 15:11:17 +0000 (15:11 +0000)]
Merge #9890
9890: internal: refactor binary operator handling r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
Aleksey Kladov [Sat, 14 Aug 2021 15:08:31 +0000 (18:08 +0300)]
internal: merge hir::BinaryOp and ast::BinOp
Aleksey Kladov [Sat, 14 Aug 2021 14:07:51 +0000 (17:07 +0300)]
internal: prepare to merge hir::BinaryOp and ast::BinOp
Aleksey Kladov [Sat, 14 Aug 2021 14:01:28 +0000 (17:01 +0300)]
internal: make naming consistent
Aleksey Kladov [Sat, 14 Aug 2021 13:58:46 +0000 (16:58 +0300)]
internal: prepare a dedicated module for all operators
bors[bot] [Sat, 14 Aug 2021 13:41:00 +0000 (13:41 +0000)]
Merge #9889
9889: Update manual.adoc: added juCi++ section r=lnicola a=eidheim
Co-authored-by: Ole Christian Eidheim <eidheim@gmail.com>
Aleksey Kladov [Sat, 14 Aug 2021 13:40:00 +0000 (16:40 +0300)]
internal: make invert binary op more robust
Previously, we only inverted comparison operators (< and the like) if
the type implemented Ord. This doesn't make sense: if `<` works, then
`>=` will work as well!
Extra semantic checks greatly reduce robustness and predictability of
the assist, it's better to keep things simple.
Ole Christian Eidheim [Sat, 14 Aug 2021 10:47:58 +0000 (12:47 +0200)]
Update manual.adoc: added juCi++ section
bors[bot] [Sat, 14 Aug 2021 07:39:46 +0000 (07:39 +0000)]
Merge #9882
9882: fix: Don't call deprecated `compile` regex method r=lnicola a=lnicola
Fixes #9872
It looks like `compile` expects to be called like `RegExp.compile("foo", "m")`, so calling `.compile()` on an existing regex replaces it with an empty one.
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
bors[bot] [Fri, 13 Aug 2021 22:12:58 +0000 (22:12 +0000)]
Merge #9886
9886: feat: type inference for if-let guards r=jonas-schievink a=jonas-schievink
This turned out fairly simple
bors r+
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
Jonas Schievink [Fri, 13 Aug 2021 22:09:30 +0000 (00:09 +0200)]
feat: type inference for if-let guards
bors[bot] [Fri, 13 Aug 2021 15:24:35 +0000 (15:24 +0000)]
Merge #9884
9884: cargo update r=kjeremy a=kjeremy
Remove paste-impl and proc-macro-hack.
Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
Jeremy Kolb [Fri, 13 Aug 2021 15:08:24 +0000 (11:08 -0400)]
cargo update
bors[bot] [Fri, 13 Aug 2021 11:19:16 +0000 (11:19 +0000)]
Merge #9871
9871: Jump to generated func r=mahdi-frms a=rylev
Worked on this with `@yoshuawuyts.`
We thought we ran into an issue with the `generate_function` assist where the code was not being generated in a certain situations. However, it wasn't actually a bug just a very confusing implementation where the cursor is not moved to the newly generated function. This happened when the return type was successfully inferred (and not unit). The function would be generated, but selection would not be changed.
This can be very confusing: If the function is generated somewhat far from where the assist is being invoked, the user never sees that the code was generated (nor are they given the chance to actually implement the function body).
This PR makes it so that the cursor is _always_ moved to somewhere in the newly generated function. In addition, if we can infer unit as the type, then we do not still generate `-> ()` as the return type. Instead, we simply omit the return type.
This means the selection will move to either one of two places:
* A generated `-> ()` return type when we cannot successfully infer the return type.
* The `todo!()` body when we can successfully infer the return type.
Co-authored-by: Ryan Levick <me@ryanlevick.com>
Laurențiu Nicola [Fri, 13 Aug 2021 11:16:33 +0000 (14:16 +0300)]
Don't call deprecated compile regex method
Ryan Levick [Fri, 13 Aug 2021 09:44:29 +0000 (11:44 +0200)]
Add documentation on how whether a generated return type should be focused or not
bors[bot] [Thu, 12 Aug 2021 22:28:04 +0000 (22:28 +0000)]
Merge #9879
9879: feat: Support `if let` match guards r=jonas-schievink a=jonas-schievink
Adds support for parsing and computing bindings for `if let` match guards (https://github.com/rust-lang/rust/issues/51114). Type inference support is still missing, but shouldn't be hard to add in a follow-up PR.
Closes https://github.com/rust-analyzer/rust-analyzer/issues/9876
bors r+
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
Jonas Schievink [Thu, 12 Aug 2021 22:21:42 +0000 (00:21 +0200)]
Support `if let` match guards
bors[bot] [Thu, 12 Aug 2021 19:45:06 +0000 (19:45 +0000)]
Merge #9874
9874: fix: Always add implicit `proc_macro` dependency r=jonas-schievink a=jonas-schievink
Even crates that don't set `proc-macro = true` are allowed to depend on `proc_macro` (just none of the APIs work when called outside of a proc macro).
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/9857
bors r+
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
Jonas Schievink [Thu, 12 Aug 2021 19:42:14 +0000 (21:42 +0200)]
Always add implicit `proc_macro` dependency
bors[bot] [Thu, 12 Aug 2021 17:55:29 +0000 (17:55 +0000)]
Merge #9807
9807: Implicit `Sized` bounds r=iDawer a=iDawer
This should close #8984
`hir_ty`:
- Type parameters, associated types and `impl Trait` are `Sized` by deafault except `Self` in a trait.
- Implicit `Sized` bound is added to end of predicate list. It does not check if such bound is present already. Also it does not track the bound is implicit.
- Allowed ambiguous unsize coercion if Chalk returns definite guidance.
- Allowed ambiguous autoderef if Chalk returns definite guidance.
`hir_def`:
- `ItemTree` pretty printing shows `?Sized` bounds.
`HirDisplay`:
- `impl Trait` with weird bounds rendered correctly.
- `Sized`/`?Sized` bounds are not shown if they are default.
### Perf
`./target/rust-analyzer-baseline_8a843113 -q analysis-stats --memory-usage .`
```
Database loaded: 1.63s, 287minstr, 91mb
crates: 38, mods: 741, decls: 15914, fns: 11835
Item Collection: 26.80s, 73ginstr, 338mb
exprs: 318994, ??ty: 398 (0%), ?ty: 435 (0%), !ty: 174
Inference: 50.28s, 116ginstr, 516mb
Total: 77.08s, 189ginstr, 855mb
```
`./target/rust-analyzer-sized-fixed_ambig_coercion-
de074fe6 -q analysis-stats --memory-usage .`
```
Database loaded: 1.63s, 287minstr, 91mb
crates: 38, mods: 741, decls: 15914, fns: 11835
Item Collection: 26.95s, 73ginstr, 338mb
exprs: 318994, ??ty: 398 (0%), ?ty: 435 (0%), !ty: 166
Inference: 96.39s, 234ginstr, 543mb
Total: 123.33s, 307ginstr, 881mb
```
Co-authored-by: Dawer <7803845+iDawer@users.noreply.github.com>
Dawer [Thu, 12 Aug 2021 14:31:00 +0000 (19:31 +0500)]
Clean up
Ryan Levick [Thu, 12 Aug 2021 14:05:32 +0000 (16:05 +0200)]
Factor out return type handling for both function and method
Ryan Levick [Thu, 12 Aug 2021 12:56:39 +0000 (14:56 +0200)]
Always fall back to focusing on generated function body
bors[bot] [Thu, 12 Aug 2021 12:11:09 +0000 (12:11 +0000)]
Merge #9869
9869: Use term "method" on label for generating method impl r=Veykril a=rylev
When showing the user the `generate_function` assist, use the term "method" when generating a method instead of the term "function" (which is correct but maybe not the most appropriate in that context).
Co-authored-by: Ryan Levick <me@ryanlevick.com>
Ryan Levick [Thu, 12 Aug 2021 11:59:08 +0000 (13:59 +0200)]
Use term on label for generating method impl
bors[bot] [Thu, 12 Aug 2021 10:18:02 +0000 (10:18 +0000)]
Merge #9863
9863: feat: Generate default trait fn impl when generating `PartialEq` r=yoshuawuyts a=yoshuawuyts
Implements a default trait function body when generating the `PartialEq` trait for a type. Thanks!
r? `@veykril`
Co-authored-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
Yoshua Wuyts [Thu, 12 Aug 2021 10:17:09 +0000 (12:17 +0200)]
add `make::ext::path_from_idents`
Yoshua Wuyts [Thu, 12 Aug 2021 09:50:01 +0000 (11:50 +0200)]
implement feedback from review
Yoshua Wuyts [Wed, 11 Aug 2021 21:30:00 +0000 (23:30 +0200)]
rm remaining todo comment
Yoshua Wuyts [Wed, 11 Aug 2021 18:33:13 +0000 (20:33 +0200)]
improve codegen
Yoshua Wuyts [Wed, 11 Aug 2021 18:04:05 +0000 (20:04 +0200)]
finishing touches
Yoshua Wuyts [Wed, 11 Aug 2021 18:01:19 +0000 (20:01 +0200)]
gen partialeq for tuple enums
Yoshua Wuyts [Wed, 11 Aug 2021 17:40:47 +0000 (19:40 +0200)]
dedup PartialEq for Record enums
Dawer [Wed, 11 Aug 2021 17:09:32 +0000 (22:09 +0500)]
Accept ambiguous unsize coercion only if it has definite guidance.
bors[bot] [Wed, 11 Aug 2021 16:13:29 +0000 (16:13 +0000)]
Merge #9862
9862: internal: Fill out expected type for functional update syntax completion r=Veykril a=Veykril
Last part of https://github.com/rust-analyzer/rust-analyzer/issues/9839
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
Lukas Wirth [Wed, 11 Aug 2021 16:05:39 +0000 (18:05 +0200)]
Fill out expected type for functional update syntax completion
bors[bot] [Wed, 11 Aug 2021 15:53:09 +0000 (15:53 +0000)]
Merge #9861
9861: fix: `extract_variable` handles selection ranges better r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
Lukas Wirth [Wed, 11 Aug 2021 15:52:09 +0000 (17:52 +0200)]
extract_variable handles selection ranges better
Yoshua Wuyts [Wed, 11 Aug 2021 15:15:12 +0000 (17:15 +0200)]
gen PartialEq for Record enums
Co-Authored-By: Ryan Levick <rylev@users.noreply.github.com>
bors[bot] [Wed, 11 Aug 2021 15:10:26 +0000 (15:10 +0000)]
Merge #9860
9860: fix: Fix extract_function tagging params as mut unnecessarily r=Veykril a=Veykril
Fixes #9822
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>