Commit Graph

94 Commits

Author SHA1 Message Date
Laurențiu Nicola
9d2cb42a41 ⬆️ rust-analyzer 2022-08-02 09:05:16 +03:00
Amos Wenger
a1f1b95d00 Merge commit 'e36a20c24f35a4cee82bbdc600289104c9237c22' into ra-sync-and-pms-component 2022-07-26 11:53:50 +02:00
Amos Wenger
dfe84494c1 Make macros test order-resistant 2022-07-24 16:48:06 +02:00
Amos Wenger
56c369db48 Sort when iterating through CrateGraph 2022-07-24 16:11:05 +02:00
Amos Wenger
d8c0d88e4f Sort in DefMap::dump, since HashMap iteration order isn't defined 2022-07-24 16:04:20 +02:00
Amos Wenger
ff317858c1 hir-def tests: sort results before comparing, since FxHashSet iteration order isn't guaranteed
(And, in fact, it failed on i686)
2022-07-24 15:55:26 +02:00
bors
d469e0de9a Auto merge of #12840 - Veykril:be-lazy, r=Veykril
internal: Use ItemTree for variant, field and module attribute collection in attrs_query

Less parsing = very good, should speed up lang item collection as that basically probes attributes of all enum variants which currently triggers parsing

Not fond of how this is searching for the correct index, ideally we'd map between HIR and item tree Id here but I am not sure how, storing the item tree ids in the HIR version doesn't work due to the usage of `Trace`...
2022-07-22 20:35:31 +00:00
Lukas Wirth
0081ef3834 Use ItemTree for modules in attrs_query 2022-07-22 22:17:13 +02:00
Lukas Wirth
5f9a5825e0 Use ItemTree for crate root attr_query collection 2022-07-21 09:23:30 +02:00
Lukas Wirth
1aadd9da92 internal: Use itemtree for variant and field attribute collection 2022-07-21 08:48:13 +02:00
Lukas Wirth
10c7ee7068 Simplify 2022-07-21 08:48:09 +02:00
bors
2f6c39005c Auto merge of #12827 - Veykril:be-lazy, r=Veykril
internal: Construct fewer `AstIdMap`s in lowering
2022-07-21 00:11:18 +00:00
Lukas Wirth
7bd2e305d6 Simplify 2022-07-21 02:06:26 +02:00
Lukas Wirth
c83f14a44a Remove AstIdMap from Expander as it is seldom needed 2022-07-21 02:01:07 +02:00
Lukas Wirth
e507807837 internal: Don't eagerly construct AstIdMaps 2022-07-20 15:12:00 +02:00
Amos Wenger
7e285e1ef5 Run cargo fmt 2022-07-20 15:06:15 +02:00
Amos Wenger
816f7fe12a Run cargo fix --edition-idioms 2022-07-20 15:02:08 +02:00
Amos Wenger
23d25a3094 Enable extra warnings required by rust-lang/rust 2022-07-20 15:00:17 +02:00
Amos Wenger
1b416473a3 Upgrade to expect-test@1.4.0
cf. https://github.com/rust-analyzer/expect-test/issues/33
cf. https://github.com/rust-lang/rust/pull/99444#issuecomment-1188844202
2022-07-19 13:00:45 +02:00
Artur Sinila
d9336a496c
fix: un-inline ConstScalarOrPath::from_expr_opt 2022-07-17 20:35:34 +03:00
bors
db6a85d358 Auto merge of #12778 - Logarithmus:feature/fix-negative-const-generics, r=flodiebold
Support negative, `char` & `bool` const generics

