Commit Graph

22628 Commits

Author SHA1 Message Date
yue4u
ea7ea7079c fix: escape for enum variant 2022-07-02 23:17:29 +09:00
yue4u
622b516c74 fix: variants rendering in pattern path 2022-07-02 20:31:24 +09:00
bors
ec78b6b08a Auto merge of #12671 - flodiebold:test-for-12669, r=flodiebold
Add tests for #12669
2022-07-01 17:00:23 +00:00
Florian Diebold
9a12d0d6f2 Fix case of ignored/broken proc macro 2022-07-01 19:00:07 +02:00
Florian Diebold
e71519572c Add tests for #12669 2022-07-01 19:00:07 +02:00
bors
994f3cf74d Auto merge of #12636 - xuhongxu96:fix-12148, r=Veykril
complete raw identifier with "r#" prefix

Fix #12148

Escape Names and Paths used in `insert_text`/`insert_snippet` while rendering the completion items.
2022-07-01 14:55:51 +00: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
bors
8489cd7c7b Auto merge of #12670 - Veykril:assoc-attrs, r=Veykril
fix: Fix attribute macros on assoc items being discarded with disabled proc macros

Fixes https://github.com/rust-lang/rust-analyzer/issues/12669
2022-07-01 14:36:56 +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
f8c416e1b9 Auto merge of #12650 - lowr:fix/12591, r=lnicola
fix: improve whitespace insertion in pretty printer

Fixes #12591

The `=>` token in the macro_rules! should be parsed as one fat arrow, but it ["requires a lot of changes in r-a"](143cc528b1), so I left it for the larger refactoring in the future and put a FIXME note.
2022-07-01 08:32:04 +00:00
bors
7d0e5aea90 Auto merge of #12660 - Veykril:flycheck, r=Veykril
fix: Fix flycheck sending cancel progress with no running process

Fixes #12659
2022-07-01 08:11:51 +00:00
Lukas Wirth
ddddca8717 fix: Fix flycheck sending cancel progress with no running process 2022-06-30 22:58:57 +02:00
bors
ce36446943 Auto merge of #12655 - ChayimFriedman2:debug-bench-filter-bin-target, r=flodiebold
Ignore the `bin` artifact for `bench` targets

Just like `test`.

Fixes #12645.

I don't know how to test that.
2022-06-30 15:01:42 +00:00
bors
642084093a Auto merge of #12634 - iDawer:match-check.witnesses, r=flodiebold
feat: Show witnesses of non-exhaustiveness in `missing-match-arm` diagnostic

Shamelessly copied from rustc. Thus reporting format is same.

This extends public api  `hir::diagnostics::MissingMatchArms` with `uncovered_patterns: String` field. It does not expose data for implementing a quick fix yet.

