Commit Graph

18687 Commits

Author SHA1 Message Date
Jonas Schievink
d568e7686a Support if let match guards 2021-08-13 00:25:14 +02:00
bors[bot]
4466e07fd7
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>
2021-08-12 19:45:06 +00:00
Jonas Schievink
6f579c4862 Always add implicit proc_macro dependency 2021-08-12 21:42:14 +02:00
bors[bot]
baf1494374
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>
2021-08-12 17:55:29 +00:00
Dawer
6c366ade00 Clean up 2021-08-12 21:20:28 +05:00
bors[bot]
c619cb12d7
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>
2021-08-12 12:11:09 +00:00
Ryan Levick
e8de34b6b3 Use term on label for generating method impl 2021-08-12 14:01:15 +02:00
bors[bot]
1376ece497
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>
2021-08-12 10:18:02 +00:00
Yoshua Wuyts
97ec6a27ec add make::ext::path_from_idents 2021-08-12 12:17:09 +02:00
Yoshua Wuyts
df19895ba6 implement feedback from review 2021-08-12 11:50:01 +02:00
Yoshua Wuyts
8ed24029c1 rm remaining todo comment 2021-08-11 23:30:00 +02:00
Yoshua Wuyts
2fff019b6b improve codegen 2021-08-11 20:33:13 +02:00
Yoshua Wuyts
6c4a94b03a finishing touches 2021-08-11 20:04:05 +02:00
Yoshua Wuyts
c4e10c81b9 gen partialeq for tuple enums 2021-08-11 20:01:19 +02:00
Yoshua Wuyts
741e27b414 dedup PartialEq for Record enums 2021-08-11 19:40:47 +02:00
Dawer
de074fe636 Accept ambiguous unsize coercion only if it has definite guidance. 2021-08-11 22:09:32 +05:00
bors[bot]
2511e1bc35
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>
2021-08-11 16:13:29 +00:00
Lukas Wirth
73b7b34f89 Fill out expected type for functional update syntax completion 2021-08-11 18:12:44 +02:00
bors[bot]
6fc7689596
Merge #9861
9861: fix: `extract_variable` handles selection ranges better r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-08-11 15:53:09 +00:00
Lukas Wirth
6045059916 extract_variable handles selection ranges better 2021-08-11 17:52:09 +02:00
Yoshua Wuyts
fc17eb482d gen PartialEq for Record enums
Co-Authored-By: Ryan Levick <rylev@users.noreply.github.com>
2021-08-11 17:15:12 +02:00
bors[bot]
f438dbb100
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>
2021-08-11 15:10:26 +00:00
Lukas Wirth
6d960ab032 Fix extract_function tagging params as mut unnecessarily 2021-08-11 17:09:51 +02:00
bors[bot]
50617ee5c5
Merge #9856
9856: Show type actions on ranged type hover r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-08-11 11:53:25 +00:00
Lukas Wirth
ec443886ea Show type actions on ranged type hover 2021-08-11 13:52:57 +02:00
bors[bot]
88311c400d
Merge #9854
9854: internal: document that ascription is preferred to a turbo fish r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-08-11 11:17:06 +00:00
Aleksey Kladov
629c68e80d internal: document that ascription is preferred to a turbo fish 2021-08-11 14:16:15 +03:00
bors[bot]
145b51f9da
Merge #9836
9836: Refactor: quick clean-up of iteration idioms in the `vfs` crate r=matklad a=Some-Dood

This PR cleans up some of the iteration idioms used in the `vfs` crate. Most of the changes simply converted `for` loops into their `std::iter::Iterator`-method counterpart. Other changes required some inversion of logic to accommodate for better short-circuiting. Overall, there should be no behavioral changes. If there are any stylistic issues, I will gladly adhere to them and adjust the PR accordingly. Thanks!