Before:
![Before](https://user-images.githubusercontent.com/29541480/179379832-0c3b2a74-fef6-427e-b89f-7e31d9c37b3d.png)

After:
![After](https://user-images.githubusercontent.com/29541480/179379863-b62475dd-e7bf-41f2-b437-08dfe55951af.png)

I tried to implement stuff like `Const<{NUM1 + 3 + NUM2}>` by using already existing constant evaluation mechanism for ordinary constants, but turned out to be harder than I thought, maybe because I've never ever tinkered with compilers before
2022-07-17 17:17:39 +00:00
Artur Sinila
83177a7cfe
fix: address suggestions 2022-07-17 18:22:11 +03:00
Artur Sinila
15f73008f8
refactor: inline some variables 2022-07-17 14:55:21 +03:00
Artur Sinila
a96f0aa7cd
feat: support negative const generic parameters
* feat: support `bool` & `char` const generics
2022-07-17 04:18:53 +03:00
bors
766c5f0861 Auto merge of #12689 - Veykril:macro-rec, r=Veykril
internal: Record all macro definitions in ItemScope

Fixes https://github.com/rust-lang/rust-analyzer/issues/12100

Doesn't resolve the shadowing issues though, fixing those is gonna be really tricky I believe unless we can come up with a nice scheme to "order" item tree items (using syntax ranges and file ids would be a pain and also a bad idea since that'll require us to potentially reparse files in collection).
2022-07-16 16:45:26 +00:00
bors
d3796adeaa Auto merge of #12772 - Veykril:nameres, r=Veykril
internal: Remove allocation in DefCollector::reseed_with_unresolved_attribute
2022-07-16 09:50:22 +00:00
Lukas Wirth
25090f0e6d internal: Remove allocation in DefCollector::reseed_with_unresolved_attribute 2022-07-16 11:17:15 +02:00
Lukas Wirth
7ff6c36716 fix: Don't show qualified path completions for private items 2022-07-15 13:30:43 +02:00
Jonas Schievink
df66eb74ab Implement ignore and index metavar expression 2022-07-11 18:31:42 +02:00
bors
c419aa9775 Auto merge of #12719 - davidlattimore:format-args-no-unsafe, r=jonas-schievink
Remove unnecessary unsafe from format_args expansion
2022-07-08 14:10:19 +00:00
Jonas Schievink
6c6ae965ba Update remaining GitHub URLs 2022-07-08 15:44:49 +02:00
David Lattimore
6f819e30e4 Remove unnecessary unsafe from format_args expansion 2022-07-08 14:56:18 +10:00
bors
c296e77767 Auto merge of #12695 - xuhongxu96:fix-12140, r=jonas-schievink
Complete type param/associated type in trait generic arg per arg index

- Fix #12140
- Also fix tidy check does not work for marks in multiline
2022-07-06 23:58:52 +00:00
Hongxu Xu
75fb3de310 Handle generic args per arg index
Add more test cases for generic args
2022-07-07 00:45:22 +08:00
bors
6edf624cbe Auto merge of #12690 - Veykril:inert-attrs, r=Veykril
internal: Update inert attribute list
2022-07-05 09:55:55 +00:00
Lukas Wirth
383ee6af5e internal: Update inert attribute list 2022-07-05 11:54:46 +02:00
Lukas Wirth
db49ac8734 internal: Record all macro definitions in ItemScope 2022-07-05 11:28:47 +02:00
Laurențiu Nicola
6669f388a2 Bump indexmap 2022-07-03 10:09:35 +03:00
Laurențiu Nicola
791f2a0bec Bump smallvec 2022-07-03 10:09:35 +03:00
Laurențiu Nicola
e6fcb23445 Bump either 2022-07-03 10:09:35 +03:00
Florian Diebold
9a12d0d6f2 Fix case of ignored/broken proc macro 2022-07-01 19:00:07 +02:00
bors
ed44fe52e4 Auto merge of #12668 - Veykril:mac-source-map, r=Veykril
fix: Simplify macro statement expansion handling

I only meant to fix https://github.com/rust-lang/rust-analyzer/issues/12644 but that somehow turned into a rewrite of the statement handling ... at least this fixes a few more issues in the IDE layer now
2022-07-01 14:46:48 +00:00
Lukas Wirth
e5e5a0932d Fix blocks not considering stmt without semi as tails 2022-07-01 16:25:52 +02:00
Lukas Wirth
8e764a8bb1 fix: Fix attribute macros on assoc items being discarded with disabled proc macros 2022-07-01 16:21:21 +02:00
Lukas Wirth
58d5c69a63 Fix Expr::MacroStmts using wrong scopes 2022-07-01 15:34:29 +02:00
Lukas Wirth
9165e3b381 Update hir-ty test outputs 2022-07-01 15:21:55 +02:00
Lukas Wirth
531e152390 fix: Simplify macro statement expansion handling 2022-07-01 14:49:30 +02:00
bors
2ff505ab48 Auto merge of #12428 - lowr:experimental/destructuring-assignment, r=flodiebold
feat: implement destructuring assignment

This is an attempt to implement destructuring assignments, or more specifically, type inference for [assignee expressions](https://doc.rust-lang.org/reference/expressions.html#place-expressions-and-value-expressions).

I'm not sure if this is the right approach, so I don't even expect this to be merged (hence the branch name 😉) but rather want to propose one direction we could choose. I don't mind getting merged if this is good enough though!

Some notes on the implementation choices:

- Assignee expressions are **not** desugared on HIR level unlike rustc, but are inferred directly along with other expressions. This matches the processing of other syntaxes that are desugared in rustc but not in r-a. I find this reasonable because r-a only needs to infer types and it's easier to relate AST nodes and HIR nodes, so I followed it.
- Assignee expressions obviously resemble patterns, so type inference for each kind of pattern and its corresponding assignee expressions share a significant amount of logic. I tried to reuse the type inference functions for patterns by introducing `PatLike` trait which generalizes assignee expressions and patterns.
  - This is not the most elegant solution I suspect (and I really don't like the name of the trait!), but it's cleaner and the change is smaller than other ways I experimented, like making the functions generic without such trait, or making them take `Either<ExprId, PatId>` in place of `PatId`.

in case this is merged:
Closes #11532
Closes #11839
Closes #12322
2022-06-30 09:14:12 +00:00
Florian Diebold
8b3ec12aac fix: Report proc macro errors in expressions correctly as well
They didn't have a krate before, resulting in the generic "proc macro
not found" error.

Also improve error messages a bit more.
2022-06-28 10:43:22 +02:00
Florian Diebold
45fd5e697f Improve comments 2022-06-24 14:19:18 +02:00