Commit Graph

429 Commits

Author SHA1 Message Date
Lukas Wirth
29c4ae6f9a extract_assist is aware of the expression owner 2021-08-03 20:47:51 +02: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]
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
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
Aleksey Kladov
86720f2953 minor: drop dummy authors field 2021-07-05 14:19:41 +03:00
Lukas Wirth
f283fce594 Mark (method-)calls with never type as exit points 2021-06-23 17:21:47 +02:00
Aleksey Kladov
7be2d2f008 internal: remove one more accidentally quadratic code-path
Definition::visibility was implemented in a rather roundabout way -- by
asking the parent module about the effective visibility.

This is problematic for a couple of reasons:

* first, it doesn't work for local items
* second, asking module about visibility of a child is a linear
  operation (that's a problem in itself, tracked in #9378)

Instead, lets ask the declared visibility directly, we have all the code
for it, and need only to actually us it.
2021-06-22 21:26:07 +03:00
Aleksey Kladov
9526c198f6 intenral: dont export impl details 2021-06-22 16:53:53 +03:00
Aleksey Kladov
2860f25ef3 minor: extend source_to_def docs 2021-06-22 16:12:01 +03:00
Aleksey Kladov
bf9ce9e65c internal: document source_to_def and it's connection to Kotlin&Roslyn 2021-06-22 15:31:04 +03:00
Jamie Cunliffe
ae823aa23f Move features into potential_cfg_options 2021-06-21 17:54:05 +01:00
Jamie Cunliffe
284483b347 Improve completion of cfg attributes
The completion of cfg will look at the enabled cfg keys when
performing completion.

It will also look crate features when completing a feature cfg
option. A fixed list of known values for some cfg options are
provided.

For unknown keys it will look at the enabled values for that cfg key,
which means that completion will only show enabled options for those.
2021-06-21 17:47:00 +01:00
Clemens Wasser
47747cd412 Apply some clippy suggestions 2021-06-21 16:40:21 +02:00
Lukas Wirth
95c8c65139 Nest all the or-patterns! 2021-06-17 17:37:14 +02:00
Lukas Wirth
354ad29493 Filter out non-type completions in the respective completions modules instead 2021-06-16 15:08:44 +02:00
Aleksey Kladov
c2015e7d18 internal: more natural order of sources for TypeParam
We usually use first (left) variant of `Either` for "usual" case, and
use right for odd things. For example, pat source is Pat | SelfParam.
2021-06-14 22:42:43 +03:00
bors[bot]
5a8ddb4b2d
Merge #9260
9260: tree-wide: make rustdoc links spiky so they are clickable r=matklad a=lf-

Rustdoc was complaining about these while I was running with --document-private-items and I figure they should be fixed.

Co-authored-by: Jade <software@lfcode.ca>
2021-06-14 07:16:48 +00:00
Jade
20b325c7d5 tree-wide: make rustdoc links spiky so they are clickable 2021-06-13 21:58:05 -07:00
Aleksey Kladov
ff52167c9a internal: kill diagnostic sink 2021-06-13 22:05:47 +03:00
Aleksey Kladov
935c53b92e internal: use cov-mark rather than bailing out diagnostic 2021-06-13 21:55:51 +03:00
Aleksey Kladov
b292e1b9da internal: refactor missing match arms diagnostics 2021-06-13 21:44:31 +03:00
Aleksey Kladov
fc30c5ccbe internal: refactor incorrect case diagnostics 2021-06-13 21:09:03 +03:00
Aleksey Kladov
de1fc70ccd internal: refactor find_map diagnostic 2021-06-13 20:32:54 +03:00
Aleksey Kladov
949a6ec469 internal: refactor missing or or some diagnostic 2021-06-13 20:19:11 +03:00
Aleksey Kladov
74f3cca85a internal: refactor remove this semicolon diagnostics 2021-06-13 20:14:12 +03:00