Commit Graph

566 Commits

Author SHA1 Message Date
hkalbasi
fa76f60cc1 Run cargo fmt on 1.72 2023-08-25 22:24:41 +03:30
Jessie Chatham Spencer
37e0e8af10 Implement extern crate completion 2023-08-20 16:36:59 +00:00
Lukas Wirth
eb6244c5f9 Record import aliases in symbol index 2023-08-18 11:46:35 +02:00
Lukas Wirth
637f496a81 fix: Fix auto-import (and completions) importing #[doc(hidden)] items 2023-08-17 12:30:19 +02:00
bors
49716e681a Auto merge of #15472 - Veykril:import-ide-support, r=Veykril
internal: Record import origins in ItemScope and PerNS

This records the import items definitions come from in the module scope (as well as what an import resolves to in an ItemScope). It does ignore glob imports as thats a lot more work for little to no gain, glob imports act as if the importing items are "inlined" into the scope which suffices for almost all use cases I believe (to my knowledge, attributes on them have little effect).

There is still a lot of work needed to make this available to the IDE layer, but this lays out the ground work for havin IDE layer support.

cc https://github.com/rust-lang/rust-analyzer/issues/14079
2023-08-17 09:56:42 +00:00
Lukas Wirth
a17d73ad36 Thread imports through the resolver 2023-08-17 10:52:13 +02:00
Lukas Wirth
c4e9b5ac64 Add import info to item scope dumps 2023-08-17 09:33:15 +02:00
Lukas Wirth
af8048266c Prepare ItemScope for IDE import resolution 2023-08-16 11:33:42 +02:00
bors
b771de3fdc Auto merge of #15179 - ponyii:fix/default-values-of-const-params-are-ignored, r=HKalbasi
the "add missing members" assists: implemented substitution of default values of const params

To achieve this, I've made `hir::ConstParamData` store the default values
2023-08-15 10:17:43 +00:00
bors
2fbe69d117 Auto merge of #15438 - Veykril:eager-parser-stuck, r=Veykril
fix: Fix parser being stuck in eager macro inputs

Fixes https://github.com/rust-lang/rust-analyzer/issues/15437
2023-08-12 14:30:38 +00:00
Lukas Wirth
9ac88d8d36 Fix parser being stuck in eager macro inputs 2023-08-12 08:27:27 +02:00
Lukas Wirth
9adff006e8 Simplify 2023-08-10 20:10:19 +02:00
Lukas Wirth
bfad781a77 Memoize block_item_tree_query 2023-08-10 19:24:39 +02:00
Lukas Wirth
fde2d9b47c Deduplicate FileId field in ModuleOrigin 2023-08-10 19:04:46 +02:00
Lukas Wirth
e5b23e3bc1 Derive block attributes from block item tree 2023-08-10 18:52:27 +02:00
bors
05b0612051 Auto merge of #15428 - Veykril:lsp-types-pin, r=Veykril
Fix pinned version of lsp-types

lsp-types published a new patch version that breaks semver with the proposed feature set (this is intended and documented), we unfortunately forgot to specify the patch version for the pinned version so this breaks us.
2023-08-09 18:07:44 +00:00
Lukas Wirth
7e04142f25 Fix pinned version of lsp-types 2023-08-09 20:06:08 +02:00
Lukas Wirth
63aba76735 Remove unnecessary ItemTreeId field in ImportSource 2023-08-09 17:06:52 +02:00
Lukas Wirth
c516dd51e9 Simplify 2023-08-09 15:54:10 +02:00
Lukas Wirth
992b928a93 Record import source IDs 2023-08-09 15:20:42 +02:00
ponyii
68e8379ec3 fixed a merge-caused error 2023-08-08 22:16:28 +04:00
ponyii
4ebdc6f052 syntax update: the default value of ConstParam turned from Expr into ConstArg 2023-08-08 21:57:54 +04:00
ponyii
52b4392724 the "add missing members" assists: implemented substitution of default values of const params 2023-08-08 21:57:54 +04:00
bors
af4ba46b40 Auto merge of #15405 - lowr:patch/doc-links-to-fields, r=Veykril
Support doc links that resolve to fields

Fixes #15331

Also removes `Resolver::resolve_module_path_in_trait_assoc_items()` and reimplements it in hir with other `Resolver` methods to decouple things a bit.
2023-08-08 14:13:27 +00:00
bors
f98d654ddf Auto merge of #15350 - max-heller:issue-11756, r=Veykril
Handle `#[cfg]`s on generic parameters

