Commit Graph

21116 Commits

Author SHA1 Message Date
bors[bot]
8f504dc873
Merge #11598
11598: feat: Parse destructuring assignment r=Veykril a=ChayimFriedman2

Part of #11532.

Lowering is not as easy and may not even be feasible right now as it requires generating identifiers: `(a, b) = (b, a)` is desugared into
```rust
{
    let (<gensym_a>, <gensym_b>) = (b, a);
    a = <gensym_a>;
    b = <gensym_b>;
}
```

rustc uses hygiene to implement that, but we don't support hygiene yet.

However, I think parsing was the main problem as lowering will just affect type inference, and while `{unknown}` is not nice it's much better than a syntax error.

I'm still looking for the best way to do lowering, though.

Fixes #11454.

Co-authored-by: Chayim Refael Friedman <chayimfr@gmail.com>
2022-03-05 11:31:29 +00:00
bors[bot]
e844b1570a
Merge #11574
11574: Small refactor text edit 2nd r=Veykril a=HansAuger

Some more changes to text_edit. Basic idea is to make `Indel` implement `PartialOrd` to take advantage of some sweet sweet iteration, most notably itertool's `merge`.



Co-authored-by: Moritz Vetter <mv@3yourmind.com>
2022-03-05 11:20:05 +00:00
bors[bot]
79a7ba0bdf
Merge #11623
11623: fix: Add type variable table to InferenceTableSnapshot r=flodiebold a=tysg

Fixes #11601. 

I observed that removing the `rollback` line in 6fc3d3aa4c fixes the issue.  

Looking at the stacktrace, I believe not restoring `type_variable_table` causes `type_variable_table` and `var_unification_table` to go out of sync, then when `hir_ty::infer::unify::InferenceTable::new_var` tries to extend `type_variable_table` to be the same length as `var_unification_table`, problems will arise.

However, I cannot pinpoint exactly how or where the vector capacity overflow happens, so my understanding might not be correct after all. 

Co-authored-by: Tianyi Song <42670338+tysg@users.noreply.github.com>
2022-03-05 10:32:07 +00:00
Tianyi Song
c49bcc7814 Add type variable table to InferenceTableSnapshot 2022-03-05 17:59:28 +08:00
bors[bot]
f1f9163b27
Merge #11622
11622: show variadic args in hover function signature r=Veykril a=euclio

The current behavior is to ignore the ellipsis.

Co-authored-by: Andy Russell <arussell123@gmail.com>
2022-03-04 23:20:29 +00:00
Andy Russell
49fab593ad
show variadic args in hover function signature 2022-03-04 16:44:31 -05:00
bors[bot]
908c17bfa6
Merge #11595
11595: fix: lower string literals with actual value instead of default r=lnicola a=tysg

Fixes #11582. Some questions below in the code review section.

Co-authored-by: Tianyi Song <42670338+tysg@users.noreply.github.com>
2022-03-04 20:21:43 +00:00
bors[bot]
a474535e44
Merge #11620
11620: feat: Support locals with multiple declaration sites r=Veykril a=Veykril

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/8860

This implements the first approach of https://github.com/rust-analyzer/rust-analyzer/issues/8860#issuecomment-845461773:
> treat every Local as having potentially many sources?

The way this is written does allow changing to a MultiLocal approach instead though, I'll investigate whether that turns out to be better or not.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-04 19:47:39 +00:00
Lukas Wirth
4a866fc672 Simplify 2022-03-04 20:23:25 +01:00
Lukas Wirth
32bf7af83e Support locals with multiple declaration sites 2022-03-04 19:49:08 +01:00
bors[bot]
f8329ba987
Merge #11140
11140: Preserve order of generic args r=HKalbasi a=HKalbasi

https://github.com/rust-lang/rust/pull/90207 removed order restriction of generic args, i.e. const generics can now become before of type generics. We need to preserve this order to analyze correctly, and this PR does that.

