Commit Graph

20304 Commits

Author SHA1 Message Date
Aleksey Kladov
8b9d145dea soa all the things 2021-12-18 15:31:50 +03:00
Aleksey Kladov
799941e05e move tests 2021-12-18 14:55:20 +03:00
Aleksey Kladov
7e99864dbf move lexing to the parser crate 2021-12-18 14:55:20 +03:00
Aleksey Kladov
958f20ff84 minor: dead code 2021-12-18 14:55:20 +03:00
bors[bot]
7f28b49759
Merge #11043
11043: fix: fix incorrect mismatched argument count diagnostic with `std::arch` functions r=jonas-schievink a=jonas-schievink

Adds basic support for `#[rustc_legacy_const_generics]`.

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

Full support would involve actually checking call arguments against the right expected types.

bors r+

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2021-12-17 17:46:42 +00:00
Jonas Schievink
fcc76e93a0 Initial support for #[rustc_legacy_const_generics] 2021-12-17 18:45:56 +01:00
bors[bot]
6674756c07
Merge #11041
11041: minor: Fix some clippy lints r=lnicola a=lnicola

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-12-17 15:52:53 +00:00
Laurențiu Nicola
6c799dac1e Fix some clippy lints 2021-12-17 17:46:20 +02:00
bors[bot]
04b0b19cdb
Merge #10527
10527: internal: Remove a few snippet completions, replace them with user snippets definitions in VSCode r=Veykril a=Veykril

Closes https://github.com/rust-analyzer/rust-analyzer/issues/9636
cc https://github.com/rust-analyzer/rust-analyzer/issues/7033#issuecomment-939959905

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-12-17 15:44:48 +00:00
Lukas Wirth
2a88b76041 Update tests 2021-12-17 16:39:21 +01:00
Laurențiu Nicola
8ad7c0439c Remove needless clones 2021-12-17 17:35:10 +02:00
Laurențiu Nicola
fb9529626d Spelling nits 2021-12-17 17:26:35 +02:00
Lukas Wirth
9fe0f0d1d9 Add a few default snippets for VSCode 2021-12-17 16:24:29 +01:00
bors[bot]
f4d65c1d20
Merge #11040
11040: fix: Don't duplicate attribute completions r=Veykril a=Veykril

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/11012
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-12-17 14:23:45 +00:00
Lukas Wirth
d3e538638a fix: Don't duplicate attribute completions 2021-12-17 15:22:53 +01:00
bors[bot]
f79f3db7b7
Merge #11030
11030: Add comma for "move if to guard" r=Veykril a=weirane

As I mentioned in #11017, there is a little issue in the implementation for if branch. This code
```rust
let y = match 92 {
    x => {
        if x == 0 {$0
            false
        }
    }
    _ => true,
};
```
will be transformed to
```rust
let y = match 92 {
    x if x == 0 => false
    _ => true,
};
```
a comma is missing after the false. I moved the fix from the code handling else branch to above.

Co-authored-by: Wang Ruochen <wrc@ruo-chen.wang>
2021-12-16 13:26:16 +00:00
bors[bot]
098b1f2486
Merge #11031
11031: minor: Set `MACOSX_DEPLOYMENT_TARGET` to 10.15 to improve compat r=lnicola a=lnicola

Since GitHub (and also us, explicitly) switched the `macos-latest` runners to 11, let's try to bring back support for 10.15.

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-12-16 06:36:10 +00:00
Laurențiu Nicola
ff6081e629 Set MACOSX_DEPLOYMENT_TARGET to 10.15 to improve compat 2021-12-16 08:02:09 +02:00
Wang Ruochen
ee079561b1
Add comma for "move if to guard" 2021-12-15 15:26:24 -08:00
bors[bot]
4ec6bd6206
Merge #11017
11017: Support "move if to guard" with an else branch r=Veykril a=weirane

Support the assist `move_arm_cond_to_match_guard` when there is an else branch.

I have two questions:
1. How to indent the first line of a match arm? `matcharm.indent()` doesn't seem to work. so I hard coded four spaces here:
95a0de85d5/crates/ide_assists/src/handlers/move_guard.rs (L162-L163)

2. I find a little issue in the original implementation, this code
```rust
let y = match 92 {
    x => {
        if x == 0 {$0
            false
        }
    }
    _ => true,
};
```
will be transformed to
```rust
let y = match 92 {
    x if x == 0 => false
    _ => true,
};
```
a comma is missing after the `false`. Should I also fix that? Or this can go in a separate PR.

Closes #10997.

Co-authored-by: Wang Ruochen <wrc@ruo-chen.wang>
2021-12-15 23:04:51 +00:00
Wang Ruochen
e8d0742997
Add coverage marks 2021-12-15 14:44:47 -08:00
bors[bot]
661e3f933a
Merge #11029
11029: internal: Refactor release workflow to reduce duplication r=lnicola a=lnicola

This reduces duplication by using `matrix` and paves the way for https://github.com/rust-analyzer/rust-analyzer/issues/10483. The `musl` builder is unchanged because it uses a container.

