Commit Graph

28094 Commits

Author SHA1 Message Date
bors
0ffc1ef115 Auto merge of #16775 - Veykril:parse-macro-parse, r=Veykril
fix: Remove accidental dependency between `parse_macro_expansion` and `parse`

Turns out my idea from https://github.com/rust-lang/rust-analyzer/pull/15251 causes all builtin derive expansions to obviously rely on the main parse, meaning the entire `macro_arg` layer becomes kind of pointless. So this reverts that PR again.
2024-03-07 10:47:35 +00:00
bors
a1fda6476c Auto merge of #16742 - alibektas:13529/source_root_tree, r=Veykril
internal: Implement parent-child relation for `SourceRoot`s

This commit adds the said relation by keeping a map of type `FxHashMap<SourceRootId,Option<SourceRootId>>` inside the `GlobalState`. Its primary use case is reading `rust-analyzer.toml`(#13529)  files that can be placed in every local source root. As a config will be found by traversing this "tree" we need the parent information for every local source root. This commit omits defining this relation for library source roots entirely.
2024-03-07 10:30:08 +00:00
bors
00f6a7aced Auto merge of #16772 - Veykril:salsa-tracing, r=Veykril
internal: Add tracing spans to macro generated database
2024-03-07 10:16:53 +00:00
Lukas Wirth
bd0ffb0248 Remove accidental dependency between parse_macro_expansion and parse 2024-03-07 11:16:40 +01:00
Lukas Wirth
9c2fa76c84 Dedup hprof stuff 2024-03-07 10:21:50 +01:00
Lukas Wirth
09d33f3e1e Add diagnostics integrated benchmark 2024-03-07 09:33:48 +01:00
Lukas Wirth
a3b6e891ea Add tracing spans to macro generated database 2024-03-06 20:19:36 +01:00
Ali Bektas
9c50d129da Opt for FxHashMap<Id,Id> instead of <Id,Option<Id>> and apply requested changes 2024-03-06 19:55:04 +01:00
Ali Bektas
a15cc86c64 Implement parent-child relation for SourceRoots
This commit adds the said relation by keeping a map of type `FxHashMap<SourceRootId,Option<SourceRootId>>`
inside the `GlobalState`. Its primary use case is reading the rust-analyzer.toml files that can be
placed under every local source root. As a config will be found by traversing this "tree" we need the parent information
for every local source root. This commit omits defining this relation for library source roots entirely.
2024-03-06 19:55:04 +01:00
bors
ce15e73a8e Auto merge of #16773 - Veykril:text-explorer, r=Veykril
fix: Add config and capability for test explorer
2024-03-06 18:26:40 +00:00
Lukas Wirth
1c6d1b4f2a fix: Add config and capability for test explorer 2024-03-06 19:20:58 +01:00
Wyatt Herkamp
4f0bc1a314 Typo 2024-03-06 11:51:45 -05:00
Wyatt Herkamp
255ba692aa Added tests, added Union Support, and code cleanup 2024-03-06 10:55:47 -05:00
bors
e5889c9b43 Auto merge of #16770 - roife:fix-issue-16278, r=Veykril
fix: panic when using float numbers without dots in chain calls

Fix #16278.

This PR fixes the panic caused by using floating-point numbers without a dot (such as `1e2`) in chain calls.

-------------

Although this syntax is very odd 🤣, r-a should not panic.
2024-03-06 15:38:35 +00:00
roife
91d181feff minor: fmt and clippy 2024-03-06 23:32:40 +08:00
roife
e2daee61bc test: add test for float_split_scientific_notation 2024-03-06 22:51:22 +08:00
roife
03420c330e fix: panic when split float numbers in scientific notation 2024-03-06 22:50:50 +08:00
bors
b85d38f7d6 Auto merge of #16755 - Veykril:rustup-bins, r=Veykril
For toolchain binaries use the full path found in $PATH

Fixes https://github.com/rust-lang/rust-analyzer/issues/16754
2024-03-06 14:47:32 +00:00
bors
1a55ab30f6 Auto merge of #16769 - ShoyuVanilla:issue-15412, r=Veykril
fix: Function argument type inference with associated type impl trait

Fixes #15412
2024-03-06 12:51:10 +00:00
Shoyu Vanilla
a8f56112ea fix: Function argument type inference with associated type impl trait 2024-03-06 21:16:41 +09:00
bors
52d8ae791d Auto merge of #16766 - roife:fix-issue-15198, r=Veykril
fix: keep attributes in assist 'generate_delegate_trait'

fix #15198.

This PR address the issue that `impl` generated by `generate_delegate_trait` doesn't keep attributes.
2024-03-06 09:27:49 +00:00
roife
5c9ce7b11f test: add tests for keeping attrs in assist 'generate_delegate_trait' 2024-03-06 15:32:49 +08:00
roife
faea7fca01 fix: keep attrs for assist 'generate_delegate_trait' 2024-03-06 15:32:26 +08:00
bors
767d5d3eab Auto merge of #16662 - HKalbasi:test-explorer, r=HKalbasi
Add test explorer

This PR implements the vscode testing api similar to #14589, this time using a set of lsp extensions in order to make it useful for clients other than vscode, and make the vscode client side logic simpler (its now around ~100 line of TS code)

Fix #3601
2024-03-05 20:50:26 +00:00
hkalbasi
44be2432f5 Add test explorer 2024-03-06 00:05:29 +03:30
bors
916914418a Auto merge of #16763 - regexident:param-accessors, r=Veykril
Add `fn index()` and `fn parent_fn()` accessors for `hir::Param`/`hir::SelfParam`

(the PR is motivated by an outside use of the `ra_ap_hir` crate that would benefit from being able to access a `hir::Param`'s/`hir::SelfParam`'s index and parent function)
2024-03-05 15:12:18 +00:00
Vincent Esche
bf141310f8 Add fn index() accessor for hir::Param 2024-03-05 16:02:22 +01:00
Vincent Esche
1afeea85ff Add fn parent_fn() accessors for hir::Param & hir::SelfParam 2024-03-05 16:01:01 +01:00
Wyatt Herkamp
6027eae51e Fix Tests + Fix Warnings 2024-03-05 08:34:52 -05:00
Wyatt Herkamp
b45cfe15b5 Added quickfix for unresolved field. 2024-03-05 08:07:21 -05:00
bors
223238d9e7 Auto merge of #16759 - roife:fix-goto-def-for-constants-in-range-pattern, r=Veykril
fix: goto-definition for constants inside range pattern

Fix #15653.

This PR addresses the issue where it was not possible to navigate to constants in range patterns, specifically including two major changes:

1. Previously, both the `start` and `end` fields in `Pat::Range` were of type `LiteralOrConst`. When performing `goto-definition` on constants inside range patterns, r-a would use `resolve_bind_pat_to_const` to find their definitions. However, because the content of a `Const` is not `Pat` but `Path`, it was not stored in the `source_map`, so `resolve_bind_pat_to_const` would returns `None`. This PR changes them to `Const(PatId)`, so that during the lowering process, they are considered as a `pat`, allowing their definitions to be found later through `resolve_bind_pat_to_const`.

2. The process related to range patterns in MIR-lowering has been modified to correctly handle the above changes.
2024-03-05 12:35:03 +00:00
bors
7c786ed96f Auto merge of #16761 - Young-Flash:ignore_hidden, r=Veykril
minor: remove `ignore-hidden = false`

run `typos` locally and get
```txt
error: `ND` should be `AND`
  --> ./.git/objects/20/a90c507b0c92883b10c29447a56d30bf9e8d57:1:515
  |
1 | xM�{L�a�Cʒ��2�DG$�Q�+1�M.[��9o��z/��<ou�Tn�ICn��˺g�VG�BFmg�j5˵�:2�p�z�����w�ۃ]�V�˼��>>���T$�
                                                                                                Đ��bgJ博3�gzr�ꝛQ�p��x����� u���"Ui"�gw��f�;�>�;���d��0�~�nvx>���+u��;c\��~�T,Ԏ�ԁ��惵���>�[����B�L8R` ��8V� ��~��lrN~��>�s�Y�Z�p"�T�mFA܁�KJ[�b�Ko���>^��Y�
                     c��7�r��0�>{Wl��ꉔ����#��E��L���#�ehm�fiA�h��9#E�������W�(\�h���`���Ca� ��H��� ;qp������:(.i���{*>�"���%���=;4O/ =�:�EZ�gD�)m��������A��ϋ��c�I���e�"��8�[r�%�}CY����=p[F�D,G��d��،��}ms��^��^�.�UC�ND
  |
```
we should ignore `.git`
2024-03-05 12:20:56 +00:00
Young-Flash
b06726bebe remove ignore-hidden = false 2024-03-05 20:16:32 +08:00
roife
9cc3a9cfc2 fix: formatting 2024-03-05 19:55:31 +08:00
Lukas Wirth
d21f88883b Remove some unnecessary cloning in method_resolution 2024-03-05 12:39:27 +01:00
Lukas Wirth
593156a357 Re-use InferenceTable by snapshotting in method resolution 2024-03-05 12:39:27 +01:00
roife
16995ceda9 test: add tests for constants inside range pattern 2024-03-05 19:31:20 +08:00
roife
96a7c6ae3c fix: mir for range pattern 2024-03-05 19:31:20 +08:00
roife
ece18fecfa fix: resolve sub-patterns inside range pattern 2024-03-05 19:31:20 +08:00
bors
2898c4217d Auto merge of #16758 - Veykril:cargo-lock, r=Veykril
Update Cargo.lock
2024-03-05 11:17:42 +00:00
Lukas Wirth
00a6cc0664 Update Cargo.lock 2024-03-05 12:16:19 +01:00
bors
676455f911 Auto merge of #16757 - Veykril:style-lints, r=Veykril
fix: Put style lints behind disabled-by-default config

Fixes https://github.com/rust-lang/rust-analyzer/issues/16542
Fixes https://github.com/rust-lang/rust-analyzer/issues/16725
cc https://github.com/rust-lang/rust-analyzer/issues/16628

Our diagnostic infra is not yet setup for those kinds of diagnostics
2024-03-05 10:45:05 +00:00
Lukas Wirth
8844640c6f fix: Put style lints behind disabled-by-default config 2024-03-05 11:43:23 +01:00
bors
124d5ff966 Auto merge of #16756 - Veykril:hover-trait, r=Veykril
internal: Adjust a few things for trait assoc item hovers

https://github.com/rust-lang/rust-analyzer/pull/15938 (minor turned major wrt diff because of test changes)
2024-03-05 10:16:04 +00:00
Lukas Wirth
b20e467373 internal: Adjust a few things for trait assoc item hovers 2024-03-05 11:06:36 +01:00
Lukas Wirth
6b48133e9a Prefer cargo proxies when setting RUSTUP_TOOLCHAIN 2024-03-05 10:44:17 +01:00
Lukas Wirth
c310aee8d6 For toolchain binaries ue the full path found in $PATH 2024-03-05 10:17:09 +01:00
Lukas Wirth
fe0daa7be3 Revert "prioritise rustup sysroots over system ones"
This reverts commit 9f1d4aa4b9.
2024-03-05 09:37:25 +01:00
bors
ce3216e0ae Auto merge of #15938 - Young-Flash:display_trait_item_when_hover, r=Veykril
feat: add hover display for trait assoc items

This PR enable preview assoc items when hover on `trait`

![image](https://github.com/rust-lang/rust-analyzer/assets/71162630/d9c3949c-33cf-4a32-aa97-3af46b28033a)

inspired by https://github.com/rust-lang/rust-analyzer/pull/15847
2024-03-05 08:26:53 +00:00
bors
0c2e9feaee Auto merge of #16752 - Lindronics:destructure-struct-binding, r=Veykril
fix: Don't destructure struct with no public fields

Unfortunately I missed this case in #16638.

If a struct only has private members, the assist should not be applicable. Though valid syntax exists (`Foo { .. }`), it isn't particularly useful. Since this case applies to a lot of common types (`Arc`, `Vec`, ...), it probably makes the most sense to hide the action.

As a side effect, this also disables the action for unit structs, where it also isn't particularly useful. I'd be open to changing it though if you think it makes more sense to keep it.

This also fixes the `make::record_pat_field_list` function to produce valid syntax if the field list is empty, as it is used in other places too.

## Current behaviour
```rust
// In crate `other_crate`
pub struct Foo { bar: i32 }

// In current crate
fn do_something(foo: other_crate::Foo) {}

// Becomes
fn do_something(other_crate::Foo { , .. }: other_crate::Foo) {}
```

## Fixed behaviour
Assist should not be applicable in this case anymore.
2024-03-05 08:03:13 +00:00