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
Laurențiu Nicola
aa55ce9567
Merge commit 'baee6b338b0ea076cd7a9f18d47f175dd2ba0e5d' into sync-from-ra
2023-08-07 12:03:15 +03: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
Laurențiu Nicola
0155385b57
Merge commit '99718d0c8bc5aadd993acdcabc1778fc7b5cc572' into sync-from-ra
2023-07-24 12:21:34 +03:00
oxalica
59a3e42ac9
Fix unescaping of C string literals
2023-07-18 18:52:34 +08:00
Laurențiu Nicola
4704881b64
Merge commit '37f84c101bca43b11027f30ab0c2852f9325bc3d' into sync-from-ra
2023-07-17 16:49:15 +03: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
hkalbasi
50559118fb
Give real discriminant_type to chalk
2023-07-14 20:15:18 +03:30
Lukas Wirth
6a7b905c86
Fix the eager token maps by re-mapping the textranges between the input and input expansion
2023-07-13 09:22:38 +02:00
Lukas Wirth
d5f64f875a
Infallibe ExpandDatabase::macro_def
2023-07-10 16:23:29 +02:00
hkalbasi
4a444e768c
Implement recursion in mir interpreter without recursion
2023-07-07 15:07:29 +03:30
hkalbasi
3a1054fc1c
Replace x
with it
2023-07-06 17:33:17 +03:30
Lukas Wirth
7b36a73351
internal: Remove CfgExpander
2023-07-04 10:38:23 +02:00
Lukas Wirth
8886d707b8
Stronger typing for AstId and AstIdMap
2023-07-04 09:16:15 +02:00
bors
daba334611
Auto merge of #15206 - Veykril:let-else-fmt, r=Veykril
...
internal: Format let-else
As nightly finally got support for it I went ahead and formatted r-a with the latest nightly, then with the latest stable (in case other stuff changed)
2023-07-03 18:41:59 +00:00
Lukas Wirth
69cd3c30ac
Format let-else
2023-07-03 20:34:09 +02:00
bors
691600a885
Auto merge of #15181 - lowr:patch/import-map-purge-unused, r=Veykril
...
Clean up `ImportMap`
There are several things in `hir_def::import_map` that are never used. This PR removes them and restructures the code. Namely:
- Removes `Query::name_only`, because it's *always* true.
- Because of this, we never took advantage of storing items' full path. This PR removes `ImportPath` and changes `ImportInfo` to only store items' name, which should reduce the memory consumption to some extent.
- Removes `SearchMode::Contains` for `Query` because it's never used.
- Merges `Query::assoc_items_only` and `Query::exclude_import_kinds` into `Query::assoc_mode`, because the latter is never used besides filtering associated items out.
Best reviewed one commit at a time. I made sure each commit passes full test suite. I can squash the first three commits if needed.
2023-07-03 14:37:55 +00:00
Lukas Wirth
321e570d92
Don't diagnose builtin derives
2023-07-03 14:23:36 +02:00
hkalbasi
6f7452882a
Fix layout of simd types and respect align in mir interpreter
2023-07-02 00:42:33 +03:30
bors
76bcd9946a
Auto merge of #15169 - lowr:patch/impl-header-anon-lifetime, r=HKalbasi
...
Use anonymous lifetime where possible
Because anonymous lifetimes are *super* cool.
More seriously, I believe anonymous lifetimes, especially those in impl headers, reduce cognitive load to a certain extent because they usually signify that they are not relevant in the signature of the methods within (or that we can apply the usual lifetime elision rules even if they are relevant).
2023-06-30 16:57:20 +00:00
Ryo Yoshida
5db0e1a346
Restructure ImportMap
collection
2023-07-01 00:18:23 +09:00
Ryo Yoshida
2b106648a7
Only store item name instead of full path
2023-07-01 00:17:57 +09:00
Ryo Yoshida
860628af7c
Remove SearchMode:Contains
...
Also micro-optimizes fuzzy search.
2023-06-30 23:37:23 +09:00
Ryo Yoshida
8cd4e9f7ec
Merge assoc_items_only
and exclude_import_kinds
into assoc_mode
2023-06-30 23:37:10 +09:00
Ryo Yoshida
97b725e269
Remove name_only
from import map query
2023-06-30 23:35:55 +09:00
hkalbasi
f53f9230f0
Support #[derive_const(Trait)]
2023-06-29 20:58:35 +03:30
Ryo Yoshida
4e793e7859
Use anonymous lifetime where possible
2023-06-29 23:27:28 +09:00
bors
ad434fc4ac
Auto merge of #15157 - HKalbasi:tokio-test, r=HKalbasi
...
Fix runnable detection for `#[tokio::test]`
fix #15141
It is hacky, and it wouldn't work for e.g. this case:
```Rust
use ::core::prelude;
#[prelude::v1::test]
fn foo() {
}
```
But it works for the tokio case. We should use the name resolution here somehow, and after that we should probably also get rid of the ast based `test_related_attribute` function.
2023-06-28 20:02:00 +00:00
hkalbasi
7901538dc8
Fix runnable detection for #[tokio::test]
2023-06-28 23:31:08 +03:30
Ryo Yoshida
56dd5368f5
Refactor
...
- don't take `&self` as receiver for `Copy` types
- simplify `hir::Module::nearest_non_block_module()`
- style changes for consistency
2023-06-27 16:01:07 +09:00
Ryo Yoshida
a02846343f
Fix self
and super
path resolution in block modules
2023-06-27 15:29:08 +09:00
Josh Stone
380773b3e8
Upgrade to indexmap v2
2023-06-24 17:35:20 -07:00
hkalbasi
674cd5ab57
Add run-tests command
2023-06-22 19:33:37 +03:30
Lukas Wirth
8823db6c78
Bump more deps
2023-06-22 11:44:10 +02:00
bors
bc26e81cd5
Auto merge of #15070 - Veykril:analysis-stat-stuff, r=Veykril
...
internal: Report metric timings for file item trees and crate def map creation
2023-06-21 05:58:13 +00:00
David Lattimore
bea3a33d84
Change in-tree libs to workspace dependencies
2023-06-20 13:53:39 +10:00
hkalbasi
3c87825074
Use ArgumentV1
instead of Argument
2023-06-19 22:48:49 +03:30
Lukas Wirth
9476fdaaa9
HIR ExternCrateDecl
2023-06-19 14:15:08 +02:00
Lukas Wirth
0bde3fc77e
Intern use and extern crate items like other items
2023-06-19 13:51:44 +02:00
Laurențiu Nicola
9326cf7f0c
Merge commit 'cd3bf9fe51676b520c546460e6d8919b8c8ff99f' into sync-from-ra
2023-06-19 09:14:04 +03:00
Lukas Wirth
c3186202a2
Shrink size of hir::Binding
2023-06-18 12:03:04 +02:00
Lukas Wirth
83d7724629
fix: Add binding definition for for-expr iterator desugared binding
2023-06-18 11:44:01 +02:00
Lukas Wirth
58ac823864
Less eager parsing for module sources
2023-06-17 10:58:52 +02:00
Lukas Wirth
3484b5a116
internal: Do not allocate unnecessarily when importing macros from parent modules
2023-06-16 18:41:06 +02:00
bors
9c967d3809
Auto merge of #15053 - Veykril:crate-root-module-id, r=Veykril
...
internal: Add a CrateRootModuleId that encodes a module id that is always a crate root
2023-06-14 14:41:06 +00:00
Lukas Wirth
cf178cba8f
internal: Add a CrateRootModuleId that encodes a module id that is always a crate root
2023-06-14 15:41:06 +02:00
bors
07bc6cbcad
Auto merge of #15040 - lnicola:hash-state-name, r=Veykril
...
fix: Use a more obscure hasher name in derive expansion
Closes #15039
2023-06-13 06:13:35 +00:00
Laurențiu Nicola
0b441ca6a5
Use a more obscure hasher name in derive expansion
2023-06-13 08:50:27 +03:00
Lukas Wirth
abe249559d
internal: Give ConstBlockId and InTypeConstId named Location types
2023-06-12 18:21:17 +02:00
hkalbasi
a4695788ca
Add a bunch of fixme comments
2023-06-12 00:37:11 +03:30
hkalbasi
e83b56739f
Flatten the TypeOwnerId
2023-06-11 01:36:32 +03:30
hkalbasi
f8594f78bb
Use ConstArg
instead of Expr
for AstId
of InTypeConstId
2023-06-11 00:39:28 +03:30
hkalbasi
d9136df9e5
Handle return types for in type const bodies
2023-06-11 00:39:28 +03:30
hkalbasi
a481e004b0
Lower const params with a bad id
2023-06-11 00:39:28 +03:30
Lukas Wirth
b6fb35f20c
Shrink hir_expand::attr::AttrInput by boxing a variant
2023-06-10 01:21:52 +02:00
Lukas Wirth
a02b9b279e
internal: Lazy eager macros
2023-06-09 13:02:13 +02:00
hkalbasi
30e16e20d0
Fix unwrap on None in expanding format args
2023-06-08 00:17:22 +03:30
Ryo Yoshida
4f0c6fac17
fix: only generate trait bound for associated types in field types
2023-06-07 20:52:49 +09:00
Laurențiu Nicola
c48062fe2a
Merge commit 'aa9bc8612514d216f84eec218dfd19ab83f3598a' into sync-from-ra
2023-06-05 12:04:23 +03:00
Laurențiu Nicola
c3dbe7c717
Merge remote-tracking branch 'upstream/master' into sync-from-rust
2023-06-05 11:07:47 +03:00
bors
9d5c34a80e
Auto merge of #14970 - HKalbasi:mir-fix, r=HKalbasi
...
Detect "bound more than once" error and suppress `need-mut` for it.
Fix the `need-mut` false positive for `izip!`
2023-06-04 09:33:53 +00:00
hkalbasi
71f3e4b08c
Detect "bound more than once" error and suppress need-mut
for it.
2023-06-04 12:39:36 +03:30
Lukas Wirth
f9a9e40c0a
Update builtin attribute list
2023-06-04 10:02:11 +02:00
bors
0b4c09b1d2
Auto merge of #14941 - Veykril:def-map, r=Veykril
...
Shrink `DefMap`, share crate level items with block def maps
2023-06-01 16:42:12 +00:00
Lukas Wirth
11b937177b
Skip extern prelude path resolution in block def maps
2023-06-01 17:58:08 +02:00
bors
4458e7f190
Auto merge of #14942 - HKalbasi:for-loop-label, r=HKalbasi
...
fix bug in labeled for loop desugaring
fix https://github.com/rust-lang/rust-analyzer/pull/14892#discussion_r1213091393
2023-06-01 14:54:47 +00:00
hkalbasi
f4c52b40bd
fix bug in labeled for loop desugaring
2023-06-01 17:51:53 +03:30
Lukas Wirth
54e3ef658a
Rename nameres::CrateData to DefMapCrateData
2023-06-01 15:50:19 +02:00
Lukas Wirth
1e6406e223
Move extern prelude into CrateData
2023-06-01 15:49:05 +02:00
Lukas Wirth
bdca349573
Arc DefMap::data so the block def maps can share it
2023-06-01 15:27:05 +02:00
Lukas Wirth
5c466ccc2b
Refactor out some crate wide data in DefMap into nested struct
2023-06-01 15:04:38 +02:00
Lukas Wirth
dc7c6d43c7
Slightly shrink DefMap
2023-06-01 14:46:36 +02:00
Lukas Wirth
0e28202832
Insert missing expr/pat for leading comma tuples
2023-06-01 08:56:40 +02:00
Oli Scherer
1570299af4
Remove const eval limit and implement an exponential backoff lint instead
2023-05-31 10:24:17 +00:00