It also simplifies implementation of const generics a bit IMO.

Implementing default generics the same problem of #7434, we need lower them to body and then evaluate them.


Co-authored-by: hkalbasi <hamidrezakalbasi@protonmail.com>
2022-03-04 12:55:07 +00:00
hkalbasi
660fd4ab41 Resolve only type params in type ns 2022-03-04 12:30:53 +03:30
hkalbasi
4fa8749c44 Preserve order of generic args 2022-03-04 11:46:14 +03:30
Tianyi Song
89a19f57f8 Lower string literals with real val, not default 2022-03-04 10:16:35 +08:00
bors[bot]
9d473a0b9f
Merge #11616
11616: fix: Fix semantic highlighting breaking for lifetimes in macros r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-03 22:25:42 +00:00
Lukas Wirth
464dd814ca slightly improve highlighting performance for derive annotated items 2022-03-03 22:59:34 +01:00
Lukas Wirth
8ded3ec9cf fix: Fix semantic highlighting breaking for lifetimes in macros 2022-03-03 22:53:03 +01:00
bors[bot]
59088d8066
Merge #11613
11613: fix: Add `abort` to safe intrinsics list r=lnicola a=lnicola

Closes #11611

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2022-03-03 18:59:22 +00:00
Laurențiu Nicola
7c6935eed5 Add abort to safe intrinsics list 2022-03-03 20:58:20 +02:00
bors[bot]
e949375098
Merge #11610
11610: Add a (currently failing) test for #11242 r=flodiebold a=flodiebold



Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2022-03-03 17:42:33 +00:00
bors[bot]
f470f35abf
Merge #11609
11609: Add another case to the syntax fixup code r=flodiebold a=flodiebold



Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2022-03-03 17:34:00 +00:00
Florian Diebold
82fe1c77b5 Add a (currently failing) test for #11242 2022-03-03 18:32:40 +01:00
Florian Diebold
ac51eea309 Add another case to the syntax fixup code 2022-03-03 18:30:14 +01:00
Chayim Refael Friedman
10d30be331 Do not consider _ to be an expression for macro_rules! 2022-03-02 01:51:25 +00:00
Chayim Refael Friedman
d9f0731bd2 Parse destructuring assignment
The only patterns we should parse are `..` in structs and `_`: the rest are either not supported or already valid expressions.
2022-03-02 01:51:25 +00:00
bors[bot]
a55dd29e88
Merge #11593
11593: Build release binaries on Ubuntu 18.04 r=lnicola a=lnicola

Fixes #11558

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2022-03-01 18:27:04 +00:00
Laurențiu Nicola
f60d300300 Build release binaries on Ubuntu 18.04 2022-03-01 07:24:27 +02:00
bors[bot]
342c3c42bb
Merge #11433
11433: minor: Add scary warning to `onEnter` r=lnicola a=lnicola

Closes #11432

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2022-02-28 10:15:44 +00:00
Laurențiu Nicola
6bf97692ae Add scary warning to onEnter 2022-02-28 12:15:15 +02:00
bors[bot]
415be8bae5
Merge #11579
11579: minor: Future-proof against a next edition by using `>=` and not `==` r=lnicola a=ChayimFriedman2

So that we won't have a strange bug when edition 2024 will land.

rustc [also does that](427cf81206/compiler/rustc_builtin_macros/src/edition_panic.rs (L84)).

Co-authored-by: Chayim Refael Friedman <chayimfr@gmail.com>
2022-02-28 09:18:26 +00:00
Chayim Refael Friedman
e6a35c28cb
Future-proof against a next edition by using >= and not ==
So that we won't have a strange bug when edition 2024 will land.