~~We also get rid of the MacOS 11 SDK thing, which is from when most MacOS builders were on 10.~~ Or not, the default is still 10.15.

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-12-15 22:00:51 +00:00
Laurențiu Nicola
f694d7fa65 Refactor release workflow 2021-12-15 23:32:05 +02:00
bors[bot]
b75d4d3dbe
Merge #11023
11023: minor: Really switch XCode version r=lnicola a=lnicola

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-12-15 12:45:13 +00:00
Laurențiu Nicola
c6a8cc1cee Really switch XCode version 2021-12-15 14:44:45 +02:00
bors[bot]
778a63e9e3
Merge #11022
11022: minor: Enable workflow_dispatch for release workflow r=lnicola a=lnicola

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-12-15 11:54:57 +00:00
Laurențiu Nicola
ebaf7d39de Enable workflow_dispatch for release workflow 2021-12-15 13:54:18 +02:00
bors[bot]
a862c596a5
Merge #11021
11021: internal: Use default XCode version r=lnicola a=lnicola

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-12-15 11:37:06 +00:00
Laurențiu Nicola
d5de3b25d7 Use default XCode version 2021-12-15 13:36:36 +02:00
Wang Ruochen
95a0de85d5
Support "move if to guard" with an else branch 2021-12-14 10:27:44 -08:00
bors[bot]
9efa355a62
Merge #11011
11011: minor: Simplify r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-12-14 11:56:30 +00:00
Lukas Wirth
901c7c7277 match_ast! takes a pattern to allow underscore usage 2021-12-14 12:44:31 +01:00
Lukas Wirth
9915103c9e Simplify 2021-12-14 12:38:20 +01:00
bors[bot]
d10a3b331c
Merge #11009
11009: internal: Move out doc-links tests into a separate module r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-12-14 11:11:29 +00:00
Lukas Wirth
04a7fbbddb Move out doc-links tests into a separate module 2021-12-14 12:10:43 +01:00
bors[bot]
536ed7c451
Merge #11004
11004: Fix: Infer associated method in local scope r=flodiebold a=XFFXFF

fixes #10936 

Co-authored-by: zhoufan <1247714429@qq.com>
2021-12-14 09:15:19 +00:00
zhoufan
c3ad945d9b fixes broken tests 2021-12-14 15:57:58 +08:00
zhoufan
7b952cb1aa infer associated method in local scope 2021-12-14 15:34:57 +08:00
bors[bot]
791722b70a
Merge #10998
10998: Add number representation assists r=Veykril a=errx

Reimplemented assists from this PR https://github.com/rust-analyzer/rust-analyzer/pull/3683 with current APIs.
![image](https://user-images.githubusercontent.com/462486/145726792-47700215-26f2-4fdc-9520-63d1487901e5.png)
![image](https://user-images.githubusercontent.com/462486/145726802-f528a2f7-9159-41d3-b459-fc3fae033e60.png)


I've decided not to add options about size of the groups so behaviour is similar to clippy's. 
Minimal number length is also taken from clippy.


Co-authored-by: Oleg Matrokhin <matrokhin@gmail.com>
2021-12-13 18:49:06 +00:00
Oleg Matrokhin
60605a24d4 Reuse results from split_into_parts() 2021-12-13 21:16:04 +03:00
Oleg Matrokhin
8b03b41b7a Add number representation assists 2021-12-13 19:35:38 +03:00
bors[bot]
69500e8c6b
Merge #11002
11002: fix: Add support for v6 macro metadata format r=lnicola a=lnicola

CC https://github.com/rust-analyzer/rust-analyzer/issues/10894#issuecomment-991993824

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-12-13 16:17:14 +00:00
Laurențiu Nicola
e6af1ca718 Add support for v6 macro metadata format 2021-12-13 18:15:22 +02:00
bors[bot]
e1f3982a5f
Merge #11001
11001: minor: fixup generate assist priorities r=Veykril a=Veykril

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/10996
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-12-13 15:51:54 +00:00
bors[bot]
3f550d2e38
Merge #11000
11000: fix: insert whitespaces into assoc items for assist when macro generated r=Veykril a=Veykril

This is obviously only a temporary hack which still produces ugly looking items, but as long as the syntax is valid one can at least have rustfmt fix the formatting again. 
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/6588
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-12-13 15:43:12 +00:00
Lukas Wirth
1cef532c4d minor: fixup generate assist priorities 2021-12-13 16:42:21 +01:00
Lukas Wirth
749eeef3e7 fix: insert whitespaces into assoc items for assist when macro generated 2021-12-13 16:35:32 +01:00
Lukas Wirth
328419534d Move ws insert rendering for macro expansion into ide_db 2021-12-13 15:55:13 +01:00
bors[bot]
db2a7087b9
Merge #10995
10995: internal: switch from trait-based TokenSource to simple struct of arrays r=matklad a=matklad

cc #10765 

The idea here is to try to simplify the interface as best as we can. The original trait-based approach is a bit over-engineered and hard to debug. Here, we replace callback with just data. The next PR in series will replace the output `TreeSink` trait with data as well. 


The biggest drawback here is that we now require to materialize all parser's input up-front. This is a bad fit for macro by example: when you parse `$e:expr`, you might consume only part of the input. However, today's trait-based solution doesn't really help -- we were already materializing the whole thing! So, let's keep it simple!

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-12-12 16:38:56 +00:00
Aleksey Kladov
3b5b988526 prettyfy 2021-12-12 19:36:14 +03:00