Commit Graph

17052 Commits

Author SHA1 Message Date
Lukas Wirth
90230e882d Tag Self in impls as a TypeAlias 2021-05-16 15:12:58 +02:00
Aleksey Kladov
9df0a23368 internal: use standard test style 2021-05-16 15:14:57 +03:00
Aleksey Kladov
e4a7b44e55 internal: use mutable trees when filling match arms 2021-05-16 15:10:18 +03:00
Aleksey Kladov
4e142757e1 minor: use uniform names 2021-05-16 14:18:49 +03:00
bors[bot]
a57bd59f35
Merge #8813
8813: Get some more array lengths! r=lf- a=lf-

This is built on #8799 and thus contains its changes. I'll rebase it onto master when that one gets merged. It adds support for r-a understanding the length of:

* `let a: [u8; 2] = ...`
* `let a = b"aaa"`
* `let a = [0u8; 4]`

I have added support for getting the values of byte strings, which was not previously there. I am least confident in the correctness of this part and it probably needs some more tests, as we currently have only one test that exercised that part (!).

Fixes #2922.

Co-authored-by: Jade <software@lfcode.ca>
2021-05-16 01:53:12 +00:00
Jade
de0ed9860d Address final feedback
* rename ConstExtension->ConstExt
* refactor a manual construction of a Const
2021-05-15 18:51:18 -07:00
bors[bot]
92abc56bc9
Merge #8848
8848: Attach comments to ast::Impl r=Veykril a=Veykril

bors r+
Fixes #8847

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-05-15 15:32:54 +00:00
Lukas Wirth
4b5b54279a Attach comments to ast::Impl 2021-05-15 17:32:28 +02:00
Lukas Wirth
3da52d2e93 simplify 2021-05-15 17:22:39 +02:00
hi-rustin
f5ea2a2ab0 Remove attrs 2021-05-15 21:12:06 +08:00
hi-rustin
696a8bf870 Address comments and add more tests
Fix tests

Fmt code
2021-05-15 20:44:45 +08:00
hi-rustin
3f0222565d Generate the impl block via generate_trait_impl_text 2021-05-15 11:29:33 +08:00
bors[bot]
87ef340c19
Merge #8843
8843: minor: simplify r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-05-14 23:10:39 +00:00
Lukas Wirth
5b247780d4 simplify 2021-05-15 01:09:53 +02:00
bors[bot]
e5e6c363dc
Merge #8840
8840: fix: false positive "Missing match arm" when a tuple pattern is shorter than scrutinee type. r=Veykril a=iDawer

