Ryo Yoshida
4db87f9346
Fix release channel detection
...
See bootstrap code in rust-lang/rust for versioning details: e49122fb1c/src/bootstrap/lib.rs (L1244)
2023-04-18 02:12:17 +09:00
Laurențiu Nicola
160ab88bb9
Bump bitflags
2023-04-17 18:42:59 +03:00
bors
5111207d9a
Auto merge of #14591 - justahero:gh-14516, r=Veykril
...
Restrict "sort items" assist for traits & impls
This restricts the "sort items alphabetically" assist when the selection is inside a `Impl` or `Trait` node & intersects with one of the associated items.
It re-orders the conditional checks of AST nodes in the `sort_items` function to check for more specific nodes first before checking `Trait` or `Impl` nodes. The `AssistContext` is passed into the `add_sort_methods_assist` function to check if the selection intersects with any inner items, e.g. associated const or type alias, function. In this case the assist does not apply.
Fixes : #14516
2023-04-17 12:45:31 +00:00
Sebastian Ziebell
c1712e55c6
Restrict "sort items" assist inside Impl & Trait
...
This fixes the applicability of the "sort items alphabetically" assist
when the selection is inside a `Trait` or `Impl`. It's now tested if the
selection is inside or overlaps with an inner node, e.g. associated
const or type alias, function.
2023-04-17 12:36:32 +02:00
bors
bab80dae44
Auto merge of #14588 - Veykril:macro-def-err, r=Veykril
...
fix: Actually bring back LRU limit for macro_expand query
2023-04-16 21:13:02 +00:00
Lukas Wirth
fd4bbcabe8
Actually bring back LRU limit for macro_expand query
2023-04-16 23:12:25 +02:00
bors
9b54e39762
Auto merge of #14587 - Veykril:macro-def-err, r=Veykril
...
fix: Bring back LRU limit for macro_expand query
Should fix the memory increase
2023-04-16 19:30:42 +00:00
Lukas Wirth
76718ea2fc
Bring back LRU limit for macro_expand query
2023-04-16 21:30:04 +02:00
bors
924d30a772
Auto merge of #14585 - Veykril:macro-def-err, r=Veykril
...
Make `ExpandDatabase::parse_macro_expansion` and `ExpandDatabase::parse_or_expand` infallible
2023-04-16 18:50:02 +00:00
Lukas Wirth
4ea5d7f6a0
Re-introduce option for macro_arg to prevent calling macros with empty inputs
2023-04-16 20:26:26 +02:00
bors
697b335fda
Auto merge of #14584 - Veykril:macro-def-err, r=Veykril
...
internal: Report item-level macro expansion syntax errors
2023-04-16 17:40:20 +00:00
Lukas Wirth
a2a3fecae3
Option begone part 2
2023-04-16 19:20:48 +02:00
Lukas Wirth
96a774261f
Option begone part 1
2023-04-16 19:20:42 +02:00
Lukas Wirth
0f4ffaa5af
Fix duplicate eager expansion errors
2023-04-16 19:20:35 +02:00
Lukas Wirth
d1632c2727
Report syntax errors from item level macro expansions
2023-04-16 17:22:06 +02:00
Lukas Wirth
71b50f9f09
Record eager expansion errors in EagerCallInfo
2023-04-16 16:11:59 +02:00
Lukas Wirth
6ae8d49e15
Simplify eager macro error handling
2023-04-16 15:46:12 +02:00
bors
f0a40c3a0e
Auto merge of #14583 - Veykril:macro-def-err, r=Veykril
...
internal: Report macro definition errors on the definition
We still report them on the call site as well for the time being, and the diagnostic doesn't know where the error in the definition comes from, but that can be done later on
2023-04-16 12:17:24 +00:00
Lukas Wirth
a5558cdfe5
internal: Report macro definition errors on the definition
2023-04-16 14:15:59 +02:00
bors
c0889589d1
Auto merge of #14581 - Veykril:layout-ty, r=Veykril
...
internal: Move layout logic from hir-def to hir-ty
2023-04-16 10:22:24 +00:00
Lukas Wirth
0bb9a17312
internal: Move layout logic from hir-def to hir-ty
2023-04-16 12:21:12 +02:00
Ryo Yoshida
83a93f4bd3
Parse inline const pattern in nested patterns
2023-04-16 04:28:37 +09:00
Ryo Yoshida
89a1439de3
Parse exclusive range pattern
2023-04-16 04:28:29 +09:00
bors
b218009f46
Auto merge of #14576 - HKalbasi:dev2, r=HKalbasi
...
Fix explicit deref problems in closure capture
fix the `need-mut` part of #14562
Perhaps surprisingly, it wasn't unique immutable borrow. The code still doesn't emit any of them, and I think those won't happen in edition 2021 (which is currently the only thing implemented), since we always capture `&mut *x` instead of `&mut x`. But I'm not very sure about it.
2023-04-14 13:23:49 +00:00
Laurențiu Nicola
febd5065ad
Make inherent_impls_in_block and trait_impls_in_block infallible
2023-04-14 16:03:45 +03:00
hkalbasi
7cb4318331
Fix explicit deref problems in closure capture
2023-04-14 15:32:40 +03:30
bors
96407424de
Auto merge of #14574 - Veykril:blocks, r=Veykril
...
internal: Make block_def_map infallible
2023-04-14 11:48:33 +00:00
Lukas Wirth
c32d51979d
internal: Make block_def_map infallible
2023-04-14 13:17:38 +02:00
bors
4667379f7e
Auto merge of #14575 - Veykril:attrs, r=Veykril
...
internal: Put Attrs behind a query instead of AttsWithOwner
We call this for pretty much every item, so this is unnecessary wasted memory
2023-04-14 11:17:18 +00:00
Lukas Wirth
ed3a5eac3c
internal: Put Attrs behind a query instead of AttsWithOwner
2023-04-14 12:47:33 +02:00
bors
1a331689d1
Auto merge of #14573 - Veykril:expr-scopes, r=Veykril
...
internal: Allocate ExprScopes ScopeEntries in a single arena instead of per ScopeData
2023-04-14 10:22:33 +00:00
Lukas Wirth
ce0896b78c
Allocate ExprScopes ScopeEntries in a single arena instead of per ScopeData
2023-04-14 12:05:11 +02:00
Lukas Wirth
9fb1b04826
Encode closing delimiter span in FlatTrees
2023-04-14 10:34:41 +02:00
Lukas Wirth
3c7b6716d1
fix: Fix inverted code lens resolve file version check
2023-04-14 08:41:53 +02:00
Jonas Schievink
901c8a4259
Map tokens from include!
expansion to the included file
2023-04-13 17:41:24 +02:00
bors
41ee5ca79d
Auto merge of #14559 - Veykril:version-code-lens, r=Veykril
...
internal: Skip code lens resolution for mismatched document versions
Closes https://github.com/rust-lang/rust-analyzer/issues/12718
2023-04-13 08:55:40 +00:00
Lukas Wirth
0286e46e5f
internal: Skip code lens resolution for mismatched document versions
2023-04-13 10:55:28 +02:00
bors
b093423d12
Auto merge of #14556 - Veykril:sysroot-no-core-warn, r=Veykril
...
internal: Warn when loading sysroot fails to find the core library
Should help a bit more with user experience, before we only logged this now we show it in the status
Closes https://github.com/rust-lang/rust-analyzer/issues/11606
2023-04-13 06:41:06 +00:00
Lukas Wirth
dd5c3c30b6
internal: Warn when loading sysroot fails to find the core library
2023-04-13 08:40:14 +02:00
Ryo Yoshida
c978d4bf0c
Implement text edits for inlay hints
2023-04-12 19:03:57 +09:00
Ryo Yoshida
fcbc250723
Add field for text edits to InlayHint
2023-04-12 19:03:55 +09:00
Ryo Yoshida
ac03de773f
Add flag to disallow opaque types for DisplayTarget::SourceCode
2023-04-12 19:03:48 +09:00
hecatia-elegua
398af0259f
Merge branch 'master' into alias-based-completion2
2023-04-11 21:14:52 +02:00
bors
7501d3b721
Auto merge of #14551 - lowr:patch/no-unstable-item-compl-on-stable, r=Veykril
...
Fix faulty variable extraction
Followup to #14549
Fixes https://github.com/rust-lang/rust-analyzer/pull/14549#discussion_r1163128814 and https://github.com/rust-lang/rust-analyzer/pull/14549#discussion_r1163132104
2023-04-11 17:43:15 +00:00
Ryo Yoshida
0a638676d1
Fix faulty variable extraction
2023-04-12 02:35:43 +09:00
bors
a1af8bb141
Auto merge of #14548 - Veykril:smol-str, r=Veykril
...
minor: Bump smol-str
2023-04-11 15:03:24 +00:00
bors
7afd2048f0
Auto merge of #14544 - HKalbasi:dev, r=Veykril
...
Infer types of nested RPITs
fix https://github.com/rust-lang/rust-analyzer/issues/14474#issuecomment-1501235394
2023-04-11 14:49:04 +00:00
bors
fd276218ec
Auto merge of #14549 - lowr:patch/no-unstable-item-compl-on-stable, r=Veykril
...
Don't suggest unstable items on stable toolchain
Closes #3020
This PR implements stability check in `ide-completion` so that unstable items are only suggested if you're on nightly toolchain.
It's a bit unfortunate `CompletionContext::check_stability()` is spammed all over the crate, but we should call it before building `CompletionItem` as you cannot get attributes on the item it's completing from that struct. I looked up every callsite of `Builder::add_to()`, `Completions::add[_opt]()`, and`Completions::add_all()` and inserted the check wherever necessary.
The tests are admittedly incomplete in that I didn't add tests for every kind of item as I thought that would be too big and not worthwhile. I copy-pasted some existing basic tests in every test module and adjusted them.
2023-04-11 14:34:47 +00:00
bors
600283f2de
Auto merge of #14550 - HKalbasi:mir, r=HKalbasi
...
Fix inference in nested closures
fix https://github.com/rust-lang/rust-analyzer/pull/14470#issuecomment-1503084796
2023-04-11 13:34:49 +00:00
hkalbasi
85f9235de8
fix inference in nested closure
2023-04-11 17:02:00 +03:30
Lukas Wirth
1456b53051
Bump smol-str
2023-04-11 14:39:19 +02:00
Ryo Yoshida
e6e48728da
Add tests for stability check in completion
2023-04-11 21:21:15 +09:00
Ryo Yoshida
0ce71dd76f
completion: check stability
2023-04-11 21:21:13 +09:00
Ryo Yoshida
584d2697cc
Add toolchain
meta for tests
2023-04-11 21:21:10 +09:00
bors
5d41affc77
Auto merge of #14547 - Veykril:extract_adjust, r=Veykril
...
fix: Fix receiver adjustments for extract_variable assist
2023-04-11 12:01:47 +00:00
Lukas Wirth
72d47144e8
fix: Fix receiver adjustments for extract_variable assist
2023-04-11 14:01:23 +02:00
bors
f9f443076a
Auto merge of #14540 - AmrDeveloper:disallow_extract_fun_single_brace, r=Veykril
...
Fix allow extracting function from single brace of block expression
Fix allow extracting function when selecting either `{` or `}`
Fix #14514
2023-04-11 10:10:25 +00:00
AmrDeveloper
5ded22065e
Make all kind of braces not applicable in function extraction
2023-04-11 11:22:52 +02:00
bors
fa3db447d7
Auto merge of #14536 - ClSlaid:feat/reorder-impl-items/not-applicative-editing-assoc-items, r=Veykril
...
fix: restrict applicable range of `reorder-impl-trait-items`
This PR should complete the need for restricting the applicable range of `reorder-impl-trait-items`.
When the cursor is in the associated items of the `impl` range, the assist will be disabled.
Fix : #14515
## Showcases
Note: If there is any available `code-action` (`ide-assist`) available, a lightbulb icon from `lspsaga` will show in the left.
- cursor in `impl` headers
![code action available](https://user-images.githubusercontent.com/44747719/230756854-7b236018-cfa8-4005-b589-2996ec42917f.png )
Code action is available. And it is reordering impl items.
![code action detail](https://user-images.githubusercontent.com/44747719/230756971-341c7fbc-f2ba-4715-a1e5-b1add984d4dd.png )
- cursor in `impl` associated items
![code action unavailable](
https://user-images.githubusercontent.com/44747719/230756906-bee7784e-bd9d-49b2-801b-743c94b4af54.png )
2023-04-11 07:36:42 +00:00
hkalbasi
a584cb998f
Infer types of nested RPITs
2023-04-11 04:32:11 +03:30
hkalbasi
59b6f2d9f2
Compute closure captures
2023-04-10 23:04:34 +03:30
AmrDeveloper
2afc124cb9
Fix allow extracting function from single brace of block expression
2023-04-09 23:44:31 +02:00
bors
51d5862caf
Auto merge of #14538 - Veykril:project-link-fix, r=Veykril
...
fix: Fix project linking popup appearing for modules that can be linked to a crate
should fix https://github.com/rust-lang/rust-analyzer/issues/14523
2023-04-09 08:18:12 +00:00
Lukas Wirth
98a673c4a8
fix: Fix project linking popup appearing for modules that can be linked to a crate
2023-04-09 10:17:58 +02:00
蔡略
475aa2839f
refactor: correct test sample
...
giving a sorted file is useless
Signed-off-by: 蔡略 <cailue@bupt.edu.cn>
2023-04-09 00:24:25 +08:00
蔡略
e90e1901ef
feat: restrict applicable range of reorder-impl-trait-items
2023-04-09 00:14:48 +08:00
hkalbasi
c54cb88950
Add bounds for associated types in derive macro
2023-04-07 19:33:14 +03:30
Lukas Wirth
435d585d0c
Revert "Add bounds for fields in derive macro"
2023-04-07 11:01:17 +02:00
bors
bca364c3fe
Auto merge of #14525 - Veykril:hir-pretty, r=Veykril
...
internal: Remove parameter names from function item tree
2023-04-07 07:57:58 +00:00
Lukas Wirth
79c4c4fb48
Remove parameter names from function item tree
2023-04-07 09:57:19 +02:00
bors
d73161b491
Auto merge of #14524 - Veykril:hir-pretty, r=Veykril
...
internal: Render function parameters in hir-def pretty printing
2023-04-07 07:34:45 +00:00
Lukas Wirth
513d4a9c9a
Render function parameters in hir-def pretty printing
2023-04-07 09:34:04 +02:00
hkalbasi
0241b52dad
Add bounds for fields in derive macro
2023-04-07 02:21:46 +03:30
bors
e739c999cd
Auto merge of #14511 - HKalbasi:dev, r=Veykril
...
Always reborrow mutable reference receiver in methods
Dependency of #14470
2023-04-06 21:18:15 +00:00
hkalbasi
7ba93cb8cf
Always reborrow reference receiver in methods
2023-04-07 00:32:28 +03:30
Ryo Yoshida
5ab4e64a4c
fix: unify types in infer_expr_coerce_never()
2023-04-07 05:46:30 +09:00
Lukas Wirth
f742943a4b
Don't recreate Hygiene unnecessarily
2023-04-06 21:16:11 +02:00
Lukas Wirth
b7c443569a
Don't unnecessarily query the ast_id_map for blocks if they aren't interned
2023-04-06 20:19:59 +02:00
Lukas Wirth
a1b96b1e00
Remove unnecessary Names from FunctionData::params
2023-04-06 20:14:51 +02:00
Lukas Wirth
3f5c9920d6
Move hir_def::builtin_attr to hir_def::attr::builtin
2023-04-06 19:55:49 +02:00
Lukas Wirth
12b069f434
Move hir_def::keys to hir_def::dyn_map
2023-04-06 19:49:33 +02:00
Lukas Wirth
40c068f502
Use hir_def::builtin_attr::find_builtin_attr_idx
2023-04-06 19:44:29 +02:00
Lukas Wirth
99b69525f4
hir_def::expr -> hir_def::hir, hir_def::type_ref -> hir_def::hir::type_ref
2023-04-06 19:36:25 +02:00
Lukas Wirth
8e7c104b3a
Move hir_def::adt to hir_def::data::adt
2023-04-06 19:23:29 +02:00
bors
3dd17bcfc3
Auto merge of #14512 - bvanjoi:fix-14489, r=Veykril
...
fix(ide): highlight escapes in char
close #14489
before:
![image](https://user-images.githubusercontent.com/30187863/230414343-16f34d31-e2a1-460b-b09f-f288b196c54e.png )
after:
![image](https://user-images.githubusercontent.com/30187863/230414581-b8c37355-6626-4745-9f2b-3d9d4f804b47.png )
2023-04-06 16:03:30 +00:00
hecatia-elegua
33ee157f3b
Render alias text for use imports
...
* removes one method breaking the flow
2023-04-06 17:25:30 +02:00
bvanjoi
f0c74b30ed
fix(ide): highlight escapes in char
2023-04-06 23:20:12 +08:00
Lukas Wirth
fbb1bd5880
Re-enable controlflow outside loop diagnostic
2023-04-06 15:37:53 +02:00
Lukas Wirth
0e7117900c
internal: Resolve labels in body lowering
2023-04-06 14:21:20 +02:00
bors
e9e57725aa
Auto merge of #14505 - Veykril:block-trait-impls, r=Veykril
...
fix: Fix block local impl trait solving regressions
Fixes https://github.com/rust-lang/rust-analyzer/issues/14443
2023-04-06 08:37:33 +00:00
Lukas Wirth
1c16e4ee97
fix: Fix block local impl trait solving regressions
2023-04-06 10:37:00 +02:00
bors
e3e324d830
Auto merge of #14432 - Veykril:proc-macro-srv, r=lnicola
...
Drop support for non-syroot proc macro ABIs
This makes some bigger changes to how we handle the proc-macro-srv things, for one it is now an empty crate if built without the `sysroot-abi` feature, this simplifies some things dropping the need to put the feature cfg in various places. The cli wrapper now actually depends on the server, instead of being part of the server that is just exported, that way we can have a true dummy server that just errors on each request if no sysroot support was specified.
2023-04-06 08:04:55 +00:00
bors
ea22d245b6
Auto merge of #14499 - DropDemBits:drive-by-fixmes, r=Veykril
...
minor: Fix some simple FIXMEs
Each FIXME fix has been split into its own commit, since they're all pretty independent changes.
(Forgot to open a PR for this a few days ago, oops)
2023-04-05 20:42:55 +00:00
hecatia-elegua
b4515d987f
Add doc(alias)-based use and other mod completion
2023-04-05 22:08:59 +02:00
Ryo Yoshida
0a2d0b15a1
Add regression test for #10989
2023-04-06 03:39:59 +09:00
hecatia-elegua
f87f468dbd
Add doc(alias)-based function name completion
2023-04-05 19:35:21 +02:00
hecatia-elegua
410acd7188
Add doc(alias)-based field completion
2023-04-05 19:28:55 +02:00
bors
e8bad53d63
Auto merge of #14455 - jplatte:convert-nested-function-to-closure, r=Veykril
...
Convert nested function to closure assist
Continuation of / closes #13467 .
Resolves #13230 .
r? `@Veykril`
2023-04-05 17:28:46 +00:00
Jonas Platte
bc704e127d
Address another round of review comments
2023-04-05 18:48:21 +02:00
bors
da9c0bd0a7
Auto merge of #14442 - DropDemBits:structured-snippet-api, r=Veykril
...
internal: Implement Structured API for snippets
Fixes #11638 (including moving the cursor before the generated type parameter)
Adds `add_tabstop_{before,after}` for inserting tabstop snippets before & after nodes, and `add_placeholder_snippet` for wrapping nodes inside placeholder nodes.
Currently, the snippets are inserted into the syntax tree in `SourceChange::commit` so that snippet bits won't interfere with syntax lookups before completing a `SourceChange`.
It would be preferable if snippet rendering was deferred to after so that rendering can work directly with text ranges, but have left that for a future PR (it would also make it easier to finely specify which text edits have snippets in them).
Another possible snippet variation to support would be a group of placeholders (i.e. placeholders with the same tabstop number) so that a generated item and its uses can be renamed right as it's generated, which is something that is technically supported by the current snippet hack in VSCode, though it's not clear if that's a thing that is officially supported.
2023-04-05 14:33:30 +00:00