Laurențiu Nicola
c9f448a834
Fix some clippy lints
2021-08-16 22:04:26 +03:00
Lukas Wirth
0336e9b25f
Flatten SourceToDefCache structure
2021-08-16 17:55:18 +02:00
Lukas Wirth
c90ecc5c26
Only add entries to SourceToDef dynmaps when they come from the same file
2021-08-16 17:07:25 +02:00
Lukas Wirth
0c0142f61a
Simplify
2021-08-16 16:12:20 +02:00
Lukas Wirth
37ad9cb2a5
Don't use non cache syntaxnodes in generate_function for lookups
2021-08-14 17:51:11 +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
Yoshua Wuyts
d6b788a9ee
Add trait codegen to add_missing_impl_members
assist
2021-08-10 10:27:52 +02:00
ivan770
be3e70c604
Add reference here diagnostic
2021-08-08 10:12:40 +02:00
bors[bot]
950efff5c6
Merge #9780
...
9780: Support exclusive_range_pattern r=matklad a=lf-
Fix #9779
Co-authored-by: Jade <software@lfcode.ca>
2021-08-04 18:12:37 +00:00
Dawer
5f2486e9a8
Handle impl ?Sized
. Fix tests.
2021-08-04 20:20:10 +05:00
Dawer
421979bc68
HirDisplay prints ?Sized
bounds now; impl Trait: Sized
by default.
2021-08-04 20:05:46 +05:00
Dawer
3981373b93
internal: add implicit Sized
bounds to type parameters.
2021-08-04 19:04:21 +05:00
bors[bot]
1b02cafa43
Merge #9734
...
9734: semantic highlighting: add reference hlmod r=matklad a=jhgg
This PR adds the "reference" highlight modifier!
I basically went around and looked for `HlMod::Mutable` to find the callsites to add a reference. I think these all make sense!
Co-authored-by: Jake Heinz <jh@discordapp.com>
Co-authored-by: Jake <jh@discordapp.com>
2021-08-04 09:37:30 +00:00
Jake Heinz
44726b6ca3
fix + update expects
2021-08-04 06:12:41 +00:00
Jake
e01ff775ae
Apply suggestions from code review
...
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-08-03 23:07:46 -07:00
Jade
e3a67ccec6
tree-wide: fix rustdoc warnings, add some links
2021-08-03 21:34:20 -07:00
bors[bot]
8a8431133e
Merge #9775
...
9775: internal: extract_assist is aware of the expression owner r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-08-03 18:48:43 +00:00
Lukas Wirth
29c4ae6f9a
extract_assist
is aware of the expression owner
2021-08-03 20:47:51 +02:00
bors[bot]
00c8cab20b
Merge #9765
...
9765: internal: Introduce TypeInfo r=Veykril a=Veykril
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-08-03 15:32:51 +00:00
Lukas Wirth
b96f1adf5c
Give TypeInfo fields and methods more appropriate names
2021-08-03 17:28:51 +02:00
Lukas Wirth
8afa2722b2
Revise TypeInfo::ty usage
2021-08-03 17:24:43 +02:00
Lukas Wirth
25ff7171c4
Introduce TypeInfo
2021-08-03 16:41:53 +02:00
bors[bot]
4b0c97668c
Merge #9772
...
9772: feat: filter out duplicate macro completions r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-08-03 14:37:25 +00:00
Aleksey Kladov
2f9273633b
feat: filter out duplicate macro completions
...
closes #9303
2021-08-03 17:36:06 +03:00
bors[bot]
cae54d86d8
Merge #9761
...
9761: feat: Show coerced types on type hover r=Veykril a=Veykril
This applies to both the ranged hover request as well as the normal hover type fallback.
![image](https://user-images.githubusercontent.com/3757771/127883884-2935b624-a3e5-4f35-861a-7d6d3266d187.png )
![image](https://user-images.githubusercontent.com/3757771/127883951-4ff96b6b-7576-4886-887b-1198c1121841.png )
We unfortunately have to leave out syntax highlighting here as otherwise the `Type` and `Coerced` words in the hover will get colored.
Note that this does not show all the coercions yet(and almost no pattern coercions) as not all coercion adjustments are implemented yet.
Closes https://github.com/rust-analyzer/rust-analyzer/issues/2677
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-08-02 15:44:43 +00:00
Lukas Wirth
486603d559
Show coerced types on type hover
2021-08-02 17:10:36 +02:00
bors[bot]
0d56ff2a02
Merge #9758
...
9758: internal: explain that we don't `ref` in style.md r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-08-02 13:00:07 +00:00
Aleksey Kladov
12d7f5b56e
internal: explain that we don't ref
in style.md
2021-08-02 15:59:28 +03:00
Lukas Wirth
62ab73767f
resolve_doc_path is able to resolve to macros
2021-08-02 14:33:09 +02:00
Lukas Wirth
1edbaa29f9
Wrap inner tail expressions in MissingOkOrSomeInTailExpr
2021-07-31 20:00:09 +02:00
Jake Heinz
2baef17bb1
semantic highlighting: add reference hlmod
2021-07-31 04:42:47 +00:00
Jonas Schievink
8764cc955f
Make flyimport respect #[doc(hidden)]
2021-07-28 19:22:59 +02:00
Jonas Schievink
18f86baa62
Stop reexporting hir_def
's ItemInNs
from HIR
2021-07-28 17:39:04 +02:00
Jonas Schievink
0fbf396f0d
Make most completions respect #[doc(hidden)]
2021-07-28 15:59:02 +02:00
Jonas Schievink
b0f7aac72f
Respect #[doc(hidden)]
in dot-completion
2021-07-23 15:36:43 +02:00
bors[bot]
4705df44c7
Merge #9637
...
9637: Overhaul doc_links testing infra r=Veykril a=Veykril
and fix several issues with current implementation.
Fixes #9617
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-07-20 16:06:37 +00:00
Lukas Wirth
cb7b4a5d5b
Some more fragment fixes
2021-07-20 17:03:39 +02:00
Aleksey Kladov
60e7c1de83
minor: address review comments
2021-07-20 17:49:33 +03:00
Aleksey Kladov
7ec8434674
internal: remove potentially slow method
2021-07-20 17:19:58 +03:00
Aleksey Kladov
3c5827cc18
internal: remove one usage of a slow method
2021-07-20 17:11:09 +03:00
Aleksey Kladov
8e0630e728
internal: remove one usage of a slow method
2021-07-20 17:02:37 +03:00
Lukas Wirth
113beab473
Cleanup runnables canonical path impl
2021-07-20 16:00:44 +02:00
Lukas Wirth
97d63d67cd
Resolve paths to assoc items for traits
2021-07-19 20:51:57 +02: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
Lukas Wirth
c6b6f18520
Simplify Semantics::type_of_expr_with_coercion
2021-07-11 14:44:10 +02: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
Lukas Wirth
9e1eb77f6b
Respect coercions in inline_call
2021-07-10 19:24:49 +02:00
Lukas Wirth
7e6f40b6f1
Expose coercions for patterns and expressions in semantics
2021-07-10 19:03:46 +02:00
Lukas Wirth
576e3a4e12
add_explicit_type
respects coercions
2021-07-10 18:19:46 +02:00
Lukas Wirth
f1b3446844
Emit test name in Run test runnables if it comes from a macro expansion
2021-07-09 14:35:42 +02:00