Records attributes on generic parameters in the item tree and filters out generic parameters disabled by `#[cfg]`s in `generic_params_query`.

Closes #11756
2023-08-08 13:05:26 +00:00
Lukas Wirth
cba39f8553 fix: Fix float parser hack creating empty NameRef tokens 2023-08-08 14:44:33 +02:00
Ryo Yoshida
0c433c23b1
Support doc links that resolve to fields 2023-08-07 00:59:35 +09:00
Lukas Wirth
042be329a7 Turn unresolved proc macro expansions into missing expressions 2023-08-05 20:00:37 +02:00
Max Heller
50db877bfa optimization and #[cfg] filtering for function generic params 2023-08-05 08:00:39 -04:00
hkalbasi
cc5664c5a2 Add rustc comment into while desugaring 2023-08-04 16:35:13 +03:30
bors
e37ec7262c Auto merge of #15373 - tadeokondrak:desugar-while-to-loop, r=HKalbasi
internal: Desugar while to loop and break

I was reading through rust-analyzer's code and was wondering why this wasn't desugared into a loop.
2023-08-04 07:26:18 +00:00
Max Heller
3205ed7a41 simplify storing generic parameter attributes in item tree 2023-08-02 09:19:56 -04:00
Lukas Wirth
ecb6d07d57 Add currently unused UseId variants 2023-08-02 14:53:45 +02:00
Lukas Wirth
f86f6a89eb Change terminology, do not name use items and use trees as imports 2023-08-02 14:19:38 +02:00
Lukas Wirth
6e2c3f610b Remove suspicious unwrap 2023-08-02 12:18:10 +02:00
Lukas Wirth
bcff166b3a Add ExternCrateDecl to HIR 2023-08-02 11:52:55 +02:00
Tadeo Kondrak
92a97c292a hir: Remove Expr::While
The previous commit desugared it to a loop.
2023-08-01 19:08:16 -06:00
Tadeo Kondrak
31bcba84f9 hir: Desugar while to loop and break 2023-08-01 19:04:36 -06:00
bors
151c750dac Auto merge of #15367 - Veykril:eager-macro-inputs, r=Veykril
fix: Strip unused token ids from eager macro input token maps
2023-08-01 11:23:02 +00:00
Lukas Wirth
e14d84d0a6 Skip out on single-segment immediate macro resolution when there are errors 2023-08-01 12:38:53 +02:00
Lukas Wirth
d999d34e39 Don't bail eager expansion when inner macros fail to resolve 2023-08-01 11:26:30 +02:00
bors
7736b656e2 Auto merge of #15361 - Veykril:eager-macro-inputs, r=Veykril
fix: Expand eager macros to delimited comma separated expression list

Prior to this, we were just parsing it as an expression which works fine for `()` and `[]` calls as those are tuple and array expressions respectively, but if tails for `{}` calls which with my recent changes reported errors for such eager macro invocations.
2023-07-31 14:24:29 +00:00
bors
cecbed98d8 Auto merge of #15360 - lowr:fix/mbe-transcribe-path-of-different-types, r=HKalbasi
Fixup path fragments upon MBE transcription

Fixes #14367

There are roughly two types of paths: paths in expression context, where a separator `::` between an identifier and its following generic argument list is mandatory, and paths in type context, where `::` can be omitted.

Unlike rustc, we need to transform the parsed fragments back into tokens during transcription. When the matched path fragment is a type-context path and is transcribed as an expression-context path, verbatim transcription would cause a syntax error.

This PR fixes up path fragments by inserting `::` to make sure they are syntactically correct in all contexts. Note that this works because expression-context paths are a strict superset of type-context paths.
2023-07-30 17:29:36 +00:00
Lukas Wirth
7c765d9f9e fix: Expand eager macros to delimited comma separated expression list 2023-07-30 17:31:26 +02:00
Ryo Yoshida
fd7435d463
Fixup path fragments upon MBE transcription 2023-07-30 23:36:42 +09:00
Lukas Wirth
df725d6b6d fix: Do not create fn macro calls with non-fn expanders 2023-07-30 12:18:19 +02:00
Max Heller
37a8493138 tests 2023-07-28 06:45:35 -04:00
Max Heller
008b639ef5 handle #[cfg]s on generic parameters 2023-07-27 21:17:10 -04:00
oxalica
59a3e42ac9
Fix unescaping of C string literals 2023-07-18 18:52:34 +08:00
bors
8e5f944317 Auto merge of #15282 - HKalbasi:mir, r=HKalbasi
Give real discriminant_type to chalk
2023-07-14 16:46:35 +00:00