iDawer
5e8c586f3b
Refactor hir::diagnostics::MissingMatchArms fields, better naming
2023-03-10 18:22:32 +05:00
iDawer
8f189f62c6
Remove unnecessary argument
2023-03-10 16:35:04 +05:00
iDawer
c38aa5f4f0
Use anonymous lifetimes
2023-03-10 16:16:28 +05:00
bors
9fca0a4afe
Auto merge of #14316 - HKalbasi:master, r=HKalbasi
...
Fix stack overflow when derefrencing `&!`
fix #14310
2023-03-10 10:25:20 +00:00
hkalbasi
a980b562a7
Fix stack overflow when derefrencing &!
2023-03-10 13:44:34 +03:30
bors
070f8f8578
Auto merge of #14313 - Veykril:notifs, r=Veykril
...
Make project loading errors less intrusive
cc https://github.com/rust-lang/rust-analyzer/issues/14193 closes https://github.com/rust-lang/rust-analyzer/issues/9909
![image](https://user-images.githubusercontent.com/3757771/224274817-a5a8cb0c-7bda-454d-9772-5f839f360b9a.png )
2023-03-10 10:12:15 +00:00
Lukas Wirth
c03775e477
Fix is_quiescent reporting
2023-03-10 10:26:02 +01:00
Lukas Wirth
0d19ccb3df
Make project loading errors less intrusive
2023-03-10 09:49:37 +01:00
bors
1b5bba4535
Auto merge of #14312 - HKalbasi:master, r=lnicola
...
Revert #14285
fix #14305
2023-03-10 08:34:27 +00:00
hkalbasi
71e1c025f8
Revert #14285
2023-03-10 11:57:30 +03:30
Lukas Wirth
116775bc83
Don't attempt to calculate diagnostics in library crates
2023-03-10 09:08:20 +01:00
hkalbasi
8593132a43
fix block with no termination in or patterns
2023-03-09 22:32:12 +03:30
bors
8ce5a53934
Auto merge of #14302 - Veykril:db-memory-usage, r=Veykril
...
internal: Add missing queries to per_query_memory_usage
2023-03-09 16:02:43 +00:00
Lukas Wirth
c49f753403
Add missing queries to per_query_memory_usage
2023-03-09 16:31:10 +01:00
bors
10a652a1e4
Auto merge of #14300 - lnicola:rustc-flycheck, r=lnicola
...
fix: Watch both stdout and stderr in flycheck
Fixes #14217
This isn't great because it un-mixes the messages from the two streams, but maybe it's not such a big problem?
2023-03-09 15:28:42 +00:00
Laurențiu Nicola
209cf7dc61
Watch both stdout and stderr in flycheck
2023-03-09 16:58:25 +02:00
Lukas Wirth
879cac4b28
minor: Remove dead code
2023-03-09 15:40:51 +01:00
bors
de3b12d686
Auto merge of #14299 - Veykril:local-search, r=Veykril
...
fix: Fix search not searching bodies of attributed items
Closes https://github.com/rust-lang/rust-analyzer/issues/14229
2023-03-09 14:33:17 +00:00
Lukas Wirth
3427d36d0e
fix: Fix search not searching bodies of attributed items
2023-03-09 15:30:17 +01:00
Lukas Wirth
e158dc7246
Remove unnecessary special local handling in search
2023-03-09 15:10:26 +01:00
bors
a738737520
Auto merge of #14297 - Veykril:proc-macro-deps, r=Veykril
...
Add core lib to proc_macro dependencies
Fixes https://github.com/rust-lang/rust-analyzer/issues/14292
2023-03-09 13:44:59 +00:00
Lukas Wirth
d8c80e7d95
Add core lib to proc_macro dependencies
2023-03-09 12:58:07 +01:00
hkalbasi
811190b913
fix multiple definition binding in match to let-else
2023-03-09 00:34:31 +03:30
bors
38e9a110d4
Auto merge of #14287 - Veykril:rustc_private-proc-macro, r=Veykril
...
minor: Fixup dylib extensions for rustc_private proc-macro loading
Follow up to https://github.com/rust-lang/rust-analyzer/pull/14282
2023-03-08 13:56:45 +00:00
Lukas Wirth
4ee2abaf38
minor: Fixup dylib extensions for rustc_private proc-macro loading
2023-03-08 14:45:47 +01:00
bors
3d904e024b
Auto merge of #14286 - Veykril:block-def-tail-mac, r=Veykril
...
fix: Fix block defmap not looking into tail expressions for macro calls
Fixes https://github.com/rust-lang/rust-analyzer/issues/14263
2023-03-08 13:37:47 +00:00
Lukas Wirth
d038892947
fix: Fix block defmap not looking into tail expressions for macro calls
2023-03-08 14:37:27 +01:00
hkalbasi
cf47c15821
Evaluate consts in path_to_const
2023-03-08 16:42:20 +03:30
bors
c9510933a5
Auto merge of #14284 - Veykril:sem-derive-unresolved, r=Veykril
...
fix: Highlight unresolved derives as being unresolved
Fixes https://github.com/rust-lang/rust-analyzer/issues/11350
2023-03-08 12:51:40 +00:00
Lukas Wirth
b6e7cf3201
Highlight unresolved derives as being unresolved
2023-03-08 13:51:14 +01:00
bors
6ebbd48ac0
Auto merge of #14283 - Veykril:error-notifs, r=Veykril
...
Load proc-macros for rustc_private crates
If the client support our server status notification there is no need to show the pop up for workspace fetching failures since that's already going to be shown in the status.
cc https://github.com/rust-lang/rust-analyzer/issues/14193
2023-03-08 12:22:10 +00:00
Lukas Wirth
b4bd27be90
Don't send error notifications for workspace failures if server status is supported
2023-03-08 13:18:44 +01:00
bors
aff6cb0080
Auto merge of #14282 - Veykril:rustc_private-proc-macro, r=Veykril
...
fix: Load proc-macros for rustc_private crates
Fixes https://github.com/rust-lang/rust-analyzer/issues/13591
Verified that this makes things work in the clippy repo (like resolving `sym` things for example)
2023-03-08 12:02:38 +00:00
bors
a9d97b6449
Auto merge of #14248 - XFFXFF:let_else_right_curly_brace, r=Veykril
...
fix: show diagnostic for } token followed by else in let else statement
fix #14221
My thinking is to check if the `expr` after `=` is block like when parse `let ... lese` , and if so, emit error.
2023-03-08 11:47:52 +00:00
Lukas Wirth
c9786484c5
Load proc-macros for rustc_private crates
2023-03-08 12:41:38 +01:00
bors
ecc32c2f85
Auto merge of #14271 - Veykril:ty-diag-err, r=Veykril
...
Don't trigger unresolved method/field diagnostics on types containing errors
2023-03-07 14:25:20 +00:00
Lukas Wirth
d45708fabe
Don't trigger unresolved method/field diagnostics on types containing errors
2023-03-07 15:24:43 +01:00
bors
44ff3c407a
Auto merge of #14232 - HKalbasi:mir, r=Veykril
...
MIR episode 2
This PR adds:
1. `need-mut` and `unused-mut` diagnostics
2. `View mir` command which shows MIR for the body under cursor, useful for debugging
3. MIR lowering for or-patterns and for-loops
2023-03-07 09:49:49 +00:00
XFFXFF
6e97527eae
add is_blocklike func on BlockLike
2023-03-07 17:27:52 +08:00
hkalbasi
bcd7ecb242
Add profiling to mir lower and borrowck query
2023-03-07 12:42:52 +03:30
XFFXFF
98990affe5
add more tests
2023-03-07 08:24:25 +08:00
XFFXFF
995aacfce8
show diagnostic for } token followed by else in let else statement
2023-03-07 08:24:25 +08:00
bors
31c12ec282
Auto merge of #14266 - Veykril:generalize-eager-lazy, r=Veykril
...
feature: Make replace_or_with_or_else assists more generally applicable
2023-03-06 21:41:46 +00:00
Lukas Wirth
0ce06088f8
Fix inlay-hint tests
2023-03-06 22:39:42 +01:00
Lukas Wirth
34a3187ee8
internal: Mark unresolved field, unresolved method and expected function diagnostics experimental
2023-03-06 22:24:38 +01:00
Lukas Wirth
199bc82ce8
feature: Make replace_or_with_or_else assists more generally applicable
2023-03-06 22:17:30 +01:00
hkalbasi
2cce9dc3e9
Make unused_mut
diagnostic experimental
2023-03-06 21:09:09 +03:30
hkalbasi
af90ec8096
Partially support "overloaded deref" MIR lowering
2023-03-06 21:09:09 +03:30
hkalbasi
bf0f99f15d
Fix overloaded deref unused mut false positive
2023-03-06 21:09:09 +03:30
hkalbasi
6377d50bd1
Support "for loop" MIR lowering
2023-03-06 21:09:09 +03:30
hkalbasi
ac04bfd7a7
Add View Mir
command and fix some bugs
2023-03-06 21:09:09 +03:30
hkalbasi
a25710b0c0
Add need-mut
and unused-mut
diagnostics
2023-03-06 21:09:08 +03:30
hkalbasi
c0a0664d12
Support "or patterns" MIR lowering
2023-03-06 21:09:08 +03:30
hkalbasi
61ad6a96ad
Add BindingId
2023-03-06 21:09:08 +03:30
bors
a360fab9a3
Auto merge of #14261 - Veykril:ty-perf, r=Veykril
...
internal: Re-use the resolver in `InferenceContext` instead of rebuilding it whenever needed
This reduced inference time on my local build by roughly ~1 sec (out of like 60)
2023-03-06 10:54:27 +00:00
bors
900efbefdd
Auto merge of #14260 - Veykril:if-let-match-adjust, r=Veykril
...
fix: Adjust `replace_match_with_if_let` applicability range
It currently trigger in the entirety of match which is less than ideal
2023-03-06 10:36:26 +00:00
Lukas Wirth
7be48ac32c
Adjust replace_match_with_if_let applicability range
2023-03-05 16:52:07 +01:00
Lukas Wirth
d8b1ec6a25
Remove unnecessary option wrapping
2023-03-05 15:43:02 +01:00
Lukas Wirth
27fad2ad75
Lift segment check out of the loop in resolve_path_in_value_ns
2023-03-05 15:42:40 +01:00
Lukas Wirth
a51267c5e0
Allocate traits in scope upfront when type checking instead of recollecting them everytime
2023-03-05 15:04:46 +01:00
Lukas Wirth
a8606e5363
Re-use the resolver in InferenceContext instead of rebuilding it on every expression change
2023-03-05 14:37:44 +01:00
hkalbasi
ae8ce99d97
Bring back the hex in const hover
2023-03-05 13:53:49 +03:30
bors
e6ba791dce
Auto merge of #14252 - Veykril:field-mcall-fallback, r=Veykril
...
internal: Handle fields called as method calls as the fields they resolve to
Confusing PR title tbf but this makes it so `bar` in `foo.bar()` resolves to the field if it exists and no method with the same name exists. Improves UX slightly when incorrectly calling a field.
2023-03-04 19:35:03 +00:00
Lukas Wirth
5a91f015b4
internal: Handle fields called as method calls as the fields they resolve to
2023-03-04 20:33:28 +01:00
bors
94dc7a3eb0
Auto merge of #14251 - Veykril:ty-expr-stmt, r=Veykril
...
internal: Set expectation for no-semi expression statements to unit
2023-03-04 19:01:47 +00:00
Lukas Wirth
b85e2af898
Correctly handle non-semi statement expressions for never coercions
2023-03-04 19:48:03 +01:00
Lukas Wirth
95c4cb991f
Handle new hir block kinds in scope calculations
2023-03-04 15:22:39 +01:00
Lukas Wirth
b8276481e7
Fix extract_variable test
2023-03-04 14:58:58 +01:00
Lukas Wirth
1b5bc83118
Remove weird nesting of effect blocks in hir
2023-03-04 14:45:57 +01:00
Lukas Wirth
24ba1bed04
Set expectation for no-semi expression statements to unit
2023-03-04 12:48:57 +01:00
bors
5efcfe5ca9
Auto merge of #14244 - Veykril:metrics, r=lnicola
...
internal: Report type metrics for patterns
```
❯ cargo run --release -p rust-analyzer -q analysis-stats --memory-usage .
Database loaded: 2.09s, 218mb (metadata 275.07ms, 21mb; build 1.29s, 504kb)
crates: 44, mods: 916, decls: 19582, fns: 14631
Item Collection: 14.33s, 472mb
exprs: 420422, ??ty: 68 (0%), ?ty: 141 (0%), !ty: 1
pats: 82968, ??ty: 11 (0%), ?ty: 10 (0%), !ty: 178
Inference: 47.84s, 745mb
Total: 62.16s, 1217mb
```
We currently have 178 mismatches on r-a itself
2023-03-04 08:31:20 +00:00
Lukas Wirth
800ab650ac
split expression and pattern metrics
2023-03-04 09:21:17 +01:00
Pascal Kuthe
2e465d18f2
generate correct completion edits for missing macro arguments
...
rust-analyzer used the token at the cursor after macro expansion
to decide whether to replace the token at the cursor before macro
expansion. In most cases these two are the same but in some cases these
can mismatch which can lead to incorrect replacements.
For example if an ident/expr macro argument is missing rust-analyzer
generates a "missing" identifier as a placeholder, there is only a
brace at the cursor. Therefore, rust-analyzer will incorrectly replace
the macro brace with the completion in that case leading to #14246 .
Using the expanded token type was intentional. However, this doesn't
seem to ever be desirable (this is supported by the fact that there
were no tests that relied on this behavior) since the type of edit to
perform should always be determined by the token it's actually applied
to.
2023-03-04 02:05:09 +01:00
Lukas Wirth
29150c2315
Disable pattern type mismatches again
2023-03-03 22:41:41 +01:00
Lukas Wirth
c12fac698f
Report type metrics for patterns
2023-03-03 21:08:45 +01:00
Lukas Wirth
e7485a0416
Diagnose unresolved method calls
2023-03-03 20:43:13 +01:00
Lukas Wirth
78b2dd813a
Diagnose unresolved field accesses
2023-03-03 20:43:10 +01:00
Lukas Wirth
3c7a0aa00e
Diagnose call expression on non-callable things
2023-03-03 20:43:05 +01:00
bors
3ba876a4a6
Auto merge of #14240 - Veykril:coerce-many, r=Veykril
...
Diagnose value breaks in incorrect breakables
2023-03-03 17:03:39 +00:00
Lukas Wirth
41f234df09
Diagnose value breaks in incorrect breakables
2023-03-03 17:28:57 +01:00
Lukas Wirth
02eb2d758e
Distinguish between expected and final type in CoerceMany
2023-03-03 16:52:09 +01:00
bors
6756294aa0
Auto merge of #14184 - lowr:feat/trait-alias-def, r=Veykril
...
Handle trait alias definitions
Part of #2773
This PR adds a bunch of structs and enum variants for trait aliases. Trait aliases should be handled as an independent item because they are semantically distinct from traits.
I basically started by adding `TraitAlias{Id, Loc}` to `hir_def::item_tree` and iterated adding necessary stuffs until compiler stopped complaining what's missing. Let me know if there's still anything I need to add.
I'm opening up this PR for early review and stuff. I'm planning to add tests for IDE functionalities in this PR, but not type-related support, for which I put FIXME notes.
2023-03-03 15:45:18 +00:00
Ryo Yoshida
f8eac19b33
Support trait aliases in IDE where type support isn't needed
2023-03-04 00:24:08 +09:00
Ryo Yoshida
29c957f973
Lower and handle trait aliases in HIR
2023-03-04 00:24:07 +09:00
Ryo Yoshida
e2ec3a6561
Refactor generic parameter lowering
...
Since we moved impl trait handling to other place, there are only two
cases now: those that introduce implicit `Self` parameter and those that
don't.
2023-03-04 00:24:05 +09:00
Ryo Yoshida
356d12eae4
refactor: leverage HasAttrs
for code brevity
2023-03-04 00:24:03 +09:00
Ryo Yoshida
2e7d2c2d04
Parse trait alias as a distinct AST type
2023-03-04 00:23:56 +09:00
bors
a8d3c46082
Auto merge of #14239 - Veykril:sysroot-cli, r=Veykril
...
fix: Load the sysroot in all CLI commands
2023-03-03 10:51:15 +00:00
bors
c229a836e8
Auto merge of #14222 - Veykril:pat-mismatch-diags, r=Veykril
...
Show pattern mismatch diagnostics
2023-03-03 10:33:54 +00:00
Lukas Wirth
80ddfb89a2
fix: Load the sysroot in all CLI commands
2023-03-03 11:21:27 +01:00
Lukas Wirth
522823f610
Fix text fixtures of missing_match_arms diagnostics
2023-03-03 11:13:06 +01:00
Lukas Wirth
44e2c6ea92
Don't emit two type mismatches for literal pattern mismatches
2023-03-03 10:42:49 +01:00
Lukas Wirth
ec273c3d12
Split pattern inference into more functions
2023-03-03 10:42:46 +01:00
Lukas Wirth
fc2b395e00
Show pattern mismatch diagnostics
2023-03-03 10:41:44 +01:00
Ryo Yoshida
bda2af71c6
feat: allow generate_function
to generate in different local crate
2023-03-03 18:40:13 +09:00
Ryo Yoshida
943de55214
Fix typo
2023-03-03 01:12:39 +09:00
Lukas Wirth
88f2abb8f7
Don't drop rustc crates in the rustc workspace
2023-03-02 12:55:41 +01:00
bors
32424d0aba
Auto merge of #14176 - lowr:fix/assoc-func-vis-in-local-impl, r=Veykril
...
Fix associated item visibility in block-local impls
Fixes #14046
When we're resolving visibility of block-local items...
> `self` normally refers to the containing non-block module, and `super` to its parent (etc.). However, visibilities must only refer to a module in the DefMap they're written in, so we restrict them when that happens. ([link])
...unless we're resolving visibility of associated items in block-local impls, because that impl is semantically "hoisted" to the nearest (non-block) module. With this PR, we skip the adjustment for such items.
Since visibility representation of those items is modified, this PR also adjusts visibility rendering in `HirDisplay`.
[link]: a6603fc21d/crates/hir-def/src/nameres/path_resolution.rs (L101-L103)
2023-03-01 12:40:55 +00:00
bors
ef9d5db857
Auto merge of #14223 - HKalbasi:mir, r=HKalbasi
...
Add tuple to render_const_scalar
cc `@lowr`
2023-03-01 12:23:52 +00:00
Ryo Yoshida
de4a8961dc
Support removing nested dbg!()
s in remove_dbg
2023-03-01 19:06:05 +09:00