rustc [also does that](427cf81206/compiler/rustc_builtin_macros/src/edition_panic.rs (L84)).
2022-02-28 11:13:55 +02:00
Moritz Vetter
96c16bc382 redirct: use iterators and knowledge about preordered arrays for more efficient merging 2022-02-28 05:56:51 +01:00
bors[bot]
4e72700e38
Merge #11573
11573: refactorings and FIXME fixes in text edit r=lnicola a=HansAuger

This is mainly me learning some rust, and only anecdotally about addressing some `fixme`s. Feel free to nope :)

There is a follow up PR in the pipeline which tackles the other two `fixme`s but it's a bit more invasive. So I wanted to get this out of the way

Co-authored-by: Moritz Vetter <mv@3yourmind.com>
2022-02-27 12:00:04 +00:00
bors[bot]
a53915c10d
Merge #11567
11567: Fix `if` in #11561 r=Veykril a=ChayimFriedman2

Fixes #11561.

Co-authored-by: Chayim Refael Friedman <chayimfr@gmail.com>
2022-02-27 11:34:01 +00:00
bors[bot]
bc2ce4c655
Merge #11570
11570: minor: Remove misleading comments r=lnicola a=ChayimFriedman2

They're not true anymore after #11375.

Co-authored-by: Chayim Refael Friedman <chayimfr@gmail.com>
2022-02-27 09:17:46 +00:00
Chayim Refael Friedman
744f0ea2e7
Remove misleading comments
They're not true anymore after #11375.
2022-02-27 09:52:11 +02:00
Moritz Vetter
ff59147d53 add two more unit tests for text_edit 2022-02-27 02:27:44 +01:00
Chayim Refael Friedman
54fe3dc0f1 Fix if in #11561 2022-02-27 00:19:45 +00:00
bors[bot]
b86baa7092
Merge #11560
11560: internal: Update `url` to make `webrender` build when computing metrics r=jonas-schievink a=lnicola

Closes #9997

This doesn't seem to affect the metrics, but I'm not sure since somehow I get different values than what shows up on CI.

With `stable`:

```
  exprs: 94151, ??ty: 96 (0%), ?ty: 25 (0%), !ty: 6
```

CI shows 16.

Also, https://github.com/rust-analyzer/rust-analyzer/pull/7250 strikes again, I can never tell what those numbers are.

r? `@jonas-schievink`

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2022-02-26 17:00:11 +00:00
bors[bot]
5cade9bf33
Merge #11565
11565: fix: Fix body selection in while loops r=Veykril a=lnicola

CC #11561

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2022-02-26 16:49:16 +00:00
bors[bot]
a153b18d6d
Merge #11566
11566: minor: Make hir::Local::name infallible r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-02-26 15:48:11 +00:00
Lukas Wirth
47ce4436e4 Make hir::Local::name infallible 2022-02-26 16:36:44 +01:00
Moritz Vetter
21d497b773 refact: edit text in place in TextEdit::apply 2022-02-26 15:50:09 +01:00
Moritz Vetter
c541f3396c test: add unit test for TextEdit::apply() 2022-02-26 15:46:14 +01:00
Laurențiu Nicola
87c4a4104d Fix body selection in while loops 2022-02-26 16:45:06 +02:00
bors[bot]
719babd9f7
Merge #11564
11564: internal: Cleanup highlighting tests r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-02-26 13:53:30 +00:00
Lukas Wirth
36603e0478 Rename test highlighting output files 2022-02-26 14:52:42 +01:00
Lukas Wirth
c99fb4b1ac Split up highlighting tests a bit more 2022-02-26 14:45:09 +01:00
Lukas Wirth
48189bc1b4 Re-order and cleanup highlighting tests 2022-02-26 14:29:03 +01:00
bors[bot]
ddb5a53fd7
Merge #11562
11562: fix: Don't emit unresolvedReference highlight tags in unlinked files r=Veykril a=Veykril

Emitting these overwrites any syntax based highlighting that is being done in the file, causing a lot of noise if the user gave them a specific color.
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-02-26 12:54:57 +00:00