-----
Worth to note: current implementation does not give a comprehensive list of missing patterns. Also mentioned in [paper](http://moscova.inria.fr/~maranget/papers/warn/warn.pdf):

> One may think that algorithm I should make an additional effort to provide more
> non-matching values, by systematically computing recursive calls on specialized
> matrices when possible, and by returning a list of all pattern vectors returned by
> recursive calls. We can first observe that it is not possible in general to supply the
> users with all non-matching values, since the signature of integers is (potentially)
> infinite.
2022-06-30 14:51:58 +00:00
iDawer
e417992674 Add static assertions for some unreachble paths 2022-06-30 18:36:05 +05:00
iDawer
461c0cc07a Correct wording 2022-06-30 17:19:03 +05:00
bors
7f9c054686 Auto merge of #12626 - CuriousCorrelation:fix/empty-reasons, r=flodiebold
fix: trailing ':' on empty inactive reasons

## Description
Fixes trailing ':' even when there is no explanation. e.g.
``` sh
code is inactive due to #[cfg] directives:
```
## Issue
Fixes: #12615
2022-06-30 10:19:21 +00: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
Chayim Refael Friedman
979d9511a1 Ignore the bin artifact for bench targets
Just like `test`.
2022-06-29 14:16:55 +03:00
bors
b0102bd469 Auto merge of #12652 - lnicola:openvsx, r=lnicola
internal: Try to publish releases to OpenVSX
2022-06-28 19:18:50 +00:00
Ryo Yoshida
36d2b43dfd
fix: improve whitespace insertion in pretty printer 2022-06-28 20:44:55 +09:00
bors
6407727ea2 Auto merge of #12648 - flodiebold:proc-macro-errors-again, r=flodiebold
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 08:44:13 +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
Ryo Yoshida
80cc0ef1bc
Fix typo 2022-06-27 23:20:26 +09:00
Ryo Yoshida
393a18b8ce
fix: escape receiver texts in format string completion 2022-06-27 23:20:23 +09:00
Ryo Yoshida
491e6eaf9e
fix: escape ${receiver} when completing with custom snippets 2022-06-27 23:20:17 +09:00
bors
9eaf96c9ea Auto merge of #12643 - Veykril:macro-compl, r=Veykril
fix: Fix completions for locals not working properly inside macro calls
2022-06-27 12:40:46 +00:00
Lukas Wirth
bdbffdd463 fix: Fix completions for locals not working properly inside macro calls 2022-06-27 14:39:44 +02:00
bors
4c3954682d Auto merge of #12635 - antogilbert:tgt_feat, r=Veykril
Correct target_feature completion

I changed the `target_feature` to match the description given in #12616.
2022-06-27 12:28:36 +00:00
bors
f6c0bf8f09 Auto merge of #12642 - weirdsmiley:master, r=Veykril
fix: deduplicate cfg completions

cfg completions are duplicated if they are set with multiple values.
This patch deduplicates them.

fixes: [#12623](https://github.com/rust-lang/rust-analyzer/issues/12623)
2022-06-27 12:16:06 +00:00
Manas
7f1fac7c26 fix: deduplicate cfg completions
cfg completions are duplicated if they are set with multiple values.
This patch deduplicates them.
2022-06-27 16:17:06 +05:30
Antonello Palazzi
bef89e95e7 Udate unit tests 2022-06-27 09:04:42 +01:00
bitgaoshu
dcb4837b2d WellFormed -> Holds 2022-06-26 23:09:06 +08:00
bitgaoshu
408fa148b9 add test for item same name 2022-06-26 22:48:26 +08:00
bors
b74e96f509 Auto merge of #12638 - buffet:fix-typo, r=flodiebold
Fix typo in build.rs
2022-06-26 10:43:30 +00:00
buffet
45b896002a Fix typo in build.rs 2022-06-26 10:09:45 +00:00
Hongxu Xu
f536766efb complete raw identifier with "r#" prefix 2022-06-26 14:45:30 +08:00
Antonello Palazzi
e4e2a46773 Correct target_feature completion 2022-06-26 00:50:41 +01:00
iDawer
fb6278e750 Reduce intermediate allocations while printing witnesses 2022-06-25 20:08:00 +05:00
bitgaoshu
0dbc091fee add test for suggest_name 2022-06-25 17:33:27 +08:00
bitgaoshu
82c1b313bc restore sth 2022-06-25 10:25:56 +08:00
bors
5bb123d970 Auto merge of #12520 - Veykril:flycheck-cancel, r=Veykril
internal: Bring back JodChild into flychecking for cancellation

cc https://github.com/rust-lang/rust-analyzer/pull/10517/files#r895241975
2022-06-24 17:42:00 +00:00
bitgaoshu
e3b1303c4f fix test in resolve_proc_macro: Foo is Owner 2022-06-25 01:02:39 +08:00
bitgaoshu
900b4208fd rename "trait_def" to "def_in_trait" 2022-06-24 23:04:35 +08:00
bitgaoshu
353829fc4e highlight: trait path 2022-06-24 23:04:35 +08:00
bitgaoshu
9ea8d5806d fix test in qualify_method: stay in trait path 2022-06-24 23:04:35 +08:00