Co-authored-by: Basti Ortiz <39114273+Some-Dood@users.noreply.github.com>
2021-08-11 09:54:09 +00:00
bors[bot]
6c80c42c57
Merge #9828
9828: Remove dependency on the system graphviz when rendering crate graph r=lnicola a=p32blo


This PR removes the need for having `graphviz` installed on the user system by using the `d3-graphviz` npm package.

The responsibility of rendering the svg output is moved to the extension while the rust side only handles the generation of the dot file.

This change also brings the following additional features:
- Allow zooming the view
- Ctrl+click to reset the zoom 
- Adjust the color scheme to dark themes
- Works on any platform without installing graphviz locally

---

I’m not sure if this fits what you had in mind for the crates graph feature but I decided to submit it anyway to see if this is useful to anyone else. 

A potential downside might be that it increases the extension size ( haven’t checked) but this feature already required the installation of graphviz on the user side, so the cost is just moved explicitly to the extension.

Feel free to make any suggestion or comments. 

Co-authored-by: André Oliveira <p32blo@gmail.com>
2021-08-11 08:30:53 +00:00
Yoshua Wuyts
1cf7af7032 wip enum record/tuple generation 2021-08-10 22:08:14 +02:00
Yoshua Wuyts
65ce87cad8 gen PartialEq for basic enums 2021-08-10 21:05:23 +02:00
Yoshua Wuyts
f8a64c044a gen PartialEq for structs 2021-08-10 19:49:06 +02:00
Yoshua Wuyts
3cad2c4feb add partial_eq gen tests 2021-08-10 19:48:50 +02:00
Yoshua Wuyts
20c3b20db3 add make::expr_op 2021-08-10 19:48:32 +02:00
bors[bot]
c943057038
Merge #9849
9849: internal: Refine functional update completion some more r=Veykril a=Veykril

cc https://github.com/rust-analyzer/rust-analyzer/issues/9839
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-08-10 15:05:04 +00:00
Lukas Wirth
f6d6fda85b Refine functional update completion some more 2021-08-10 17:03:38 +02:00
Basti Ortiz
0986632c04
Fix: revert strange usage of ? operator 2021-08-10 22:44:15 +08:00
Basti Ortiz
27605b402e
Fix: prefer the usage of for loops over fold 2021-08-10 22:40:04 +08:00
Basti Ortiz
0e480a6e9c
Chore: add comments to explicitly express two-step check
See https://github.com/rust-analyzer/rust-analyzer/pull/9836#discussion_r685953381
2021-08-10 22:30:08 +08:00
Basti Ortiz
ae1288eeed
Fix: revert complex conditional in Directories::contains_file
This reverts commit 6d0336b2e4.
2021-08-10 22:25:43 +08:00
André Oliveira
25e1ca38ab Update 'package-lock.json' 2021-08-10 13:46:44 +00:00
André Oliveira
7666eb1fb8 Embed the scripts in the html template 2021-08-10 13:43:58 +00:00
André Oliveira
51a6d2204e Remove unecessary joinPaths 2021-08-10 13:43:58 +00:00
André Oliveira
f4a60e2af3 Include the needed node_modules files in the final extension bundle 2021-08-10 13:43:58 +00:00
André Oliveira
11bbaecca0 Formatting issues 2021-08-10 13:43:57 +00:00
André Oliveira
5e571a375b replace let by const 2021-08-10 13:43:57 +00:00
André Oliveira
b29508949d Remove debug logs 2021-08-10 13:43:57 +00:00
André Oliveira
6d59219d26 Reduce path handling code 2021-08-10 13:43:57 +00:00
André Oliveira
1039acb10a Add more features to the rendering
- Allow the zoom to go further than 10x
- Adapt css to dark and high constrast themess
- Use 'javascript/worker' for the wasm graphviz
- Add Ctrl + LeftMouseClick to reset zoom
2021-08-10 13:43:55 +00:00
André Oliveira
8a563e4a46 Use local node_modules to allow the graph to load offline
- Fix some warnings
2021-08-10 13:43:08 +00:00