Commit Graph

22702 Commits

Author SHA1 Message Date
Laurențiu Nicola
5381811368 Bump tracing-subscriber 2022-07-03 10:12:58 +03:00
Laurențiu Nicola
a3011e5ed2 Bump arbitrary and derive_arbitrary 2022-07-03 10:10:45 +03:00
Laurențiu Nicola
9e7ca80c82 Bump cargo_metadata 2022-07-03 10:09:35 +03:00
Laurențiu Nicola
2d3f0b4841 Bump semver 2022-07-03 10:09:35 +03:00
Laurențiu Nicola
6669f388a2 Bump indexmap 2022-07-03 10:09:35 +03:00
Laurențiu Nicola
b24ece5220 Bump serde_json 2022-07-03 10:09:35 +03:00
Laurențiu Nicola
87572bee23 Bump serde 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
2af61bc9ba Bump pulldown-cmark-to-cmark 2022-07-03 10:09:35 +03:00
Laurențiu Nicola
e6fcb23445 Bump either 2022-07-03 10:09:35 +03:00
Laurențiu Nicola
c7c314d462 Bump quote 2022-07-03 10:09:35 +03:00
Laurențiu Nicola
416787d26d Bump anyhow 2022-07-03 09:57:01 +03:00
Laurențiu Nicola
212f84ab46 Bump crossbeam-channel 2022-07-03 09:56:58 +03:00
Dorian Scheidt
e3940003a2 fix: Extract function from trait impl
This change fixes #10036, "Extract to function assist implements nonexistent
trait methods".

When we detect that the extraction is coming from within a trait impl, and that
a `self` param will be necessary, we adjust which `SyntaxNode` to `insert_after`,
and create a new empty `impl` block for the newly extracted function.
2022-07-02 15:00:02 -05:00
bors
cc0bb71e25 Auto merge of #12662 - DorianListens:dscheidt/extract-function-duplicate-name, r=DorianListens
fix: Extract Function produces duplicate fn names

This change fixes #10037, in more or less the most naive fashion
possible.

We continue to start with the hardcoded default of "fun_name", and now append a
counter to the end of it if that name is already in scope.

In the future, we can probably apply more heuristics here to wind up with more
useful names by default, but for now this resolves the immediate problem.
2022-07-02 19:42:17 +00:00
Dorian Scheidt
0039d6f731 fix: Extract Function produces duplicate fn names
This change fixes issue #10037, in more or less the most naive fashion
possible.

We continue to start with the hardcoded default of "fun_name", and now append a
counter to the end of it if that name is already in scope.

In the future, we can probably apply more heuristics here to wind up with more
useful names by default, but for now this resolves the immediate problem.
2022-07-02 14:24:41 -05:00
bors
d1ac46201d Auto merge of #12680 - lowr:fix/12428-regression, r=Veykril
fix regressions on assignment expressions

This is a follow-up PR on #12428. I'm not sure if this is everything I overlooked, so if there are more things that are not right, we may want to revert #12428.

This should also fix the increase of the type mismatches and the unknown types in diesel in the [metrics](https://rust-analyzer.github.io/metrics/?start=2022-06-23&end=2022-07-01) introduced by #12428.

The regressions are:

- some coercions don't work in the ordinary (i.e. non-destructuring) assignments

    In order for coercions on ADT fields instantiations to work, lhs type has to be known before inferring rhs. #12428 changed the inference order, making rhs inferred before lhs, breaking the coercion, so I restored the original inference mechanism for the ordinary assignments.

    Note that this kind of coercion doesn't happen in destructuring assigments, because when they are desugared, the struct expression is first assigned to a temporary, which is then assigned to the assignee, which is not coercion site anymore.

- type mismatches on individual identifiers are not reported
2022-07-02 19:00:49 +00:00
Ryo Yoshida
649e1f54cf
fix: report type mismatch on identifier in destructuring assignments 2022-07-03 03:29:15 +09:00
Ryo Yoshida
afdbd6cce2
fix: infer lhs first on ordinary assignment expressions 2022-07-03 03:29:02 +09:00
bors
d101439c77 Auto merge of #12627 - yue4u:fix/struct-variant-patterns, r=Veykril
fix: complete enum variants as patterns in pattern path

close #12593
2022-07-02 17:18:24 +00:00
bors
30680df3cc Auto merge of #12679 - a-kenji:fix-typos-hir, r=lnicola
fix: typos in hir-ty
2022-07-02 15:28:29 +00:00
a-kenji
f2963cf8ff fix: typos in hir-ty 2022-07-02 17:19:06 +02:00
bors
d4b79ad77b Auto merge of #12678 - Veykril:flyimport, r=Veykril
fix: Trigger flyimport completions in item lists again

Fixes https://github.com/rust-lang/rust-analyzer/issues/12656
2022-07-02 14:20:36 +00:00
Lukas Wirth
cd42b20ce3 fix: Trigger flyimport completions in item lists again 2022-07-02 16:20:26 +02:00
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