![Screenshot_20210515_003035](https://user-images.githubusercontent.com/7803845/118320023-2bcb7380-b4eb-11eb-9de6-d8762f981dc2.jpg)
Match checking diagnostic shouldn't fire when there is type mismatches.

rust-analyzer fd109fb58 2021-05-10 dev

(This is part of the preparation for https://github.com/rust-analyzer/rust-analyzer/pull/8717)

Co-authored-by: Dawer <7803845+iDawer@users.noreply.github.com>
2021-05-14 19:57:52 +00:00
Dawer
2abb4c99fe Fix false positive "Missing match arm". 2021-05-15 00:18:59 +05:00
bors[bot]
260bcd942b
Merge #8839
8839: minor: more useful bench r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-05-14 17:24:39 +00:00
Aleksey Kladov
ee1c23c78c minor: more useful bench 2021-05-14 20:23:29 +03:00
bors[bot]
e7b8e6fbca
Merge #8819
8819: Use package root as `cargo check` working directory r=matklad a=bcully

Cargo commands are affected by the `.cargo/config` files above
their working directory. If cargo is invoked from above the directory
holding `Cargo.toml`, it may not pick up important settings like
registry replacements, causing it to behave differently or even fail.

Most cargo invocations are currently setting their working directories
to the directory containing `Cargo.toml`, but a couple of paths remain
in which cargo is invoked from the default workspace root instead.

This change fixes that, resolving some cargo check failures that I
experienced in a multi-root workspace in which packages used different
registries.

Co-authored-by: Brendan Cully <brendan@cully.org>
2021-05-14 17:15:21 +00:00
bors[bot]
6c0f20d79f
Merge #8838
8838: internal: use more mutable APIs r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-05-14 17:01:05 +00:00
Aleksey Kladov
883dd1568f internal: use more mutable APIs 2021-05-14 20:00:35 +03:00
bors[bot]
a32589f773
Merge #8837
8837: internal: rewrite assoc item manipulaion to use mutable trees r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-05-14 15:54:38 +00:00
Aleksey Kladov
6c21d04307 internal: use standard style for tests 2021-05-14 18:53:53 +03:00
Aleksey Kladov
cea589b3b5 internal: rewrite assoc item manipulaion to use mutable trees 2021-05-14 18:47:08 +03:00
Aleksey Kladov
73123a7550 internal: remove SyntaxRewriter 2021-05-14 16:40:11 +03:00
Aleksey Kladov
873717190d internal: remove more of the SyntaxRewriter 2021-05-14 16:28:59 +03:00
Aleksey Kladov
0650f77dd9 internal: remove one more immutable tree 2021-05-14 16:19:27 +03:00
bors[bot]
ab528e85f7
Merge #8831
8831: Apply async semantic token modifier to async/await keywords r=Veykril a=hi-rustin

close https://github.com/rust-analyzer/rust-analyzer/issues/8633

Co-authored-by: hi-rustin <rustin.liu@gmail.com>
2021-05-14 09:50:36 +00:00
hi-rustin
765ccf2eca Address comments 2021-05-14 17:47:16 +08:00
Jade
78d6b88f21 Add more tests, refactor array lengths/consteval work
Fix #2922: add unknown length as a condition for a type having unknown.

Incorporate reviews:

* Extract some of the const evaluation workings into functions
* Add fixmes on the hacks
* Add tests for impls on specific array lengths (these work!!! 😁)
* Add tests for const generics (indeed we don't support it yet)
2021-05-14 01:39:28 -07:00
hi-rustin
b98c119ba6 Apply async semantic token modifier to async/await keywords
Only async semantic token modifier
2021-05-14 10:47:00 +08:00
bors[bot]
9803a9a148
Merge #8830
8830: feat: Implement bulitin macro `concat_idents` r=edwin0cheng a=edwin0cheng

cc  #8828

bors r+

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2021-05-13 22:44:34 +00:00
Edwin Cheng
bbc151ef32 Implement concat_idents 2021-05-14 06:42:10 +08:00
bors[bot]
9c8c72b7c4
Merge #8822
8822: minor: Cleanup imports r=Veykril a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-05-13 20:38:56 +00:00
bors[bot]
1552fdd3bc
Merge #8814
8814: fix: Keep doc comments and outer attrs on "Move module to file" assist r=Veykril a=Jesse-Bakker

Fixes #8804


Co-authored-by: Jesse Bakker <github@jessebakker.com>
2021-05-13 17:37:52 +00:00
bors[bot]
908cd23f81
Merge #8820
8820: fix: Return absolute paths in find_path if crate start is ambiguous r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-05-13 16:48:11 +00:00
bors[bot]
c9c9b4e9ed
Merge #8823
8823: Enable OPTION::ENABLE_TASKLISTS in pulldown_cmark r=Veykril a=Veykril

Closes #8821

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-05-13 16:41:25 +00:00
bors[bot]
38a53c29ea
Merge #8825
8825: Corrected minor typo on line 20 r=lnicola a=mixio



Co-authored-by: mixio <38652479+mixio@users.noreply.github.com>
2021-05-13 16:31:42 +00:00
mixio
0cb5443455
Corrected minor typo on line 20 2021-05-13 18:29:48 +02:00
Lukas Wirth
07fe9a890d Enable OPTION::ENABLE_TASKLISTS in pulldown_cmark 2021-05-13 15:09:46 +02:00
Aleksey Kladov
ad0648dc95 Cleanup imports 2021-05-13 13:44:47 +03:00
Jesse Bakker
8c95b205a2 fix: Keep doc comments and outer attrs on "Move module to file" assist 2021-05-13 07:51:00 +02:00
Jade
32c600664e Test lowering byte strings some more 2021-05-12 21:22:46 -07:00
Jade
e666589e63 Add support for lengths in array repeats, if they are literals
Now we will get the type of `[0u8; 4]`.
2021-05-12 21:22:46 -07:00
Jade
73023c0299 Support length for ByteStrings
I am not confident that my added byte string parsing is right.
2021-05-12 21:22:46 -07:00
Jade
8b147624ff Add lowering of array lengths in types
Now e.g.

```rust
fn a(b: [u8; 2]) {
}
```

will know about the length of b.
2021-05-12 21:22:46 -07:00
Brendan Cully
c4664609ed Use package root as cargo check working directory
Cargo commands are affected by the `.cargo/config` files above
their working directory. If cargo is invoked from above the directory
holding `Cargo.toml`, it may not pick up important settings like
registry replacements, causing it to behave differently or even fail.

Most cargo invocations are currently setting their working directories
to the directory containing `Cargo.toml`, but a couple of paths remain
in which cargo is invoked from the default workspace root instead.

This change fixes that, resolving some cargo check failures that I
experienced in a multi-root workspace in which packages used different
registries.
2021-05-12 19:50:52 -07:00
Lukas Wirth
69e0b10150 Return absolute paths in find_path if crate start is ambiguous 2021-05-13 02:53:32 +02:00
bors[bot]
312f1fe20a
Merge #8799
8799: Add basic support for array lengths in types r=flodiebold a=lf-

This recognizes `let a = [1u8, 2, 3]` as having type `[u8; 3]` instead
of the previous `[u8; _]`. Byte strings and `[0u8; 2]` kinds of range
array declarations are unsupported as before.

I don't know why a bunch of our rustc tests had single quotes inside
strings un-escaped by `UPDATE_EXPECT=1 cargo t`, but I don't think it's
bad? Maybe something in a nightly?

Co-authored-by: Jade <software@lfcode.ca>
2021-05-12 14:49:43 +00:00
bors[bot]
1c927d2f8e
Merge #8802
8802: Keep comments and attrs when extracting struct from enum variant r=Veykril a=DropDemBits

Fixes #6730

Still unsure if existing visibilities of fields should be forced to pub (which is what was previously done), or if it's okay to keep it in the extracted struct.

Co-authored-by: DropDemBits <r3usrlnd@gmail.com>
2021-05-12 14:42:01 +00:00