Dawer
dfb15292c2
fix: Type param hover shows correct sized bounds.
2021-09-10 20:48:39 +05:00
bors[bot]
ac2520128d
Merge #10135
...
10135: minor: fix some clippy lints r=lnicola a=Veykril
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-03 14:28:27 +00:00
Lukas Wirth
36a5ce9790
minor: fix some clippy lints
2021-09-03 16:00:50 +02:00
Lukas Wirth
0fee14bfdd
When descending tokens don't bail on failed macro call expansions
2021-09-02 19:12:08 +02:00
Dezhi Wu
ba0947dded
switch log
crate to tracing
2021-08-30 15:11:42 +08:00
Aleksey Kladov
cfa3f679e9
internal: don't expose impl details out of hir
2021-08-29 18:55:25 +03:00
Aleksey Kladov
76b60efbfb
internal: improve compile times a bit
...
before after for cargo llvm-lines -q --lib --release -p ide_ssr | head -n 24
Lines Copies Function name
----- ------ -------------
297146 (100%) 12748 (100%) (TOTAL)
5970 (2.0%) 47 (0.4%) core::iter::traits::iterator::Iterator::try_fold
4750 (1.6%) 27 (0.2%) hashbrown::raw::RawTable<T,A>::resize
4080 (1.4%) 30 (0.2%) alloc::raw_vec::RawVec<T,A>::grow_amortized
3933 (1.3%) 69 (0.5%) alloc::raw_vec::RawVec<T,A>::current_memory
3668 (1.2%) 89 (0.7%) <core::result::Result<T,E> as core::ops::try_trait::Try>::branch
3500 (1.2%) 50 (0.4%) hashbrown::raw::RawTable<T,A>::drop_elements
3436 (1.2%) 33 (0.3%) hashbrown::raw::RawTable<T,A>::find
3415 (1.1%) 17 (0.1%) hashbrown::raw::RawTable<T,A>::rehash_in_place
3400 (1.1%) 50 (0.4%) <hashbrown::raw::RawIterRange<T> as core::iter::traits::iterator::Iterator>::next
2840 (1.0%) 20 (0.2%) alloc::raw_vec::RawVec<T,A>::allocate_in
2700 (0.9%) 30 (0.2%) core::alloc::layout::Layout::array
2666 (0.9%) 86 (0.7%) core::ptr::metadata::from_raw_parts_mut
2495 (0.8%) 50 (0.4%) core::option::Option<T>::map
2354 (0.8%) 38 (0.3%) alloc::alloc::box_free
2302 (0.8%) 7 (0.1%) ide_ssr::parsing::RuleBuilder::try_add
2146 (0.7%) 45 (0.4%) core::mem::replace
2070 (0.7%) 69 (0.5%) <alloc::raw_vec::RawVec<T,A> as core::ops::drop::Drop>::drop
1979 (0.7%) 16 (0.1%) hashbrown::map::HashMap<K,V,S,A>::insert
1926 (0.6%) 18 (0.1%) <core::iter::adapters::zip::Zip<A,B> as core::iter::adapters::zip::ZipImpl<A,B>>::next
1922 (0.6%) 62 (0.5%) core::fmt::ArgumentV1::new
1885 (0.6%) 13 (0.1%) alloc::raw_vec::RawVec<T,A>::shrink
Lines Copies Function name
----- ------ -------------
261717 (100%) 11666 (100%) (TOTAL)
5239 (2.0%) 42 (0.4%) core::iter::traits::iterator::Iterator::try_fold
4750 (1.8%) 27 (0.2%) hashbrown::raw::RawTable<T,A>::resize
3933 (1.5%) 69 (0.6%) alloc::raw_vec::RawVec<T,A>::current_memory
3536 (1.4%) 26 (0.2%) alloc::raw_vec::RawVec<T,A>::grow_amortized
3500 (1.3%) 50 (0.4%) hashbrown::raw::RawTable<T,A>::drop_elements
3400 (1.3%) 50 (0.4%) <hashbrown::raw::RawIterRange<T> as core::iter::traits::iterator::Iterator>::next
3124 (1.2%) 30 (0.3%) hashbrown::raw::RawTable<T,A>::find
2812 (1.1%) 14 (0.1%) hashbrown::raw::RawTable<T,A>::rehash_in_place
2604 (1.0%) 84 (0.7%) core::ptr::metadata::from_raw_parts_mut
2340 (0.9%) 26 (0.2%) core::alloc::layout::Layout::array
2302 (0.9%) 7 (0.1%) ide_ssr::parsing::RuleBuilder::try_add
2272 (0.9%) 16 (0.1%) alloc::raw_vec::RawVec<T,A>::allocate_in
2201 (0.8%) 35 (0.3%) alloc::alloc::box_free
2104 (0.8%) 44 (0.4%) core::mem::replace
2079 (0.8%) 42 (0.4%) <core::result::Result<T,E> as core::ops::try_trait::Try>::branch
2070 (0.8%) 69 (0.6%) <alloc::raw_vec::RawVec<T,A> as core::ops::drop::Drop>::drop
1926 (0.7%) 18 (0.2%) <core::iter::adapters::zip::Zip<A,B> as core::iter::adapters::zip::ZipImpl<A,B>>::next
1885 (0.7%) 13 (0.1%) alloc::raw_vec::RawVec<T,A>::shrink
1833 (0.7%) 13 (0.1%) hashbrown::raw::RawTable<T,A>::shrink_to
1771 (0.7%) 91 (0.8%) core::ptr::read
1701 (0.6%) 35 (0.3%) core::option::Option<T>::map
2021-08-29 18:49:16 +03:00
Lukas Wirth
6993a607cb
Simplify
2021-08-29 01:38:10 +02:00
Lukas Wirth
99f1e66997
Only report unique text ranges in highlight_related
2021-08-29 01:11:29 +02:00
Lukas Wirth
72bfbb0691
Return all usages inside macros in usage searches
2021-08-29 00:49:57 +02:00
Lukas Wirth
512135920d
Highlight all related tokens in macro inputs
2021-08-29 00:49:57 +02:00
Lukas Wirth
c5059e0623
Return all ranges corresponding to a token id in TokenMap
2021-08-29 00:49:57 +02:00
Jonas Schievink
3047ae8d0f
Enable diagnostics in const
and static
items
2021-08-27 23:21:21 +02:00
bors[bot]
97409e5fc8
Merge #9970
...
9970: feat: Implement attribute input token mapping, fix attribute item token mapping r=Veykril a=Veykril
![image](https://user-images.githubusercontent.com/3757771/130328577-4c1ad72c-51b1-47c3-8d3d-3242ec44a355.png )
The token mapping for items with attributes got overwritten partially by the attributes non-item input, since attributes have two different inputs, the item and the direct input both.
This PR gives attributes a second TokenMap for its direct input. We now shift all normal input IDs by the item input maximum(we maybe wanna swap this see below) similar to what we do for macro-rules/def. For mapping down we then have to figure out whether we are inside the direct attribute input or its item input to pick the appropriate mapping which can be done with some token range comparisons.
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/9867
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-08-27 19:30:36 +00:00
Lukas Wirth
0f3617f76f
fix: Fix multiple derives in one attribute not expanding all in expand_macro
2021-08-26 03:32:45 +02:00
Lukas Wirth
d99b81f839
Expand derive macros under cursor in Expand Macro Recursively
2021-08-24 16:33:52 +02:00
Frank Steffahn
3a5a93595f
Fix typos “a”→“an”
2021-08-22 14:31:37 +02:00
Lukas Wirth
2f179adc41
Expand attributes recursively in expand_macro
2021-08-21 23:24:12 +02:00
Lukas Wirth
177c70128c
Map attribute input tokens correctly
2021-08-21 18:13:41 +02:00
Lukas Wirth
557df6ff3f
Use correct HirFileId in find_related_test
2021-08-20 13:50:40 +02:00
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
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
Aleksey Kladov
8d391ec981
internal: refactor mismatched args count diagnostic
2021-06-13 20:06:25 +03:00
Aleksey Kladov
bccf77f26c
internal: refactor missing unsafe diagnostic
2021-06-13 20:01:01 +03:00
Aleksey Kladov
886b66cd03
internal: refactor BreakOutsideOfLoop diagnostic
2021-06-13 19:51:19 +03:00
Aleksey Kladov
7166e8549b
internal: refactor NoSuchField diagnostic
2021-06-13 19:45:16 +03:00
Aleksey Kladov
d3621eeb02
internal: refactor unimplemented builtin macro diagnostic
2021-06-13 19:35:30 +03:00
Aleksey Kladov
00303284b5
internal: refactor macro error
2021-06-13 18:41:04 +03:00
Aleksey Kladov
1e4aaee7bb
internal: refactor unresolved proc macro diagnostic
2021-06-13 17:51:44 +03:00
Aleksey Kladov
f85e383b94
internal: refactor inactive code diagnostics
2021-06-13 17:29:25 +03:00
Aleksey Kladov
fa9ed4e0ce
internal: refactor unresolved macro call diagnostic
2021-06-13 17:08:54 +03:00
Aleksey Kladov
6d104de15a
internal: refactor unresolved import diagnostic
2021-06-13 16:42:34 +03:00
Aleksey Kladov
39f190b72c
internal: refactor unresolved extern crate diagnostic
2021-06-13 16:05:43 +03:00
Aleksey Kladov
6383252cc2
internal: unified missing fields diagnostic
2021-06-13 15:48:54 +03:00
Aleksey Kladov
c6509a4592
internal: move missing_fields diagnostics
2021-06-13 15:27:15 +03:00
Aleksey Kladov
efa069d288
internal: start new diagnostics API
...
At the moment, this moves only a single diagnostic, but the idea is
reafactor the rest to use the same pattern. We are going to have a
single file per diagnostic. This file will define diagnostics code,
rendering range and fixes, if any. It'll also have all of the tests.
This is similar to how we deal with assists.
After we refactor all diagnostics to follow this pattern, we'll probably
move them to a new `ide_diagnostics` crate.
Not that we intentionally want to test all diagnostics on this layer,
despite the fact that they are generally emitted in the guts on the
compiler. Diagnostics care to much about the end presentation
details/fixes to be worth-while "unit" testing. So, we'll unit-test only
the primary output of compilation process (types and name res tables),
and will use integrated UI tests for diagnostics.
2021-06-13 14:55:45 +03:00
Maan2003
705f7e6e26
clippy::clone_on_copy
2021-06-13 09:27:19 +05:30
Maan2003
c9b4ac5be4
clippy::redudant_borrow
2021-06-13 09:24:16 +05:30
Aleksey Kladov
7731714578
internal: move diagnostics infra to hir
2021-06-12 22:05:23 +03:00
Aleksey Kladov
6940cfed1e
Move some hir_ty diagnostics to hir
2021-06-12 21:00:22 +03:00
Aleksey Kladov
6f0141a140
minor: optimize
...
We shouldn't be looking at the source map unless we actually have
diagnostics.
2021-06-12 17:49:41 +03:00
Aleksey Kladov
0413d51317
internal: move missing unsafe diagnostic to hir
2021-06-12 17:39:46 +03:00
Aleksey Kladov
f8009666be
internal: move inference diagnostics to hir
2021-06-12 17:17:23 +03:00
bors[bot]
21d4416235
Merge #9218
...
9218: Item search now respects trait impl items r=Veykril a=Veykril
Fixes #2977
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-06-11 17:33:34 +00:00
Lukas Wirth
48f65b3b15
Item search now respects trait impl items
2021-06-11 19:24:52 +02:00
Kirill Bulatov
3aaf07b8cb
Add more profiling for flyimports
2021-06-10 23:43:46 +03:00
Lukas Wirth
ae8d74ab2c
Implement dummy expansions for builtin attributes
2021-06-09 18:27:08 +02:00
bors[bot]
5f592f4f58
Merge #9191
...
9191: fix: Don't descend MacroCall TokenTree delimiters r=jonas-schievink a=Veykril
Fixes #9190
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-06-09 13:17:38 +00:00
Lukas Wirth
3c40b15d62
Don't descend MacroCall TokenTree delimiters
2021-06-09 15:02:11 +02:00
bors[bot]
b6199de706
Merge #9181 #9182
...
9181: Don't complete values in type position r=jonas-schievink a=Veykril
Will add some proper tests in a bit
9182: fix: don't complete derive macros as fn-like macros r=jonas-schievink a=jonas-schievink
Part of https://github.com/rust-analyzer/rust-analyzer/issues/8518
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-06-08 19:09:13 +00:00
Jonas Schievink
ee374ff1ee
fix: don't complete derive macros as fn-like macros
2021-06-08 17:31:47 +02:00
Lukas Wirth
1d74ef1d98
Don't complete values in type position
2021-06-08 16:50:10 +02:00
Jonas Schievink
8482329d65
source_to_def: skip items with no def
2021-06-08 16:42:48 +02:00
bors[bot]
2f376f7475
Merge #9169
...
9169: internal: steps towards attribute macro token mapping r=jonas-schievink a=jonas-schievink
This doesn't work yet, but we seem to be getting a bit further along (for example, we now stop highlighting `use` items inside item with attribute macros as if they were written verbatim).
bors r+
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-06-07 17:37:48 +00:00
Jonas Schievink
33be5762e5
Attempt to track attr macros during highlighting
2021-06-07 19:32:28 +02:00
Jonas Schievink
33e747d786
Make "expand macro" command work with attribute macros
2021-06-07 16:05:36 +02:00
Jade
8a57c73640
feat: goto definition on an impl fn goes to that fn in the trait
...
e.g. if you have a trait T and `impl T for S` for some struct, if you
goto definition on some function name inside the impl, it will go to the
definition of that function inside the `trait T` block, rather than the
current behaviour of not going anywhere at all.
2021-06-06 21:51:17 -07:00
Jonas Schievink
8d87f9b298
Handle attribute macros in descend_into_macros
2021-06-06 17:03:37 +02:00
Jonas Schievink
e5a2c6596d
Expand procedural attribute macros
2021-06-03 18:09:21 +02:00
bors[bot]
e9a797748d
Merge #8866
...
8866: Update salsa r=matklad a=jonas-schievink
This updates salsa to include https://github.com/salsa-rs/salsa/pull/265 , and removes all cancellation-related code from rust-analyzer
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-05-31 12:42:32 +00:00
Jonas Schievink
cb5454db86
Diagnose unimplemented built-in macros
2021-05-30 04:19:47 +02:00
Jonas Schievink
8c639a87bd
Thread proc-macro types through the HIR
2021-05-29 20:32:57 +02:00
Laurențiu Nicola
2268a220e4
Don't store supertraits in ItemTree
2021-05-27 16:52:30 +03:00
Jonas Schievink
33debc4065
Update salsa
2021-05-27 15:05:41 +02:00
bors[bot]
d0a4ba294c
Merge #8997
...
8997: internal: stop expanding UseTrees during ItemTree lowering r=jonas-schievink a=jonas-schievink
Closes https://github.com/rust-analyzer/rust-analyzer/issues/8908
Messy diff, but `ItemTree` lowering got simpler, since we now have a strict 1-to-1 mapping between `ast::Item` and `ModItem`.
The most messy part is mapping a single `UseTree` back to its `ast::UseTree` counterpart for diagnostics, but I think the ad-hoc source map built during lowering does the job.
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-05-27 11:56:26 +00:00
Lukas Wirth
26e784a575
simplify
2021-05-26 21:09:27 +02:00
Jonas Schievink
b52df91877
Stop expanding UseTrees during ItemTree lowering
2021-05-26 01:01:58 +02:00
Aleksey Kladov
5c9f31d4c2
internal: move diagnostics to hir
...
The idea here is to eventually get rid of `dyn Diagnostic` and
`DiagnosticSink` infrastructure altogether, and just have a `enum
hir::Diagnostic` instead.
The problem with `dyn Diagnostic` is that it is defined in the lowest
level of the stack (hir_expand), but is used by the highest level (ide).
As a first step, we free hir_expand and hir_def from `dyn Diagnostic`
and kick the can up to `hir_ty`, as an intermediate state. The plan is
then to move DiagnosticSink similarly to the hir crate, and, as final
third step, remove its usage from the ide.
One currently unsolved problem is testing. You can notice that the test
which checks precise diagnostic ranges, unresolved_import_in_use_tree,
was moved to the ide layer. Logically, only IDE should have the infra to
render a specific range.
At the same time, the range is determined with the data produced in
hir_def and hir crates, so this layering is rather unfortunate. Working
on hir_def shouldn't require compiling `ide` for testing.
2021-05-25 17:49:59 +03:00
bors[bot]
8b049ec393
Merge #8942
...
8942: Add `library` semantic token modifier to items from other crates r=arzg a=arzg
Closes #5772 .
A lot of code here is pretty repetitive; please let me know if you have any ideas how to improve it, or whether it’s fine as-is.
Side-note: How can I add tests for this? I don’t see a way for the test Rust code in `test_highlighting` to reference other crates to observe the new behaviour.
Co-authored-by: Aramis Razzaghipour <aramisnoah@gmail.com>
2021-05-25 02:30:47 +00:00
Aleksey Kladov
45112aa8c0
internal: rename hypothetical -> speculative
...
Lets steal this good naming from Roslyn before I forget about it yet
again.
2021-05-24 22:21:25 +03:00
Jonas Schievink
8ebb8d29e1
internal: intern TypeBound
s
...
Doesn't save much memory (~2 mb), but interning things is generally a
good pattern to follow
2021-05-24 15:13:23 +02:00
Aramis Razzaghipour
c32428571c
Remove hir krate methods
2021-05-24 14:54:16 +10:00
Aramis Razzaghipour
4fd5248749
Add highlighting of items from other crates
2021-05-24 14:53:48 +10:00
bors[bot]
495c9586ec
Merge #8945
...
8945: fix: Make expected type work in more situations r=flodiebold a=flodiebold
Also makes call info show the correct types for generic methods.
![2021-05-23-182952_1134x616_scrot](https://user-images.githubusercontent.com/906069/119269023-dd5a5b00-bbf5-11eb-993a-b6e122c3b9a6.png )
![2021-05-23-183117_922x696_scrot](https://user-images.githubusercontent.com/906069/119269025-dfbcb500-bbf5-11eb-983c-fc415b8428e0.png )
Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2021-05-23 21:55:51 +00:00
Florian Diebold
b8262099cc
Get rid of field_type again
2021-05-23 23:54:35 +02:00
Lukas Tobias Wirth
da74c66947
Correctly resolve crate name in use paths when import shadows itself
2021-05-23 19:37:01 +02:00
Florian Diebold
7a0c93c58a
Infer correct expected type for generic struct fields
2021-05-23 18:45:44 +02:00
Florian Diebold
4a6cdd776d
Record method call substs and use them in call info
2021-05-23 18:24:21 +02:00
Aramis Razzaghipour
4d4dbcfead
Give ‘unsafe’ semantic token modifier to unsafe traits
2021-05-23 21:45:10 +10:00
Florian Diebold
34a3bc4196
Paper over #8931 a bit more
...
The problem was the skipping of binders in
`resolve_method_call_as_callable`; this still doesn't use the _correct_
substitution, but at least it doesn't return a type with free variables
in it.
Fixes #8931 .
2021-05-23 13:00:14 +02:00
Florian Diebold
a5d85a6356
Add test for #8931 and better checking
2021-05-23 12:52:41 +02:00